@@ -3,7 +3,7 @@ import 'should';
33import { TestBitGo , TestBitGoAPI } from '@bitgo/sdk-test' ;
44import { BitGoAPI } from '@bitgo/sdk-api' ;
55import { Txrp } from '../../src/txrp' ;
6- const ripple = require ( '../../src/ripple' ) ;
6+ import ripple from '../../src/ripple' ;
77
88import * as nock from 'nock' ;
99import assert from 'assert' ;
@@ -91,7 +91,7 @@ describe('XRP:', function () {
9191 txHex :
9292 '{"TransactionType":"Payment","Account":"rBSpCz8PafXTJHppDcNnex7dYnbe3tSuFG","Destination":"rfjub8A4dpSD5nnszUFTsLprxu1W398jwc","DestinationTag":0,"Amount":"253481","Flags":2147483648,"LastLedgerSequence":1626225,"Fee":"45","Sequence":7}' ,
9393 } ) ;
94- unsignedExplanation . id . should . equal ( 'CB36F366F1AC25FCDB38A19F17384ED3509D9B7F063520034597852FB10A1B45 ' ) ;
94+ unsignedExplanation . id . should . equal ( '37486621138DFB0C55FEF45FD275B565254464651A04CB02EE371F8C4A84D8CA ' ) ;
9595 signedExplanation . id . should . equal ( 'D52681436CC5B94E9D00BC8172047B1A6F3C028D2D0A5CDFB81680039C48ADFD' ) ;
9696 unsignedExplanation . outputAmount . should . equal ( '253481' ) ;
9797 signedExplanation . outputAmount . should . equal ( '253481' ) ;
@@ -122,7 +122,7 @@ describe('XRP:', function () {
122122 txHex :
123123 '{"TransactionType":"AccountSet","Account":"r95xbEHFzDfc9XfmXHaDnj6dHNntT9RNcy","Fee":"45","Sequence":15070378,"LastLedgerSequence":15320391,"MessageKey":"02000000000000000000000000415F8315C9948AD91E2CCE5B8583A36DA431FB61"}' ,
124124 } ) ;
125- unsignedExplanation . id . should . equal ( '69E8A046124F15749BF75554D82F19282C1FECAA9785444FCC21107528741EDD ' ) ;
125+ unsignedExplanation . id . should . equal ( 'A0F2AF7A3E0936BCFEE0D047789502D01518D9A4F1287D50568D66474475B3E7 ' ) ;
126126 unsignedExplanation . accountSet . messageKey . should . equal (
127127 '02000000000000000000000000415F8315C9948AD91E2CCE5B8583A36DA431FB61'
128128 ) ;
@@ -141,17 +141,19 @@ describe('XRP:', function () {
141141 xrpAddress : 'rJBWFy35Ya3qDZD89DuWBwm8oBbYmqb3H9' ,
142142 } ;
143143
144- const rippleLib = ripple ( ) ;
145- const fullySigned = rippleLib . signWithPrivateKey ( halfSignedTxHex , signer . rawPrv , {
144+ const fullySigned = ripple . signWithPrivateKey ( halfSignedTxHex , signer . rawPrv , {
146145 signAs : signer . xrpAddress ,
147146 } ) ;
148147
149148 const signedTransaction = rippleBinaryCodec . decode ( fullySigned . signedTransaction ) ;
150- signedTransaction . TransactionType . should . equal ( 'Payment' ) ;
151- signedTransaction . Amount . should . equal ( '14999970' ) ;
152- signedTransaction . Account . should . equal ( 'rBfhJ6HopLW69xK83nyShdNxC3uggjs46K' ) ;
153- signedTransaction . Destination . should . equal ( 'rKuDJCu188nbLDs2zfaT2RNScS6aa63PLC' ) ;
154- signedTransaction . Signers . length . should . equal ( 2 ) ;
149+ signedTransaction . should . containDeep ( {
150+ TransactionType : 'Payment' ,
151+ Amount : '14999970' ,
152+ Account : 'rBfhJ6HopLW69xK83nyShdNxC3uggjs46K' ,
153+ Destination : 'rKuDJCu188nbLDs2zfaT2RNScS6aa63PLC' ,
154+ } ) ;
155+ assert ( Array . isArray ( signedTransaction . Signers ) ) ;
156+ ( signedTransaction . Signers as Array < string > ) . length . should . equal ( 2 ) ;
155157 } ) ;
156158
157159 it ( 'should be able to cosign XRP transaction in any form' , function ( ) {
@@ -168,11 +170,10 @@ describe('XRP:', function () {
168170 xrpAddress : 'rJBWFy35Ya3qDZD89DuWBwm8oBbYmqb3H9' ,
169171 } ;
170172
171- const rippleLib = ripple ( ) ;
172- const coSignedHexTransaction = rippleLib . signWithPrivateKey ( unsignedTxHex , signer . rawPrv , {
173+ const coSignedHexTransaction = ripple . signWithPrivateKey ( unsignedTxHex , signer . rawPrv , {
173174 signAs : signer . xrpAddress ,
174175 } ) ;
175- const coSignedJsonTransaction = rippleLib . signWithPrivateKey ( unsignedTxJson , signer . rawPrv , {
176+ const coSignedJsonTransaction = ripple . signWithPrivateKey ( unsignedTxJson , signer . rawPrv , {
176177 signAs : signer . xrpAddress ,
177178 } ) ;
178179 coSignedHexTransaction . signedTransaction . should . equal ( coSignedJsonTransaction . signedTransaction ) ;
0 commit comments