diff --git a/package-lock.json b/package-lock.json index 8498a273..6b62b130 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56003,7 +56003,7 @@ }, "price_pusher": { "name": "@pythnetwork/price-pusher", - "version": "5.4.8", + "version": "5.4.9", "license": "Apache-2.0", "dependencies": { "@injectivelabs/sdk-ts": "1.10.72", diff --git a/price_pusher/package.json b/price_pusher/package.json index beac3924..31d2a000 100644 --- a/price_pusher/package.json +++ b/price_pusher/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/price-pusher", - "version": "5.4.8", + "version": "5.4.9", "description": "Pyth Price Pusher", "homepage": "https://pyth.network", "main": "lib/index.js", diff --git a/price_pusher/src/injective/injective.ts b/price_pusher/src/injective/injective.ts index 7c7c649d..d524ee1e 100644 --- a/price_pusher/src/injective/injective.ts +++ b/price_pusher/src/injective/injective.ts @@ -133,37 +133,37 @@ export class InjectivePricePusher implements IPricePusher { const txService = new TxGrpcClient(this.grpcEndpoint); // simulation - const { - gasInfo: { gasUsed }, - } = await txService.simulate(simulateTxRaw); - - // simulation returns us the approximate gas used - // gas passed with the transaction should be more than that - // in order for it to be successfully executed - // this multiplier takes care of that - const gas = (gasUsed * this.chainConfig.gasMultiplier).toFixed(); - const fee = { - amount: [ - { - denom: "inj", - amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(), - }, - ], - gas, - }; - - const { signBytes, txRaw } = createTransactionFromMsg({ - sequence: this.account.baseAccount.sequence, - accountNumber: this.account.baseAccount.accountNumber, - message: msg, - chainId: this.chainConfig.chainId, - fee, - pubKey: this.wallet.toPublicKey().toBase64(), - }); - - const sig = await this.wallet.sign(Buffer.from(signBytes)); - try { + const { + gasInfo: { gasUsed }, + } = await txService.simulate(simulateTxRaw); + + // simulation returns us the approximate gas used + // gas passed with the transaction should be more than that + // in order for it to be successfully executed + // this multiplier takes care of that + const gas = (gasUsed * this.chainConfig.gasMultiplier).toFixed(); + const fee = { + amount: [ + { + denom: "inj", + amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(), + }, + ], + gas, + }; + + const { signBytes, txRaw } = createTransactionFromMsg({ + sequence: this.account.baseAccount.sequence, + accountNumber: this.account.baseAccount.accountNumber, + message: msg, + chainId: this.chainConfig.chainId, + fee, + pubKey: this.wallet.toPublicKey().toBase64(), + }); + + const sig = await this.wallet.sign(Buffer.from(signBytes)); + this.account.baseAccount.sequence++; /** Append Signatures */