From df69c67b1737c84f6e3b97d2c1b05f6c01484f13 Mon Sep 17 00:00:00 2001 From: Nagaprasadvr Date: Mon, 11 Sep 2023 17:33:07 +0530 Subject: [PATCH] add sendAndConfirmTx fn when signing individual txs --- .../plugins/psyoptionsEuropeanInstrumentModule/helpers.ts | 8 ++++---- packages/js/src/plugins/rpcModule/RpcClient.ts | 4 ++-- packages/js/src/utils/TransactionBuilder.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/js/src/plugins/psyoptionsEuropeanInstrumentModule/helpers.ts b/packages/js/src/plugins/psyoptionsEuropeanInstrumentModule/helpers.ts index faaf4c734..7e9d5ca61 100644 --- a/packages/js/src/plugins/psyoptionsEuropeanInstrumentModule/helpers.ts +++ b/packages/js/src/plugins/psyoptionsEuropeanInstrumentModule/helpers.ts @@ -46,8 +46,9 @@ export const initializeNewEuropeanOption = async ( if (tx.instructions.length > 0) { tx.recentBlockhash = latestBlockHash.blockhash; tx.feePayer = convergence.rpc().getDefaultFeePayer().publicKey; - await convergence.identity().signTransaction(tx); - await convergence.rpc().serializeAndSendTransaction(tx, latestBlockHash); + await convergence + .rpc() + .sendAndConfirmTransaction(tx, [convergence.identity()]); } const strikePriceSize = addDecimals(strikePrice, stableMint.decimals); @@ -79,10 +80,9 @@ export const initializeNewEuropeanOption = async ( const createTx = new Transaction().add(createIx); createTx.recentBlockhash = latestBlockHash.blockhash; createTx.feePayer = convergence.rpc().getDefaultFeePayer().publicKey; - const signedTx = await convergence.identity().signTransaction(createTx); await convergence .rpc() - .serializeAndSendTransaction(signedTx, latestBlockHash); + .sendAndConfirmTransaction(createTx, [convergence.identity()]); } return { diff --git a/packages/js/src/plugins/rpcModule/RpcClient.ts b/packages/js/src/plugins/rpcModule/RpcClient.ts index a89551491..9f3501632 100644 --- a/packages/js/src/plugins/rpcModule/RpcClient.ts +++ b/packages/js/src/plugins/rpcModule/RpcClient.ts @@ -283,8 +283,8 @@ export class RpcClient { async sendAndConfirmTransaction( transaction: Transaction | TransactionBuilder, - confirmOptions?: ConfirmOptions, - signers: Signer[] = [] + signers: Signer[] = [], + confirmOptions?: ConfirmOptions ): Promise { const prepared = await this.prepareTransaction(transaction, signers); const { blockhashWithExpiryBlockHeight } = prepared; diff --git a/packages/js/src/utils/TransactionBuilder.ts b/packages/js/src/utils/TransactionBuilder.ts index 04be4161e..54d51f00a 100644 --- a/packages/js/src/utils/TransactionBuilder.ts +++ b/packages/js/src/utils/TransactionBuilder.ts @@ -196,7 +196,7 @@ export class TransactionBuilder { ): Promise<{ response: SendAndConfirmTransactionResponse } & C> { const response = await convergence .rpc() - .sendAndConfirmTransaction(this, confirmOptions); + .sendAndConfirmTransaction(this, [], confirmOptions); return { response,