go-stacks

module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT

README

go-stacks

Introduction

go-stacks is a golang sdk for interacting with the stacks blockchain. This SDK was generated using the Hiro's OpenAPI specification & API Matic with some modifications. It only has one dependancy, and that dependancy has none.

Requirements

The SDK requires Go version 1.22 or above.

Building

Install Dependencies

Resolve all the SDK dependencies, using the go get command.

TODOs

  • fix and improve testing
  • implement (de)serializing transactions

Quick Start

Note: Documentation for the client can be found here.

package main

import (
	"context"
	"fmt"

	"github.com/cbadawi/go-stacks/stacks"
)

func main() {
	config := stacks.CreateConfiguration(
		stacks.WithBaseUri(stacks.MAINNET_URI),
		stacks.WithVerbose(true),
	)

	principal := "SP3KANBW2C4E5BRPWNTWZCCDGF2F87CW9D9KV0FFK"
	unanchored := false
	untilBlock := "600000"

	client := stacks.NewClient(config)
	accountsController := client.AccountsController()
	ctx := context.Background()

	apiResponse, err := accountsController.GetAccountBalance(ctx, principal, &unanchored, &untilBlock)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(apiResponse.Data.Stx.Balance)
}

List of APIs

Classes Documentation

Directories

Path Synopsis
Package stacks
Package stacks
errors
Package stacks
Package stacks
models
Package stacks
Package stacks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL