diff --git a/modules/sdk-coin-stx/src/stx.ts b/modules/sdk-coin-stx/src/stx.ts index 8c8ce1c7f6..96dbf2b38a 100644 --- a/modules/sdk-coin-stx/src/stx.ts +++ b/modules/sdk-coin-stx/src/stx.ts @@ -46,7 +46,10 @@ export class Stx extends BaseCoin { } async verifyTransaction(params: VerifyTransactionOptions): Promise { - // TODO: Implement when available on the SDK. + const { txParams } = params; + if (txParams?.recipients?.length !== 1) { + throw new Error(`txParams should only have 1 recipient but ${txParams?.recipients?.length} found`); + } return true; } diff --git a/modules/sdk-coin-stx/test/unit/stx.ts b/modules/sdk-coin-stx/test/unit/stx.ts index ae38089e8c..3206d8ed6b 100644 --- a/modules/sdk-coin-stx/test/unit/stx.ts +++ b/modules/sdk-coin-stx/test/unit/stx.ts @@ -4,6 +4,7 @@ import { coins } from '@bitgo/statics'; import * as testData from '../fixtures'; import { Stx, Tstx, StxLib } from '../../src'; import assert from 'assert'; +import { Wallet } from '@bitgo/sdk-core'; const { KeyPair } = StxLib; @@ -284,4 +285,25 @@ describe('STX:', function () { bufferTx.should.be.deepEqual(Buffer.from(testData.unsignedTxForExplainTransfer)); }); }); + + describe('Verify Transaction', function () { + const address1 = '0x174cfd823af8ce27ed0afee3fcf3c3ba259116be'; + const address2 = '0x7e85bdc27c050e3905ebf4b8e634d9ad6edd0de6'; + it('should reject a txPrebuild with more than one recipient', async function () { + const wallet = new Wallet(bitgo, basecoin, {}); + + const txParams = { + recipients: [ + { amount: '1000000000000', address: address1 }, + { amount: '2500000000000', address: address2 }, + ], + wallet: wallet, + walletPassphrase: 'fakeWalletPassphrase', + }; + + await basecoin + .verifyTransaction({ txParams }) + .should.be.rejectedWith('txParams should only have 1 recipient but 2 found'); + }); + }); });