@canton-network/wallet-gateway-remote 0.1.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.
Files changed (96) hide show
  1. package/README.md +25 -0
  2. package/dist/auth/jwt-auth-service.d.ts +11 -0
  3. package/dist/auth/jwt-auth-service.d.ts.map +1 -0
  4. package/dist/auth/jwt-auth-service.js +50 -0
  5. package/dist/config/Config.d.ts +590 -0
  6. package/dist/config/Config.d.ts.map +1 -0
  7. package/dist/config/Config.js +19 -0
  8. package/dist/config/Config.test.d.ts +2 -0
  9. package/dist/config/Config.test.d.ts.map +1 -0
  10. package/dist/config/Config.test.js +19 -0
  11. package/dist/config/ConfigUtils.d.ts +5 -0
  12. package/dist/config/ConfigUtils.d.ts.map +1 -0
  13. package/dist/config/ConfigUtils.js +14 -0
  14. package/dist/dapp-api/controller.d.ts +18 -0
  15. package/dist/dapp-api/controller.d.ts.map +1 -0
  16. package/dist/dapp-api/controller.js +101 -0
  17. package/dist/dapp-api/rpc-gen/index.d.ts +36 -0
  18. package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -0
  19. package/dist/dapp-api/rpc-gen/index.js +17 -0
  20. package/dist/dapp-api/rpc-gen/typings.d.ts +337 -0
  21. package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -0
  22. package/dist/dapp-api/rpc-gen/typings.js +3 -0
  23. package/dist/dapp-api/server.d.ts +6 -0
  24. package/dist/dapp-api/server.d.ts.map +1 -0
  25. package/dist/dapp-api/server.js +62 -0
  26. package/dist/dapp-api/server.test.d.ts +2 -0
  27. package/dist/dapp-api/server.test.d.ts.map +1 -0
  28. package/dist/dapp-api/server.test.js +45 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +30 -0
  32. package/dist/init.d.ts +9 -0
  33. package/dist/init.d.ts.map +1 -0
  34. package/dist/init.js +77 -0
  35. package/dist/ledger/party-allocation-service.d.ts +34 -0
  36. package/dist/ledger/party-allocation-service.d.ts.map +1 -0
  37. package/dist/ledger/party-allocation-service.js +50 -0
  38. package/dist/ledger/party-allocation-service.test.d.ts +2 -0
  39. package/dist/ledger/party-allocation-service.test.d.ts.map +1 -0
  40. package/dist/ledger/party-allocation-service.test.js +85 -0
  41. package/dist/ledger/wallet-sync-service.d.ts +18 -0
  42. package/dist/ledger/wallet-sync-service.d.ts.map +1 -0
  43. package/dist/ledger/wallet-sync-service.js +90 -0
  44. package/dist/middleware/jsonRpcHandler.d.ts +9 -0
  45. package/dist/middleware/jsonRpcHandler.d.ts.map +1 -0
  46. package/dist/middleware/jsonRpcHandler.js +102 -0
  47. package/dist/middleware/jwtAuth.d.ts +5 -0
  48. package/dist/middleware/jwtAuth.d.ts.map +1 -0
  49. package/dist/middleware/jwtAuth.js +20 -0
  50. package/dist/middleware/rateLimit.d.ts +2 -0
  51. package/dist/middleware/rateLimit.d.ts.map +1 -0
  52. package/dist/middleware/rateLimit.js +9 -0
  53. package/dist/notification/NotificationService.d.ts +11 -0
  54. package/dist/notification/NotificationService.d.ts.map +1 -0
  55. package/dist/notification/NotificationService.js +5 -0
  56. package/dist/user-api/controller.d.ts +23 -0
  57. package/dist/user-api/controller.d.ts.map +1 -0
  58. package/dist/user-api/controller.js +336 -0
  59. package/dist/user-api/rpc-gen/index.d.ts +42 -0
  60. package/dist/user-api/rpc-gen/index.d.ts.map +1 -0
  61. package/dist/user-api/rpc-gen/index.js +19 -0
  62. package/dist/user-api/rpc-gen/typings.d.ts +297 -0
  63. package/dist/user-api/rpc-gen/typings.d.ts.map +1 -0
  64. package/dist/user-api/rpc-gen/typings.js +3 -0
  65. package/dist/user-api/server.d.ts +7 -0
  66. package/dist/user-api/server.d.ts.map +1 -0
  67. package/dist/user-api/server.js +20 -0
  68. package/dist/user-api/server.test.d.ts +2 -0
  69. package/dist/user-api/server.test.d.ts.map +1 -0
  70. package/dist/user-api/server.test.js +38 -0
  71. package/dist/web/frontend/404/index.html +20 -0
  72. package/dist/web/frontend/approve/index.html +23 -0
  73. package/dist/web/frontend/assets/404-BHkjVWlW.js +16 -0
  74. package/dist/web/frontend/assets/approve-lRsfAWmm.js +157 -0
  75. package/dist/web/frontend/assets/callback-QrXhW3mX.js +1 -0
  76. package/dist/web/frontend/assets/handle-errors-BcwHAkCd.js +1 -0
  77. package/dist/web/frontend/assets/index-BknZMPaI.css +5 -0
  78. package/dist/web/frontend/assets/index-BxdGgjHv.js +1 -0
  79. package/dist/web/frontend/assets/index-D-GexOrJ.js +697 -0
  80. package/dist/web/frontend/assets/index-TZrNw7dA.css +1 -0
  81. package/dist/web/frontend/assets/login-HUymBqli.js +159 -0
  82. package/dist/web/frontend/assets/networks-BZihbVwK.js +221 -0
  83. package/dist/web/frontend/assets/rpc-client-CCUlY3sp.js +1 -0
  84. package/dist/web/frontend/assets/state-DKGJ6EmM.js +9 -0
  85. package/dist/web/frontend/assets/state-manager-BNW0y5PZ.js +23 -0
  86. package/dist/web/frontend/assets/wallets-BoN6kUME.js +214 -0
  87. package/dist/web/frontend/callback/index.html +13 -0
  88. package/dist/web/frontend/icon.png +0 -0
  89. package/dist/web/frontend/index.html +19 -0
  90. package/dist/web/frontend/login/index.html +21 -0
  91. package/dist/web/frontend/networks/index.html +20 -0
  92. package/dist/web/frontend/wallets/index.html +22 -0
  93. package/dist/web/server.d.ts +2 -0
  94. package/dist/web/server.d.ts.map +1 -0
  95. package/dist/web/server.js +30 -0
  96. package/package.json +86 -0
@@ -0,0 +1,19 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { storeConfigSchema } from '@canton-network/core-wallet-store';
4
+ import { z } from 'zod';
5
+ export const kernelInfoSchema = z.object({
6
+ id: z.string(),
7
+ clientType: z.union([
8
+ z.literal('browser'),
9
+ z.literal('desktop'),
10
+ z.literal('mobile'),
11
+ z.literal('remote'),
12
+ ]),
13
+ url: z.string().url(),
14
+ userUrl: z.string().url(),
15
+ });
16
+ export const configSchema = z.object({
17
+ kernel: kernelInfoSchema,
18
+ store: storeConfigSchema,
19
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Config.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.test.d.ts","sourceRoot":"","sources":["../../src/config/Config.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { expect, test } from '@jest/globals';
4
+ import { ConfigUtils } from './ConfigUtils.js';
5
+ test('config from json file', async () => {
6
+ const resp = ConfigUtils.loadConfigFile('../test/config.json');
7
+ expect(resp.store.networks[0].name).toBe('Local (password IDP)');
8
+ expect(resp.store.networks[0].ledgerApi.baseUrl).toBe('https://test');
9
+ expect(resp.store.networks[0].auth.clientId).toBe('wk-service-account');
10
+ expect(resp.store.networks[0].auth.scope).toBe('openid');
11
+ expect(resp.store.networks[0].auth.type).toBe('password');
12
+ if (resp.store.networks[0].auth.type === 'password') {
13
+ expect(resp.store.networks[0].auth.tokenUrl).toBe('tokenUrl');
14
+ }
15
+ expect(resp.store.networks[1].auth.type).toBe('implicit');
16
+ if (resp.store.networks[1].auth.type === 'implicit') {
17
+ expect(resp.store.networks[1].auth.audience).toBe('https://daml.com/jwt/aud/participant/participant1::1220d44fc1c3ba0b5bdf7b956ee71bc94ebe2d23258dc268fdf0824fbaeff2c61424');
18
+ }
19
+ });
@@ -0,0 +1,5 @@
1
+ import { Config } from './Config.js';
2
+ export declare class ConfigUtils {
3
+ static loadConfigFile(filePath: string): Config;
4
+ }
5
+ //# sourceMappingURL=ConfigUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAA;AAElD,qBAAa,WAAW;IACpB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CASlD"}
@@ -0,0 +1,14 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { readFileSync, existsSync } from 'fs';
4
+ import { configSchema } from './Config.js';
5
+ export class ConfigUtils {
6
+ static loadConfigFile(filePath) {
7
+ if (existsSync(filePath)) {
8
+ return configSchema.parse(JSON.parse(readFileSync(filePath, 'utf-8')));
9
+ }
10
+ else {
11
+ throw new Error("Supplied file path doesn't exist " + filePath);
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,18 @@
1
+ import { AuthContext } from '@canton-network/core-wallet-auth';
2
+ import { Store } from '@canton-network/core-wallet-store';
3
+ import { NotificationService } from '../notification/NotificationService.js';
4
+ import { KernelInfo as KernelInfoConfig } from '../config/Config.js';
5
+ import { Logger } from 'pino';
6
+ export declare const dappController: (kernelInfo: KernelInfoConfig, store: Store, notificationService: NotificationService, _logger: Logger, context?: AuthContext) => {
7
+ status: import("./rpc-gen/typings.js").Status;
8
+ connect: import("./rpc-gen/typings.js").Connect;
9
+ darsAvailable: import("./rpc-gen/typings.js").DarsAvailable;
10
+ prepareReturn: import("./rpc-gen/typings.js").PrepareReturn;
11
+ prepareExecute: import("./rpc-gen/typings.js").PrepareExecute;
12
+ ledgerApi: import("./rpc-gen/typings.js").LedgerApi;
13
+ onConnected: import("./rpc-gen/typings.js").OnConnected;
14
+ onAccountsChanged: import("./rpc-gen/typings.js").OnAccountsChanged;
15
+ requestAccounts: import("./rpc-gen/typings.js").RequestAccounts;
16
+ onTxChanged: import("./rpc-gen/typings.js").OnTxChanged;
17
+ };
18
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAO9D,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AAGzD,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;AA6B7B,eAAO,MAAM,cAAc,GACvB,YAAY,gBAAgB,EAC5B,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,SAAS,MAAM,EACf,UAAU,WAAW;;;;;;;;;;;CAiHxB,CAAA"}
@@ -0,0 +1,101 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // Disabled unused vars rule to allow for future implementations
4
+ import buildController from './rpc-gen/index.js';
5
+ import { LedgerClient } from '@canton-network/core-ledger-client';
6
+ import { v4 } from 'uuid';
7
+ async function prepareSubmission(userId, partyId, synchronizerId, commands, ledgerClient, commandId) {
8
+ const prepareParams = {
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- because OpenRPC codegen type is incompatible with ledger codegen type
10
+ commands: commands,
11
+ commandId: commandId || v4(),
12
+ userId,
13
+ actAs: [partyId],
14
+ readAs: [],
15
+ disclosedContracts: [],
16
+ synchronizerId,
17
+ verboseHashing: false,
18
+ packageIdSelectionPreference: [],
19
+ };
20
+ return await ledgerClient.post('/v2/interactive-submission/prepare', prepareParams);
21
+ }
22
+ export const dappController = (kernelInfo, store, notificationService, _logger, context) => {
23
+ const logger = _logger.child({ component: 'dapp-controller' });
24
+ return buildController({
25
+ connect: async () => ({
26
+ kernel: kernelInfo,
27
+ isConnected: false,
28
+ userUrl: 'http://localhost:3002/login/',
29
+ }),
30
+ darsAvailable: async () => ({ dars: ['default-dar'] }),
31
+ ledgerApi: async (params) => ({
32
+ response: 'default-response',
33
+ }),
34
+ prepareExecute: async (params) => {
35
+ const wallet = await store.getPrimaryWallet();
36
+ const network = await store.getCurrentNetwork();
37
+ if (context === undefined) {
38
+ throw new Error('Unauthenticated context');
39
+ }
40
+ if (wallet === undefined) {
41
+ throw new Error('No primary wallet found');
42
+ }
43
+ const ledgerClient = new LedgerClient(new URL(network.ledgerApi.baseUrl), context.accessToken, logger);
44
+ const userId = context.userId;
45
+ const notifier = notificationService.getNotifier(userId);
46
+ const commandId = v4();
47
+ notifier.emit('txChanged', { status: 'pending', commandId });
48
+ const { preparedTransactionHash, preparedTransaction = '' } = await prepareSubmission(context.userId, wallet.partyId, network.synchronizerId, params.commands, ledgerClient, commandId);
49
+ store.setTransaction({
50
+ commandId,
51
+ status: 'pending',
52
+ preparedTransaction,
53
+ preparedTransactionHash,
54
+ payload: params.commands,
55
+ });
56
+ return {
57
+ userUrl: `http://localhost:3002/approve/index.html?commandId=${commandId}&partyId=${wallet.partyId}&txHash=${encodeURIComponent(preparedTransactionHash)}&tx=${encodeURIComponent(preparedTransaction)}`,
58
+ };
59
+ },
60
+ prepareReturn: async (params) => {
61
+ const wallet = await store.getPrimaryWallet();
62
+ const network = await store.getCurrentNetwork();
63
+ if (context === undefined) {
64
+ throw new Error('Unauthenticated context');
65
+ }
66
+ if (wallet === undefined) {
67
+ throw new Error('No primary wallet found');
68
+ }
69
+ const ledgerClient = new LedgerClient(new URL(network.ledgerApi.baseUrl), context.accessToken, logger);
70
+ return prepareSubmission(context.userId, wallet.partyId, network.synchronizerId, params.commands, ledgerClient);
71
+ },
72
+ status: async () => {
73
+ if (!context) {
74
+ return {
75
+ kernel: kernelInfo,
76
+ isConnected: false,
77
+ };
78
+ }
79
+ else {
80
+ return {
81
+ kernel: kernelInfo,
82
+ isConnected: true,
83
+ chainId: (await store.getCurrentNetwork()).chainId,
84
+ };
85
+ }
86
+ },
87
+ onConnected: async () => {
88
+ throw new Error('Only for events.');
89
+ },
90
+ onAccountsChanged: async () => {
91
+ throw new Error('Only for events.');
92
+ },
93
+ requestAccounts: async () => {
94
+ const wallets = await store.getWallets();
95
+ return wallets;
96
+ },
97
+ onTxChanged: async () => {
98
+ throw new Error('Only for events.');
99
+ },
100
+ });
101
+ };
@@ -0,0 +1,36 @@
1
+ import { Status } from './typings.js';
2
+ import { Connect } from './typings.js';
3
+ import { DarsAvailable } from './typings.js';
4
+ import { PrepareReturn } from './typings.js';
5
+ import { PrepareExecute } from './typings.js';
6
+ import { LedgerApi } from './typings.js';
7
+ import { OnConnected } from './typings.js';
8
+ import { OnAccountsChanged } from './typings.js';
9
+ import { RequestAccounts } from './typings.js';
10
+ import { OnTxChanged } from './typings.js';
11
+ export type Methods = {
12
+ status: Status;
13
+ connect: Connect;
14
+ darsAvailable: DarsAvailable;
15
+ prepareReturn: PrepareReturn;
16
+ prepareExecute: PrepareExecute;
17
+ ledgerApi: LedgerApi;
18
+ onConnected: OnConnected;
19
+ onAccountsChanged: OnAccountsChanged;
20
+ requestAccounts: RequestAccounts;
21
+ onTxChanged: OnTxChanged;
22
+ };
23
+ declare function buildController(methods: Methods): {
24
+ status: Status;
25
+ connect: Connect;
26
+ darsAvailable: DarsAvailable;
27
+ prepareReturn: PrepareReturn;
28
+ prepareExecute: PrepareExecute;
29
+ ledgerApi: LedgerApi;
30
+ onConnected: OnConnected;
31
+ onAccountsChanged: OnAccountsChanged;
32
+ requestAccounts: RequestAccounts;
33
+ onTxChanged: OnTxChanged;
34
+ };
35
+ export default buildController;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,OAAO,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;IAC5B,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;IAC9B,SAAS,EAAE,SAAS,CAAA;IACpB,WAAW,EAAE,WAAW,CAAA;IACxB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,eAAe,EAAE,eAAe,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;CAC3B,CAAA;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO;;;;;;;;;;;EAaxC;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,17 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ function buildController(methods) {
4
+ return {
5
+ status: methods.status,
6
+ connect: methods.connect,
7
+ darsAvailable: methods.darsAvailable,
8
+ prepareReturn: methods.prepareReturn,
9
+ prepareExecute: methods.prepareExecute,
10
+ ledgerApi: methods.ledgerApi,
11
+ onConnected: methods.onConnected,
12
+ onAccountsChanged: methods.onAccountsChanged,
13
+ requestAccounts: methods.requestAccounts,
14
+ onTxChanged: methods.onTxChanged,
15
+ };
16
+ }
17
+ export default buildController;
@@ -0,0 +1,337 @@
1
+ /**
2
+ *
3
+ * Structure representing JS commands for transaction execution
4
+ *
5
+ */
6
+ export interface JsCommands {
7
+ [key: string]: any;
8
+ }
9
+ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
10
+ export type Resource = string;
11
+ export type Body = string;
12
+ /**
13
+ *
14
+ * The unique identifier of the Wallet Gateway.
15
+ *
16
+ */
17
+ export type Id = string;
18
+ /**
19
+ *
20
+ * The type of client that implements the Wallet Gateway.
21
+ *
22
+ */
23
+ export type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote';
24
+ /**
25
+ *
26
+ * The URL of the Wallet Gateway.
27
+ *
28
+ */
29
+ export type Url = string;
30
+ /**
31
+ *
32
+ * Represents a Wallet Gateway.
33
+ *
34
+ */
35
+ export interface KernelInfo {
36
+ id: Id;
37
+ clientType: ClientType;
38
+ url?: Url;
39
+ [k: string]: any;
40
+ }
41
+ /**
42
+ *
43
+ * Whether or not a connection to a network is esablished.
44
+ *
45
+ */
46
+ export type IsConnected = boolean;
47
+ /**
48
+ *
49
+ * The network ID the wallet corresponds to.
50
+ *
51
+ */
52
+ export type ChainId = string;
53
+ /**
54
+ *
55
+ * A URL that points to a user interface.
56
+ *
57
+ */
58
+ export type UserUrl = string;
59
+ export type Dar = string;
60
+ export type Dars = Dar[];
61
+ /**
62
+ *
63
+ * The prepared transaction data.
64
+ *
65
+ */
66
+ export type PreparedTransaction = string;
67
+ /**
68
+ *
69
+ * The hash of the prepared transaction.
70
+ *
71
+ */
72
+ export type PreparedTransactionHash = string;
73
+ /**
74
+ *
75
+ * Structure representing the result of a prepareReturn call
76
+ *
77
+ */
78
+ export interface JsPrepareSubmissionResponse {
79
+ preparedTransaction?: PreparedTransaction;
80
+ preparedTransactionHash?: PreparedTransactionHash;
81
+ [k: string]: any;
82
+ }
83
+ export type Response = string;
84
+ /**
85
+ *
86
+ * JWT authentication token (if applicable).
87
+ *
88
+ */
89
+ export type SessionToken = string;
90
+ /**
91
+ *
92
+ * Set as primary wallet for dApp usage.
93
+ *
94
+ */
95
+ export type Primary = boolean;
96
+ /**
97
+ *
98
+ * The party ID corresponding to the wallet.
99
+ *
100
+ */
101
+ export type PartyId = string;
102
+ /**
103
+ *
104
+ * The party hint and name of the wallet.
105
+ *
106
+ */
107
+ export type Hint = string;
108
+ /**
109
+ *
110
+ * The public key of the party.
111
+ *
112
+ */
113
+ export type PublicKey = string;
114
+ /**
115
+ *
116
+ * The namespace of the party.
117
+ *
118
+ */
119
+ export type Namespace = string;
120
+ /**
121
+ *
122
+ * The signing provider ID the wallet corresponds to.
123
+ *
124
+ */
125
+ export type SigningProviderId = string;
126
+ /**
127
+ *
128
+ * Structure representing a wallet
129
+ *
130
+ */
131
+ export interface Wallet {
132
+ primary: Primary;
133
+ partyId: PartyId;
134
+ hint: Hint;
135
+ publicKey: PublicKey;
136
+ namespace: Namespace;
137
+ chainId: ChainId;
138
+ signingProviderId: SigningProviderId;
139
+ [k: string]: any;
140
+ }
141
+ /**
142
+ *
143
+ * The status of the transaction.
144
+ *
145
+ */
146
+ export type StatusPending = 'pending';
147
+ /**
148
+ *
149
+ * The unique identifier of the command associated with the transaction.
150
+ *
151
+ */
152
+ export type CommandId = string;
153
+ /**
154
+ *
155
+ * Event emitted when a transaction is pending.
156
+ *
157
+ */
158
+ export interface TxChangedPendingEvent {
159
+ status: StatusPending;
160
+ commandId: CommandId;
161
+ }
162
+ /**
163
+ *
164
+ * The status of the transaction.
165
+ *
166
+ */
167
+ export type StatusSigned = 'signed';
168
+ /**
169
+ *
170
+ * The signature of the transaction.
171
+ *
172
+ */
173
+ export type Signature = string;
174
+ /**
175
+ *
176
+ * The identifier of the provider that signed the transaction.
177
+ *
178
+ */
179
+ export type SignedBy = string;
180
+ /**
181
+ *
182
+ * The party that signed the transaction.
183
+ *
184
+ */
185
+ export type Party = string;
186
+ /**
187
+ *
188
+ * Payload for the TxChangedSignedEvent.
189
+ *
190
+ */
191
+ export interface TxChangedSignedPayload {
192
+ signature: Signature;
193
+ signedBy: SignedBy;
194
+ party: Party;
195
+ }
196
+ /**
197
+ *
198
+ * Event emitted when a transaction has been signed.
199
+ *
200
+ */
201
+ export interface TxChangedSignedEvent {
202
+ status: StatusSigned;
203
+ commandId: CommandId;
204
+ payload: TxChangedSignedPayload;
205
+ }
206
+ /**
207
+ *
208
+ * The status of the transaction.
209
+ *
210
+ */
211
+ export type StatusExecuted = 'executed';
212
+ /**
213
+ *
214
+ * The update ID corresponding to the transaction.
215
+ *
216
+ */
217
+ export type UpdateId = string;
218
+ export type CompletionOffset = number;
219
+ /**
220
+ *
221
+ * Payload for the TxChangedExecutedEvent.
222
+ *
223
+ */
224
+ export interface TxChangedExecutedPayload {
225
+ updateId: UpdateId;
226
+ completionOffset: CompletionOffset;
227
+ }
228
+ /**
229
+ *
230
+ * Event emitted when a transaction is executed against the participant.
231
+ *
232
+ */
233
+ export interface TxChangedExecutedEvent {
234
+ status: StatusExecuted;
235
+ commandId: CommandId;
236
+ payload: TxChangedExecutedPayload;
237
+ }
238
+ /**
239
+ *
240
+ * The status of the transaction.
241
+ *
242
+ */
243
+ export type StatusFailed = 'failed';
244
+ /**
245
+ *
246
+ * Event emitted when a transaction has failed.
247
+ *
248
+ */
249
+ export interface TxChangedFailedEvent {
250
+ status: StatusFailed;
251
+ commandId: CommandId;
252
+ }
253
+ export interface PrepareReturnParams {
254
+ commands: JsCommands;
255
+ [k: string]: any;
256
+ }
257
+ export interface PrepareExecuteParams {
258
+ commands: JsCommands;
259
+ [k: string]: any;
260
+ }
261
+ export interface LedgerApiParams {
262
+ requestMethod: RequestMethod;
263
+ resource: Resource;
264
+ body?: Body;
265
+ [k: string]: any;
266
+ }
267
+ export interface StatusResult {
268
+ kernel: KernelInfo;
269
+ isConnected: IsConnected;
270
+ chainId?: ChainId;
271
+ [k: string]: any;
272
+ }
273
+ export interface ConnectResult {
274
+ kernel: KernelInfo;
275
+ isConnected: IsConnected;
276
+ chainId?: ChainId;
277
+ userUrl: UserUrl;
278
+ [k: string]: any;
279
+ }
280
+ export interface DarsAvailableResult {
281
+ dars: Dars;
282
+ [k: string]: any;
283
+ }
284
+ export type PrepareReturnResult = any;
285
+ export interface PrepareExecuteResult {
286
+ userUrl: UserUrl;
287
+ [k: string]: any;
288
+ }
289
+ /**
290
+ *
291
+ * Ledger Api configuration options
292
+ *
293
+ */
294
+ export interface LedgerApiResult {
295
+ response: Response;
296
+ [k: string]: any;
297
+ }
298
+ export interface OnConnectedEvent {
299
+ kernel: KernelInfo;
300
+ chainId: ChainId;
301
+ sessionToken?: SessionToken;
302
+ [k: string]: any;
303
+ }
304
+ /**
305
+ *
306
+ * Event emitted when the user's accounts change.
307
+ *
308
+ */
309
+ export type AccountsChangedEvent = Wallet[];
310
+ /**
311
+ *
312
+ * An array of accounts that the user has authorized the dapp to access..
313
+ *
314
+ */
315
+ export type RequestAccountsResult = Wallet[];
316
+ /**
317
+ *
318
+ * Event emitted when a transaction changes.
319
+ *
320
+ */
321
+ export type TxChangedEvent = TxChangedPendingEvent | TxChangedSignedEvent | TxChangedExecutedEvent | TxChangedFailedEvent;
322
+ /**
323
+ *
324
+ * Generated! Represents an alias to any of the provided schemas
325
+ *
326
+ */
327
+ export type Status = () => Promise<StatusResult>;
328
+ export type Connect = () => Promise<ConnectResult>;
329
+ export type DarsAvailable = () => Promise<DarsAvailableResult>;
330
+ export type PrepareReturn = (params: PrepareReturnParams) => Promise<PrepareReturnResult>;
331
+ export type PrepareExecute = (params: PrepareExecuteParams) => Promise<PrepareExecuteResult>;
332
+ export type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>;
333
+ export type OnConnected = () => Promise<OnConnectedEvent>;
334
+ export type OnAccountsChanged = () => Promise<AccountsChangedEvent>;
335
+ export type RequestAccounts = () => Promise<RequestAccountsResult>;
336
+ export type OnTxChanged = () => Promise<TxChangedEvent>;
337
+ //# sourceMappingURL=typings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/typings.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM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,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;AAClD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAC9D,MAAM,MAAM,aAAa,GAAG,CACxB,MAAM,EAAE,mBAAmB,KAC1B,OAAO,CAAC,mBAAmB,CAAC,CAAA;AACjC,MAAM,MAAM,cAAc,GAAG,CACzB,MAAM,EAAE,oBAAoB,KAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAClC,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;AAC7E,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACnE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAClE,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Store } from '@canton-network/core-wallet-store';
2
+ import { AuthService, AuthAware } from '@canton-network/core-wallet-auth';
3
+ import { NotificationService } from '../notification/NotificationService.js';
4
+ import { KernelInfo } from '../config/Config.js';
5
+ export declare const dapp: (kernelInfo: KernelInfo, notificationService: NotificationService, authService: AuthService, store: Store & AuthAware<Store>) => import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
6
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dapp-api/server.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAKzE,OAAO,EACH,mBAAmB,EAEtB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIhD,eAAO,MAAM,IAAI,GACb,YAAY,UAAU,EACtB,qBAAqB,mBAAmB,EACxC,aAAa,WAAW,EACxB,OAAO,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,uGAyElC,CAAA"}