Skip to content

Commit

Permalink
add sendAndConfirmTx fn when signing individual txs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagaprasadvr committed Sep 11, 2023
1 parent 85aa453 commit df69c67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/js/src/plugins/rpcModule/RpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ export class RpcClient {

async sendAndConfirmTransaction(
transaction: Transaction | TransactionBuilder,
confirmOptions?: ConfirmOptions,
signers: Signer[] = []
signers: Signer[] = [],
confirmOptions?: ConfirmOptions
): Promise<SendAndConfirmTransactionResponse> {
const prepared = await this.prepareTransaction(transaction, signers);
const { blockhashWithExpiryBlockHeight } = prepared;
Expand Down
2 changes: 1 addition & 1 deletion packages/js/src/utils/TransactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class TransactionBuilder<C extends object = object> {
): Promise<{ response: SendAndConfirmTransactionResponse } & C> {
const response = await convergence
.rpc()
.sendAndConfirmTransaction(this, confirmOptions);
.sendAndConfirmTransaction(this, [], confirmOptions);

return {
response,
Expand Down

0 comments on commit df69c67

Please sign in to comment.