api

package
v0.0.0-...-c305843 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 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

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

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

func (*Handler) AddressParse

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

func (*Handler) BlockchainAccountInspect

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

func (*Handler) DecodeMessage

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

func (*Handler) ExecGetMethodForBlockchainAccount

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

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

func (*Handler) GetAccountDnsExpiring

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

func (*Handler) GetAccountEvent

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

func (*Handler) GetAccountEvents

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

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

func (*Handler) GetAccountInscriptionsHistory

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

func (*Handler) GetAccountInscriptionsHistoryByTicker

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

func (*Handler) GetAccountJettonBalance

func (h *Handler) GetAccountJettonBalance(ctx context.Context, params oas.GetAccountJettonBalanceParams) (*oas.JettonBalance, error)

func (*Handler) GetAccountJettonHistoryByID

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

func (*Handler) GetAccountJettonsBalances

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

func (*Handler) GetAccountJettonsHistory

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

func (*Handler) GetAccountNftHistory

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

func (*Handler) GetAccountNftItems

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

func (*Handler) GetAccountNominatorsPools

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

func (*Handler) GetAccountPublicKey

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

func (*Handler) GetAccountSeqno

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

func (*Handler) GetAccountSubscriptions

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

func (*Handler) GetAccountTraces

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

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

func (*Handler) GetBlockchainAccountTransactions

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

func (*Handler) GetBlockchainBlock

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

func (*Handler) GetBlockchainBlockTransactions

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

func (*Handler) GetBlockchainConfig

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

func (*Handler) GetBlockchainConfigFromBlock

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

func (*Handler) GetBlockchainMasterchainBlocks

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

func (*Handler) GetBlockchainMasterchainHead

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

func (*Handler) GetBlockchainMasterchainShards

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

func (*Handler) GetBlockchainMasterchainTransactions

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

func (*Handler) GetBlockchainRawAccount

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

func (*Handler) GetBlockchainTransaction

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

func (*Handler) GetBlockchainTransactionByMessageHash

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

func (*Handler) GetBlockchainValidators

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

func (*Handler) GetChartRates

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

func (*Handler) GetDnsInfo

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

func (*Handler) GetDomainBids

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

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

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

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

func (*Handler) GetJettonsEvents

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

func (*Handler) GetMarketsRates

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

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) GetOutMsgQueueSizes

func (h *Handler) GetOutMsgQueueSizes(ctx context.Context) (*oas.GetOutMsgQueueSizesOK, error)

func (*Handler) GetRates

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

func (*Handler) GetRawAccountState

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

func (*Handler) GetRawBlockProof

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

func (*Handler) GetRawBlockchainBlock

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

func (*Handler) GetRawBlockchainBlockHeader

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

func (*Handler) GetRawBlockchainBlockState

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

func (*Handler) GetRawBlockchainConfig

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

func (*Handler) GetRawBlockchainConfigFromBlock

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

func (*Handler) GetRawConfig

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

func (*Handler) GetRawListBlockTransactions

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

func (*Handler) GetRawMasterchainInfo

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

func (*Handler) GetRawMasterchainInfoExt

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

func (*Handler) GetRawShardBlockProof

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

func (*Handler) GetRawShardInfo

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

func (*Handler) GetRawTime

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

func (*Handler) GetRawTransactions

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

func (*Handler) GetStakingPoolHistory

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

func (*Handler) GetStakingPoolInfo

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

func (*Handler) GetStakingPools

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

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

func (*Handler) NewError

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

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

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

func (*Handler) SearchAccounts

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

func (*Handler) SendBlockchainMessage

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

func (*Handler) SendRawMessage

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) Status

func (h *Handler) Status(ctx context.Context) (*oas.ServiceStatus, 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

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

func WithRatesSource(source ratesSource) Option

func WithSpamFilter

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

func WithBlockHeadersSource(src sources.BlockHeadersSource) ServerOption

func WithBlockSource

func WithBlockSource(src sources.BlockSource) ServerOption

func WithMemPool

func WithMemPool(memPool sources.MemPoolSource) ServerOption

func WithOgenMiddleware

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

func WithTraceSource

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