Documentation ¶
Index ¶
Constants ¶
const ( // TransactionStatusTaskName contains the name of the task TransactionStatusTaskName string = "TransactionStatusTask" // TransactionTxHashParam contains the name of the parameter TransactionTxHashParam string = "TxHashParam" // TransactionAccountParam contains the name of the account TransactionAccountParam string = "Account ID" // ErrTransactionFailed error when transaction failed ErrTransactionFailed = errors.Error("Transaction failed") )
const BootstrappedEthereumClient string = "BootstrappedEthereumClient"
BootstrappedEthereumClient is a key to mapped client in bootstrap context.
Variables ¶
This section is empty.
Functions ¶
func DefaultWaitForTransactionMiningContext ¶
func DefaultWaitForTransactionMiningContext(d time.Duration) (ctx context.Context, cancelFunc context.CancelFunc)
DefaultWaitForTransactionMiningContext returns context with timeout for write operations
Types ¶
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (Bootstrapper) Bootstrap(context map[string]interface{}) error
Bootstrap initialises ethereum client.
type Client ¶
type Client interface { // GetEthClient returns the ethereum client GetEthClient() *ethclient.Client // GetNodeURL returns the node url GetNodeURL() *url.URL // GetTxOpts returns a cached options if available else creates and returns new options GetTxOpts(accountName string) (*bind.TransactOpts, error) // SubmitTransactionWithRetries submits transaction to the ethereum chain // Blocking Function that sends transaction using reflection wrapped in a retrial block. It is based on the transactionUnderpriced error, // meaning that a transaction is being attempted to run twice, and the logic is to override the existing one. As we have constant // gas prices that means that a concurrent transaction race condition event has happened. // - contractMethod: Contract Method that implements GenericEthereumAsset (usually autogenerated binding from abi) // - params: Arbitrary number of parameters that are passed to the function fname call // Note: contractMethod must always return "*types.Transaction, error" SubmitTransactionWithRetries(contractMethod interface{}, opts *bind.TransactOpts, params ...interface{}) (tx *types.Transaction, err error) // GetGethCallOpts returns the Call options with default GetGethCallOpts() (*bind.CallOpts, context.CancelFunc) // TransactionByHash returns a Ethereum transaction TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error) // TransactionReceipt return receipt of a transaction TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) // SubmitTransaction creates an Ethereum transactions with retries SubmitTransaction(tendantID identity.CentID, contractMethod interface{}, opts *bind.TransactOpts, params ...interface{}) (*uuid.UUID, *types.Transaction, error) }
Client can be implemented by any chain client
func NewGethClient ¶
func NewGethClient(config Config, transService transactions.Service, queue *queue.Server) (Client, error)
NewGethClient returns an gethClient which implements Client
type Config ¶
type Config interface { GetEthereumGasPrice() *big.Int GetEthereumGasLimit() uint64 GetEthereumNodeURL() string GetEthereumAccount(accountName string) (account *config.AccountConfig, err error) GetEthereumIntervalRetry() time.Duration GetEthereumMaxRetries() int GetTxPoolAccessEnabled() bool GetEthereumContextReadWaitTimeout() time.Duration }
Config defines functions to get ethereum details
type TransactionStatusTask ¶
type TransactionStatusTask struct { transactions.BaseTask // contains filtered or unexported fields }
TransactionStatusTask is struct for the task to check an Ethereum transaction
func NewTransactionStatusTask ¶
func NewTransactionStatusTask( timeout time.Duration, txService transactions.Service, transactionByHash func(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error), transactionReceipt func(ctx context.Context, txHash common.Hash) (*types.Receipt, error), ethContextInitializer func(d time.Duration) (ctx context.Context, cancelFunc context.CancelFunc), ) *TransactionStatusTask
NewTransactionStatusTask returns a the struct for the task
func (*TransactionStatusTask) Copy ¶
func (nftc *TransactionStatusTask) Copy() (gocelery.CeleryTask, error)
Copy returns a new instance of mintingConfirmationTask
func (*TransactionStatusTask) ParseKwargs ¶
func (nftc *TransactionStatusTask) ParseKwargs(kwargs map[string]interface{}) (err error)
ParseKwargs - define a method to parse CentID
func (*TransactionStatusTask) RunTask ¶
func (nftc *TransactionStatusTask) RunTask() (resp interface{}, err error)
RunTask calls listens to events from geth related to MintingConfirmationTask#TokenID and records result.
func (*TransactionStatusTask) TaskTypeName ¶
func (nftc *TransactionStatusTask) TaskTypeName() string
TaskTypeName returns mintingConfirmationTaskName