@canton-network/wallet-gateway-remote 0.16.0 → 0.18.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/README.md +37 -0
- package/dist/config/Config.js +2 -2
- package/dist/dapp-api/controller.d.ts +7 -6
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +23 -26
- package/dist/dapp-api/rpc-gen/index.d.ts +21 -18
- package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/dapp-api/rpc-gen/index.js +7 -6
- package/dist/dapp-api/rpc-gen/typings.d.ts +29 -48
- package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +52 -45
- package/dist/example-config.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +42 -0
- package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.js +30 -20
- package/dist/ledger/wallet-sync-service.test.js +336 -0
- package/dist/middleware/jwtAuth.d.ts.map +1 -1
- package/dist/middleware/jwtAuth.js +3 -1
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +10 -9
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/{404-Dtgkdx8n.js → 404-Cdu0PFS_.js} +1 -1
- package/dist/web/frontend/assets/{approve-BngitDiu.js → approve-B-AjC3qs.js} +1 -1
- package/dist/web/frontend/assets/{callback-BZOvs1pj.js → callback-CVGmyjFw.js} +1 -1
- package/dist/web/frontend/assets/index-DUTzHvwi.js +1158 -0
- package/dist/web/frontend/assets/login-BpjPKEmn.js +186 -0
- package/dist/web/frontend/assets/{settings-lrbuWERD.js → settings-DFCq6vOq.js} +1 -1
- package/dist/web/frontend/assets/{state-UchZlNDY.js → state-D-NnR2Q_.js} +1 -1
- package/dist/web/frontend/assets/{transactions-OQYrtI6P.js → transactions-Cn8Y2p7-.js} +1 -1
- package/dist/web/frontend/assets/{wallets-BIhi0xp5.js → wallets-B4lynciv.js} +17 -16
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +3 -3
- package/dist/web/frontend/settings/index.html +3 -3
- package/dist/web/frontend/transactions/index.html +3 -3
- package/dist/web/frontend/wallets/index.html +3 -3
- package/package.json +26 -21
- package/dist/web/frontend/assets/index-chWxxmO7.js +0 -1158
- package/dist/web/frontend/assets/login-lehCoCJX.js +0 -186
package/README.md
CHANGED
|
@@ -51,3 +51,40 @@ The JSON-RPC API specs from `api-specs/` are generated into strongly-typed metho
|
|
|
51
51
|
2. Place the `fireblocks_secret.key` file at the path `/splice-wallet-kernel/wallet-gateway/remote`
|
|
52
52
|
|
|
53
53
|
3. Create a file named `fireblocks_api.key` at the path `/splice-wallet-kernel/wallet-gateway/remote` and insert your Fireblocks API key into it (get it from `API User (ID)` column in fireblocks api users table). Make sure file doesn't end with new line character.
|
|
54
|
+
|
|
55
|
+
## Postgres connection
|
|
56
|
+
|
|
57
|
+
To create a Postgres database you need to:
|
|
58
|
+
|
|
59
|
+
1. Start Postgres in Docker using:
|
|
60
|
+
|
|
61
|
+
```shell
|
|
62
|
+
$ docker run --network=host --name some-postgres -e POSTGRES_PASSWORD=postgres -d postgres
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. In the file `splice-wallet-kernel/wallet-gateway/test/config.json`, specify the connection settings for both databases (store and signingStore). The connection should look like this (it is important that `store.connection.database !== signingStore.connection.database !== 'postgres'`):
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"store": {
|
|
70
|
+
"connection": {
|
|
71
|
+
"type": "postgres",
|
|
72
|
+
"password": "postgres",
|
|
73
|
+
"port": 5432,
|
|
74
|
+
"user": "postgres",
|
|
75
|
+
"host": "0.0.0.0",
|
|
76
|
+
"database": "wallet_store"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"signingStore": {
|
|
80
|
+
"connection": {
|
|
81
|
+
"type": "postgres",
|
|
82
|
+
"password": "postgres",
|
|
83
|
+
"port": 5432,
|
|
84
|
+
"user": "postgres",
|
|
85
|
+
"host": "0.0.0.0",
|
|
86
|
+
"database": "signing_store"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
package/dist/config/Config.js
CHANGED
|
@@ -44,8 +44,8 @@ export const serverConfigSchema = z.object({
|
|
|
44
44
|
requestSizeLimit: z.string().default('1mb').meta({
|
|
45
45
|
description: 'The maximum size of incoming requests. Defaults to 1mb.',
|
|
46
46
|
}),
|
|
47
|
-
requestRateLimit: z.number().default(
|
|
48
|
-
description: 'The maximum number of requests per minute from a single IP address. Defaults to
|
|
47
|
+
requestRateLimit: z.number().default(10000).meta({
|
|
48
|
+
description: 'The maximum number of requests per minute from a single IP address. Defaults to 10000.',
|
|
49
49
|
}),
|
|
50
50
|
});
|
|
51
51
|
export const configSchema = z.object({
|
|
@@ -7,14 +7,15 @@ export declare const dappController: (kernelInfo: KernelInfoConfig, dappUrl: str
|
|
|
7
7
|
status: import("./rpc-gen/typings.js").Status;
|
|
8
8
|
connect: import("./rpc-gen/typings.js").Connect;
|
|
9
9
|
disconnect: import("./rpc-gen/typings.js").Disconnect;
|
|
10
|
-
|
|
11
|
-
prepareReturn: import("./rpc-gen/typings.js").PrepareReturn;
|
|
10
|
+
getActiveNetwork: import("./rpc-gen/typings.js").GetActiveNetwork;
|
|
12
11
|
prepareExecute: import("./rpc-gen/typings.js").PrepareExecute;
|
|
12
|
+
signMessage: import("./rpc-gen/typings.js").SignMessage;
|
|
13
13
|
ledgerApi: import("./rpc-gen/typings.js").LedgerApi;
|
|
14
|
-
|
|
14
|
+
connected: import("./rpc-gen/typings.js").Connected;
|
|
15
15
|
onStatusChanged: import("./rpc-gen/typings.js").OnStatusChanged;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
accountsChanged: import("./rpc-gen/typings.js").AccountsChanged;
|
|
17
|
+
getPrimaryAccount: import("./rpc-gen/typings.js").GetPrimaryAccount;
|
|
18
|
+
listAccounts: import("./rpc-gen/typings.js").ListAccounts;
|
|
19
|
+
txChanged: import("./rpc-gen/typings.js").TxChanged;
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,WAAW,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAW/E,OAAO,EAAE,KAAK,EAAe,MAAM,mCAAmC,CAAA;AAQtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAG7B,eAAO,MAAM,cAAc,GACvB,YAAY,gBAAgB,EAC5B,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,SAAS,MAAM,EACf,QAAQ,MAAM,GAAG,IAAI,EACrB,UAAU,WAAW;;;;;;;;;;;;;;CA0NxB,CAAA"}
|
|
@@ -27,7 +27,8 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
27
27
|
accessToken: context.accessToken,
|
|
28
28
|
});
|
|
29
29
|
const status = await networkStatus(ledgerClient);
|
|
30
|
-
|
|
30
|
+
const notifier = notificationService.getNotifier(context.userId);
|
|
31
|
+
const StatusEvent = {
|
|
31
32
|
kernel: kernelInfo,
|
|
32
33
|
isConnected: true,
|
|
33
34
|
isNetworkConnected: status.isConnected,
|
|
@@ -45,6 +46,8 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
45
46
|
},
|
|
46
47
|
userUrl: `${userUrl}/login/`,
|
|
47
48
|
};
|
|
49
|
+
notifier.emit('statusChanged', StatusEvent);
|
|
50
|
+
return StatusEvent;
|
|
48
51
|
},
|
|
49
52
|
disconnect: async () => {
|
|
50
53
|
if (!context) {
|
|
@@ -57,13 +60,12 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
57
60
|
kernel: kernelInfo,
|
|
58
61
|
isConnected: false,
|
|
59
62
|
isNetworkConnected: false,
|
|
60
|
-
networkReason: '
|
|
63
|
+
networkReason: 'disconnect',
|
|
61
64
|
userUrl: `${userUrl}/login/`,
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
67
|
return null;
|
|
65
68
|
},
|
|
66
|
-
darsAvailable: async () => ({ dars: ['default-dar'] }),
|
|
67
69
|
ledgerApi: async (params) => {
|
|
68
70
|
const network = await store.getCurrentNetwork();
|
|
69
71
|
const ledgerClient = new LedgerClient({
|
|
@@ -126,23 +128,6 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
126
128
|
userUrl: `${userUrl}/approve/index.html?commandId=${commandId}`,
|
|
127
129
|
};
|
|
128
130
|
},
|
|
129
|
-
prepareReturn: async (params) => {
|
|
130
|
-
const wallet = await store.getPrimaryWallet();
|
|
131
|
-
const network = await store.getCurrentNetwork();
|
|
132
|
-
if (context === undefined) {
|
|
133
|
-
throw new Error('Unauthenticated context');
|
|
134
|
-
}
|
|
135
|
-
if (wallet === undefined) {
|
|
136
|
-
throw new Error('No primary wallet found');
|
|
137
|
-
}
|
|
138
|
-
const ledgerClient = new LedgerClient({
|
|
139
|
-
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
140
|
-
logger,
|
|
141
|
-
isAdmin: false,
|
|
142
|
-
accessToken: context.accessToken,
|
|
143
|
-
});
|
|
144
|
-
return prepareSubmission(context.userId, wallet.partyId, network.synchronizerId, params, ledgerClient);
|
|
145
|
-
},
|
|
146
131
|
status: async () => {
|
|
147
132
|
if (!context || !(await store.getSession())) {
|
|
148
133
|
return {
|
|
@@ -180,22 +165,34 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
180
165
|
userUrl: `${userUrl}/login/`,
|
|
181
166
|
};
|
|
182
167
|
},
|
|
183
|
-
|
|
168
|
+
connected: async () => {
|
|
184
169
|
throw new Error('Only for events.');
|
|
185
170
|
},
|
|
186
171
|
onStatusChanged: async () => {
|
|
187
172
|
throw new Error('Only for events.');
|
|
188
173
|
},
|
|
189
|
-
|
|
174
|
+
accountsChanged: async () => {
|
|
190
175
|
throw new Error('Only for events.');
|
|
191
176
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return wallets;
|
|
177
|
+
listAccounts: async () => {
|
|
178
|
+
return await store.getWallets();
|
|
195
179
|
},
|
|
196
|
-
|
|
180
|
+
txChanged: async () => {
|
|
197
181
|
throw new Error('Only for events.');
|
|
198
182
|
},
|
|
183
|
+
getActiveNetwork: function () {
|
|
184
|
+
throw new Error('Function not implemented.');
|
|
185
|
+
},
|
|
186
|
+
signMessage: function () {
|
|
187
|
+
throw new Error('Function not implemented.');
|
|
188
|
+
},
|
|
189
|
+
getPrimaryAccount: async function () {
|
|
190
|
+
const wallet = await store.getPrimaryWallet();
|
|
191
|
+
if (!wallet) {
|
|
192
|
+
throw new Error('No primary wallet found');
|
|
193
|
+
}
|
|
194
|
+
return wallet;
|
|
195
|
+
},
|
|
199
196
|
});
|
|
200
197
|
};
|
|
201
198
|
async function prepareSubmission(userId, partyId, synchronizerId, params, ledgerClient) {
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { Status } from './typings.js';
|
|
2
2
|
import { Connect } from './typings.js';
|
|
3
3
|
import { Disconnect } from './typings.js';
|
|
4
|
-
import {
|
|
5
|
-
import { PrepareReturn } from './typings.js';
|
|
4
|
+
import { GetActiveNetwork } from './typings.js';
|
|
6
5
|
import { PrepareExecute } from './typings.js';
|
|
6
|
+
import { SignMessage } from './typings.js';
|
|
7
7
|
import { LedgerApi } from './typings.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Connected } from './typings.js';
|
|
9
9
|
import { OnStatusChanged } from './typings.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { AccountsChanged } from './typings.js';
|
|
11
|
+
import { GetPrimaryAccount } from './typings.js';
|
|
12
|
+
import { ListAccounts } from './typings.js';
|
|
13
|
+
import { TxChanged } from './typings.js';
|
|
13
14
|
export type Methods = {
|
|
14
15
|
status: Status;
|
|
15
16
|
connect: Connect;
|
|
16
17
|
disconnect: Disconnect;
|
|
17
|
-
|
|
18
|
-
prepareReturn: PrepareReturn;
|
|
18
|
+
getActiveNetwork: GetActiveNetwork;
|
|
19
19
|
prepareExecute: PrepareExecute;
|
|
20
|
+
signMessage: SignMessage;
|
|
20
21
|
ledgerApi: LedgerApi;
|
|
21
|
-
|
|
22
|
+
connected: Connected;
|
|
22
23
|
onStatusChanged: OnStatusChanged;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
accountsChanged: AccountsChanged;
|
|
25
|
+
getPrimaryAccount: GetPrimaryAccount;
|
|
26
|
+
listAccounts: ListAccounts;
|
|
27
|
+
txChanged: TxChanged;
|
|
26
28
|
};
|
|
27
29
|
declare function buildController(methods: Methods): {
|
|
28
30
|
status: Status;
|
|
29
31
|
connect: Connect;
|
|
30
32
|
disconnect: Disconnect;
|
|
31
|
-
|
|
32
|
-
prepareReturn: PrepareReturn;
|
|
33
|
+
getActiveNetwork: GetActiveNetwork;
|
|
33
34
|
prepareExecute: PrepareExecute;
|
|
35
|
+
signMessage: SignMessage;
|
|
34
36
|
ledgerApi: LedgerApi;
|
|
35
|
-
|
|
37
|
+
connected: Connected;
|
|
36
38
|
onStatusChanged: OnStatusChanged;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
accountsChanged: AccountsChanged;
|
|
40
|
+
getPrimaryAccount: GetPrimaryAccount;
|
|
41
|
+
listAccounts: ListAccounts;
|
|
42
|
+
txChanged: TxChanged;
|
|
40
43
|
};
|
|
41
44
|
export default buildController;
|
|
42
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,MAAM,OAAO,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,WAAW,CAAA;IACxB,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,SAAS,CAAA;IACpB,eAAe,EAAE,eAAe,CAAA;IAChC,eAAe,EAAE,eAAe,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACvB,CAAA;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO;;;;;;;;;;;;;;EAgBxC;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -5,15 +5,16 @@ function buildController(methods) {
|
|
|
5
5
|
status: methods.status,
|
|
6
6
|
connect: methods.connect,
|
|
7
7
|
disconnect: methods.disconnect,
|
|
8
|
-
|
|
9
|
-
prepareReturn: methods.prepareReturn,
|
|
8
|
+
getActiveNetwork: methods.getActiveNetwork,
|
|
10
9
|
prepareExecute: methods.prepareExecute,
|
|
10
|
+
signMessage: methods.signMessage,
|
|
11
11
|
ledgerApi: methods.ledgerApi,
|
|
12
|
-
|
|
12
|
+
connected: methods.connected,
|
|
13
13
|
onStatusChanged: methods.onStatusChanged,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
accountsChanged: methods.accountsChanged,
|
|
15
|
+
getPrimaryAccount: methods.getPrimaryAccount,
|
|
16
|
+
listAccounts: methods.listAccounts,
|
|
17
|
+
txChanged: methods.txChanged,
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export default buildController;
|
|
@@ -79,6 +79,12 @@ export type PackageId = string;
|
|
|
79
79
|
*
|
|
80
80
|
*/
|
|
81
81
|
export type PackageIdSelectionPreference = PackageId[];
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* The message to sign.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
export type Message = string;
|
|
82
88
|
export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
83
89
|
export type Resource = string;
|
|
84
90
|
export type Body = string;
|
|
@@ -202,30 +208,12 @@ export interface ConnectResult {
|
|
|
202
208
|
userUrl: UserUrl;
|
|
203
209
|
[k: string]: any;
|
|
204
210
|
}
|
|
205
|
-
export type Dar = string;
|
|
206
|
-
export type Dars = Dar[];
|
|
207
211
|
/**
|
|
208
212
|
*
|
|
209
|
-
* The
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
export type PreparedTransaction = string;
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* The hash of the prepared transaction.
|
|
216
|
-
*
|
|
217
|
-
*/
|
|
218
|
-
export type PreparedTransactionHash = string;
|
|
219
|
-
/**
|
|
220
|
-
*
|
|
221
|
-
* Structure representing the result of a prepareReturn call
|
|
213
|
+
* The signature of the transaction.
|
|
222
214
|
*
|
|
223
215
|
*/
|
|
224
|
-
export
|
|
225
|
-
preparedTransaction?: PreparedTransaction;
|
|
226
|
-
preparedTransactionHash?: PreparedTransactionHash;
|
|
227
|
-
[k: string]: any;
|
|
228
|
-
}
|
|
216
|
+
export type Signature = string;
|
|
229
217
|
export type Response = string;
|
|
230
218
|
/**
|
|
231
219
|
*
|
|
@@ -334,12 +322,6 @@ export interface TxChangedPendingEvent {
|
|
|
334
322
|
*
|
|
335
323
|
*/
|
|
336
324
|
export type StatusSigned = 'signed';
|
|
337
|
-
/**
|
|
338
|
-
*
|
|
339
|
-
* The signature of the transaction.
|
|
340
|
-
*
|
|
341
|
-
*/
|
|
342
|
-
export type Signature = string;
|
|
343
325
|
/**
|
|
344
326
|
*
|
|
345
327
|
* The identifier of the provider that signed the transaction.
|
|
@@ -418,7 +400,7 @@ export interface TxChangedFailedEvent {
|
|
|
418
400
|
* Structure representing the request for prepare and execute calls
|
|
419
401
|
*
|
|
420
402
|
*/
|
|
421
|
-
export interface
|
|
403
|
+
export interface PrepareExecuteParams {
|
|
422
404
|
commandId?: CommandId;
|
|
423
405
|
commands: JsCommands;
|
|
424
406
|
actAs?: ActAs;
|
|
@@ -430,17 +412,11 @@ export interface PrepareReturnParams {
|
|
|
430
412
|
}
|
|
431
413
|
/**
|
|
432
414
|
*
|
|
433
|
-
*
|
|
415
|
+
* Request to sign a message.
|
|
434
416
|
*
|
|
435
417
|
*/
|
|
436
|
-
export interface
|
|
437
|
-
|
|
438
|
-
commands: JsCommands;
|
|
439
|
-
actAs?: ActAs;
|
|
440
|
-
readAs?: ReadAs;
|
|
441
|
-
disclosedContracts?: DisclosedContracts;
|
|
442
|
-
synchronizerId?: SynchronizerId;
|
|
443
|
-
packageIdSelectionPreference?: PackageIdSelectionPreference;
|
|
418
|
+
export interface SignMessageParams {
|
|
419
|
+
message: Message;
|
|
444
420
|
[k: string]: any;
|
|
445
421
|
}
|
|
446
422
|
/**
|
|
@@ -461,15 +437,19 @@ export type StatusEventAsync = StatusEvent & ConnectResult;
|
|
|
461
437
|
*
|
|
462
438
|
*/
|
|
463
439
|
export type Null = null;
|
|
464
|
-
export interface DarsAvailableResult {
|
|
465
|
-
dars: Dars;
|
|
466
|
-
[k: string]: any;
|
|
467
|
-
}
|
|
468
|
-
export type PrepareReturnResult = any;
|
|
469
440
|
export interface PrepareExecuteResult {
|
|
470
441
|
userUrl: UserUrl;
|
|
471
442
|
[k: string]: any;
|
|
472
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
*
|
|
446
|
+
* Result of signing a message.
|
|
447
|
+
*
|
|
448
|
+
*/
|
|
449
|
+
export interface SignMessageResult {
|
|
450
|
+
signature: Signature;
|
|
451
|
+
[k: string]: any;
|
|
452
|
+
}
|
|
473
453
|
/**
|
|
474
454
|
*
|
|
475
455
|
* Ledger Api configuration options
|
|
@@ -490,7 +470,7 @@ export type AccountsChangedEvent = Wallet[];
|
|
|
490
470
|
* An array of accounts that the user has authorized the dapp to access..
|
|
491
471
|
*
|
|
492
472
|
*/
|
|
493
|
-
export type
|
|
473
|
+
export type ListAccountsResult = Wallet[];
|
|
494
474
|
/**
|
|
495
475
|
*
|
|
496
476
|
* Event emitted when a transaction changes.
|
|
@@ -505,13 +485,14 @@ export type TxChangedEvent = TxChangedPendingEvent | TxChangedSignedEvent | TxCh
|
|
|
505
485
|
export type Status = () => Promise<StatusEvent>;
|
|
506
486
|
export type Connect = () => Promise<StatusEventAsync>;
|
|
507
487
|
export type Disconnect = () => Promise<Null>;
|
|
508
|
-
export type
|
|
509
|
-
export type PrepareReturn = (params: PrepareReturnParams) => Promise<PrepareReturnResult>;
|
|
488
|
+
export type GetActiveNetwork = () => Promise<Network>;
|
|
510
489
|
export type PrepareExecute = (params: PrepareExecuteParams) => Promise<PrepareExecuteResult>;
|
|
490
|
+
export type SignMessage = (params: SignMessageParams) => Promise<SignMessageResult>;
|
|
511
491
|
export type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>;
|
|
512
|
-
export type
|
|
492
|
+
export type Connected = () => Promise<StatusEvent>;
|
|
513
493
|
export type OnStatusChanged = () => Promise<StatusEvent>;
|
|
514
|
-
export type
|
|
515
|
-
export type
|
|
516
|
-
export type
|
|
494
|
+
export type AccountsChanged = () => Promise<AccountsChangedEvent>;
|
|
495
|
+
export type GetPrimaryAccount = () => Promise<Wallet>;
|
|
496
|
+
export type ListAccounts = () => Promise<ListAccountsResult>;
|
|
497
|
+
export type TxChanged = () => Promise<TxChangedEvent>;
|
|
517
498
|
//# sourceMappingURL=typings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/typings.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,MAAM,SAAS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CAAC,CAAA;AACrD,MAAM,MAAM,cAAc,GAAG,CACzB,MAAM,EAAE,oBAAoB,KAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAClC,MAAM,MAAM,WAAW,GAAG,CACtB,MAAM,EAAE,iBAAiB,KACxB,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAC/B,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;AAC7E,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;AAClD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;AACxD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC5D,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dapp-api/server.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAG7B,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dapp-api/server.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAG7B,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAO9D,eAAO,MAAM,IAAI,GACb,OAAO,MAAM,EACb,KAAK,OAAO,CAAC,OAAO,EACpB,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,YAAY,UAAU,EACtB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,cAAc,YAAY,EAC1B,qBAAqB,mBAAmB,EACxC,aAAa,WAAW,EACxB,OAAO,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,kGAuFlC,CAAA"}
|
package/dist/dapp-api/server.js
CHANGED
|
@@ -3,11 +3,62 @@
|
|
|
3
3
|
import cors from 'cors';
|
|
4
4
|
import { dappController } from './controller.js';
|
|
5
5
|
import { jsonRpcHandler } from '../middleware/jsonRpcHandler.js';
|
|
6
|
-
|
|
6
|
+
function writeSSE(res, event, data) {
|
|
7
|
+
res.write(`event: ${event}\n`);
|
|
8
|
+
res.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
9
|
+
}
|
|
7
10
|
export const dapp = (route, app, logger, server, kernelInfo, dappUrl, userUrl, serverConfig, notificationService, authService, store) => {
|
|
8
11
|
app.use(cors({
|
|
9
12
|
origin: serverConfig.allowedOrigins,
|
|
10
13
|
}));
|
|
14
|
+
// SSE endpoint for real-time notifications (must be registered before the JSON-RPC route)
|
|
15
|
+
app.get(`${route}/events`, async (req, res) => {
|
|
16
|
+
const context = req.authContext;
|
|
17
|
+
if (!context) {
|
|
18
|
+
res.status(401).json({ error: 'Unauthenticated' });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const newStore = store.withAuthContext(context);
|
|
22
|
+
const session = await newStore.getSession();
|
|
23
|
+
const sessionId = session?.id;
|
|
24
|
+
if (!sessionId) {
|
|
25
|
+
res.status(401).json({ error: 'No session' });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
logger.debug(`SSE connected for user: ${context.userId} with session ID: ${sessionId}`);
|
|
29
|
+
res.setHeader('Content-Type', 'text/event-stream');
|
|
30
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
31
|
+
res.setHeader('Connection', 'keep-alive');
|
|
32
|
+
res.setHeader('X-Accel-Buffering', 'no');
|
|
33
|
+
res.flushHeaders?.();
|
|
34
|
+
const notifier = notificationService.getNotifier(context.userId);
|
|
35
|
+
const onAccountsChanged = (...event) => {
|
|
36
|
+
writeSSE(res, 'accountsChanged', event);
|
|
37
|
+
};
|
|
38
|
+
const onStatusChanged = (...event) => {
|
|
39
|
+
logger.debug({ sessionId }, 'Emitting statusChanged event via SSE');
|
|
40
|
+
writeSSE(res, 'statusChanged', event);
|
|
41
|
+
};
|
|
42
|
+
const onConnected = (...event) => {
|
|
43
|
+
writeSSE(res, 'connected', event);
|
|
44
|
+
};
|
|
45
|
+
const onTxChanged = (...event) => {
|
|
46
|
+
writeSSE(res, 'txChanged', event);
|
|
47
|
+
};
|
|
48
|
+
notifier.on('accountsChanged', onAccountsChanged);
|
|
49
|
+
notifier.on('connected', onConnected);
|
|
50
|
+
notifier.on('statusChanged', onStatusChanged);
|
|
51
|
+
notifier.on('txChanged', onTxChanged);
|
|
52
|
+
const cleanup = () => {
|
|
53
|
+
logger.debug('SSE client disconnected');
|
|
54
|
+
notifier.removeListener('accountsChanged', onAccountsChanged);
|
|
55
|
+
notifier.removeListener('connected', onConnected);
|
|
56
|
+
notifier.removeListener('statusChanged', onStatusChanged);
|
|
57
|
+
notifier.removeListener('txChanged', onTxChanged);
|
|
58
|
+
};
|
|
59
|
+
req.on('close', cleanup);
|
|
60
|
+
req.on('error', cleanup);
|
|
61
|
+
});
|
|
11
62
|
app.use(route, (req, res, next) => {
|
|
12
63
|
const origin = req.headers.origin ?? null;
|
|
13
64
|
jsonRpcHandler({
|
|
@@ -15,49 +66,5 @@ export const dapp = (route, app, logger, server, kernelInfo, dappUrl, userUrl, s
|
|
|
15
66
|
logger,
|
|
16
67
|
})(req, res, next);
|
|
17
68
|
});
|
|
18
|
-
const io = new SocketIoServer(server, {
|
|
19
|
-
cors: {
|
|
20
|
-
origin: serverConfig.allowedOrigins,
|
|
21
|
-
methods: ['GET', 'POST'],
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
io.on('connection', async (socket) => {
|
|
25
|
-
let sessionId = undefined;
|
|
26
|
-
const context = await authService.verifyToken(socket.handshake.auth.token);
|
|
27
|
-
if (context !== undefined) {
|
|
28
|
-
const newStore = store.withAuthContext(context);
|
|
29
|
-
const session = await newStore.getSession();
|
|
30
|
-
sessionId = session?.id;
|
|
31
|
-
}
|
|
32
|
-
if (context && sessionId) {
|
|
33
|
-
socket.join(sessionId);
|
|
34
|
-
logger.debug(`Socket.io connected for user: ${context.userId} with session ID: ${sessionId}`);
|
|
35
|
-
const notifier = notificationService.getNotifier(context.userId);
|
|
36
|
-
const onAccountsChanged = (...event) => {
|
|
37
|
-
io.to(sessionId).emit('accountsChanged', ...event);
|
|
38
|
-
};
|
|
39
|
-
const onStatusChanged = (...event) => {
|
|
40
|
-
logger.debug({ sessionId }, 'Emitting statusChanged event via Socket.io');
|
|
41
|
-
io.to(sessionId).emit('statusChanged', ...event);
|
|
42
|
-
};
|
|
43
|
-
const onConnected = (...event) => {
|
|
44
|
-
io.to(sessionId).emit('onConnected', ...event);
|
|
45
|
-
};
|
|
46
|
-
const onTxChanged = (...event) => {
|
|
47
|
-
io.to(sessionId).emit('txChanged', ...event);
|
|
48
|
-
};
|
|
49
|
-
notifier.on('accountsChanged', onAccountsChanged);
|
|
50
|
-
notifier.on('onConnected', onConnected);
|
|
51
|
-
notifier.on('statusChanged', onStatusChanged);
|
|
52
|
-
notifier.on('txChanged', onTxChanged);
|
|
53
|
-
socket.on('disconnect', () => {
|
|
54
|
-
logger.debug('Socket.io client disconnected');
|
|
55
|
-
notifier.removeListener('accountsChanged', onAccountsChanged);
|
|
56
|
-
notifier.removeListener('onConnected', onConnected);
|
|
57
|
-
notifier.removeListener('statusChanged', onStatusChanged);
|
|
58
|
-
notifier.removeListener('txChanged', onTxChanged);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
69
|
return server;
|
|
63
70
|
};
|
package/dist/example-config.js
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA4DA,QAAA,MAAM,OAAO;;;;;;CAAiB,CAAA;AAE9B,MAAM,MAAM,UAAU,GAAG,OAAO,OAAO,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Option, Command } from '@commander-js/extra-typings';
|
|
5
5
|
import { initialize } from './init.js';
|
|
6
6
|
import { createCLI } from '@canton-network/core-wallet-store-sql';
|
|
7
|
+
import { createCLI as createSigningCLI } from '@canton-network/core-signing-store-sql';
|
|
7
8
|
import { ConfigUtils } from './config/ConfigUtils.js';
|
|
8
9
|
import pino from 'pino';
|
|
9
10
|
import z from 'zod';
|
|
@@ -52,11 +53,20 @@ const options = program.opts();
|
|
|
52
53
|
let db = new Command('db')
|
|
53
54
|
.description('Database management commands')
|
|
54
55
|
.allowUnknownOption(true);
|
|
56
|
+
let signingDb = new Command('signing-db')
|
|
57
|
+
.description('Signing database management commands')
|
|
58
|
+
.allowUnknownOption(true);
|
|
55
59
|
const hasDb = process.argv.slice(2).includes('db');
|
|
56
60
|
if (hasDb) {
|
|
57
61
|
const config = ConfigUtils.loadConfigFile(options.config);
|
|
58
62
|
db = createCLI(config.store);
|
|
59
63
|
}
|
|
64
|
+
const hasSigningDb = process.argv.slice(2).includes('signing-db');
|
|
65
|
+
if (hasSigningDb) {
|
|
66
|
+
const config = ConfigUtils.loadConfigFile(options.config);
|
|
67
|
+
signingDb = createSigningCLI(config.signingStore);
|
|
68
|
+
}
|
|
60
69
|
program.addCommand(db.name('db'));
|
|
70
|
+
program.addCommand(signingDb.name('signing-db'));
|
|
61
71
|
// Now parse normally for execution/help
|
|
62
72
|
program.parseAsync(process.argv);
|
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;AAqB7B,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;AAqB7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAyIvC,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAoIhE"}
|