api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 61 Imported by: 2

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 uint64, decimals int) decimal.Decimal

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

Types

type AsyncHandler

type AsyncHandler func(http.ResponseWriter, *http.Request, int) error

type AsyncMiddleware

type AsyncMiddleware func(AsyncHandler) AsyncHandler

type Handler

type Handler struct {
	oas.UnimplementedHandler // automatically implement all methods
	// contains filtered or unexported fields
}

func NewHandler

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

func (Handler) DnsBackResolve

func (h Handler) DnsBackResolve(ctx context.Context, params oas.DnsBackResolveParams) (r oas.DnsBackResolveRes, err error)

func (Handler) DnsResolve

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

func (Handler) EmulateMessageToTrace

func (h Handler) EmulateMessageToTrace(ctx context.Context, req oas.EmulateMessageToTraceReq) (r oas.EmulateMessageToTraceRes, _ error)

func (Handler) ExecGetMethod

func (h Handler) ExecGetMethod(ctx context.Context, params oas.ExecGetMethodParams) (oas.ExecGetMethodRes, error)

func (Handler) GetAccount

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

func (Handler) GetAccountInfoByStateInit

func (h Handler) GetAccountInfoByStateInit(ctx context.Context, request oas.GetAccountInfoByStateInitReq) (res oas.GetAccountInfoByStateInitRes, err error)

func (Handler) GetAccountSeqno added in v1.0.0

func (h Handler) GetAccountSeqno(ctx context.Context, params oas.GetAccountSeqnoParams) (res oas.GetAccountSeqnoRes, err error)

func (Handler) GetAccountStateLiteServer added in v1.0.0

func (h Handler) GetAccountStateLiteServer(ctx context.Context, params oas.GetAccountStateLiteServerParams) (res oas.GetAccountStateLiteServerRes, err error)

func (Handler) GetAccountTransactions

func (h Handler) GetAccountTransactions(ctx context.Context, params oas.GetAccountTransactionsParams) (r oas.GetAccountTransactionsRes, err error)

func (Handler) GetAccounts

func (h Handler) GetAccounts(ctx context.Context, req oas.OptGetAccountsReq) (r oas.GetAccountsRes, _ error)

func (Handler) GetAllAuctions

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

func (Handler) GetAllShardsInfoLiteServer added in v1.0.0

func (h Handler) GetAllShardsInfoLiteServer(ctx context.Context, params oas.GetAllShardsInfoLiteServerParams) (res oas.GetAllShardsInfoLiteServerRes, err error)

func (Handler) GetBlock

func (h Handler) GetBlock(ctx context.Context, params oas.GetBlockParams) (r oas.GetBlockRes, _ error)

func (Handler) GetBlockHeaderLiteServer added in v1.0.0

func (h Handler) GetBlockHeaderLiteServer(ctx context.Context, params oas.GetBlockHeaderLiteServerParams) (res oas.GetBlockHeaderLiteServerRes, err error)

func (Handler) GetBlockLiteServer added in v1.0.0

func (h Handler) GetBlockLiteServer(ctx context.Context, params oas.GetBlockLiteServerParams) (res oas.GetBlockLiteServerRes, err error)

func (Handler) GetBlockProofLiteServer added in v1.0.0

func (h Handler) GetBlockProofLiteServer(ctx context.Context, params oas.GetBlockProofLiteServerParams) (res oas.GetBlockProofLiteServerRes, err error)

func (Handler) GetBlockTransactions

func (h Handler) GetBlockTransactions(ctx context.Context, params oas.GetBlockTransactionsParams) (oas.GetBlockTransactionsRes, error)

func (Handler) GetConfig added in v1.0.0

func (h Handler) GetConfig(ctx context.Context) (r oas.GetConfigRes, _ error)

func (Handler) GetConfigAllLiteServer added in v1.0.0

func (h Handler) GetConfigAllLiteServer(ctx context.Context, params oas.GetConfigAllLiteServerParams) (res oas.GetConfigAllLiteServerRes, err error)

func (Handler) GetDnsExpiring

func (h Handler) GetDnsExpiring(ctx context.Context, params oas.GetDnsExpiringParams) (r oas.GetDnsExpiringRes, _ error)

func (Handler) GetDomainBids added in v1.0.0

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

func (Handler) GetEvent

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

func (Handler) GetEventsByAccount

func (h Handler) GetEventsByAccount(ctx context.Context, params oas.GetEventsByAccountParams) (r oas.GetEventsByAccountRes, _ error)

func (Handler) GetItemsFromCollection

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

func (Handler) GetJettonInfo

func (h Handler) GetJettonInfo(ctx context.Context, params oas.GetJettonInfoParams) (r oas.GetJettonInfoRes, err 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) (r oas.GetJettonsRes, _ error)

func (Handler) GetJettonsBalances

func (h Handler) GetJettonsBalances(ctx context.Context, params oas.GetJettonsBalancesParams) (oas.GetJettonsBalancesRes, error)

func (Handler) GetJettonsHistory

func (h Handler) GetJettonsHistory(ctx context.Context, params oas.GetJettonsHistoryParams) (res oas.GetJettonsHistoryRes, err error)

func (Handler) GetJettonsHistoryByID

func (h Handler) GetJettonsHistoryByID(ctx context.Context, params oas.GetJettonsHistoryByIDParams) (res oas.GetJettonsHistoryByIDRes, err error)

func (Handler) GetListBlockTransactionsLiteServer added in v1.0.0

func (h Handler) GetListBlockTransactionsLiteServer(ctx context.Context, params oas.GetListBlockTransactionsLiteServerParams) (res oas.GetListBlockTransactionsLiteServerRes, err error)

func (Handler) GetMasterchainHead

func (h Handler) GetMasterchainHead(ctx context.Context) (r oas.GetMasterchainHeadRes, err error)

func (Handler) GetMasterchainInfoExtLiteServer added in v1.0.0

func (Handler) GetMasterchainInfoLiteServer added in v1.0.0

func (h Handler) GetMasterchainInfoLiteServer(ctx context.Context) (res oas.GetMasterchainInfoLiteServerRes, err error)

func (Handler) GetNftCollection

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

func (Handler) GetNftCollections

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

func (Handler) GetNftItemByAddress

func (Handler) GetNftItemsByOwner

func (h Handler) GetNftItemsByOwner(ctx context.Context, params oas.GetNftItemsByOwnerParams) (oas.GetNftItemsByOwnerRes, error)

func (Handler) GetPublicKeyByAccountID

func (h Handler) GetPublicKeyByAccountID(ctx context.Context, params oas.GetPublicKeyByAccountIDParams) (r oas.GetPublicKeyByAccountIDRes, _ error)

func (*Handler) GetRates

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

func (Handler) GetRawAccount

func (h Handler) GetRawAccount(ctx context.Context, params oas.GetRawAccountParams) (r oas.GetRawAccountRes, _ error)

func (Handler) GetSearchAccounts

func (h Handler) GetSearchAccounts(ctx context.Context, params oas.GetSearchAccountsParams) (res oas.GetSearchAccountsRes, err error)

func (Handler) GetShardBlockProofLiteServer added in v1.0.0

func (h Handler) GetShardBlockProofLiteServer(ctx context.Context, params oas.GetShardBlockProofLiteServerParams) (res oas.GetShardBlockProofLiteServerRes, err error)

func (Handler) GetShardInfoLiteServer added in v1.0.0

func (h Handler) GetShardInfoLiteServer(ctx context.Context, params oas.GetShardInfoLiteServerParams) (res oas.GetShardInfoLiteServerRes, err error)

func (Handler) GetStateLiteServer added in v1.0.0

func (h Handler) GetStateLiteServer(ctx context.Context, params oas.GetStateLiteServerParams) (res oas.GetStateLiteServerRes, err error)

func (Handler) GetStorageProviders

func (h Handler) GetStorageProviders(ctx context.Context) (r oas.GetStorageProvidersRes, _ error)

func (Handler) GetSubscriptionsByAccount added in v0.1.0

func (h Handler) GetSubscriptionsByAccount(ctx context.Context, params oas.GetSubscriptionsByAccountParams) (res oas.GetSubscriptionsByAccountRes, err error)

func (Handler) GetTimeLiteServer added in v1.0.0

func (h Handler) GetTimeLiteServer(ctx context.Context) (res oas.GetTimeLiteServerRes, err error)

func (Handler) GetTonConnectPayload

func (h Handler) GetTonConnectPayload(ctx context.Context) (res oas.GetTonConnectPayloadRes, err error)

func (Handler) GetTrace

func (h Handler) GetTrace(ctx context.Context, params oas.GetTraceParams) (r oas.GetTraceRes, _ error)

func (Handler) GetTransaction

func (h Handler) GetTransaction(ctx context.Context, params oas.GetTransactionParams) (r oas.GetTransactionRes, _ error)

func (Handler) GetTransactionByMessageHash added in v1.0.0

func (h Handler) GetTransactionByMessageHash(ctx context.Context, params oas.GetTransactionByMessageHashParams) (r oas.GetTransactionByMessageHashRes, _ error)

func (Handler) GetTransactionsLiteServer added in v1.0.0

func (Handler) GetWalletBackup

func (h Handler) GetWalletBackup(ctx context.Context, params oas.GetWalletBackupParams) (res oas.GetWalletBackupRes, err error)

func (Handler) GetWalletsByPublicKey added in v1.0.0

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

func (Handler) PoolsByNominators

func (h Handler) PoolsByNominators(ctx context.Context, params oas.PoolsByNominatorsParams) (oas.PoolsByNominatorsRes, error)

func (Handler) ReindexAccount

func (h Handler) ReindexAccount(ctx context.Context, params oas.ReindexAccountParams) (r oas.ReindexAccountRes, err error)

ReindexAccount updates internal cache for a particular account.

func (Handler) SendMessage

func (h Handler) SendMessage(ctx context.Context, req oas.SendMessageReq) (r oas.SendMessageRes, _ error)

func (Handler) SendMessageLiteServer added in v1.0.0

func (h Handler) SendMessageLiteServer(ctx context.Context, request oas.SendMessageLiteServerReq) (res oas.SendMessageLiteServerRes, err error)

func (Handler) SetWalletBackup

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

func (Handler) StakingPoolHistory added in v1.0.0

func (h Handler) StakingPoolHistory(ctx context.Context, params oas.StakingPoolHistoryParams) (oas.StakingPoolHistoryRes, error)

func (Handler) StakingPoolInfo

func (h Handler) StakingPoolInfo(ctx context.Context, params oas.StakingPoolInfoParams) (oas.StakingPoolInfoRes, error)

func (Handler) StakingPools

func (h Handler) StakingPools(ctx context.Context, params oas.StakingPoolsParams) (r oas.StakingPoolsRes, _ error)

func (Handler) TonConnectProof

func (h Handler) TonConnectProof(ctx context.Context, request oas.TonConnectProofReq) (res oas.TonConnectProofRes, err 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) NormalizedMetadata

type Option

type Option func(o *Options)

func WithAddressBook

func WithAddressBook(book addressBook) Option

func WithChainState

func WithChainState(state chainState) Option

func WithExecutor

func WithExecutor(e executor) Option

func WithLimits

func WithLimits(limits Limits) Option

func WithMessageSender

func WithMessageSender(msgSender messageSender) Option

func WithPreviewGenerator

func WithPreviewGenerator(previewGenerator previewGenerator) Option

func WithRatesSource added in v1.0.0

func WithRatesSource(source ratesSource) Option

func WithSpamRules

func WithSpamRules(spamRules func() rules.Rules) 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)

func (*Server) Run

func (s *Server) Run()

type ServerOption

type ServerOption func(options *ServerOptions)

func WithAsyncMiddleware

func WithAsyncMiddleware(m ...AsyncMiddleware) ServerOption

func WithMemPool

func WithMemPool(memPool sources.MemPoolSource) ServerOption

func WithOgenMiddleware

func WithOgenMiddleware(m ...oas.Middleware) 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"
	VerificationNone      VerificationType = "none"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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