Documentation ¶
Index ¶
- type AddressInformation
- type BlockHeader
- type BlockHeaderRequestParameters
- type BlockID
- type BlockTransactionsRequestParameters
- type ExtendedAccountState
- type ExtendedAddress
- type ExtendedAddressInformation
- type LookupBlockRequestParameters
- type MasterchainInfo
- type Message
- type MessageData
- type RunMethodRequest
- type TonCenterClient
- func (t *TonCenterClient) AddressInformation(address string) (AddressInformation, error)
- func (t *TonCenterClient) AddressState(address string) (string, error)
- func (t *TonCenterClient) Balance(address string) (balance decimal.Decimal, err error)
- func (t *TonCenterClient) BlockHeader(workchain int64, shard int64, seqno int64, ...) (BlockHeader, error)
- func (t *TonCenterClient) BlockTransactions(workchain int64, shard int64, seqno int64, ...) ([]BlockID, error)
- func (t *TonCenterClient) ConsensusBlock() (consensusBlock int64, timestamp float64, err error)
- func (t *TonCenterClient) ExtendedAddressInformation(address string) (ExtendedAddressInformation, error)
- func (t *TonCenterClient) LookupBlock(workchain int32, shard int64, options LookupBlockRequestParameters) (BlockID, error)
- func (t *TonCenterClient) MasterchainInfo() (MasterchainInfo, error)
- func (t *TonCenterClient) PackAddress(address string) (string, error)
- func (t *TonCenterClient) RunGetMethod(request RunMethodRequest) (map[string]interface{}, error)
- func (t *TonCenterClient) Shards(seqno int64) ([]BlockID, error)
- func (t *TonCenterClient) Transactions(address string, parameters TransactionsRequestOptions) ([]Transaction, error)
- func (t *TonCenterClient) TryLocateSourceTx(source string, destination string, createdLt int64) (Transaction, error)
- func (t *TonCenterClient) TryLocateTx(source string, destination string, createdLt int64) (Transaction, error)
- func (t *TonCenterClient) UnpackAddress(address string) (string, error)
- func (t *TonCenterClient) WalletInformation(address string) (WalletInformation, error)
- type TonID
- type Transaction
- type TransactionsRequestOptions
- type WalletInformation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressInformation ¶
type AddressInformation struct { Type string `json:"@type"` Balance decimal.Decimal `json:"balance"` Code string `json:"code"` Data string `json:"data"` LastTransactionID TonID `json:"last_transaction_id"` BlockID BlockID `json:"block_id"` FrozenHash string `json:"frozen_hash"` SyncUtime int64 `json:"sync_utime"` Extra string `json:"@extra"` State string `json:"state"` }
AddressInformation
type BlockHeader ¶
type BlockHeader struct { Type string `json:"@type"` ID BlockID `json:"id"` GlobalID int64 `json:"global_id"` Version int64 `json:"version"` AfterMerge bool `json:"after_merge"` AfterSplit bool `json:"after_split"` BeforeSplit bool `json:"before_split"` WantMerge bool `json:"want_merge"` WantSplit bool `json:"want_split"` ValidatorListHashShort int64 `json:"validator_list_hash_short"` CatchainSeqNo int64 `json:"catchain_seqno"` MinRefMcSeqNo int64 `json:"min_ref_mc_seqno"` IsKeyBlock bool `json:"is_key_block"` PrevKeyBlockSeqNo int64 `json:"prev_key_block_seqno"` StartLt string `json:"start_lt"` EndLt string `json:"end_lt"` VertSeqNo int64 `json:"vert_seqno"` PrevBlocks []BlockID `json:"prev_blocks"` Extra string `json:"@extra"` }
BlockHeader information
type BlockHeaderRequestParameters ¶
BlockHeaderRequestParameters
type BlockID ¶
type BlockID struct { Type string `json:"@type"` Workchaing int32 `json:"workchain"` Shard string `json:"shard"` SeqNo int64 `json:"seqno"` RootHash string `json:"root_hash"` FileHash string `json:"file_hash"` }
BlockID
type BlockTransactionsRequestParameters ¶
type BlockTransactionsRequestParameters struct { RootHash string FileHash string AfterLt int64 AfterHash string Count int32 }
BlockTransactionsRequestParameters
type ExtendedAccountState ¶
type ExtendedAccountState struct { Type string `json:"@type"` WalledID string `json:"walled_id"` SeqNo int64 `json:"seqno"` }
ExtendedAccountState
type ExtendedAddress ¶
ExtendedAddress
type ExtendedAddressInformation ¶
type ExtendedAddressInformation struct { Type string `json:"@type"` Address ExtendedAddress `json:"address"` Balance decimal.Decimal `json:"balance"` LastTransactionID TonID `json:"last_transaction_id"` BlockID BlockID `json:"block_id"` SyncUtime int64 `json:"sync_utime"` AccountState ExtendedAccountState `json:"account_state"` Revision int64 `json:"revision"` Extra string `json:"@extra"` }
ExtendedAddressInformation
type LookupBlockRequestParameters ¶
LookupBlockRequestParameters
type MasterchainInfo ¶
type MasterchainInfo struct { Type string `json:"@type"` LastBlockID BlockID `json:"last"` StateRootHash string `json:"state_root_hash"` InitBlockID BlockID `json:"init"` Extra string `json:"@extra"` }
MasterchainInfo
type Message ¶
type Message struct { Source string `json:"source"` Destination string `json:"destination"` Value decimal.Decimal `json:"value"` ForwardFee decimal.Decimal `json:"fwd_fee"` IhrFee decimal.Decimal `json:"ihr_fee"` CreatedLt string `json:"created_lt"` BodyHash string `json:"body_hash"` Message string `json:"message"` MessageData MessageData `json:"msg_data"` }
Message describes transaction message
type MessageData ¶
MessageData
type RunMethodRequest ¶
type RunMethodRequest struct { Address string `json:"address"` Method string `json:"method"` Stack [][]string `json:"stack"` }
RunMethodRequest contains parameters for run method request
type TonCenterClient ¶
type TonCenterClient struct {
// contains filtered or unexported fields
}
TonCenterClient is the client for toncenter.com HTTP API
func NewTonCenterAnonimousClient ¶
func NewTonCenterAnonimousClient(url string) *TonCenterClient
NewTonCenterAnonimousClient creates new anonymous toncenter HTTP client
func NewTonCenterClient ¶
func NewTonCenterClient(url string, token string) *TonCenterClient
NewTonCenterClient creates new toncenter HTTP client
func (*TonCenterClient) AddressInformation ¶
func (t *TonCenterClient) AddressInformation(address string) (AddressInformation, error)
AddressInformation gets basic information about the address: balance, code, data, last_transaction_id.
func (*TonCenterClient) AddressState ¶
func (t *TonCenterClient) AddressState(address string) (string, error)
AddressState represents the state of an address
func (*TonCenterClient) Balance ¶
func (t *TonCenterClient) Balance(address string) (balance decimal.Decimal, err error)
Balance returns a wallet balance in nanotons
func (*TonCenterClient) BlockHeader ¶
func (t *TonCenterClient) BlockHeader( workchain int64, shard int64, seqno int64, parameters BlockHeaderRequestParameters, ) (BlockHeader, error)
BlockHeader returns metadata of a given block
func (*TonCenterClient) BlockTransactions ¶
func (t *TonCenterClient) BlockTransactions( workchain int64, shard int64, seqno int64, parameters BlockTransactionsRequestParameters, ) ([]BlockID, error)
BlockTransactions returns transactions of the given block
func (*TonCenterClient) ConsensusBlock ¶
func (t *TonCenterClient) ConsensusBlock() (consensusBlock int64, timestamp float64, err error)
ConsensusBlock consensus block and its update timestamp
func (*TonCenterClient) ExtendedAddressInformation ¶
func (t *TonCenterClient) ExtendedAddressInformation(address string) (ExtendedAddressInformation, error)
ExtendedAddressInformation is similar to previous one (AddressInformation) but tries to parse additional information for known contract types. This method is based on tonlib's function getAccountState. For detecting wallets we recommend to use getWalletInformation.
func (*TonCenterClient) LookupBlock ¶
func (t *TonCenterClient) LookupBlock( workchain int32, shard int64, options LookupBlockRequestParameters, ) (BlockID, error)
LookupBlock by either seqno, lt or unix time
func (*TonCenterClient) MasterchainInfo ¶
func (t *TonCenterClient) MasterchainInfo() (MasterchainInfo, error)
MasterchainInfo returns up-to-date masterchain state
func (*TonCenterClient) PackAddress ¶
func (t *TonCenterClient) PackAddress(address string) (string, error)
PackAddress converts an address from raw to human-readable format
func (*TonCenterClient) RunGetMethod ¶
func (t *TonCenterClient) RunGetMethod(request RunMethodRequest) (map[string]interface{}, error)
func (*TonCenterClient) Shards ¶
func (t *TonCenterClient) Shards(seqno int64) ([]BlockID, error)
Shards returns shards information
func (*TonCenterClient) Transactions ¶
func (t *TonCenterClient) Transactions(address string, parameters TransactionsRequestOptions) ([]Transaction, error)
Transactions gets transaction history of a given address
func (*TonCenterClient) TryLocateSourceTx ¶
func (t *TonCenterClient) TryLocateSourceTx(source string, destination string, createdLt int64) (Transaction, error)
TryLocateSourceTx needs to locate incoming transaction of source address by outcoming message.
func (*TonCenterClient) TryLocateTx ¶
func (t *TonCenterClient) TryLocateTx(source string, destination string, createdLt int64) (Transaction, error)
TryLocateTx needs to locate outcoming transaction of destination address by incoming message
func (*TonCenterClient) UnpackAddress ¶
func (t *TonCenterClient) UnpackAddress(address string) (string, error)
UnpackAddress converts an address from human-readable to raw format
func (*TonCenterClient) WalletInformation ¶
func (t *TonCenterClient) WalletInformation(address string) (WalletInformation, error)
WalletInformation retrieves wallet information. This method parses contract state and currently supports more wallet types than getExtendedAddressInformation: simple wallet, standart wallet, v3 wallet, v4 wallet.
type Transaction ¶
type Transaction struct { Address string `json:"address"` Utime int64 `json:"utime"` Data string `json:"data"` TransactionID TonID `json:"transaction_id"` InMessage Message `json:"in_msg"` OurMessages []Message `json:"out_msgs"` Fee decimal.Decimal `json:"fee"` StorageFee decimal.Decimal `json:"storage_fee"` OtherFees []decimal.Decimal `json:"other_fees"` }
Transaction
type TransactionsRequestOptions ¶
type TransactionsRequestOptions struct { // Maximum number of transactions in response Limit int32 // Logical time of transaction to start with, must be sent with hash Lt int64 // Logical time of transaction to finish with (to get tx from lt to to_lt). ToLt int64 // Hash of transaction to start with, in base64 or hex encoding , must be sent with lt Hash string // By default a request is processed by any available liteserver. // If archival=true only liteservers with full history are used Archival bool }
TransactionsRequestOptions contains options for transactions request
type WalletInformation ¶
type WalletInformation struct { Wallet bool `json:"wallet"` Balance decimal.Decimal `json:"balance"` AccountState string `json:"account_state"` WalletType string `json:"wallet_type"` SeqNo int64 `json:"seqno"` LastTransactionID TonID `json:"last_transaction_id"` WalletID uint64 `json:"wallet_id"` }
WalletInformation