diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts index ce5ce4732..cef5304a2 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts @@ -51,7 +51,6 @@ interface MsgBroadcasterLocalOptions { ethereumChainId?: EthereumChainId simulateTx?: boolean gasBufferCoefficient?: number - increaseSequenceLocally?: boolean } /** @@ -73,8 +72,6 @@ export class MsgBroadcasterLocal { public simulateTx: boolean = false - public increaseSequenceLocally: boolean = false - public baseAccount: BaseAccount | undefined = undefined public gasBufferCoefficient = 1.1 @@ -86,7 +83,6 @@ export class MsgBroadcasterLocal { const endpoints = getNetworkEndpoints(options.network) this.simulateTx = options.simulateTx || false - this.increaseSequenceLocally = options.increaseSequenceLocally || false this.chainId = networkInfo.chainId this.gasBufferCoefficient = options.gasBufferCoefficient || 1.1 this.ethereumChainId = @@ -312,7 +308,7 @@ export class MsgBroadcasterLocal { } private async getAccountDetails() { - if (this.baseAccount && this.increaseSequenceLocally) { + if (this.baseAccount) { return this.baseAccount.toAccountDetails() } @@ -327,8 +323,6 @@ export class MsgBroadcasterLocal { } private async incrementTxCount() { - if (this.increaseSequenceLocally) { - this.txCount += 1 - } + this.txCount += 1 } } diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts index 31af1944a..f9363b4ae 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts @@ -53,6 +53,7 @@ interface MsgBroadcasterWithPkOptions { ethereumChainId?: EthereumChainId simulateTx?: boolean loggingEnabled?: boolean + gasBufferCoefficient?: number } /** @@ -76,10 +77,13 @@ export class MsgBroadcasterWithPk { public loggingEnabled: boolean = false + public gasBufferCoefficient: number = 1.1 + constructor(options: MsgBroadcasterWithPkOptions) { const networkInfo = getNetworkInfo(options.network) const endpoints = getNetworkEndpoints(options.network) + this.gasBufferCoefficient = options.gasBufferCoefficient || 1.1 this.simulateTx = options.simulateTx || false this.loggingEnabled = options.loggingEnabled || false this.chainId = networkInfo.chainId @@ -212,10 +216,10 @@ export class MsgBroadcasterWithPk { * * If we want to simulate the transaction we set the * gas limit based on the simulation and add a small multiplier - * to be safe (factor of 1.1) + * to be safe (factor of 1.1 (or user specified)) */ private async getTxWithStdFee(args: CreateTransactionArgs) { - const { simulateTx } = this + const { simulateTx, gasBufferCoefficient } = this if (!simulateTx) { return createTransaction(args) @@ -229,7 +233,9 @@ export class MsgBroadcasterWithPk { const stdGasFee = getStdFee({ ...args.fee, - gas: new BigNumberInBase(result.gasInfo.gasUsed).times(1.1).toFixed(), + gas: new BigNumberInBase(result.gasInfo.gasUsed) + .times(gasBufferCoefficient) + .toFixed(), }) return createTransaction({ ...args, fee: stdGasFee }) @@ -313,6 +319,7 @@ export class MsgBroadcasterWithPk { privateKey.toBech32(), ) const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) + return baseAccount.toAccountDetails() }