multichain

package
v0.0.0-...-8ff08b3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainProvider

type ChainProvider struct {
	Ethereum *EthereumProvider
	Tezos    *TezosProvider
	Optimism *OptimismProvider
	Arbitrum *ArbitrumProvider
	Poap     *PoapProvider
	Zora     *ZoraProvider
	Base     *BaseProvider
	Polygon  *PolygonProvider
}

type ContractOwnerResult

type ContractOwnerResult struct {
	Contracts []common.ChainAgnosticContract
	Chain     persist.Chain
}

type ErrProviderFailed

type ErrProviderFailed struct{ Err error }

func (ErrProviderFailed) Error

func (e ErrProviderFailed) Error() string

func (ErrProviderFailed) Unwrap

func (e ErrProviderFailed) Unwrap() error

type Provider

type Provider struct {
	Repos     *postgres.Repositories
	Queries   *db.Queries
	Chains    ProviderLookup
	Submitter tokenmanage.Submitter
}

func NewMultichainProvider

func NewMultichainProvider(contextContext context.Context, repositories *postgres.Repositories, queries *coredb.Queries, client *ethclient.Client, taskClient *task.Client, cache *redis.Cache) *Provider

NewMultichainProvider is a wire injector that sets up a multichain provider instance ethClient.Client and task.Client are expensive to initialize so they're passed as an arg.

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 (p *Provider) GetTokenMetadataByTokenIdentifiers(ctx context.Context, contractAddress persist.Address, tokenID persist.HexTokenID, chain persist.Chain) (persist.TokenMetadata, error)

func (*Provider) GetTokenMetadataByTokenIdentifiersBatch

func (p *Provider) GetTokenMetadataByTokenIdentifiersBatch(ctx context.Context, chain persist.Chain, tIDs []common.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

func (p *Provider) RefreshContract(ctx context.Context, ci persist.ContractIdentifiers) error

RefreshContract refreshes a contract on the given chain using the chain provider for that chain

func (*Provider) RefreshToken

func (p *Provider) RefreshToken(ctx context.Context, ti persist.TokenIdentifiers) error

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 (p *Provider) SyncCreatedTokensForExistingContract(ctx context.Context, userID persist.DBID, contractID persist.DBID) error

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 ProviderLookup map[persist.Chain]any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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