The Official Go SDK for Cobo WaaS API
About
This repository contains the official Go SDK for Cobo WaaS API, enabling developers to integrate with Cobo's Custodial
and/or MPC services seamlessly using the Go programming language.
Documentation
To access the API documentation, navigate to
the API references.
For more information on Cobo's Go SDK, refer to
the Go SDK Guide.
Usage
Before You Begin
Ensure that you have created an account and configured Cobo's Custodial and/or MPC services.
For detailed instructions, please refer to
the Quickstart guide.
Requirements
Go 1.18 or newer.
Installation
add dependency
go get github.com/CoboGlobal/cobo-go-api@v0.56.0
Code Sample
Generate Key Pair
import "github.com/CoboGlobal/cobo-go-api/cobo_custody"
apiSecret, apiKey := cobo_custody.GenerateKeyPair()
println("API_SECRET:", apiSecret)
println("API_KEY:", apiKey)
For more information on the API key, please click here.
Initialize ApiSigner
ApiSigner
can be instantiated through
import "github.com/CoboGlobal/cobo-go-api/cobo_custody"
var localSigner = cobo_custody.LocalSigner{
PrivateKey: "apiSecret",
}
In some cases, your private key cannot be exported, for example, your private key is in aws kms, you should pass in your own implementation by implements ApiSigner
interface
Initialize RestClient
import "github.com/CoboGlobal/cobo-go-api/cobo_custody"
var client = cobo_custody.Client{
Signer: localSigner,
Env: cobo_custody.Dev(),
}
Complete Code Sample
import (
"fmt"
"github.com/CoboGlobal/cobo-go-api/cobo_custody"
)
apiSecret, apiKey := cobo_custody.GenerateKeyPair()
fmt.Println("API_SECRET:", apiSecret)
fmt.Println("API_KEY:", apiKey)
var localSigner = cobo_custody.LocalSigner{
PrivateKey: apiSecret,
}
var client = cobo_custody.Client{
Signer: localSigner,
Env: cobo_custody.Dev(),
}
var res, error_msg = client.GetAccountInfo()
fmt.Println(res)
fmt.Println(error_msg)