@@ -664,12 +664,69 @@ describe('DOT:', function () {
664664 walletPassphrase : 'fakeWalletPassphrase' ,
665665 } ;
666666
667+ const txPrebuild = {
668+ txHex :
669+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
670+ } ;
671+
667672 await basecoin
668- . verifyTransaction ( { txParams } )
673+ . verifyTransaction ( { txPrebuild , txParams } )
669674 . should . be . rejectedWith (
670675 `tdot doesn't support sending to more than 1 destination address within a single transaction. Try again, using only a single recipient.`
671676 ) ;
672677 } ) ;
678+
679+ it ( 'should reject a txPrebuild with more than invalid amount' , async function ( ) {
680+ const wallet = new Wallet ( bitgo , basecoin , { } ) ;
681+ const txParams = {
682+ recipients : [ { amount : '20000000000' , address : '5CZh773vKGwKFCYUjGc31AwXCbf7TPkavdeuk2XoujJMjbBD' } ] ,
683+ wallet : wallet ,
684+ walletPassphrase : 'fakeWalletPassphrase' ,
685+ } ;
686+ const txPrebuild = {
687+ txHex :
688+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
689+ } ;
690+
691+ await basecoin
692+ . verifyTransaction ( { txPrebuild, txParams } )
693+ . should . be . rejectedWith ( `Recipient amount 20000000000 does not match transaction amount 2000000000000` ) ;
694+ } ) ;
695+
696+ it ( 'should reject a txPrebuild with more than invalid recipient' , async function ( ) {
697+ const wallet = new Wallet ( bitgo , basecoin , { } ) ;
698+ const txParams = {
699+ recipients : [ { amount : '2000000000000' , address : '5CZh773vKGwKFCUjGc31AwXCbf7TPkavduk2XoujJMjbBD' } ] ,
700+ wallet : wallet ,
701+ walletPassphrase : 'fakeWalletPassphrase' ,
702+ } ;
703+ const txPrebuild = {
704+ txHex :
705+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
706+ } ;
707+
708+ await basecoin
709+ . verifyTransaction ( { txPrebuild, txParams } )
710+ . should . be . rejectedWith (
711+ `Recipient address 5CZh773vKGwKFCUjGc31AwXCbf7TPkavduk2XoujJMjbBD does not match transaction destination address 5CZh773vKGwKFCYUjGc31AwXCbf7TPkavdeuk2XoujJMjbBD`
712+ ) ;
713+ } ) ;
714+
715+ it ( 'should accept a txPrebuild with more than valid recipient and amount' , async function ( ) {
716+ const wallet = new Wallet ( bitgo , basecoin , { } ) ;
717+ const txParams = {
718+ recipients : [ { amount : '2000000000000' , address : '5CZh773vKGwKFCYUjGc31AwXCbf7TPkavdeuk2XoujJMjbBD' } ] ,
719+ wallet : wallet ,
720+ walletPassphrase : 'fakeWalletPassphrase' ,
721+ } ;
722+ const txPrebuild = {
723+ txHex :
724+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
725+ } ;
726+
727+ const result = await basecoin . verifyTransaction ( { txPrebuild, txParams } ) ;
728+ assert . strictEqual ( result , true ) ;
729+ } ) ;
673730 } ) ;
674731
675732 describe ( 'isWalletAddress' , ( ) => {
0 commit comments