stackshelper

package
v1.4.549 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StacksURL                = "https://api.mainnet.hiro.so"
	DefaultSleepBetweenCalls = 1000  // ms
	DefaultRefreshDelay      = 10000 // ms
	MaxPageLimit             = 50
)

Variables

This section is empty.

Functions

func DeserializeCVUint

func DeserializeCVUint(src []byte) (*big.Int, error)

DeserializeCVUint converts a clarity 128-bit uint value into a `big.Int`.

func SerializeCVTuple

func SerializeCVTuple(tuple CVTuple) []byte

SerializeCVTuple converts a clarity value tuple into its binary representation that can be used to call stacks smart contract functions.

func SerializeCVUint added in v1.4.544

func SerializeCVUint(value *big.Int) []byte

SerializeCVUint converts a `big.Int` instance into Clarity value binary representation.

Types

type AddressTransaction

type AddressTransaction struct {
	Tx Transaction `json:"tx"`
}

type Block

type Block struct {
	Height         int    `json:"height"`
	Hash           string `json:"hash"`
	BlockTime      int    `json:"block_time"`
	BlockTimeISO   string `json:"block_time_iso"`
	IndexBlockHash string `json:"index_block_hash"`
	TxCount        int    `json:"tx_count"`
}

type CVTuple

type CVTuple map[string][]byte

func DeserializeCVTuple

func DeserializeCVTuple(src []byte) (CVTuple, error)

DeserializeCVTuple converts binary representation of a clarity value tuple into a `CVTuple` map. IMPORTANT: this function supports a limited amount of Clarity types at the moment, therefore it should NOT be used as a complete solution to deserialize any arbitrary Clarity tuple.

type ClarityValue added in v1.4.544

type ClarityValue struct {
	Hex  string `json:"hex"`
	Repr string `json:"repr"`
}

type ContractCall

type ContractCall struct {
	ContractID   string        `json:"contract_id"`
	FunctionName string        `json:"function_name"`
	FunctionArgs []FunctionArg `json:"function_args"`
}

type ContractLog added in v1.4.544

type ContractLog struct {
	ContractID string       `json:"contract_id"`
	Topic      string       `json:"topic"`
	Value      ClarityValue `json:"value"`
}

type DataMapEntry

type DataMapEntry struct {
	Data  string `json:"data"`
	Proof string `json:"proof"`
}

type Event added in v1.4.544

type Event struct {
	Index       int         `json:"event_index"`
	Type        string      `json:"event_type"`
	ContractLog ContractLog `json:"contract_log"`
}

type FunctionArg

type FunctionArg struct {
	ClarityValue
	Name string `json:"name"`
	Type string `json:"type"`
}

type GetAddressTransactionsResponse

type GetAddressTransactionsResponse struct {
	Limit   int                  `json:"limit"`
	Offset  int                  `json:"offset"`
	Total   int                  `json:"total"`
	Results []AddressTransaction `json:"results"`
}

type GetBlockTransactionsResponse

type GetBlockTransactionsResponse struct {
	Limit   int           `json:"limit"`
	Offset  int           `json:"offset"`
	Total   int           `json:"total"`
	Results []Transaction `json:"results"`
}

type StacksClient

type StacksClient struct {
	// contains filtered or unexported fields
}

func NewStacksClient

func NewStacksClient(logger *logrus.Entry, sleepBetweenCalls time.Duration, hiroAPIKey string, isDebug bool) *StacksClient

func (*StacksClient) GetAddressTransactions

func (c *StacksClient) GetAddressTransactions(address string, limit, offset int) (GetAddressTransactionsResponse, error)

func (*StacksClient) GetAllBlockTransactions

func (c *StacksClient) GetAllBlockTransactions(height int) ([]Transaction, error)

func (*StacksClient) GetDataMapEntry

func (c *StacksClient) GetDataMapEntry(contractId, mapName, key string) ([]byte, error)

func (*StacksClient) GetLatestBlock

func (c *StacksClient) GetLatestBlock() (Block, error)

func (*StacksClient) GetTransactionAt

func (c *StacksClient) GetTransactionAt(txID string) (Transaction, error)

type Transaction

type Transaction struct {
	TxID          string       `json:"tx_id"`
	SenderAddress string       `json:"sender_address"`
	BlockHash     string       `json:"block_hash"`
	BlockHeight   int          `json:"block_height"`
	BlockTime     int          `json:"block_time"`
	TxStatus      string       `json:"tx_status"`
	TxType        string       `json:"tx_type"`
	TxResult      ClarityValue `json:"tx_result"`
	ContractCall  ContractCall `json:"contract_call"`
	Events        []Event      `json:"events"`
}

Jump to

Keyboard shortcuts

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