@canton-network/wallet-gateway-remote 0.11.3 → 0.13.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.js +1 -1
- package/dist/auth/jwt-unsafe-auth-service.js +1 -1
- package/dist/config/Config.d.ts +6 -4
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +29 -7
- package/dist/config/Config.test.js +1 -1
- package/dist/config/ConfigUtils.d.ts +9 -5
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +11 -9
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +1 -2
- package/dist/dapp-api/rpc-gen/index.js +1 -1
- package/dist/dapp-api/rpc-gen/typings.js +1 -1
- package/dist/dapp-api/server.js +1 -1
- package/dist/dapp-api/server.test.js +4 -4
- package/dist/example-config.d.ts +0 -2
- package/dist/example-config.d.ts.map +1 -1
- package/dist/example-config.js +1 -3
- package/dist/index.js +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +20 -33
- package/dist/ledger/party-allocation-service.js +1 -1
- package/dist/ledger/party-allocation-service.test.js +1 -1
- package/dist/ledger/wallet-sync-service.js +1 -1
- package/dist/ledger/wallet-sync-service.test.js +1 -1
- package/dist/middleware/jsonRpcHandler.js +1 -1
- package/dist/middleware/jwtAuth.d.ts.map +1 -1
- package/dist/middleware/jwtAuth.js +1 -2
- package/dist/middleware/rateLimit.js +1 -1
- package/dist/middleware/sessionHandler.d.ts.map +1 -1
- package/dist/middleware/sessionHandler.js +1 -2
- package/dist/notification/NotificationService.d.ts.map +1 -1
- package/dist/notification/NotificationService.js +1 -1
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +130 -5
- package/dist/user-api/rpc-gen/index.js +1 -1
- package/dist/user-api/rpc-gen/typings.js +1 -1
- package/dist/user-api/server.js +1 -1
- package/dist/user-api/server.test.js +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -2
- package/dist/version.js +1 -1
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/{404-DOEElx02.js → 404-KW2rktHv.js} +1 -1
- package/dist/web/frontend/assets/{approve-D15QJVvX.js → approve-GI8lkQ67.js} +1 -1
- package/dist/web/frontend/assets/callback-CiI5c-jK.js +1 -0
- package/dist/web/frontend/assets/index-Beqy7PIH.js +1011 -0
- package/dist/web/frontend/assets/login-OllsdROi.js +186 -0
- package/dist/web/frontend/assets/{settings-DgcggvCV.js → settings-BSmtobKY.js} +1 -1
- package/dist/web/frontend/assets/{state-DcvVyWZr.js → state-Beq2Oijy.js} +1 -1
- package/dist/web/frontend/assets/{transactions-C-931My3.js → transactions-unooQfO1.js} +1 -1
- package/dist/web/frontend/assets/{wallets-Cf2MBnzs.js → wallets-C43SSsO8.js} +2 -2
- 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/dist/web/server.js +1 -1
- package/package.json +18 -17
- package/dist/web/frontend/assets/callback-D0wYdJFr.js +0 -1
- package/dist/web/frontend/assets/index-EdAN1_qe.js +0 -1011
- package/dist/web/frontend/assets/login-CqVgGYZA.js +0 -186
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// Disabled unused vars rule to allow for future implementations
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -103,13 +103,84 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
103
103
|
const { signature } = await driver.signTransaction({
|
|
104
104
|
tx: '',
|
|
105
105
|
txHash: hash,
|
|
106
|
-
|
|
106
|
+
keyIdentifier: {
|
|
107
|
+
publicKey: key.publicKey,
|
|
108
|
+
},
|
|
107
109
|
});
|
|
108
110
|
return signature;
|
|
109
111
|
});
|
|
110
112
|
publicKey = key.publicKey;
|
|
111
113
|
break;
|
|
112
114
|
}
|
|
115
|
+
case SigningProvider.BLOCKDAEMON: {
|
|
116
|
+
if (signingProviderContext) {
|
|
117
|
+
walletStatus = 'initialized';
|
|
118
|
+
const { signature, status } = await driver.getTransaction({
|
|
119
|
+
userId,
|
|
120
|
+
txId: signingProviderContext.externalTxId,
|
|
121
|
+
});
|
|
122
|
+
if (!['pending', 'signed'].includes(status)) {
|
|
123
|
+
await store.removeWallet(signingProviderContext.partyId);
|
|
124
|
+
}
|
|
125
|
+
if (signature) {
|
|
126
|
+
await partyAllocator.allocatePartyWithExistingWallet(signingProviderContext.namespace, signingProviderContext.topologyTransactions.split(', '), signature, userId);
|
|
127
|
+
walletStatus = 'allocated';
|
|
128
|
+
}
|
|
129
|
+
party = {
|
|
130
|
+
partyId: signingProviderContext.partyId,
|
|
131
|
+
namespace: signingProviderContext.namespace,
|
|
132
|
+
hint: partyHint,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const key = await driver.createKey({
|
|
137
|
+
name: partyHint,
|
|
138
|
+
});
|
|
139
|
+
if ('error' in key) {
|
|
140
|
+
throw new Error(`Failed to create key: ${key.error_description}`);
|
|
141
|
+
}
|
|
142
|
+
const namespace = partyAllocator.createFingerprintFromKey(key.publicKey);
|
|
143
|
+
const transactions = await partyAllocator.generateTopologyTransactions(partyHint, key.publicKey);
|
|
144
|
+
topologyTransactions =
|
|
145
|
+
transactions.topologyTransactions ?? [];
|
|
146
|
+
topologyTransactions.forEach((tx, idx) => {
|
|
147
|
+
logger.info(`BLOCKDAEMON: topologyTransaction[${idx}] length=${tx.length} preview=${tx.substring(0, 100)}...`);
|
|
148
|
+
});
|
|
149
|
+
let partyId = '';
|
|
150
|
+
const internalTxId = crypto
|
|
151
|
+
.randomUUID()
|
|
152
|
+
.replace(/-/g, '')
|
|
153
|
+
.substring(0, 16);
|
|
154
|
+
const txPayload = JSON.stringify(topologyTransactions);
|
|
155
|
+
const { status, txId: id } = await driver.signTransaction({
|
|
156
|
+
tx: Buffer.from(txPayload).toString('base64'),
|
|
157
|
+
txHash: transactions.multiHash,
|
|
158
|
+
keyIdentifier: {
|
|
159
|
+
publicKey: key.publicKey,
|
|
160
|
+
},
|
|
161
|
+
internalTxId,
|
|
162
|
+
});
|
|
163
|
+
if (status === 'signed') {
|
|
164
|
+
const { signature } = await driver.getTransaction({
|
|
165
|
+
userId,
|
|
166
|
+
txId: id,
|
|
167
|
+
});
|
|
168
|
+
partyId =
|
|
169
|
+
await partyAllocator.allocatePartyWithExistingWallet(namespace, transactions.topologyTransactions ?? [], signature, userId);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
txId = id;
|
|
173
|
+
walletStatus = 'initialized';
|
|
174
|
+
}
|
|
175
|
+
party = {
|
|
176
|
+
partyId,
|
|
177
|
+
namespace,
|
|
178
|
+
hint: partyHint,
|
|
179
|
+
};
|
|
180
|
+
publicKey = key.publicKey;
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
113
184
|
case SigningProvider.FIREBLOCKS: {
|
|
114
185
|
const keys = await driver.getKeys();
|
|
115
186
|
const key = keys?.keys?.find((k) => k.name === 'Canton Party');
|
|
@@ -144,7 +215,9 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
144
215
|
const { status, txId: id } = await driver.signTransaction({
|
|
145
216
|
tx: '',
|
|
146
217
|
txHash: Buffer.from(transactions.multiHash, 'base64').toString('hex'),
|
|
147
|
-
|
|
218
|
+
keyIdentifier: {
|
|
219
|
+
publicKey: key.publicKey,
|
|
220
|
+
},
|
|
148
221
|
});
|
|
149
222
|
if (status === 'signed') {
|
|
150
223
|
const { signature } = await driver.getTransaction({
|
|
@@ -239,7 +312,9 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
239
312
|
const signature = await driver.signTransaction({
|
|
240
313
|
tx: preparedTransaction,
|
|
241
314
|
txHash: preparedTransactionHash,
|
|
242
|
-
|
|
315
|
+
keyIdentifier: {
|
|
316
|
+
publicKey: wallet.publicKey,
|
|
317
|
+
},
|
|
243
318
|
});
|
|
244
319
|
if (!signature.signature) {
|
|
245
320
|
throw new Error('Failed to sign transaction: ' +
|
|
@@ -267,6 +342,55 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
267
342
|
partyId: wallet.partyId,
|
|
268
343
|
};
|
|
269
344
|
}
|
|
345
|
+
case SigningProvider.BLOCKDAEMON: {
|
|
346
|
+
const internalTxId = crypto
|
|
347
|
+
.randomUUID()
|
|
348
|
+
.replace(/-/g, '')
|
|
349
|
+
.substring(0, 16);
|
|
350
|
+
let result = await driver.signTransaction({
|
|
351
|
+
tx: preparedTransaction,
|
|
352
|
+
txHash: preparedTransactionHash,
|
|
353
|
+
keyIdentifier: {
|
|
354
|
+
publicKey: wallet.publicKey,
|
|
355
|
+
},
|
|
356
|
+
internalTxId,
|
|
357
|
+
});
|
|
358
|
+
if (result.status === 'pending' && result.txId) {
|
|
359
|
+
for (let i = 0; i < 60; i++) {
|
|
360
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
361
|
+
result = await driver.getTransaction({
|
|
362
|
+
userId,
|
|
363
|
+
txId: result.txId,
|
|
364
|
+
});
|
|
365
|
+
if (result.status === 'signed')
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (!result.signature) {
|
|
370
|
+
throw new Error('Signing timed out or failed: ' +
|
|
371
|
+
JSON.stringify(result));
|
|
372
|
+
}
|
|
373
|
+
const existingTx = await store.getTransaction(commandId);
|
|
374
|
+
const now = new Date();
|
|
375
|
+
const signedTx = {
|
|
376
|
+
commandId,
|
|
377
|
+
status: 'signed',
|
|
378
|
+
preparedTransaction,
|
|
379
|
+
preparedTransactionHash,
|
|
380
|
+
origin: existingTx?.origin ?? null,
|
|
381
|
+
...(existingTx?.createdAt && {
|
|
382
|
+
createdAt: existingTx.createdAt,
|
|
383
|
+
}),
|
|
384
|
+
signedAt: now,
|
|
385
|
+
};
|
|
386
|
+
store.setTransaction(signedTx);
|
|
387
|
+
notifier.emit('txChanged', signedTx);
|
|
388
|
+
return {
|
|
389
|
+
signature: result.signature,
|
|
390
|
+
signedBy: wallet.namespace,
|
|
391
|
+
partyId: wallet.partyId,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
270
394
|
default:
|
|
271
395
|
throw new Error(`Unsupported signing provider: ${wallet.signingProviderId}`);
|
|
272
396
|
}
|
|
@@ -327,7 +451,8 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
327
451
|
throw error;
|
|
328
452
|
}
|
|
329
453
|
}
|
|
330
|
-
case SigningProvider.WALLET_KERNEL:
|
|
454
|
+
case SigningProvider.WALLET_KERNEL:
|
|
455
|
+
case SigningProvider.BLOCKDAEMON: {
|
|
331
456
|
const result = await ledgerClient.postWithRetry('/v2/interactive-submission/execute', {
|
|
332
457
|
userId,
|
|
333
458
|
preparedTransaction: transaction.preparedTransaction,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
function buildController(methods) {
|
|
4
4
|
return {
|
package/dist/user-api/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { jsonRpcHandler } from '../middleware/jsonRpcHandler.js';
|
|
4
4
|
import { userController } from './controller.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { expect, test } from '@jest/globals';
|
|
4
4
|
import cors from 'cors';
|
|
@@ -6,7 +6,7 @@ import express from 'express';
|
|
|
6
6
|
import request from 'supertest';
|
|
7
7
|
import { user } from './server.js';
|
|
8
8
|
import { StoreInternal } from '@canton-network/core-wallet-store-inmemory';
|
|
9
|
-
import { ConfigUtils,
|
|
9
|
+
import { ConfigUtils, deriveUrls } from '../config/ConfigUtils.js';
|
|
10
10
|
import { NotificationService } from '../notification/NotificationService.js';
|
|
11
11
|
import { pino } from 'pino';
|
|
12
12
|
import { sink } from 'pino-test';
|
|
@@ -19,8 +19,8 @@ test('call listNetworks rpc', async () => {
|
|
|
19
19
|
const app = express();
|
|
20
20
|
app.use(cors());
|
|
21
21
|
app.use(express.json());
|
|
22
|
-
const {
|
|
23
|
-
const response = await request(user('/api/v0/user', app, pino(sink()), config.kernel,
|
|
22
|
+
const { publicUrl } = deriveUrls(config);
|
|
23
|
+
const response = await request(user('/api/v0/user', app, pino(sink()), config.kernel, publicUrl, notificationService, drivers, store))
|
|
24
24
|
.post('/api/v0/user')
|
|
25
25
|
.send({ jsonrpc: '2.0', id: 0, method: 'listNetworks', params: [] })
|
|
26
26
|
.set('Accept', 'application/json');
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,EACR,kBAAkB,EAClB,4BAA4B,EAC/B,MAAM,+BAA+B,CAAA;AAEtC,KAAK,aAAa,GAAG;IACjB,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,wBAAsB,aAAa,CAC/B,YAAY,EAAE,YAAY,GAC3B,OAAO,CAAC,aAAa,CAAC,CAaxB;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,4BAA4B,CAAC,EAAE,4BAA4B,CAAA;IAC3D,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,aAAa,GACtB,WAAW,CAAC,oCAAoC,CAAC,CAuBnD"}
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
// Disabled unused vars rule to allow for future implementations
|
|
4
3
|
import { v4 } from 'uuid';
|
|
5
4
|
export async function networkStatus(ledgerClient) {
|
|
6
5
|
try {
|
package/dist/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel - Not found</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/404-
|
|
7
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
6
|
+
<script type="module" crossorigin src="/assets/404-KW2rktHv.js"></script>
|
|
7
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Beqy7PIH.js">
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CgbJtyud.css">
|
|
9
9
|
</head>
|
|
10
10
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel - Approve Write Request</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/approve-
|
|
7
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/state-
|
|
6
|
+
<script type="module" crossorigin src="/assets/approve-GI8lkQ67.js"></script>
|
|
7
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Beqy7PIH.js">
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/state-Beq2Oijy.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/decode-CLJkuAIr.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-CgbJtyud.css">
|
|
11
11
|
</head>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as k,a as z,x as O,t as P}from"./index-
|
|
1
|
+
import{i as k,a as z,x as O,t as P}from"./index-Beqy7PIH.js";var C=Object.create,s=Object.defineProperty,E=Object.getOwnPropertyDescriptor,x=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),h=r=>{throw TypeError(r)},I=(r,e,a)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,j=(r,e)=>s(r,"name",{value:e,configurable:!0}),A=r=>[,,,C(r?.[x("metadata")]??null)],D=["class","method","getter","setter","accessor","field","value","get","set"],w=r=>r!==void 0&&typeof r!="function"?h("Function expected"):r,F=(r,e,a,n,t)=>({kind:D[r],name:e,metadata:n,addInitializer:o=>a._?h("Already initialized"):t.push(w(o||null))}),M=(r,e)=>I(e,x("metadata"),r[3]),N=(r,e,a,n)=>{for(var t=0,o=r[e>>1],i=o&&o.length;t<i;t++)o[t].call(a);return n},T=(r,e,a,n,t,o)=>{var i,u,f,l=e&7,b=!1,m=0,g=r[m]||(r[m]=[]),c=l&&(t=t.prototype,l<5&&(l>3||!b)&&E(t,a));j(t,a);for(var _=n.length-1;_>=0;_--)f=F(l,a,u={},r[3],g),i=(0,n[_])(t,f),u._=1,w(i)&&(t=i);return M(r,t),c&&s(t,a,c),b?l^4?o:c:t},y,v,S;y=[P("user-ui-404")];const p=class p extends(S=k){connectedCallback(){super.connectedCallback()}render(){return O`
|
|
2
2
|
<div class="wrapper">
|
|
3
3
|
<not-found href="/"></not-found>
|
|
4
4
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as J,s as K,
|
|
1
|
+
import{c as J,s as K,y as ge,E as k,x as v,a as me,i as ue,t as _e}from"./index-Beqy7PIH.js";import{r as g}from"./state-Beq2Oijy.js";import{p as ve}from"./decode-CLJkuAIr.js";var fe=Object.create,z=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Y=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),x=t=>{throw TypeError(t)},be=(t,e,a)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,Q=(t,e)=>z(t,"name",{value:e,configurable:!0}),we=t=>[,,,fe(t?.[Y("metadata")]??null)],Z=["class","method","getter","setter","accessor","field","value","get","set"],w=t=>t!==void 0&&typeof t!="function"?x("Function expected"):t,ke=(t,e,a,n,o)=>({kind:Z[t],name:e,metadata:n,addInitializer:d=>a._?x("Already initialized"):o.push(w(d||null))}),ye=(t,e)=>be(e,Y("metadata"),t[3]),i=(t,e,a,n)=>{for(var o=0,d=t[e>>1],f=d&&d.length;o<f;o++)e&1?d[o].call(a):n=d[o].call(a,n);return n},l=(t,e,a,n,o,d)=>{var f,p,F,b,y,r=e&7,A=!!(e&8),_=!!(e&16),I=r>3?t.length+1:r?A?1:2:0,G=Z[r+5],L=r>3&&(t[I-1]=[]),pe=t[I]||(t[I]=[]),u=r&&(!_&&!A&&(o=o.prototype),r<5&&(r>3||!_)&&xe(r<4?o:{get[a](){return V(this,d)},set[a](h){return X(this,d,h)}},a));r?_&&r<4&&Q(d,(r>2?"set ":r>1?"get ":"")+a):Q(o,a);for(var $=n.length-1;$>=0;$--)b=ke(r,a,F={},t[3],pe),r&&(b.static=A,b.private=_,y=b.access={has:_?h=>Ae(o,h):h=>a in h},r^3&&(y.get=_?h=>(r^1?V:Ie)(h,o,r^4?d:u.get):h=>h[a]),r>2&&(y.set=_?(h,T)=>X(h,o,T,r^4?d:u.set):(h,T)=>h[a]=T)),p=(0,n[$])(r?r<4?_?d:u[G]:r>4?void 0:{get:u.get,set:u.set}:o,b),F._=1,r^4||p===void 0?w(p)&&(r>4?L.unshift(p):r?_?d=p:u[G]=p:o=p):typeof p!="object"||p===null?x("Object expected"):(w(f=p.get)&&(u.get=f),w(f=p.set)&&(u.set=f),w(f=p.init)&&L.unshift(f));return r||ye(t,o),u&&z(o,a,u),_?r^4?d:u:o},M=(t,e,a)=>e.has(t)||x("Cannot "+a),Ae=(t,e)=>Object(e)!==e?x('Cannot use the "in" operator on this value'):t.has(e),V=(t,e,a)=>(M(t,e,"read from private field"),a?a.call(t):e.get(t)),m=(t,e,a)=>e.has(t)?x("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),X=(t,e,a,n)=>(M(t,e,"write to private field"),n?n.call(t,a):e.set(t,a),a),Ie=(t,e,a)=>(M(t,e,"access private method"),a),j,ee,te,ae,se,re,ie,oe,ne,de,ce,he,P,le,s,S,W,C,N,E,H,O,q,U,D,R,B;le=[_e("user-ui-approve")];class c extends(P=ue,he=[g()],ce=[g()],de=[g()],ne=[g()],oe=[g()],ie=[g()],re=[g()],se=[g()],ae=[g()],te=[g()],ee=[g()],j=[g()],P){constructor(){super(...arguments),m(this,S,i(s,8,this,!1)),i(s,11,this),m(this,W,i(s,12,this,"")),i(s,15,this),m(this,C,i(s,16,this,"")),i(s,19,this),m(this,N,i(s,20,this,"")),i(s,23,this),m(this,E,i(s,24,this,"")),i(s,27,this),m(this,H,i(s,28,this,null)),i(s,31,this),m(this,O,i(s,32,this,"")),i(s,35,this),m(this,q,i(s,36,this,null)),i(s,39,this),m(this,U,i(s,40,this,null)),i(s,43,this),m(this,D,i(s,44,this,null)),i(s,47,this),m(this,R,i(s,48,this,null)),i(s,51,this),m(this,B,i(s,52,this,null)),i(s,55,this)}connectedCallback(){super.connectedCallback();const e=new URL(window.location.href);this.commandId=e.searchParams.get("commandId")||"",this.updateState()}async updateState(){const e=await J(K.accessToken.get());e.request("getTransaction",{commandId:this.commandId}).then(a=>{this.txHash=a.preparedTransactionHash,this.tx=a.preparedTransaction,this.status=a.status,this.createdAt=a.createdAt||null,this.signedAt=a.signedAt||null,this.origin=a.origin||null;try{this.txParsed=ve(this.tx)}catch(n){console.error("Error parsing prepared transaction:",n),this.txParsed=null}}),e.request("listWallets",[]).then(a=>{this.partyId=a.find(n=>n.primary===!0)?.partyId||""})}async handleExecute(){this.loading=!0,this.message="Executing transaction...",this.messageType="info";try{const e={commandId:this.commandId,partyId:this.partyId,preparedTransactionHash:this.txHash,preparedTransaction:this.tx},a=await J(K.accessToken.get()),{signature:n,signedBy:o}=await a.request("sign",e),d={signature:n,signedBy:o,commandId:this.commandId,partyId:this.partyId};await a.request("execute",d),this.message="Transaction executed successfully ✅",this.messageType="info",window.opener&&setTimeout(()=>window.close(),1e3)}catch(e){console.error(e),this.message=null,this.messageType=null,ge(e,{message:"Error executing transaction"})}finally{this.loading=!1}}render(){return v`
|
|
2
2
|
<div class="card">
|
|
3
3
|
<h1>Pending Transaction Request</h1>
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as y,s as u,b as O,r as C,x as P,t as I}from"./index-Beqy7PIH.js";var L=Object.create,h=Object.defineProperty,z=Object.getOwnPropertyDescriptor,w=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),b=e=>{throw TypeError(e)},D=(e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>h(e,"name",{value:t,configurable:!0}),T=e=>[,,,L(e?.[w("metadata")]??null)],j=["class","method","getter","setter","accessor","field","value","get","set"],k=e=>e!==void 0&&typeof e!="function"?b("Function expected"):e,E=(e,t,r,o,a)=>({kind:j[e],name:t,metadata:o,addInitializer:c=>r._?b("Already initialized"):a.push(k(c||null))}),U=(e,t)=>D(t,w("metadata"),e[3]),N=(e,t,r,o)=>{for(var a=0,c=e[t>>1],i=c&&c.length;a<i;a++)c[a].call(r);return o},F=(e,t,r,o,a,c)=>{var i,s,l,n=t&7,d=!1,g=0,x=e[g]||(e[g]=[]),_=n&&(a=a.prototype,n<5&&(n>3||!d)&&z(a,r));R(a,r);for(var p=o.length-1;p>=0;p--)l=E(n,r,s={},e[3],x),i=(0,o[p])(a,l),s._=1,k(i)&&(a=i);return U(e,a),_&&h(a,r,_),d?n^4?c:_:a},m,v,S;m=[I("login-callback")];class f extends(S=y){connectedCallback(){super.connectedCallback(),this.handleRedirect()}async handleRedirect(){const t=new URL(window.location.href),r=t.searchParams.get("code"),o=t.searchParams.get("state");if(!r&&!o){console.error("missing state and code");return}if(r&&o){const a=JSON.parse(atob(o)),s=(await(await fetch(a.configUrl)).json()).token_endpoint,n=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:r,redirect_uri:window.location.origin+"/callback/",client_id:a.clientId,audience:a.audience})})).json();if(n.access_token){const d=JSON.parse(atob(n.access_token.split(".")[1]));u.expirationDate.set(new Date(d.exp*1e3).toISOString()),u.accessToken.set(n.access_token),O(n.access_token,u.networkId.get()||"").then(()=>{C()})}}}render(){return P`<h2>Logged in!</h2>`}}v=T(S);f=F(v,0,"LoginCallback",m,f);N(v,1,f);
|