Skip to content

diem/client-sdk-go

Note to readers: On December 1, 2020, the Diem Association was renamed to Diem Association. The project repos are in the process of being migrated. All projects will remain available for use here until the migration to a new GitHub Organization is complete.

client-sdk-go

API Reference Apache V2 License

client-sdk-go is the official Diem Client SDK for the Go programming language.

Overview of SDK's Packages

  • diemclient: diem JSON-RPC APIs client
  • jsonrpc: a JSON-RPC 2.0 SPEC client
  • diemkeys: keys utils, including generating public & private keys for testing, creating auth key and account address from public key.
  • diemsigner: sign transaction logic
  • txnmetadata: utils for creating peer to peer transaction metadata. (LIP-4)
  • diemid: encoding & decoding Diem Account Identifier and Intent URL. (LIP-5)
  • testnet: testnet utils
  • stdlib: move stdlib script utils. This is generated code, for constructing transaction script playload.
  • diemtypes: Diem on-chain data structure types. Mostly generated code with small extension code for attaching handy functions to generated types.
  • examples: examples of how to use this SDK.
    • submit transaction and wait: this example shows how to submit a transaction and wait for its result; it also shows how to handle a stale response error in various cases.
    • create child VASP account: this example shows how to create ChildVASP account for a ParentVASP account.
    • p2p transfer: this example shows 4 different types of p2p transfers between custodial accounts and non-custodial accounts.
    • intent identifier: this example shows how to use diemid for encoding and decoding the intent identifier / url.

Installing

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.

go get github.com/diem/client-sdk-go

To update the SDK use go get -u to retrieve the latest version of the SDK.

go get -u github.com/diem/client-sdk-go

Development

Run test

make test

Generate diemtypes & move stdlib script encoder & decoder

git submodule update
make gen

Upgrade diemtypes and move stdlib

git submodule update
cd diem
git pull origin master
cd ..
make gen

API Documentation

The Go Client SDK API documentation is currently available at godoc.org.

License

Apache License V2

Contributing

CONTRIBUTING