client

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core added in v1.4.0

type Core interface {
	bind.ContractBackend
	ChainID(ctx context.Context) (*big.Int, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	BlockNumber(ctx context.Context) (uint64, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

type DiamondRouter added in v1.4.0

type DiamondRouter interface {
	WatchLock(opts *bind.WatchOpts, sink chan<- *router.RouterLock) (event.Subscription, error)
	HasValidSignaturesLength(opts *bind.CallOpts, _n *big.Int) (bool, error)
	ParseMint(log types.Log) (*router.RouterMint, error)
	ParseBurn(log types.Log) (*router.RouterBurn, error)
	ParseLock(log types.Log) (*router.RouterLock, error)
	ParseUnlock(log types.Log) (*router.RouterUnlock, error)
	ParseBurnERC721(log types.Log) (*router.RouterBurnERC721, error)
	WatchBurn(opts *bind.WatchOpts, sink chan<- *router.RouterBurn) (event.Subscription, error)
	MembersCount(opts *bind.CallOpts) (*big.Int, error)
	MemberAt(opts *bind.CallOpts, _index *big.Int) (common.Address, error)
	TokenFeeData(opts *bind.CallOpts, _token common.Address) (struct {
		ServiceFeePercentage *big.Int
		FeesAccrued          *big.Int
		PreviousAccrued      *big.Int
		Accumulator          *big.Int
	}, error)
	Erc721Fee(opts *bind.CallOpts, _erc721 common.Address) (*big.Int, error)
	Erc721Payment(opts *bind.CallOpts, _erc721 common.Address) (common.Address, error)
}

type EVM added in v1.4.0

type EVM interface {
	bind.ContractBackend
	GetChainID() uint64
	SetChainID(chainId uint64)
	ChainID(ctx context.Context) (*big.Int, error)
	GetClient() Core
	BlockNumber(ctx context.Context) (uint64, error)
	GetBlockTimestamp(blockNumber *big.Int) uint64
	ValidateContractDeployedAt(contractAddress string) (*common.Address, error)
	// WaitForTransactionCallback waits for transaction receipt and depending on receipt status calls one of the provided functions
	// onSuccess is called once the TX is successfully mined
	// onRevert is called once the TX is mined but it reverted
	// onError is called if an error occurs while waiting for TX to go into one of the other 2 states
	WaitForTransactionCallback(hex string, onSuccess, onRevert func(), onError func(err error))
	// WaitForConfirmations starts a loop which ends either when we reach the target block number or an error occurs with block number retrieval
	WaitForConfirmations(raw types.Log) error
	// GetPrivateKey retrieves private key used for the specific EVM Client
	GetPrivateKey() string
	BlockConfirmations() uint64
	// RetryBlockNumber returns the most recent block number
	// Uses a retry mechanism in case the filter query is stuck
	RetryBlockNumber() (uint64, error)
	// RetryFilterLogs returns the logs from the input query
	// Uses a retry mechanism in case the filter query is stuck
	RetryFilterLogs(query ethereum.FilterQuery) ([]types.Log, error)
	// WaitForTransactionReceipt Polls the provided hash every 5 seconds until the transaction mined (either successfully or reverted)
	WaitForTransactionReceipt(hash common.Hash) (txReceipt *types.Receipt, err error)

	RetryTransactionByHash(hash common.Hash) (*types.Transaction, error)
}

type EvmFungibleToken added in v1.4.0

type EvmFungibleToken interface {
	Decimals(opts *bind.CallOpts) (uint8, error)
	Name(opts *bind.CallOpts) (string, error)
	Symbol(opts *bind.CallOpts) (string, error)
	TotalSupply(opts *bind.CallOpts) (*big.Int, error)
	BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error)
}

type EvmNft added in v1.4.0

type EvmNft interface {
	Name(opts *bind.CallOpts) (string, error)
	Symbol(opts *bind.CallOpts) (string, error)
	BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error)
}

type HederaNode

type HederaNode interface {
	// GetClient returns the underlying Hedera SDK client
	GetClient() *hedera.Client
	// SubmitTopicConsensusMessage submits the provided message bytes to the
	// specified HCS `topicId`
	SubmitTopicConsensusMessage(topicId hedera.TopicID, message []byte) (*hedera.TransactionID, error)
	// SubmitScheduledTokenTransferTransaction creates a token transfer transaction and submits it as a scheduled transaction
	SubmitScheduledTokenTransferTransaction(tokenID hedera.TokenID, transfers []transfer.Hedera, payerAccountID hedera.AccountID, memo string) (*hedera.TransactionResponse, error)
	// SubmitScheduledHbarTransferTransaction creates an hbar transfer transaction and submits it as a scheduled transfer transaction
	SubmitScheduledHbarTransferTransaction(transfers []transfer.Hedera, payerAccountID hedera.AccountID, memo string) (*hedera.TransactionResponse, error)
	// SubmitScheduledNftTransferTransaction creates an Nft transfer transaction and submits it as a scheduled transfer transactions
	SubmitScheduledNftTransferTransaction(nftID hedera.NftID, payerAccount hedera.AccountID, sender hedera.AccountID, receiving hedera.AccountID, memo string, approved bool) (*hedera.TransactionResponse, error)
	// SubmitScheduledNftApproveTransaction creates an allowance of for the nft for the spender and submits it as a scheduled transaction
	SubmitScheduledNftApproveTransaction(payer hedera.AccountID, memo string, nftId hedera.NftID, owner, spender hedera.AccountID) (*hedera.TransactionResponse, error)
	// SubmitScheduleSign submits a ScheduleSign transaction for a given ScheduleID
	SubmitScheduleSign(scheduleID hedera.ScheduleID) (*hedera.TransactionResponse, error)
	// SubmitScheduledTokenMintTransaction creates a token mint transaction and submits it as a scheduled mint transaction
	SubmitScheduledTokenMintTransaction(tokenID hedera.TokenID, amount int64, payerAccountID hedera.AccountID, memo string) (*hedera.TransactionResponse, error)
	// SubmitScheduledTokenBurnTransaction creates a token burn transaction and submits it as a scheduled burn transaction
	SubmitScheduledTokenBurnTransaction(id hedera.TokenID, amount int64, account hedera.AccountID, memo string) (*hedera.TransactionResponse, error)
	// TransactionReceiptQuery returns the receipt for a given transaction ID
	TransactionReceiptQuery(transactionID hedera.TransactionID, nodeAccIds []hedera.AccountID) (hedera.TransactionReceipt, error)
}

type HttpClient added in v1.4.0

type HttpClient interface {
	Get(url string) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
}

type MirrorNode

type MirrorNode interface {
	// GetAccountTokenMintTransactionsAfterTimestampString queries the hedera mirror node for transactions on a certain account with type TokenMint
	GetAccountTokenMintTransactionsAfterTimestampString(accountId hedera.AccountID, from string) (*transaction.Response, error)
	// GetAccountTokenMintTransactionsAfterTimestamp queries the hedera mirror node for transactions on a certain account with type TokenMint
	GetAccountTokenMintTransactionsAfterTimestamp(accountId hedera.AccountID, from int64) (*transaction.Response, error)
	// GetAccountTokenBurnTransactionsAfterTimestampString queries the hedera mirror node for transactions on a certain account with type TokenBurn
	GetAccountTokenBurnTransactionsAfterTimestampString(accountId hedera.AccountID, from string) (*transaction.Response, error)
	// GetAccountTokenBurnTransactionsAfterTimestamp queries the hedera mirror node for transactions on a certain account with type TokenBurn
	GetAccountTokenBurnTransactionsAfterTimestamp(accountId hedera.AccountID, from int64) (*transaction.Response, error)
	// GetAccountDebitTransactionsAfterTimestampString queries the hedera mirror node for transactions that are debit and after a given timestamp
	GetAccountDebitTransactionsAfterTimestampString(accountId hedera.AccountID, from string) (*transaction.Response, error)
	// GetAccountCreditTransactionsAfterTimestampString returns all transaction after a given timestamp
	GetAccountCreditTransactionsAfterTimestampString(accountId hedera.AccountID, from string) (*transaction.Response, error)
	// GetAccountCreditTransactionsAfterTimestamp returns all transaction after a given timestamp
	GetAccountCreditTransactionsAfterTimestamp(accountId hedera.AccountID, from int64) (*transaction.Response, error)
	// GetAccountCreditTransactionsBetween returns all incoming Transfers for the specified account between timestamp `from` and `to` excluded
	GetAccountCreditTransactionsBetween(accountId hedera.AccountID, from, to int64) ([]transaction.Transaction, error)
	// GetTransactionsAfterTimestamp returns all transaction after a given timestamp for the specified account and transaction type
	GetTransactionsAfterTimestamp(accountId hedera.AccountID, startTimestamp int64, transactionType string) ([]transaction.Transaction, error)
	// GetMessagesAfterTimestamp returns all topic messages after the given timestamp
	GetMessagesAfterTimestamp(topicId hedera.TopicID, from int64, limit int64) ([]message.Message, error)
	// GetMessageBySequenceNumber returns message from given topic with provided sequence number
	GetMessageBySequenceNumber(topicId hedera.TopicID, sequenceNumber int64) (*message.Message, error)
	// GetLatestMessages returns latest Topic messages
	GetLatestMessages(topicId hedera.TopicID, limit int64) ([]message.Message, error)
	// GetMessagesForTopicBetween returns all topic messages for a given topic between timestamp `from` included and `to` excluded
	GetMessagesForTopicBetween(topicId hedera.TopicID, from, to int64) ([]message.Message, error)
	// GetNftTransactions returns the nft transactions for tokenID and serialNum
	GetNftTransactions(tokenID string, serialNum int64) (transaction.NftTransactionsResponse, error)
	// GetScheduledTransaction gets the Scheduled transaction of an executed transaction
	GetScheduledTransaction(transactionID string) (*transaction.Response, error)
	// GetTransaction gets all data related to a specific transaction id or returns an error
	GetTransaction(transactionID string) (*transaction.Response, error)
	// GetSuccessfulTransaction gets the success transaction by transaction id or returns an error
	GetSuccessfulTransaction(transactionID string) (transaction.Transaction, error)
	// GetSchedule retrieves a schedule entity by its id
	GetSchedule(scheduleID string) (*transaction.Schedule, error)
	// GetStateProof sends a query to get the state proof. If the query is successful, the function returns the state.
	// If the query returns a status != 200, the function returns an error.
	GetStateProof(transactionID string) ([]byte, error)
	// GetNft retrieves an nft token entity by its id and serial number
	GetNft(tokenID string, serialNum int64) (*transaction.Nft, error)
	// AccountExists sends a query to check whether a specific account exists. If the query returns a status != 200, the function returns a false value
	AccountExists(accountID hedera.AccountID) bool
	// GetAccount gets the account data by ID.
	GetAccount(accountID string) (*account.AccountsResponse, error)
	// GetAccountByPublicKey gets the account data by public key
	GetAccountByPublicKey(publicKey string) (*account.AccountsQueryResponse, error)
	// GetToken gets the token data by ID.
	GetToken(tokenID string) (*token.TokenResponse, error)
	// TopicExists sends a query to check whether a specific topic exists. If the query returns a status != 200, the function returns a false value
	TopicExists(topicID hedera.TopicID) bool
	// WaitForTransaction Polls the transaction at intervals. Depending on the
	// result, the corresponding `onSuccess` and `onFailure` functions are called
	WaitForTransaction(txId string, onSuccess, onFailure func())
	// WaitForScheduledTransaction Polls the transaction at intervals. Depending on the
	// result, the corresponding `onSuccess` and `onFailure` functions are called
	WaitForScheduledTransaction(txId string, onSuccess, onFailure func())
	// GetHBARUsdPrice Returns USD price for HBAR
	GetHBARUsdPrice() (price decimal.Decimal, err error)
	// QueryDefaultLimit returns the default records limit per query
	QueryDefaultLimit() int64
	// QueryMaxLimit returns the maximum allowed records limit per query
	QueryMaxLimit() int64
}

type Pricing added in v1.4.0

type Pricing interface {
	// GetUsdPrices Returns USD prices for requested tokens
	GetUsdPrices(idsByNetworkAndAddress map[uint64]map[string]string) (pricesByNetworkAndAddress map[uint64]map[string]decimal.Decimal, err error)
}

Jump to

Keyboard shortcuts

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