Skip to content

Commit

Permalink
sdk: expect signTransaction from wallet adapters to return a copy (#299)
Browse files Browse the repository at this point in the history
* sdk: expect signTransaction from wallet adapters to return a copy

* update CHANGELOG

Co-authored-by: Chris Heaney <[email protected]>
  • Loading branch information
evanpipta and crispheaney committed Dec 22, 2022
1 parent f98d539 commit 55667b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixes

- ts-sdk: expect signTransaction from wallet adapters to return a copy ([#299](https://github.com/drift-labs/protocol-v2/pull/299))

### Breaking

## [2.8.0] - 2022-12-22
Expand Down
14 changes: 7 additions & 7 deletions sdk/src/tx/retryTxSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export class RetryTxSender implements TxSender {
opts = this.provider.opts;
}

if (!preSigned) {
await this.prepareTx(tx, additionalSigners, opts);
}
const signedTx = preSigned
? tx
: await this.prepareTx(tx, additionalSigners, opts);

const rawTransaction = tx.serialize();
const rawTransaction = signedTx.serialize();
const startTime = this.getTimestamp();

let txid: TransactionSignature;
Expand Down Expand Up @@ -123,14 +123,14 @@ export class RetryTxSender implements TxSender {
)
).blockhash;

await this.provider.wallet.signTransaction(tx);
const signedTx = await this.provider.wallet.signTransaction(tx);
additionalSigners
.filter((s): s is Signer => s !== undefined)
.forEach((kp) => {
tx.partialSign(kp);
signedTx.partialSign(kp);
});

return tx;
return signedTx;
}

async confirmTransaction(
Expand Down

0 comments on commit 55667b7

Please sign in to comment.