Documentation
¶
Index ¶
- Constants
- Variables
- func FindIndexes(sortedList []AttachedAccount, prefix string) (int, int)
- func GenerateSlugVariants(name string) []string
- func Refresher(name string, interval, errorInterval time.Duration, logger *zap.Logger, ...)
- type AttachedAccount
- type AttachedAccountType
- type Book
- func (b *Book) GetAddressInfoByAddress(a tongo.AccountID) (KnownAddress, bool)
- func (b *Book) GetCollectionInfoByAddress(a tongo.AccountID) (KnownCollection, bool)
- func (b *Book) GetJettonInfoByAddress(a tongo.AccountID) (KnownJetton, bool)
- func (b *Book) GetKnownCollections() map[tongo.AccountID]KnownCollection
- func (b *Book) GetKnownJettons() map[tongo.AccountID]KnownJetton
- func (b *Book) GetTFPoolInfo(a tongo.AccountID) (TFPoolInfo, bool)
- func (b *Book) IsWallet(addr tongo.AccountID) (bool, error)
- func (b *Book) SearchAttachedAccountsByPrefix(prefix string) []AttachedAccount
- func (b *Book) TFPools() []tongo.AccountID
- type KnownAddress
- type KnownCollection
- type KnownJetton
- type Option
- type Options
- type TFPoolInfo
Constants ¶
const ( KnownAccountWeight = 5000 BoostForFullMatch = 100 BoostForVerified = 50 )
AttachedAccountType represents the type of the attached account
Variables ¶
var NormalizeReg = regexp.MustCompile("[^\\p{L}\\p{N}]")
NormalizeReg is a regular expression to remove all non-letter and non-number characters
Functions ¶
func FindIndexes ¶
func FindIndexes(sortedList []AttachedAccount, prefix string) (int, int)
FindIndexes finds the start and end indexes of the prefix in the sorted list
func GenerateSlugVariants ¶
GenerateSlugVariants generates name variants by rotating the words
Types ¶
type AttachedAccount ¶
type AttachedAccount struct {
Name string `json:"name"`
Preview string `json:"preview"`
Wallet ton.AccountID `json:"wallet"`
Slug string `json:"-"`
Symbol string `json:"-"`
Type AttachedAccountType `json:"-"`
Weight int64 `json:"-"`
Popular int64 `json:"-"`
Trust core.TrustType `json:"-"`
Normalized string `json:"-"`
}
AttachedAccount represents domains, nft collections for quick search by name are presented
func ConvertAttachedAccount ¶
func ConvertAttachedAccount(name, slug, image string, account ton.AccountID, weight int, trust core.TrustType, accountType AttachedAccountType) (AttachedAccount, error)
ConvertAttachedAccount converts a known account to an attached account
type AttachedAccountType ¶
type AttachedAccountType string
AttachedAccountType defines different types of accounts (e.g., manual, NFT)
const ( ManualAccountType AttachedAccountType = "manual" NftCollectionAccountType AttachedAccountType = "collection" NftItemAccountType AttachedAccountType = "nft" TonDomainAccountType AttachedAccountType = "ton_domain" TgDomainAccountType AttachedAccountType = "tg_domain" JettonSymbolAccountType AttachedAccountType = "jetton_symbol" JettonNameAccountType AttachedAccountType = "jetton_name" )
type Book ¶
type Book struct {
// contains filtered or unexported fields
}
Book holds information about known accounts, jettons, NFT collections manually crafted by the tonkeeper team and the community
func NewAddressBook ¶
func NewAddressBook(logger *zap.Logger, addressPath, jettonPath, collectionPath string, storage accountsStatesSource, opts ...Option) *Book
NewAddressBook initializes a Book and starts background refreshers tasks
func (*Book) GetAddressInfoByAddress ¶
func (b *Book) GetAddressInfoByAddress(a tongo.AccountID) (KnownAddress, bool)
GetAddressInfoByAddress fetches address info if available
func (*Book) GetCollectionInfoByAddress ¶
func (b *Book) GetCollectionInfoByAddress(a tongo.AccountID) (KnownCollection, bool)
GetCollectionInfoByAddress retrieves collection info for a specific address
func (*Book) GetJettonInfoByAddress ¶
func (b *Book) GetJettonInfoByAddress(a tongo.AccountID) (KnownJetton, bool)
GetJettonInfoByAddress fetches jetton info for a specific address
func (*Book) GetKnownCollections ¶
func (b *Book) GetKnownCollections() map[tongo.AccountID]KnownCollection
GetKnownCollections returns all known collections
func (*Book) GetKnownJettons ¶
func (b *Book) GetKnownJettons() map[tongo.AccountID]KnownJetton
GetKnownJettons returns all known jettons
func (*Book) GetTFPoolInfo ¶
func (b *Book) GetTFPoolInfo(a tongo.AccountID) (TFPoolInfo, bool)
GetTFPoolInfo retrieves token pool info for an account
func (*Book) SearchAttachedAccountsByPrefix ¶
func (b *Book) SearchAttachedAccountsByPrefix(prefix string) []AttachedAccount
SearchAttachedAccountsByPrefix searches for accounts by prefix
type KnownAddress ¶
type KnownAddress struct {
IsScam bool `json:"is_scam,omitempty"`
RequireMemo bool `json:"require_memo,omitempty"`
Name string `json:"name"`
Address string `json:"address"`
Image string `json:"image,omitempty"`
}
KnownAddress represents additional manually crafted information about a particular account in the blockchain
type KnownCollection ¶
type KnownCollection struct {
Address string `json:"address"`
Approvers []oas.NftApprovedByItem
}
KnownCollection represents additional manually crafted information about a particular NFT collection in the blockchain
type KnownJetton ¶
type KnownJetton struct {
Name string `json:"name"`
Verification core.TrustType `json:"verification"`
Description string `json:"description"`
Image string `json:"image"`
Address string `json:"address"`
Symbol string `json:"symbol"`
MaxSupply decimal.Decimal `json:"max_supply"`
Websites []string `json:"websites,omitempty"`
Social []string `json:"social,omitempty"`
Coinmarketcap string `json:"coinmarketcap,omitempty"`
Coingecko string `json:"coingecko,omitempty"`
}
KnownJetton represents additional manually crafted information about a particular jetton in the blockchain
type Option ¶
type Option func(o *Options)
func WithAdditionalAddressesSource ¶
func WithAdditionalAddressesSource(a addresser) Option
type TFPoolInfo ¶
type TFPoolInfo struct {
Name string `json:"name"`
GroupName string `json:"groupName"`
Address string `json:"address"`
}
TFPoolInfo holds information about a token pool