Usage

To use the SDK in your Golang project, you must first import it:

import s6 "github.com/thesixnetwork/six-protocol-go-sdk/api"

Creating Client

gasPrice := "1.25usix" // default "1.25usix"
clientOptions := &s6.ClientOptions{
	BroadcastMode: "<broadcast-mode>", // default "block"
	GasPrices:     &gasPrice,
}
client, err := s6.NewClient(
	"<nodeURL>",
	"<armor>",
	"<passphrase>",
	"<chain-id>",
	clientOptions,
)
if err != nil {
	fmt.Println(err)
	return
}

Broadcast Mode

sync: Wait for the transaction to pass/fail the CheckTx async: Do not wait for the transaction to pass/fail the CheckTx. Instead, send and return the transaction immediately. block: Wait for the transaction to pass/fail the CheckTx, DeliverTx, and be committed to a block. (Note: this is not recommended.)

nodeURL: Endpoint URL for SIX Protocol fivenet: https://rpc1.fivenet.sixprotocol.net sixnet: https://sixnet-rpc.sixprotocol.net armor: An encrypted private key use with passphrase as a secret key. passphrase: Together with encrypted private key is used as a secret key. Here is the detail about how to create both armor and passphrase. chain-id: For testnet , the chain id is "fivenet" and "sixnet" for Testnet and Mainnet

Construct Message

Create a message for each service that you need to use. You can find more messages here

Broadcast Transaction

Query

To query the data , you can use read-to-use query client from the constructed client. And for more detail about queries you can use , here is the list.

go.mod

You would need to put the line below at the bottom of your go.mod

Last updated