@@ -727,6 +727,53 @@ describe('DOT:', function () {
727727 const result = await basecoin . verifyTransaction ( { txPrebuild, txParams } ) ;
728728 assert . strictEqual ( result , true ) ;
729729 } ) ;
730+
731+ it ( 'should verify a valid consolidation transaction' , async function ( ) {
732+ const mockedWallet = {
733+ coinSpecific : ( ) => ( {
734+ baseAddress : '5CZh773vKGwKFCYUjGc31AwXCbf7TPkavdeuk2XoujJMjbBD' ,
735+ } ) ,
736+ } ;
737+ const txPrebuild = {
738+ txHex :
739+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
740+ } ;
741+
742+ const result = await basecoin . verifyTransaction ( {
743+ txPrebuild,
744+ txParams : { } ,
745+ wallet : mockedWallet as any ,
746+ verification : {
747+ consolidationToBaseAddress : true ,
748+ } ,
749+ } ) ;
750+ assert . strictEqual ( result , true ) ;
751+ } ) ;
752+
753+ it ( 'should reject a consolidation transaction with invalid destination address' , async function ( ) {
754+ const mockedWallet = {
755+ coinSpecific : ( ) => ( {
756+ baseAddress : '5DxD9nT16GQLrU6aB5pSS5VtxoZbVju3NHUCcawxZyZCTf74' ,
757+ } ) ,
758+ } ;
759+ const txPrebuild = {
760+ txHex :
761+ '0xa80a0300161b969b6b53ef81225feea3882284c778cd4a406d23215fcf492e83f75d42960b00204aa9d101eb600400000065900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9a7b7420ee3e4fe2b88da0fc42b30897e18d56d8b56a1934211d9de730cf96de300' ,
762+ } ;
763+
764+ await basecoin
765+ . verifyTransaction ( {
766+ txPrebuild,
767+ txParams : { } ,
768+ wallet : mockedWallet as any ,
769+ verification : {
770+ consolidationToBaseAddress : true ,
771+ } ,
772+ } )
773+ . should . be . rejectedWith (
774+ 'Transaction destination address 5CZh773vKGwKFCYUjGc31AwXCbf7TPkavdeuk2XoujJMjbBD does not match wallet base address 5DxD9nT16GQLrU6aB5pSS5VtxoZbVju3NHUCcawxZyZCTf74'
775+ ) ;
776+ } ) ;
730777 } ) ;
731778
732779 describe ( 'isWalletAddress' , ( ) => {
0 commit comments