-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi there,
We are using this library to process the transactions sent to some of our smart contracts.
When using the BlastApi gateway we get a lot of errors (error code 500) and from the discussion that I've had with the BwareLabs team, this usually means that we requested a block from the future (not finalized yet).
After a quick look at the library code, I noticed that it uses erd_nonce for the current nonce, and not erd_highest_final_nonce. Shouldn't erd_highest_final_nonce give us the last final block?
private async getCurrentNonce(shardId: number): Promise<number> {
const shardInfo = await this.gatewayGet(`network/status/${shardId}`);
return shardInfo.status.erd_nonce;
}I'm proposing the following non-breaking changes to the library:
- Add a new optional property that allows us to specify which nonce to use
export enum TransactionProcessorNonceStrategy {
CurrentNonce = 'erd_nonce',
HighestFinalNonce = 'erd_highest_final_nonce',
}
export class TransactionProcessorOptions {
...
nonceStrategy?: TransactionProcessorNonceStrategy = TransactionProcessorNonceStrategy.CurrentNonce
}- Update the
getCurrentNoncecode to use the the new property
private async getCurrentNonce(shardId: number): Promise<number> {
const shardInfo = await this.gatewayGet(`network/status/${shardId}`);
return shardInfo.status[this.options.nonceStrategy];
}I can create a PR if you are willing to include it in this library.
Metadata
Metadata
Assignees
Labels
No labels