File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ export class Stx extends BaseCoin {
4646 }
4747
4848 async verifyTransaction ( params : VerifyTransactionOptions ) : Promise < boolean > {
49- // TODO: Implement when available on the SDK.
49+ const { txParams } = params ;
50+ if ( txParams ?. recipients ?. length !== 1 ) {
51+ throw new Error ( `txParams should only have 1 recipient but ${ txParams ?. recipients ?. length } found` ) ;
52+ }
5053 return true ;
5154 }
5255
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { coins } from '@bitgo/statics';
44import * as testData from '../fixtures' ;
55import { Stx , Tstx , StxLib } from '../../src' ;
66import assert from 'assert' ;
7+ import { Wallet } from '@bitgo/sdk-core' ;
78
89const { KeyPair } = StxLib ;
910
@@ -284,4 +285,25 @@ describe('STX:', function () {
284285 bufferTx . should . be . deepEqual ( Buffer . from ( testData . unsignedTxForExplainTransfer ) ) ;
285286 } ) ;
286287 } ) ;
288+
289+ describe ( 'Verify Transaction' , function ( ) {
290+ const address1 = '0x174cfd823af8ce27ed0afee3fcf3c3ba259116be' ;
291+ const address2 = '0x7e85bdc27c050e3905ebf4b8e634d9ad6edd0de6' ;
292+ it ( 'should reject a txPrebuild with more than one recipient' , async function ( ) {
293+ const wallet = new Wallet ( bitgo , basecoin , { } ) ;
294+
295+ const txParams = {
296+ recipients : [
297+ { amount : '1000000000000' , address : address1 } ,
298+ { amount : '2500000000000' , address : address2 } ,
299+ ] ,
300+ wallet : wallet ,
301+ walletPassphrase : 'fakeWalletPassphrase' ,
302+ } ;
303+
304+ await basecoin
305+ . verifyTransaction ( { txParams } )
306+ . should . be . rejectedWith ( 'txParams should only have 1 recipient but 2 found' ) ;
307+ } ) ;
308+ } ) ;
287309} ) ;
You can’t perform that action at this time.
0 commit comments