README

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.
    • refund: this example shows peer to peer transfers from custodial accounts to non-custodial accounts, and then refunds the amount.
    • 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

Expand ▾ Collapse ▴

Directories

Path Synopsis
Provides Diem JSON-RPC API client, see https://github.com/diem/diem/blob/master/json-rpc/json-rpc-spec.md for more details.
Provides Diem JSON-RPC API client, see https://github.com/diem/diem/blob/master/json-rpc/json-rpc-spec.md for more details.
diemclienttest
Provides builders for creating JSON-RPC response result in test.
Provides builders for creating JSON-RPC response result in test.
Provides utility functions for Diem Intent Identifier and Account Identifier (https://github.com/diem/lip/blob/master/lips/lip-5.md)
Provides utility functions for Diem Intent Identifier and Account Identifier (https://github.com/diem/lip/blob/master/lips/lip-5.md)
bech32
Package bech32 reference implementation for Bech32 and segwit addresses.
Package bech32 reference implementation for Bech32 and segwit addresses.
Provides Diem JSON-RPC API response data types.
Provides Diem JSON-RPC API response data types.
Provides interface for abstracting private key and public key implementations, utility functions for authentication key.
Provides interface for abstracting private key and public key implementations, utility functions for authentication key.
Provides signing transaction logic.
Provides signing transaction logic.
Provides Diem on-chain data types, utility functions for converting types.
Provides Diem on-chain data types, utility functions for converting types.
examples
Provides a general JSON-RPC client, decodes Diem extension fields.
Provides a general JSON-RPC client, decodes Diem extension fields.
jsonrpctest
Provides a simple json-rpc client stub for testing client without connecting to remote server.
Provides a simple json-rpc client stub for testing client without connecting to remote server.
Provides Diem move language stdlib script encoding and decoding utilities.
Provides Diem move language stdlib script encoding and decoding utilities.
Provides Diem Testnet testing utilities.
Provides Diem Testnet testing utilities.
Provides utility functions for creating peer to peer transaction metadata (https://github.com/diem/lip/blob/master/lips/lip-4.md).
Provides utility functions for creating peer to peer transaction metadata (https://github.com/diem/lip/blob/master/lips/lip-4.md).