Skip to content

Repository files navigation

About

Incomplete Client Library for Frequency written in Kotlin. It wraps substrate-client-java with specific methods for interaction with the Frequency blockchain.

Building Locally

Install Prerequisites

  1. Install asdf tools version manager. Make sure to follow instructions for your shell (e.g. ZSH, Fish, etc.) and package manager (e.g. Homebrew)

    • Install the Rust plugin.
    • Install the Java plugin.
    • Then, run asdf install at the root of the repo to install tools listed in /.tool-versions.
    • Verify your local Java version matches what's in /.tool-versions. If they don't match check the $PATH env var to ensure ~/.asdf/shims directory has precedence over others.
      java -version
      cat .tool-versions
  2. Install Docker Desktop, an application for managing Docker containers and images along with docker CLI tools.

    Note: If using fish shell you'd need to update the $PATH manually with this command, so docker executables can be found and restart the shell:

    set -U fish_user_paths /Applications/Docker.app/Contents/Resources/bin $fish_user_paths

Build and Publish

  1. Build project.

    ./gradlew clean build
  2. Publish compile artifacts to the local Maven cache, so other apps (e.g. Custodial Wallet) can consume it.
    Please note, this step is optional and only needed if you, as a developer, made changes to it and want to see those changes in a consuming app. Otherwise, you can skip it if you are just trying to build things out for the first time.

    ./gradlew publishToMavenLocal

Clean up Built Artifacts

To delete compiled artifacts in local build directories:

./gradlew clean

To verify all compiled artifacts have been deleted run this command in the repo root:

find . -type d -name "build"
---
(should be empty output)

Adding New Scale Data Structures (e.g., Extrinsics)

  1. Navigate to the frequency rust docs and find the definition:
    • For extrinsics, identify the function signature to see the types being used.
    • For other data structures there is generally a struct definition.
  2. Create a new class:
    • For extrinsics: io.amplica.frequency.client.pallet.[module].call.[extrinsic].java
    • For return types: io.amplica.frequency.client.pallet.[module].[type].java
    • For events: io.amplica.frequency.client.pallet.[module].[module].java
    • For payloads: io.amplica.frequency.signing_service.[payload].java
      • These are generally included inside extrinsics and signed over, e.g., AddKeyDataPayload
  3. Enumerate the properties in the extrinsic, using the correct types:
    • AccountId -> com.strategyobject.substrateclient.rpc.api.AccountId
    • BlockNumberFor<T> ->
    • MessageSourceId -> io.amplica.frequency.client.pallet.msa.MessageSourceId
    • MultiSignature -> long with annotation @Scale(ScaleType.U32.class)
      • byte (representing the signature type)
      • com.strategyobject.substrateclient.crypto.SignatureData (representing signature data) ...

How to Release

  1. Check that main is building https://github.com/AmplicaLabs/saas-frequency-client/actions
  2. Go to main: git checkout main && git pull --rebase
  3. Look in build.gradle.kts for the current version, in theory we are just removing SNAPSHOT here but check that git tag hasn't already used that non-SNAPSHOT version
  4. Once all that is settled remove -SNAPSHOT and check that into main with a message something like "Preparing next release 1.0.9"
  5. Monitor the build at https://github.com/AmplicaLabs/saas-frequency-client/actions and wait for it to finish successfully
  6. Tag the build for the next release, it should be git tag vX.Y.Z where X.Y.Z match the non-SNAPSHOT version in step 3 that you just checked into build.gradle.kts
  7. Push the tag up git push --tags
  8. Monitor the build at https://github.com/AmplicaLabs/saas-frequency-client/actions
  9. When it finishes successfully check that you have the published artifact at https://github.com/AmplicaLabs/saas-frequency-client/packages
  10. Update build.gradle.kts to whatever version for the next iteration and check that into main with a message something like "Preparing for next iteration 1.0.10-SNAPSHOT"
  11. Monitor the build at https://github.com/AmplicaLabs/saas-frequency-client/actions until it succeeds and when that happens you are done

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages