otyang / fireblocks-sdk-golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fireblocks SDK in Go (golang)

This SDK provides Golang bindings for interacting with blockchains through Fireblocks, enabling you to manage vault accounts, transactions, webhooks, and more. This isnt meant to be a full sdk, but a streamlined one with only function needed at this point

Available Actions at this point

  • VaultService:
    • Create vault accounts
    • Create asset wallets and addresses
    • Find vault accounts by ID
  • TransactionService:
    • Estimate transaction fees
    • Create transactions
    • Find transactions by ID or external transaction ID
  • WebhookService:
    • Resend failed webhooks
    • Verify webhook transactions
  • CustomFlowSVC:
    • Streamlined methods for address creation and sending transactions

Installation

go get github.com/otyang/fireblocks-sdk-golang.git

Usage

  1. Import the SDK:
import (
    "github.com/otyang/fireblocks/client"
    "github.com/otyang/fireblocks/transaction"
    "github.com/otyang/fireblocks/vault"
    "github.com/otyang/fireblocks/webhook"
)
  1. Create a Fireblocks client:
fireblocks, err := New(client.ConfigApiKey,  client.ConfigPrivateKey, client.ConfigBaseURL, true)

Usage:

 
func main() {
    client.ConfigApiKey = "api-key"
    client.ConfigPrivateKey = "private-key"
    client.ConfigBaseURL = "https://sandbox-api.fireblocks.io"
    client.ConfigDebugMode =  true

    fireblocks, err := New(client.ConfigApiKey,  client.ConfigPrivateKey, client.ConfigBaseURL, client.ConfigDebugMode) 
    if err != nil {
        return err
    }

    // Create a vault account
	vault, err := fireblocks.Vault.FindVaultAccountByID(context.Background(), "1")
    if err != nil {
        return err
    }
    // .....

    feeResponse, err := client.Transaction.EstimateFeeForSendingToExternalAddress(
        ctx context.Context, assetID, amount, treatAsGrossAmount,
    )

    // ... (other examples for transactions, webhooks, etc.)
}

Running Tests

To run tests on the endpoint, run the following command

  go test -v

Or use make command to run all test at a go

  make

Documentation

Contributing

Contributions are welcome! Please follow the contributing guidelines.

License

This SDK is licensed under the MIT License.

About


Languages

Language:Go 99.5%Language:Makefile 0.5%