An SDK for Sila written in Golang.
This project creates a native SDK for the Sila API in Golang. To learn more about Sila and how it works, please go to
their website as well as read the documentation.
The current version of this library implements the following endpoints according to the Sila API v0.2.
To use the Sila SDK, first import:
import "github.com/bpancost/sila"
From there, create a new client by using
// The the auth private key as a hex string, without the "0x" prefixed
privateKeyHex := "badba7368134dcd61c60f9b56979c09196d03f5891a20c1557b1afac0202a97c"
// The handle associated with your auth account
authHandle := "handle.silamoney.eth"
// A production client can be created by using sila.Production instead of sila.Sandbox
client, err := sila.NewClient(privateKeyHex, authHandle, sila.Sandbox)
With the client, it is possible to make any of the included calls. Each is a chainable series of method calls, ending
with a call to the Do
method. For example, to get a list of entities you could use
response, err := silaClient.GetEntities().
SetPage(1).
SetPerPage(20).
Do()
There are several functions within the github.com/bpancost/sila
package which can be used to manipulate or create keys
for wallets, which will be required for certain calls.
GenerateNewPrivateKey() (string, error)
GetWalletAddress(privateKeyHex string) (string, error)
GenerateWalletSignature(message []byte, walletPrivateKeyHex string) (string, error)
To use the included integration tests, create a file named test_config.yaml
using the test_config_sample.yaml
as a
template. Provide your auth key as a hex string, your auth handle, a unique user handle specifically for this testing,
and a private key as a hex string for the integration user’s wallet which will be their main wallet. You can use a tool
like Vanity-Eth to help generate a new wallet address and private key.
Most tests will complete quickly, though the transaction tests require several minute sleeps to verify they completed
and will take around 10 minutes to complete.
If you would like to view the integration test progress via a web page, you can use goconvey
from a terminal and then
navigate to http://127.0.0.1:8080.