@canton-network/wallet-gateway-remote 1.10.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/ledger/transaction-service.d.ts +2 -8
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +51 -474
- package/dist/ledger/transaction-service.test.js +26 -18
- 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 +5 -6
- package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +1 -1
- package/dist/web/frontend/activities/index.html +2 -2
- package/dist/web/frontend/approve/index.html +2 -2
- package/dist/web/frontend/assets/{activities-CuMcxQVi.js → activities-B5-XCCZC.js} +1 -1
- package/dist/web/frontend/assets/addParty-BQLGvzJS.js +13 -0
- package/dist/web/frontend/assets/{approve-4Xp3Ck4z.js → approve-CyDHnjOG.js} +1 -1
- 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/index-Cvcr2Fng.js +2 -0
- package/dist/web/frontend/parties/add/index.html +2 -1
- package/dist/web/frontend/parties/edit/index.html +17 -0
- package/package.json +27 -28
- package/dist/web/frontend/assets/addParty-SChbVsEF.js +0 -43
- package/dist/web/frontend/assets/index-BjhQnXf1.js +0 -2
|
@@ -53,6 +53,11 @@ const executeParams = {
|
|
|
53
53
|
signature: 'signature',
|
|
54
54
|
signedBy: wallet.namespace,
|
|
55
55
|
};
|
|
56
|
+
const postWithRetry = vi.fn().mockResolvedValue({ updateId: 'ledger-update-1' });
|
|
57
|
+
const ledgerClient = {
|
|
58
|
+
postWithRetry,
|
|
59
|
+
getSynchronizerId: vi.fn(),
|
|
60
|
+
};
|
|
56
61
|
const network = {
|
|
57
62
|
id: 'network1',
|
|
58
63
|
name: 'testnet',
|
|
@@ -89,6 +94,9 @@ function createStore(transaction = pendingTransaction) {
|
|
|
89
94
|
function createService(store, drivers, notifier, logger) {
|
|
90
95
|
return new TransactionService(store, logger, drivers, notifier, 'HASHING_SCHEME_VERSION_V3');
|
|
91
96
|
}
|
|
97
|
+
vi.stubGlobal('crypto', {
|
|
98
|
+
randomUUID: vi.fn().mockReturnValue('internal-tx-uuid'),
|
|
99
|
+
});
|
|
92
100
|
describe('TransactionService', () => {
|
|
93
101
|
let logger;
|
|
94
102
|
let notifier;
|
|
@@ -106,7 +114,13 @@ describe('TransactionService', () => {
|
|
|
106
114
|
it('returns a signed result and persists signed status', async () => {
|
|
107
115
|
const store = createStore();
|
|
108
116
|
const service = createService(store, {
|
|
109
|
-
[SigningProvider.PARTICIPANT]: createDriver({
|
|
117
|
+
[SigningProvider.PARTICIPANT]: createDriver({
|
|
118
|
+
signTransaction: vi.fn().mockResolvedValue({
|
|
119
|
+
status: 'signed',
|
|
120
|
+
signature: 'none',
|
|
121
|
+
signedBy: 'namespace',
|
|
122
|
+
}),
|
|
123
|
+
}),
|
|
110
124
|
}, notifier, logger);
|
|
111
125
|
const participantWallet = walletWithProvider(SigningProvider.PARTICIPANT);
|
|
112
126
|
const result = await service.sign(authContext, participantWallet, signParams);
|
|
@@ -117,7 +131,7 @@ describe('TransactionService', () => {
|
|
|
117
131
|
partyId: wallet.partyId,
|
|
118
132
|
});
|
|
119
133
|
expect(store.getTransaction).toHaveBeenCalledWith(pendingTransaction.id);
|
|
120
|
-
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date));
|
|
134
|
+
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date), undefined);
|
|
121
135
|
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({
|
|
122
136
|
id: pendingTransaction.id,
|
|
123
137
|
status: 'signed',
|
|
@@ -126,9 +140,10 @@ describe('TransactionService', () => {
|
|
|
126
140
|
});
|
|
127
141
|
describe('wallet-kernel', () => {
|
|
128
142
|
it('signs the transaction and persists the signed state', async () => {
|
|
129
|
-
const signTransaction = vi
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
const signTransaction = vi.fn().mockResolvedValue({
|
|
144
|
+
status: 'signed',
|
|
145
|
+
signature: 'kernel-signature',
|
|
146
|
+
});
|
|
132
147
|
const store = createStore();
|
|
133
148
|
const service = createService(store, {
|
|
134
149
|
[SigningProvider.WALLET_KERNEL]: createDriver({
|
|
@@ -141,7 +156,7 @@ describe('TransactionService', () => {
|
|
|
141
156
|
txHash: pendingTransaction.preparedTransactionHash,
|
|
142
157
|
keyIdentifier: { publicKey: wallet.publicKey },
|
|
143
158
|
});
|
|
144
|
-
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date));
|
|
159
|
+
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date), undefined);
|
|
145
160
|
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({
|
|
146
161
|
id: pendingTransaction.id,
|
|
147
162
|
status: 'signed',
|
|
@@ -239,11 +254,11 @@ describe('TransactionService', () => {
|
|
|
239
254
|
});
|
|
240
255
|
describe('fireblocks', () => {
|
|
241
256
|
it('returns a base64 signature when signing completes', async () => {
|
|
242
|
-
const
|
|
257
|
+
const signature = Buffer.from('fireblocks-signature').toString('base64');
|
|
243
258
|
const signTransaction = vi.fn().mockResolvedValue({
|
|
244
259
|
status: 'signed',
|
|
245
260
|
txId: 'fb-tx-1',
|
|
246
|
-
signature
|
|
261
|
+
signature,
|
|
247
262
|
});
|
|
248
263
|
const store = createStore();
|
|
249
264
|
const service = createService(store, {
|
|
@@ -254,11 +269,11 @@ describe('TransactionService', () => {
|
|
|
254
269
|
const result = await service.sign(authContext, walletWithProvider(SigningProvider.FIREBLOCKS), signParams);
|
|
255
270
|
expect(signTransaction).toHaveBeenCalledWith(expect.objectContaining({
|
|
256
271
|
userId: authContext.userId,
|
|
257
|
-
txHash:
|
|
272
|
+
txHash: 'tx-hash',
|
|
258
273
|
}));
|
|
259
274
|
expect(result).toMatchObject({
|
|
260
275
|
status: 'signed',
|
|
261
|
-
signature
|
|
276
|
+
signature,
|
|
262
277
|
externalTxId: 'fb-tx-1',
|
|
263
278
|
});
|
|
264
279
|
});
|
|
@@ -437,7 +452,7 @@ describe('TransactionService', () => {
|
|
|
437
452
|
...pendingTransaction,
|
|
438
453
|
status,
|
|
439
454
|
};
|
|
440
|
-
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.`);
|
|
441
456
|
});
|
|
442
457
|
describe('participant', () => {
|
|
443
458
|
it('submits the prepared transaction to the ledger', async () => {
|
|
@@ -450,13 +465,6 @@ describe('TransactionService', () => {
|
|
|
450
465
|
},
|
|
451
466
|
};
|
|
452
467
|
const store = createStore(transaction);
|
|
453
|
-
const postWithRetry = vi
|
|
454
|
-
.fn()
|
|
455
|
-
.mockResolvedValue({ updateId: 'ledger-update-1' });
|
|
456
|
-
const ledgerClient = {
|
|
457
|
-
postWithRetry,
|
|
458
|
-
getSynchronizerId: vi.fn(),
|
|
459
|
-
};
|
|
460
468
|
const service = createService(store, {}, notifier, logger);
|
|
461
469
|
const result = await service.execute(authContext.userId, participantWallet, transaction, executeParams, ledgerClient, network);
|
|
462
470
|
expect(postWithRetry).toHaveBeenCalledWith('/v2/commands/submit-and-wait', expect.objectContaining({
|
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,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;
|
|
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"}
|
|
@@ -22,14 +22,13 @@ export class FireblocksWalletAllocator {
|
|
|
22
22
|
const key = keys?.keys?.find((k) => k.name === keyName);
|
|
23
23
|
if (!key)
|
|
24
24
|
throw new Error('Fireblocks key not found');
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const transactions = await this.partyAllocator.generateTopologyTransactions(partyHint, formattedPublicKey);
|
|
25
|
+
const namespace = this.partyAllocator.createFingerprintFromKey(key.publicKey);
|
|
26
|
+
const transactions = await this.partyAllocator.generateTopologyTransactions(partyHint, key.publicKey);
|
|
28
27
|
const topologyTransactions = transactions.topologyTransactions ?? [];
|
|
29
28
|
const { status, txId } = await driver
|
|
30
29
|
.signTransaction({
|
|
31
30
|
tx: '',
|
|
32
|
-
txHash:
|
|
31
|
+
txHash: transactions.multiHash,
|
|
33
32
|
keyIdentifier: {
|
|
34
33
|
publicKey: key.publicKey,
|
|
35
34
|
},
|
|
@@ -60,7 +59,7 @@ export class FireblocksWalletAllocator {
|
|
|
60
59
|
if (!signature) {
|
|
61
60
|
throw new Error('Transaction signed but no signature found in result');
|
|
62
61
|
}
|
|
63
|
-
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(namespace, topologyTransactions,
|
|
62
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(namespace, topologyTransactions, signature, userId);
|
|
64
63
|
wallet = {
|
|
65
64
|
...walletBase,
|
|
66
65
|
partyId,
|
|
@@ -108,7 +107,7 @@ export class FireblocksWalletAllocator {
|
|
|
108
107
|
if (!signature) {
|
|
109
108
|
throw new Error('Transaction signed but no signature found in result');
|
|
110
109
|
}
|
|
111
|
-
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(existingWallet.namespace, existingWallet.topologyTransactions.split(', '),
|
|
110
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(existingWallet.namespace, existingWallet.topologyTransactions.split(', '), signature, userId);
|
|
112
111
|
walletUpdate = {
|
|
113
112
|
...walletUpdate,
|
|
114
113
|
partyId,
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wallet Gateway - Activities</title>
|
|
7
|
-
<script type="module" crossorigin src="../assets/activities-
|
|
7
|
+
<script type="module" crossorigin src="../assets/activities-B5-XCCZC.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="../assets/index-BhzcMGYw.js">
|
|
9
|
-
<link rel="modulepreload" crossorigin href="../assets/index-
|
|
9
|
+
<link rel="modulepreload" crossorigin href="../assets/index-Cvcr2Fng.js">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<user-app>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wallet Gateway - Activity detail</title>
|
|
7
|
-
<script type="module" crossorigin src="../assets/approve-
|
|
7
|
+
<script type="module" crossorigin src="../assets/approve-CyDHnjOG.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="../assets/index-BhzcMGYw.js">
|
|
9
|
-
<link rel="modulepreload" crossorigin href="../assets/index-
|
|
9
|
+
<link rel="modulepreload" crossorigin href="../assets/index-Cvcr2Fng.js">
|
|
10
10
|
</head>
|
|
11
11
|
|
|
12
12
|
<body>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,b as _,V as Y,s as Z,d as j,c as tt,a as at,f as et,v as N,i as it,t as st}from"./index-BhzcMGYw.js";import{p as rt}from"./index-
|
|
1
|
+
import{r as C,b as _,V as Y,s as Z,d as j,c as tt,a as at,f as et,v as N,i as it,t as st}from"./index-BhzcMGYw.js";import{p as rt}from"./index-Cvcr2Fng.js";var nt=Object.create,I=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,R=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),v=a=>{throw TypeError(a)},ct=(a,t,e)=>t in a?I(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,F=(a,t)=>I(a,"name",{value:t,configurable:!0}),dt=a=>[,,,nt(a?.[R("metadata")]??null)],V=["class","method","getter","setter","accessor","field","value","get","set"],m=a=>a!==void 0&&typeof a!="function"?v("Function expected"):a,lt=(a,t,e,o,s)=>({kind:V[a],name:t,metadata:o,addInitializer:r=>e._?v("Already initialized"):s.push(m(r||null))}),pt=(a,t)=>ct(t,R("metadata"),a[3]),p=(a,t,e,o)=>{for(var s=0,r=a[t>>1],h=r&&r.length;s<h;s++)t&1?r[s].call(e):o=r[s].call(e,o);return o},f=(a,t,e,o,s,r)=>{var h,d,x,w,T,i=t&7,$=!!(t&8),u=!!(t&16),P=i>3?a.length+1:i?$?1:2:0,E=V[i+5],D=i>3&&(a[P-1]=[]),X=a[P]||(a[P]=[]),l=i&&(!u&&!$&&(s=s.prototype),i<5&&(i>3||!u)&&ot(i<4?s:{get[e](){return H(this,r)},set[e](c){return L(this,r,c)}},e));i?u&&i<4&&F(r,(i>2?"set ":i>1?"get ":"")+e):F(s,e);for(var b=o.length-1;b>=0;b--)w=lt(i,e,x={},a[3],X),i&&(w.static=$,w.private=u,T=w.access={has:u?c=>ht(s,c):c=>e in c},i^3&&(T.get=u?c=>(i^1?H:ut)(c,s,i^4?r:l.get):c=>c[e]),i>2&&(T.set=u?(c,k)=>L(c,s,k,i^4?r:l.set):(c,k)=>c[e]=k)),d=(0,o[b])(i?i<4?u?r:l[E]:i>4?void 0:{get:l.get,set:l.set}:s,w),x._=1,i^4||d===void 0?m(d)&&(i>4?D.unshift(d):i?u?r=d:l[E]=d:s=d):typeof d!="object"||d===null?v("Object expected"):(m(h=d.get)&&(l.get=h),m(h=d.set)&&(l.set=h),m(h=d.init)&&D.unshift(h));return i||pt(a,s),l&&I(s,e,l),u?i^4?r:l:s},z=(a,t,e)=>t.has(a)||v("Cannot "+e),ht=(a,t)=>Object(t)!==t?v('Cannot use the "in" operator on this value'):a.has(t),H=(a,t,e)=>(z(a,t,"read from private field"),e?e.call(a):t.get(a)),y=(a,t,e)=>t.has(a)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e),L=(a,t,e,o)=>(z(a,t,"write to private field"),o?o.call(a,e):t.set(a,e),e),ut=(a,t,e)=>(z(a,t,"access private method"),e),q,G,B,J,K,S,Q,n,A,M,O,U,W;Q=[st("user-ui-activities")];class g extends(S=N,K=[C()],J=[C()],B=[C()],G=[C()],q=[C()],S){constructor(){super(...arguments),y(this,A,p(n,8,this,[])),p(n,11,this),y(this,M,p(n,12,this,new Map)),p(n,15,this),y(this,O,p(n,16,this,!1)),p(n,19,this),y(this,U,p(n,20,this,1)),p(n,23,this),y(this,W,p(n,24,this,0)),p(n,27,this),this.pageCursors=[void 0],this.pageSize=4}render(){return _`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<h1 class="h4 fw-semibold mb-0 text-body">Activities</h1>
|
|
4
4
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{d as E,c as C,a as A,s as O,x as T,f as I,b as U,t as $}from"./index-BhzcMGYw.js";import{S as P,W as l}from"./index-D-NXyb6u.js";import{U as x}from"./common-Byz7o2Qs.js";var k=Object.create,g=Object.defineProperty,D=Object.getOwnPropertyDescriptor,h=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),b=r=>{throw TypeError(r)},K=(r,e,a)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,W=(r,e)=>g(r,"name",{value:e,configurable:!0}),z=r=>[,,,k(r?.[h("metadata")]??null)],M=["class","method","getter","setter","accessor","field","value","get","set"],S=r=>r!==void 0&&typeof r!="function"?b("Function expected"):r,N=(r,e,a,s,t)=>({kind:M[r],name:e,metadata:s,addInitializer:i=>a._?b("Already initialized"):t.push(S(i||null))}),F=(r,e)=>K(e,h("metadata"),r[3]),H=(r,e,a,s)=>{for(var t=0,i=r[e>>1],n=i&&i.length;t<n;t++)i[t].call(a);return s},R=(r,e,a,s,t,i)=>{var n,p,m,o=e&7,v=!1,y=0,L=r[y]||(r[y]=[]),d=o&&(t=t.prototype,o<5&&(o>3||!v)&&D(t,a));W(t,a);for(var c=s.length-1;c>=0;c--)m=N(o,a,p={},r[3],L),n=(0,s[c])(t,m),p._=1,S(n)&&(t=n);return F(r,t),d&&g(t,a,d),v?o^4?i:d:t},f,_,w;f=[$("user-ui-add-party")];class u extends(w=x){constructor(){super(...arguments),this.pageTitle="Create a new party"}get showToast(){return this.selectedSigningProvider===P.FIREBLOCKS}async onCreateParty(e){this.submitting=!0;try{const a=await E(),t=await(await C(await A.accessToken.get(a))).request({method:"createWallet",params:{primary:e.primary,partyHint:e.partyHint,signingProviderId:e.signingProviderId,...e.keyName&&{keyName:e.keyName}}}),n={allocated:l.WALLET_ALLOCATED,initialized:l.WALLET_INITIALIZED,removed:l.WALLET_REMOVED}[t.wallet.status];O(`${T("/parties/")}?createPartyStatus=${n}`)}catch(a){this.submitting=!1,I(a)}}get form(){return U`
|
|
2
|
+
<wg-wallet-create-form
|
|
3
|
+
.signingProviders=${this.signingProviders}
|
|
4
|
+
.keySigningProviders=${[P.FIREBLOCKS]}
|
|
5
|
+
.selectedSigningProvider=${this.selectedSigningProvider}
|
|
6
|
+
.publicKeys=${this.publicKeys}
|
|
7
|
+
.submitLabel=${"Create party"}
|
|
8
|
+
?submitting=${this.submitting}
|
|
9
|
+
?publicKeysLoading=${this.publicKeysLoading}
|
|
10
|
+
@wallet-create=${this.onCreateParty}
|
|
11
|
+
@signing-provider-change=${this.onSigningProviderChange}
|
|
12
|
+
></wg-wallet-create-form>
|
|
13
|
+
`}}_=z(w);u=R(_,0,"UserUiAddParty",f,u);H(_,1,u);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as m,e as i,l as A,g as z,u as Pt,h as ht,j as pt,k as st,n as ut,r as u,s as Dt,V as at,A as it,d as W,c as $,a as O,m as S,f as nt,b as rt,v as zt,t as Ht}from"./index-BhzcMGYw.js";import{p as Ut}from"./index-
|
|
1
|
+
import{o as m,e as i,l as A,g as z,u as Pt,h as ht,j as pt,k as st,n as ut,r as u,s as Dt,V as at,A as it,d as W,c as $,a as O,m as S,f as nt,b as rt,v as zt,t as Ht}from"./index-BhzcMGYw.js";import{p as Ut}from"./index-Cvcr2Fng.js";const _t=m({method:A("authorization_code"),audience:i(),scope:i(),clientId:i()}).meta({description:"Authorization code flow authentication configuration. This is used for browser-based application login."}),Rt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),jt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),qt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),Gt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),P=z("method",[_t,Rt,jt]);z("method",[_t,qt,Gt]);const Lt=z("type",[m({id:i(),type:A("self_signed"),issuer:i()}),m({id:i(),type:A("oauth"),issuer:i(),configUrl:i().url()})]);let ct=(function(t){return t.CanActAs="CanActAs",t.CanReadAs="CanReadAs",t.CanExecuteAs="CanExecuteAs",t})({});const Ft=m({baseUrl:Pt()}),Vt=m({id:i(),name:i(),description:i(),synchronizerId:i().includes("::").min(10).optional(),identityProviderId:i(),ledgerApi:Ft,auth:P,adminAuth:P.optional(),serviceAccountAuth:P.optional()}),Bt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),password:i(),database:i()}),Nt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),passwordEnv:i(),database:i()}),Jt=pt([Bt,Nt]);m({connection:pt([m({type:A("memory")}),m({type:A("sqlite"),database:i()}),Jt])});m({idps:st(Lt),networks:st(Vt)});var Kt=Object.create,H=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,gt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),I=t=>{throw TypeError(t)},Xt=(t,e,a)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,ot=(t,e)=>H(t,"name",{value:e,configurable:!0}),Yt=t=>[,,,Kt(t?.[gt("metadata")]??null)],mt=["class","method","getter","setter","accessor","field","value","get","set"],b=t=>t!==void 0&&typeof t!="function"?I("Function expected"):t,Zt=(t,e,a,c,o)=>({kind:mt[t],name:e,metadata:c,addInitializer:d=>a._?I("Already initialized"):o.push(b(d||null))}),te=(t,e)=>Xt(e,gt("metadata"),t[3]),n=(t,e,a,c)=>{for(var o=0,d=t[e>>1],v=d&&d.length;o<v;o++)e&1?d[o].call(a):c=d[o].call(a,c);return c},h=(t,e,a,c,o,d)=>{var v,p,y,C,k,r=e&7,x=!!(e&8),f=!!(e&16),M=r>3?t.length+1:r?x?1:2:0,tt=mt[r+5],et=r>3&&(t[M-1]=[]),Ot=t[M]||(t[M]=[]),w=r&&(!f&&!x&&(o=o.prototype),r<5&&(r>3||!f)&&Qt(r<4?o:{get[a](){return dt(this,d)},set[a](g){return lt(this,d,g)}},a));r?f&&r<4&&ot(d,(r>2?"set ":r>1?"get ":"")+a):ot(o,a);for(var E=c.length-1;E>=0;E--)C=Zt(r,a,y={},t[3],Ot),r&&(C.static=x,C.private=f,k=C.access={has:f?g=>ee(o,g):g=>a in g},r^3&&(k.get=f?g=>(r^1?dt:se)(g,o,r^4?d:w.get):g=>g[a]),r>2&&(k.set=f?(g,T)=>lt(g,o,T,r^4?d:w.set):(g,T)=>g[a]=T)),p=(0,c[E])(r?r<4?f?d:w[tt]:r>4?void 0:{get:w.get,set:w.set}:o,C),y._=1,r^4||p===void 0?b(p)&&(r>4?et.unshift(p):r?f?d=p:w[tt]=p:o=p):typeof p!="object"||p===null?I("Object expected"):(b(v=p.get)&&(w.get=v),b(v=p.set)&&(w.set=v),b(v=p.init)&&et.unshift(v));return r||te(t,o),w&&H(o,a,w),f?r^4?d:w:o},U=(t,e,a)=>e.has(t)||I("Cannot "+a),ee=(t,e)=>Object(e)!==e?I('Cannot use the "in" operator on this value'):t.has(e),dt=(t,e,a)=>(U(t,e,"read from private field"),a?a.call(t):e.get(t)),_=(t,e,a)=>e.has(t)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),lt=(t,e,a,c)=>(U(t,e,"write to private field"),c?c.call(t,a):e.set(t,a),a),se=(t,e,a)=>(U(t,e,"access private method"),a),vt,wt,At,ft,yt,It,Ct,St,bt,kt,xt,Mt,Et,Tt,Wt,D,$t,s,R,j,q,G,L,F,V,B,N,J,K,Q,X,Y,Z;$t=[Ht("user-ui-approve")];class l extends(D=zt,Wt=[u()],Tt=[u()],Et=[u()],Mt=[u()],xt=[u()],kt=[u()],bt=[u()],St=[u()],Ct=[u()],It=[u()],yt=[u()],ft=[u()],At=[u()],wt=[u()],vt=[u()],D){constructor(){super(...arguments),_(this,R,n(s,8,this,!1)),n(s,11,this),_(this,j,n(s,12,this,!1)),n(s,15,this),_(this,q,n(s,16,this,!1)),n(s,19,this),_(this,G,n(s,20,this,"")),n(s,23,this),_(this,L,n(s,24,this,"")),n(s,27,this),_(this,F,n(s,28,this,"")),n(s,31,this),_(this,V,n(s,32,this,"")),n(s,35,this),_(this,B,n(s,36,this,"")),n(s,39,this),_(this,N,n(s,40,this,null)),n(s,43,this),_(this,J,n(s,44,this,"")),n(s,47,this),_(this,K,n(s,48,this,null)),n(s,51,this),_(this,Q,n(s,52,this,null)),n(s,55,this),_(this,X,n(s,56,this,null)),n(s,59,this),_(this,Y,n(s,60,this,!0)),n(s,63,this),_(this,Z,n(s,64,this,null)),n(s,67,this)}connectedCallback(){super.connectedCallback();const e=new URL(window.location.href);this.transactionId=e.searchParams.get("transactionId")||"",this.updateState()}closeOrGoToList(){this.disabled=!0;const a=new URLSearchParams(window.location.search).has("closeafteraction");setTimeout(()=>{a&&window.opener?window.close():Dt(at(it))},2e3)}async updateState(){const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"getTransaction",params:{transactionId:this.transactionId}});this.transactionId=c.id,this.commandId=c.commandId,this.txHash=c.preparedTransactionHash,this.tx=c.preparedTransaction,this.status=c.status,this.createdAt=c.createdAt||null,this.signedAt=c.signedAt||null,this.origin=c.origin||null;try{this.txParsed=Ut(this.tx)}catch(y){console.error("Error parsing prepared transaction:",y),this.txParsed=null}const d=(await a.request({method:"listWallets",params:{}})).find(y=>y.primary===!0);this.partyId=d?.partyId||"";const v=d?.rights,p=!!(v?.includes(ct.CanActAs)||v?.includes(ct.CanExecuteAs));this.canSubmit=p,this.walletCapabilityMessage=p?null:"The selected wallet is read-only for submission (no CanActAs/CanExecuteAs right)."}async handleReject(){if(confirm(`Reject pending activity "${this.commandId}"?`)){this.isDeleting=!0;try{const e=await W();await(await $(await O.accessToken.get(e))).request({method:"deleteTransaction",params:{transactionId:this.transactionId}}),S("","Activity rejected successfully","success"),this.closeOrGoToList()}catch(e){console.error(e),nt(e,{message:"Error rejecting activity"})}finally{this.isDeleting=!1}}}async handleApprove(){if(!this.canSubmit){S("Read-only wallet","This wallet can read but cannot submit transactions. Switch to a wallet with CanActAs or CanExecuteAs.","error");return}this.isApproving=!0;try{const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"sign",params:{transactionId:this.transactionId,partyId:this.partyId}});if(c.status==="pending"){S("Activity pending","Complete signing in your external provider, then click Approve to finish.","info"),await this.updateState();return}if(c.status==="signed"){await a.request({method:"execute",params:{signature:c.signature,signedBy:c.signedBy,transactionId:this.transactionId,partyId:this.partyId}}),S("","Activity executed successfully","success"),this.closeOrGoToList();return}const o=c.status==="rejected"?"Activity was rejected":"Activity failed";S("",o,"error"),await this.updateState()}catch(e){console.error(e),nt(e,{message:"Error executing activity"})}finally{this.isApproving=!1}}render(){return rt`
|
|
2
2
|
${this.walletCapabilityMessage?rt`<div class="alert alert-warning" role="alert">
|
|
3
3
|
${this.walletCapabilityMessage}
|
|
4
4
|
</div>`:""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{r as u,s as V,V as G,d as H,c as R,a as J,m as Q,f as X,z as Y,b as Z,v as z,i as ee}from"./index-BhzcMGYw.js";import{S as T}from"./index-D-NXyb6u.js";var te=Object.create,I=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,L=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},ae=(e,t,i)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,re=e=>[,,,te(e?.[L("metadata")]??null)],M=["class","method","getter","setter","accessor","field","value","get","set"],h=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,se=(e,t,i,s,a)=>({kind:M[e],name:t,metadata:s,addInitializer:n=>i._?_("Already initialized"):a.push(h(n||null))}),ne=(e,t)=>ae(t,L("metadata"),e[3]),d=(e,t,i,s)=>{for(var a=0,n=e[t>>1],o=n&&n.length;a<o;a++)t&1?n[a].call(i):s=n[a].call(i,s);return s},y=(e,t,i,s,a,n)=>{for(var o,c,C,v,b,O=t&7,$=!1,B=!1,w=e.length+1,j=M[O+5],q=e[w-1]=[],D=e[w]||(e[w]=[]),l=(a=a.prototype,ie({get[i](){return oe(this,n)},set[i](g){return ce(this,n,g)}},i)),m=s.length-1;m>=0;m--)v=se(O,i,C={},e[3],D),v.static=$,v.private=B,b=v.access={has:g=>i in g},b.get=g=>g[i],b.set=(g,F)=>g[i]=F,c=(0,s[m])({get:l.get,set:l.set},v),C._=1,c===void 0?h(c)&&(l[j]=c):typeof c!="object"||c===null?_("Object expected"):(h(o=c.get)&&(l.get=o),h(o=c.set)&&(l.set=o),h(o=c.init)&&q.unshift(o));return l&&I(a,i,l),a},A=(e,t,i)=>t.has(e)||_("Cannot "+i),oe=(e,t,i)=>(A(e,t,"read from private field"),t.get(e)),f=(e,t,i)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ce=(e,t,i,s)=>(A(e,t,"write to private field"),t.set(e,i),i),W,E,N,U,P,r,k,S,K,x;class p extends(P=z,U=[u()],N=[u()],E=[u()],W=[u()],P){constructor(){super(...arguments),this.signingProviders=Object.values(T),f(this,k,d(r,8,this,!1)),d(r,11,this),f(this,S,d(r,12,this,[])),d(r,15,this),f(this,K,d(r,16,this,!1)),d(r,19,this),f(this,x,d(r,20,this,"")),d(r,23,this)}navigateBack(){V(G("/parties"))}async getSigningProviderKeys(t){this.publicKeysLoading=!0;const i=await H();try{const s=await R(await J.accessToken.get(i)),{keys:a}=await s.request({method:"listSigningProviderKeys",params:{signingProviderId:t}});this.publicKeys=a.sort((n,o)=>n.name.localeCompare(o.name)),a.length===0&&this.showToast&&Q("No public keys found","No public keys are available for the selected signing provider.","info")}catch(s){X(s)}finally{this.publicKeysLoading=!1}}async onSigningProviderChange(t){this.publicKeys=[];const{signingProviderId:i}=t;this.selectedSigningProvider=i,i!==T.PARTICIPANT&&await this.getSigningProviderKeys(i)}render(){return Z`
|
|
2
|
+
<div class="page-header">
|
|
3
|
+
<h1 class="h4 fw-semibold mb-0">${this.pageTitle}</h1>
|
|
4
|
+
<button
|
|
5
|
+
class="btn btn-link btn-sm text-body text-decoration-none p-0 d-inline-flex align-items-center gap-1"
|
|
6
|
+
type="button"
|
|
7
|
+
@click=${this.navigateBack}
|
|
8
|
+
>
|
|
9
|
+
${Y}
|
|
10
|
+
<span>Back</span>
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="form-wrap">${this.form}</div>
|
|
15
|
+
`}}r=re(P);k=new WeakMap;S=new WeakMap;K=new WeakMap;x=new WeakMap;y(r,4,"submitting",U,p,k);y(r,4,"publicKeys",N,p,S);y(r,4,"publicKeysLoading",E,p,K);y(r,4,"selectedSigningProvider",W,p,x);ne(r,p);p.styles=[z.styles,ee`
|
|
16
|
+
:host {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.page-header {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
margin-bottom: var(--wg-space-4);
|
|
25
|
+
gap: var(--wg-space-3);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.form-wrap {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
`];export{p as U};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{r as C,d as H,c as J,a as Q,s as V,x as X,f as Y,b as Z,t as j}from"./index-BhzcMGYw.js";import{S as W,W as ee}from"./index-D-NXyb6u.js";import{U as te}from"./common-Byz7o2Qs.js";var ie=Object.create,K=Object.defineProperty,re=Object.getOwnPropertyDescriptor,q=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},se=(e,t,i)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,M=(e,t)=>K(e,"name",{value:t,configurable:!0}),ae=e=>[,,,ie(e?.[q("metadata")]??null)],N=["class","method","getter","setter","accessor","field","value","get","set"],y=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,ne=(e,t,i,l,s)=>({kind:N[e],name:t,metadata:l,addInitializer:a=>i._?_("Already initialized"):s.push(y(a||null))}),de=(e,t)=>se(t,q("metadata"),e[3]),p=(e,t,i,l)=>{for(var s=0,a=e[t>>1],u=a&&a.length;s<u;s++)t&1?a[s].call(i):l=a[s].call(i,l);return l},P=(e,t,i,l,s,a)=>{var u,d,k,v,w,r=t&7,f=!!(t&8),h=!!(t&16),I=r>3?e.length+1:r?f?1:2:0,A=N[r+5],L=r>3&&(e[I-1]=[]),G=e[I]||(e[I]=[]),c=r&&(!h&&!f&&(s=s.prototype),r<5&&(r>3||!h)&&re(r<4?s:{get[i](){return z(this,a)},set[i](n){return D(this,a,n)}},i));r?h&&r<4&&M(a,(r>2?"set ":r>1?"get ":"")+i):M(s,i);for(var b=l.length-1;b>=0;b--)v=ne(r,i,k={},e[3],G),r&&(v.static=f,v.private=h,w=v.access={has:h?n=>oe(s,n):n=>i in n},r^3&&(w.get=h?n=>(r^1?z:le)(n,s,r^4?a:c.get):n=>n[i]),r>2&&(w.set=h?(n,S)=>D(n,s,S,r^4?a:c.set):(n,S)=>n[i]=S)),d=(0,l[b])(r?r<4?h?a:c[A]:r>4?void 0:{get:c.get,set:c.set}:s,v),k._=1,r^4||d===void 0?y(d)&&(r>4?L.unshift(d):r?h?a=d:c[A]=d:s=d):typeof d!="object"||d===null?_("Object expected"):(y(u=d.get)&&(c.get=u),y(u=d.set)&&(c.set=u),y(u=d.init)&&L.unshift(u));return r||de(e,s),c&&K(s,i,c),h?r^4?a:c:s},T=(e,t,i)=>t.has(e)||_("Cannot "+i),oe=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),z=(e,t,i)=>(T(e,t,"read from private field"),i?i.call(e):t.get(e)),m=(e,t,i)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),D=(e,t,i,l)=>(T(e,t,"write to private field"),l?l.call(e,i):t.set(e,i),i),le=(e,t,i)=>(T(e,t,"access private method"),i),R,F,x,E,B,o,U,$,O;B=[j("user-ui-edit-party")];class g extends(E=te,x=[C()],F=[C()],R=[C()],E){constructor(){super(...arguments),m(this,U,p(o,8,this)),p(o,11,this),m(this,$,p(o,12,this)),p(o,15,this),m(this,O,p(o,16,this,"")),p(o,19,this),this.pageTitle="Edit party",this.showToast=!0}get partyId(){const t=new URLSearchParams(window.location.search).get("partyId");if(!t)throw new Error("partyId query param must be provided");return t}get loaded(){return!!this.userClient}async connectedCallback(){super.connectedCallback();const t=await H();this.userClient=await J(await Q.accessToken.get(t));const i=await this.userClient.request({method:"getWallet",params:{partyId:this.partyId}});if(!i)throw new Error("wallet not found");this.wallet=i,this.selectedSigningProvider=this.wallet.signingProviderId,this.selectedPublicKey=this.wallet.publicKey,this.selectedSigningProvider!==W.PARTICIPANT&&await this.getSigningProviderKeys(this.wallet.signingProviderId)}async onEditParty(t){if(this.loaded){this.submitting=!0;try{await this.userClient.request({method:"changeSigningProvider",params:{signingProviderId:t.signingProviderId,partyId:t.partyId,publicKey:t.publicKey}}),V(`${X("/parties/")}?createPartyStatus=${ee.WALLET_EDITED}`)}catch(i){this.submitting=!1,Y(i)}}}get form(){return Z`
|
|
2
|
+
<wg-wallet-edit-form
|
|
3
|
+
.signingProviders=${this.signingProviders}
|
|
4
|
+
.disabledSigningProviders=${[W.PARTICIPANT]}
|
|
5
|
+
.publicKeys=${this.publicKeys}
|
|
6
|
+
.selectedSigningProvider=${this.selectedSigningProvider}
|
|
7
|
+
.partyId=${this.partyId}
|
|
8
|
+
.selectedPublicKey=${this.selectedPublicKey}
|
|
9
|
+
?publicKeysLoading=${this.publicKeysLoading}
|
|
10
|
+
?submitting=${this.submitting}
|
|
11
|
+
@signing-provider-change=${this.onSigningProviderChange}
|
|
12
|
+
@wallet-edit=${this.onEditParty}
|
|
13
|
+
></wg-wallet-edit-form>
|
|
14
|
+
`}}o=ae(E);U=new WeakMap;$=new WeakMap;O=new WeakMap;P(o,4,"userClient",x,g,U);P(o,4,"wallet",F,g,$);P(o,4,"selectedPublicKey",R,g,O);g=P(o,0,"UserUiEditParty",B,g);p(o,1,g);
|