@canton-network/wallet-gateway-remote 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/jwt-auth-service.test.js +2 -1
- package/dist/auth/jwt-unsafe-auth-service.test.js +2 -1
- package/dist/config/Config.d.ts +54 -14
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +11 -0
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +23 -0
- package/dist/dapp-api/controller.d.ts +2 -1
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +5 -5
- package/dist/dapp-api/controller.test.js +5 -3
- package/dist/dapp-api/rpc-gen/index.d.ts +15 -15
- package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/dapp-api/server.d.ts +2 -1
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +2 -2
- package/dist/dapp-api/server.test.js +3 -2
- package/dist/env.d.ts +5 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +4 -0
- package/dist/example-config.d.ts +3 -0
- package/dist/example-config.d.ts.map +1 -1
- package/dist/example-config.js +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +19 -2
- package/dist/ledger/party-allocation-service.d.ts +1 -1
- package/dist/ledger/party-allocation-service.d.ts.map +1 -1
- package/dist/ledger/party-allocation-service.js +4 -0
- package/dist/ledger/transaction-service.d.ts +5 -8
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +55 -389
- package/dist/ledger/transaction-service.test.js +101 -19
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts +24 -0
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts.map +1 -0
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.js +138 -0
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.js +11 -9
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.js +12 -10
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts +5 -7
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.js +19 -23
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.d.ts +5 -4
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.js +13 -11
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts +2 -1
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.js +4 -0
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.js +12 -10
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts +9 -10
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.js +49 -13
- package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +104 -20
- package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.js +3 -5
- package/dist/ledger/wallet-sync-service.test.js +3 -1
- package/dist/signing/signing-worker.d.ts +2 -0
- package/dist/signing/signing-worker.d.ts.map +1 -1
- package/dist/signing/signing-worker.js +1 -1
- package/dist/signing/signing-worker.test.js +1 -0
- package/dist/user-api/controller.d.ts +5 -2
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +64 -14
- package/dist/user-api/controller.test.js +60 -72
- package/dist/user-api/rpc-gen/index.d.ts +40 -34
- package/dist/user-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/user-api/rpc-gen/index.js +3 -1
- package/dist/user-api/rpc-gen/typings.d.ts +48 -36
- package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/user-api/server.d.ts +2 -1
- package/dist/user-api/server.d.ts.map +1 -1
- package/dist/user-api/server.js +2 -2
- package/dist/user-api/server.test.js +29 -4
- package/dist/user-api/token-network-matching.d.ts.map +1 -1
- package/dist/user-api/token-network-matching.js +0 -28
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +3 -3
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/404-DaA35RoG.js +5 -0
- package/dist/web/frontend/assets/{activities-WIV19RPr.js → activities-B5-XCCZC.js} +2 -2
- package/dist/web/frontend/assets/{addIdentityProvider-DA4ry8mX.js → addIdentityProvider-BYCAWtiZ.js} +2 -2
- package/dist/web/frontend/assets/addNetwork-DJM_nq3n.js +38 -0
- package/dist/web/frontend/assets/addParty-BQLGvzJS.js +13 -0
- package/dist/web/frontend/assets/approve-CyDHnjOG.js +21 -0
- package/dist/web/frontend/assets/callback-DCYIq514.js +7 -0
- package/dist/web/frontend/assets/common-Byz7o2Qs.js +31 -0
- package/dist/web/frontend/assets/editParty-Oe0m1yB6.js +14 -0
- package/dist/web/frontend/assets/{identityProviders-nRE_Y8vP.js → identityProviders-1ro-4zy9.js} +3 -3
- package/dist/web/frontend/assets/index-BhzcMGYw.js +4943 -0
- package/dist/web/frontend/assets/index-Cvcr2Fng.js +2 -0
- package/dist/web/frontend/assets/index-D-NXyb6u.js +93 -0
- package/dist/web/frontend/assets/login-VCs39tyk.js +11 -0
- package/dist/web/frontend/assets/{networks-pshe9KRL.js → networks-CRTkFNGb.js} +2 -2
- package/dist/web/frontend/assets/{reviewIdentityProvider-DtUWN0jT.js → reviewIdentityProvider-8F5_K-A5.js} +3 -3
- package/dist/web/frontend/assets/{reviewNetwork-3vKq0jr4.js → reviewNetwork-DL-oQDwd.js} +3 -3
- package/dist/web/frontend/assets/{settings-Bdp9lvU5.js → settings-DgRrnzuq.js} +2 -2
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/identity-providers/add/index.html +2 -2
- package/dist/web/frontend/identity-providers/index.html +2 -2
- package/dist/web/frontend/identity-providers/review/index.html +2 -2
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +2 -2
- package/dist/web/frontend/networks/add/index.html +2 -2
- package/dist/web/frontend/networks/index.html +2 -2
- package/dist/web/frontend/networks/review/index.html +2 -2
- package/dist/web/frontend/parties/add/index.html +4 -3
- package/dist/web/frontend/parties/edit/index.html +17 -0
- package/dist/web/frontend/parties/index.html +2 -2
- package/dist/web/frontend/settings/index.html +2 -2
- package/package.json +29 -27
- package/dist/web/frontend/assets/404-G9ooRT6W.js +0 -5
- package/dist/web/frontend/assets/addNetwork-URqIQBpY.js +0 -38
- package/dist/web/frontend/assets/addParty-CYVpWBOW.js +0 -45
- package/dist/web/frontend/assets/approve-uxh5J3JI.js +0 -21
- package/dist/web/frontend/assets/callback-BSwKp4qp.js +0 -3
- package/dist/web/frontend/assets/index-Bbo4F8DN.js +0 -4810
- package/dist/web/frontend/assets/index-BjhQnXf1.js +0 -2
- package/dist/web/frontend/assets/index-kNaUhLVu.js +0 -91
- package/dist/web/frontend/assets/login-Dojx8YbO.js +0 -11
|
@@ -21,6 +21,7 @@ const wallet = {
|
|
|
21
21
|
signingProviderId: SigningProvider.WALLET_KERNEL,
|
|
22
22
|
publicKey: 'wallet-public-key',
|
|
23
23
|
namespace: 'namespace',
|
|
24
|
+
userId: 'user-1',
|
|
24
25
|
networkId: 'network1',
|
|
25
26
|
rights: [],
|
|
26
27
|
};
|
|
@@ -52,6 +53,11 @@ const executeParams = {
|
|
|
52
53
|
signature: 'signature',
|
|
53
54
|
signedBy: wallet.namespace,
|
|
54
55
|
};
|
|
56
|
+
const postWithRetry = vi.fn().mockResolvedValue({ updateId: 'ledger-update-1' });
|
|
57
|
+
const ledgerClient = {
|
|
58
|
+
postWithRetry,
|
|
59
|
+
getSynchronizerId: vi.fn(),
|
|
60
|
+
};
|
|
55
61
|
const network = {
|
|
56
62
|
id: 'network1',
|
|
57
63
|
name: 'testnet',
|
|
@@ -86,8 +92,11 @@ function createStore(transaction = pendingTransaction) {
|
|
|
86
92
|
};
|
|
87
93
|
}
|
|
88
94
|
function createService(store, drivers, notifier, logger) {
|
|
89
|
-
return new TransactionService(store, logger, drivers, notifier);
|
|
95
|
+
return new TransactionService(store, logger, drivers, notifier, 'HASHING_SCHEME_VERSION_V3');
|
|
90
96
|
}
|
|
97
|
+
vi.stubGlobal('crypto', {
|
|
98
|
+
randomUUID: vi.fn().mockReturnValue('internal-tx-uuid'),
|
|
99
|
+
});
|
|
91
100
|
describe('TransactionService', () => {
|
|
92
101
|
let logger;
|
|
93
102
|
let notifier;
|
|
@@ -105,7 +114,13 @@ describe('TransactionService', () => {
|
|
|
105
114
|
it('returns a signed result and persists signed status', async () => {
|
|
106
115
|
const store = createStore();
|
|
107
116
|
const service = createService(store, {
|
|
108
|
-
[SigningProvider.PARTICIPANT]: createDriver({
|
|
117
|
+
[SigningProvider.PARTICIPANT]: createDriver({
|
|
118
|
+
signTransaction: vi.fn().mockResolvedValue({
|
|
119
|
+
status: 'signed',
|
|
120
|
+
signature: 'none',
|
|
121
|
+
signedBy: 'namespace',
|
|
122
|
+
}),
|
|
123
|
+
}),
|
|
109
124
|
}, notifier, logger);
|
|
110
125
|
const participantWallet = walletWithProvider(SigningProvider.PARTICIPANT);
|
|
111
126
|
const result = await service.sign(authContext, participantWallet, signParams);
|
|
@@ -116,7 +131,7 @@ describe('TransactionService', () => {
|
|
|
116
131
|
partyId: wallet.partyId,
|
|
117
132
|
});
|
|
118
133
|
expect(store.getTransaction).toHaveBeenCalledWith(pendingTransaction.id);
|
|
119
|
-
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date));
|
|
134
|
+
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date), undefined);
|
|
120
135
|
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({
|
|
121
136
|
id: pendingTransaction.id,
|
|
122
137
|
status: 'signed',
|
|
@@ -125,9 +140,10 @@ describe('TransactionService', () => {
|
|
|
125
140
|
});
|
|
126
141
|
describe('wallet-kernel', () => {
|
|
127
142
|
it('signs the transaction and persists the signed state', async () => {
|
|
128
|
-
const signTransaction = vi
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
const signTransaction = vi.fn().mockResolvedValue({
|
|
144
|
+
status: 'signed',
|
|
145
|
+
signature: 'kernel-signature',
|
|
146
|
+
});
|
|
131
147
|
const store = createStore();
|
|
132
148
|
const service = createService(store, {
|
|
133
149
|
[SigningProvider.WALLET_KERNEL]: createDriver({
|
|
@@ -140,7 +156,7 @@ describe('TransactionService', () => {
|
|
|
140
156
|
txHash: pendingTransaction.preparedTransactionHash,
|
|
141
157
|
keyIdentifier: { publicKey: wallet.publicKey },
|
|
142
158
|
});
|
|
143
|
-
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date));
|
|
159
|
+
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date), undefined);
|
|
144
160
|
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({
|
|
145
161
|
id: pendingTransaction.id,
|
|
146
162
|
status: 'signed',
|
|
@@ -238,11 +254,11 @@ describe('TransactionService', () => {
|
|
|
238
254
|
});
|
|
239
255
|
describe('fireblocks', () => {
|
|
240
256
|
it('returns a base64 signature when signing completes', async () => {
|
|
241
|
-
const
|
|
257
|
+
const signature = Buffer.from('fireblocks-signature').toString('base64');
|
|
242
258
|
const signTransaction = vi.fn().mockResolvedValue({
|
|
243
259
|
status: 'signed',
|
|
244
260
|
txId: 'fb-tx-1',
|
|
245
|
-
signature
|
|
261
|
+
signature,
|
|
246
262
|
});
|
|
247
263
|
const store = createStore();
|
|
248
264
|
const service = createService(store, {
|
|
@@ -253,11 +269,11 @@ describe('TransactionService', () => {
|
|
|
253
269
|
const result = await service.sign(authContext, walletWithProvider(SigningProvider.FIREBLOCKS), signParams);
|
|
254
270
|
expect(signTransaction).toHaveBeenCalledWith(expect.objectContaining({
|
|
255
271
|
userId: authContext.userId,
|
|
256
|
-
txHash:
|
|
272
|
+
txHash: 'tx-hash',
|
|
257
273
|
}));
|
|
258
274
|
expect(result).toMatchObject({
|
|
259
275
|
status: 'signed',
|
|
260
|
-
signature
|
|
276
|
+
signature,
|
|
261
277
|
externalTxId: 'fb-tx-1',
|
|
262
278
|
});
|
|
263
279
|
});
|
|
@@ -314,6 +330,74 @@ describe('TransactionService', () => {
|
|
|
314
330
|
});
|
|
315
331
|
});
|
|
316
332
|
});
|
|
333
|
+
describe('bitgo', () => {
|
|
334
|
+
it('returns the driver signature when signing completes', async () => {
|
|
335
|
+
const signTransaction = vi.fn().mockResolvedValue({
|
|
336
|
+
status: 'signed',
|
|
337
|
+
txId: 'bitgo-tx-1',
|
|
338
|
+
signature: 'bitgo-signature',
|
|
339
|
+
});
|
|
340
|
+
const store = createStore();
|
|
341
|
+
const service = createService(store, {
|
|
342
|
+
[SigningProvider.BITGO]: createDriver({
|
|
343
|
+
signTransaction,
|
|
344
|
+
}),
|
|
345
|
+
}, notifier, logger);
|
|
346
|
+
const result = await service.sign(authContext, walletWithProvider(SigningProvider.BITGO), signParams);
|
|
347
|
+
expect(result).toEqual({
|
|
348
|
+
status: 'signed',
|
|
349
|
+
signature: 'bitgo-signature',
|
|
350
|
+
signedBy: wallet.namespace,
|
|
351
|
+
partyId: wallet.partyId,
|
|
352
|
+
externalTxId: 'bitgo-tx-1',
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
it('returns pending status when signing is in progress', async () => {
|
|
356
|
+
const signTransaction = vi.fn().mockResolvedValue({
|
|
357
|
+
status: 'pending',
|
|
358
|
+
txId: 'bitgo-tx-1',
|
|
359
|
+
});
|
|
360
|
+
const store = createStore();
|
|
361
|
+
const service = createService(store, {
|
|
362
|
+
[SigningProvider.BITGO]: createDriver({
|
|
363
|
+
signTransaction,
|
|
364
|
+
}),
|
|
365
|
+
}, notifier, logger);
|
|
366
|
+
const result = await service.sign(authContext, walletWithProvider(SigningProvider.BITGO), signParams);
|
|
367
|
+
expect(result).toEqual({
|
|
368
|
+
status: 'pending',
|
|
369
|
+
externalTxId: 'bitgo-tx-1',
|
|
370
|
+
partyId: wallet.partyId,
|
|
371
|
+
});
|
|
372
|
+
expect(store.setTransactionStatus).toHaveBeenCalledWith(pendingTransaction.id, 'pending', { externalTxId: 'bitgo-tx-1' });
|
|
373
|
+
});
|
|
374
|
+
it('polls getTransaction when externalTxId is already set', async () => {
|
|
375
|
+
const getTransaction = vi.fn().mockResolvedValue({
|
|
376
|
+
status: 'signed',
|
|
377
|
+
txId: 'bitgo-tx-1',
|
|
378
|
+
signature: 'bitgo-signature',
|
|
379
|
+
});
|
|
380
|
+
const store = createStore({
|
|
381
|
+
...pendingTransaction,
|
|
382
|
+
externalTxId: 'bitgo-tx-1',
|
|
383
|
+
});
|
|
384
|
+
const service = createService(store, {
|
|
385
|
+
[SigningProvider.BITGO]: createDriver({
|
|
386
|
+
getTransaction,
|
|
387
|
+
}),
|
|
388
|
+
}, notifier, logger);
|
|
389
|
+
const result = await service.sign(authContext, walletWithProvider(SigningProvider.BITGO), signParams);
|
|
390
|
+
expect(getTransaction).toHaveBeenCalledWith(expect.objectContaining({ txId: 'bitgo-tx-1' }));
|
|
391
|
+
expect(result).toMatchObject({
|
|
392
|
+
status: 'signed',
|
|
393
|
+
signature: 'bitgo-signature',
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
it('throws when BitGo signing driver is not available', async () => {
|
|
397
|
+
const service = createService(createStore(), {}, notifier, logger);
|
|
398
|
+
await expect(service.sign(authContext, walletWithProvider(SigningProvider.BITGO), signParams)).rejects.toThrow('No driver found for bitgo');
|
|
399
|
+
});
|
|
400
|
+
});
|
|
317
401
|
it.each([
|
|
318
402
|
{
|
|
319
403
|
name: 'participant',
|
|
@@ -345,6 +429,11 @@ describe('TransactionService', () => {
|
|
|
345
429
|
provider: SigningProvider.SECUROSYS,
|
|
346
430
|
auth: authContext,
|
|
347
431
|
},
|
|
432
|
+
{
|
|
433
|
+
name: 'bitgo',
|
|
434
|
+
provider: SigningProvider.BITGO,
|
|
435
|
+
auth: authContext,
|
|
436
|
+
},
|
|
348
437
|
])('rejects signing an already executed transaction for $name', async ({ provider, auth }) => {
|
|
349
438
|
const store = createStore(executedTransaction);
|
|
350
439
|
const service = createService(store, {
|
|
@@ -363,7 +452,7 @@ describe('TransactionService', () => {
|
|
|
363
452
|
...pendingTransaction,
|
|
364
453
|
status,
|
|
365
454
|
};
|
|
366
|
-
expect(() => service.execute(authContext.userId, wallet, transaction, executeParams)).toThrow(`Cannot execute a ${status} transaction. Expected status: signed.`);
|
|
455
|
+
expect(() => service.execute(authContext.userId, wallet, transaction, executeParams, ledgerClient)).toThrow(`Cannot execute a ${status} transaction. Expected status: signed.`);
|
|
367
456
|
});
|
|
368
457
|
describe('participant', () => {
|
|
369
458
|
it('submits the prepared transaction to the ledger', async () => {
|
|
@@ -376,13 +465,6 @@ describe('TransactionService', () => {
|
|
|
376
465
|
},
|
|
377
466
|
};
|
|
378
467
|
const store = createStore(transaction);
|
|
379
|
-
const postWithRetry = vi
|
|
380
|
-
.fn()
|
|
381
|
-
.mockResolvedValue({ updateId: 'ledger-update-1' });
|
|
382
|
-
const ledgerClient = {
|
|
383
|
-
postWithRetry,
|
|
384
|
-
getSynchronizerId: vi.fn(),
|
|
385
|
-
};
|
|
386
468
|
const service = createService(store, {}, notifier, logger);
|
|
387
469
|
const result = await service.execute(authContext.userId, participantWallet, transaction, executeParams, ledgerClient, network);
|
|
388
470
|
expect(postWithRetry).toHaveBeenCalledWith('/v2/commands/submit-and-wait', expect.objectContaining({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UserId } from '@canton-network/core-wallet-auth';
|
|
2
|
+
import { Store, Wallet } from '@canton-network/core-wallet-store';
|
|
3
|
+
import { SigningDriverInterface } from '@canton-network/core-signing-lib';
|
|
4
|
+
import { Logger } from 'pino';
|
|
5
|
+
import { PartyAllocationService } from '../../party-allocation-service.js';
|
|
6
|
+
import { PartyHint, Primary } from '../../../user-api/rpc-gen/typings.js';
|
|
7
|
+
import { WalletAllocator } from '../wallet-allocation-service.js';
|
|
8
|
+
/**
|
|
9
|
+
* BitGo sign-only allocator. The gateway runs the topology flow against its
|
|
10
|
+
* configured validator; BitGo is asked only to sign the topology hash, mirroring
|
|
11
|
+
* the bring-your-own-validator pattern used for other external providers.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BitGoWalletAllocator implements WalletAllocator {
|
|
14
|
+
private store;
|
|
15
|
+
private logger;
|
|
16
|
+
private partyAllocator;
|
|
17
|
+
protected signingDriver: SigningDriverInterface;
|
|
18
|
+
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDriver: SigningDriverInterface);
|
|
19
|
+
getKeys(userId: UserId): Promise<import("@canton-network/core-signing-lib").Keys | null>;
|
|
20
|
+
createWallet(userId: UserId, _email: string | undefined, partyHint: PartyHint, primary?: Primary): Promise<Wallet>;
|
|
21
|
+
allocateParty(userId: UserId, _email: string | undefined, existingWallet: Wallet): Promise<void>;
|
|
22
|
+
private finalizeWallet;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=bitgo-wallet-allocator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitgo-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EACH,sBAAsB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAEH,eAAe,EAClB,MAAM,iCAAiC,CAAA;AAGxC;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAEpD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IACtB,SAAS,CAAC,aAAa,EAAE,sBAAsB;gBAHvC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACpC,aAAa,EAAE,sBAAsB;IAG7C,OAAO,CAAC,MAAM,EAAE,MAAM;IAMtB,YAAY,CACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC;IA8DZ,aAAa,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;YA+DF,cAAc;CA+C/B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
4
|
+
import { handleSigningProviderError, } from '../wallet-allocation-service.js';
|
|
5
|
+
import { WALLET_DISABLED_REASON } from '@canton-network/core-types';
|
|
6
|
+
/**
|
|
7
|
+
* BitGo sign-only allocator. The gateway runs the topology flow against its
|
|
8
|
+
* configured validator; BitGo is asked only to sign the topology hash, mirroring
|
|
9
|
+
* the bring-your-own-validator pattern used for other external providers.
|
|
10
|
+
*/
|
|
11
|
+
export class BitGoWalletAllocator {
|
|
12
|
+
constructor(store, logger, partyAllocator, signingDriver) {
|
|
13
|
+
this.store = store;
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
this.partyAllocator = partyAllocator;
|
|
16
|
+
this.signingDriver = signingDriver;
|
|
17
|
+
}
|
|
18
|
+
async getKeys(userId) {
|
|
19
|
+
if (!this.signingDriver)
|
|
20
|
+
return null;
|
|
21
|
+
const driver = this.signingDriver.controller(userId);
|
|
22
|
+
return await driver.getKeys().then(handleSigningProviderError);
|
|
23
|
+
}
|
|
24
|
+
async createWallet(userId, _email, partyHint, primary = false) {
|
|
25
|
+
const driver = this.signingDriver.controller(userId);
|
|
26
|
+
const key = await driver
|
|
27
|
+
.createKey({ name: partyHint })
|
|
28
|
+
.then(handleSigningProviderError);
|
|
29
|
+
const namespace = this.partyAllocator.createFingerprintFromKey(key.publicKey);
|
|
30
|
+
const transactions = await this.partyAllocator.generateTopologyTransactions(partyHint, key.publicKey);
|
|
31
|
+
const topologyTransactions = transactions.topologyTransactions ?? [];
|
|
32
|
+
const internalTxId = crypto
|
|
33
|
+
.randomUUID()
|
|
34
|
+
.replace(/-/g, '')
|
|
35
|
+
.substring(0, 16);
|
|
36
|
+
const txPayload = JSON.stringify(topologyTransactions);
|
|
37
|
+
const { status, txId } = await driver
|
|
38
|
+
.signTransaction({
|
|
39
|
+
tx: Buffer.from(txPayload).toString('base64'),
|
|
40
|
+
txHash: transactions.multiHash,
|
|
41
|
+
keyIdentifier: { id: key.id, publicKey: key.publicKey },
|
|
42
|
+
internalTxId,
|
|
43
|
+
messageStandardType: 'CANTON_SIGN_TOPOLOGY',
|
|
44
|
+
})
|
|
45
|
+
.then(handleSigningProviderError);
|
|
46
|
+
const network = await this.store.getCurrentNetwork();
|
|
47
|
+
const walletBase = {
|
|
48
|
+
partyId: `${partyHint}::${namespace}`,
|
|
49
|
+
hint: partyHint,
|
|
50
|
+
namespace,
|
|
51
|
+
signingProviderId: SigningProvider.BITGO,
|
|
52
|
+
networkId: network.id,
|
|
53
|
+
userId,
|
|
54
|
+
primary,
|
|
55
|
+
publicKey: key.publicKey,
|
|
56
|
+
externalTxId: txId,
|
|
57
|
+
topologyTransactions: topologyTransactions.join(', '),
|
|
58
|
+
rights: [],
|
|
59
|
+
};
|
|
60
|
+
const wallet = await this.finalizeWallet(walletBase, userId, status, txId, topologyTransactions, namespace, driver);
|
|
61
|
+
await this.store.addWallet(wallet);
|
|
62
|
+
return wallet;
|
|
63
|
+
}
|
|
64
|
+
async allocateParty(userId, _email, existingWallet) {
|
|
65
|
+
if (!existingWallet.externalTxId ||
|
|
66
|
+
!existingWallet.topologyTransactions) {
|
|
67
|
+
throw new Error('Existing wallet is missing field externalTxId or topologyTransactions');
|
|
68
|
+
}
|
|
69
|
+
const driver = this.signingDriver.controller(userId);
|
|
70
|
+
const { signature, status, metadata } = await driver
|
|
71
|
+
.getTransaction({ txId: existingWallet.externalTxId })
|
|
72
|
+
.then(handleSigningProviderError);
|
|
73
|
+
let walletUpdate = {
|
|
74
|
+
partyId: existingWallet.partyId,
|
|
75
|
+
networkId: existingWallet.networkId,
|
|
76
|
+
};
|
|
77
|
+
if (status === 'signed') {
|
|
78
|
+
if (!signature) {
|
|
79
|
+
throw new Error('Transaction signed but no signature found in result');
|
|
80
|
+
}
|
|
81
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(existingWallet.namespace, existingWallet.topologyTransactions.split(', '), signature, userId);
|
|
82
|
+
walletUpdate = {
|
|
83
|
+
...walletUpdate,
|
|
84
|
+
partyId,
|
|
85
|
+
status: 'allocated',
|
|
86
|
+
reason: '',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else if (status === 'pending') {
|
|
90
|
+
walletUpdate = {
|
|
91
|
+
...walletUpdate,
|
|
92
|
+
status: 'initialized',
|
|
93
|
+
reason: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_PENDING,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.logger.warn(`Topology transaction for wallet ${existingWallet.partyId} was ${status} with ${JSON.stringify(metadata)}`);
|
|
98
|
+
const reason = status === 'rejected'
|
|
99
|
+
? WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_REJECTED
|
|
100
|
+
: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_FAILED;
|
|
101
|
+
walletUpdate = {
|
|
102
|
+
...walletUpdate,
|
|
103
|
+
status: 'removed',
|
|
104
|
+
disabled: true,
|
|
105
|
+
reason,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return this.store.updateWallet(walletUpdate);
|
|
109
|
+
}
|
|
110
|
+
async finalizeWallet(walletBase, userId, status, txId, topologyTransactions, namespace, driver) {
|
|
111
|
+
if (status === 'signed') {
|
|
112
|
+
const { signature } = await driver
|
|
113
|
+
.getTransaction({ txId })
|
|
114
|
+
.then(handleSigningProviderError);
|
|
115
|
+
if (!signature) {
|
|
116
|
+
throw new Error('Transaction signed but no signature found in result');
|
|
117
|
+
}
|
|
118
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(namespace, topologyTransactions, signature, userId);
|
|
119
|
+
return { ...walletBase, partyId, status: 'allocated' };
|
|
120
|
+
}
|
|
121
|
+
if (status === 'pending') {
|
|
122
|
+
return {
|
|
123
|
+
...walletBase,
|
|
124
|
+
status: 'initialized',
|
|
125
|
+
reason: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_PENDING,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const reason = status === 'rejected'
|
|
129
|
+
? WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_REJECTED
|
|
130
|
+
: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_FAILED;
|
|
131
|
+
return {
|
|
132
|
+
...walletBase,
|
|
133
|
+
status: 'removed',
|
|
134
|
+
disabled: true,
|
|
135
|
+
reason,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -4,13 +4,14 @@ import { SigningDriverInterface } from '@canton-network/core-signing-lib';
|
|
|
4
4
|
import { Logger } from 'pino';
|
|
5
5
|
import { PartyAllocationService } from '../../party-allocation-service.js';
|
|
6
6
|
import { PartyHint, Primary } from '../../../user-api/rpc-gen/typings.js';
|
|
7
|
-
import
|
|
7
|
+
import { WalletAllocator } from '../wallet-allocation-service.js';
|
|
8
8
|
export declare class BlockdaemonWalletAllocator implements WalletAllocator {
|
|
9
9
|
private store;
|
|
10
10
|
private logger;
|
|
11
11
|
private partyAllocator;
|
|
12
|
-
|
|
12
|
+
protected signingDriver: SigningDriverInterface;
|
|
13
13
|
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDriver: SigningDriverInterface);
|
|
14
|
+
getKeys(userId: UserId): Promise<import("@canton-network/core-signing-lib").Keys | null>;
|
|
14
15
|
createWallet(userId: UserId, email: string | undefined, partyHint: PartyHint, primary?: Primary): Promise<Wallet>;
|
|
15
16
|
allocateParty(userId: UserId, email: string | undefined, existingWallet: Wallet): Promise<void>;
|
|
16
17
|
}
|
package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockdaemon-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"blockdaemon-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EACH,sBAAsB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAGjE,qBAAa,0BAA2B,YAAW,eAAe;IAE1D,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IACtB,SAAS,CAAC,aAAa,EAAE,sBAAsB;gBAHvC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACpC,aAAa,EAAE,sBAAsB;IAG7C,OAAO,CAAC,MAAM,EAAE,MAAM;IAMtB,YAAY,CACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC;IAyGZ,aAAa,CACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;CAgEnB"}
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
4
4
|
import { WALLET_DISABLED_REASON } from '@canton-network/core-types';
|
|
5
|
-
|
|
6
|
-
if ('error' in result) {
|
|
7
|
-
throw new Error(`Error from signing driver: ${result.error_description}`);
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
5
|
+
import { handleSigningProviderError } from '../wallet-allocation-service.js';
|
|
11
6
|
export class BlockdaemonWalletAllocator {
|
|
12
7
|
constructor(store, logger, partyAllocator, signingDriver) {
|
|
13
8
|
this.store = store;
|
|
@@ -15,6 +10,12 @@ export class BlockdaemonWalletAllocator {
|
|
|
15
10
|
this.partyAllocator = partyAllocator;
|
|
16
11
|
this.signingDriver = signingDriver;
|
|
17
12
|
}
|
|
13
|
+
async getKeys(userId) {
|
|
14
|
+
if (!this.signingDriver)
|
|
15
|
+
return null;
|
|
16
|
+
const driver = this.signingDriver.controller(userId);
|
|
17
|
+
return await driver.getKeys().then(handleSigningProviderError);
|
|
18
|
+
}
|
|
18
19
|
async createWallet(userId, email, partyHint, primary = false) {
|
|
19
20
|
const driver = this.signingDriver.controller(email);
|
|
20
21
|
const key = await driver.createKey({
|
|
@@ -43,7 +44,7 @@ export class BlockdaemonWalletAllocator {
|
|
|
43
44
|
},
|
|
44
45
|
internalTxId,
|
|
45
46
|
})
|
|
46
|
-
.then(
|
|
47
|
+
.then(handleSigningProviderError);
|
|
47
48
|
const network = await this.store.getCurrentNetwork();
|
|
48
49
|
const walletBase = {
|
|
49
50
|
partyId: `${partyHint}::${namespace}`,
|
|
@@ -51,6 +52,7 @@ export class BlockdaemonWalletAllocator {
|
|
|
51
52
|
namespace,
|
|
52
53
|
signingProviderId: SigningProvider.BLOCKDAEMON,
|
|
53
54
|
networkId: network.id,
|
|
55
|
+
userId,
|
|
54
56
|
primary,
|
|
55
57
|
publicKey: key.publicKey,
|
|
56
58
|
externalTxId: txId,
|
|
@@ -64,7 +66,7 @@ export class BlockdaemonWalletAllocator {
|
|
|
64
66
|
userId,
|
|
65
67
|
txId,
|
|
66
68
|
})
|
|
67
|
-
.then(
|
|
69
|
+
.then(handleSigningProviderError);
|
|
68
70
|
if (!signature) {
|
|
69
71
|
throw new Error('Transaction signed but no signature found in result');
|
|
70
72
|
}
|
|
@@ -106,7 +108,7 @@ export class BlockdaemonWalletAllocator {
|
|
|
106
108
|
.getTransaction({
|
|
107
109
|
txId: existingWallet.externalTxId,
|
|
108
110
|
})
|
|
109
|
-
.then(
|
|
111
|
+
.then(handleSigningProviderError);
|
|
110
112
|
let walletUpdate = {
|
|
111
113
|
partyId: existingWallet.partyId,
|
|
112
114
|
networkId: existingWallet.networkId,
|
|
@@ -4,7 +4,7 @@ import { SigningDriverInterface } from '@canton-network/core-signing-lib';
|
|
|
4
4
|
import { Logger } from 'pino';
|
|
5
5
|
import { PartyAllocationService } from '../../party-allocation-service.js';
|
|
6
6
|
import { PartyHint, Primary } from '../../../user-api/rpc-gen/typings.js';
|
|
7
|
-
import
|
|
7
|
+
import { WalletAllocator } from '../wallet-allocation-service.js';
|
|
8
8
|
/**
|
|
9
9
|
* Dfns sign-only allocator. The gateway runs the topology flow against its
|
|
10
10
|
* configured validator; Dfns is asked only to sign the topology hash, mirroring
|
|
@@ -14,8 +14,9 @@ export declare class DfnsWalletAllocator implements WalletAllocator {
|
|
|
14
14
|
private store;
|
|
15
15
|
private logger;
|
|
16
16
|
private partyAllocator;
|
|
17
|
-
|
|
17
|
+
protected signingDriver: SigningDriverInterface;
|
|
18
18
|
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDriver: SigningDriverInterface);
|
|
19
|
+
getKeys(userId: UserId): Promise<import("@canton-network/core-signing-lib").Keys | null>;
|
|
19
20
|
createWallet(userId: UserId, _email: string | undefined, partyHint: PartyHint, primary?: Primary): Promise<Wallet>;
|
|
20
21
|
allocateParty(userId: UserId, _email: string | undefined, existingWallet: Wallet): Promise<void>;
|
|
21
22
|
private finalizeWallet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dfns-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"dfns-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EACH,sBAAsB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAGjE;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IAEnD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IACtB,SAAS,CAAC,aAAa,EAAE,sBAAsB;gBAHvC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACpC,aAAa,EAAE,sBAAsB;IAG7C,OAAO,CAAC,MAAM,EAAE,MAAM;IAMtB,YAAY,CACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC;IA6DZ,aAAa,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;YA+DF,cAAc;CA+C/B"}
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
4
4
|
import { WALLET_DISABLED_REASON } from '@canton-network/core-types';
|
|
5
|
-
|
|
6
|
-
if ('error' in result) {
|
|
7
|
-
throw new Error(`Error from signing driver: ${result.error_description}`);
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
5
|
+
import { handleSigningProviderError } from '../wallet-allocation-service.js';
|
|
11
6
|
/**
|
|
12
7
|
* Dfns sign-only allocator. The gateway runs the topology flow against its
|
|
13
8
|
* configured validator; Dfns is asked only to sign the topology hash, mirroring
|
|
@@ -20,11 +15,17 @@ export class DfnsWalletAllocator {
|
|
|
20
15
|
this.partyAllocator = partyAllocator;
|
|
21
16
|
this.signingDriver = signingDriver;
|
|
22
17
|
}
|
|
18
|
+
async getKeys(userId) {
|
|
19
|
+
if (!this.signingDriver)
|
|
20
|
+
return null;
|
|
21
|
+
const driver = this.signingDriver.controller(userId);
|
|
22
|
+
return await driver.getKeys().then(handleSigningProviderError);
|
|
23
|
+
}
|
|
23
24
|
async createWallet(userId, _email, partyHint, primary = false) {
|
|
24
25
|
const driver = this.signingDriver.controller(userId);
|
|
25
26
|
const key = await driver
|
|
26
27
|
.createKey({ name: partyHint })
|
|
27
|
-
.then(
|
|
28
|
+
.then(handleSigningProviderError);
|
|
28
29
|
const namespace = this.partyAllocator.createFingerprintFromKey(key.publicKey);
|
|
29
30
|
const transactions = await this.partyAllocator.generateTopologyTransactions(partyHint, key.publicKey);
|
|
30
31
|
const topologyTransactions = transactions.topologyTransactions ?? [];
|
|
@@ -40,7 +41,7 @@ export class DfnsWalletAllocator {
|
|
|
40
41
|
keyIdentifier: { id: key.id, publicKey: key.publicKey },
|
|
41
42
|
internalTxId,
|
|
42
43
|
})
|
|
43
|
-
.then(
|
|
44
|
+
.then(handleSigningProviderError);
|
|
44
45
|
const network = await this.store.getCurrentNetwork();
|
|
45
46
|
const walletBase = {
|
|
46
47
|
partyId: `${partyHint}::${namespace}`,
|
|
@@ -48,6 +49,7 @@ export class DfnsWalletAllocator {
|
|
|
48
49
|
namespace,
|
|
49
50
|
signingProviderId: SigningProvider.DFNS,
|
|
50
51
|
networkId: network.id,
|
|
52
|
+
userId,
|
|
51
53
|
primary,
|
|
52
54
|
publicKey: key.publicKey,
|
|
53
55
|
externalTxId: txId,
|
|
@@ -66,7 +68,7 @@ export class DfnsWalletAllocator {
|
|
|
66
68
|
const driver = this.signingDriver.controller(userId);
|
|
67
69
|
const { signature, status, metadata } = await driver
|
|
68
70
|
.getTransaction({ txId: existingWallet.externalTxId })
|
|
69
|
-
.then(
|
|
71
|
+
.then(handleSigningProviderError);
|
|
70
72
|
let walletUpdate = {
|
|
71
73
|
partyId: existingWallet.partyId,
|
|
72
74
|
networkId: existingWallet.networkId,
|
|
@@ -108,7 +110,7 @@ export class DfnsWalletAllocator {
|
|
|
108
110
|
if (status === 'signed') {
|
|
109
111
|
const { signature } = await driver
|
|
110
112
|
.getTransaction({ txId })
|
|
111
|
-
.then(
|
|
113
|
+
.then(handleSigningProviderError);
|
|
112
114
|
if (!signature) {
|
|
113
115
|
throw new Error('Transaction signed but no signature found in result');
|
|
114
116
|
}
|
|
@@ -3,18 +3,16 @@ import { Store, Wallet } from '@canton-network/core-wallet-store';
|
|
|
3
3
|
import { SigningDriverInterface } from '@canton-network/core-signing-lib';
|
|
4
4
|
import { Logger } from 'pino';
|
|
5
5
|
import { PartyAllocationService } from '../../party-allocation-service.js';
|
|
6
|
-
import { PartyHint, Primary
|
|
7
|
-
import
|
|
6
|
+
import { KeyName, PartyHint, Primary } from '../../../user-api/rpc-gen/typings.js';
|
|
7
|
+
import { WalletAllocator } from '../wallet-allocation-service.js';
|
|
8
8
|
export declare class FireblocksWalletAllocator implements WalletAllocator {
|
|
9
9
|
private store;
|
|
10
10
|
private logger;
|
|
11
11
|
private partyAllocator;
|
|
12
|
-
|
|
12
|
+
protected signingDriver: SigningDriverInterface;
|
|
13
13
|
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDriver: SigningDriverInterface);
|
|
14
|
-
|
|
14
|
+
getKeys(userId: UserId): Promise<import("@canton-network/core-signing-lib").Keys | null>;
|
|
15
|
+
createWallet(userId: UserId, email: string | undefined, partyHint: PartyHint, primary: Primary | undefined, keyName: KeyName): Promise<Wallet>;
|
|
15
16
|
allocateParty(userId: UserId, email: string | undefined, existingWallet: Wallet): Promise<void>;
|
|
16
|
-
getVaults(userId: UserId): Promise<{
|
|
17
|
-
vaults: string[];
|
|
18
|
-
}>;
|
|
19
17
|
}
|
|
20
18
|
//# sourceMappingURL=fireblocks-wallet-allocator.d.ts.map
|
package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fireblocks-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"fireblocks-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EACH,sBAAsB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EACH,OAAO,EACP,SAAS,EACT,OAAO,EACV,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAGjE,qBAAa,yBAA0B,YAAW,eAAe;IAEzD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IACtB,SAAS,CAAC,aAAa,EAAE,sBAAsB;gBAHvC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACpC,aAAa,EAAE,sBAAsB;IAG7C,OAAO,CAAC,MAAM,EAAE,MAAM;IAMtB,YAAY,CACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,YAAQ,EACxB,OAAO,EAAE,OAAO,GACjB,OAAO,CAAC,MAAM,CAAC;IA0FZ,aAAa,CACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;CA+DnB"}
|