@@ -1921,6 +1921,31 @@ describe('V2 Wallet:', function () {
19211921 intent . isTss ! . should . equal ( true ) ;
19221922 intent . intentType . should . equal ( 'fillNonce' ) ;
19231923 } ) ;
1924+
1925+ it ( 'should populate intent with custodianTransactionId' , async function ( ) {
1926+ const mpcUtils = new ECDSAUtils . EcdsaUtils ( bitgo , bitgo . coin ( 'gteth' ) ) ;
1927+ const feeOptions = {
1928+ maxFeePerGas : 3000000000 ,
1929+ maxPriorityFeePerGas : 2000000000 ,
1930+ } ;
1931+ const nonce = '1' ;
1932+
1933+ const intent = mpcUtils . populateIntent ( bitgo . coin ( 'gteth' ) , {
1934+ custodianTransactionId : 'unittest' ,
1935+ reqId,
1936+ intentType : 'fillNonce' ,
1937+ nonce,
1938+ feeOptions,
1939+ isTss : true ,
1940+ } ) ;
1941+
1942+ intent . custodianTransactionId ! . should . equal ( 'unittest' ) ;
1943+ intent . should . have . property ( 'recipients' , undefined ) ;
1944+ intent . feeOptions ! . should . deepEqual ( feeOptions ) ;
1945+ intent . nonce ! . should . equal ( nonce ) ;
1946+ intent . isTss ! . should . equal ( true ) ;
1947+ intent . intentType . should . equal ( 'fillNonce' ) ;
1948+ } ) ;
19241949 } ) ;
19251950
19261951 describe ( 'Transaction signing' , function ( ) {
@@ -1946,6 +1971,7 @@ describe('V2 Wallet:', function () {
19461971 } ) ;
19471972 } ) ;
19481973
1974+
19491975 it ( 'should fail to sign transaction without txRequestId' , async function ( ) {
19501976 const txPrebuild = {
19511977 walletId : tssWallet . id ( ) ,
@@ -1965,7 +1991,7 @@ describe('V2 Wallet:', function () {
19651991 txRequestId : 'id' ,
19661992 transactions : [ ] ,
19671993 intent : {
1968- intentType : 'payment ' ,
1994+ intentType : 'signMessage ' ,
19691995 } ,
19701996 date : new Date ( ) . toISOString ( ) ,
19711997 latest : true ,
@@ -2020,6 +2046,23 @@ describe('V2 Wallet:', function () {
20202046 actualArg . messagePrebuild . message . should . equal ( `\u0019Ethereum Signed Message:\\n${ message . length } ${ message } ` ) ;
20212047 } ) ;
20222048
2049+ it ( 'should sign message when custodianMessageId is provided' , async function ( ) {
2050+ const signMessageTssSpy = sinon . spy ( tssEthWallet , 'signMessageTss' as any ) ;
2051+ nock ( bgUrl )
2052+ . post ( `/api/v2/wallet/${ tssEthWallet . id ( ) } /txrequests` )
2053+ . reply ( 200 , txRequestForMessageSigning ) ;
2054+
2055+ const signMessage = await tssEthWallet . signMessage ( {
2056+ custodianMessageId : 'unittest' ,
2057+ reqId,
2058+ messagePrebuild : { message } ,
2059+ prv : 'secretKey' ,
2060+ } ) ;
2061+ signMessage . should . deepEqual ( { txRequestId } ) ;
2062+ const actualArg = signMessageTssSpy . getCalls ( ) [ 0 ] . args [ 0 ] ;
2063+ actualArg . messagePrebuild . message . should . equal ( `\u0019Ethereum Signed Message:\\n${ message . length } ${ message } ` ) ;
2064+ } ) ;
2065+
20232066 it ( 'should sign message when txRequestId not provided' , async function ( ) {
20242067 const signMessageTssSpy = sinon . spy ( tssEthWallet , 'signMessageTss' as any ) ;
20252068 nock ( bgUrl )
0 commit comments