@@ -114,22 +114,74 @@ describe('POST /api/:coin/wallet/generate', () => {
114114 keyType : 'independent' ,
115115 enterprise : 'test_enterprise' ,
116116 } )
117- . reply ( 200 , { id : 'bitgo-key-id' , pub : 'xpub_bitgo' } ) ;
117+ . reply ( 200 , {
118+ id : 'bitgo-key-id' ,
119+ pub : 'xpub_bitgo' ,
120+ source : 'bitgo' ,
121+ type : 'independent' ,
122+ isBitGo : true ,
123+ isTrust : false ,
124+ hsmType : 'institutional' ,
125+ } ) ;
118126
119127 const bitgoAddWalletNock = nock ( bitgoApiUrl )
120128 . post ( `/api/v2/${ coin } /wallet/add` , {
121129 label : 'test_wallet' ,
130+ enterprise : 'test_enterprise' ,
131+ multisigType : 'onchain' ,
132+ coin : coin ,
122133 m : 2 ,
123134 n : 3 ,
124135 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
125136 type : 'cold' ,
126137 subType : 'onPrem' ,
127- multisigType : 'onchain' ,
128- enterprise : 'test_enterprise' ,
129138 } )
130139 . matchHeader ( 'any' , ( ) => true )
131140 . reply ( 200 , {
132141 id : 'new-wallet-id' ,
142+ users : [
143+ {
144+ user : 'user-id' ,
145+ permissions : [ 'admin' , 'spend' , 'view' ] ,
146+ } ,
147+ ] ,
148+ coin : coin ,
149+ label : 'test_wallet' ,
150+ m : 2 ,
151+ n : 3 ,
152+ keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
153+ keySignatures : { } ,
154+ enterprise : 'test_enterprise' ,
155+ organization : 'org-id' ,
156+ bitgoOrg : 'BitGo Inc' ,
157+ tags : [ 'new-wallet-id' , 'test_enterprise' ] ,
158+ disableTransactionNotifications : false ,
159+ freeze : { } ,
160+ deleted : false ,
161+ approvalsRequired : 1 ,
162+ isCold : true ,
163+ coinSpecific : { } ,
164+ admin : { } ,
165+ pendingApprovals : [ ] ,
166+ allowBackupKeySigning : false ,
167+ clientFlags : [ ] ,
168+ recoverable : false ,
169+ startDate : '2025-01-01T00:00:00.000Z' ,
170+ hasLargeNumberOfAddresses : false ,
171+ config : { } ,
172+ balanceString : '0' ,
173+ confirmedBalanceString : '0' ,
174+ spendableBalanceString : '0' ,
175+ receiveAddress : {
176+ id : 'addr-id' ,
177+ address : 'tb1qexampleaddress000000000000000000000' ,
178+ chain : 20 ,
179+ index : 0 ,
180+ coin : coin ,
181+ wallet : 'new-wallet-id' ,
182+ coinSpecific : { } ,
183+ } ,
184+ // optional-ish fields used in assertions
133185 multisigType : 'onchain' ,
134186 type : 'cold' ,
135187 subType : 'onPrem' ,
@@ -416,31 +468,33 @@ describe('POST /api/:coin/wallet/generate', () => {
416468 const addWalletNock = nock ( bitgoApiUrl )
417469 . post ( `/api/v2/${ eddsaCoin } /wallet/add` , {
418470 label : 'test_wallet' ,
471+ enterprise : 'test_enterprise' ,
472+ multisigType : 'tss' ,
473+ coin : eddsaCoin ,
419474 m : 2 ,
420475 n : 3 ,
421476 keys : [ 'id' , 'id' , 'id' ] ,
422477 type : 'cold' ,
423478 subType : 'onPrem' ,
424- multisigType : 'tss' ,
425- enterprise : 'test_enterprise' ,
426479 } )
427480 . reply ( 200 , {
428- id : '685cb53debcd0bcb5ab4fe80d2b74be2' ,
429- users : [ [ 'Object' ] ] ,
430- coin : 'tsol' ,
431- label : 'OnPrem eddsa sendMany test 2025-06-26T02:49:18.622Z' ,
481+ id : 'wallet-id' ,
482+ users : [
483+ {
484+ user : 'user-id' ,
485+ permissions : [ 'admin' , 'spend' , 'view' ] ,
486+ } ,
487+ ] ,
488+ coin : eddsaCoin ,
489+ label : 'test_wallet' ,
432490 m : 2 ,
433491 n : 3 ,
434- keys : [
435- '685cb5393d57687bdf0a464594ca9e36' ,
436- '685cb53a3d57687bdf0a4657b5f1f364' ,
437- '685cb536f21050339163a75dd04d41bf' ,
438- ] ,
492+ keys : [ 'id' , 'id' , 'id' ] ,
439493 keySignatures : { } ,
440- enterprise : '6750c2d327511bc4e5f83ccfcfe1b3eb ' ,
441- organization : '6750c2e027511bc4e5f83d251248fc14 ' ,
442- bitgoOrg : 'BitGo Trust ' ,
443- tags : [ '685cb53debcd0bcb5ab4fe80d2b74be2 ' , '6750c2d327511bc4e5f83ccfcfe1b3eb ' ] ,
494+ enterprise : 'test_enterprise ' ,
495+ organization : 'org-id ' ,
496+ bitgoOrg : 'BitGo Inc ' ,
497+ tags : [ 'wallet-id ' , 'test_enterprise ' ] ,
444498 disableTransactionNotifications : false ,
445499 freeze : { } ,
446500 deleted : false ,
@@ -454,37 +508,30 @@ describe('POST /api/:coin/wallet/generate', () => {
454508 nonceExpiresAt : '2025-06-25T23:00:12.019Z' ,
455509 trustedTokens : [ ] ,
456510 } ,
457- admin : {
458- policy : [ 'Object' ] ,
459- } ,
511+ admin : { } ,
512+ pendingApprovals : [ ] ,
513+ allowBackupKeySigning : false ,
460514 clientFlags : [ ] ,
461515 walletFlags : [ ] ,
462- allowBackupKeySigning : false ,
463516 recoverable : false ,
464- startDate : '2025-06-26T02:49:33.000Z' ,
465- type : 'cold' ,
466- buildDefaults : { } ,
467- customChangeKeySignatures : { } ,
517+ startDate : '2025-01-01T00:00:00.000Z' ,
468518 hasLargeNumberOfAddresses : false ,
469- multisigType : 'tss' ,
470- hasReceiveTransferPolicy : false ,
471- creator : '63f512adc61d7100088e99bf1deece73' ,
472- subType : 'onPrem' ,
473519 config : { } ,
474- pendingChainInitialization : true ,
475520 balanceString : '0' ,
476521 confirmedBalanceString : '0' ,
477522 spendableBalanceString : '0' ,
478- reservedBalanceString : '0' ,
479523 receiveAddress : {
480- id : '685cb53eebcd0bcb5ab4fe8ed214d5b9 ' ,
481- address : '74AUHib3F6Fq5eVm2ywP5ik9iQjviwAfZXWnGM9JHhJ4 ' ,
524+ id : 'addr-id ' ,
525+ address : '93AHaUAExampleRootAddress ' ,
482526 chain : 0 ,
483527 index : 0 ,
484- coin : 'tsol' ,
485- wallet : '685cb53debcd0bcb5ab4fe80d2b74be2 ' ,
486- coinSpecific : [ 'Object' ] ,
528+ coin : eddsaCoin ,
529+ wallet : 'wallet-id ' ,
530+ coinSpecific : { } ,
487531 } ,
532+ multisigType : 'tss' ,
533+ type : 'cold' ,
534+ subType : 'onPrem' ,
488535 } ) ;
489536
490537 const response = await agent
@@ -1051,7 +1098,7 @@ describe('POST /api/:coin/wallet/generate', () => {
10511098 type : 'tss' ,
10521099 isMPCv2 : true ,
10531100 } )
1054- . reply ( 200 , { id : 'user-key-id' } ) ;
1101+ . reply ( 200 , { id : 'user-key-id' , source : 'user' , type : 'tss' } ) ;
10551102
10561103 const bitgoAddBackupKeyNock = nock ( bitgoApiUrl )
10571104 . post ( `/api/v2/${ ecdsaCoin } /key` , {
@@ -1060,7 +1107,7 @@ describe('POST /api/:coin/wallet/generate', () => {
10601107 type : 'tss' ,
10611108 isMPCv2 : true ,
10621109 } )
1063- . reply ( 200 , { id : 'backup-key-id' } ) ;
1110+ . reply ( 200 , { id : 'backup-key-id' , source : 'backup' , type : 'tss' } ) ;
10641111
10651112 const bitgoAddBitGoKeyNock = nock ( bitgoApiUrl )
10661113 . post ( `/api/v2/${ ecdsaCoin } /key` , {
@@ -1069,21 +1116,72 @@ describe('POST /api/:coin/wallet/generate', () => {
10691116 type : 'tss' ,
10701117 isMPCv2 : true ,
10711118 } )
1072- . reply ( 200 , { id : 'bitgo-key-id' } ) ;
1119+ . reply ( 200 , {
1120+ id : 'bitgo-key-id' ,
1121+ source : 'bitgo' ,
1122+ type : 'tss' ,
1123+ commonKeychain : 'commonKeychain' ,
1124+ isBitGo : true ,
1125+ isTrust : false ,
1126+ hsmType : 'institutional' ,
1127+ } ) ;
10731128
10741129 const bitgoAddWalletNock = nock ( bitgoApiUrl )
10751130 . post ( `/api/v2/${ ecdsaCoin } /wallet/add` , {
10761131 label : 'test-wallet' , // ?
1132+ enterprise : 'test-enterprise' ,
1133+ multisigType : 'tss' ,
1134+ coin : ecdsaCoin ,
10771135 m : 2 ,
10781136 n : 3 ,
10791137 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
10801138 type : 'cold' ,
10811139 subType : 'onPrem' ,
1082- multisigType : 'tss' ,
1083- enterprise : 'test-enterprise' ,
10841140 } )
10851141 . reply ( 200 , {
10861142 id : 'new-wallet-id' ,
1143+ users : [
1144+ {
1145+ user : 'user-id' ,
1146+ permissions : [ 'admin' , 'spend' , 'view' ] ,
1147+ } ,
1148+ ] ,
1149+ coin : ecdsaCoin ,
1150+ label : 'test-wallet' ,
1151+ m : 2 ,
1152+ n : 3 ,
1153+ keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
1154+ keySignatures : { } ,
1155+ enterprise : 'test-enterprise' ,
1156+ organization : 'org-id' ,
1157+ bitgoOrg : 'BitGo Inc' ,
1158+ tags : [ 'new-wallet-id' , 'test-enterprise' ] ,
1159+ disableTransactionNotifications : false ,
1160+ freeze : { } ,
1161+ deleted : false ,
1162+ approvalsRequired : 1 ,
1163+ isCold : true ,
1164+ coinSpecific : { } ,
1165+ admin : { } ,
1166+ pendingApprovals : [ ] ,
1167+ allowBackupKeySigning : false ,
1168+ clientFlags : [ ] ,
1169+ recoverable : false ,
1170+ startDate : '2025-01-01T00:00:00.000Z' ,
1171+ hasLargeNumberOfAddresses : false ,
1172+ config : { } ,
1173+ balanceString : '0' ,
1174+ confirmedBalanceString : '0' ,
1175+ spendableBalanceString : '0' ,
1176+ receiveAddress : {
1177+ id : 'addr-id' ,
1178+ address : '0xexample' ,
1179+ chain : 0 ,
1180+ index : 0 ,
1181+ coin : ecdsaCoin ,
1182+ wallet : 'new-wallet-id' ,
1183+ coinSpecific : { } ,
1184+ } ,
10871185 multisigType : 'tss' ,
10881186 type : 'cold' ,
10891187 subType : 'onPrem' ,
0 commit comments