@@ -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' ,
@@ -258,22 +310,8 @@ describe('POST /api/:coin/wallet/generate', () => {
258310 isTrust : true ,
259311 hsmType : 'institutional' ,
260312 keyShares : [
261- {
262- from : 'bitgo' ,
263- to : 'user' ,
264- publicShare : 'publicShare' ,
265- privateShare : 'privateShare' ,
266- vssProof : 'true' ,
267- gpgKey : 'bitgo-key' ,
268- } ,
269- {
270- from : 'bitgo' ,
271- to : 'backup' ,
272- publicShare : 'publicShare' ,
273- privateShare : 'privateShare' ,
274- vssProof : 'true' ,
275- gpgKey : 'bitgo-key' ,
276- } ,
313+ { from : 'bitgo' , to : 'user' , publicShare : 'publicShare' } ,
314+ { from : 'bitgo' , to : 'backup' , publicShare : 'publicShare' } ,
277315 ] ,
278316 walletHSMGPGPublicKeySigs : 'hsm-sig' ,
279317 } ) ;
@@ -416,75 +454,62 @@ describe('POST /api/:coin/wallet/generate', () => {
416454 const addWalletNock = nock ( bitgoApiUrl )
417455 . post ( `/api/v2/${ eddsaCoin } /wallet/add` , {
418456 label : 'test_wallet' ,
457+ enterprise : 'test_enterprise' ,
458+ multisigType : 'tss' ,
459+ coin : eddsaCoin ,
419460 m : 2 ,
420461 n : 3 ,
421462 keys : [ 'id' , 'id' , 'id' ] ,
422463 type : 'cold' ,
423464 subType : 'onPrem' ,
424- multisigType : 'tss' ,
425- enterprise : 'test_enterprise' ,
426465 } )
427466 . reply ( 200 , {
428- id : '685cb53debcd0bcb5ab4fe80d2b74be2' ,
429- users : [ [ 'Object' ] ] ,
430- coin : 'tsol' ,
431- label : 'OnPrem eddsa sendMany test 2025-06-26T02:49:18.622Z' ,
467+ id : 'wallet-id' ,
468+ users : [
469+ {
470+ user : 'user-id' ,
471+ permissions : [ 'admin' , 'spend' , 'view' ] ,
472+ } ,
473+ ] ,
474+ coin : eddsaCoin ,
475+ label : 'test_wallet' ,
432476 m : 2 ,
433477 n : 3 ,
434- keys : [
435- '685cb5393d57687bdf0a464594ca9e36' ,
436- '685cb53a3d57687bdf0a4657b5f1f364' ,
437- '685cb536f21050339163a75dd04d41bf' ,
438- ] ,
478+ keys : [ 'id' , 'id' , 'id' ] ,
439479 keySignatures : { } ,
440- enterprise : '6750c2d327511bc4e5f83ccfcfe1b3eb ' ,
441- organization : '6750c2e027511bc4e5f83d251248fc14 ' ,
442- bitgoOrg : 'BitGo Trust ' ,
443- tags : [ '685cb53debcd0bcb5ab4fe80d2b74be2 ' , '6750c2d327511bc4e5f83ccfcfe1b3eb ' ] ,
480+ enterprise : 'test_enterprise ' ,
481+ organization : 'org-id ' ,
482+ bitgoOrg : 'BitGo Inc ' ,
483+ tags : [ 'wallet-id ' , 'test_enterprise ' ] ,
444484 disableTransactionNotifications : false ,
445485 freeze : { } ,
446486 deleted : false ,
447487 approvalsRequired : 1 ,
448488 isCold : true ,
449- coinSpecific : {
450- rootAddress : '74AUHib3F6Fq5eVm2ywP5ik9iQjviwAfZXWnGM9JHhJ4' ,
451- pendingChainInitialization : true ,
452- minimumFunding : 2447136 ,
453- lastChainIndex : [ 'Object' ] ,
454- nonceExpiresAt : '2025-06-25T23:00:12.019Z' ,
455- trustedTokens : [ ] ,
456- } ,
457- admin : {
458- policy : [ 'Object' ] ,
459- } ,
460- clientFlags : [ ] ,
461- walletFlags : [ ] ,
489+ coinSpecific : { } ,
490+ admin : { } ,
491+ pendingApprovals : [ ] ,
462492 allowBackupKeySigning : false ,
493+ clientFlags : [ ] ,
463494 recoverable : false ,
464- startDate : '2025-06-26T02:49:33.000Z' ,
465- type : 'cold' ,
466- buildDefaults : { } ,
467- customChangeKeySignatures : { } ,
495+ startDate : '2025-01-01T00:00:00.000Z' ,
468496 hasLargeNumberOfAddresses : false ,
469- multisigType : 'tss' ,
470- hasReceiveTransferPolicy : false ,
471- creator : '63f512adc61d7100088e99bf1deece73' ,
472- subType : 'onPrem' ,
473497 config : { } ,
474- pendingChainInitialization : true ,
475498 balanceString : '0' ,
476499 confirmedBalanceString : '0' ,
477500 spendableBalanceString : '0' ,
478- reservedBalanceString : '0' ,
479501 receiveAddress : {
480- id : '685cb53eebcd0bcb5ab4fe8ed214d5b9 ' ,
481- address : '74AUHib3F6Fq5eVm2ywP5ik9iQjviwAfZXWnGM9JHhJ4 ' ,
502+ id : 'addr-id ' ,
503+ address : '93AHaUAExampleRootAddress ' ,
482504 chain : 0 ,
483505 index : 0 ,
484- coin : 'tsol' ,
485- wallet : '685cb53debcd0bcb5ab4fe80d2b74be2 ' ,
486- coinSpecific : [ 'Object' ] ,
506+ coin : eddsaCoin ,
507+ wallet : 'wallet-id ' ,
508+ coinSpecific : { } ,
487509 } ,
510+ multisigType : 'tss' ,
511+ type : 'cold' ,
512+ subType : 'onPrem' ,
488513 } ) ;
489514
490515 const response = await agent
@@ -1069,21 +1094,72 @@ describe('POST /api/:coin/wallet/generate', () => {
10691094 type : 'tss' ,
10701095 isMPCv2 : true ,
10711096 } )
1072- . reply ( 200 , { id : 'bitgo-key-id' } ) ;
1097+ . reply ( 200 , {
1098+ id : 'bitgo-key-id' ,
1099+ source : 'bitgo' ,
1100+ type : 'tss' ,
1101+ commonKeychain : 'commonKeychain' ,
1102+ isBitGo : true ,
1103+ isTrust : false ,
1104+ hsmType : 'institutional' ,
1105+ } ) ;
10731106
10741107 const bitgoAddWalletNock = nock ( bitgoApiUrl )
10751108 . post ( `/api/v2/${ ecdsaCoin } /wallet/add` , {
10761109 label : 'test-wallet' , // ?
1110+ enterprise : 'test-enterprise' ,
1111+ multisigType : 'tss' ,
1112+ coin : ecdsaCoin ,
10771113 m : 2 ,
10781114 n : 3 ,
10791115 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
10801116 type : 'cold' ,
10811117 subType : 'onPrem' ,
1082- multisigType : 'tss' ,
1083- enterprise : 'test-enterprise' ,
10841118 } )
10851119 . reply ( 200 , {
10861120 id : 'new-wallet-id' ,
1121+ users : [
1122+ {
1123+ user : 'user-id' ,
1124+ permissions : [ 'admin' , 'spend' , 'view' ] ,
1125+ } ,
1126+ ] ,
1127+ coin : ecdsaCoin ,
1128+ label : 'test-wallet' ,
1129+ m : 2 ,
1130+ n : 3 ,
1131+ keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
1132+ keySignatures : { } ,
1133+ enterprise : 'test-enterprise' ,
1134+ organization : 'org-id' ,
1135+ bitgoOrg : 'BitGo Inc' ,
1136+ tags : [ 'new-wallet-id' , 'test-enterprise' ] ,
1137+ disableTransactionNotifications : false ,
1138+ freeze : { } ,
1139+ deleted : false ,
1140+ approvalsRequired : 1 ,
1141+ isCold : true ,
1142+ coinSpecific : { } ,
1143+ admin : { } ,
1144+ pendingApprovals : [ ] ,
1145+ allowBackupKeySigning : false ,
1146+ clientFlags : [ ] ,
1147+ recoverable : false ,
1148+ startDate : '2025-01-01T00:00:00.000Z' ,
1149+ hasLargeNumberOfAddresses : false ,
1150+ config : { } ,
1151+ balanceString : '0' ,
1152+ confirmedBalanceString : '0' ,
1153+ spendableBalanceString : '0' ,
1154+ receiveAddress : {
1155+ id : 'addr-id' ,
1156+ address : '0xexample' ,
1157+ chain : 0 ,
1158+ index : 0 ,
1159+ coin : ecdsaCoin ,
1160+ wallet : 'new-wallet-id' ,
1161+ coinSpecific : { } ,
1162+ } ,
10871163 multisigType : 'tss' ,
10881164 type : 'cold' ,
10891165 subType : 'onPrem' ,
0 commit comments