Documentation ¶
Index ¶
- Variables
- type ArbitrumProvider
- type BaseProvider
- type ChainAgnosticContract
- type ChainAgnosticContractDescriptors
- type ChainAgnosticIdentifiers
- type ChainAgnosticToken
- type ChainAgnosticTokenDescriptors
- type ChainAgnosticTokensAndContracts
- type ChainProvider
- type ContractFetcher
- type ContractOwnerResult
- type ContractsCreatorFetcher
- type CustomMetadataHandlers
- func (c *CustomMetadataHandlers) AddToPage(ctx context.Context, chain persist.Chain, ...) (<-chan ChainAgnosticTokensAndContracts, <-chan error)
- func (c *CustomMetadataHandlers) AddToToken(ctx context.Context, chain persist.Chain, t ChainAgnosticToken) ChainAgnosticToken
- func (c *CustomMetadataHandlers) HandlerFor(t persist.TokenIdentifiers) metadataHandler
- func (c *CustomMetadataHandlers) Load(ctx context.Context, chain persist.Chain, t ChainAgnosticIdentifiers, ...) persist.TokenMetadata
- func (c *CustomMetadataHandlers) LoadAll(ctx context.Context, chain persist.Chain, tokens []ChainAgnosticToken) []ChainAgnosticToken
- func (c *CustomMetadataHandlers) LoadMetadataAll(ctx context.Context, chain persist.Chain, tokens []ChainAgnosticToken) []persist.TokenMetadata
- type ErrProviderContractNotFound
- type ErrProviderFailed
- type EthereumProvider
- type OptimismProvider
- type PoapProvider
- type PolygonProvider
- type Provider
- func (p *Provider) AddTokensToUserUnchecked(ctx context.Context, userID persist.DBID, ...) ([]op.TokenFullDetails, error)
- func (p *Provider) GetTokenMetadataByTokenIdentifiers(ctx context.Context, contractAddress persist.Address, ...) (persist.TokenMetadata, error)
- func (p *Provider) GetTokenMetadataByTokenIdentifiersBatch(ctx context.Context, chain persist.Chain, tIDs []ChainAgnosticIdentifiers) ([]persist.TokenMetadata, error)
- func (p *Provider) GetTokensOfContractForWallet(ctx context.Context, contractAddress persist.ChainAddress, ...) ([]op.TokenFullDetails, error)
- func (p *Provider) RefreshContract(ctx context.Context, ci persist.ContractIdentifiers) error
- func (p *Provider) RefreshToken(ctx context.Context, ti persist.TokenIdentifiers) error
- func (p *Provider) RefreshTokenDescriptorsByTokenIdentifiers(ctx context.Context, ti persist.TokenIdentifiers) (db.TokenDefinition, error)
- func (p *Provider) SyncCreatedTokensForExistingContract(ctx context.Context, userID persist.DBID, contractID persist.DBID) error
- func (p *Provider) SyncCreatedTokensForNewContracts(ctx context.Context, userID persist.DBID, chains []persist.Chain) error
- func (p *Provider) SyncTokenByUserWalletsAndTokenIdentifiersRetry(ctx context.Context, userID persist.DBID, t persist.TokenIdentifiers, ...) (token op.TokenFullDetails, err error)
- func (p *Provider) SyncTokensByUserID(ctx context.Context, userID persist.DBID, chains []persist.Chain) error
- func (p *Provider) SyncTokensByUserIDAndTokenIdentifiers(ctx context.Context, userID persist.DBID, ...) ([]op.TokenFullDetails, error)
- func (p *Provider) TokenExists(ctx context.Context, token persist.TokenIdentifiers, r retry.Retry) (td db.TokenDefinition, err error)
- func (p *Provider) VerifySignature(ctx context.Context, pSig string, pMessage string, ...) (bool, error)
- type ProviderLookup
- type TezosProvider
- type TokenDescriptorsFetcher
- type TokenIdentifierOwnerFetcher
- type TokenMetadataBatcher
- type TokenMetadataFetcher
- type TokensByContractWalletFetcher
- type TokensByTokenIdentifiersFetcher
- type TokensIncrementalContractFetcher
- type TokensIncrementalOwnerFetcher
- type Verifier
- type ZoraProvider
Constants ¶
This section is empty.
Variables ¶
var ( AutoglyphContract = persist.ContractIdentifiers{ContractAddress: "0xd4e4078ca3495de5b1d4db434bebc5a986197782", Chain: persist.ChainETH} ColorglyphContract = persist.ContractIdentifiers{ContractAddress: "0x60f3680350f65beb2752788cb48abfce84a4759e", Chain: persist.ChainETH} EnsContract = persist.ContractIdentifiers{ContractAddress: eth.EnsAddress, Chain: persist.ChainETH} CryptopunkContract = persist.ContractIdentifiers{ContractAddress: "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb", Chain: persist.ChainETH} ZoraContract = persist.ContractIdentifiers{ContractAddress: "0xabefbc9fd2f806065b4f3c237d4b59d9a97bcac7", Chain: persist.ChainETH} )
Functions ¶
This section is empty.
Types ¶
type ArbitrumProvider ¶
type BaseProvider ¶
type ChainAgnosticContract ¶
type ChainAgnosticContract struct { Descriptors ChainAgnosticContractDescriptors `json:"descriptors"` Address persist.Address `json:"address"` IsSpam *bool `json:"is_spam"` LatestBlock persist.BlockNumber `json:"latest_block"` }
ChainAgnosticContract is a contract that is agnostic to the chain it is on
type ChainAgnosticIdentifiers ¶
type ChainAgnosticIdentifiers struct { ContractAddress persist.Address `json:"contract_address"` TokenID persist.HexTokenID `json:"token_id"` }
ChainAgnosticIdentifiers identify tokens despite their chain
func (ChainAgnosticIdentifiers) String ¶
func (t ChainAgnosticIdentifiers) String() string
type ChainAgnosticToken ¶
type ChainAgnosticToken struct { Descriptors ChainAgnosticTokenDescriptors `json:"descriptors"` TokenType persist.TokenType `json:"token_type"` TokenURI persist.TokenURI `json:"token_uri"` TokenID persist.HexTokenID `json:"token_id"` Quantity persist.HexString `json:"quantity"` OwnerAddress persist.Address `json:"owner_address"` TokenMetadata persist.TokenMetadata `json:"metadata"` ContractAddress persist.Address `json:"contract_address"` FallbackMedia persist.FallbackMedia `json:"fallback_media"` ExternalURL string `json:"external_url"` BlockNumber persist.BlockNumber `json:"block_number"` IsSpam *bool `json:"is_spam"` }
ChainAgnosticToken is a token that is agnostic to the chain it is on
type ChainAgnosticTokenDescriptors ¶
type ChainAgnosticTokenDescriptors struct { Name string `json:"name"` Description string `json:"description"` }
ChainAgnosticTokenDescriptors are the fields that describe a token but cannot be used to uniquely identify it
type ChainAgnosticTokensAndContracts ¶
type ChainAgnosticTokensAndContracts struct { Tokens []ChainAgnosticToken `json:"tokens"` Contracts []ChainAgnosticContract `json:"contracts"` }
type ChainProvider ¶
type ChainProvider struct { Ethereum *EthereumProvider Tezos *TezosProvider Optimism *OptimismProvider Arbitrum *ArbitrumProvider Poap *PoapProvider Zora *ZoraProvider Base *BaseProvider Polygon *PolygonProvider }
type ContractFetcher ¶
type ContractOwnerResult ¶
type ContractOwnerResult struct { Contracts []ChainAgnosticContract Chain persist.Chain }
type ContractsCreatorFetcher ¶
type CustomMetadataHandlers ¶
type CustomMetadataHandlers struct { AutoglyphHandler metadataHandler ColorglyphHandler metadataHandler EnsHandler metadataHandler CryptopunkHandler metadataHandler ZoraHandler metadataHandler }
func (*CustomMetadataHandlers) AddToPage ¶
func (c *CustomMetadataHandlers) AddToPage(ctx context.Context, chain persist.Chain, recCh <-chan ChainAgnosticTokensAndContracts, errIn <-chan error) (<-chan ChainAgnosticTokensAndContracts, <-chan error)
func (*CustomMetadataHandlers) AddToToken ¶
func (c *CustomMetadataHandlers) AddToToken(ctx context.Context, chain persist.Chain, t ChainAgnosticToken) ChainAgnosticToken
func (*CustomMetadataHandlers) HandlerFor ¶
func (c *CustomMetadataHandlers) HandlerFor(t persist.TokenIdentifiers) metadataHandler
func (*CustomMetadataHandlers) Load ¶
func (c *CustomMetadataHandlers) Load(ctx context.Context, chain persist.Chain, t ChainAgnosticIdentifiers, oldMetadata ...persist.TokenMetadata) persist.TokenMetadata
func (*CustomMetadataHandlers) LoadAll ¶
func (c *CustomMetadataHandlers) LoadAll(ctx context.Context, chain persist.Chain, tokens []ChainAgnosticToken) []ChainAgnosticToken
func (*CustomMetadataHandlers) LoadMetadataAll ¶
func (c *CustomMetadataHandlers) LoadMetadataAll(ctx context.Context, chain persist.Chain, tokens []ChainAgnosticToken) []persist.TokenMetadata
type ErrProviderContractNotFound ¶
func (ErrProviderContractNotFound) Error ¶
func (e ErrProviderContractNotFound) Error() string
func (ErrProviderContractNotFound) Unwrap ¶
func (e ErrProviderContractNotFound) Unwrap() error
type ErrProviderFailed ¶
type ErrProviderFailed struct{ Err error }
func (ErrProviderFailed) Error ¶
func (e ErrProviderFailed) Error() string
func (ErrProviderFailed) Unwrap ¶
func (e ErrProviderFailed) Unwrap() error
type EthereumProvider ¶
type EthereumProvider struct { ContractFetcher ContractsCreatorFetcher TokenDescriptorsFetcher TokenIdentifierOwnerFetcher TokenMetadataBatcher TokenMetadataFetcher TokensByContractWalletFetcher TokensByTokenIdentifiersFetcher TokensIncrementalContractFetcher TokensIncrementalOwnerFetcher Verifier }
type OptimismProvider ¶
type PoapProvider ¶
type PoapProvider struct { TokenDescriptorsFetcher TokenMetadataFetcher TokensIncrementalOwnerFetcher TokenIdentifierOwnerFetcher }
type PolygonProvider ¶
type Provider ¶
type Provider struct { Repos *postgres.Repositories Queries *db.Queries Chains ProviderLookup Submitter tokenmanage.Submitter }
func (*Provider) AddTokensToUserUnchecked ¶
func (p *Provider) AddTokensToUserUnchecked(ctx context.Context, userID persist.DBID, tIDs []persist.TokenUniqueIdentifiers, newQuantities []persist.HexString) ([]op.TokenFullDetails, error)
AddTokensToUserUnchecked adds tokens to a user with the requested quantities. AddTokensToUserUnchecked does not make any effort to validate that the user owns the tokens, only that the tokens exist and are fetchable on chain. This is useful for adding tokens to a user when it's already known beforehand that the user owns the token via a trusted source, skipping the potentially expensive operation of fetching a token by its owner.
func (*Provider) GetTokenMetadataByTokenIdentifiers ¶
func (*Provider) GetTokenMetadataByTokenIdentifiersBatch ¶
func (p *Provider) GetTokenMetadataByTokenIdentifiersBatch(ctx context.Context, chain persist.Chain, tIDs []ChainAgnosticIdentifiers) ([]persist.TokenMetadata, error)
func (*Provider) GetTokensOfContractForWallet ¶
func (p *Provider) GetTokensOfContractForWallet(ctx context.Context, contractAddress persist.ChainAddress, wallet persist.L1ChainAddress) ([]op.TokenFullDetails, error)
func (*Provider) RefreshContract ¶
RefreshContract refreshes a contract on the given chain using the chain provider for that chain
func (*Provider) RefreshToken ¶
RefreshToken refreshes a token on the given chain using the chain provider for that chain
func (*Provider) RefreshTokenDescriptorsByTokenIdentifiers ¶
func (p *Provider) RefreshTokenDescriptorsByTokenIdentifiers(ctx context.Context, ti persist.TokenIdentifiers) (db.TokenDefinition, error)
RefreshTokenDescriptorsByTokenIdentifiers will refresh the token descriptors for a token by its identifiers.
func (*Provider) SyncCreatedTokensForExistingContract ¶
func (*Provider) SyncCreatedTokensForNewContracts ¶
func (p *Provider) SyncCreatedTokensForNewContracts(ctx context.Context, userID persist.DBID, chains []persist.Chain) error
SyncCreatedTokensForNewContracts syncs tokens for contracts that the user created but does not currently have any tokens for.
func (*Provider) SyncTokenByUserWalletsAndTokenIdentifiersRetry ¶
func (p *Provider) SyncTokenByUserWalletsAndTokenIdentifiersRetry(ctx context.Context, userID persist.DBID, t persist.TokenIdentifiers, r retry.Retry) (token op.TokenFullDetails, err error)
SyncTokenByUserWalletsAndTokenIdentifiersRetry attempts to sync a token for a user by their wallets and token identifiers.
func (*Provider) SyncTokensByUserID ¶
func (p *Provider) SyncTokensByUserID(ctx context.Context, userID persist.DBID, chains []persist.Chain) error
SyncTokensByUserID updates the media for all tokens for a user
func (*Provider) SyncTokensByUserIDAndTokenIdentifiers ¶
func (p *Provider) SyncTokensByUserIDAndTokenIdentifiers(ctx context.Context, userID persist.DBID, tokenIdentifiers []persist.TokenUniqueIdentifiers) ([]op.TokenFullDetails, error)
SyncTokensByUserIDAndTokenIdentifiers updates the media for specific tokens for a user
func (*Provider) TokenExists ¶
func (p *Provider) TokenExists(ctx context.Context, token persist.TokenIdentifiers, r retry.Retry) (td db.TokenDefinition, err error)
TokenExists checks if a token exists according to any provider by its identifiers. It returns nil if the token exists. If a token exists, it will also update its contract and its descriptors in the database.
func (*Provider) VerifySignature ¶
func (p *Provider) VerifySignature(ctx context.Context, pSig string, pMessage string, pChainAddress persist.ChainPubKey, pWalletType persist.WalletType) (bool, error)
VerifySignature verifies a signature for a wallet address
type ProviderLookup ¶
type TezosProvider ¶
type TokenDescriptorsFetcher ¶
type TokenDescriptorsFetcher interface {
GetTokenDescriptorsByTokenIdentifiers(ctx context.Context, ti ChainAgnosticIdentifiers) (ChainAgnosticTokenDescriptors, ChainAgnosticContractDescriptors, error)
}
type TokenIdentifierOwnerFetcher ¶
type TokenIdentifierOwnerFetcher interface {
GetTokenByTokenIdentifiersAndOwner(context.Context, ChainAgnosticIdentifiers, persist.Address) (ChainAgnosticToken, ChainAgnosticContract, error)
}
type TokenMetadataBatcher ¶
type TokenMetadataBatcher interface {
GetTokenMetadataByTokenIdentifiersBatch(ctx context.Context, tIDs []ChainAgnosticIdentifiers) ([]persist.TokenMetadata, error)
}
type TokenMetadataFetcher ¶
type TokenMetadataFetcher interface {
GetTokenMetadataByTokenIdentifiers(ctx context.Context, ti ChainAgnosticIdentifiers) (persist.TokenMetadata, error)
}
TokenMetadataFetcher supports fetching token metadata
type TokensByContractWalletFetcher ¶
type TokensByContractWalletFetcher interface {
GetTokensByContractWallet(ctx context.Context, contract persist.ChainAddress, wallet persist.Address) ([]ChainAgnosticToken, ChainAgnosticContract, error)
}
type TokensByTokenIdentifiersFetcher ¶
type TokensByTokenIdentifiersFetcher interface {
GetTokensByTokenIdentifiers(context.Context, ChainAgnosticIdentifiers) ([]ChainAgnosticToken, ChainAgnosticContract, error)
}
type TokensIncrementalContractFetcher ¶
type TokensIncrementalContractFetcher interface { // NOTE: implementations MUST close the rec channel // maxLimit is not for pagination, it is to make sure we don't fetch a bajilion tokens from an omnibus contract GetTokensIncrementallyByContractAddress(ctx context.Context, address persist.Address, maxLimit int) (<-chan ChainAgnosticTokensAndContracts, <-chan error) }
TokensIncrementalContractFetcher supports fetching tokens by contract for syncing incrementally
type TokensIncrementalOwnerFetcher ¶
type TokensIncrementalOwnerFetcher interface { // NOTE: implementation MUST close the rec channel GetTokensIncrementallyByWalletAddress(ctx context.Context, address persist.Address) (<-chan ChainAgnosticTokensAndContracts, <-chan error) }
TokensIncrementalOwnerFetcher supports fetching tokens for syncing incrementally
type Verifier ¶
type Verifier interface {
VerifySignature(ctx context.Context, pubKey persist.PubKey, walletType persist.WalletType, nonce string, sig string) (bool, error)
}
Verifier can verify that a signature is signed by a given key