Documentation
¶
Index ¶
- Variables
- func CalculateAPY(roundExpected, roundBorrowed int64, governanceFee int32) float64
- func CollectAdditionalInfo(ctx context.Context, infoSource InformationSource, trace *Trace) error
- func DistinctAccounts(trace *Trace) []tongo.AccountID
- func GetNftMetaData(nftMetaUrl string) ([]byte, error)
- func PrepareLibraries(ctx context.Context, code *boc.Cell, ...) (string, error)
- func SimpleLibMapToCells(libraries map[string]tlb.SimpleLib) map[tongo.Bits256]*SimpleLib
- func StateInitLibraries(hashmap *tlb.HashmapE[tlb.Bits256, tlb.SimpleLib]) map[tongo.Bits256]*SimpleLib
- func Visit(trace *Trace, fn func(trace *Trace))
- type Account
- type AccountInfo
- type AccountStat
- type AttachedAccount
- type Auction
- type BlockExtra
- type BlockHeader
- type BouncePhaseType
- type Contract
- type Currency
- type CurrencyCollection
- type CurrencyType
- type DecodedMessageBody
- type DedustPool
- type DnsExpiring
- type DomainBid
- type EmulatedTeleitemNFT
- type ExternalAddress
- type ExtraCurrencies
- type ExtraCurrency
- type Filter
- type GenSoftware
- type InformationSource
- type InvoicePayment
- type JettonHolder
- type JettonMaster
- type JettonOperation
- type JettonOperationType
- type JettonTransferPayload
- type JettonWallet
- type JettonWalletLockData
- type LibraryResolver
- type LiquidPool
- type Message
- type MessageID
- type MsgType
- type Multisig
- type MultisigOrder
- type NftCollection
- type NftItem
- type NftOperation
- type NftOperationType
- type NftSaleContract
- type NftSaleInfo
- type Nominator
- type Plugin
- type Price
- type PurchaseMetadata
- type PurchaseMetadataType
- type ReducedBlock
- type STONfiPool
- type STONfiPoolID
- type STONfiVersion
- type SimpleLib
- type StakingImplementation
- type StateUpdate
- type StorageInfo
- type StorageProvider
- type SubscriptionV1
- type SubscriptionV2
- type TFPool
- type Trace
- type TraceAdditionalInfo
- func (info *TraceAdditionalInfo) JettonMaster(jettonWallet tongo.AccountID) (tongo.AccountID, bool)
- func (t *TraceAdditionalInfo) MarshalJSON() ([]byte, error)
- func (info *TraceAdditionalInfo) SetJettonMaster(jettonWallet tongo.AccountID, jettonMaster tongo.AccountID)
- func (t *TraceAdditionalInfo) UnmarshalJSON(data []byte) error
- type TraceID
- type Transaction
- type TransactionID
- type TransactionType
- type TrustType
- type TxAccStatusChange
- type TxActionPhase
- type TxBouncePhase
- type TxComputePhase
- type TxComputeSkipReason
- type TxCreditPhase
- type TxStoragePhase
- type ValueFlow
Constants ¶
This section is empty.
Variables ¶
var ErrEntityNotFound = errors.New("entity not found")
var ErrNotKeyBlock = errors.New("block must be a key block")
var ErrTooManyEntities = errors.New("too many entities")
var (
ErrTraceIsTooLong = errors.New("trace is too long")
)
Functions ¶
func CalculateAPY ¶
func CollectAdditionalInfo ¶
func CollectAdditionalInfo(ctx context.Context, infoSource InformationSource, trace *Trace) error
CollectAdditionalInfo goes over the whole trace and populates trace.TraceAdditionalInfo based on information provided by InformationSource.
func DistinctAccounts ¶
DistinctAccounts returns a list of accounts that are involved in the given trace.
func GetNftMetaData ¶
func PrepareLibraries ¶
func SimpleLibMapToCells ¶
func StateInitLibraries ¶
Types ¶
type Account ¶
type Account struct {
AccountAddress ton.AccountID
Status tlb.AccountStatus
TonBalance int64
ExtraBalances ExtraCurrencies
LastTransactionLt uint64
LastTransactionHash ton.Bits256
Code []byte
Data []byte
FrozenHash *ton.Bits256
Storage StorageInfo
Interfaces []abi.ContractInterface
LastActivityTime int64
GetMethods []string
Libraries map[ton.Bits256]*SimpleLib
}
Account holds low-level details about a particular account taken directly from the blockchain.
func ConvertToAccount ¶
type AccountInfo ¶
type AccountInfo struct {
Account Account
MemoRequired *bool
Name *string
Icon *string
IsScam *bool
}
AccountInfo extends Account type to hold additional human-friendly information about a particular account.
type AccountStat ¶
type AttachedAccount ¶
type BlockExtra ¶
type BlockHeader ¶
type BlockHeader struct {
tongo.BlockIDExt
MasterRef *tongo.BlockIDExt
PrevBlocks []tongo.BlockIDExt
StartLt int64
EndLt int64
GlobalId int32
MinRefMcSeqno int32
CatchainSeqno int32
PrevKeyBlockSeqno int32
ValidatorListHashShort int32
GenUtime uint32
Version uint32
VertSeqno uint32
WantMerge bool
WantSplit bool
AfterMerge bool
AfterSplit bool
BeforeSplit bool
IsKeyBlock bool
// GenSoftware describes software that created this particular block.
// It is up to the software to include this piece of information.
GenSoftware *GenSoftware
BlockExtra BlockExtra
ValueFlow ValueFlow
// TxQuantity is the number of transactions in this block.
TxQuantity int
}
BlockHeader contains information extracted from a block.
func ConvertToBlockHeader ¶
func ConvertToBlockHeader(id tongo.BlockIDExt, block *tlb.Block) (*BlockHeader, error)
type BouncePhaseType ¶
type BouncePhaseType string
const ( BounceNegFunds BouncePhaseType = "TrPhaseBounceNegfunds" BounceNoFunds BouncePhaseType = "TrPhaseBounceNofunds " BounceOk BouncePhaseType = "TrPhaseBounceOk" )
type Contract ¶
type Contract struct {
Status tlb.AccountStatus
Balance int64
Code []byte
Data []byte
Libraries map[ton.Bits256]*SimpleLib
LastTransactionLt uint64
}
Contract represents an account but contains a few fields that are only relevant for smart contracts.
type Currency ¶
type Currency struct {
Type CurrencyType
Jetton *tongo.AccountID
CurrencyID *int32
}
type CurrencyCollection ¶
type CurrencyCollection struct {
Grams uint64
Other []ExtraCurrency
}
func ConvertToCurrencyCollection ¶
func ConvertToCurrencyCollection(collection tlb.CurrencyCollection) CurrencyCollection
type CurrencyType ¶
type CurrencyType string
const ( CurrencyTON CurrencyType = "native" CurrencyExtra CurrencyType = "extra_currency" CurrencyJetton CurrencyType = "jetton" CurrencyFiat CurrencyType = "fiat" )
type DecodedMessageBody ¶
DecodedMessageBody contains a message body decoded by tongo.abi package.
type DedustPool ¶
DedustPool holds results of execution of Dedust's "get_assets" method.
type DnsExpiring ¶
type EmulatedTeleitemNFT ¶
type ExternalAddress ¶
ExternalAddress represents either the source or destination address of external inbound(ExtInMsg) or external outbound(ExtOutMsg) message correspondingly.
type ExtraCurrencies ¶
type ExtraCurrencies map[int32]tlb.VarUInteger32
type ExtraCurrency ¶
type GenSoftware ¶
GenSoftware describes version and capabilities of software that created a blockchain block.
type InformationSource ¶
type InformationSource interface {
JettonMastersForWallets(ctx context.Context, wallets []tongo.AccountID) (map[tongo.AccountID]tongo.AccountID, error)
NftSaleContracts(ctx context.Context, contracts []tongo.AccountID) (map[tongo.AccountID]NftSaleContract, error)
STONfiPools(ctx context.Context, poolIDs []STONfiPoolID) (map[tongo.AccountID]STONfiPool, error)
DedustPools(ctx context.Context, contracts []tongo.AccountID) (map[tongo.AccountID]DedustPool, error)
}
InformationSource provides methods to construct TraceAdditionalInfo.
type InvoicePayment ¶
type JettonHolder ¶
type JettonMaster ¶
type JettonOperation ¶
type JettonOperation struct {
Operation JettonOperationType
Source *tongo.AccountID
Destination *tongo.AccountID
JettonMaster tongo.AccountID
TraceID ton.Bits256
TxID ton.Bits256
DestEndBalance decimal.Decimal
Amount decimal.Decimal
QueryID uint64
ForwardPayload abi.JettonPayload
Lt uint64
Utime int64
}
type JettonOperationType ¶
type JettonOperationType = string
const ( TransferJettonOperation JettonOperationType = "transfer" MintJettonOperation JettonOperationType = "mint" BurnJettonOperation JettonOperationType = "burn" UnknownJettonOperation JettonOperationType = "unknown" )
type JettonTransferPayload ¶
type JettonWallet ¶
type JettonWalletLockData ¶
type LibraryResolver ¶
type LibraryResolver interface {
GetLibraries(ctx context.Context, libraries []tongo.Bits256) (map[tongo.Bits256]*boc.Cell, error)
}
LibraryResolver provides a method to resolve libraries by their hashes.
type LiquidPool ¶
type Message ¶
type Message struct {
MessageID
MsgType MsgType
Hash ton.Bits256
SourceExtern *ExternalAddress
DestinationExtern *ExternalAddress
IhrDisabled bool
Bounce bool
Bounced bool
Value int64
ValueExtra ExtraCurrencies
FwdFee int64
IhrFee int64
ImportFee int64
Init []byte
InitInterfaces []abi.ContractInterface
Body []byte
CreatedAt uint32
// OpCode is the first 32 bits of a message body indicating a possible operation.
OpCode *uint32
DecodedBody *DecodedMessageBody
}
func ConvertMessage ¶
func (Message) IsEmission ¶
func (*Message) UnmarshalJSON ¶
type MessageID ¶
func (MessageID) IsExternal ¶
type MultisigOrder ¶
type NftCollection ¶
type NftOperation ¶
type NftOperationType ¶
type NftOperationType = string
const ( TransferNftOperation NftOperationType = "transfer" MintNftOperation NftOperationType = "mint" BurnNftOperation NftOperationType = "burn" UnknownNftOperation NftOperationType = "unknown" )
type NftSaleContract ¶
type NftSaleContract struct {
NftPrice int64
// Owner of an NFT according to a getgems/basic contract.
Owner *tongo.AccountID
Item tongo.AccountID
}
NftSaleContract holds partial results of get_sale_data method.
type NftSaleInfo ¶
type PurchaseMetadata ¶
type PurchaseMetadata struct {
Type PurchaseMetadataType
Payload []byte
}
type PurchaseMetadataType ¶
type PurchaseMetadataType string
const ( NoneMetadataType PurchaseMetadataType = "none" TextMetadataType PurchaseMetadataType = "text" EncryptedBinaryMetadataType PurchaseMetadataType = "encrypted_binary" )
type ReducedBlock ¶
type STONfiPool ¶
STONfiPool holds partial results of execution of STONfi's "get_pool_data" method.
type STONfiPoolID ¶
type STONfiPoolID struct {
ID tongo.AccountID
Version STONfiVersion
}
type STONfiVersion ¶
type STONfiVersion string
const ( STONfiPoolV1 STONfiVersion = "v1" STONfiPoolV2 STONfiVersion = "v2" )
type StakingImplementation ¶
type StakingImplementation string
const ( StakingImplementationTF StakingImplementation = "tf" StakingImplementationLiquidTF StakingImplementation = "liquidTF" StakingImplementationWhales StakingImplementation = "whales" )
type StorageInfo ¶
type StorageInfo struct {
UsedCells big.Int
UsedBits big.Int
UsedPublicCells big.Int
LastPaid uint32
DuePayment int64
}
StorageInfo is taken from TLB storage_stat:StorageInfo.
type StorageProvider ¶
type StorageProvider struct {
Address tongo.AccountID
AcceptNewContracts bool
// RatePerMbDay specifies the cost of storage in nanoTON per megabyte per day.
RatePerMbDay int64
// MaxSpan specifies how often the provider provides proofs of Bag storage.
MaxSpan int64
// MinimalFileSize specifies min Bag size in bytes.
MinimalFileSize int64
// MaximalFileSize specifies max Bag size in bytes.
MaximalFileSize int64
}
StorageProvider is a smart contract that accepts storage requests and manages payments from clients.
type SubscriptionV1 ¶
type SubscriptionV1 struct {
AccountID tongo.AccountID
WalletAccountID tongo.AccountID
BeneficiaryAccountID tongo.AccountID
Status tlb.AccountStatus
Amount int64
Period int64
StartTime int64
Timeout int64
LastPaymentTime int64
LastRequestTime int64
FailedAttempts int32
SubscriptionID int64
IndexerLastUpdateLt int64
}
type SubscriptionV2 ¶
type Trace ¶
type Trace struct {
// Transaction is slightly modified.
// For example, we have kept only external outbound messages in OutMsgs.
Transaction
AccountInterfaces []abi.ContractInterface
Children []*Trace
// contains filtered or unexported fields
}
func CopyTraceData ¶
CopyTraceData copies additional data and transaction data from one trace to another. It copies TraceAdditionalInfo, AccountInterfaces, and the embedded Transaction.
func (*Trace) AdditionalInfo ¶
func (t *Trace) AdditionalInfo() *TraceAdditionalInfo
func (*Trace) CalculateProgress ¶
func (*Trace) InProgress ¶
func (*Trace) SetAdditionalInfo ¶
func (t *Trace) SetAdditionalInfo(info *TraceAdditionalInfo)
type TraceAdditionalInfo ¶
type TraceAdditionalInfo struct {
// JettonMasters maps jetton wallets to their masters.
JettonMasters map[tongo.AccountID]tongo.AccountID
// NftSaleContract is set, if a transaction's account implements "get_sale_data" method.
NftSaleContract *NftSaleContract
// STONfiPool is set, if a transaction's account implements "get_pool_data" method and abi.StonfiPool interface.
STONfiPool *STONfiPool
// EmulatedTeleitemNFT is set, if this trace is a result of emulation.
// This field is required because when a new NFT is created during emulation,
// there is no way to get it from the blockchain, and we have to store it somewhere.
EmulatedTeleitemNFT *EmulatedTeleitemNFT
// DedustPool is set, if a transaction's account implements "get_assets" method and abi.DedustPool interface.
DedustPool *DedustPool
}
TraceAdditionalInfo holds information about a trace but not directly extracted from it or a corresponding transaction.
func (*TraceAdditionalInfo) JettonMaster ¶
func (*TraceAdditionalInfo) MarshalJSON ¶
func (t *TraceAdditionalInfo) MarshalJSON() ([]byte, error)
func (*TraceAdditionalInfo) SetJettonMaster ¶
func (info *TraceAdditionalInfo) SetJettonMaster(jettonWallet tongo.AccountID, jettonMaster tongo.AccountID)
func (*TraceAdditionalInfo) UnmarshalJSON ¶
func (t *TraceAdditionalInfo) UnmarshalJSON(data []byte) error
type TraceID ¶
TraceID identifies a trace by a hash of the transaction which created it and the logical time of the transaction.
type Transaction ¶
type Transaction struct {
TransactionID
Type TransactionType
Success bool
Utime int64
InMsg *Message
OutMsgs []Message
BlockID tongo.BlockID
OrigStatus tlb.AccountStatus
EndStatus tlb.AccountStatus
EndBalance int64
PrevTransHash tongo.Bits256
PrevTransLt uint64
StateHashUpdate tlb.HashUpdate
ComputePhase *TxComputePhase
StoragePhase *TxStoragePhase
CreditPhase *TxCreditPhase
ActionPhase *TxActionPhase
BouncePhase *TxBouncePhase
Emulated bool
Aborted bool
Destroyed bool
// StorageFee collected during the Storage Phase.
StorageFee int64
// TotalFee is the original total_fee of a transaction directly from the blockchain.
TotalFee int64
Raw []byte
}
func ConvertTransaction ¶
func ConvertTransaction(workchain int32, tx tongo.Transaction, cd *abi.ContractDescription) (*Transaction, error)
func ExtractTransactions ¶
func ExtractTransactions(id tongo.BlockIDExt, block *tlb.Block) ([]*Transaction, error)
type TransactionID ¶
type TransactionType ¶
type TransactionType string
TransactionType stands for transaction kind from [4.2.4] from the TON whitepaper.
const ( OrdinaryTx TransactionType = "TransOrd" TickTockTx TransactionType = "TransTickTock" SplitPrepareTx TransactionType = "TransSplitPrepare" SplitInstallTx TransactionType = "TransSplitInstall" MergePrepareTx TransactionType = "TransMergePrepare" MergeInstallTx TransactionType = "TransMergeInstall" StorageTx TransactionType = "TransStorage" )
type TxAccStatusChange ¶
type TxAccStatusChange = tlb.AccStatusChange
type TxActionPhase ¶
type TxBouncePhase ¶
type TxBouncePhase struct {
Type BouncePhaseType
}
type TxComputePhase ¶
type TxComputeSkipReason ¶
type TxComputeSkipReason = tlb.ComputeSkipReason
type TxCreditPhase ¶
type TxStoragePhase ¶
type TxStoragePhase struct {
StorageFeesCollected uint64
StorageFeesDue *uint64
StatusChange TxAccStatusChange
}
type ValueFlow ¶
type ValueFlow struct {
FromPrevBlk CurrencyCollection
ToNextBlk CurrencyCollection
Imported CurrencyCollection
Exported CurrencyCollection
FeesCollected CurrencyCollection
Burned *CurrencyCollection
FeesImported CurrencyCollection
Recovered CurrencyCollection
Created CurrencyCollection
Minted CurrencyCollection
}