TransactionQueue
Class to manage procedural transaction queues
Type parameters
▪ ProcedureReturnType
▪ ReturnType
▪ TransactionArgs: unknown[][]
Hierarchy
TransactionQueue
Index
Constructors
Properties
Methods
Constructors
constructor
new TransactionQueue(
args
: object,context
: Context): TransactionQueue
Defined in src/base/TransactionQueue.ts:91
Create a transaction queue
Parameters:
▪ args: object
▪ context: Context
Returns: TransactionQueue
Properties
Optional
error
Optional
error• error? : PolymeshError
Defined in src/base/TransactionQueue.ts:59
optional error information
status
• status: TransactionQueueStatus = TransactionQueueStatus.Idle
Defined in src/base/TransactionQueue.ts:54
status of the queue
transactions
• transactions: PolymeshTransactionArray‹TransactionArgs›
Defined in src/base/TransactionQueue.ts:49
transactions that will be run in the queue
Methods
getMinFees
▸ getMinFees(): Promise‹FeesBreakdown›
Defined in src/base/TransactionQueue.ts:189
Retrieves a lower bound of the fees required to execute this transaction queue. Transaction fees can be higher at execution time for three reasons:
One or more transaction arguments depend on the result of another transaction in the queue.
This means fees can't be calculated for said transaction until previous transactions in the queue have run
Protocol or gas fees may vary between when this value is fetched and when the transaction is actually executed because of a
governance vote
Transaction fees are broken down between those that have to be paid by the current Account and those that will be paid by third parties. In most cases, the entirety of the fees will be paid by either the current Account or a single third party Account
Returns: Promise‹FeesBreakdown›
onProcessedByMiddleware
▸ onProcessedByMiddleware(listener
: function): function
Defined in src/base/TransactionQueue.ts:319
Subscribe to the results of this queue being processed by the harvester (and as such, available to the middleware)
note
this event will be fired even if the queue fails
throws
if the middleware wasn't enabled when instantiating the SDK client
Parameters:
▪ listener: function
callback function that will be called whenever the middleware is updated with the latest data. If there is an error (timeout or middleware offline) it will be passed to this callback
▸ (err?
: PolymeshError): void
Parameters:
Returns: function
unsubscribe function
▸ (): void
onStatusChange
▸ onStatusChange(listener
: function): function
Defined in src/base/TransactionQueue.ts:282
Subscribe to status changes on the Transaction Queue
Parameters:
▪ listener: function
callback function that will be called whenever the Transaction Queue's status changes
▸ (transactionQueue
: this, err?
: PolymeshError): void
Parameters:
Returns: function
unsubscribe function
▸ (): void
onTransactionStatusChange
▸ onTransactionStatusChange‹TxArgs, Values›(listener
: function): function
Defined in src/base/TransactionQueue.ts:299
Subscribe to status changes on individual transactions
Type parameters:
▪ TxArgs: unknown[]
▪ Values: unknown[]
Parameters:
▪ listener: function
callback function that will be called whenever the individual transaction's status changes
▸ (transaction
: PolymeshTransactionBase‹TxArgs, Values›, transactionQueue
: this): void
Parameters:
Returns: function
unsubscribe function
▸ (): void
run
▸ run(): Promise‹ReturnType›
Defined in src/base/TransactionQueue.ts:136
Run the transactions in the queue in sequential order. If a transaction fails or the user refuses to sign it, one of two things can happen:
1) If transaction.isCritical === true
, the entire queue fails and the corresponding error is stored in this.error
as well as thrown 2) Otherwise, the queue continues executing and the error is stored in transaction.error
Returns: Promise‹ReturnType›
Last updated