websocket

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressBalanceNotification

type AddressBalanceNotification struct {
	Address string `json:"address"`
	Balance string `json:"balance"`
}

type AddressTransactionSubscriptionParams

type AddressTransactionSubscriptionParams struct {
	Event   string `json:"event"`
	Address string `json:"address"`
}

func (AddressTransactionSubscriptionParams) GetEvent

type AddressTxNotification

type AddressTxNotification struct {
	Address     string      `json:"address"`
	Transaction Transaction `json:"tx"`
}

type AddressTxUpdate

type AddressTxUpdate struct {
	Address      string          `json:"address"`
	TxID         string          `json:"tx_id"`
	TxStatus     string          `json:"tx_status"`
	TxType       string          `json:"tx_type"`
	Tx           TransactionInfo `json:"tx"`
	StxSent      string          `json:"stx_sent"`
	StxReceived  string          `json:"stx_received"`
	StxTransfers []StxTransfer   `json:"stx_transfers"`
}

type AddressTxUpdateEvent

type AddressTxUpdateEvent struct {
	Method string          `json:"method"`
	Params AddressTxUpdate `json:"params"`
}

type Block

type Block struct {
	Hash                     string         `json:"hash"`
	BurnBlockHash            string         `json:"burn_block_hash"`
	ParentBlockHash          string         `json:"parent_block_hash"`
	Height                   int            `json:"height"`
	BurnBlockTime            int            `json:"burn_block_time"`
	BlockTime                int            `json:"block_time"`
	Canonical                bool           `json:"canonical"`
	TenureHeight             int            `json:"tenure_height"`
	IndexBlockHash           string         `json:"index_block_hash"`
	ParentMicroblockHash     string         `json:"parent_microblock_hash"`
	ParentMicroblockSequence int            `json:"parent_microblock_sequence"`
	Txs                      []string       `json:"txs"`
	MicroblocksAccepted      []interface{}  `json:"microblocks_accepted"`
	MicroblocksStreamed      []interface{}  `json:"microblocks_streamed"`
	ExecutionCostReadCount   int            `json:"execution_cost_read_count"`
	ExecutionCostReadLength  int            `json:"execution_cost_read_length"`
	ExecutionCostRuntime     int            `json:"execution_cost_runtime"`
	ExecutionCostWriteCount  int            `json:"execution_cost_write_count"`
	ExecutionCostWriteLength int            `json:"execution_cost_write_length"`
	MicroblockTxCount        map[string]int `json:"microblock_tx_count"`
}

type BlockEvent

type BlockEvent struct {
	Method string `json:"method"`
	Params struct {
		Canonical       bool     `json:"canonical"`
		Height          int      `json:"height"`
		Hash            string   `json:"hash"`
		Txs             []string `json:"txs"`
		BlockTime       int64    `json:"block_time"`
		BurnBlockHeight int      `json:"burn_block_height"`
	} `json:"params"`
}

type BlockSubscriptionParams

type BlockSubscriptionParams struct {
	Event string `json:"event"`
}

func (BlockSubscriptionParams) GetEvent

func (p BlockSubscriptionParams) GetEvent() string

type Client

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

func NewClient

func NewClient(apiURL string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) SubscribeAddressTransactions

func (c *Client) SubscribeAddressTransactions(ctx context.Context, address string) (<-chan AddressTxUpdateEvent, error)

func (*Client) SubscribeBlocks

func (c *Client) SubscribeBlocks(ctx context.Context) (<-chan BlockEvent, error)

func (*Client) SubscribeMempool

func (c *Client) SubscribeMempool(ctx context.Context) (<-chan MempoolEvent, error)

type ContractCall

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

type ContractLogEvent

type ContractLogEvent struct {
	ContractID string          `json:"contract_id"`
	Topic      string          `json:"topic"`
	Value      json.RawMessage `json:"value"`
}

type ExecutionCost

type ExecutionCost struct {
	ReadCount   int `json:"execution_cost_read_count"`
	ReadLength  int `json:"execution_cost_read_length"`
	Runtime     int `json:"execution_cost_runtime"`
	WriteCount  int `json:"execution_cost_write_count"`
	WriteLength int `json:"execution_cost_write_length"`
}

type FunctionArg

type FunctionArg struct {
	Hex  string `json:"hex"`
	Repr string `json:"repr"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type MempoolEvent

type MempoolEvent struct {
	Method string `json:"method"`
	Params struct {
		TxID        string `json:"tx_id"`
		Status      string `json:"tx_status"`
		ReceiptTime int64  `json:"receipt_time"`
	} `json:"params"`
}

type MempoolSubscriptionParams

type MempoolSubscriptionParams struct {
	Event string `json:"event"`
}

func (MempoolSubscriptionParams) GetEvent

func (p MempoolSubscriptionParams) GetEvent() string

type MempoolTransaction

type MempoolTransaction struct {
	TxID     string `json:"tx_id"`
	TxStatus string `json:"tx_status"`
}

type Microblock

type Microblock struct {
	MicroblockHash string   `json:"microblock_hash"`
	ParentHash     string   `json:"parent_hash"`
	Sequence       int      `json:"sequence"`
	TxIDs          []string `json:"txs"`
}

type NFTEvent

type NFTEvent struct {
	EventType       string `json:"event_type"`
	AssetIdentifier string `json:"asset_identifier"`
	Sender          string `json:"sender"`
	Recipient       string `json:"recipient"`
	Value           struct {
		Hex  string `json:"hex"`
		Repr string `json:"repr"`
		Type string `json:"type"`
	} `json:"value"`
}

type StacksEvent

type StacksEvent struct {
	Type  string          `json:"type"`
	Value json.RawMessage `json:"value"`
}

type StxTransfer

type StxTransfer struct {
	Amount    string `json:"amount"`
	Sender    string `json:"sender"`
	Recipient string `json:"recipient"`
}

type SubscriptionParams

type SubscriptionParams interface {
	GetEvent() string
}

type Transaction

type Transaction struct {
	TxID        string `json:"tx_id"`
	TxStatus    string `json:"tx_status"`
	BlockHeight int    `json:"block_height"`
}

type TransactionInfo

type TransactionInfo struct {
	TxID                string        `json:"tx_id"`
	Nonce               int           `json:"nonce"`
	FeeRate             string        `json:"fee_rate"`
	SenderAddress       string        `json:"sender_address"`
	Sponsored           bool          `json:"sponsored"`
	PostConditionMode   string        `json:"post_condition_mode"`
	PostConditions      []interface{} `json:"post_conditions"`
	AnchorMode          string        `json:"anchor_mode"`
	IsUnanchored        bool          `json:"is_unanchored"`
	BlockHash           string        `json:"block_hash"`
	ParentBlockHash     string        `json:"parent_block_hash"`
	BlockHeight         int           `json:"block_height"`
	BlockTime           int64         `json:"block_time"`
	BlockTimeISO        string        `json:"block_time_iso"`
	BurnBlockHeight     int           `json:"burn_block_height"`
	BurnBlockTime       int64         `json:"burn_block_time"`
	BurnBlockTimeISO    string        `json:"burn_block_time_iso"`
	Canonical           bool          `json:"canonical"`
	TxIndex             int           `json:"tx_index"`
	TxStatus            string        `json:"tx_status"`
	TxResult            TxResult      `json:"tx_result"`
	MicroblockHash      string        `json:"microblock_hash"`
	MicroblockSequence  int           `json:"microblock_sequence"`
	MicroblockCanonical bool          `json:"microblock_canonical"`
	EventCount          int           `json:"event_count"`
	Events              []StacksEvent `json:"events"`
	ExecutionCost       ExecutionCost `json:"execution_cost"`
	TxType              string        `json:"tx_type"`
	ContractCall        *ContractCall `json:"contract_call,omitempty"`
}

type TxResult

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

Jump to

Keyboard shortcuts

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