litestorage

package
v0.0.0-...-4fc17d7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNotFound = errors.New("key not found")

Functions

func OasTransactionToCoreTransaction

func OasTransactionToCoreTransaction(oasTransaction tonapi.Transaction) (core.Transaction, error)

Types

type ICache

type ICache[T any] interface {
	Get(ctx context.Context, key string) (T, error)
	Set(ctx context.Context, key string, value T, expiration time.Duration) error
	SetMany(ctx context.Context, items map[string]T, expiration time.Duration) error
}

func NewCache

func NewCache[T any](maxItems int64) (ICache[T], error)

type InMemoryCache

type InMemoryCache[T any] struct {
	// contains filtered or unexported fields
}

func (*InMemoryCache[T]) Delete

func (c *InMemoryCache[T]) Delete(ctx context.Context, key string) error

func (*InMemoryCache[T]) Get

func (c *InMemoryCache[T]) Get(ctx context.Context, key string) (T, error)

func (*InMemoryCache[T]) Set

func (c *InMemoryCache[T]) Set(ctx context.Context, key string, value T, expiration time.Duration) error

func (*InMemoryCache[T]) SetMany

func (c *InMemoryCache[T]) SetMany(ctx context.Context, items map[string]T, expiration time.Duration) error

type InMemoryConfig

type InMemoryConfig struct {
	MaxItems int64
}

type LiteStorage

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

func NewLiteStorage

func NewLiteStorage(log *zap.Logger, cli *liteapi.Client, opts ...Option) (*LiteStorage, error)

func (*LiteStorage) AccountStatusAndInterfaces

func (s *LiteStorage) AccountStatusAndInterfaces(addr tongo.AccountID) (tlb.AccountStatus, []abi.ContractInterface, error)

func (*LiteStorage) FindAllDomainsResolvedToAddress

func (s *LiteStorage) FindAllDomainsResolvedToAddress(ctx context.Context, a tongo.AccountID, collections map[tongo.AccountID]string) ([]string, error)

func (*LiteStorage) GetAccountDiff

func (s *LiteStorage) GetAccountDiff(ctx context.Context, account tongo.AccountID, startTime int64, endTime int64) (int64, error)

func (*LiteStorage) GetAccountJettonHistoryByID

func (s *LiteStorage) GetAccountJettonHistoryByID(ctx context.Context, address, jettonMaster tongo.AccountID, limit int, beforeLT, startTime, endTime *int64) ([]tongo.Bits256, error)

func (*LiteStorage) GetAccountJettonsHistory

func (s *LiteStorage) GetAccountJettonsHistory(ctx context.Context, address tongo.AccountID, limit int, beforeLT, startTime, endTime *int64) ([]tongo.Bits256, error)

func (*LiteStorage) GetAccountMultisigs

func (s *LiteStorage) GetAccountMultisigs(ctx context.Context, accountID ton.AccountID) ([]core.Multisig, error)

func (*LiteStorage) GetAccountNftsHistory

func (s *LiteStorage) GetAccountNftsHistory(ctx context.Context, address tongo.AccountID, limit int, beforeLT *int64, startTime *int64, endTime *int64) ([]tongo.Bits256, error)

func (*LiteStorage) GetAccountState

func (s *LiteStorage) GetAccountState(ctx context.Context, a tongo.AccountID) (tlb.ShardAccount, error)

func (*LiteStorage) GetAccountStateRaw

func (s *LiteStorage) GetAccountStateRaw(ctx context.Context, accountID tongo.AccountID, id *tongo.BlockIDExt) (liteclient.LiteServerAccountStateC, error)

func (*LiteStorage) GetAccountTransactions

func (s *LiteStorage) GetAccountTransactions(ctx context.Context, id tongo.AccountID, limit int, beforeLt, afterLt uint64, descendingOrder bool) ([]*core.Transaction, error)

func (*LiteStorage) GetAllAuctions

func (s *LiteStorage) GetAllAuctions(ctx context.Context) ([]core.Auction, error)

func (*LiteStorage) GetBlockHeader

func (s *LiteStorage) GetBlockHeader(ctx context.Context, id tongo.BlockID) (*core.BlockHeader, error)

func (*LiteStorage) GetBlockHeaderRaw

func (s *LiteStorage) GetBlockHeaderRaw(ctx context.Context, id tongo.BlockIDExt, mode uint32) (liteclient.LiteServerBlockHeaderC, error)

func (*LiteStorage) GetBlockProofRaw

func (s *LiteStorage) GetBlockProofRaw(ctx context.Context, knownBlock tongo.BlockIDExt, targetBlock *tongo.BlockIDExt) (liteclient.LiteServerPartialBlockProofC, error)

func (*LiteStorage) GetBlockRaw

func (*LiteStorage) GetBlockShards

func (s *LiteStorage) GetBlockShards(ctx context.Context, id tongo.BlockID) ([]ton.BlockID, error)

func (*LiteStorage) GetBlockTransactions

func (s *LiteStorage) GetBlockTransactions(ctx context.Context, id tongo.BlockID) ([]*core.Transaction, error)

func (*LiteStorage) GetConfigAllRaw

func (*LiteStorage) GetConfigFromBlock

func (c *LiteStorage) GetConfigFromBlock(ctx context.Context, id ton.BlockID) (tlb.ConfigParams, error)

func (*LiteStorage) GetConfigRaw

func (c *LiteStorage) GetConfigRaw(ctx context.Context) ([]byte, error)

func (*LiteStorage) GetContract

func (s *LiteStorage) GetContract(ctx context.Context, id tongo.AccountID) (*core.Contract, error)

func (*LiteStorage) GetDnsExpiring

func (s *LiteStorage) GetDnsExpiring(ctx context.Context, id tongo.AccountID, period *int) ([]core.DnsExpiring, error)

func (*LiteStorage) GetDomainBids

func (s *LiteStorage) GetDomainBids(ctx context.Context, domain string) ([]core.DomainBid, error)

func (*LiteStorage) GetDomainInfo

func (s *LiteStorage) GetDomainInfo(ctx context.Context, domain string) (core.NftItem, int64, error)

func (*LiteStorage) GetInscriptionBalancesByAccount

func (c *LiteStorage) GetInscriptionBalancesByAccount(ctx context.Context, a ton.AccountID) ([]core.InscriptionBalance, error)

func (*LiteStorage) GetInscriptionsHistoryByAccount

func (c *LiteStorage) GetInscriptionsHistoryByAccount(ctx context.Context, a ton.AccountID, ticker *string, beforeLt int64, limit int) ([]core.InscriptionMessage, error)

func (*LiteStorage) GetJettonHolders

func (s *LiteStorage) GetJettonHolders(ctx context.Context, jettonMaster tongo.AccountID, limit, offset int) ([]core.JettonHolder, error)

func (*LiteStorage) GetJettonMasterData

func (s *LiteStorage) GetJettonMasterData(ctx context.Context, master tongo.AccountID) (core.JettonMaster, error)

func (*LiteStorage) GetJettonMasterMetadata

func (s *LiteStorage) GetJettonMasterMetadata(ctx context.Context, master tongo.AccountID) (tongo.JettonMetadata, error)

func (*LiteStorage) GetJettonMasters

func (s *LiteStorage) GetJettonMasters(ctx context.Context, limit, offset int) ([]core.JettonMaster, error)

func (*LiteStorage) GetJettonMastersByAddresses

func (s *LiteStorage) GetJettonMastersByAddresses(ctx context.Context, addresses []ton.AccountID) ([]core.JettonMaster, error)

func (*LiteStorage) GetJettonTransferPayload

func (s *LiteStorage) GetJettonTransferPayload(ctx context.Context, accountID, jettonMaster ton.AccountID) (*core.JettonTransferPayload, error)

func (*LiteStorage) GetJettonWalletsByOwnerAddress

func (s *LiteStorage) GetJettonWalletsByOwnerAddress(ctx context.Context, address ton.AccountID, jetton *ton.AccountID, isJettonMaster bool, mintless bool) ([]core.JettonWallet, error)

func (*LiteStorage) GetJettonsHoldersCount

func (s *LiteStorage) GetJettonsHoldersCount(ctx context.Context, accountIDs []tongo.AccountID) (map[tongo.AccountID]int32, error)

func (*LiteStorage) GetLastConfig

func (c *LiteStorage) GetLastConfig(ctx context.Context) (ton.BlockchainConfig, error)

func (*LiteStorage) GetLatencyAndLastMasterchainSeqno

func (s *LiteStorage) GetLatencyAndLastMasterchainSeqno(ctx context.Context) (int64, uint32, error)

func (*LiteStorage) GetLibraries

func (s *LiteStorage) GetLibraries(ctx context.Context, libraries []tongo.Bits256) (map[tongo.Bits256]*boc.Cell, error)

func (*LiteStorage) GetLiquidPool

func (s *LiteStorage) GetLiquidPool(ctx context.Context, pool tongo.AccountID) (core.LiquidPool, error)

func (*LiteStorage) GetLiquidPools

func (s *LiteStorage) GetLiquidPools(ctx context.Context, onlyVerified bool) ([]core.LiquidPool, error)

func (*LiteStorage) GetLogs

func (s *LiteStorage) GetLogs(ctx context.Context, account tongo.AccountID, destination *tlb.MsgAddress, limit int, beforeLT uint64) ([]core.Message, error)

func (*LiteStorage) GetMasterchainInfoExtRaw

func (s *LiteStorage) GetMasterchainInfoExtRaw(ctx context.Context, mode uint32) (liteclient.LiteServerMasterchainInfoExtC, error)

func (*LiteStorage) GetMasterchainInfoRaw

func (s *LiteStorage) GetMasterchainInfoRaw(ctx context.Context) (liteclient.LiteServerMasterchainInfoC, error)

func (*LiteStorage) GetMissedEvents

func (s *LiteStorage) GetMissedEvents(ctx context.Context, account ton.AccountID, lt uint64, limit int) ([]oas.AccountEvent, error)

func (*LiteStorage) GetMultisigByID

func (s *LiteStorage) GetMultisigByID(ctx context.Context, accountID ton.AccountID) (*core.Multisig, error)

func (*LiteStorage) GetNFTs

func (s *LiteStorage) GetNFTs(ctx context.Context, accounts []tongo.AccountID) ([]core.NftItem, error)

func (*LiteStorage) GetNftCollectionByCollectionAddress

func (s *LiteStorage) GetNftCollectionByCollectionAddress(ctx context.Context, address tongo.AccountID) (core.NftCollection, error)

func (*LiteStorage) GetNftCollections

func (s *LiteStorage) GetNftCollections(ctx context.Context, limit, offset *int32) ([]core.NftCollection, error)

func (*LiteStorage) GetNftCollectionsByAddresses

func (s *LiteStorage) GetNftCollectionsByAddresses(ctx context.Context, addresses []ton.AccountID) ([]core.NftCollection, error)

func (*LiteStorage) GetNftHistory

func (s *LiteStorage) GetNftHistory(ctx context.Context, address tongo.AccountID, limit int, beforeLT *int64, startTime *int64, endTime *int64) ([]tongo.Bits256, error)

func (*LiteStorage) GetOutMsgQueueSizes

func (s *LiteStorage) GetOutMsgQueueSizes(ctx context.Context) (liteclient.LiteServerOutMsgQueueSizesC, error)

func (*LiteStorage) GetParticipatingInLiquidPools

func (s *LiteStorage) GetParticipatingInLiquidPools(ctx context.Context, member tongo.AccountID) ([]core.Nominator, error)

func (*LiteStorage) GetParticipatingInTfPools

func (s *LiteStorage) GetParticipatingInTfPools(ctx context.Context, member tongo.AccountID) ([]core.Nominator, error)

func (*LiteStorage) GetParticipatingInWhalesPools

func (s *LiteStorage) GetParticipatingInWhalesPools(ctx context.Context, member tongo.AccountID) ([]core.Nominator, error)

func (*LiteStorage) GetRawAccount

func (s *LiteStorage) GetRawAccount(ctx context.Context, address tongo.AccountID) (*core.Account, error)

GetRawAccount returns low-level information about an account taken directly from the blockchain.

func (*LiteStorage) GetRawAccounts

func (s *LiteStorage) GetRawAccounts(ctx context.Context, ids []tongo.AccountID) ([]*core.Account, error)

GetRawAccounts returns low-level information about several accounts taken directly from the blockchain.

func (*LiteStorage) GetReducedBlocks

func (s *LiteStorage) GetReducedBlocks(ctx context.Context, from, to int64) ([]core.ReducedBlock, error)

func (*LiteStorage) GetSeqno

func (s *LiteStorage) GetSeqno(ctx context.Context, account tongo.AccountID) (uint32, error)

func (*LiteStorage) GetShardBlockProofRaw

func (*LiteStorage) GetShardInfoRaw

func (s *LiteStorage) GetShardInfoRaw(ctx context.Context, id tongo.BlockIDExt, workchain uint32, shard uint64, exact bool) (liteclient.LiteServerShardInfoC, error)

func (*LiteStorage) GetShardsAllInfo

func (*LiteStorage) GetStateRaw

func (*LiteStorage) GetStorageProviders

func (s *LiteStorage) GetStorageProviders(ctx context.Context) ([]core.StorageProvider, error)

func (*LiteStorage) GetSubscriptions

func (s *LiteStorage) GetSubscriptions(ctx context.Context, address tongo.AccountID) ([]core.Subscription, error)

func (*LiteStorage) GetTFPool

func (s *LiteStorage) GetTFPool(ctx context.Context, pool tongo.AccountID) (core.TFPool, error)

func (*LiteStorage) GetTFPools

func (s *LiteStorage) GetTFPools(ctx context.Context, onlyVerified bool, availableFor *ton.AccountID) ([]core.TFPool, error)

func (*LiteStorage) GetTimeRaw

func (s *LiteStorage) GetTimeRaw(ctx context.Context) (uint32, error)

func (*LiteStorage) GetTrace

func (s *LiteStorage) GetTrace(ctx context.Context, hash tongo.Bits256) (*core.Trace, error)

func (*LiteStorage) GetTransaction

func (s *LiteStorage) GetTransaction(ctx context.Context, hash tongo.Bits256) (*core.Transaction, error)

func (*LiteStorage) GetTransactionsRaw

func (s *LiteStorage) GetTransactionsRaw(ctx context.Context, count uint32, accountID tongo.AccountID, lt uint64, hash tongo.Bits256) (liteclient.LiteServerTransactionListC, error)

func (*LiteStorage) GetWalletPubKey

func (s *LiteStorage) GetWalletPubKey(ctx context.Context, address tongo.AccountID) (ed25519.PublicKey, error)

func (*LiteStorage) GetWhalesPoolMemberInfo

func (s *LiteStorage) GetWhalesPoolMemberInfo(ctx context.Context, pool, member tongo.AccountID) (core.Nominator, error)

func (*LiteStorage) InspectContract

func (s *LiteStorage) InspectContract(ctx context.Context, account core.Account) ([]abi.ContractInterface, error)

func (*LiteStorage) JettonMastersForWallets

func (s *LiteStorage) JettonMastersForWallets(ctx context.Context, wallets []tongo.AccountID) (map[tongo.AccountID]tongo.AccountID, error)

func (*LiteStorage) LastMasterchainBlockHeader

func (s *LiteStorage) LastMasterchainBlockHeader(ctx context.Context) (*core.BlockHeader, error)

func (*LiteStorage) ListBlockTransactionsRaw

func (*LiteStorage) NftSaleContracts

func (s *LiteStorage) NftSaleContracts(ctx context.Context, contracts []tongo.AccountID) (map[tongo.AccountID]core.NftSaleContract, error)

func (*LiteStorage) ParseBlock

func (s *LiteStorage) ParseBlock(ctx context.Context, block indexer.IDandBlock)

func (*LiteStorage) ReindexAccount

func (s *LiteStorage) ReindexAccount(ctx context.Context, accountID tongo.AccountID) error

func (*LiteStorage) RunSmcMethod

func (s *LiteStorage) RunSmcMethod(ctx context.Context, id tongo.AccountID, method string, stack tlb.VmStack) (uint32, tlb.VmStack, error)

func (*LiteStorage) RunSmcMethodByID

func (s *LiteStorage) RunSmcMethodByID(ctx context.Context, id tongo.AccountID, method int, stack tlb.VmStack) (uint32, tlb.VmStack, error)

func (*LiteStorage) STONfiPools

func (s *LiteStorage) STONfiPools(ctx context.Context, poolIDs []core.STONfiPoolID) (map[tongo.AccountID]core.STONfiPool, error)

func (*LiteStorage) SearchAccountsByPubKey

func (s *LiteStorage) SearchAccountsByPubKey(pubKey ed25519.PublicKey) ([]tongo.AccountID, error)

func (*LiteStorage) SearchNFTs

func (s *LiteStorage) SearchNFTs(ctx context.Context,
	collection *core.Filter[tongo.AccountID],
	owner *core.Filter[tongo.AccountID],
	includeOnSale bool,
	onlyVerified bool,
	limit, offset int,
) ([]tongo.AccountID, error)

func (*LiteStorage) SearchTraces

func (s *LiteStorage) SearchTraces(ctx context.Context, a tongo.AccountID, limit int, beforeLT, startTime, endTime *int64, initiator bool) ([]core.TraceID, error)

func (*LiteStorage) SearchTransactionByMessageHash

func (s *LiteStorage) SearchTransactionByMessageHash(ctx context.Context, hash tongo.Bits256) (*tongo.Bits256, error)

func (*LiteStorage) SendMessageRaw

func (s *LiteStorage) SendMessageRaw(ctx context.Context, payload []byte) (uint32, error)

func (*LiteStorage) SetExecutor

func (s *LiteStorage) SetExecutor(e abi.Executor)

func (*LiteStorage) Shutdown

func (s *LiteStorage) Shutdown()

Shutdown stops all background goroutines.

func (*LiteStorage) TrimmedConfigBase64

func (c *LiteStorage) TrimmedConfigBase64() (string, error)

TrimmedConfigBase64 returns the current trimmed blockchain config in a base64 format.

type Option

type Option func(o *Options)

func WithBlockChannel

func WithBlockChannel(ch <-chan indexer.IDandBlock) Option

WithBlockChannel configures a channel to receive notifications about new blocks in the blockchain.

func WithCacheExpiration

func WithCacheExpiration(d time.Duration) Option

func WithKnownJettons

func WithKnownJettons(a []tongo.AccountID) Option

func WithPreloadAccounts

func WithPreloadAccounts(a []tongo.AccountID) Option

func WithPreloadBlocks

func WithPreloadBlocks(ids []tongo.BlockID) Option

func WithTFPools

func WithTFPools(pools []tongo.AccountID) Option

func WithTonApiClient

func WithTonApiClient(c *tonapi.Client) Option

func WithTrackAllAccounts

func WithTrackAllAccounts() Option

func WithTransactionsByInMsg

func WithTransactionsByInMsg(cache ICache[string]) Option

func WithTransactionsByOutMsg

func WithTransactionsByOutMsg(cache ICache[string]) Option

func WithTransactionsIndexByHash

func WithTransactionsIndexByHash(cache ICache[core.Transaction]) Option

type Options

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

Jump to

Keyboard shortcuts

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