@canton-network/wallet-gateway-remote 1.2.0 → 1.2.1
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/README.md +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +38 -0
- package/dist/ledger/transaction-service.js +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.js +2 -2
- package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +3 -3
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ Dfns provisions and activates Canton wallets through its validator integration,
|
|
|
59
59
|
|
|
60
60
|
## Fireblocks
|
|
61
61
|
|
|
62
|
-
1. Complete steps 1–3 from the instructions at https://github.com/
|
|
62
|
+
1. Complete steps 1–3 from the instructions at https://github.com/canton-network/wallet-gateway/tree/main/core/signing-fireblocks
|
|
63
63
|
|
|
64
64
|
2. set the environment variable `FIREBLOCKS_API_KEY` (get it from `API User (ID)` column in fireblocks api users table).
|
|
65
65
|
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA2B7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA2B7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAsMvC,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAiKhE"}
|
package/dist/init.js
CHANGED
|
@@ -47,6 +47,44 @@ async function initializeDatabase(config, logger) {
|
|
|
47
47
|
.catch(() => { });
|
|
48
48
|
exists = false;
|
|
49
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
const appDb = connection(config.store);
|
|
52
|
+
try {
|
|
53
|
+
const idpsTable = await sql
|
|
54
|
+
.raw(`select exists(select 1 from information_schema.tables where table_schema='public' and table_name='idps') as exists;`)
|
|
55
|
+
.execute(appDb);
|
|
56
|
+
const networksTable = await sql
|
|
57
|
+
.raw(`select exists(select 1 from information_schema.tables where table_schema='public' and table_name='networks') as exists;`)
|
|
58
|
+
.execute(appDb);
|
|
59
|
+
const idpsExists = Boolean(idpsTable.rows[0]?.exists);
|
|
60
|
+
const networksExists = Boolean(networksTable.rows[0]?.exists);
|
|
61
|
+
let idpsHasRows = false;
|
|
62
|
+
let networksHasRows = false;
|
|
63
|
+
if (idpsExists) {
|
|
64
|
+
const idpsCount = await sql
|
|
65
|
+
.raw(`select count(*) as "rowCount" from idps;`)
|
|
66
|
+
.execute(appDb);
|
|
67
|
+
idpsHasRows = Number(idpsCount.rows[0]?.rowCount ?? 0) > 0;
|
|
68
|
+
}
|
|
69
|
+
if (networksExists) {
|
|
70
|
+
const networksCount = await sql
|
|
71
|
+
.raw(`select count(*) as "rowCount" from networks;`)
|
|
72
|
+
.execute(appDb);
|
|
73
|
+
networksHasRows =
|
|
74
|
+
Number(networksCount.rows[0]?.rowCount ?? 0) > 0;
|
|
75
|
+
}
|
|
76
|
+
if (!idpsExists ||
|
|
77
|
+
!networksExists ||
|
|
78
|
+
!idpsHasRows ||
|
|
79
|
+
!networksHasRows) {
|
|
80
|
+
logger.warn('Database exists but required tables are missing or empty. Attempting to bootstrap...');
|
|
81
|
+
exists = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
await appDb.destroy();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
50
88
|
await db.destroy();
|
|
51
89
|
}
|
|
52
90
|
const db = connection(config.store);
|
|
@@ -33,7 +33,7 @@ export class TransactionService {
|
|
|
33
33
|
async signWithWalletKernel(userId, wallet, signParams) {
|
|
34
34
|
const signingProvider = this.signingDrivers[SigningProvider.WALLET_KERNEL];
|
|
35
35
|
if (!signingProvider) {
|
|
36
|
-
throw new Error('Wallet
|
|
36
|
+
throw new Error('Wallet Gateway signing driver not available');
|
|
37
37
|
}
|
|
38
38
|
const driver = signingProvider.controller(userId);
|
|
39
39
|
const tx = await this.loadPreparedTransactionForSigning(signParams.transactionId);
|
|
@@ -32,7 +32,7 @@ export class WalletAllocationService {
|
|
|
32
32
|
return this.participantAllocator.createWallet(userId, email, partyHint, primary);
|
|
33
33
|
case SigningProvider.WALLET_KERNEL:
|
|
34
34
|
if (!this.kernelAllocator) {
|
|
35
|
-
throw new Error('Wallet
|
|
35
|
+
throw new Error('Wallet Gateway signing driver not available');
|
|
36
36
|
}
|
|
37
37
|
return this.kernelAllocator.createWallet(userId, email, partyHint, primary);
|
|
38
38
|
case SigningProvider.FIREBLOCKS:
|
|
@@ -63,7 +63,7 @@ export class WalletAllocationService {
|
|
|
63
63
|
return this.participantAllocator.allocateParty(userId, email, existingWallet);
|
|
64
64
|
case SigningProvider.WALLET_KERNEL:
|
|
65
65
|
if (!this.kernelAllocator) {
|
|
66
|
-
throw new Error('Wallet
|
|
66
|
+
throw new Error('Wallet Gateway signing driver not available');
|
|
67
67
|
}
|
|
68
68
|
return this.kernelAllocator.allocateParty(userId, email, existingWallet);
|
|
69
69
|
case SigningProvider.FIREBLOCKS:
|
|
@@ -156,7 +156,7 @@ describe('WalletAllocationService', () => {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
|
-
describe('Wallet
|
|
159
|
+
describe('Wallet Gateway', () => {
|
|
160
160
|
it('createWallet initializes new wallet and adds to store', async () => {
|
|
161
161
|
const expectedParty = createAllocatedParty('bob::fingerprint', 'bob', 'fingerprint');
|
|
162
162
|
mockPartyAllocator.createFingerprintFromKey.mockReturnValue('fingerprint');
|
|
@@ -198,9 +198,9 @@ describe('WalletAllocationService', () => {
|
|
|
198
198
|
status: 'allocated',
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
|
-
it('throws when Wallet
|
|
201
|
+
it('throws when Wallet Gateway signing driver not available', async () => {
|
|
202
202
|
const serviceWithoutDriver = createService({});
|
|
203
|
-
await expect(serviceWithoutDriver.createWallet('user-1', undefined, 'bob', false, SigningProvider.WALLET_KERNEL)).rejects.toThrow('Wallet
|
|
203
|
+
await expect(serviceWithoutDriver.createWallet('user-1', undefined, 'bob', false, SigningProvider.WALLET_KERNEL)).rejects.toThrow('Wallet Gateway signing driver not available');
|
|
204
204
|
});
|
|
205
205
|
});
|
|
206
206
|
describe('Fireblocks', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/wallet-gateway-remote",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A server-side Wallet Gateway implementation over HTTP",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -38,24 +38,24 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@canton-network/core-ledger-client": "^1.2.
|
|
42
|
-
"@canton-network/core-rpc-errors": "^1.2.
|
|
43
|
-
"@canton-network/core-rpc-transport": "^1.2.
|
|
44
|
-
"@canton-network/core-signing-blockdaemon": "^1.2.
|
|
45
|
-
"@canton-network/core-signing-dfns": "^0.2.
|
|
46
|
-
"@canton-network/core-signing-fireblocks": "^1.2.
|
|
47
|
-
"@canton-network/core-signing-internal": "^1.2.
|
|
48
|
-
"@canton-network/core-signing-lib": "^1.2.
|
|
49
|
-
"@canton-network/core-signing-participant": "^1.2.
|
|
50
|
-
"@canton-network/core-signing-store-sql": "^1.2.
|
|
51
|
-
"@canton-network/core-tx-visualizer": "^1.2.
|
|
52
|
-
"@canton-network/core-types": "^1.2.
|
|
53
|
-
"@canton-network/core-wallet-auth": "^1.2.
|
|
54
|
-
"@canton-network/core-wallet-dapp-rpc-client": "^1.2.
|
|
55
|
-
"@canton-network/core-wallet-store": "^1.2.
|
|
56
|
-
"@canton-network/core-wallet-store-sql": "^1.2.
|
|
57
|
-
"@canton-network/core-wallet-ui-components": "^1.2.
|
|
58
|
-
"@canton-network/core-wallet-user-rpc-client": "^1.2.
|
|
41
|
+
"@canton-network/core-ledger-client": "^1.2.1",
|
|
42
|
+
"@canton-network/core-rpc-errors": "^1.2.1",
|
|
43
|
+
"@canton-network/core-rpc-transport": "^1.2.1",
|
|
44
|
+
"@canton-network/core-signing-blockdaemon": "^1.2.1",
|
|
45
|
+
"@canton-network/core-signing-dfns": "^0.2.1",
|
|
46
|
+
"@canton-network/core-signing-fireblocks": "^1.2.1",
|
|
47
|
+
"@canton-network/core-signing-internal": "^1.2.1",
|
|
48
|
+
"@canton-network/core-signing-lib": "^1.2.1",
|
|
49
|
+
"@canton-network/core-signing-participant": "^1.2.1",
|
|
50
|
+
"@canton-network/core-signing-store-sql": "^1.2.1",
|
|
51
|
+
"@canton-network/core-tx-visualizer": "^1.2.1",
|
|
52
|
+
"@canton-network/core-types": "^1.2.1",
|
|
53
|
+
"@canton-network/core-wallet-auth": "^1.2.1",
|
|
54
|
+
"@canton-network/core-wallet-dapp-rpc-client": "^1.2.1",
|
|
55
|
+
"@canton-network/core-wallet-store": "^1.2.1",
|
|
56
|
+
"@canton-network/core-wallet-store-sql": "^1.2.1",
|
|
57
|
+
"@canton-network/core-wallet-ui-components": "^1.2.1",
|
|
58
|
+
"@canton-network/core-wallet-user-rpc-client": "^1.2.1",
|
|
59
59
|
"@commander-js/extra-typings": "^14.0.0",
|
|
60
60
|
"commander": "^14.0.3",
|
|
61
61
|
"cors": "^2.8.6",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"zod": "^4.3.6"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@canton-network/core-wallet-store-inmemory": "^1.2.
|
|
76
|
+
"@canton-network/core-wallet-store-inmemory": "^1.2.1",
|
|
77
77
|
"@types/cors": "^2.8.19",
|
|
78
78
|
"@types/express": "^5.0.6",
|
|
79
79
|
"@types/node": "^25.3.3",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"repository": {
|
|
98
98
|
"type": "git",
|
|
99
|
-
"url": "git+https://github.com/
|
|
99
|
+
"url": "git+https://github.com/canton-network/wallet-gateway.git",
|
|
100
100
|
"directory": "wallet-gateway/remote"
|
|
101
101
|
}
|
|
102
102
|
}
|