Skip to content

Commit 4f377a8

Browse files
committed
feat(sdk-core): add transaction verification to validate platform built transactions
Ticket: WP-5945
1 parent 13dad4a commit 4f377a8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,18 @@ export class Wallet implements IWallet {
735735
return buildResponse;
736736
}
737737

738+
// Validate that the platform-built transaction matches user parameters
739+
const txPrebuilds = Array.isArray(buildResponse) ? buildResponse : [buildResponse];
740+
for (const txPrebuild of txPrebuilds) {
741+
await this.baseCoin.verifyTransaction({
742+
txParams: params,
743+
txPrebuild,
744+
wallet: this,
745+
verification: params.verification ?? {},
746+
reqId,
747+
});
748+
}
749+
738750
const keychains = (await this.baseCoin
739751
.keychains()
740752
.getKeysForSigning({ wallet: this, reqId })) as unknown as Keychain[];
@@ -751,8 +763,6 @@ export class Wallet implements IWallet {
751763
allowNonSegwitSigningWithoutPrevTx: !!params.bulk,
752764
};
753765

754-
const txPrebuilds = Array.isArray(buildResponse) ? buildResponse : [buildResponse];
755-
756766
const selectParams = _.pick(params, ['comment', 'otp', 'bulk']);
757767

758768
const response = await Promise.all(

0 commit comments

Comments
 (0)