api

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LongLivedConnection = 0
	RegularConnection   = 1
)

For authentication purposes we need to distinguish between regular and long-lived connections.

View Source
const UnknownJettonName = "UKWN"

Variables

View Source
var ErrRateLimit = errors.New("rate limit")

Functions

func Scale

func Scale(amount tlb.VarUInteger16, decimals int) decimal.Decimal

Scale returns a proper decimal representation of jettons taking metadata.Decimals into account.

func ScaleJettons added in v1.0.0

func ScaleJettons(amount big.Int, decimals int) decimal.Decimal

ScaleJettons returns a proper decimal representation of jettons taking metadata.Decimals into account.

Types

type AsyncHandler

type AsyncHandler func(w http.ResponseWriter, r *http.Request, connectionType int, allowTokenInQuery bool) error

type AsyncMiddleware

type AsyncMiddleware func(AsyncHandler) AsyncHandler

type Handler

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

func NewHandler

func NewHandler(logger *zap.Logger, opts ...Option) (*Handler, error)

func (*Handler) AccountDnsBackResolve added in v1.1.0

func (h *Handler) AccountDnsBackResolve(ctx context.Context, params oas.AccountDnsBackResolveParams) (*oas.DomainNames, error)

func (*Handler) AddressParse added in v1.2.0

func (h *Handler) AddressParse(ctx context.Context, params oas.AddressParseParams) (*oas.AddressParseOK, error)

func (*Handler) BlockchainAccountInspect added in v1.1.0

func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.BlockchainAccountInspectParams) (*oas.BlockchainAccountInspect, error)

func (*Handler) DecodeMessage added in v1.2.0

func (h *Handler) DecodeMessage(ctx context.Context, req *oas.DecodeMessageReq) (*oas.DecodedMessage, error)

func (*Handler) DnsResolve

func (h *Handler) DnsResolve(ctx context.Context, params oas.DnsResolveParams) (*oas.DnsRecord, error)

func (*Handler) EmulateMessageToAccountEvent

func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *oas.EmulateMessageToAccountEventReq, params oas.EmulateMessageToAccountEventParams) (*oas.AccountEvent, error)

func (*Handler) EmulateMessageToEvent

func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.EmulateMessageToEventReq, params oas.EmulateMessageToEventParams) (*oas.Event, error)

func (*Handler) EmulateMessageToTrace

func (h *Handler) EmulateMessageToTrace(ctx context.Context, request *oas.EmulateMessageToTraceReq, params oas.EmulateMessageToTraceParams) (*oas.Trace, error)

func (*Handler) EmulateMessageToWallet added in v1.1.0

func (*Handler) ExecGetMethodForBlockchainAccount added in v1.1.0

func (h *Handler) ExecGetMethodForBlockchainAccount(ctx context.Context, params oas.ExecGetMethodForBlockchainAccountParams) (*oas.MethodExecutionResult, error)

func (*Handler) GetAccount

func (h *Handler) GetAccount(ctx context.Context, params oas.GetAccountParams) (*oas.Account, error)

func (*Handler) GetAccountDiff added in v1.1.0

func (h *Handler) GetAccountDiff(ctx context.Context, params oas.GetAccountDiffParams) (*oas.GetAccountDiffOK, error)

func (*Handler) GetAccountDnsExpiring added in v1.1.0

func (h *Handler) GetAccountDnsExpiring(ctx context.Context, params oas.GetAccountDnsExpiringParams) (*oas.DnsExpiring, error)

func (*Handler) GetAccountEvent added in v1.1.0

func (h *Handler) GetAccountEvent(ctx context.Context, params oas.GetAccountEventParams) (*oas.AccountEvent, error)

func (*Handler) GetAccountEvents added in v1.1.0

func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEventsParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountInfoByStateInit

func (h *Handler) GetAccountInfoByStateInit(ctx context.Context, request *oas.GetAccountInfoByStateInitReq) (*oas.AccountInfoByStateInit, error)

func (*Handler) GetAccountInscriptions added in v1.2.0

func (h *Handler) GetAccountInscriptions(ctx context.Context, params oas.GetAccountInscriptionsParams) (*oas.InscriptionBalances, error)

func (*Handler) GetAccountInscriptionsHistory added in v1.2.0

func (h *Handler) GetAccountInscriptionsHistory(ctx context.Context, params oas.GetAccountInscriptionsHistoryParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountInscriptionsHistoryByTicker added in v1.2.0

func (h *Handler) GetAccountInscriptionsHistoryByTicker(ctx context.Context, params oas.GetAccountInscriptionsHistoryByTickerParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountJettonHistoryByID added in v1.1.0

func (h *Handler) GetAccountJettonHistoryByID(ctx context.Context, params oas.GetAccountJettonHistoryByIDParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountJettonsBalances added in v1.1.0

func (h *Handler) GetAccountJettonsBalances(ctx context.Context, params oas.GetAccountJettonsBalancesParams) (*oas.JettonsBalances, error)

func (*Handler) GetAccountJettonsHistory added in v1.1.0

func (h *Handler) GetAccountJettonsHistory(ctx context.Context, params oas.GetAccountJettonsHistoryParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountNftHistory added in v1.1.0

func (h *Handler) GetAccountNftHistory(ctx context.Context, params oas.GetAccountNftHistoryParams) (*oas.AccountEvents, error)

func (*Handler) GetAccountNftItems added in v1.1.0

func (h *Handler) GetAccountNftItems(ctx context.Context, params oas.GetAccountNftItemsParams) (*oas.NftItems, error)

func (*Handler) GetAccountNominatorsPools added in v1.1.0

func (h *Handler) GetAccountNominatorsPools(ctx context.Context, params oas.GetAccountNominatorsPoolsParams) (*oas.AccountStaking, error)

func (*Handler) GetAccountPublicKey added in v1.1.0

func (h *Handler) GetAccountPublicKey(ctx context.Context, params oas.GetAccountPublicKeyParams) (*oas.GetAccountPublicKeyOK, error)

func (*Handler) GetAccountSeqno added in v1.0.0

func (h *Handler) GetAccountSeqno(ctx context.Context, params oas.GetAccountSeqnoParams) (*oas.Seqno, error)

func (*Handler) GetAccountSubscriptions added in v1.1.0

func (h *Handler) GetAccountSubscriptions(ctx context.Context, params oas.GetAccountSubscriptionsParams) (*oas.Subscriptions, error)

func (*Handler) GetAccountTraces added in v1.1.0

func (h *Handler) GetAccountTraces(ctx context.Context, params oas.GetAccountTracesParams) (*oas.TraceIDs, error)

func (*Handler) GetAccounts

func (h *Handler) GetAccounts(ctx context.Context, request oas.OptGetAccountsReq) (*oas.Accounts, error)

func (*Handler) GetAllAuctions

func (h *Handler) GetAllAuctions(ctx context.Context, params oas.GetAllAuctionsParams) (*oas.Auctions, error)

func (*Handler) GetAllRawShardsInfo added in v1.1.0

func (h *Handler) GetAllRawShardsInfo(ctx context.Context, params oas.GetAllRawShardsInfoParams) (*oas.GetAllRawShardsInfoOK, error)

func (*Handler) GetBlockchainAccountTransactions added in v1.1.0

func (h *Handler) GetBlockchainAccountTransactions(ctx context.Context, params oas.GetBlockchainAccountTransactionsParams) (*oas.Transactions, error)

func (*Handler) GetBlockchainBlock added in v1.1.0

func (h *Handler) GetBlockchainBlock(ctx context.Context, params oas.GetBlockchainBlockParams) (*oas.BlockchainBlock, error)

func (*Handler) GetBlockchainBlockTransactions added in v1.1.0

func (h *Handler) GetBlockchainBlockTransactions(ctx context.Context, params oas.GetBlockchainBlockTransactionsParams) (*oas.Transactions, error)

func (*Handler) GetBlockchainConfig added in v1.1.0

func (h *Handler) GetBlockchainConfig(ctx context.Context) (*oas.BlockchainConfig, error)

func (*Handler) GetBlockchainConfigFromBlock added in v1.2.0

func (h *Handler) GetBlockchainConfigFromBlock(ctx context.Context, params oas.GetBlockchainConfigFromBlockParams) (*oas.BlockchainConfig, error)

func (*Handler) GetBlockchainMasterchainBlocks added in v1.2.0

func (h *Handler) GetBlockchainMasterchainBlocks(ctx context.Context, params oas.GetBlockchainMasterchainBlocksParams) (*oas.BlockchainBlocks, error)

func (*Handler) GetBlockchainMasterchainHead added in v1.1.0

func (h *Handler) GetBlockchainMasterchainHead(ctx context.Context) (*oas.BlockchainBlock, error)

func (*Handler) GetBlockchainMasterchainShards added in v1.2.0

func (h *Handler) GetBlockchainMasterchainShards(ctx context.Context, params oas.GetBlockchainMasterchainShardsParams) (r *oas.BlockchainBlockShards, _ error)

func (*Handler) GetBlockchainMasterchainTransactions added in v1.2.0

func (h *Handler) GetBlockchainMasterchainTransactions(ctx context.Context, params oas.GetBlockchainMasterchainTransactionsParams) (*oas.Transactions, error)

func (*Handler) GetBlockchainRawAccount added in v1.1.0

func (h *Handler) GetBlockchainRawAccount(ctx context.Context, params oas.GetBlockchainRawAccountParams) (*oas.BlockchainRawAccount, error)

func (*Handler) GetBlockchainTransaction added in v1.1.0

func (h *Handler) GetBlockchainTransaction(ctx context.Context, params oas.GetBlockchainTransactionParams) (*oas.Transaction, error)

func (*Handler) GetBlockchainTransactionByMessageHash added in v1.1.0

func (h *Handler) GetBlockchainTransactionByMessageHash(ctx context.Context, params oas.GetBlockchainTransactionByMessageHashParams) (*oas.Transaction, error)

func (*Handler) GetBlockchainValidators added in v1.2.0

func (h *Handler) GetBlockchainValidators(ctx context.Context) (*oas.Validators, error)

func (*Handler) GetChartRates added in v1.1.0

func (h *Handler) GetChartRates(ctx context.Context, params oas.GetChartRatesParams) (*oas.GetChartRatesOK, error)

func (*Handler) GetDnsInfo added in v1.1.0

func (h *Handler) GetDnsInfo(ctx context.Context, params oas.GetDnsInfoParams) (*oas.DomainInfo, error)

func (*Handler) GetDomainBids added in v1.0.0

func (h *Handler) GetDomainBids(ctx context.Context, params oas.GetDomainBidsParams) (*oas.DomainBids, error)

func (*Handler) GetEvent

func (h *Handler) GetEvent(ctx context.Context, params oas.GetEventParams) (*oas.Event, error)

func (*Handler) GetInscriptionOpTemplate added in v1.2.0

func (h *Handler) GetInscriptionOpTemplate(ctx context.Context, params oas.GetInscriptionOpTemplateParams) (*oas.GetInscriptionOpTemplateOK, error)

func (*Handler) GetItemsFromCollection

func (h *Handler) GetItemsFromCollection(ctx context.Context, params oas.GetItemsFromCollectionParams) (*oas.NftItems, error)

func (*Handler) GetJettonHolders added in v1.1.0

func (h *Handler) GetJettonHolders(ctx context.Context, params oas.GetJettonHoldersParams) (*oas.JettonHolders, error)

func (*Handler) GetJettonInfo

func (h *Handler) GetJettonInfo(ctx context.Context, params oas.GetJettonInfoParams) (*oas.JettonInfo, error)

func (*Handler) GetJettonNormalizedMetadata

func (h *Handler) GetJettonNormalizedMetadata(ctx context.Context, master tongo.AccountID) NormalizedMetadata

func (*Handler) GetJettons added in v1.0.0

func (h *Handler) GetJettons(ctx context.Context, params oas.GetJettonsParams) (*oas.Jettons, error)

func (*Handler) GetJettonsEvents added in v1.1.0

func (h *Handler) GetJettonsEvents(ctx context.Context, params oas.GetJettonsEventsParams) (*oas.Event, error)

func (*Handler) GetMarketsRates added in v1.2.0

func (h *Handler) GetMarketsRates(ctx context.Context) (*oas.GetMarketsRatesOK, error)

func (*Handler) GetNftCollection

func (h *Handler) GetNftCollection(ctx context.Context, params oas.GetNftCollectionParams) (*oas.NftCollection, error)

func (*Handler) GetNftCollections

func (h *Handler) GetNftCollections(ctx context.Context, params oas.GetNftCollectionsParams) (*oas.NftCollections, error)

func (*Handler) GetNftHistoryByID added in v1.1.0

func (h *Handler) GetNftHistoryByID(ctx context.Context, params oas.GetNftHistoryByIDParams) (*oas.AccountEvents, error)

func (*Handler) GetNftItemByAddress

func (h *Handler) GetNftItemByAddress(ctx context.Context, params oas.GetNftItemByAddressParams) (*oas.NftItem, error)

func (*Handler) GetNftItemsByAddresses

func (h *Handler) GetNftItemsByAddresses(ctx context.Context, request oas.OptGetNftItemsByAddressesReq) (*oas.NftItems, error)

func (*Handler) GetRates

func (h *Handler) GetRates(ctx context.Context, params oas.GetRatesParams) (*oas.GetRatesOK, error)

func (*Handler) GetRawAccountState added in v1.1.0

func (h *Handler) GetRawAccountState(ctx context.Context, params oas.GetRawAccountStateParams) (*oas.GetRawAccountStateOK, error)

func (*Handler) GetRawBlockProof added in v1.1.0

func (h *Handler) GetRawBlockProof(ctx context.Context, params oas.GetRawBlockProofParams) (*oas.GetRawBlockProofOK, error)

func (*Handler) GetRawBlockchainBlock added in v1.1.0

func (h *Handler) GetRawBlockchainBlock(ctx context.Context, params oas.GetRawBlockchainBlockParams) (*oas.GetRawBlockchainBlockOK, error)

func (*Handler) GetRawBlockchainBlockHeader added in v1.1.0

func (h *Handler) GetRawBlockchainBlockHeader(ctx context.Context, params oas.GetRawBlockchainBlockHeaderParams) (*oas.GetRawBlockchainBlockHeaderOK, error)

func (*Handler) GetRawBlockchainBlockState added in v1.1.0

func (h *Handler) GetRawBlockchainBlockState(ctx context.Context, params oas.GetRawBlockchainBlockStateParams) (*oas.GetRawBlockchainBlockStateOK, error)

func (*Handler) GetRawBlockchainConfig added in v1.2.0

func (h *Handler) GetRawBlockchainConfig(ctx context.Context) (r *oas.RawBlockchainConfig, _ error)

func (*Handler) GetRawBlockchainConfigFromBlock added in v1.2.0

func (h *Handler) GetRawBlockchainConfigFromBlock(ctx context.Context, params oas.GetRawBlockchainConfigFromBlockParams) (r *oas.RawBlockchainConfig, _ error)

func (*Handler) GetRawConfig added in v1.1.0

func (h *Handler) GetRawConfig(ctx context.Context, params oas.GetRawConfigParams) (*oas.GetRawConfigOK, error)

func (*Handler) GetRawListBlockTransactions added in v1.1.0

func (h *Handler) GetRawListBlockTransactions(ctx context.Context, params oas.GetRawListBlockTransactionsParams) (*oas.GetRawListBlockTransactionsOK, error)

func (*Handler) GetRawMasterchainInfo added in v1.1.0

func (h *Handler) GetRawMasterchainInfo(ctx context.Context) (*oas.GetRawMasterchainInfoOK, error)

func (*Handler) GetRawMasterchainInfoExt added in v1.1.0

func (h *Handler) GetRawMasterchainInfoExt(ctx context.Context, params oas.GetRawMasterchainInfoExtParams) (*oas.GetRawMasterchainInfoExtOK, error)

func (*Handler) GetRawShardBlockProof added in v1.1.0

func (h *Handler) GetRawShardBlockProof(ctx context.Context, params oas.GetRawShardBlockProofParams) (*oas.GetRawShardBlockProofOK, error)

func (*Handler) GetRawShardInfo added in v1.1.0

func (h *Handler) GetRawShardInfo(ctx context.Context, params oas.GetRawShardInfoParams) (*oas.GetRawShardInfoOK, error)

func (*Handler) GetRawTime added in v1.1.0

func (h *Handler) GetRawTime(ctx context.Context) (*oas.GetRawTimeOK, error)

func (*Handler) GetRawTransactions added in v1.1.0

func (h *Handler) GetRawTransactions(ctx context.Context, params oas.GetRawTransactionsParams) (*oas.GetRawTransactionsOK, error)

func (*Handler) GetStakingPoolHistory added in v1.1.0

func (h *Handler) GetStakingPoolHistory(ctx context.Context, params oas.GetStakingPoolHistoryParams) (*oas.GetStakingPoolHistoryOK, error)

func (*Handler) GetStakingPoolInfo added in v1.1.0

func (h *Handler) GetStakingPoolInfo(ctx context.Context, params oas.GetStakingPoolInfoParams) (*oas.GetStakingPoolInfoOK, error)

func (*Handler) GetStakingPools added in v1.1.0

func (h *Handler) GetStakingPools(ctx context.Context, params oas.GetStakingPoolsParams) (*oas.GetStakingPoolsOK, error)

func (*Handler) GetStorageProviders

func (h *Handler) GetStorageProviders(ctx context.Context) (*oas.GetStorageProvidersOK, error)

func (*Handler) GetTonConnectPayload

func (h *Handler) GetTonConnectPayload(ctx context.Context) (*oas.GetTonConnectPayloadOK, error)

func (*Handler) GetTrace

func (h *Handler) GetTrace(ctx context.Context, params oas.GetTraceParams) (*oas.Trace, error)

func (*Handler) GetWalletBackup

func (h *Handler) GetWalletBackup(ctx context.Context, params oas.GetWalletBackupParams) (*oas.GetWalletBackupOK, error)

func (*Handler) GetWalletsByPublicKey added in v1.0.0

func (h *Handler) GetWalletsByPublicKey(ctx context.Context, params oas.GetWalletsByPublicKeyParams) (*oas.Accounts, error)

func (*Handler) NewError added in v1.2.0

func (h *Handler) NewError(ctx context.Context, err error) *oas.ErrorStatusCode

func (*Handler) ReduceIndexingLatency added in v1.2.0

func (h *Handler) ReduceIndexingLatency(ctx context.Context) (*oas.ServiceStatus, error)

func (*Handler) ReindexAccount

func (h *Handler) ReindexAccount(ctx context.Context, params oas.ReindexAccountParams) error

ReindexAccount updates internal cache for a particular account.

func (*Handler) RunEmulation added in v1.2.0

func (h *Handler) RunEmulation(ctx context.Context, msgCh <-chan blockchain.ExtInMsgCopy, emulationCh chan<- blockchain.ExtInMsgCopy)

func (*Handler) SearchAccounts added in v1.1.0

func (h *Handler) SearchAccounts(ctx context.Context, params oas.SearchAccountsParams) (*oas.FoundAccounts, error)

func (*Handler) SendBlockchainMessage added in v1.1.0

func (h *Handler) SendBlockchainMessage(ctx context.Context, request *oas.SendBlockchainMessageReq) error

func (*Handler) SendRawMessage added in v1.1.0

func (h *Handler) SendRawMessage(ctx context.Context, request *oas.SendRawMessageReq) (*oas.SendRawMessageOK, error)

func (*Handler) SetWalletBackup

func (h *Handler) SetWalletBackup(ctx context.Context, request oas.SetWalletBackupReq, params oas.SetWalletBackupParams) error

func (*Handler) TonConnectProof

func (h *Handler) TonConnectProof(ctx context.Context, request *oas.TonConnectProofReq) (*oas.TonConnectProofOK, error)

type Limits

type Limits struct {
	// BulkLimits stands for a number of entities a user is allowed to request at once with a bulk query.
	BulkLimits int
}

type NormalizedMetadata

type NormalizedMetadata struct {
	Name         string
	Description  string
	Image        string
	Symbol       string
	Decimals     int
	Verification VerificationType
	Social       []string
	Websites     []string
}

NormalizedMetadata is a special version of jetton metadata ready to be shown to the users. It contains a mix of information from two sources: 1. a jetton master metadata taken from the blockchain (onchain/offchain) 2. a jetton description taken from the community git https://github.com/tonkeeper/ton-assets. It additionally rewrites some fields if necessary.

func NormalizeMetadata

func NormalizeMetadata(meta tep64.Metadata, info *addressbook.KnownJetton, isBlacklisted bool) NormalizedMetadata

type Option

type Option func(o *Options)

func WithAddressBook

func WithAddressBook(book addressBook) Option

func WithChainState

func WithChainState(state chainState) Option

func WithContextToDetails added in v1.2.0

func WithContextToDetails(ctxToDetails ctxToDetails) Option

func WithExecutor

func WithExecutor(e executor) Option

func WithLimits

func WithLimits(limits Limits) Option

func WithMessageSender

func WithMessageSender(msgSender messageSender) Option

func WithRatesSource added in v1.0.0

func WithRatesSource(source ratesSource) Option

func WithSpamFilter added in v1.1.0

func WithSpamFilter(spamFilter spamFilter) Option

func WithStorage

func WithStorage(s storage) Option

func WithTonConnectSecret

func WithTonConnectSecret(tonConnectSecret string) Option

type Options

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

Options configures behavior of a Handler instance.

type Server

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

Server opens a port and exposes REST-ish API.

Server integrates two groups of endpoints:

  1. The first group named "Ogen" consists of endpoints generated by ogen based on api/openapi.yml. It has an independent server in "oas" package.
  2. The second group named "Async" contains methods that aren't supported by ogen (streaming methods with non-standard Content-Type). These methods are defined manually and are exposed with http.ServeMux.

We provide basic middleware like logging and metrics for both groups.

func NewServer

func NewServer(log *zap.Logger, handler *Handler, address string, opts ...ServerOption) (*Server, error)

func (*Server) RegisterAsyncHandler

func (s *Server) RegisterAsyncHandler(pattern string, handler AsyncHandler, connectionType int, allowTokenInQuery bool)

func (*Server) Run

func (s *Server) Run()

type ServerOption

type ServerOption func(options *ServerOptions)

func WithAsyncMiddleware

func WithAsyncMiddleware(m ...AsyncMiddleware) ServerOption

func WithBlockHeadersSource added in v1.2.0

func WithBlockHeadersSource(src sources.BlockHeadersSource) ServerOption

func WithBlockSource added in v1.2.0

func WithBlockSource(src sources.BlockSource) ServerOption

func WithMemPool

func WithMemPool(memPool sources.MemPoolSource) ServerOption

func WithOgenMiddleware

func WithOgenMiddleware(m ...oas.Middleware) ServerOption

func WithTraceSource added in v1.2.0

func WithTraceSource(src sources.TraceSource) ServerOption

func WithTransactionSource

func WithTransactionSource(txSource sources.TransactionSource) ServerOption

type ServerOptions

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

type VerificationType

type VerificationType string
const (
	VerificationWhitelist VerificationType = "whitelist"
	VerificationBlacklist VerificationType = "blacklist"
	VerificationNone      VerificationType = "none"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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