@ledgerhq/revault-api 1.41.0 → 1.43.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/lib/{app-types-BCPeZhFD.d.mts → app-types-BxhO5dk7.d.mts} +1030 -580
- package/lib/fakes.d.mts +115 -17
- package/lib/fakes.mjs +1254 -1008
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +4003 -593
- package/package.json +2 -2
package/lib/fakes.mjs
CHANGED
|
@@ -1,286 +1,12 @@
|
|
|
1
1
|
import { __export } from './chunk-J5LGTIGS.mjs';
|
|
2
2
|
import { faker } from '@faker-js/faker';
|
|
3
3
|
import { AccountType, ChallengeType, PsdModel, UserRole, UserRegistrationState, AllowedAction, AdminPermission, RequestType, AccountGovernanceType, ActivationStatus, MessageType, WhitelistType, RequestReviewStatus, RequestState, GateAccountType } from '@prisma/client';
|
|
4
|
+
import 'ts-pattern';
|
|
5
|
+
import z14, { z } from 'zod';
|
|
4
6
|
import { omit, times, get, isPlainObject } from 'lodash';
|
|
5
|
-
import 'axios';
|
|
6
7
|
import invariant8 from 'invariant';
|
|
7
|
-
import
|
|
8
|
-
import 'ts-pattern';
|
|
9
|
-
|
|
10
|
-
// src/errors.ts
|
|
11
|
-
var ValidationError = class extends Error {
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/sync-utils.ts
|
|
15
|
-
var GATE_SYNC_ID_PREFIX = "gate://";
|
|
16
|
-
var buildGateSyncId = (workspaceName, gateType, gateId) => {
|
|
17
|
-
if (gateId <= 0) {
|
|
18
|
-
throw new ValidationError(`Invalid gate ID: ${gateId}`);
|
|
19
|
-
}
|
|
20
|
-
return `${GATE_SYNC_ID_PREFIX}${workspaceName}/${gateType}/${gateId}`;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/utils.ts
|
|
24
|
-
var isRecord = (value) => isPlainObject(value);
|
|
25
|
-
var ensureNonEmptyArray = (values, message) => {
|
|
26
|
-
invariant8(
|
|
27
|
-
values.length > 0,
|
|
28
|
-
`Expected non-empty array but got one with length ${values.length}`
|
|
29
|
-
);
|
|
30
|
-
return values;
|
|
31
|
-
};
|
|
32
|
-
function unreachable(value) {
|
|
33
|
-
throw new Error(`Un-covered: ${value}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// src/__fakes__/faker-utils.ts
|
|
37
|
-
var fakeUniqueName = (length = 20) => faker.string.alphanumeric({ length, casing: "lower" });
|
|
38
|
-
var fakeHexString = (length, casing = "upper") => faker.string.hexadecimal({ prefix: "", casing, length });
|
|
39
|
-
var fakePubKey = () => fakeHexString(130);
|
|
40
|
-
var fakeIntegerId = () => faker.number.int({ min: 1, max: 2e9 });
|
|
41
|
-
var fakeGateId = fakeIntegerId;
|
|
42
|
-
var fakeBase64String = (length) => btoa(faker.string.sample(length));
|
|
43
|
-
var fakePsdSignature = () => fakeBase64String(100);
|
|
44
|
-
var fakeJws = () => times(3, () => faker.string.hexadecimal({ prefix: "", length: 100 })).join(".");
|
|
45
|
-
var fakeHsmObjectId = () => faker.string.uuid();
|
|
46
|
-
var fakeHsmCertificate = () => ({
|
|
47
|
-
codeHash: fakeBase64String(10),
|
|
48
|
-
attestationPub: fakeBase64String(20),
|
|
49
|
-
certificate: fakeBase64String(20),
|
|
50
|
-
signature: fakeBase64String(20)
|
|
51
|
-
});
|
|
52
|
-
var fakePsdChallenge = () => ({
|
|
53
|
-
challengeType: "PSD",
|
|
54
|
-
wActions: [fakeBase64String(50), fakeBase64String(50), fakeBase64String(50)],
|
|
55
|
-
handshake: fakeBase64String(100),
|
|
56
|
-
handshakeAttestation: fakeHsmCertificate(),
|
|
57
|
-
partitionId: fakeBase64String(20)
|
|
58
|
-
});
|
|
59
|
-
var fakeWorkspaceName = () => faker.string.alpha({ length: 8, casing: "lower" });
|
|
60
|
-
var injectSyncId = (obj) => {
|
|
61
|
-
let { syncId } = obj;
|
|
62
|
-
if (syncId === void 0) {
|
|
63
|
-
if (obj.gateType !== null && obj.gateId !== 0) {
|
|
64
|
-
syncId = buildGateSyncId(obj.workspaceName, obj.gateType, obj.gateId);
|
|
65
|
-
} else if (obj.gateType === null && obj.gateId === 0) {
|
|
66
|
-
syncId = faker.string.uuid();
|
|
67
|
-
} else {
|
|
68
|
-
throw new Error(`Invalid gateType and gateId: ${obj.gateType}, ${obj.gateId}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return { ...obj, syncId };
|
|
72
|
-
};
|
|
8
|
+
import 'axios';
|
|
73
9
|
|
|
74
|
-
// src/__fakes__/models/accounts.ts
|
|
75
|
-
var genAssetFieldsForType = (type) => {
|
|
76
|
-
const hsmXpub = faker.string.hexadecimal({ prefix: "", casing: "upper", length: 66 });
|
|
77
|
-
const hsmChainCode = faker.string.hexadecimal({ prefix: "", casing: "upper", length: 64 });
|
|
78
|
-
switch (type) {
|
|
79
|
-
case "BITCOIN_LIKE":
|
|
80
|
-
return {
|
|
81
|
-
type,
|
|
82
|
-
currency: faker.helpers.arrayElement(["bitcoin", "bitcoin_testnet"]),
|
|
83
|
-
derivationPath: "84'/0'/0'",
|
|
84
|
-
address: null,
|
|
85
|
-
contractAddress: null,
|
|
86
|
-
xpub: faker.string.hexadecimal({ prefix: "", length: 120 }),
|
|
87
|
-
hsmXpub,
|
|
88
|
-
hsmChainCode
|
|
89
|
-
};
|
|
90
|
-
case "ETHEREUM_LIKE":
|
|
91
|
-
return {
|
|
92
|
-
type,
|
|
93
|
-
currency: faker.helpers.arrayElement(["ethereum", "ethereum_goerli"]),
|
|
94
|
-
derivationPath: "44'/60'/0'",
|
|
95
|
-
address: faker.finance.ethereumAddress(),
|
|
96
|
-
contractAddress: null,
|
|
97
|
-
xpub: null,
|
|
98
|
-
hsmXpub,
|
|
99
|
-
hsmChainCode
|
|
100
|
-
};
|
|
101
|
-
case "CANTON_LIKE":
|
|
102
|
-
return {
|
|
103
|
-
type,
|
|
104
|
-
currency: "canton",
|
|
105
|
-
derivationPath: "44'/6767'/0'/0'/0'",
|
|
106
|
-
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
107
|
-
contractAddress: null,
|
|
108
|
-
xpub: null,
|
|
109
|
-
hsmXpub,
|
|
110
|
-
hsmChainCode: null
|
|
111
|
-
};
|
|
112
|
-
case "CARDANO_LIKE":
|
|
113
|
-
return {
|
|
114
|
-
type,
|
|
115
|
-
currency: faker.helpers.arrayElement(["cardano"]),
|
|
116
|
-
derivationPath: "1852'/1815'/0'",
|
|
117
|
-
address: `addr${faker.string.alphanumeric({ length: 100, casing: "lower" })}`,
|
|
118
|
-
contractAddress: null,
|
|
119
|
-
xpub: null,
|
|
120
|
-
hsmXpub,
|
|
121
|
-
hsmChainCode
|
|
122
|
-
};
|
|
123
|
-
case "SOLANA_LIKE":
|
|
124
|
-
return {
|
|
125
|
-
type,
|
|
126
|
-
currency: faker.helpers.arrayElement(["solana"]),
|
|
127
|
-
derivationPath: "44'/501'/0'",
|
|
128
|
-
address: faker.string.alphanumeric({ length: 44, casing: "lower" }),
|
|
129
|
-
contractAddress: null,
|
|
130
|
-
xpub: null,
|
|
131
|
-
hsmXpub,
|
|
132
|
-
hsmChainCode: null
|
|
133
|
-
};
|
|
134
|
-
case "TEZOS_LIKE":
|
|
135
|
-
return {
|
|
136
|
-
type,
|
|
137
|
-
currency: faker.helpers.arrayElement(["tezos"]),
|
|
138
|
-
derivationPath: "44'/1729'/0'",
|
|
139
|
-
address: `tz${faker.string.alphanumeric({ length: 34, casing: "mixed" })}`,
|
|
140
|
-
contractAddress: null,
|
|
141
|
-
xpub: null,
|
|
142
|
-
hsmXpub,
|
|
143
|
-
hsmChainCode
|
|
144
|
-
};
|
|
145
|
-
case "STELLAR_LIKE":
|
|
146
|
-
return {
|
|
147
|
-
type,
|
|
148
|
-
currency: faker.helpers.arrayElement(["stellar"]),
|
|
149
|
-
derivationPath: "44'/148'/0'",
|
|
150
|
-
address: faker.string.alphanumeric({ length: 56, casing: "upper" }),
|
|
151
|
-
contractAddress: null,
|
|
152
|
-
xpub: null,
|
|
153
|
-
hsmXpub,
|
|
154
|
-
hsmChainCode
|
|
155
|
-
};
|
|
156
|
-
case "RIPPLE_LIKE":
|
|
157
|
-
return {
|
|
158
|
-
type,
|
|
159
|
-
currency: faker.helpers.arrayElement(["ripple"]),
|
|
160
|
-
derivationPath: "44'/144'/0'",
|
|
161
|
-
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
162
|
-
contractAddress: null,
|
|
163
|
-
xpub: `xpub${faker.string.alphanumeric({ length: 107, casing: "mixed" })}`,
|
|
164
|
-
hsmXpub,
|
|
165
|
-
hsmChainCode
|
|
166
|
-
};
|
|
167
|
-
case "POLKADOT_LIKE":
|
|
168
|
-
return {
|
|
169
|
-
type,
|
|
170
|
-
currency: faker.helpers.arrayElement(["polkadot"]),
|
|
171
|
-
derivationPath: "44'/354'/0'",
|
|
172
|
-
address: faker.string.alphanumeric({ length: 48, casing: "mixed" }),
|
|
173
|
-
contractAddress: null,
|
|
174
|
-
xpub: null,
|
|
175
|
-
hsmXpub,
|
|
176
|
-
hsmChainCode: null
|
|
177
|
-
};
|
|
178
|
-
case "TRON_LIKE":
|
|
179
|
-
return {
|
|
180
|
-
type,
|
|
181
|
-
currency: faker.helpers.arrayElement(["tron"]),
|
|
182
|
-
derivationPath: "44'/195'/0'",
|
|
183
|
-
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
184
|
-
contractAddress: null,
|
|
185
|
-
xpub: null,
|
|
186
|
-
hsmXpub,
|
|
187
|
-
hsmChainCode
|
|
188
|
-
};
|
|
189
|
-
case "SUI_LIKE":
|
|
190
|
-
return {
|
|
191
|
-
type,
|
|
192
|
-
currency: faker.helpers.arrayElement(["sui"]),
|
|
193
|
-
derivationPath: "44'/784'/0'",
|
|
194
|
-
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
195
|
-
contractAddress: null,
|
|
196
|
-
xpub: null,
|
|
197
|
-
hsmXpub,
|
|
198
|
-
hsmChainCode: null
|
|
199
|
-
};
|
|
200
|
-
case "GENERIC_LIKE":
|
|
201
|
-
return {
|
|
202
|
-
type,
|
|
203
|
-
currency: faker.helpers.arrayElement(["cosmos"]),
|
|
204
|
-
derivationPath: "44'/118'/0'",
|
|
205
|
-
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
206
|
-
contractAddress: null,
|
|
207
|
-
xpub: null,
|
|
208
|
-
hsmXpub,
|
|
209
|
-
hsmChainCode
|
|
210
|
-
};
|
|
211
|
-
case "RAW_SIGNING":
|
|
212
|
-
return {
|
|
213
|
-
type,
|
|
214
|
-
currency: faker.helpers.arrayElement(["ethereum", "bitcoin"]),
|
|
215
|
-
derivationPath: "44'/118'/0'",
|
|
216
|
-
address: null,
|
|
217
|
-
contractAddress: null,
|
|
218
|
-
xpub: null,
|
|
219
|
-
hsmXpub,
|
|
220
|
-
hsmChainCode
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
var genGovernanceFieldsForType = (governanceType, {
|
|
225
|
-
accountId,
|
|
226
|
-
policyId,
|
|
227
|
-
assetManagerId
|
|
228
|
-
}) => {
|
|
229
|
-
switch (governanceType) {
|
|
230
|
-
case AccountGovernanceType.CLASSIC:
|
|
231
|
-
case AccountGovernanceType.RAW_SIGNING:
|
|
232
|
-
return {
|
|
233
|
-
governanceType,
|
|
234
|
-
classicGovernanceMixin: {
|
|
235
|
-
id: faker.number.int(),
|
|
236
|
-
policyId: policyId ?? faker.string.uuid(),
|
|
237
|
-
accountId
|
|
238
|
-
},
|
|
239
|
-
tradelinkGovernanceMixin: null
|
|
240
|
-
};
|
|
241
|
-
case AccountGovernanceType.TRADELINK:
|
|
242
|
-
return {
|
|
243
|
-
governanceType,
|
|
244
|
-
classicGovernanceMixin: null,
|
|
245
|
-
tradelinkGovernanceMixin: {
|
|
246
|
-
id: faker.number.int(),
|
|
247
|
-
assetManagerId: assetManagerId ?? faker.string.uuid(),
|
|
248
|
-
accountId,
|
|
249
|
-
exchangeConfigs: [],
|
|
250
|
-
status: ActivationStatus.ACTIVE
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
var genAccount = (opts) => {
|
|
256
|
-
const { policyId, assetManagerId, ...rest } = opts ?? {};
|
|
257
|
-
const commonFields = {
|
|
258
|
-
id: faker.string.uuid(),
|
|
259
|
-
workspaceName: fakeWorkspaceName(),
|
|
260
|
-
name: fakeUniqueName(),
|
|
261
|
-
hsmId: fakeHsmObjectId(),
|
|
262
|
-
status: ActivationStatus.ACTIVE,
|
|
263
|
-
index: faker.number.int({ min: 0, max: 10 }),
|
|
264
|
-
gateId: fakeGateId(),
|
|
265
|
-
gateType: GateAccountType.Account,
|
|
266
|
-
lesWalletId: faker.string.uuid(),
|
|
267
|
-
createdAt: faker.date.past(),
|
|
268
|
-
updatedAt: faker.date.past()
|
|
269
|
-
};
|
|
270
|
-
const assetFields = genAssetFieldsForType(
|
|
271
|
-
opts?.type ?? faker.helpers.arrayElement(Object.values(AccountType))
|
|
272
|
-
);
|
|
273
|
-
const governanceFields = genGovernanceFieldsForType(
|
|
274
|
-
opts?.governanceType ?? faker.helpers.arrayElement(Object.values(AccountGovernanceType)),
|
|
275
|
-
{ accountId: commonFields.id, policyId, assetManagerId }
|
|
276
|
-
);
|
|
277
|
-
return injectSyncId({
|
|
278
|
-
...commonFields,
|
|
279
|
-
...governanceFields,
|
|
280
|
-
...assetFields,
|
|
281
|
-
...rest
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
10
|
var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
|
|
285
11
|
var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
|
|
286
12
|
var zUnsignedIntString = z.string().nonempty().regex(/^([1-9]\d*|0)$/);
|
|
@@ -301,68 +27,68 @@ z.codec(z.iso.datetime(), z.date(), {
|
|
|
301
27
|
|
|
302
28
|
// src/networks/common.ts
|
|
303
29
|
var NetworkFamily = omit(AccountType, ["RAW_SIGNING"]);
|
|
304
|
-
var zHexDataString =
|
|
30
|
+
var zHexDataString = z14.codec(z14.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/), z14.string(), {
|
|
305
31
|
decode: (hex) => `0x${hex.toLowerCase().replace("0x", "")}`,
|
|
306
32
|
encode: (hex) => hex
|
|
307
33
|
});
|
|
308
|
-
var zCommonLiveData =
|
|
309
|
-
id:
|
|
310
|
-
balance:
|
|
311
|
-
total:
|
|
312
|
-
pending:
|
|
34
|
+
var zCommonLiveData = z14.object({
|
|
35
|
+
id: z14.string().meta({ description: "Account internal unique identifier" }),
|
|
36
|
+
balance: z14.object({
|
|
37
|
+
total: z14.string().meta({ description: "Total balance" }),
|
|
38
|
+
pending: z14.string().meta({ description: "Pending balance" })
|
|
313
39
|
}).meta({ description: "Balance fields" })
|
|
314
40
|
});
|
|
315
|
-
var zCommonTransactionData =
|
|
41
|
+
var zCommonTransactionData = z14.object({
|
|
316
42
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
317
43
|
currency: zCurrencyString.meta({
|
|
318
44
|
description: "Will be deprecated soon, use Account.network. Transaction currency"
|
|
319
45
|
}),
|
|
320
46
|
// TODO: to remove, use account.network instead
|
|
321
47
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
322
|
-
recipient:
|
|
48
|
+
recipient: z14.string().nonempty().meta({ description: "Transaction recipient" })
|
|
323
49
|
});
|
|
324
|
-
var zFeeStrategyCustom =
|
|
325
|
-
type:
|
|
50
|
+
var zFeeStrategyCustom = z14.object({
|
|
51
|
+
type: z14.enum(["SLOW", "NORMAL", "FAST", "CUSTOM"])
|
|
326
52
|
});
|
|
327
|
-
var zFeeStrategy =
|
|
328
|
-
type:
|
|
53
|
+
var zFeeStrategy = z14.object({
|
|
54
|
+
type: z14.enum(["SLOW", "NORMAL", "FAST"])
|
|
329
55
|
});
|
|
330
|
-
var zTransactionStatus =
|
|
331
|
-
var zCommonTransactionResponse =
|
|
332
|
-
id:
|
|
333
|
-
hash:
|
|
334
|
-
block:
|
|
335
|
-
height:
|
|
336
|
-
time:
|
|
56
|
+
var zTransactionStatus = z14.enum(["SUCCESSFUL", "FAILED"]);
|
|
57
|
+
var zCommonTransactionResponse = z14.object({
|
|
58
|
+
id: z14.string().meta({ description: "Internal unique identifier" }),
|
|
59
|
+
hash: z14.string().meta({ description: "Transaction hash" }),
|
|
60
|
+
block: z14.object({
|
|
61
|
+
height: z14.string().nullable().meta({ description: "Transaction block height" }),
|
|
62
|
+
time: z14.string().nullable().meta({ description: "Transaction block time" })
|
|
337
63
|
}),
|
|
338
64
|
status: zTransactionStatus.meta({ description: "Transaction status" }),
|
|
339
|
-
confirmations:
|
|
340
|
-
amount:
|
|
341
|
-
fee:
|
|
342
|
-
senders:
|
|
343
|
-
recipients:
|
|
344
|
-
});
|
|
345
|
-
var zBitcoinLikeAssetFields =
|
|
346
|
-
type:
|
|
347
|
-
xpub:
|
|
65
|
+
confirmations: z14.string().meta({ description: "Block confirmations" }),
|
|
66
|
+
amount: z14.string().meta({ description: "Transaction amount" }),
|
|
67
|
+
fee: z14.string().meta({ description: "Transaction fee" }),
|
|
68
|
+
senders: z14.array(z14.string()).meta({ description: "Senders (can be multiple for UTXOs-based accounts)" }),
|
|
69
|
+
recipients: z14.array(z14.string()).meta({ description: "Recipients (can be multiple for multi-output transactions)" })
|
|
70
|
+
});
|
|
71
|
+
var zBitcoinLikeAssetFields = z14.object({
|
|
72
|
+
type: z14.literal(NetworkFamily.BITCOIN_LIKE).meta({ description: "Account type" }),
|
|
73
|
+
xpub: z14.string().meta({ description: "xpub (extended public key)" })
|
|
348
74
|
}).meta({ description: "Bitcoin-like" });
|
|
349
75
|
var zBitcoinLikeLiveData = zCommonLiveData.extend({
|
|
350
|
-
type:
|
|
76
|
+
type: z14.literal(NetworkFamily.BITCOIN_LIKE).meta({ description: "Account type" })
|
|
351
77
|
}).meta({ description: "Bitcoin-like" });
|
|
352
|
-
var zBitcoinLikeTransactionType =
|
|
78
|
+
var zBitcoinLikeTransactionType = z14.enum(["BITCOIN_LIKE_SEND", "BITCOIN_LIKE_RECEIVE"]).meta({ description: "Bitcoin-like transaction type" });
|
|
353
79
|
var zBitcoinLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
354
80
|
// nullish is optional + nullable, it is easier to seed rather than just optional
|
|
355
81
|
feePerByte: zUnsignedIntString.nullish().meta({ description: "Fee per byte" })
|
|
356
82
|
}).meta({ description: "Bitcoin-like fee strategy" });
|
|
357
83
|
var zBitcoinLikeSendData = zCommonTransactionData.extend({
|
|
358
|
-
type:
|
|
84
|
+
type: z14.literal(zBitcoinLikeTransactionType.enum.BITCOIN_LIKE_SEND),
|
|
359
85
|
feeStrategy: zBitcoinLikeFeeStrategy
|
|
360
86
|
}).meta({
|
|
361
87
|
description: "Bitcoin-like send data",
|
|
362
88
|
id: "BitcoinLikeSendData"
|
|
363
89
|
});
|
|
364
|
-
var zBitcoinLikeTransactionData =
|
|
365
|
-
var zBitcoinLikeTransactionResponse =
|
|
90
|
+
var zBitcoinLikeTransactionData = z14.discriminatedUnion("type", [zBitcoinLikeSendData]);
|
|
91
|
+
var zBitcoinLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
366
92
|
zCommonTransactionResponse.extend({ type: zBitcoinLikeTransactionType }).meta({ description: "Bitcoin-like transaction" })
|
|
367
93
|
]);
|
|
368
94
|
|
|
@@ -374,25 +100,74 @@ var BITCOIN_SPEC = {
|
|
|
374
100
|
zTransactionType: zBitcoinLikeTransactionType,
|
|
375
101
|
zTransactionData: zBitcoinLikeTransactionData,
|
|
376
102
|
zSendTransactionData: zBitcoinLikeSendData,
|
|
377
|
-
zEstimatedFees:
|
|
103
|
+
zEstimatedFees: z14.never(),
|
|
378
104
|
zTransactionResponse: zBitcoinLikeTransactionResponse,
|
|
379
|
-
zStakingFields:
|
|
380
|
-
var
|
|
381
|
-
|
|
382
|
-
|
|
105
|
+
zStakingFields: z14.never()};
|
|
106
|
+
var zCantonTransferProposal = z14.object({
|
|
107
|
+
amount: zUnsignedIntString.meta({ description: "Transfer amount" }),
|
|
108
|
+
contractId: z14.string().meta({ description: "ID of the transfer-proposal contract" }),
|
|
109
|
+
instrumentId: z14.string().meta({ description: "ID of the instrument being transferred" }),
|
|
110
|
+
expiresAtMicros: z14.number().int().meta({ description: "Expiration timestamp in microseconds" }),
|
|
111
|
+
memo: z14.string().nullable().meta({ description: "Optional note attached to the proposal" }),
|
|
112
|
+
sender: z14.string().meta({ description: "Party proposing to send the asset" }),
|
|
113
|
+
recipient: z14.string().meta({ description: "Intended recipient of the proposed transfer" })
|
|
114
|
+
}).meta({
|
|
115
|
+
description: "A pending asset-transfer request",
|
|
116
|
+
id: "CantonTransferProposal"
|
|
117
|
+
});
|
|
118
|
+
var zCantonLikeAssetFields = z14.object({
|
|
119
|
+
type: z14.literal(NetworkFamily.CANTON_LIKE).meta({ description: "Account type" }),
|
|
120
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
383
121
|
}).meta({ description: "Canton-like" });
|
|
384
122
|
var zCantonLikeLiveData = zCommonLiveData.extend({
|
|
385
|
-
type:
|
|
123
|
+
type: z14.literal(NetworkFamily.CANTON_LIKE).meta({ description: "Account type" })
|
|
386
124
|
}).meta({ description: "Canton-like" });
|
|
387
|
-
var zCantonLikeTransactionType =
|
|
388
|
-
var zCantonLikeSendData = zCommonTransactionData.extend({
|
|
389
|
-
type:
|
|
125
|
+
var zCantonLikeTransactionType = z14.enum(["CANTON_LIKE_SEND", "CANTON_LIKE_RECEIVE", "CANTON_LIKE_PRE_APPROVAL", "CANTON_LIKE_TAP"]).meta({ description: "Canton-like transaction type" });
|
|
126
|
+
var zCantonLikeSendData = zCommonTransactionData.omit({ maxFee: true }).extend({
|
|
127
|
+
type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_SEND)
|
|
390
128
|
}).meta({
|
|
391
129
|
description: "Canton-like send data",
|
|
392
130
|
id: "CantonLikeSendData"
|
|
393
131
|
});
|
|
394
|
-
var
|
|
395
|
-
|
|
132
|
+
var zCantonLikeReceiveData = z14.object({
|
|
133
|
+
currency: zCurrencyString.meta({
|
|
134
|
+
description: "Will be deprecated soon, use Account.network. Transfer currency"
|
|
135
|
+
}),
|
|
136
|
+
// TODO: to remove, use account.network instead
|
|
137
|
+
transferProposal: zCantonTransferProposal,
|
|
138
|
+
verdict: z14.enum(["ACCEPT", "REJECT"]).meta({ description: "Accept or reject the transfer" }),
|
|
139
|
+
reason: z14.string().nullable().meta({ description: "Reason of the verdict" }),
|
|
140
|
+
type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_RECEIVE)
|
|
141
|
+
}).meta({
|
|
142
|
+
description: "Canton-like receive data",
|
|
143
|
+
id: "CantonLikeReceiveData"
|
|
144
|
+
});
|
|
145
|
+
var zCantonLikePreApprovalData = z14.object({
|
|
146
|
+
currency: zCurrencyString.meta({
|
|
147
|
+
description: "Will be deprecated soon, use Account.network. Transaction currency"
|
|
148
|
+
}),
|
|
149
|
+
// TODO: to remove, use account.network instead
|
|
150
|
+
recipient: z14.string().nonempty().meta({
|
|
151
|
+
description: "Recipient party on which to enable pre-approval"
|
|
152
|
+
}),
|
|
153
|
+
type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_PRE_APPROVAL)
|
|
154
|
+
}).meta({
|
|
155
|
+
description: "Canton-like pre-approval data",
|
|
156
|
+
id: "CantonLikePreApprovalData"
|
|
157
|
+
});
|
|
158
|
+
var zCantonLikeTapData = zCommonTransactionData.extend({
|
|
159
|
+
type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_TAP)
|
|
160
|
+
}).meta({
|
|
161
|
+
description: "Canton-like tap data",
|
|
162
|
+
id: "CantonLikeTapData"
|
|
163
|
+
});
|
|
164
|
+
var zCantonLikeTransactionData = z14.discriminatedUnion("type", [
|
|
165
|
+
zCantonLikeSendData,
|
|
166
|
+
zCantonLikeReceiveData,
|
|
167
|
+
zCantonLikePreApprovalData,
|
|
168
|
+
zCantonLikeTapData
|
|
169
|
+
]);
|
|
170
|
+
var zCantonLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
396
171
|
zCommonTransactionResponse.extend({ type: zCantonLikeTransactionType }).meta({ description: "Canton-like transaction" })
|
|
397
172
|
]);
|
|
398
173
|
|
|
@@ -404,22 +179,22 @@ var CANTON_SPEC = {
|
|
|
404
179
|
zTransactionType: zCantonLikeTransactionType,
|
|
405
180
|
zTransactionData: zCantonLikeTransactionData,
|
|
406
181
|
zSendTransactionData: zCantonLikeSendData,
|
|
407
|
-
zEstimatedFees:
|
|
182
|
+
zEstimatedFees: z14.never(),
|
|
408
183
|
zTransactionResponse: zCantonLikeTransactionResponse,
|
|
409
|
-
zStakingFields:
|
|
410
|
-
var zCardanoLikeAssetFields =
|
|
411
|
-
type:
|
|
412
|
-
address:
|
|
184
|
+
zStakingFields: z14.never()};
|
|
185
|
+
var zCardanoLikeAssetFields = z14.object({
|
|
186
|
+
type: z14.literal(NetworkFamily.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
187
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
413
188
|
}).meta({ description: "Cardano-like" });
|
|
414
|
-
var zCardanoLikeStakingData =
|
|
415
|
-
staked:
|
|
189
|
+
var zCardanoLikeStakingData = z14.object({
|
|
190
|
+
staked: z14.string().meta({ description: "Staked balance" })
|
|
416
191
|
}).nullable().meta({ description: "Cardano-like staking data" });
|
|
417
|
-
var zCardanoLikeStakingFields =
|
|
418
|
-
type:
|
|
192
|
+
var zCardanoLikeStakingFields = z14.object({
|
|
193
|
+
type: z14.literal(NetworkFamily.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
419
194
|
staking: zCardanoLikeStakingData.optional()
|
|
420
195
|
});
|
|
421
196
|
var zCardanoLikeLiveData = zCommonLiveData.extend(zCardanoLikeStakingFields.shape).meta({ description: "Cardano-like" });
|
|
422
|
-
var zCardanoLikeTransactionType =
|
|
197
|
+
var zCardanoLikeTransactionType = z14.enum([
|
|
423
198
|
"CARDANO_LIKE_SEND",
|
|
424
199
|
"CARDANO_LIKE_RECEIVE",
|
|
425
200
|
"CARDANO_LIKE_STAKING_REGISTER",
|
|
@@ -428,26 +203,26 @@ var zCardanoLikeTransactionType = z13.enum([
|
|
|
428
203
|
"CARDANO_LIKE_STAKING_WITHDRAW"
|
|
429
204
|
]).meta({ description: "Cardano-like transaction type" });
|
|
430
205
|
var zCardanoLikeSendData = zCommonTransactionData.extend({
|
|
431
|
-
type:
|
|
206
|
+
type: z14.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_SEND),
|
|
432
207
|
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" })
|
|
433
208
|
}).meta({
|
|
434
209
|
description: "Cardano-like send data",
|
|
435
210
|
id: "CardanoSendData"
|
|
436
211
|
});
|
|
437
|
-
var zCardanoStakingDelegateData =
|
|
438
|
-
type:
|
|
212
|
+
var zCardanoStakingDelegateData = z14.object({
|
|
213
|
+
type: z14.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DELEGATE),
|
|
439
214
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
440
215
|
// TODO: strict literal or enum?
|
|
441
216
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
442
217
|
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
443
218
|
// DELEGATE doesn't have neither amount nor recipient
|
|
444
|
-
stakePoolId:
|
|
219
|
+
stakePoolId: z14.string().min(1).max(100).meta({ description: "" })
|
|
445
220
|
}).meta({
|
|
446
221
|
description: "Cardano-like staking delegate",
|
|
447
222
|
id: "CardanoStakingDelegateData"
|
|
448
223
|
});
|
|
449
|
-
var zCardanoStakingDeregisterData =
|
|
450
|
-
type:
|
|
224
|
+
var zCardanoStakingDeregisterData = z14.object({
|
|
225
|
+
type: z14.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DEREGISTER),
|
|
451
226
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
452
227
|
// TODO: strict literal or enum?
|
|
453
228
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
@@ -458,8 +233,8 @@ var zCardanoStakingDeregisterData = z13.object({
|
|
|
458
233
|
description: "Cardano-like staking deregister data",
|
|
459
234
|
id: "CardanoStakingDeregisterData"
|
|
460
235
|
});
|
|
461
|
-
var zCardanoStakingRegisterData =
|
|
462
|
-
type:
|
|
236
|
+
var zCardanoStakingRegisterData = z14.object({
|
|
237
|
+
type: z14.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
463
238
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
464
239
|
// TODO: strict literal or enum?
|
|
465
240
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
@@ -470,8 +245,8 @@ var zCardanoStakingRegisterData = z13.object({
|
|
|
470
245
|
description: "Cardano-like staking register data",
|
|
471
246
|
id: "CardanoStakingRegisterData"
|
|
472
247
|
});
|
|
473
|
-
var zCardanoStakingWithdrawData =
|
|
474
|
-
type:
|
|
248
|
+
var zCardanoStakingWithdrawData = z14.object({
|
|
249
|
+
type: z14.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_WITHDRAW),
|
|
475
250
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
476
251
|
// TODO: strict literal or enum?
|
|
477
252
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
@@ -482,14 +257,14 @@ var zCardanoStakingWithdrawData = z13.object({
|
|
|
482
257
|
description: "Cardano-like staking withdraw data",
|
|
483
258
|
id: "CardanoStakingWithdrawData"
|
|
484
259
|
});
|
|
485
|
-
var zCardanoLikeTransactionData =
|
|
260
|
+
var zCardanoLikeTransactionData = z14.discriminatedUnion("type", [
|
|
486
261
|
zCardanoLikeSendData,
|
|
487
262
|
zCardanoStakingDelegateData,
|
|
488
263
|
zCardanoStakingDeregisterData,
|
|
489
264
|
zCardanoStakingRegisterData,
|
|
490
265
|
zCardanoStakingWithdrawData
|
|
491
266
|
]);
|
|
492
|
-
var zCardanoLikeTransactionResponse =
|
|
267
|
+
var zCardanoLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
493
268
|
zCommonTransactionResponse.extend({ type: zCardanoLikeTransactionType }).meta({ description: "Cardano-like transaction" })
|
|
494
269
|
]);
|
|
495
270
|
|
|
@@ -501,37 +276,37 @@ var CARDANO_SPEC = {
|
|
|
501
276
|
zTransactionType: zCardanoLikeTransactionType,
|
|
502
277
|
zTransactionData: zCardanoLikeTransactionData,
|
|
503
278
|
zSendTransactionData: zCardanoLikeSendData,
|
|
504
|
-
zEstimatedFees:
|
|
279
|
+
zEstimatedFees: z14.never(),
|
|
505
280
|
zTransactionResponse: zCardanoLikeTransactionResponse,
|
|
506
281
|
zStakingFields: zCardanoLikeStakingFields};
|
|
507
|
-
var zEthereumLikeAssetFields =
|
|
508
|
-
type:
|
|
509
|
-
address:
|
|
510
|
-
contractAddress:
|
|
282
|
+
var zEthereumLikeAssetFields = z14.object({
|
|
283
|
+
type: z14.literal(NetworkFamily.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
284
|
+
address: z14.string().nullable().meta({ description: "Account address" }),
|
|
285
|
+
contractAddress: z14.string().nullable().meta({
|
|
511
286
|
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
512
287
|
}).optional()
|
|
513
288
|
}).meta({ description: "Ethereum-like" });
|
|
514
|
-
var zEthereumLikeStakingData =
|
|
515
|
-
totalStaking:
|
|
516
|
-
totalRewards:
|
|
517
|
-
availableRewards:
|
|
518
|
-
networkApy:
|
|
289
|
+
var zEthereumLikeStakingData = z14.object({
|
|
290
|
+
totalStaking: z14.string().meta({ description: "Total staked amount" }),
|
|
291
|
+
totalRewards: z14.string().meta({ description: "Total of rewards" }),
|
|
292
|
+
availableRewards: z14.string().meta({ description: "Available rewards" }),
|
|
293
|
+
networkApy: z14.number().meta({ description: "Network APY" })
|
|
519
294
|
}).nullable().meta({ description: "Ethereum-like staking data" });
|
|
520
|
-
var zEthereumLikeStakingFields =
|
|
521
|
-
type:
|
|
295
|
+
var zEthereumLikeStakingFields = z14.object({
|
|
296
|
+
type: z14.literal(NetworkFamily.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
522
297
|
staking: zEthereumLikeStakingData.optional()
|
|
523
298
|
});
|
|
524
299
|
var zEthereumLikeLiveData = zCommonLiveData.extend(zEthereumLikeStakingFields.shape).meta({ description: "Ethereum-like" });
|
|
525
|
-
var zEthereumLikeEstimatedFees =
|
|
526
|
-
type:
|
|
300
|
+
var zEthereumLikeEstimatedFees = z14.object({
|
|
301
|
+
type: z14.literal(NetworkFamily.ETHEREUM_LIKE),
|
|
527
302
|
baseFees: zIntString,
|
|
528
303
|
gasLimit: zIntString,
|
|
529
|
-
nonce:
|
|
304
|
+
nonce: z14.string(),
|
|
530
305
|
priorityFees: zIntString
|
|
531
306
|
}).meta({ description: "Ethereum-like fees" });
|
|
532
|
-
var zEthereumLikeTransferTransactionType =
|
|
533
|
-
var zEthereumLikeContractTransactionType =
|
|
534
|
-
var zEthereumLikeTransactionType =
|
|
307
|
+
var zEthereumLikeTransferTransactionType = z14.enum(["ETHEREUM_LIKE_SEND", "ETHEREUM_LIKE_RECEIVE"]).meta({ description: "Ethereum-like transaction type" });
|
|
308
|
+
var zEthereumLikeContractTransactionType = z14.enum(["ETHEREUM_LIKE_EXECUTE_CONTRACT", "ETHEREUM_LIKE_DEPLOY_CONTRACT"]).meta({ description: "Ethereum-like transaction type" });
|
|
309
|
+
var zEthereumLikeTransactionType = z14.enum([
|
|
535
310
|
...zEthereumLikeTransferTransactionType.options,
|
|
536
311
|
...zEthereumLikeContractTransactionType.options
|
|
537
312
|
]).meta({
|
|
@@ -546,14 +321,14 @@ var zEthereumLikeEip1559FeeStrategy = zFeeStrategyCustom.extend({
|
|
|
546
321
|
maxFeePerGas: zUnsignedIntString.meta({ description: "Maximum fee per gas (base + priority)" }),
|
|
547
322
|
gasLimit: zUnsignedIntString.meta({ description: "Gas limit" })
|
|
548
323
|
}).meta({ description: "Ethereum-like EIP-1559 fee strategy" });
|
|
549
|
-
var zEthereumLikeFeeStrategy =
|
|
324
|
+
var zEthereumLikeFeeStrategy = z14.union([zEthereumLikeLegacyFeeStrategy, zEthereumLikeEip1559FeeStrategy]).meta({
|
|
550
325
|
description: "Ethereum-like fee strategy",
|
|
551
326
|
id: "EthereumLikeFeeStrategy"
|
|
552
327
|
});
|
|
553
328
|
var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
554
|
-
type:
|
|
329
|
+
type: z14.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_DEPLOY_CONTRACT),
|
|
555
330
|
// force the recipient to be the zero address
|
|
556
|
-
recipient:
|
|
331
|
+
recipient: z14.literal("0x0000000000000000000000000000000000000000"),
|
|
557
332
|
contractData: zHexDataString.meta({ description: "Contract data in hexadecimal format" }),
|
|
558
333
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
559
334
|
}).meta({
|
|
@@ -561,7 +336,7 @@ var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
|
561
336
|
id: "EthereumLikeDeployContractData"
|
|
562
337
|
});
|
|
563
338
|
var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
564
|
-
type:
|
|
339
|
+
type: z14.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_EXECUTE_CONTRACT),
|
|
565
340
|
contractData: zHexDataString.meta({ description: "Contract call data in hexadecimal format" }),
|
|
566
341
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
567
342
|
}).meta({
|
|
@@ -569,28 +344,28 @@ var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
|
569
344
|
id: "EthereumLikeExecuteContractData"
|
|
570
345
|
});
|
|
571
346
|
var zEthereumLikeSendData = zCommonTransactionData.extend({
|
|
572
|
-
type:
|
|
347
|
+
type: z14.literal(zEthereumLikeTransferTransactionType.enum.ETHEREUM_LIKE_SEND),
|
|
573
348
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
574
349
|
}).meta({
|
|
575
350
|
description: "Ethereum-like send data",
|
|
576
351
|
id: "EthereumLikeSendData"
|
|
577
352
|
});
|
|
578
|
-
var zEthereumLikeTransactionData =
|
|
353
|
+
var zEthereumLikeTransactionData = z14.discriminatedUnion("type", [
|
|
579
354
|
zEthereumLikeDeployContractData,
|
|
580
355
|
zEthereumLikeExecuteContractData,
|
|
581
356
|
zEthereumLikeSendData
|
|
582
357
|
]);
|
|
583
|
-
var zEthereumLikeTransferCoinFields =
|
|
358
|
+
var zEthereumLikeTransferCoinFields = z14.object({
|
|
584
359
|
type: zEthereumLikeTransferTransactionType,
|
|
585
|
-
gasPrice:
|
|
586
|
-
gasLimit:
|
|
587
|
-
nonce:
|
|
360
|
+
gasPrice: z14.string(),
|
|
361
|
+
gasLimit: z14.string(),
|
|
362
|
+
nonce: z14.string()
|
|
588
363
|
});
|
|
589
364
|
var zEthereumLikeContractCoinFields = zEthereumLikeTransferCoinFields.extend({
|
|
590
365
|
type: zEthereumLikeContractTransactionType,
|
|
591
|
-
contractData:
|
|
366
|
+
contractData: z14.string().meta({ description: "Contract deployment or contract execution data" })
|
|
592
367
|
});
|
|
593
|
-
var zEthereumLikeTransactionResponse =
|
|
368
|
+
var zEthereumLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
594
369
|
zCommonTransactionResponse.extend(zEthereumLikeTransferCoinFields.shape).meta({ description: "Ethereum-like transfer transaction" }),
|
|
595
370
|
zCommonTransactionResponse.extend(zEthereumLikeContractCoinFields.shape).meta({ description: "Ethereum-like contract transaction" })
|
|
596
371
|
]).meta({ description: "Ethereum-like contract transaction" });
|
|
@@ -606,22 +381,22 @@ var ETHEREUM_SPEC = {
|
|
|
606
381
|
zEstimatedFees: zEthereumLikeEstimatedFees,
|
|
607
382
|
zTransactionResponse: zEthereumLikeTransactionResponse,
|
|
608
383
|
zStakingFields: zEthereumLikeStakingFields};
|
|
609
|
-
var zGenericAssetFields =
|
|
384
|
+
var zGenericAssetFields = z14.object({ type: z14.literal(NetworkFamily.GENERIC_LIKE).meta({ description: "Account type" }) }).meta({ description: "Generic-like" });
|
|
610
385
|
var zGenericLiveData = zCommonLiveData.extend({
|
|
611
|
-
type:
|
|
386
|
+
type: z14.literal(NetworkFamily.GENERIC_LIKE).meta({ description: "Account type" })
|
|
612
387
|
}).meta({ description: "Generic-like" });
|
|
613
|
-
var zGenericTransactionType =
|
|
614
|
-
var zGenericTransactionData =
|
|
615
|
-
|
|
616
|
-
type:
|
|
388
|
+
var zGenericTransactionType = z14.enum(["GENERIC_TRANSACTION"]).meta({ description: "Generic transaction type" });
|
|
389
|
+
var zGenericTransactionData = z14.discriminatedUnion("type", [
|
|
390
|
+
z14.object({
|
|
391
|
+
type: z14.literal(zGenericTransactionType.enum.GENERIC_TRANSACTION),
|
|
617
392
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
618
|
-
rawTx:
|
|
393
|
+
rawTx: z14.string().meta({ description: "Raw tx" })
|
|
619
394
|
}).meta({
|
|
620
395
|
description: "Generic transaction data",
|
|
621
396
|
id: "GenericTransactionData"
|
|
622
397
|
})
|
|
623
398
|
]);
|
|
624
|
-
var zGenericTransactionResponse =
|
|
399
|
+
var zGenericTransactionResponse = z14.discriminatedUnion("type", [
|
|
625
400
|
zCommonTransactionResponse.extend({ type: zGenericTransactionType }).meta({ description: "Generic transaction" })
|
|
626
401
|
]);
|
|
627
402
|
|
|
@@ -632,62 +407,114 @@ var GENERIC_SPEC = {
|
|
|
632
407
|
zLiveData: zGenericLiveData,
|
|
633
408
|
zTransactionType: zGenericTransactionType,
|
|
634
409
|
zTransactionData: zGenericTransactionData,
|
|
635
|
-
zSendTransactionData:
|
|
636
|
-
zEstimatedFees:
|
|
410
|
+
zSendTransactionData: z14.never(),
|
|
411
|
+
zEstimatedFees: z14.never(),
|
|
637
412
|
zTransactionResponse: zGenericTransactionResponse,
|
|
638
|
-
zStakingFields:
|
|
639
|
-
var
|
|
640
|
-
type:
|
|
641
|
-
address:
|
|
413
|
+
zStakingFields: z14.never()};
|
|
414
|
+
var zHederaLikeAssetFields = z14.object({
|
|
415
|
+
type: z14.literal(NetworkFamily.HEDERA_LIKE).meta({ description: "Account type" }),
|
|
416
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
417
|
+
}).meta({ description: "Hedera-like" });
|
|
418
|
+
var zHederaLikeEstimatedFees = z14.object({
|
|
419
|
+
type: z14.literal(NetworkFamily.HEDERA_LIKE),
|
|
420
|
+
fee: zIntString
|
|
421
|
+
}).meta({ description: "Hedera-like fees" });
|
|
422
|
+
var zHederaLikeTransactionType = z14.enum([
|
|
423
|
+
"HEDERA_LIKE_SEND",
|
|
424
|
+
"HEDERA_LIKE_RECEIVE",
|
|
425
|
+
"HEDERA_LIKE_SEND_TOKEN",
|
|
426
|
+
"HEDERA_LIKE_RECEIVE_TOKEN"
|
|
427
|
+
]).meta({ description: "Hedera-like transaction type" });
|
|
428
|
+
var zHederaLikeLiveData = zCommonLiveData.extend({
|
|
429
|
+
type: z14.literal(NetworkFamily.HEDERA_LIKE).meta({ description: "Account type" })
|
|
430
|
+
}).meta({ description: "Hedera-like" });
|
|
431
|
+
var zHederaLikeSendData = zCommonTransactionData.extend({
|
|
432
|
+
type: z14.literal(zHederaLikeTransactionType.enum.HEDERA_LIKE_SEND),
|
|
433
|
+
feeStrategy: zFeeStrategy
|
|
434
|
+
}).meta({
|
|
435
|
+
description: "Hedera-like send data",
|
|
436
|
+
id: "HederaLikeSendData"
|
|
437
|
+
});
|
|
438
|
+
var zHederaLikeSendTokenData = zCommonTransactionData.extend({
|
|
439
|
+
type: z14.literal(zHederaLikeTransactionType.enum.HEDERA_LIKE_SEND_TOKEN),
|
|
440
|
+
feeStrategy: zFeeStrategy
|
|
441
|
+
}).meta({
|
|
442
|
+
description: "Hedera-like send token data",
|
|
443
|
+
id: "HederaLikeSendTokenData"
|
|
444
|
+
});
|
|
445
|
+
var zHederaLikeTransactionData = z14.discriminatedUnion("type", [
|
|
446
|
+
zHederaLikeSendData,
|
|
447
|
+
zHederaLikeSendTokenData
|
|
448
|
+
]);
|
|
449
|
+
var zHederaLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
450
|
+
zCommonTransactionResponse.extend({
|
|
451
|
+
type: zHederaLikeTransactionType
|
|
452
|
+
}).meta({ description: "Hedera-like transaction" })
|
|
453
|
+
]);
|
|
454
|
+
|
|
455
|
+
// src/networks/hedera/index.ts
|
|
456
|
+
var HEDERA_SPEC = {
|
|
457
|
+
family: NetworkFamily.HEDERA_LIKE,
|
|
458
|
+
zAssetFields: zHederaLikeAssetFields,
|
|
459
|
+
zLiveData: zHederaLikeLiveData,
|
|
460
|
+
zTransactionType: zHederaLikeTransactionType,
|
|
461
|
+
zTransactionData: zHederaLikeTransactionData,
|
|
462
|
+
zSendTransactionData: zHederaLikeSendData,
|
|
463
|
+
zEstimatedFees: zHederaLikeEstimatedFees,
|
|
464
|
+
zTransactionResponse: zHederaLikeTransactionResponse,
|
|
465
|
+
zStakingFields: z.never()};
|
|
466
|
+
var zPolkadotLikeAssetFields = z14.object({
|
|
467
|
+
type: z14.literal(NetworkFamily.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
468
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
642
469
|
}).meta({ description: "Polkadot-like" });
|
|
643
|
-
var zPolkadotUnbondingAmount =
|
|
644
|
-
amount:
|
|
645
|
-
waiting_time:
|
|
646
|
-
});
|
|
647
|
-
var zPolkadotLikeStakingData =
|
|
648
|
-
info:
|
|
649
|
-
controllerAddress:
|
|
650
|
-
rewardsDestination:
|
|
651
|
-
proxies:
|
|
652
|
-
legacyStaking:
|
|
653
|
-
isNominator:
|
|
470
|
+
var zPolkadotUnbondingAmount = z14.object({
|
|
471
|
+
amount: z14.string().meta({ description: "Amount" }),
|
|
472
|
+
waiting_time: z14.string().meta({ description: "Waiting time" })
|
|
473
|
+
});
|
|
474
|
+
var zPolkadotLikeStakingData = z14.object({
|
|
475
|
+
info: z14.object({
|
|
476
|
+
controllerAddress: z14.string().nullable().meta({ description: "Controller address" }),
|
|
477
|
+
rewardsDestination: z14.string().nullable().meta({ description: "Rewards destination" }),
|
|
478
|
+
proxies: z14.array(z14.string()).meta({ description: "Proxies" }),
|
|
479
|
+
legacyStaking: z14.boolean().meta({ description: "True if account uses legacy staking" }),
|
|
480
|
+
isNominator: z14.boolean().meta({ description: "True if is nominator" })
|
|
654
481
|
}),
|
|
655
|
-
balances:
|
|
656
|
-
free:
|
|
657
|
-
reserved:
|
|
658
|
-
frozen:
|
|
659
|
-
bonded:
|
|
660
|
-
available:
|
|
661
|
-
unbonding:
|
|
662
|
-
unbonded:
|
|
663
|
-
totalUnbonding:
|
|
664
|
-
totalUnbonded:
|
|
482
|
+
balances: z14.object({
|
|
483
|
+
free: z14.string().meta({ description: "Free balance" }),
|
|
484
|
+
reserved: z14.string().meta({ description: "Reserved balance" }),
|
|
485
|
+
frozen: z14.string().meta({ description: "Frozen balance" }),
|
|
486
|
+
bonded: z14.string().meta({ description: "Bonded balance" }),
|
|
487
|
+
available: z14.string().meta({ description: "Available balance" }),
|
|
488
|
+
unbonding: z14.array(zPolkadotUnbondingAmount).meta({ description: "Unbonding balances" }),
|
|
489
|
+
unbonded: z14.array(zPolkadotUnbondingAmount).meta({ description: "Unbonded balances" }),
|
|
490
|
+
totalUnbonding: z14.string().meta({ description: "Total unbonding" }),
|
|
491
|
+
totalUnbonded: z14.string().meta({ description: "Total unbonded" })
|
|
665
492
|
}),
|
|
666
|
-
anonymousProxy:
|
|
667
|
-
address:
|
|
668
|
-
createdAt:
|
|
669
|
-
isController:
|
|
670
|
-
isMain:
|
|
671
|
-
balances:
|
|
672
|
-
free:
|
|
673
|
-
reserved:
|
|
674
|
-
frozen:
|
|
675
|
-
bonded:
|
|
676
|
-
available:
|
|
677
|
-
total:
|
|
493
|
+
anonymousProxy: z14.object({
|
|
494
|
+
address: z14.string().meta({ description: "Address" }),
|
|
495
|
+
createdAt: z14.string().meta({ description: "Creation date" }),
|
|
496
|
+
isController: z14.boolean().meta({ description: "True if is controller" }),
|
|
497
|
+
isMain: z14.boolean().meta({ description: "True if is main" }),
|
|
498
|
+
balances: z14.object({
|
|
499
|
+
free: z14.string().meta({ description: "Anonymous proxy free balance" }),
|
|
500
|
+
reserved: z14.string().meta({ description: "Anonymous proxy reserved balance" }),
|
|
501
|
+
frozen: z14.string().meta({ description: "Anonymous proxy frozen balance" }),
|
|
502
|
+
bonded: z14.string().meta({ description: "Anonymous proxy bonded balance" }),
|
|
503
|
+
available: z14.string().meta({ description: "Anonymous proxy available balance" }),
|
|
504
|
+
total: z14.string().meta({ description: "Anonymous proxy total balance" })
|
|
678
505
|
}).nullable(),
|
|
679
|
-
blockHeight:
|
|
680
|
-
extIndex:
|
|
681
|
-
index:
|
|
682
|
-
kind:
|
|
506
|
+
blockHeight: z14.string().meta({ description: "Anonymous proxy block height" }),
|
|
507
|
+
extIndex: z14.string().meta({ description: "Ext index" }),
|
|
508
|
+
index: z14.string().meta({ description: "Index" }),
|
|
509
|
+
kind: z14.string().meta({ description: "Kind" })
|
|
683
510
|
}).nullable().meta({ description: "Anonymous proxy" })
|
|
684
511
|
}).nullable().meta({ description: "Polkadot-like staking data" });
|
|
685
|
-
var zPolkadotLikeStakingFields =
|
|
686
|
-
type:
|
|
512
|
+
var zPolkadotLikeStakingFields = z14.object({
|
|
513
|
+
type: z14.literal(NetworkFamily.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
687
514
|
staking: zPolkadotLikeStakingData.optional()
|
|
688
515
|
});
|
|
689
516
|
var zPolkadotLikeLiveData = zCommonLiveData.extend(zPolkadotLikeStakingFields.shape).meta({ description: "Polkadot-like" });
|
|
690
|
-
var zPolkadotLikeTransactionType =
|
|
517
|
+
var zPolkadotLikeTransactionType = z14.enum([
|
|
691
518
|
"POLKADOT_LIKE_SEND",
|
|
692
519
|
"POLKADOT_LIKE_RECEIVE",
|
|
693
520
|
"POLKADOT_LIKE_ADDPROXY",
|
|
@@ -709,25 +536,25 @@ var zPolkadotLikeTransactionType = z13.enum([
|
|
|
709
536
|
"POLKADOT_LIKE_CHILL",
|
|
710
537
|
"POLKADOT_LIKE_TRANSFERALL"
|
|
711
538
|
]).meta({ description: "Polkadot-like transaction type" });
|
|
712
|
-
var zPolkadotRewardDestination =
|
|
713
|
-
var zPolkadotLikeAddProxyData =
|
|
714
|
-
type:
|
|
539
|
+
var zPolkadotRewardDestination = z14.enum(["Staked", "Stash"]);
|
|
540
|
+
var zPolkadotLikeAddProxyData = z14.object({
|
|
541
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ADDPROXY),
|
|
715
542
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
716
|
-
kind:
|
|
717
|
-
proxy:
|
|
543
|
+
kind: z14.literal("Staking").meta({ description: "Proxy kind" }),
|
|
544
|
+
proxy: z14.string().meta({ description: "Proxy address" })
|
|
718
545
|
}).meta({
|
|
719
546
|
description: "Polkadot-like add proxy data",
|
|
720
547
|
id: "PolkadotLikeAddProxyData"
|
|
721
548
|
});
|
|
722
|
-
var zPolkadotLikeAnonymousProxyData =
|
|
723
|
-
type:
|
|
549
|
+
var zPolkadotLikeAnonymousProxyData = z14.object({
|
|
550
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ANONYMOUSPROXY),
|
|
724
551
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
725
552
|
}).meta({
|
|
726
553
|
description: "Polkadot-like anonymous proxy data",
|
|
727
554
|
id: "PolkadotLikeAnonymousProxyData"
|
|
728
555
|
});
|
|
729
|
-
var zPolkadotLikeBondData =
|
|
730
|
-
type:
|
|
556
|
+
var zPolkadotLikeBondData = z14.object({
|
|
557
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BOND),
|
|
731
558
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
732
559
|
payee: zPolkadotRewardDestination,
|
|
733
560
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
@@ -735,75 +562,75 @@ var zPolkadotLikeBondData = z13.object({
|
|
|
735
562
|
description: "Polkadot-like bond data",
|
|
736
563
|
id: "PolkadotLikeBondData"
|
|
737
564
|
});
|
|
738
|
-
var zPolkadotLikeBondExtraData =
|
|
739
|
-
type:
|
|
565
|
+
var zPolkadotLikeBondExtraData = z14.object({
|
|
566
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BONDEXTRA),
|
|
740
567
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
741
568
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
742
569
|
}).meta({
|
|
743
570
|
description: "Polkadot-like bond extra data",
|
|
744
571
|
id: "PolkadotLikeBondExtraData"
|
|
745
572
|
});
|
|
746
|
-
var zPolkadotLikeChillData =
|
|
747
|
-
type:
|
|
573
|
+
var zPolkadotLikeChillData = z14.object({
|
|
574
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_CHILL),
|
|
748
575
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
749
576
|
}).meta({
|
|
750
577
|
description: "Polkadot-like chill data",
|
|
751
578
|
id: "PolkadotLikeChillData"
|
|
752
579
|
});
|
|
753
|
-
var zPolkadotLikeKillAnonymousData =
|
|
754
|
-
type:
|
|
580
|
+
var zPolkadotLikeKillAnonymousData = z14.object({
|
|
581
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_KILLANONYMOUS),
|
|
755
582
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
756
583
|
}).meta({
|
|
757
584
|
description: "Polkadot-like kill anonymous data",
|
|
758
585
|
id: "PolkadotLikeKillAnonymousData"
|
|
759
586
|
});
|
|
760
|
-
var zPolkadotLikeRebondData =
|
|
761
|
-
type:
|
|
587
|
+
var zPolkadotLikeRebondData = z14.object({
|
|
588
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REBOND),
|
|
762
589
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
763
590
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
764
591
|
}).meta({
|
|
765
592
|
description: "Polkadot-like rebond data",
|
|
766
593
|
id: "PolkadotLikeRebondData"
|
|
767
594
|
});
|
|
768
|
-
var zPolkadotLikeRemoveProxyData =
|
|
769
|
-
type:
|
|
595
|
+
var zPolkadotLikeRemoveProxyData = z14.object({
|
|
596
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REMOVEPROXY),
|
|
770
597
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
771
|
-
kind:
|
|
772
|
-
proxy:
|
|
598
|
+
kind: z14.literal("Staking"),
|
|
599
|
+
proxy: z14.string().meta({ description: "Proxy address" })
|
|
773
600
|
}).meta({
|
|
774
601
|
description: "Polkadot-like remove proxy data",
|
|
775
602
|
id: "PolkadotLikeRemoveProxyData"
|
|
776
603
|
});
|
|
777
604
|
var zPolkadotLikeSendData = zCommonTransactionData.extend({
|
|
778
|
-
type:
|
|
605
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SEND)
|
|
779
606
|
}).meta({
|
|
780
607
|
description: "Polkadot-like send data",
|
|
781
608
|
id: "PolkadotLikeSendData"
|
|
782
609
|
});
|
|
783
|
-
var zPolkadotLikeSetPayeeData =
|
|
784
|
-
type:
|
|
610
|
+
var zPolkadotLikeSetPayeeData = z14.object({
|
|
611
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SETPAYEE),
|
|
785
612
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
786
613
|
payee: zPolkadotRewardDestination
|
|
787
614
|
}).meta({
|
|
788
615
|
description: "Polkadot-like set payee data",
|
|
789
616
|
id: "PolkadotLikeSetPayeeData"
|
|
790
617
|
});
|
|
791
|
-
var zPolkadotLikeUnbondData =
|
|
792
|
-
type:
|
|
618
|
+
var zPolkadotLikeUnbondData = z14.object({
|
|
619
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_UNBOND),
|
|
793
620
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
794
621
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
795
622
|
}).meta({
|
|
796
623
|
description: "Polkadot-like unbond data",
|
|
797
624
|
id: "PolkadotLikeUnbondData"
|
|
798
625
|
});
|
|
799
|
-
var zPolkadotLikeWithdrawUnbondedData =
|
|
800
|
-
type:
|
|
626
|
+
var zPolkadotLikeWithdrawUnbondedData = z14.object({
|
|
627
|
+
type: z14.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_WITHDRAWUNBONDED),
|
|
801
628
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
802
629
|
}).meta({
|
|
803
630
|
description: "Polkadot-like withdraw unbonded data",
|
|
804
631
|
id: "PolkadotLikeWithdrawUnbondedData"
|
|
805
632
|
});
|
|
806
|
-
var zPolkadotLikeTransactionData =
|
|
633
|
+
var zPolkadotLikeTransactionData = z14.discriminatedUnion("type", [
|
|
807
634
|
zPolkadotLikeAddProxyData,
|
|
808
635
|
zPolkadotLikeAnonymousProxyData,
|
|
809
636
|
zPolkadotLikeBondData,
|
|
@@ -817,7 +644,7 @@ var zPolkadotLikeTransactionData = z13.discriminatedUnion("type", [
|
|
|
817
644
|
zPolkadotLikeUnbondData,
|
|
818
645
|
zPolkadotLikeWithdrawUnbondedData
|
|
819
646
|
]);
|
|
820
|
-
var zPolkadotLikeTransactionResponse =
|
|
647
|
+
var zPolkadotLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
821
648
|
zCommonTransactionResponse.extend({ type: zPolkadotLikeTransactionType }).meta({ description: "Polkadot-like transaction" })
|
|
822
649
|
]);
|
|
823
650
|
|
|
@@ -829,35 +656,35 @@ var POLKADOT_SPEC = {
|
|
|
829
656
|
zTransactionType: zPolkadotLikeTransactionType,
|
|
830
657
|
zTransactionData: zPolkadotLikeTransactionData,
|
|
831
658
|
zSendTransactionData: zPolkadotLikeSendData,
|
|
832
|
-
zEstimatedFees:
|
|
659
|
+
zEstimatedFees: z14.never(),
|
|
833
660
|
zTransactionResponse: zPolkadotLikeTransactionResponse,
|
|
834
661
|
zStakingFields: zPolkadotLikeStakingFields};
|
|
835
|
-
var zRippleLikeAssetFields =
|
|
836
|
-
type:
|
|
837
|
-
address:
|
|
662
|
+
var zRippleLikeAssetFields = z14.object({
|
|
663
|
+
type: z14.literal(NetworkFamily.RIPPLE_LIKE).meta({ description: "Account type" }),
|
|
664
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
838
665
|
}).meta({ description: "Ripple-like" });
|
|
839
666
|
var zRippleLikeLiveData = zCommonLiveData.extend({
|
|
840
|
-
type:
|
|
667
|
+
type: z14.literal(NetworkFamily.RIPPLE_LIKE).meta({ description: "Account type" })
|
|
841
668
|
}).meta({ description: "Ripple-like" });
|
|
842
|
-
var zRippleLikeEstimatedFees =
|
|
843
|
-
type:
|
|
669
|
+
var zRippleLikeEstimatedFees = z14.object({
|
|
670
|
+
type: z14.literal(NetworkFamily.RIPPLE_LIKE),
|
|
844
671
|
fee: zIntString
|
|
845
672
|
}).meta({ description: "Ripple-like fees" });
|
|
846
|
-
var zRippleLikeTransactionType =
|
|
673
|
+
var zRippleLikeTransactionType = z14.enum(["RIPPLE_LIKE_SEND", "RIPPLE_LIKE_RECEIVE"]).meta({ description: "Ripple-like transaction type" });
|
|
847
674
|
var zRippleLikeSendData = zCommonTransactionData.extend({
|
|
848
|
-
type:
|
|
675
|
+
type: z14.literal(zRippleLikeTransactionType.enum.RIPPLE_LIKE_SEND),
|
|
849
676
|
destinationTag: zIntString.nullable().meta({ description: "Destination tag" }),
|
|
850
677
|
feeStrategy: zFeeStrategyCustom.meta({ description: "Ripple-like fee strategy" })
|
|
851
678
|
}).meta({
|
|
852
679
|
description: "Ripple-like send data",
|
|
853
680
|
id: "RippleLikeSendData"
|
|
854
681
|
});
|
|
855
|
-
var zRippleLikeTransactionData =
|
|
856
|
-
var zRippleLikeTransactionResponse =
|
|
682
|
+
var zRippleLikeTransactionData = z14.discriminatedUnion("type", [zRippleLikeSendData]);
|
|
683
|
+
var zRippleLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
857
684
|
zCommonTransactionResponse.extend({
|
|
858
685
|
type: zRippleLikeTransactionType,
|
|
859
|
-
memos:
|
|
860
|
-
destinationTag:
|
|
686
|
+
memos: z14.array(z14.string()),
|
|
687
|
+
destinationTag: z14.string()
|
|
861
688
|
}).meta({ description: "Ripple-like transaction" })
|
|
862
689
|
]);
|
|
863
690
|
|
|
@@ -871,52 +698,52 @@ var RIPPLE_SPEC = {
|
|
|
871
698
|
zSendTransactionData: zRippleLikeSendData,
|
|
872
699
|
zEstimatedFees: zRippleLikeEstimatedFees,
|
|
873
700
|
zTransactionResponse: zRippleLikeTransactionResponse,
|
|
874
|
-
zStakingFields:
|
|
875
|
-
var zSolanaLikeAssetFields =
|
|
876
|
-
type:
|
|
877
|
-
address:
|
|
878
|
-
contractAddress:
|
|
701
|
+
zStakingFields: z14.never()};
|
|
702
|
+
var zSolanaLikeAssetFields = z14.object({
|
|
703
|
+
type: z14.literal(NetworkFamily.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
704
|
+
address: z14.string().nullable().meta({ description: "Account address" }),
|
|
705
|
+
contractAddress: z14.string().meta({
|
|
879
706
|
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
880
707
|
}).nullable().optional()
|
|
881
708
|
}).meta({ description: "Solana-like" });
|
|
882
|
-
var zSolanaStakingAccountStatus =
|
|
883
|
-
var zSolanaLikeStakingData =
|
|
884
|
-
staked:
|
|
885
|
-
rewards:
|
|
886
|
-
total:
|
|
887
|
-
last7:
|
|
888
|
-
last30:
|
|
709
|
+
var zSolanaStakingAccountStatus = z14.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).meta({ description: "Staking account status" });
|
|
710
|
+
var zSolanaLikeStakingData = z14.object({
|
|
711
|
+
staked: z14.string().meta({ description: "Staked balance" }),
|
|
712
|
+
rewards: z14.object({
|
|
713
|
+
total: z14.string().meta({ description: "Total rewards" }),
|
|
714
|
+
last7: z14.string().meta({ description: "Rewards on last 7 days" }),
|
|
715
|
+
last30: z14.string().meta({ description: "Rewards on last 30 days" })
|
|
889
716
|
}),
|
|
890
|
-
stakes:
|
|
891
|
-
|
|
892
|
-
uid:
|
|
893
|
-
baseAccountUid:
|
|
894
|
-
pubKey:
|
|
895
|
-
validatorPubKey:
|
|
896
|
-
initialAmount:
|
|
897
|
-
activeAmount:
|
|
898
|
-
inactiveAmount:
|
|
899
|
-
totalBalance:
|
|
900
|
-
creationDate:
|
|
901
|
-
activationEpoch:
|
|
902
|
-
activationDate:
|
|
903
|
-
deactivationEpoch:
|
|
904
|
-
deactivationDate:
|
|
717
|
+
stakes: z14.array(
|
|
718
|
+
z14.object({
|
|
719
|
+
uid: z14.string(),
|
|
720
|
+
baseAccountUid: z14.string(),
|
|
721
|
+
pubKey: z14.string().meta({ description: "Public key" }),
|
|
722
|
+
validatorPubKey: z14.string().nullable().meta({ description: "Validator public key" }),
|
|
723
|
+
initialAmount: z14.string().meta({ description: "Initial amount" }),
|
|
724
|
+
activeAmount: z14.string().meta({ description: "Active amount" }),
|
|
725
|
+
inactiveAmount: z14.string().meta({ description: "Inactive amount" }),
|
|
726
|
+
totalBalance: z14.string().meta({ description: "Total balance" }),
|
|
727
|
+
creationDate: z14.string().meta({ description: "Creation date" }),
|
|
728
|
+
activationEpoch: z14.string().nullable().meta({ description: "Activation epoch" }),
|
|
729
|
+
activationDate: z14.string().nullable().meta({ description: "Activation date" }),
|
|
730
|
+
deactivationEpoch: z14.string().nullable().meta({ description: "Deactivation epoch" }),
|
|
731
|
+
deactivationDate: z14.string().nullable().meta({ description: "Deactivation date" }),
|
|
905
732
|
status: zSolanaStakingAccountStatus,
|
|
906
|
-
rentExemptReserve:
|
|
907
|
-
withdrawableAmount:
|
|
908
|
-
totalRewards:
|
|
909
|
-
creationTxHash:
|
|
910
|
-
actionsTxHashes:
|
|
733
|
+
rentExemptReserve: z14.string().meta({ description: "Rent exempt reserve" }),
|
|
734
|
+
withdrawableAmount: z14.string().meta({ description: "Withdrawable amount" }),
|
|
735
|
+
totalRewards: z14.string().meta({ description: "Total rewards" }),
|
|
736
|
+
creationTxHash: z14.string().nullable().meta({ description: "Creation transaction hash" }),
|
|
737
|
+
actionsTxHashes: z14.array(z14.string()).meta({ description: "Actions transactions hashes" })
|
|
911
738
|
})
|
|
912
739
|
)
|
|
913
740
|
}).nullable().meta({ description: "Solana-like staking data" });
|
|
914
|
-
var zSolanaLikeStakingFields =
|
|
915
|
-
type:
|
|
741
|
+
var zSolanaLikeStakingFields = z14.object({
|
|
742
|
+
type: z14.literal(NetworkFamily.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
916
743
|
staking: zSolanaLikeStakingData.optional()
|
|
917
744
|
});
|
|
918
745
|
var zSolanaLikeLiveData = zCommonLiveData.extend(zSolanaLikeStakingFields.shape).meta({ description: "Solana-like" });
|
|
919
|
-
var zSolanaLikeTransactionType =
|
|
746
|
+
var zSolanaLikeTransactionType = z14.enum([
|
|
920
747
|
"SOLANA_LIKE_SEND",
|
|
921
748
|
"SOLANA_LIKE_RECEIVE",
|
|
922
749
|
"SOLANA_LIKE_CREATE_DELEGATE_STAKE",
|
|
@@ -931,43 +758,43 @@ var zSolanaLikeTransactionType = z13.enum([
|
|
|
931
758
|
"SOLANA_LIKE_CREATE_SPL_TOKEN_ACCOUNT"
|
|
932
759
|
]).meta({ description: "Solana-like transaction type" });
|
|
933
760
|
var zSolanaLikeCreateDelegateStakeData = zCommonTransactionData.extend({
|
|
934
|
-
type:
|
|
935
|
-
recipient:
|
|
761
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_DELEGATE_STAKE),
|
|
762
|
+
recipient: z14.string().meta({ description: "Delegated vote address" }),
|
|
936
763
|
// Re-described
|
|
937
764
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
938
765
|
}).meta({
|
|
939
766
|
description: "Solana-like create delegate stake data",
|
|
940
767
|
id: "SolanaLikeCreateDelegateStakeData"
|
|
941
768
|
});
|
|
942
|
-
var zSolanaLikeDeactivateStakeData =
|
|
943
|
-
type:
|
|
769
|
+
var zSolanaLikeDeactivateStakeData = z14.object({
|
|
770
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DEACTIVATE_STAKE),
|
|
944
771
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
945
772
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
946
|
-
stakeAccount:
|
|
773
|
+
stakeAccount: z14.string().meta({ description: "Stake account address" }),
|
|
947
774
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
948
775
|
// No recipient, no amount
|
|
949
776
|
}).meta({
|
|
950
777
|
description: "Solana-like deactivate stake data",
|
|
951
778
|
id: "SolanaLikeDeactivateStakeData"
|
|
952
779
|
});
|
|
953
|
-
var zSolanaLikeDelegateStakeData =
|
|
954
|
-
type:
|
|
780
|
+
var zSolanaLikeDelegateStakeData = z14.object({
|
|
781
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DELEGATE_STAKE),
|
|
955
782
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
956
783
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
957
|
-
recipient:
|
|
958
|
-
stakeAccount:
|
|
784
|
+
recipient: z14.string().meta({ description: "Delegated vote address" }),
|
|
785
|
+
stakeAccount: z14.string().meta({ description: "Stake account address" }),
|
|
959
786
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
960
787
|
// No amount
|
|
961
788
|
}).meta({
|
|
962
789
|
description: "Solana-like delegate stake data",
|
|
963
790
|
id: "SolanaLikeDelegateStakeData"
|
|
964
791
|
});
|
|
965
|
-
var zSolanaLikeMergeStakeData =
|
|
966
|
-
type:
|
|
792
|
+
var zSolanaLikeMergeStakeData = z14.object({
|
|
793
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_MERGE_STAKE),
|
|
967
794
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
968
795
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
969
|
-
mergeSrcAccount:
|
|
970
|
-
mergeDstAccount:
|
|
796
|
+
mergeSrcAccount: z14.string().meta({ description: "Source stake address" }),
|
|
797
|
+
mergeDstAccount: z14.string().meta({ description: "Destination stake address" }),
|
|
971
798
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
972
799
|
// No recipient, no amount
|
|
973
800
|
}).meta({
|
|
@@ -975,42 +802,42 @@ var zSolanaLikeMergeStakeData = z13.object({
|
|
|
975
802
|
id: "SolanaLikeMergeStakeData"
|
|
976
803
|
});
|
|
977
804
|
var zSolanaLikeSendData = zCommonTransactionData.extend({
|
|
978
|
-
type:
|
|
805
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND),
|
|
979
806
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
980
807
|
}).meta({
|
|
981
808
|
description: "Solana-like send data",
|
|
982
809
|
id: "SolanaLikeSendData"
|
|
983
810
|
});
|
|
984
|
-
var zSolanaLikeSplitDeactivateStakeData =
|
|
985
|
-
type:
|
|
811
|
+
var zSolanaLikeSplitDeactivateStakeData = z14.object({
|
|
812
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE),
|
|
986
813
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
987
814
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
988
815
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
989
|
-
stakeAccount:
|
|
816
|
+
stakeAccount: z14.string().meta({ description: "Stake account address" }),
|
|
990
817
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
991
818
|
// No recipient
|
|
992
819
|
}).meta({
|
|
993
820
|
description: "Solana-like split deactivate stake data",
|
|
994
821
|
id: "SolanaLikeSplitDeactivateStakeData"
|
|
995
822
|
});
|
|
996
|
-
var zSolanaLikeSplitStakeData =
|
|
997
|
-
type:
|
|
823
|
+
var zSolanaLikeSplitStakeData = z14.object({
|
|
824
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_STAKE),
|
|
998
825
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
999
826
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
1000
827
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1001
|
-
stakeAccount:
|
|
828
|
+
stakeAccount: z14.string().meta({ description: "Stake account address" }),
|
|
1002
829
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
1003
830
|
// No recipient
|
|
1004
831
|
}).meta({
|
|
1005
832
|
description: "Solana-like split stake data",
|
|
1006
833
|
id: "SolanaLikeSplitStakeData"
|
|
1007
834
|
});
|
|
1008
|
-
var zSolanaLikeWithdrawStakeData =
|
|
1009
|
-
type:
|
|
835
|
+
var zSolanaLikeWithdrawStakeData = z14.object({
|
|
836
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_WITHDRAW_STAKE),
|
|
1010
837
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
1011
838
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
1012
839
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1013
|
-
stakeAccount:
|
|
840
|
+
stakeAccount: z14.string().meta({ description: "Stake account address" }),
|
|
1014
841
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
1015
842
|
// No recipient
|
|
1016
843
|
}).meta({
|
|
@@ -1018,21 +845,21 @@ var zSolanaLikeWithdrawStakeData = z13.object({
|
|
|
1018
845
|
id: "SolanaLikeWithdrawStakeData"
|
|
1019
846
|
});
|
|
1020
847
|
var zSolanaLikeSendTokenData = zCommonTransactionData.extend({
|
|
1021
|
-
type:
|
|
848
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND_TOKEN),
|
|
1022
849
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
1023
850
|
}).meta({
|
|
1024
851
|
description: "Solana-like send token data",
|
|
1025
852
|
id: "SolanaLikeSendTokenData"
|
|
1026
853
|
});
|
|
1027
854
|
var zSolanaLikeFundAndSendTokenData = zCommonTransactionData.extend({
|
|
1028
|
-
type:
|
|
855
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_FUND_AND_SEND_TOKEN),
|
|
1029
856
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
1030
857
|
}).meta({
|
|
1031
858
|
description: "Solana-like fund token account and send token data",
|
|
1032
859
|
id: "SolanaLikeFundAndSendTokenData"
|
|
1033
860
|
});
|
|
1034
|
-
var zSolanaLikeCreateTokenAccountData =
|
|
1035
|
-
type:
|
|
861
|
+
var zSolanaLikeCreateTokenAccountData = z14.object({
|
|
862
|
+
type: z14.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_SPL_TOKEN_ACCOUNT),
|
|
1036
863
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
1037
864
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1038
865
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
@@ -1040,7 +867,7 @@ var zSolanaLikeCreateTokenAccountData = z13.object({
|
|
|
1040
867
|
description: "Solana-like create token account",
|
|
1041
868
|
id: "SolanaLikeCreateTokenAccountData"
|
|
1042
869
|
});
|
|
1043
|
-
var zSolanaLikeTransactionData =
|
|
870
|
+
var zSolanaLikeTransactionData = z14.discriminatedUnion("type", [
|
|
1044
871
|
zSolanaLikeCreateDelegateStakeData,
|
|
1045
872
|
zSolanaLikeDeactivateStakeData,
|
|
1046
873
|
zSolanaLikeDelegateStakeData,
|
|
@@ -1053,7 +880,7 @@ var zSolanaLikeTransactionData = z13.discriminatedUnion("type", [
|
|
|
1053
880
|
zSolanaLikeFundAndSendTokenData,
|
|
1054
881
|
zSolanaLikeCreateTokenAccountData
|
|
1055
882
|
]);
|
|
1056
|
-
var zSolanaLikeTransactionResponse =
|
|
883
|
+
var zSolanaLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
1057
884
|
zCommonTransactionResponse.extend({ type: zSolanaLikeTransactionType }).meta({ description: "Solana-like transaction" })
|
|
1058
885
|
]);
|
|
1059
886
|
|
|
@@ -1065,45 +892,45 @@ var SOLANA_SPEC = {
|
|
|
1065
892
|
zTransactionType: zSolanaLikeTransactionType,
|
|
1066
893
|
zTransactionData: zSolanaLikeTransactionData,
|
|
1067
894
|
zSendTransactionData: zSolanaLikeSendData,
|
|
1068
|
-
zEstimatedFees:
|
|
895
|
+
zEstimatedFees: z14.never(),
|
|
1069
896
|
zTransactionResponse: zSolanaLikeTransactionResponse,
|
|
1070
897
|
zStakingFields: zSolanaLikeStakingFields};
|
|
1071
|
-
var zStellarLikeAssetFields =
|
|
1072
|
-
type:
|
|
1073
|
-
address:
|
|
898
|
+
var zStellarLikeAssetFields = z14.object({
|
|
899
|
+
type: z14.literal(NetworkFamily.STELLAR_LIKE).meta({ description: "Account type" }),
|
|
900
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
1074
901
|
}).meta({ description: "Stellar-like" });
|
|
1075
902
|
var zStellarLikeLiveData = zCommonLiveData.extend({
|
|
1076
|
-
type:
|
|
903
|
+
type: z14.literal(NetworkFamily.STELLAR_LIKE).meta({ description: "Account type" })
|
|
1077
904
|
}).meta({ description: "Stellar-like" });
|
|
1078
|
-
var zStellarLikeEstimatedFees =
|
|
1079
|
-
type:
|
|
905
|
+
var zStellarLikeEstimatedFees = z14.object({
|
|
906
|
+
type: z14.literal(NetworkFamily.STELLAR_LIKE),
|
|
1080
907
|
fee: zIntString
|
|
1081
908
|
}).meta({ description: "Stellar-like fees" });
|
|
1082
|
-
var zStellarLikeTransactionType =
|
|
1083
|
-
var zStellarMemo =
|
|
1084
|
-
|
|
1085
|
-
MEMO_TEXT:
|
|
909
|
+
var zStellarLikeTransactionType = z14.enum(["STELLAR_LIKE_SEND", "STELLAR_LIKE_RECEIVE"]).meta({ description: "Stellar-like transaction type" });
|
|
910
|
+
var zStellarMemo = z14.union([
|
|
911
|
+
z14.object({
|
|
912
|
+
MEMO_TEXT: z14.string().max(28).meta({ description: "Text memo (at most a 28 bytes string)" })
|
|
1086
913
|
}).meta({ description: "Text memo" }),
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
MEMO_HASH:
|
|
914
|
+
z14.object({ MEMO_ID: zIntString.meta({ description: "Id memo (unsigned 64 bits integer)" }) }).meta({ description: "Id memo" }),
|
|
915
|
+
z14.object({
|
|
916
|
+
MEMO_HASH: z14.string().max(128).regex(/^[a-fA-F0-9]+$/).meta({ description: "Transaction hash memo (64 bytes hexadecimal string)" })
|
|
1090
917
|
}).meta({ description: "Hash memo" }),
|
|
1091
|
-
|
|
1092
|
-
MEMO_RETURN:
|
|
918
|
+
z14.object({
|
|
919
|
+
MEMO_RETURN: z14.string().max(128).regex(/^[a-fA-F0-9]+$/).meta({
|
|
1093
920
|
description: "A 64 bytes hexadecimal string intended to be interpreted as the hash of the transaction the sender is refunding."
|
|
1094
921
|
})
|
|
1095
922
|
}).meta({ description: "Return memo" })
|
|
1096
923
|
]);
|
|
1097
924
|
var zStellarLikeSendData = zCommonTransactionData.extend({
|
|
1098
|
-
type:
|
|
925
|
+
type: z14.literal(zStellarLikeTransactionType.enum.STELLAR_LIKE_SEND),
|
|
1099
926
|
memo: zStellarMemo.nullable().meta({ description: "Stellar memo" }),
|
|
1100
927
|
feeStrategy: zFeeStrategy.meta({ description: "Stellar-like fee strategy" })
|
|
1101
928
|
}).meta({
|
|
1102
929
|
description: "Stellar-like send data",
|
|
1103
930
|
id: "StellarLikeSendData"
|
|
1104
931
|
});
|
|
1105
|
-
var zStellarLikeTransactionData =
|
|
1106
|
-
var zStellarLikeTransactionResponse =
|
|
932
|
+
var zStellarLikeTransactionData = z14.discriminatedUnion("type", [zStellarLikeSendData]);
|
|
933
|
+
var zStellarLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
1107
934
|
zCommonTransactionResponse.extend({ type: zStellarLikeTransactionType }).meta({ description: "Stellar-like transaction" })
|
|
1108
935
|
]);
|
|
1109
936
|
|
|
@@ -1117,25 +944,25 @@ var STELLAR_SPEC = {
|
|
|
1117
944
|
zSendTransactionData: zStellarLikeSendData,
|
|
1118
945
|
zEstimatedFees: zStellarLikeEstimatedFees,
|
|
1119
946
|
zTransactionResponse: zStellarLikeTransactionResponse,
|
|
1120
|
-
zStakingFields:
|
|
1121
|
-
var zSuiLikeAssetFields =
|
|
1122
|
-
type:
|
|
1123
|
-
address:
|
|
947
|
+
zStakingFields: z14.never()};
|
|
948
|
+
var zSuiLikeAssetFields = z14.object({
|
|
949
|
+
type: z14.literal(NetworkFamily.SUI_LIKE).meta({ description: "Account type" }),
|
|
950
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
1124
951
|
}).meta({ description: "Sui-like" });
|
|
1125
|
-
var zSuiLikeStakingData =
|
|
1126
|
-
totalStaked:
|
|
1127
|
-
totalRewards:
|
|
952
|
+
var zSuiLikeStakingData = z14.object({
|
|
953
|
+
totalStaked: z14.string().meta({ description: "Total staked amount" }),
|
|
954
|
+
totalRewards: z14.string().meta({ description: "Total of rewards" })
|
|
1128
955
|
}).nullable().meta({ description: "Sui-like staking data" });
|
|
1129
|
-
var zSuiLikeStakingFields =
|
|
1130
|
-
type:
|
|
956
|
+
var zSuiLikeStakingFields = z14.object({
|
|
957
|
+
type: z14.literal(NetworkFamily.SUI_LIKE).meta({ description: "Account type" }),
|
|
1131
958
|
staking: zSuiLikeStakingData.optional()
|
|
1132
959
|
});
|
|
1133
960
|
var zSuiLikeLiveData = zCommonLiveData.extend(zSuiLikeStakingFields.shape).meta({ description: "Sui-like" });
|
|
1134
|
-
var zSuiLikeEstimatedFees =
|
|
1135
|
-
type:
|
|
961
|
+
var zSuiLikeEstimatedFees = z14.object({
|
|
962
|
+
type: z14.literal(NetworkFamily.SUI_LIKE),
|
|
1136
963
|
fee: zIntString
|
|
1137
964
|
}).meta({ description: "Sui-like fees" });
|
|
1138
|
-
var zSuiLikeTransactionType =
|
|
965
|
+
var zSuiLikeTransactionType = z14.enum([
|
|
1139
966
|
"SUI_LIKE_SEND",
|
|
1140
967
|
"SUI_LIKE_RECEIVE",
|
|
1141
968
|
"SUI_LIKE_SEND_TOKEN",
|
|
@@ -1144,21 +971,21 @@ var zSuiLikeTransactionType = z13.enum([
|
|
|
1144
971
|
"SUI_LIKE_UNSTAKE"
|
|
1145
972
|
]).meta({ description: "Sui-like transaction type" });
|
|
1146
973
|
var zSuiLikeSendData = zCommonTransactionData.extend({
|
|
1147
|
-
type:
|
|
974
|
+
type: z14.literal(zSuiLikeTransactionType.enum.SUI_LIKE_SEND),
|
|
1148
975
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" })
|
|
1149
976
|
}).meta({
|
|
1150
977
|
description: "Sui-like send data",
|
|
1151
978
|
id: "SuiLikeSendData"
|
|
1152
979
|
});
|
|
1153
980
|
var zSuiLikeTransferTokenData = zCommonTransactionData.extend({
|
|
1154
|
-
type:
|
|
981
|
+
type: z14.literal(zSuiLikeTransactionType.enum.SUI_LIKE_SEND_TOKEN),
|
|
1155
982
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" })
|
|
1156
983
|
}).meta({
|
|
1157
984
|
description: "Sui-like transfer token data",
|
|
1158
985
|
id: "SuiLikeTransferTokenData"
|
|
1159
986
|
});
|
|
1160
|
-
var zSuiLikeStakeData =
|
|
1161
|
-
type:
|
|
987
|
+
var zSuiLikeStakeData = z14.object({
|
|
988
|
+
type: z14.literal(zSuiLikeTransactionType.enum.SUI_LIKE_STAKE),
|
|
1162
989
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" }),
|
|
1163
990
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
1164
991
|
currency: zCurrencyString.meta({
|
|
@@ -1166,34 +993,34 @@ var zSuiLikeStakeData = z13.object({
|
|
|
1166
993
|
}),
|
|
1167
994
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1168
995
|
// DELEGATE does not have recipient, but has validator instead
|
|
1169
|
-
validator:
|
|
996
|
+
validator: z14.string().nonempty().meta({ description: "Validator address" })
|
|
1170
997
|
}).meta({
|
|
1171
998
|
description: "Sui-like stake data",
|
|
1172
999
|
id: "SuiLikeStakeData"
|
|
1173
1000
|
});
|
|
1174
|
-
var zSuiLikeUnstakeData =
|
|
1175
|
-
type:
|
|
1001
|
+
var zSuiLikeUnstakeData = z14.object({
|
|
1002
|
+
type: z14.literal(zSuiLikeTransactionType.enum.SUI_LIKE_UNSTAKE),
|
|
1176
1003
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" }),
|
|
1177
1004
|
currency: zCurrencyString.meta({
|
|
1178
1005
|
description: "Will be deprecated soon, use Account.network. Transaction currency"
|
|
1179
1006
|
}),
|
|
1180
1007
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1181
|
-
stakedSuiId:
|
|
1008
|
+
stakedSuiId: z14.string().nonempty().meta({ description: "Staked object to (partially?) unstake" }),
|
|
1182
1009
|
amount: zUnsignedIntString.meta({ description: "Amount to unstake from the position" }),
|
|
1183
|
-
useAllAmount:
|
|
1010
|
+
useAllAmount: z14.boolean().meta({
|
|
1184
1011
|
description: "Whether to unstake the full amount (triggers different sets of transaction commands)"
|
|
1185
1012
|
})
|
|
1186
1013
|
}).meta({
|
|
1187
1014
|
description: "Sui-like unstake data",
|
|
1188
1015
|
id: "SuiLikeUnstakeData"
|
|
1189
1016
|
});
|
|
1190
|
-
var zSuiLikeTransactionData =
|
|
1017
|
+
var zSuiLikeTransactionData = z14.discriminatedUnion("type", [
|
|
1191
1018
|
zSuiLikeSendData,
|
|
1192
1019
|
zSuiLikeTransferTokenData,
|
|
1193
1020
|
zSuiLikeStakeData,
|
|
1194
1021
|
zSuiLikeUnstakeData
|
|
1195
1022
|
]);
|
|
1196
|
-
var zSuiLikeTransactionResponse =
|
|
1023
|
+
var zSuiLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
1197
1024
|
zCommonTransactionResponse.extend({ type: zSuiLikeTransactionType }).meta({ description: "Sui-like transaction" })
|
|
1198
1025
|
]);
|
|
1199
1026
|
|
|
@@ -1208,27 +1035,27 @@ var SUI_SPEC = {
|
|
|
1208
1035
|
zEstimatedFees: zSuiLikeEstimatedFees,
|
|
1209
1036
|
zTransactionResponse: zSuiLikeTransactionResponse,
|
|
1210
1037
|
zStakingFields: zSuiLikeStakingFields};
|
|
1211
|
-
var zTezosLikeAssetFields =
|
|
1212
|
-
type:
|
|
1213
|
-
address:
|
|
1038
|
+
var zTezosLikeAssetFields = z14.object({
|
|
1039
|
+
type: z14.literal(NetworkFamily.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
1040
|
+
address: z14.string().nullable().meta({ description: "Account address" })
|
|
1214
1041
|
}).meta({ description: "Tezos-like" });
|
|
1215
|
-
var zTezosLikeStakingData =
|
|
1216
|
-
delegations:
|
|
1217
|
-
|
|
1218
|
-
address:
|
|
1042
|
+
var zTezosLikeStakingData = z14.object({
|
|
1043
|
+
delegations: z14.array(
|
|
1044
|
+
z14.object({
|
|
1045
|
+
address: z14.string()
|
|
1219
1046
|
})
|
|
1220
1047
|
)
|
|
1221
1048
|
}).nullable().meta({ description: "Tezos-like staking data" });
|
|
1222
|
-
var zTezosLikeStakingFields =
|
|
1223
|
-
type:
|
|
1049
|
+
var zTezosLikeStakingFields = z14.object({
|
|
1050
|
+
type: z14.literal(NetworkFamily.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
1224
1051
|
staking: zTezosLikeStakingData.optional()
|
|
1225
1052
|
});
|
|
1226
1053
|
var zTezosLikeLiveData = zCommonLiveData.extend(zTezosLikeStakingFields.shape).meta({ description: "Tezos-like" });
|
|
1227
|
-
var zTezosLikeEstimatedFees =
|
|
1228
|
-
type:
|
|
1054
|
+
var zTezosLikeEstimatedFees = z14.object({
|
|
1055
|
+
type: z14.literal(NetworkFamily.TEZOS_LIKE),
|
|
1229
1056
|
fee: zIntString
|
|
1230
1057
|
}).describe("Tezos-like fees");
|
|
1231
|
-
var zTezosLikeTransactionType =
|
|
1058
|
+
var zTezosLikeTransactionType = z14.enum([
|
|
1232
1059
|
"TEZOS_LIKE_SEND",
|
|
1233
1060
|
"TEZOS_LIKE_RECEIVE",
|
|
1234
1061
|
"TEZOS_LIKE_REVEAL",
|
|
@@ -1237,40 +1064,40 @@ var zTezosLikeTransactionType = z13.enum([
|
|
|
1237
1064
|
]).meta({ description: "Tezos-like transaction type" });
|
|
1238
1065
|
var zTezosLikeFeeStrategy = zFeeStrategyCustom.meta({ description: "Tezos-like fee strategy" });
|
|
1239
1066
|
var zTezosLikeSendData = zCommonTransactionData.extend({
|
|
1240
|
-
type:
|
|
1067
|
+
type: z14.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_SEND),
|
|
1241
1068
|
feeStrategy: zTezosLikeFeeStrategy
|
|
1242
1069
|
}).meta({
|
|
1243
1070
|
description: "Tezos-like send data",
|
|
1244
1071
|
id: "TezosLikeSendData"
|
|
1245
1072
|
});
|
|
1246
|
-
var zTezosLikeDelegateData =
|
|
1247
|
-
type:
|
|
1073
|
+
var zTezosLikeDelegateData = z14.object({
|
|
1074
|
+
type: z14.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_DELEGATE),
|
|
1248
1075
|
amount: zUnsignedIntString.optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
1249
1076
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
1250
1077
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1251
|
-
recipient:
|
|
1078
|
+
recipient: z14.string().nonempty().meta({ description: "Transaction recipient" }),
|
|
1252
1079
|
feeStrategy: zTezosLikeFeeStrategy
|
|
1253
1080
|
}).meta({
|
|
1254
1081
|
description: "Tezos-like delegate data",
|
|
1255
1082
|
id: "TezosLikeDelegateData"
|
|
1256
1083
|
});
|
|
1257
|
-
var zTezosLikeUndelegateData =
|
|
1258
|
-
type:
|
|
1084
|
+
var zTezosLikeUndelegateData = z14.object({
|
|
1085
|
+
type: z14.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_UNDELEGATE),
|
|
1259
1086
|
amount: zUnsignedIntString.optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
1260
1087
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
1261
1088
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
1262
|
-
recipient:
|
|
1089
|
+
recipient: z14.string().nonempty().optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
1263
1090
|
feeStrategy: zTezosLikeFeeStrategy
|
|
1264
1091
|
}).meta({
|
|
1265
1092
|
description: "Tezos-like undelegate data",
|
|
1266
1093
|
id: "TezosLikeUndelegateData"
|
|
1267
1094
|
});
|
|
1268
|
-
var zTezosLikeTransactionData =
|
|
1095
|
+
var zTezosLikeTransactionData = z14.discriminatedUnion("type", [
|
|
1269
1096
|
zTezosLikeSendData,
|
|
1270
1097
|
zTezosLikeDelegateData,
|
|
1271
1098
|
zTezosLikeUndelegateData
|
|
1272
1099
|
]);
|
|
1273
|
-
var zTezosLikeTransactionResponse =
|
|
1100
|
+
var zTezosLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
1274
1101
|
zCommonTransactionResponse.extend({ type: zTezosLikeTransactionType }).meta({ description: "Tezos-like transaction" })
|
|
1275
1102
|
]);
|
|
1276
1103
|
|
|
@@ -1285,40 +1112,40 @@ var TEZOS_SPEC = {
|
|
|
1285
1112
|
zEstimatedFees: zTezosLikeEstimatedFees,
|
|
1286
1113
|
zTransactionResponse: zTezosLikeTransactionResponse,
|
|
1287
1114
|
zStakingFields: zTezosLikeStakingFields};
|
|
1288
|
-
var zTronLikeAssetFields =
|
|
1289
|
-
type:
|
|
1290
|
-
address:
|
|
1291
|
-
contractAddress:
|
|
1115
|
+
var zTronLikeAssetFields = z14.object({
|
|
1116
|
+
type: z14.literal(NetworkFamily.TRON_LIKE).meta({ description: "Account type" }),
|
|
1117
|
+
address: z14.string().nullable().meta({ description: "Account address" }),
|
|
1118
|
+
contractAddress: z14.string().nullable().meta({
|
|
1292
1119
|
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
1293
1120
|
}).optional()
|
|
1294
1121
|
}).meta({ description: "Tron-like" });
|
|
1295
1122
|
var zTronLikeLiveData = zCommonLiveData.extend({
|
|
1296
|
-
type:
|
|
1123
|
+
type: z14.literal(NetworkFamily.TRON_LIKE).meta({ description: "Account type" })
|
|
1297
1124
|
}).meta({ description: "Tron-like" });
|
|
1298
|
-
var zTronLikeEstimatedFees =
|
|
1299
|
-
type:
|
|
1125
|
+
var zTronLikeEstimatedFees = z14.object({
|
|
1126
|
+
type: z14.literal(NetworkFamily.TRON_LIKE),
|
|
1300
1127
|
fee: zIntString
|
|
1301
1128
|
}).meta({ description: "Tron-like fees" });
|
|
1302
|
-
var zTronLikeTransactionType =
|
|
1129
|
+
var zTronLikeTransactionType = z14.enum(["TRON_LIKE_SEND", "TRON_LIKE_RECEIVE", "TRON_LIKE_SEND_TOKEN", "TRON_LIKE_RECEIVE_TOKEN"]).meta({ description: "Tron-like transaction type" });
|
|
1303
1130
|
var zTronLikeSendData = zCommonTransactionData.extend({
|
|
1304
|
-
type:
|
|
1131
|
+
type: z14.literal(zTronLikeTransactionType.enum.TRON_LIKE_SEND),
|
|
1305
1132
|
feeStrategy: zFeeStrategy.meta({ description: "Tron-like fee strategy" })
|
|
1306
1133
|
}).meta({
|
|
1307
1134
|
description: "Tron-like send data",
|
|
1308
1135
|
id: "TronLikeSendData"
|
|
1309
1136
|
});
|
|
1310
1137
|
var zTronLikeSendTokenData = zCommonTransactionData.extend({
|
|
1311
|
-
type:
|
|
1138
|
+
type: z14.literal(zTronLikeTransactionType.enum.TRON_LIKE_SEND_TOKEN),
|
|
1312
1139
|
feeStrategy: zFeeStrategy.meta({ description: "Tron-like fee strategy" })
|
|
1313
1140
|
}).meta({
|
|
1314
1141
|
description: "Tron-like send token data",
|
|
1315
1142
|
id: "TronLikeSendTokenData"
|
|
1316
1143
|
});
|
|
1317
|
-
var zTronLikeTransactionData =
|
|
1144
|
+
var zTronLikeTransactionData = z14.discriminatedUnion("type", [
|
|
1318
1145
|
zTronLikeSendData,
|
|
1319
1146
|
zTronLikeSendTokenData
|
|
1320
1147
|
]);
|
|
1321
|
-
var zTronLikeTransactionResponse =
|
|
1148
|
+
var zTronLikeTransactionResponse = z14.discriminatedUnion("type", [
|
|
1322
1149
|
zCommonTransactionResponse.extend({ type: zTronLikeTransactionType }).meta({ description: "Tron-like transaction" })
|
|
1323
1150
|
]);
|
|
1324
1151
|
|
|
@@ -1329,18 +1156,19 @@ var TRON_SPEC = {
|
|
|
1329
1156
|
zLiveData: zTronLikeLiveData,
|
|
1330
1157
|
zTransactionType: zTronLikeTransactionType,
|
|
1331
1158
|
zTransactionData: zTronLikeTransactionData,
|
|
1332
|
-
zSendTransactionData:
|
|
1159
|
+
zSendTransactionData: z14.never(),
|
|
1333
1160
|
zEstimatedFees: zTronLikeEstimatedFees,
|
|
1334
1161
|
zTransactionResponse: zTronLikeTransactionResponse,
|
|
1335
|
-
zStakingFields:
|
|
1162
|
+
zStakingFields: z14.never()};
|
|
1336
1163
|
|
|
1337
1164
|
// src/networks/index.ts
|
|
1338
|
-
var zNetworkAssetFields =
|
|
1165
|
+
var zNetworkAssetFields = z14.discriminatedUnion("type", [
|
|
1339
1166
|
BITCOIN_SPEC.zAssetFields,
|
|
1340
1167
|
CANTON_SPEC.zAssetFields,
|
|
1341
1168
|
CARDANO_SPEC.zAssetFields,
|
|
1342
1169
|
ETHEREUM_SPEC.zAssetFields,
|
|
1343
1170
|
GENERIC_SPEC.zAssetFields,
|
|
1171
|
+
HEDERA_SPEC.zAssetFields,
|
|
1344
1172
|
POLKADOT_SPEC.zAssetFields,
|
|
1345
1173
|
RIPPLE_SPEC.zAssetFields,
|
|
1346
1174
|
SOLANA_SPEC.zAssetFields,
|
|
@@ -1349,12 +1177,13 @@ var zNetworkAssetFields = z13.discriminatedUnion("type", [
|
|
|
1349
1177
|
TEZOS_SPEC.zAssetFields,
|
|
1350
1178
|
TRON_SPEC.zAssetFields
|
|
1351
1179
|
]).meta({ description: "Network asset fields" });
|
|
1352
|
-
var zAccountLiveData =
|
|
1180
|
+
var zAccountLiveData = z14.discriminatedUnion("type", [
|
|
1353
1181
|
BITCOIN_SPEC.zLiveData,
|
|
1354
1182
|
CANTON_SPEC.zLiveData,
|
|
1355
1183
|
CARDANO_SPEC.zLiveData,
|
|
1356
1184
|
ETHEREUM_SPEC.zLiveData,
|
|
1357
1185
|
GENERIC_SPEC.zLiveData,
|
|
1186
|
+
HEDERA_SPEC.zLiveData,
|
|
1358
1187
|
POLKADOT_SPEC.zLiveData,
|
|
1359
1188
|
RIPPLE_SPEC.zLiveData,
|
|
1360
1189
|
SOLANA_SPEC.zLiveData,
|
|
@@ -1363,7 +1192,7 @@ var zAccountLiveData = z13.discriminatedUnion("type", [
|
|
|
1363
1192
|
TEZOS_SPEC.zLiveData,
|
|
1364
1193
|
TRON_SPEC.zLiveData
|
|
1365
1194
|
]);
|
|
1366
|
-
|
|
1195
|
+
z14.discriminatedUnion("type", [
|
|
1367
1196
|
CARDANO_SPEC.zStakingFields,
|
|
1368
1197
|
ETHEREUM_SPEC.zStakingFields,
|
|
1369
1198
|
POLKADOT_SPEC.zStakingFields,
|
|
@@ -1371,20 +1200,22 @@ z13.discriminatedUnion("type", [
|
|
|
1371
1200
|
SUI_SPEC.zStakingFields,
|
|
1372
1201
|
TEZOS_SPEC.zStakingFields
|
|
1373
1202
|
]);
|
|
1374
|
-
|
|
1203
|
+
z14.discriminatedUnion("type", [
|
|
1375
1204
|
ETHEREUM_SPEC.zEstimatedFees,
|
|
1205
|
+
HEDERA_SPEC.zEstimatedFees,
|
|
1376
1206
|
RIPPLE_SPEC.zEstimatedFees,
|
|
1377
1207
|
STELLAR_SPEC.zEstimatedFees,
|
|
1378
1208
|
SUI_SPEC.zEstimatedFees,
|
|
1379
1209
|
TEZOS_SPEC.zEstimatedFees,
|
|
1380
1210
|
TRON_SPEC.zEstimatedFees
|
|
1381
1211
|
]);
|
|
1382
|
-
|
|
1212
|
+
z14.union([
|
|
1383
1213
|
BITCOIN_SPEC.zTransactionType,
|
|
1384
1214
|
CANTON_SPEC.zTransactionType,
|
|
1385
1215
|
CARDANO_SPEC.zTransactionType,
|
|
1386
1216
|
ETHEREUM_SPEC.zTransactionType,
|
|
1387
1217
|
GENERIC_SPEC.zTransactionType,
|
|
1218
|
+
HEDERA_SPEC.zTransactionType,
|
|
1388
1219
|
POLKADOT_SPEC.zTransactionType,
|
|
1389
1220
|
RIPPLE_SPEC.zTransactionType,
|
|
1390
1221
|
SOLANA_SPEC.zTransactionType,
|
|
@@ -1398,6 +1229,7 @@ z13.union([
|
|
|
1398
1229
|
...CANTON_SPEC.zTransactionType.enum,
|
|
1399
1230
|
...CARDANO_SPEC.zTransactionType.enum,
|
|
1400
1231
|
...ETHEREUM_SPEC.zTransactionType.enum,
|
|
1232
|
+
...HEDERA_SPEC.zTransactionType.enum,
|
|
1401
1233
|
...GENERIC_SPEC.zTransactionType.enum,
|
|
1402
1234
|
...POLKADOT_SPEC.zTransactionType.enum,
|
|
1403
1235
|
...RIPPLE_SPEC.zTransactionType.enum,
|
|
@@ -1412,12 +1244,13 @@ z13.union([
|
|
|
1412
1244
|
// TODO: Sometimes `NetworkFamily` is not a `TransactionType` prefix - but why?
|
|
1413
1245
|
[NetworkFamily.GENERIC_LIKE]: "GENERIC"
|
|
1414
1246
|
});
|
|
1415
|
-
var zTransactionData =
|
|
1247
|
+
var zTransactionData = z14.discriminatedUnion("type", [
|
|
1416
1248
|
...BITCOIN_SPEC.zTransactionData.options,
|
|
1417
1249
|
...CANTON_SPEC.zTransactionData.options,
|
|
1418
1250
|
...CARDANO_SPEC.zTransactionData.options,
|
|
1419
1251
|
...ETHEREUM_SPEC.zTransactionData.options,
|
|
1420
1252
|
...GENERIC_SPEC.zTransactionData.options,
|
|
1253
|
+
...HEDERA_SPEC.zTransactionData.options,
|
|
1421
1254
|
...POLKADOT_SPEC.zTransactionData.options,
|
|
1422
1255
|
...RIPPLE_SPEC.zTransactionData.options,
|
|
1423
1256
|
...SOLANA_SPEC.zTransactionData.options,
|
|
@@ -1426,11 +1259,12 @@ var zTransactionData = z13.discriminatedUnion("type", [
|
|
|
1426
1259
|
...TEZOS_SPEC.zTransactionData.options,
|
|
1427
1260
|
...TRON_SPEC.zTransactionData.options
|
|
1428
1261
|
]);
|
|
1429
|
-
var zSendOnlyTransactionData =
|
|
1262
|
+
var zSendOnlyTransactionData = z14.discriminatedUnion("type", [
|
|
1430
1263
|
BITCOIN_SPEC.zSendTransactionData,
|
|
1431
1264
|
CANTON_SPEC.zSendTransactionData,
|
|
1432
1265
|
CARDANO_SPEC.zSendTransactionData,
|
|
1433
1266
|
ETHEREUM_SPEC.zSendTransactionData,
|
|
1267
|
+
HEDERA_SPEC.zSendTransactionData,
|
|
1434
1268
|
POLKADOT_SPEC.zSendTransactionData,
|
|
1435
1269
|
RIPPLE_SPEC.zSendTransactionData,
|
|
1436
1270
|
SOLANA_SPEC.zSendTransactionData,
|
|
@@ -1438,12 +1272,13 @@ var zSendOnlyTransactionData = z13.discriminatedUnion("type", [
|
|
|
1438
1272
|
SUI_SPEC.zSendTransactionData,
|
|
1439
1273
|
TEZOS_SPEC.zSendTransactionData
|
|
1440
1274
|
]);
|
|
1441
|
-
var zTransactionResponse =
|
|
1275
|
+
var zTransactionResponse = z14.discriminatedUnion("type", [
|
|
1442
1276
|
...BITCOIN_SPEC.zTransactionResponse.options,
|
|
1443
1277
|
...CANTON_SPEC.zTransactionResponse.options,
|
|
1444
1278
|
...CARDANO_SPEC.zTransactionResponse.options,
|
|
1445
1279
|
...ETHEREUM_SPEC.zTransactionResponse.options,
|
|
1446
1280
|
...GENERIC_SPEC.zTransactionResponse.options,
|
|
1281
|
+
...HEDERA_SPEC.zTransactionResponse.options,
|
|
1447
1282
|
...POLKADOT_SPEC.zTransactionResponse.options,
|
|
1448
1283
|
...RIPPLE_SPEC.zTransactionResponse.options,
|
|
1449
1284
|
...SOLANA_SPEC.zTransactionResponse.options,
|
|
@@ -1452,6 +1287,326 @@ var zTransactionResponse = z13.discriminatedUnion("type", [
|
|
|
1452
1287
|
...TEZOS_SPEC.zTransactionResponse.options,
|
|
1453
1288
|
...TRON_SPEC.zTransactionResponse.options
|
|
1454
1289
|
]);
|
|
1290
|
+
|
|
1291
|
+
// src/errors.ts
|
|
1292
|
+
var ValidationError = class extends Error {
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
// src/sync-utils.ts
|
|
1296
|
+
var GATE_SYNC_ID_PREFIX = "gate://";
|
|
1297
|
+
var buildGateSyncId = (workspaceName, gateType, gateId) => {
|
|
1298
|
+
if (gateId <= 0) {
|
|
1299
|
+
throw new ValidationError(`Invalid gate ID: ${gateId}`);
|
|
1300
|
+
}
|
|
1301
|
+
return `${GATE_SYNC_ID_PREFIX}${workspaceName}/${gateType}/${gateId}`;
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
// src/utils.ts
|
|
1305
|
+
var isRecord = (value) => isPlainObject(value);
|
|
1306
|
+
var ensureNonEmptyArray = (values, message) => {
|
|
1307
|
+
invariant8(
|
|
1308
|
+
values.length > 0,
|
|
1309
|
+
`Expected non-empty array but got one with length ${values.length}`
|
|
1310
|
+
);
|
|
1311
|
+
return values;
|
|
1312
|
+
};
|
|
1313
|
+
function unreachable(value) {
|
|
1314
|
+
throw new Error(`Un-covered: ${value}`);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
// src/__fakes__/faker-utils.ts
|
|
1318
|
+
var fakeUniqueName = (length = 20) => faker.string.alphanumeric({ length, casing: "lower" });
|
|
1319
|
+
var fakeHexString = (length, casing = "upper") => faker.string.hexadecimal({ prefix: "", casing, length });
|
|
1320
|
+
var fakePubKey = () => fakeHexString(130);
|
|
1321
|
+
var fakeIntegerId = () => faker.number.int({ min: 1, max: 2e9 });
|
|
1322
|
+
var fakeGateId = fakeIntegerId;
|
|
1323
|
+
var fakeBase64String = (length) => btoa(faker.string.sample(length));
|
|
1324
|
+
var fakePsdSignature = () => fakeBase64String(100);
|
|
1325
|
+
var fakeJws = () => times(3, () => faker.string.hexadecimal({ prefix: "", length: 100 })).join(".");
|
|
1326
|
+
var fakeHsmObjectId = () => faker.string.uuid();
|
|
1327
|
+
var fakeHsmCertificate = () => ({
|
|
1328
|
+
codeHash: fakeBase64String(10),
|
|
1329
|
+
attestationPub: fakeBase64String(20),
|
|
1330
|
+
certificate: fakeBase64String(20),
|
|
1331
|
+
signature: fakeBase64String(20)
|
|
1332
|
+
});
|
|
1333
|
+
var fakePsdChallenge = () => ({
|
|
1334
|
+
challengeType: "PSD",
|
|
1335
|
+
wActions: [fakeBase64String(50), fakeBase64String(50), fakeBase64String(50)],
|
|
1336
|
+
handshake: fakeBase64String(100),
|
|
1337
|
+
handshakeAttestation: fakeHsmCertificate(),
|
|
1338
|
+
partitionId: fakeBase64String(20)
|
|
1339
|
+
});
|
|
1340
|
+
var fakeWorkspaceName = () => faker.string.alphanumeric({ length: 16, casing: "lower" });
|
|
1341
|
+
|
|
1342
|
+
// src/__fakes__/canton.ts
|
|
1343
|
+
var fakeCantonAddress = (role) => `${role}-${faker.lorem.word()}::${fakeHexString(68, "lower")}`;
|
|
1344
|
+
var fakeCantonPartyId = () => fakeCantonAddress("party");
|
|
1345
|
+
var injectSyncId = (obj) => {
|
|
1346
|
+
let { syncId } = obj;
|
|
1347
|
+
if (syncId === void 0) {
|
|
1348
|
+
if (obj.gateType !== null && obj.gateId !== 0) {
|
|
1349
|
+
syncId = buildGateSyncId(obj.workspaceName, obj.gateType, obj.gateId);
|
|
1350
|
+
} else if (obj.gateType === null && obj.gateId === 0) {
|
|
1351
|
+
syncId = faker.string.uuid();
|
|
1352
|
+
} else {
|
|
1353
|
+
throw new Error(`Invalid gateType and gateId: ${obj.gateType}, ${obj.gateId}`);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
return { ...obj, syncId };
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
// src/__fakes__/models/accounts.ts
|
|
1360
|
+
var WELL_KNOWN_NETWORKS_BY_FAMILY = {
|
|
1361
|
+
[NetworkFamily.BITCOIN_LIKE]: ["bitcoin", "bitcoin_testnet"],
|
|
1362
|
+
[NetworkFamily.CANTON_LIKE]: ["canton_network"],
|
|
1363
|
+
[NetworkFamily.CARDANO_LIKE]: ["cardano"],
|
|
1364
|
+
[NetworkFamily.ETHEREUM_LIKE]: ["ethereum", "ethereum_goerli"],
|
|
1365
|
+
[NetworkFamily.HEDERA_LIKE]: ["hedera"],
|
|
1366
|
+
[NetworkFamily.POLKADOT_LIKE]: ["polkadot"],
|
|
1367
|
+
[NetworkFamily.RIPPLE_LIKE]: ["ripple"],
|
|
1368
|
+
[NetworkFamily.SOLANA_LIKE]: ["solana"],
|
|
1369
|
+
[NetworkFamily.STELLAR_LIKE]: ["stellar"],
|
|
1370
|
+
[NetworkFamily.SUI_LIKE]: ["sui"],
|
|
1371
|
+
[NetworkFamily.TEZOS_LIKE]: ["tezos"],
|
|
1372
|
+
[NetworkFamily.TRON_LIKE]: ["tron"],
|
|
1373
|
+
[NetworkFamily.GENERIC_LIKE]: ["cosmos"]
|
|
1374
|
+
};
|
|
1375
|
+
var genConsistentAccountType = (opts) => {
|
|
1376
|
+
if (opts?.type !== void 0) {
|
|
1377
|
+
return opts.type;
|
|
1378
|
+
}
|
|
1379
|
+
if (opts?.currency !== void 0) {
|
|
1380
|
+
for (const [family, currencies] of Object.entries(WELL_KNOWN_NETWORKS_BY_FAMILY)) {
|
|
1381
|
+
if (currencies.includes(opts.currency)) {
|
|
1382
|
+
return family;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return faker.helpers.arrayElement(Object.values(AccountType));
|
|
1387
|
+
};
|
|
1388
|
+
var genAssetFieldsForType = (type) => {
|
|
1389
|
+
const currency = faker.helpers.arrayElement(
|
|
1390
|
+
type === "RAW_SIGNING" ? ["ethereum", "bitcoin"] : WELL_KNOWN_NETWORKS_BY_FAMILY[type]
|
|
1391
|
+
);
|
|
1392
|
+
const hsmXpub = fakeHexString(66, "upper");
|
|
1393
|
+
const hsmChainCode = fakeHexString(64, "upper");
|
|
1394
|
+
switch (type) {
|
|
1395
|
+
case "BITCOIN_LIKE":
|
|
1396
|
+
return {
|
|
1397
|
+
type,
|
|
1398
|
+
currency,
|
|
1399
|
+
derivationPath: "84'/0'/0'",
|
|
1400
|
+
address: null,
|
|
1401
|
+
contractAddress: null,
|
|
1402
|
+
xpub: fakeHexString(120),
|
|
1403
|
+
hsmXpub,
|
|
1404
|
+
hsmChainCode
|
|
1405
|
+
};
|
|
1406
|
+
case "ETHEREUM_LIKE":
|
|
1407
|
+
return {
|
|
1408
|
+
type,
|
|
1409
|
+
currency,
|
|
1410
|
+
derivationPath: "44'/60'/0'",
|
|
1411
|
+
address: faker.finance.ethereumAddress(),
|
|
1412
|
+
contractAddress: null,
|
|
1413
|
+
xpub: null,
|
|
1414
|
+
hsmXpub,
|
|
1415
|
+
hsmChainCode
|
|
1416
|
+
};
|
|
1417
|
+
case "CANTON_LIKE":
|
|
1418
|
+
return {
|
|
1419
|
+
type,
|
|
1420
|
+
currency,
|
|
1421
|
+
derivationPath: "44'/6767'/0'/0'/0'",
|
|
1422
|
+
address: fakeCantonPartyId(),
|
|
1423
|
+
contractAddress: null,
|
|
1424
|
+
xpub: null,
|
|
1425
|
+
hsmXpub,
|
|
1426
|
+
hsmChainCode: null
|
|
1427
|
+
};
|
|
1428
|
+
case "CARDANO_LIKE":
|
|
1429
|
+
return {
|
|
1430
|
+
type,
|
|
1431
|
+
currency,
|
|
1432
|
+
derivationPath: "1852'/1815'/0'",
|
|
1433
|
+
address: `addr${faker.string.alphanumeric({ length: 100, casing: "lower" })}`,
|
|
1434
|
+
contractAddress: null,
|
|
1435
|
+
xpub: null,
|
|
1436
|
+
hsmXpub,
|
|
1437
|
+
hsmChainCode
|
|
1438
|
+
};
|
|
1439
|
+
case "SOLANA_LIKE":
|
|
1440
|
+
return {
|
|
1441
|
+
type,
|
|
1442
|
+
currency,
|
|
1443
|
+
derivationPath: "44'/501'/0'",
|
|
1444
|
+
address: faker.string.alphanumeric({ length: 44, casing: "lower" }),
|
|
1445
|
+
contractAddress: null,
|
|
1446
|
+
xpub: null,
|
|
1447
|
+
hsmXpub,
|
|
1448
|
+
hsmChainCode: null
|
|
1449
|
+
};
|
|
1450
|
+
case "TEZOS_LIKE":
|
|
1451
|
+
return {
|
|
1452
|
+
type,
|
|
1453
|
+
currency,
|
|
1454
|
+
derivationPath: "44'/1729'/0'",
|
|
1455
|
+
address: `tz${faker.string.alphanumeric({ length: 34, casing: "mixed" })}`,
|
|
1456
|
+
contractAddress: null,
|
|
1457
|
+
xpub: null,
|
|
1458
|
+
hsmXpub,
|
|
1459
|
+
hsmChainCode
|
|
1460
|
+
};
|
|
1461
|
+
case "STELLAR_LIKE":
|
|
1462
|
+
return {
|
|
1463
|
+
type,
|
|
1464
|
+
currency,
|
|
1465
|
+
derivationPath: "44'/148'/0'",
|
|
1466
|
+
address: faker.string.alphanumeric({ length: 56, casing: "upper" }),
|
|
1467
|
+
contractAddress: null,
|
|
1468
|
+
xpub: null,
|
|
1469
|
+
hsmXpub,
|
|
1470
|
+
hsmChainCode
|
|
1471
|
+
};
|
|
1472
|
+
case "RIPPLE_LIKE":
|
|
1473
|
+
return {
|
|
1474
|
+
type,
|
|
1475
|
+
currency,
|
|
1476
|
+
derivationPath: "44'/144'/0'",
|
|
1477
|
+
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
1478
|
+
contractAddress: null,
|
|
1479
|
+
xpub: `xpub${faker.string.alphanumeric({ length: 107, casing: "mixed" })}`,
|
|
1480
|
+
hsmXpub,
|
|
1481
|
+
hsmChainCode
|
|
1482
|
+
};
|
|
1483
|
+
case "POLKADOT_LIKE":
|
|
1484
|
+
return {
|
|
1485
|
+
type,
|
|
1486
|
+
currency,
|
|
1487
|
+
derivationPath: "44'/354'/0'",
|
|
1488
|
+
address: faker.string.alphanumeric({ length: 48, casing: "mixed" }),
|
|
1489
|
+
contractAddress: null,
|
|
1490
|
+
xpub: null,
|
|
1491
|
+
hsmXpub,
|
|
1492
|
+
hsmChainCode: null
|
|
1493
|
+
};
|
|
1494
|
+
case "TRON_LIKE":
|
|
1495
|
+
return {
|
|
1496
|
+
type,
|
|
1497
|
+
currency,
|
|
1498
|
+
derivationPath: "44'/195'/0'",
|
|
1499
|
+
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
1500
|
+
contractAddress: null,
|
|
1501
|
+
xpub: null,
|
|
1502
|
+
hsmXpub,
|
|
1503
|
+
hsmChainCode
|
|
1504
|
+
};
|
|
1505
|
+
case "SUI_LIKE":
|
|
1506
|
+
return {
|
|
1507
|
+
type,
|
|
1508
|
+
currency,
|
|
1509
|
+
derivationPath: "44'/784'/0'",
|
|
1510
|
+
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
1511
|
+
contractAddress: null,
|
|
1512
|
+
xpub: null,
|
|
1513
|
+
hsmXpub,
|
|
1514
|
+
hsmChainCode: null
|
|
1515
|
+
};
|
|
1516
|
+
case "HEDERA_LIKE":
|
|
1517
|
+
return {
|
|
1518
|
+
type,
|
|
1519
|
+
currency,
|
|
1520
|
+
derivationPath: "44'/3030'/0'",
|
|
1521
|
+
address: faker.string.hexadecimal({ length: 34, casing: "mixed" }),
|
|
1522
|
+
contractAddress: null,
|
|
1523
|
+
xpub: null,
|
|
1524
|
+
hsmXpub,
|
|
1525
|
+
hsmChainCode
|
|
1526
|
+
};
|
|
1527
|
+
case "GENERIC_LIKE":
|
|
1528
|
+
return {
|
|
1529
|
+
type,
|
|
1530
|
+
currency,
|
|
1531
|
+
derivationPath: "44'/118'/0'",
|
|
1532
|
+
address: faker.string.alphanumeric({ length: 34, casing: "mixed" }),
|
|
1533
|
+
contractAddress: null,
|
|
1534
|
+
xpub: null,
|
|
1535
|
+
hsmXpub,
|
|
1536
|
+
hsmChainCode
|
|
1537
|
+
};
|
|
1538
|
+
case "RAW_SIGNING":
|
|
1539
|
+
return {
|
|
1540
|
+
type,
|
|
1541
|
+
currency,
|
|
1542
|
+
derivationPath: "44'/118'/0'",
|
|
1543
|
+
address: null,
|
|
1544
|
+
contractAddress: null,
|
|
1545
|
+
xpub: null,
|
|
1546
|
+
hsmXpub,
|
|
1547
|
+
hsmChainCode
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
var genGovernanceFieldsForType = (governanceType, {
|
|
1552
|
+
accountId,
|
|
1553
|
+
policyId,
|
|
1554
|
+
assetManagerId
|
|
1555
|
+
}) => {
|
|
1556
|
+
switch (governanceType) {
|
|
1557
|
+
case AccountGovernanceType.CLASSIC:
|
|
1558
|
+
case AccountGovernanceType.RAW_SIGNING:
|
|
1559
|
+
return {
|
|
1560
|
+
governanceType,
|
|
1561
|
+
classicGovernanceMixin: {
|
|
1562
|
+
id: faker.number.int(),
|
|
1563
|
+
policyId: policyId ?? faker.string.uuid(),
|
|
1564
|
+
accountId
|
|
1565
|
+
},
|
|
1566
|
+
tradelinkGovernanceMixin: null
|
|
1567
|
+
};
|
|
1568
|
+
case AccountGovernanceType.TRADELINK:
|
|
1569
|
+
return {
|
|
1570
|
+
governanceType,
|
|
1571
|
+
classicGovernanceMixin: null,
|
|
1572
|
+
tradelinkGovernanceMixin: {
|
|
1573
|
+
id: faker.number.int(),
|
|
1574
|
+
assetManagerId: assetManagerId ?? faker.string.uuid(),
|
|
1575
|
+
accountId,
|
|
1576
|
+
exchangeConfigs: [],
|
|
1577
|
+
status: ActivationStatus.ACTIVE
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
var genAccount = (opts) => {
|
|
1583
|
+
const { policyId, assetManagerId, withLesWalletId, ...rest } = opts ?? {};
|
|
1584
|
+
const commonFields = {
|
|
1585
|
+
id: faker.string.uuid(),
|
|
1586
|
+
workspaceName: fakeWorkspaceName(),
|
|
1587
|
+
name: fakeUniqueName(),
|
|
1588
|
+
hsmId: fakeHsmObjectId(),
|
|
1589
|
+
status: ActivationStatus.ACTIVE,
|
|
1590
|
+
index: faker.number.int({ min: 0, max: 10 }),
|
|
1591
|
+
gateId: fakeGateId(),
|
|
1592
|
+
gateType: GateAccountType.Account,
|
|
1593
|
+
lesWalletId: withLesWalletId ?? true ? faker.string.uuid() : null,
|
|
1594
|
+
createdAt: faker.date.past(),
|
|
1595
|
+
updatedAt: faker.date.past()
|
|
1596
|
+
};
|
|
1597
|
+
const type = genConsistentAccountType(rest);
|
|
1598
|
+
const assetFields = genAssetFieldsForType(type);
|
|
1599
|
+
const governanceFields = genGovernanceFieldsForType(
|
|
1600
|
+
opts?.governanceType ?? faker.helpers.arrayElement(Object.values(AccountGovernanceType)),
|
|
1601
|
+
{ accountId: commonFields.id, policyId, assetManagerId }
|
|
1602
|
+
);
|
|
1603
|
+
return injectSyncId({
|
|
1604
|
+
...commonFields,
|
|
1605
|
+
...governanceFields,
|
|
1606
|
+
...assetFields,
|
|
1607
|
+
...rest
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1455
1610
|
var shouldHaveTargetHsmId = (request) => {
|
|
1456
1611
|
switch (request.type) {
|
|
1457
1612
|
case RequestType.CREATE_ENTITY:
|
|
@@ -1591,6 +1746,9 @@ var genVaultRequestReview = (opts) => {
|
|
|
1591
1746
|
case ChallengeType.API:
|
|
1592
1747
|
signature = fakeJws();
|
|
1593
1748
|
break;
|
|
1749
|
+
case ChallengeType.SOFT:
|
|
1750
|
+
signature = "";
|
|
1751
|
+
break;
|
|
1594
1752
|
}
|
|
1595
1753
|
}
|
|
1596
1754
|
return {
|
|
@@ -1634,15 +1792,15 @@ var zApiChallenge = z.object({
|
|
|
1634
1792
|
reject: z.string().meta({ description: "JSON payload to sign (as JWS) to reject" })
|
|
1635
1793
|
}).meta({ description: "JSON payload to approve and to reject" })
|
|
1636
1794
|
});
|
|
1637
|
-
var
|
|
1795
|
+
var zHsmChallenge = z.discriminatedUnion("challengeType", [
|
|
1638
1796
|
zPsdChallenge.meta({ description: "Necessary data to approve on a PSD" }),
|
|
1639
1797
|
zApiChallenge.meta({ description: "Necessary data for approval by an API user" })
|
|
1640
1798
|
]);
|
|
1641
|
-
var zHsmChallengeGroup = z.record(zPubKey,
|
|
1799
|
+
var zHsmChallengeGroup = z.record(zPubKey, zHsmChallenge);
|
|
1642
1800
|
var zHsmChallengeSteps = z.array(zHsmChallengeGroup);
|
|
1643
1801
|
var zPsdSignature = z.string().min(1).meta({ description: "Signature from PSD" });
|
|
1644
1802
|
var zApiSignature = z.string().min(1).meta({ description: "Signature from API (JWS)" });
|
|
1645
|
-
var
|
|
1803
|
+
var zHsmProof = z.discriminatedUnion("challengeType", [
|
|
1646
1804
|
z.object({
|
|
1647
1805
|
challengeType: z.literal(ChallengeType.PSD),
|
|
1648
1806
|
signature: zPsdSignature
|
|
@@ -1652,7 +1810,7 @@ var zUserApproval = z.discriminatedUnion("challengeType", [
|
|
|
1652
1810
|
signature: zApiSignature
|
|
1653
1811
|
})
|
|
1654
1812
|
]);
|
|
1655
|
-
var zHsmApprovalGroup = z.record(zPubKey,
|
|
1813
|
+
var zHsmApprovalGroup = z.record(zPubKey, zHsmProof);
|
|
1656
1814
|
z.array(zHsmApprovalGroup);
|
|
1657
1815
|
z.object({
|
|
1658
1816
|
stageName: z.string(),
|
|
@@ -1715,7 +1873,7 @@ var zHsmSignature = z.object({
|
|
|
1715
1873
|
}),
|
|
1716
1874
|
pubkey: zHexString.nullable().meta({ description: "Public key for signature verification, 32 or 33 bytes" })
|
|
1717
1875
|
});
|
|
1718
|
-
var zWorkspaceName =
|
|
1876
|
+
var zWorkspaceName = z14.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
1719
1877
|
var zUserName = z.string().min(1).max(19).meta({ description: "User name" });
|
|
1720
1878
|
var zUserRegistrationCreateInput = z.object({
|
|
1721
1879
|
name: zUserName,
|
|
@@ -1731,22 +1889,22 @@ zUserRegistrationCreateInput.extend({
|
|
|
1731
1889
|
});
|
|
1732
1890
|
|
|
1733
1891
|
// src/users/request-data.ts
|
|
1734
|
-
var zCreatePsdUserRequestData =
|
|
1735
|
-
registrationId:
|
|
1892
|
+
var zCreatePsdUserRequestData = z14.object({
|
|
1893
|
+
registrationId: z14.string().meta({ description: "User registration ID" })
|
|
1736
1894
|
});
|
|
1737
|
-
var zCreateApiUserRequestData =
|
|
1895
|
+
var zCreateApiUserRequestData = z14.object({
|
|
1738
1896
|
name: zUserName,
|
|
1739
|
-
pubKey:
|
|
1740
|
-
role:
|
|
1741
|
-
viewAll:
|
|
1897
|
+
pubKey: z14.string().meta({ description: "Public key" }),
|
|
1898
|
+
role: z14.enum(["ADMIN", "OPERATOR"]).meta({ description: "User role" }),
|
|
1899
|
+
viewAll: z14.boolean().meta({ description: "View all data" }).optional()
|
|
1742
1900
|
}).meta({ description: "Create API user request data" });
|
|
1743
|
-
var zCreateApiUserAccessRequestData =
|
|
1901
|
+
var zCreateApiUserAccessRequestData = z14.object({
|
|
1744
1902
|
name: zUserName
|
|
1745
1903
|
}).meta({ description: "Create API user credential request data" });
|
|
1746
|
-
|
|
1747
|
-
authUserId:
|
|
1904
|
+
z14.object({
|
|
1905
|
+
authUserId: z14.string().meta({ description: "Authentication broker ID" })
|
|
1748
1906
|
}).meta({ description: "Managed data for API user" });
|
|
1749
|
-
var zRevokeUserRequestData =
|
|
1907
|
+
var zRevokeUserRequestData = z14.object({});
|
|
1750
1908
|
var zReviewStepWithUsers = z.object({
|
|
1751
1909
|
quorum: z.number().min(0).meta({ description: "Number of required approvals for the step" }),
|
|
1752
1910
|
userIds: z.array(z.string().min(1)).meta({ description: "User ids in the step" })
|
|
@@ -1772,30 +1930,38 @@ __export(policy_exports, {
|
|
|
1772
1930
|
zThreshold: () => zThreshold,
|
|
1773
1931
|
zWhitelistIds: () => zWhitelistIds
|
|
1774
1932
|
});
|
|
1775
|
-
var zNote =
|
|
1776
|
-
title:
|
|
1777
|
-
content:
|
|
1933
|
+
var zNote = z14.object({
|
|
1934
|
+
title: z14.string().meta({ description: "Note title" }),
|
|
1935
|
+
content: z14.string().meta({ description: "Note content" })
|
|
1778
1936
|
});
|
|
1779
|
-
var
|
|
1937
|
+
var zValueTransactionAction = z.enum([
|
|
1780
1938
|
AllowedAction.SEND,
|
|
1781
1939
|
AllowedAction.STAKE,
|
|
1782
1940
|
AllowedAction.DEPLOY_CONTRACT,
|
|
1783
1941
|
AllowedAction.EXECUTE_CONTRACT,
|
|
1784
|
-
AllowedAction.ACTIVATE_TOKEN
|
|
1785
|
-
AllowedAction.RECEIVE
|
|
1942
|
+
AllowedAction.ACTIVATE_TOKEN
|
|
1786
1943
|
]);
|
|
1787
|
-
var
|
|
1788
|
-
type:
|
|
1944
|
+
var zValueTransactionIntent = z.object({
|
|
1945
|
+
type: zValueTransactionAction,
|
|
1789
1946
|
currency: zCurrencyString,
|
|
1790
1947
|
recipient: z.string().nonempty(),
|
|
1791
1948
|
destinationTag: z.string().nonempty().optional(),
|
|
1792
1949
|
value: zUnsignedIntString
|
|
1793
1950
|
});
|
|
1794
|
-
var
|
|
1795
|
-
var
|
|
1796
|
-
type:
|
|
1951
|
+
var zReceiveAction = z.enum([AllowedAction.RECEIVE]);
|
|
1952
|
+
var zReceiveIntent = z.object({
|
|
1953
|
+
type: zReceiveAction,
|
|
1954
|
+
currency: zCurrencyString,
|
|
1955
|
+
sender: z.string().nonempty(),
|
|
1956
|
+
value: zUnsignedIntString.nullable(),
|
|
1957
|
+
// null means "any value"
|
|
1958
|
+
verdict: z.enum(["ACCEPT", "REJECT"])
|
|
1959
|
+
});
|
|
1960
|
+
var zSigningAction = z.enum([AllowedAction.SIGN_MESSAGE, AllowedAction.SIGN_DIGESTS]);
|
|
1961
|
+
var zSigningIntent = z.object({
|
|
1962
|
+
type: zSigningAction
|
|
1797
1963
|
});
|
|
1798
|
-
var
|
|
1964
|
+
var zClassicAction = z.enum([
|
|
1799
1965
|
AllowedAction.SEND,
|
|
1800
1966
|
AllowedAction.STAKE,
|
|
1801
1967
|
AllowedAction.DEPLOY_CONTRACT,
|
|
@@ -1805,13 +1971,15 @@ var zClassicOperationType = z.enum([
|
|
|
1805
1971
|
AllowedAction.RECEIVE
|
|
1806
1972
|
]);
|
|
1807
1973
|
z.enum([AllowedAction.SIGN_DIGESTS]);
|
|
1808
|
-
var
|
|
1809
|
-
...
|
|
1810
|
-
...
|
|
1974
|
+
var zGovernableAction = z.enum([
|
|
1975
|
+
...zValueTransactionAction.options,
|
|
1976
|
+
...zReceiveAction.options,
|
|
1977
|
+
...zSigningAction.options
|
|
1811
1978
|
]);
|
|
1812
1979
|
z.discriminatedUnion("type", [
|
|
1813
|
-
|
|
1814
|
-
|
|
1980
|
+
zValueTransactionIntent,
|
|
1981
|
+
zReceiveIntent,
|
|
1982
|
+
zSigningIntent
|
|
1815
1983
|
]);
|
|
1816
1984
|
|
|
1817
1985
|
// src/prisma-utils/policy.ts
|
|
@@ -1821,8 +1989,8 @@ var zThreshold = z.object({
|
|
|
1821
1989
|
}).meta({ description: "Threshold for the transaction value" });
|
|
1822
1990
|
var zWhitelistIds = z.array(z.string().min(1)).meta({ description: "IDs of whitelists for the recipient address" });
|
|
1823
1991
|
var zGovRuleJsonObject = z.object({
|
|
1824
|
-
// Required.
|
|
1825
|
-
operationType:
|
|
1992
|
+
// Required. TODO: Rename to `action`
|
|
1993
|
+
operationType: zGovernableAction.meta({ description: "Allowed action" }),
|
|
1826
1994
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1827
1995
|
threshold: zThreshold,
|
|
1828
1996
|
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
@@ -1848,70 +2016,94 @@ var INCLUDE_MEMBERS = {
|
|
|
1848
2016
|
include: { members: true }
|
|
1849
2017
|
}
|
|
1850
2018
|
};
|
|
1851
|
-
var zUpdateQuorumRequestData =
|
|
1852
|
-
quorum:
|
|
2019
|
+
var zUpdateQuorumRequestData = z14.object({
|
|
2020
|
+
quorum: z14.number().int().min(2).meta({ description: "Workspace quorum" })
|
|
1853
2021
|
});
|
|
1854
2022
|
var NonRootAdminPermission = omit(AdminPermission, "ROOT");
|
|
1855
|
-
var zWorkspaceRuleRequestData =
|
|
1856
|
-
permission:
|
|
2023
|
+
var zWorkspaceRuleRequestData = z14.object({
|
|
2024
|
+
permission: z14.enum(NonRootAdminPermission).meta({ description: "Granted permissions" }),
|
|
1857
2025
|
reviewConfig: zReviewStepWithUsersArray.meta({ description: "List of admin review steps" })
|
|
1858
2026
|
});
|
|
1859
|
-
|
|
2027
|
+
z14.discriminatedUnion(
|
|
1860
2028
|
zTransactionResponse._zod.def.discriminator,
|
|
1861
2029
|
ensureNonEmptyArray(
|
|
1862
2030
|
zTransactionResponse.options.map((_) => _.extend({ note: zNote.nullable() }))
|
|
1863
2031
|
)
|
|
1864
2032
|
);
|
|
1865
|
-
|
|
1866
|
-
|
|
2033
|
+
|
|
2034
|
+
// src/accounts/les-wallet/canton-extras.ts
|
|
2035
|
+
var canton_extras_exports = {};
|
|
2036
|
+
__export(canton_extras_exports, {
|
|
2037
|
+
zPreApprovalState: () => zPreApprovalState,
|
|
2038
|
+
zTransferProposal: () => zTransferProposal
|
|
2039
|
+
});
|
|
2040
|
+
var zPreApprovalState = z14.discriminatedUnion("enabled", [
|
|
2041
|
+
z14.object({
|
|
2042
|
+
enabled: z14.literal(true).meta({ description: "Pre-approval is enabled" }),
|
|
2043
|
+
contractId: z14.string().meta({ description: "ID of the pre-approval contract" }),
|
|
2044
|
+
expiresAt: z14.coerce.date().meta({ description: "Timestamp when the pre-approval expires and becomes invalid" }),
|
|
2045
|
+
lastRenewedAt: z14.coerce.date().meta({ description: "Timestamp of the most recent renewal of the pre-approval" }),
|
|
2046
|
+
provider: z14.string().meta({ description: "Validator that issued and manages the pre-approval" }),
|
|
2047
|
+
recipient: z14.string().meta({ description: "Party that authorizes the pre-approval to receive transfers" }),
|
|
2048
|
+
validFrom: z14.coerce.date().meta({ description: "Timestamp when the pre-approval becomes effective" })
|
|
2049
|
+
}),
|
|
2050
|
+
z14.object({
|
|
2051
|
+
enabled: z14.literal(false).meta({ description: "Pre-approval is not enabled" })
|
|
2052
|
+
})
|
|
2053
|
+
]).meta({
|
|
2054
|
+
description: "Pre-approval state of the account"
|
|
2055
|
+
});
|
|
2056
|
+
var zTransferProposal = zCantonTransferProposal;
|
|
2057
|
+
var zTradelinkWhitelistAddress = z14.object({
|
|
2058
|
+
name: z14.string().min(1),
|
|
1867
2059
|
currency: zCurrencyString,
|
|
1868
|
-
address:
|
|
2060
|
+
address: z14.string().min(1)
|
|
1869
2061
|
});
|
|
1870
|
-
|
|
1871
|
-
var zTradelinkId =
|
|
1872
|
-
var zTradelinkOrgEntityResponse =
|
|
2062
|
+
z14.array(zTradelinkWhitelistAddress);
|
|
2063
|
+
var zTradelinkId = z14.string().meta({ description: "Unique identifier in Tradelink service" });
|
|
2064
|
+
var zTradelinkOrgEntityResponse = z14.object({
|
|
1873
2065
|
tradelinkId: zTradelinkId,
|
|
1874
|
-
name:
|
|
1875
|
-
code:
|
|
1876
|
-
logoUrl:
|
|
2066
|
+
name: z14.string().meta({ description: "Name" }),
|
|
2067
|
+
code: z14.string().meta({ description: "Code" }),
|
|
2068
|
+
logoUrl: z14.string().meta({ description: "Logo URL" })
|
|
1877
2069
|
});
|
|
1878
2070
|
zTradelinkOrgEntityResponse.omit({
|
|
1879
2071
|
tradelinkId: true
|
|
1880
2072
|
});
|
|
1881
|
-
|
|
2073
|
+
z14.object({
|
|
1882
2074
|
tradelinkId: zTradelinkId
|
|
1883
2075
|
});
|
|
1884
|
-
var zTradelinkExchangeConfig =
|
|
1885
|
-
exchangeId:
|
|
1886
|
-
repledgeAuthorized:
|
|
2076
|
+
var zTradelinkExchangeConfig = z14.object({
|
|
2077
|
+
exchangeId: z14.string().meta({ description: "Tradelink exchange id" }),
|
|
2078
|
+
repledgeAuthorized: z14.boolean().meta({
|
|
1887
2079
|
description: "Determines whether this exchange is authorized to repledge on this account"
|
|
1888
2080
|
}),
|
|
1889
|
-
needsAssetManagerApprovalForSettlements:
|
|
2081
|
+
needsAssetManagerApprovalForSettlements: z14.boolean().meta({
|
|
1890
2082
|
description: 'Determines whether asset manager will "pre-approve" the settlement requests on this account'
|
|
1891
2083
|
})
|
|
1892
2084
|
});
|
|
1893
|
-
var zTradelinkExchangeConfigs =
|
|
1894
|
-
|
|
2085
|
+
var zTradelinkExchangeConfigs = z14.array(zTradelinkExchangeConfig);
|
|
2086
|
+
z14.object({
|
|
1895
2087
|
workspaceName: zWorkspaceName,
|
|
1896
|
-
custodian:
|
|
1897
|
-
assetManagers:
|
|
1898
|
-
exchanges:
|
|
2088
|
+
custodian: z14.object({ name: z14.string() }),
|
|
2089
|
+
assetManagers: z14.array(z14.object({ name: z14.string() })),
|
|
2090
|
+
exchanges: z14.array(z14.object({ name: z14.string() }))
|
|
1899
2091
|
});
|
|
1900
|
-
|
|
1901
|
-
tradelinkId:
|
|
2092
|
+
z14.object({
|
|
2093
|
+
tradelinkId: z14.string(),
|
|
1902
2094
|
workspaceName: zWorkspaceName,
|
|
1903
2095
|
custodian: zTradelinkOrgEntityResponse,
|
|
1904
|
-
assetManagers:
|
|
1905
|
-
exchanges:
|
|
2096
|
+
assetManagers: z14.array(zTradelinkOrgEntityResponse),
|
|
2097
|
+
exchanges: z14.array(zTradelinkOrgEntityResponse)
|
|
1906
2098
|
});
|
|
1907
|
-
var zTradelinkAsset =
|
|
1908
|
-
name:
|
|
1909
|
-
magnitude:
|
|
2099
|
+
var zTradelinkAsset = z14.object({
|
|
2100
|
+
name: z14.string(),
|
|
2101
|
+
magnitude: z14.number().int().nonnegative()
|
|
1910
2102
|
});
|
|
1911
|
-
|
|
2103
|
+
z14.object({
|
|
1912
2104
|
tradelinkId: zTradelinkId,
|
|
1913
2105
|
asset: zTradelinkAsset,
|
|
1914
|
-
state:
|
|
2106
|
+
state: z14.enum([
|
|
1915
2107
|
"PLEDGE_READY",
|
|
1916
2108
|
"PLEDGE_INCREMENT_PENDING_APPROVAL",
|
|
1917
2109
|
"PLEDGE_APPROVED",
|
|
@@ -1928,28 +2120,28 @@ z13.object({
|
|
|
1928
2120
|
"RECOVERING_FROM_FAILURE",
|
|
1929
2121
|
"PLEDGE_CONSUMED"
|
|
1930
2122
|
]),
|
|
1931
|
-
isLocked:
|
|
1932
|
-
amount:
|
|
1933
|
-
pending:
|
|
1934
|
-
repledge:
|
|
1935
|
-
exchangeTradelinkId:
|
|
1936
|
-
accountId:
|
|
1937
|
-
});
|
|
1938
|
-
|
|
1939
|
-
workspaceName:
|
|
1940
|
-
clientAccountId:
|
|
2123
|
+
isLocked: z14.boolean(),
|
|
2124
|
+
amount: z14.string().meta({ description: "Currently pledged amount" }),
|
|
2125
|
+
pending: z14.string().meta({ description: "Requested pledge increment, not yet approved" }),
|
|
2126
|
+
repledge: z14.string().meta({ description: "TODO: describe this field" }),
|
|
2127
|
+
exchangeTradelinkId: z14.string(),
|
|
2128
|
+
accountId: z14.string()
|
|
2129
|
+
});
|
|
2130
|
+
z14.object({
|
|
2131
|
+
workspaceName: z14.string(),
|
|
2132
|
+
clientAccountId: z14.string().meta({ description: "Account ID from the client side" }),
|
|
1941
2133
|
exchangeTradelinkId: zTradelinkId,
|
|
1942
2134
|
asset: zTradelinkAsset
|
|
1943
2135
|
});
|
|
1944
|
-
|
|
2136
|
+
z14.object({
|
|
1945
2137
|
pledgeTradelinkId: zTradelinkId,
|
|
1946
2138
|
amount: zUnsignedIntString,
|
|
1947
2139
|
asset: zTradelinkAsset
|
|
1948
2140
|
});
|
|
1949
|
-
|
|
1950
|
-
tradelinkId:
|
|
1951
|
-
pledgeTradelinkId:
|
|
1952
|
-
state:
|
|
2141
|
+
z14.object({
|
|
2142
|
+
tradelinkId: z14.string(),
|
|
2143
|
+
pledgeTradelinkId: z14.string(),
|
|
2144
|
+
state: z14.enum([
|
|
1953
2145
|
"REGISTERED",
|
|
1954
2146
|
"PENDING_REPLEDGE_CREATION_APPROVAL",
|
|
1955
2147
|
"PENDING_REPLEDGE_APPROVAL",
|
|
@@ -1963,110 +2155,110 @@ z13.object({
|
|
|
1963
2155
|
"CANCELED"
|
|
1964
2156
|
]),
|
|
1965
2157
|
// For now we only consider the outbound settlement
|
|
1966
|
-
outboundTransactionHash:
|
|
2158
|
+
outboundTransactionHash: z14.string().nullable()
|
|
1967
2159
|
});
|
|
1968
|
-
var zTradelinkActivateAccountRequestData =
|
|
1969
|
-
var zTradelinkCustodianRequestData =
|
|
2160
|
+
var zTradelinkActivateAccountRequestData = z14.null();
|
|
2161
|
+
var zTradelinkCustodianRequestData = z14.object({
|
|
1970
2162
|
settlement: zReviewStepWithUsersArray.meta({ description: "List of settlement review steps" }),
|
|
1971
2163
|
withdraw: zReviewStepWithUsersArray.meta({ description: "List of withdraw review steps" }),
|
|
1972
2164
|
arbitration: zReviewStepWithUsersArray.meta({ description: "List of arbitration review steps" })
|
|
1973
2165
|
});
|
|
1974
|
-
var zTradelinkEntityRequestData =
|
|
1975
|
-
tradelinkId:
|
|
2166
|
+
var zTradelinkEntityRequestData = z14.object({
|
|
2167
|
+
tradelinkId: z14.string().min(1),
|
|
1976
2168
|
groups: zReviewStepWithUsersArray.meta({ description: "List of asset manager review groups" }),
|
|
1977
|
-
whitelist:
|
|
2169
|
+
whitelist: z14.array(zTradelinkWhitelistAddress).meta({ description: "List of asset manager whitelisted addresses" })
|
|
1978
2170
|
});
|
|
1979
|
-
var zTradelinkAdjustPledgeRequestData =
|
|
1980
|
-
accountId:
|
|
1981
|
-
exchangeId:
|
|
2171
|
+
var zTradelinkAdjustPledgeRequestData = z14.object({
|
|
2172
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2173
|
+
exchangeId: z14.string().meta({ description: "Exchange id" }),
|
|
1982
2174
|
amount: zIntString.meta({ description: "Amount to add to pledge" })
|
|
1983
2175
|
});
|
|
1984
|
-
var zTradelinkRepledgeRequestData =
|
|
1985
|
-
accountId:
|
|
1986
|
-
exchangeId:
|
|
2176
|
+
var zTradelinkRepledgeRequestData = z14.object({
|
|
2177
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2178
|
+
exchangeId: z14.string().meta({ description: "Exchange id" }),
|
|
1987
2179
|
amount: zIntString.meta({ description: "Amount to add to pledge" })
|
|
1988
2180
|
});
|
|
1989
|
-
var zTradelinkCreateSettlementRequestData =
|
|
1990
|
-
accountId:
|
|
1991
|
-
exchangeId:
|
|
2181
|
+
var zTradelinkCreateSettlementRequestData = z14.object({
|
|
2182
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2183
|
+
exchangeId: z14.string().meta({ description: "Exchange id" }),
|
|
1992
2184
|
transaction: zSendOnlyTransactionData
|
|
1993
2185
|
});
|
|
1994
|
-
var zTradelinkForceUnpledgeRequestData =
|
|
1995
|
-
accountId:
|
|
1996
|
-
exchangeId:
|
|
2186
|
+
var zTradelinkForceUnpledgeRequestData = z14.object({
|
|
2187
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2188
|
+
exchangeId: z14.string().meta({ description: "Exchange id" })
|
|
1997
2189
|
});
|
|
1998
|
-
var zTradelinkWithdrawRequestData =
|
|
1999
|
-
accountId:
|
|
2190
|
+
var zTradelinkWithdrawRequestData = z14.object({
|
|
2191
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2000
2192
|
transaction: zSendOnlyTransactionData
|
|
2001
2193
|
});
|
|
2002
|
-
var zTradelinkArbitrationRequestData =
|
|
2003
|
-
accountId:
|
|
2194
|
+
var zTradelinkArbitrationRequestData = z14.object({
|
|
2195
|
+
accountId: z14.string().meta({ description: "Account id" }),
|
|
2004
2196
|
transaction: zSendOnlyTransactionData
|
|
2005
2197
|
});
|
|
2006
2198
|
var zTradelinkRequestMixinsByType = {
|
|
2007
|
-
[RequestType.TRADELINK_ACTIVATE_ACCOUNT]:
|
|
2008
|
-
type:
|
|
2009
|
-
targetId:
|
|
2199
|
+
[RequestType.TRADELINK_ACTIVATE_ACCOUNT]: z14.object({
|
|
2200
|
+
type: z14.literal(RequestType.TRADELINK_ACTIVATE_ACCOUNT),
|
|
2201
|
+
targetId: z14.string(),
|
|
2010
2202
|
data: zTradelinkActivateAccountRequestData
|
|
2011
2203
|
}),
|
|
2012
|
-
[RequestType.TRADELINK_CREATE_CUSTODIAN]:
|
|
2013
|
-
type:
|
|
2204
|
+
[RequestType.TRADELINK_CREATE_CUSTODIAN]: z14.object({
|
|
2205
|
+
type: z14.literal(RequestType.TRADELINK_CREATE_CUSTODIAN),
|
|
2014
2206
|
data: zTradelinkCustodianRequestData
|
|
2015
2207
|
}),
|
|
2016
|
-
[RequestType.TRADELINK_EDIT_CUSTODIAN]:
|
|
2017
|
-
type:
|
|
2018
|
-
targetId:
|
|
2208
|
+
[RequestType.TRADELINK_EDIT_CUSTODIAN]: z14.object({
|
|
2209
|
+
type: z14.literal(RequestType.TRADELINK_EDIT_CUSTODIAN),
|
|
2210
|
+
targetId: z14.string(),
|
|
2019
2211
|
data: zTradelinkCustodianRequestData
|
|
2020
2212
|
}),
|
|
2021
|
-
[RequestType.TRADELINK_CREATE_EXCHANGE]:
|
|
2022
|
-
type:
|
|
2213
|
+
[RequestType.TRADELINK_CREATE_EXCHANGE]: z14.object({
|
|
2214
|
+
type: z14.literal(RequestType.TRADELINK_CREATE_EXCHANGE),
|
|
2023
2215
|
data: zTradelinkEntityRequestData
|
|
2024
2216
|
}),
|
|
2025
|
-
[RequestType.TRADELINK_EDIT_EXCHANGE]:
|
|
2026
|
-
type:
|
|
2027
|
-
targetId:
|
|
2217
|
+
[RequestType.TRADELINK_EDIT_EXCHANGE]: z14.object({
|
|
2218
|
+
type: z14.literal(RequestType.TRADELINK_EDIT_EXCHANGE),
|
|
2219
|
+
targetId: z14.string(),
|
|
2028
2220
|
data: zTradelinkEntityRequestData
|
|
2029
2221
|
}),
|
|
2030
|
-
[RequestType.TRADELINK_CREATE_ASSET_MANAGER]:
|
|
2031
|
-
type:
|
|
2222
|
+
[RequestType.TRADELINK_CREATE_ASSET_MANAGER]: z14.object({
|
|
2223
|
+
type: z14.literal(RequestType.TRADELINK_CREATE_ASSET_MANAGER),
|
|
2032
2224
|
data: zTradelinkEntityRequestData
|
|
2033
2225
|
}),
|
|
2034
|
-
[RequestType.TRADELINK_EDIT_ASSET_MANAGER]:
|
|
2035
|
-
type:
|
|
2036
|
-
targetId:
|
|
2226
|
+
[RequestType.TRADELINK_EDIT_ASSET_MANAGER]: z14.object({
|
|
2227
|
+
type: z14.literal(RequestType.TRADELINK_EDIT_ASSET_MANAGER),
|
|
2228
|
+
targetId: z14.string(),
|
|
2037
2229
|
data: zTradelinkEntityRequestData
|
|
2038
2230
|
}),
|
|
2039
|
-
[RequestType.TRADELINK_ADJUST_PLEDGE]:
|
|
2040
|
-
type:
|
|
2231
|
+
[RequestType.TRADELINK_ADJUST_PLEDGE]: z14.object({
|
|
2232
|
+
type: z14.literal(RequestType.TRADELINK_ADJUST_PLEDGE),
|
|
2041
2233
|
data: zTradelinkAdjustPledgeRequestData
|
|
2042
2234
|
}),
|
|
2043
|
-
[RequestType.TRADELINK_REPLEDGE]:
|
|
2044
|
-
type:
|
|
2235
|
+
[RequestType.TRADELINK_REPLEDGE]: z14.object({
|
|
2236
|
+
type: z14.literal(RequestType.TRADELINK_REPLEDGE),
|
|
2045
2237
|
data: zTradelinkRepledgeRequestData
|
|
2046
2238
|
}),
|
|
2047
|
-
[RequestType.TRADELINK_CREATE_SETTLEMENT]:
|
|
2048
|
-
type:
|
|
2239
|
+
[RequestType.TRADELINK_CREATE_SETTLEMENT]: z14.object({
|
|
2240
|
+
type: z14.literal(RequestType.TRADELINK_CREATE_SETTLEMENT),
|
|
2049
2241
|
data: zTradelinkCreateSettlementRequestData,
|
|
2050
|
-
meta:
|
|
2051
|
-
hash:
|
|
2242
|
+
meta: z14.object({
|
|
2243
|
+
hash: z14.string().nullable()
|
|
2052
2244
|
}).optional().nullable()
|
|
2053
2245
|
}),
|
|
2054
|
-
[RequestType.TRADELINK_FORCE_UNPLEDGE]:
|
|
2055
|
-
type:
|
|
2246
|
+
[RequestType.TRADELINK_FORCE_UNPLEDGE]: z14.object({
|
|
2247
|
+
type: z14.literal(RequestType.TRADELINK_FORCE_UNPLEDGE),
|
|
2056
2248
|
data: zTradelinkForceUnpledgeRequestData
|
|
2057
2249
|
}),
|
|
2058
|
-
[RequestType.TRADELINK_WITHDRAW]:
|
|
2059
|
-
type:
|
|
2250
|
+
[RequestType.TRADELINK_WITHDRAW]: z14.object({
|
|
2251
|
+
type: z14.literal(RequestType.TRADELINK_WITHDRAW),
|
|
2060
2252
|
data: zTradelinkWithdrawRequestData,
|
|
2061
|
-
meta:
|
|
2062
|
-
hash:
|
|
2253
|
+
meta: z14.object({
|
|
2254
|
+
hash: z14.string().nullable()
|
|
2063
2255
|
}).optional().nullable()
|
|
2064
2256
|
}),
|
|
2065
|
-
[RequestType.TRADELINK_ARBITRATE]:
|
|
2066
|
-
type:
|
|
2257
|
+
[RequestType.TRADELINK_ARBITRATE]: z14.object({
|
|
2258
|
+
type: z14.literal(RequestType.TRADELINK_ARBITRATE),
|
|
2067
2259
|
data: zTradelinkArbitrationRequestData,
|
|
2068
|
-
meta:
|
|
2069
|
-
hash:
|
|
2260
|
+
meta: z14.object({
|
|
2261
|
+
hash: z14.string().nullable()
|
|
2070
2262
|
}).optional().nullable()
|
|
2071
2263
|
})
|
|
2072
2264
|
};
|
|
@@ -2086,26 +2278,26 @@ var zTradelinkAccountGovernanceFields = z.object({
|
|
|
2086
2278
|
var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).meta({ description: "Governance fields" });
|
|
2087
2279
|
|
|
2088
2280
|
// src/accounts/types.ts
|
|
2089
|
-
var zAccountCommonFields =
|
|
2090
|
-
id:
|
|
2091
|
-
legacyId:
|
|
2092
|
-
name:
|
|
2281
|
+
var zAccountCommonFields = z14.object({
|
|
2282
|
+
id: z14.string().meta({ description: "Internal unique identifier" }),
|
|
2283
|
+
legacyId: z14.number().meta({ description: "Legacy internal unique identifier (for retro-compatibility)" }),
|
|
2284
|
+
name: z14.string().meta({ description: "Name" }),
|
|
2093
2285
|
currency: zCurrencyString,
|
|
2094
2286
|
network: zNetwork,
|
|
2095
|
-
contractAddress:
|
|
2096
|
-
index:
|
|
2097
|
-
derivationPath:
|
|
2098
|
-
status:
|
|
2099
|
-
createdAt:
|
|
2100
|
-
updatedAt:
|
|
2101
|
-
});
|
|
2102
|
-
var zRawSigningAssetFields =
|
|
2103
|
-
var zAccountAssetFields =
|
|
2287
|
+
contractAddress: z14.string().nullable().meta({ description: "Token contract address for Token account" }),
|
|
2288
|
+
index: z14.number().gte(0).meta({ description: "BIP44 account index" }),
|
|
2289
|
+
derivationPath: z14.string().meta({ description: "Derivation path" }),
|
|
2290
|
+
status: z14.enum(ActivationStatus).meta({ description: "Status" }),
|
|
2291
|
+
createdAt: z14.coerce.date().meta({ description: "Creation timestamp" }),
|
|
2292
|
+
updatedAt: z14.coerce.date().meta({ description: "Last modification timestamp" })
|
|
2293
|
+
});
|
|
2294
|
+
var zRawSigningAssetFields = z14.object({ type: z14.literal(AccountType.RAW_SIGNING).meta({ description: "Account type" }) }).meta({ description: "Raw signing account" });
|
|
2295
|
+
var zAccountAssetFields = z14.discriminatedUnion("type", [zRawSigningAssetFields, ...zNetworkAssetFields.options]).meta({ description: "Account asset fields" });
|
|
2104
2296
|
var zAccountResponse = zAccountCommonFields.extend({
|
|
2105
2297
|
asset: zAccountAssetFields,
|
|
2106
2298
|
governance: zAccountGovernanceFields
|
|
2107
2299
|
});
|
|
2108
|
-
|
|
2300
|
+
z14.enum([
|
|
2109
2301
|
"name",
|
|
2110
2302
|
"currency",
|
|
2111
2303
|
"index",
|
|
@@ -2113,123 +2305,141 @@ z13.enum([
|
|
|
2113
2305
|
"updatedAt"
|
|
2114
2306
|
]).default("createdAt");
|
|
2115
2307
|
var zRawSigningLiveData = zCommonLiveData.extend({
|
|
2116
|
-
type:
|
|
2308
|
+
type: z14.literal(AccountType.RAW_SIGNING).meta({ description: "Account type" })
|
|
2117
2309
|
}).meta({ description: "Raw signing account" });
|
|
2118
|
-
|
|
2310
|
+
z14.discriminatedUnion("type", [
|
|
2119
2311
|
zRawSigningLiveData,
|
|
2120
2312
|
...zAccountLiveData.options
|
|
2121
2313
|
]);
|
|
2122
|
-
|
|
2123
|
-
address:
|
|
2124
|
-
derivationPath:
|
|
2314
|
+
z14.object({
|
|
2315
|
+
address: z14.string().meta({ description: "Address" }),
|
|
2316
|
+
derivationPath: z14.string().nullable().meta({ description: "Derivation path" })
|
|
2125
2317
|
});
|
|
2126
|
-
|
|
2318
|
+
z14.object({
|
|
2127
2319
|
amount: zIntString.meta({ description: "Amount in the smallest unit of the currency" }),
|
|
2128
2320
|
currency: zCurrency
|
|
2129
2321
|
});
|
|
2130
|
-
|
|
2131
|
-
id:
|
|
2132
|
-
validator:
|
|
2133
|
-
state:
|
|
2134
|
-
staked:
|
|
2135
|
-
rewards:
|
|
2136
|
-
total:
|
|
2322
|
+
z14.object({
|
|
2323
|
+
id: z14.string().nonempty().meta({ description: "Staking position ID (if applicable)" }),
|
|
2324
|
+
validator: z14.string().nonempty().meta({ description: "Validator address" }),
|
|
2325
|
+
state: z14.enum(["ACTIVE", "INACTIVE", "ACTIVATING", "DEACTIVATING", "UNKNOWN"]).meta({ description: "Stake state" }),
|
|
2326
|
+
staked: z14.string().meta({ description: "Staked amount" }),
|
|
2327
|
+
rewards: z14.object({
|
|
2328
|
+
total: z14.string().meta({ description: "Total rewards" })
|
|
2137
2329
|
})
|
|
2138
2330
|
});
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
address:
|
|
2142
|
-
apy:
|
|
2143
|
-
balance:
|
|
2144
|
-
commissionRate:
|
|
2145
|
-
description:
|
|
2146
|
-
logo:
|
|
2147
|
-
name:
|
|
2148
|
-
url:
|
|
2149
|
-
});
|
|
2150
|
-
|
|
2151
|
-
var zMessageType =
|
|
2331
|
+
z14.enum(["staked", "rewards", "total"]).default("total");
|
|
2332
|
+
z14.object({
|
|
2333
|
+
address: z14.string().meta({ description: "Validator address" }),
|
|
2334
|
+
apy: z14.string().nullable().meta({ description: "Validator APY" }),
|
|
2335
|
+
balance: z14.string().nullable().meta({ description: "Validator balance" }),
|
|
2336
|
+
commissionRate: z14.string().nullable().meta({ description: "Validator commission rate" }),
|
|
2337
|
+
description: z14.string().nullable().meta({ description: "Description" }),
|
|
2338
|
+
logo: z14.string().nullable().meta({ description: "Logo URL" }),
|
|
2339
|
+
name: z14.string().nullable().meta({ description: "Validator name" }),
|
|
2340
|
+
url: z14.string().nullable().meta({ description: "Validator URL" })
|
|
2341
|
+
});
|
|
2342
|
+
z14.enum(["balance"]).default("balance");
|
|
2343
|
+
var zMessageType = z14.enum(MessageType).meta({ description: "Type of the message to sign" });
|
|
2152
2344
|
var zMessageData = zHexString.nonempty().meta({
|
|
2153
|
-
description: "Hex data to sign, either a json string for EIP712, or a raw string for
|
|
2345
|
+
description: "Hex data to sign, either a json string for EIP712, or a raw string for other types"
|
|
2154
2346
|
});
|
|
2155
|
-
var zMessage =
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2347
|
+
var zMessage = z14.discriminatedUnion("type", [
|
|
2348
|
+
z14.object({
|
|
2349
|
+
type: z14.literal("EIP191"),
|
|
2350
|
+
data: zMessageData
|
|
2351
|
+
}),
|
|
2352
|
+
z14.object({
|
|
2353
|
+
type: z14.literal("EIP712"),
|
|
2354
|
+
data: zMessageData
|
|
2355
|
+
// TODO: put a proper EIP712 schema
|
|
2356
|
+
}),
|
|
2357
|
+
z14.object({
|
|
2358
|
+
type: z14.literal("CIP8"),
|
|
2359
|
+
data: zMessageData,
|
|
2360
|
+
signingKey: z14.literal(["PAYMENT", "STAKE"]).meta({ description: "CIP-8 signing key" })
|
|
2361
|
+
}),
|
|
2362
|
+
z14.object({
|
|
2363
|
+
type: z14.literal("BIP137"),
|
|
2364
|
+
data: zMessageData
|
|
2365
|
+
})
|
|
2366
|
+
]);
|
|
2367
|
+
z14.object({
|
|
2368
|
+
id: z14.string().meta({ description: "Unique identifier" }),
|
|
2161
2369
|
type: zMessageType,
|
|
2162
2370
|
data: zMessageData,
|
|
2163
|
-
address:
|
|
2164
|
-
derivationPath:
|
|
2371
|
+
address: z14.string().meta({ description: "Address of the signing key" }),
|
|
2372
|
+
derivationPath: z14.string().meta({ description: "Derivation path of the signing key" }),
|
|
2165
2373
|
signature: zHsmSignature.meta({ description: "Signature of the message" }),
|
|
2166
|
-
createdById:
|
|
2167
|
-
createdAt:
|
|
2374
|
+
createdById: z14.string().meta({ description: "ID of the creator" }),
|
|
2375
|
+
createdAt: z14.coerce.date().meta({ description: "Creation timestamp" })
|
|
2168
2376
|
}).meta({ description: "Signed message", id: "SignedMessageResponse" });
|
|
2169
|
-
var zCreateTransactionRequestData =
|
|
2170
|
-
accountId:
|
|
2377
|
+
var zCreateTransactionRequestData = z14.object({
|
|
2378
|
+
accountId: z14.string().min(1).meta({ description: "Target account id" }),
|
|
2171
2379
|
transaction: zTransactionData
|
|
2172
2380
|
}).meta({
|
|
2173
2381
|
description: "Create transaction request data",
|
|
2174
2382
|
id: "CreateTransactionRequestData"
|
|
2175
2383
|
});
|
|
2176
|
-
var zSignMessageRequestData =
|
|
2384
|
+
var zSignMessageRequestData = z14.object({
|
|
2177
2385
|
message: zMessage.meta({ description: "Message to sign" }),
|
|
2178
|
-
accountId:
|
|
2179
|
-
address:
|
|
2180
|
-
derivationPath:
|
|
2386
|
+
accountId: z14.string().min(1).meta({ description: "Target account id" }),
|
|
2387
|
+
address: z14.string().nonempty().meta({ description: "Address with which to sign the message" }),
|
|
2388
|
+
derivationPath: z14.string().nonempty().meta({ description: "Derivation path of the signing address" })
|
|
2181
2389
|
});
|
|
2182
2390
|
var zSignMessageUserInputData = zSignMessageRequestData.partial({
|
|
2183
2391
|
address: true,
|
|
2184
2392
|
derivationPath: true
|
|
2185
2393
|
});
|
|
2186
|
-
var zDigestData =
|
|
2394
|
+
var zDigestData = z14.object({
|
|
2187
2395
|
digest: zHexString.meta({ description: "The hex string digest to sign" }),
|
|
2188
|
-
derivationPath:
|
|
2396
|
+
derivationPath: z14.string().nonempty().meta({ description: "The derivation path with which to sign the digest" })
|
|
2189
2397
|
});
|
|
2190
|
-
var zSignDigestsRequestData =
|
|
2191
|
-
accountId:
|
|
2192
|
-
digests:
|
|
2398
|
+
var zSignDigestsRequestData = z14.object({
|
|
2399
|
+
accountId: z14.string().min(1).meta({ description: "Target account id" }),
|
|
2400
|
+
digests: z14.array(zDigestData).meta({ description: "The digests to sign" })
|
|
2193
2401
|
});
|
|
2194
|
-
|
|
2195
|
-
signatures:
|
|
2402
|
+
z14.object({
|
|
2403
|
+
signatures: z14.array(zHsmSignature)
|
|
2196
2404
|
});
|
|
2197
2405
|
|
|
2198
2406
|
// src/accounts/app-types.ts
|
|
2199
|
-
|
|
2407
|
+
z14.discriminatedUnion(
|
|
2200
2408
|
zTransactionResponse._zod.def.discriminator,
|
|
2201
2409
|
ensureNonEmptyArray(
|
|
2202
2410
|
zTransactionResponse.options.map(
|
|
2203
2411
|
(_) => _.extend({
|
|
2204
2412
|
note: zNote.nullable().meta({ description: "Optional transaction note" }),
|
|
2205
|
-
requestId:
|
|
2413
|
+
requestId: z14.string().nullable().meta({ description: "Request ID associated with the transaction, if available" })
|
|
2206
2414
|
})
|
|
2207
2415
|
)
|
|
2208
2416
|
)
|
|
2209
2417
|
);
|
|
2210
|
-
|
|
2211
|
-
|
|
2418
|
+
canton_extras_exports.zPreApprovalState;
|
|
2419
|
+
canton_extras_exports.zTransferProposal;
|
|
2420
|
+
var zWhitelistAddress = z14.object({
|
|
2421
|
+
name: z14.string().min(1).max(50),
|
|
2212
2422
|
currency: zCurrencyString,
|
|
2213
|
-
address:
|
|
2423
|
+
address: z14.string().min(1).max(200),
|
|
2214
2424
|
// Destination tags are numeric-only or alpha-numeric.
|
|
2215
2425
|
// Empty array (or undefined) means no check on destination tag.
|
|
2216
|
-
destinationTags:
|
|
2426
|
+
destinationTags: z14.array(z14.string().min(1).regex(/^\w+$/)).optional()
|
|
2217
2427
|
});
|
|
2218
|
-
var zWhitelistAddresses =
|
|
2219
|
-
var zWhitelistName =
|
|
2220
|
-
var zCreateWhitelistRequestData =
|
|
2428
|
+
var zWhitelistAddresses = z14.array(zWhitelistAddress);
|
|
2429
|
+
var zWhitelistName = z14.string().min(1).max(45).meta({ description: "Whitelist name" });
|
|
2430
|
+
var zCreateWhitelistRequestData = z14.object({
|
|
2221
2431
|
name: zWhitelistName,
|
|
2222
|
-
description:
|
|
2432
|
+
description: z14.string().nullable(),
|
|
2223
2433
|
addresses: zWhitelistAddresses,
|
|
2224
|
-
type:
|
|
2434
|
+
type: z14.enum(WhitelistType)
|
|
2225
2435
|
});
|
|
2226
|
-
var zEditWhitelistRequestData =
|
|
2436
|
+
var zEditWhitelistRequestData = z14.object({
|
|
2227
2437
|
name: zWhitelistName,
|
|
2228
2438
|
addresses: zWhitelistAddresses
|
|
2229
2439
|
});
|
|
2230
2440
|
|
|
2231
2441
|
// src/policies/db-utils.ts
|
|
2232
|
-
var zBaseGovRuleData =
|
|
2442
|
+
var zBaseGovRuleData = z14.object({
|
|
2233
2443
|
// Steps of users that will need to review operations
|
|
2234
2444
|
reviewSteps: zReviewStepsArray,
|
|
2235
2445
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
@@ -2238,95 +2448,95 @@ var zBaseGovRuleData = z13.object({
|
|
|
2238
2448
|
whitelistIds: policy_exports.zWhitelistIds.optional()
|
|
2239
2449
|
});
|
|
2240
2450
|
var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
2241
|
-
operationType:
|
|
2451
|
+
operationType: zClassicAction.meta({ description: "Allowed action" })
|
|
2242
2452
|
}).meta({ description: "Account governance rule", id: "ClassicGovRuleData" });
|
|
2243
2453
|
zBaseGovRuleData.extend({
|
|
2244
|
-
operationType:
|
|
2454
|
+
operationType: zGovernableAction.meta({ description: "Allowed action" })
|
|
2245
2455
|
}).meta({ description: "Governance rule", id: "GovRuleResponse" });
|
|
2246
2456
|
({
|
|
2247
2457
|
reviewConfigs: { include: review_config_exports.INCLUDE_MEMBERS }
|
|
2248
2458
|
});
|
|
2249
|
-
var zPolicyName =
|
|
2250
|
-
var zCurrency2 =
|
|
2251
|
-
var zCreatePublicPolicyRequestData =
|
|
2459
|
+
var zPolicyName = z14.string().min(1).max(19).meta({ description: "Policy name" });
|
|
2460
|
+
var zCurrency2 = z14.string().min(1).max(40).regex(/^\w+$/).meta({ description: "Currency" });
|
|
2461
|
+
var zCreatePublicPolicyRequestData = z14.object({
|
|
2252
2462
|
name: zPolicyName,
|
|
2253
|
-
description:
|
|
2463
|
+
description: z14.string().nullable().meta({ description: "Description" }),
|
|
2254
2464
|
currency: zCurrency2.nullable(),
|
|
2255
|
-
govRules:
|
|
2465
|
+
govRules: z14.array(zClassicGovRuleData).meta({ description: "Governance rules" })
|
|
2256
2466
|
});
|
|
2257
|
-
var zEditPublicPolicyRequestData =
|
|
2467
|
+
var zEditPublicPolicyRequestData = z14.object({
|
|
2258
2468
|
name: zPolicyName,
|
|
2259
|
-
description:
|
|
2260
|
-
govRules:
|
|
2469
|
+
description: z14.string().nullable().meta({ description: "Description" }),
|
|
2470
|
+
govRules: z14.array(zClassicGovRuleData).meta({ description: "Governance rules" })
|
|
2261
2471
|
});
|
|
2262
|
-
var zAccountName =
|
|
2263
|
-
|
|
2264
|
-
var zSignDigestsGovRuleData =
|
|
2265
|
-
operationType:
|
|
2472
|
+
var zAccountName = z14.string().min(1).max(40).meta({ description: "Account name" });
|
|
2473
|
+
z14.enum(["standalone", "legacy"]);
|
|
2474
|
+
var zSignDigestsGovRuleData = z14.object({
|
|
2475
|
+
operationType: z14.literal("SIGN_DIGESTS"),
|
|
2266
2476
|
reviewSteps: zReviewStepWithUsersArray
|
|
2267
2477
|
// we need to control for API users only
|
|
2268
2478
|
}).meta({ description: "Digest signing rule" });
|
|
2269
|
-
var zAccountPolicyRequestData =
|
|
2270
|
-
|
|
2271
|
-
|
|
2479
|
+
var zAccountPolicyRequestData = z14.union([
|
|
2480
|
+
z14.object({ policyId: z14.string() }).meta({ description: "Account policy" }),
|
|
2481
|
+
z14.object({ rules: z14.array(zClassicGovRuleData) }).meta({ description: "Account governance rules" })
|
|
2272
2482
|
]).meta({ description: "Account policy or governance rules" });
|
|
2273
|
-
var zCreateAccountGovernanceData =
|
|
2274
|
-
|
|
2275
|
-
type:
|
|
2483
|
+
var zCreateAccountGovernanceData = z14.discriminatedUnion("type", [
|
|
2484
|
+
z14.object({
|
|
2485
|
+
type: z14.literal(AccountGovernanceType.CLASSIC),
|
|
2276
2486
|
policy: zAccountPolicyRequestData
|
|
2277
2487
|
}).meta({ description: "Classic governance" }),
|
|
2278
|
-
|
|
2279
|
-
type:
|
|
2280
|
-
assetManagerId:
|
|
2488
|
+
z14.object({
|
|
2489
|
+
type: z14.literal(AccountGovernanceType.TRADELINK),
|
|
2490
|
+
assetManagerId: z14.string(),
|
|
2281
2491
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
2282
2492
|
}).meta({ description: "Tradelink governance" }),
|
|
2283
|
-
|
|
2284
|
-
type:
|
|
2285
|
-
policy:
|
|
2493
|
+
z14.object({
|
|
2494
|
+
type: z14.literal(AccountGovernanceType.RAW_SIGNING),
|
|
2495
|
+
policy: z14.object({ rules: z14.array(zSignDigestsGovRuleData) })
|
|
2286
2496
|
}).meta({ description: "Raw signing governance" })
|
|
2287
2497
|
]).meta({ description: "Governance fields" });
|
|
2288
|
-
var zCreateAccountUserInputData =
|
|
2498
|
+
var zCreateAccountUserInputData = z14.object({
|
|
2289
2499
|
name: zAccountName,
|
|
2290
2500
|
currency: zCurrencyString,
|
|
2291
2501
|
// "bitcoin"
|
|
2292
|
-
index:
|
|
2293
|
-
contractAddress:
|
|
2502
|
+
index: z14.number().nonnegative().optional().meta({ description: "Account index" }),
|
|
2503
|
+
contractAddress: z14.string().min(1).optional().meta({ description: "Account contract address" }),
|
|
2294
2504
|
governance: zCreateAccountGovernanceData
|
|
2295
2505
|
});
|
|
2296
2506
|
var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }).extend({
|
|
2297
|
-
index:
|
|
2298
|
-
derivationPath:
|
|
2299
|
-
type:
|
|
2507
|
+
index: z14.number().nonnegative().meta({ description: "Account index" }),
|
|
2508
|
+
derivationPath: z14.string().meta({ description: "Account bip44 derivation path" }),
|
|
2509
|
+
type: z14.enum(AccountType)
|
|
2300
2510
|
// "BITCOIN_LIKE"
|
|
2301
2511
|
}).meta({
|
|
2302
2512
|
description: "Create account request data",
|
|
2303
2513
|
id: "CreateAccountRequestData"
|
|
2304
2514
|
});
|
|
2305
|
-
var zEditAccountGovernanceData =
|
|
2306
|
-
|
|
2307
|
-
type:
|
|
2515
|
+
var zEditAccountGovernanceData = z14.discriminatedUnion("type", [
|
|
2516
|
+
z14.object({
|
|
2517
|
+
type: z14.literal(AccountGovernanceType.CLASSIC),
|
|
2308
2518
|
policy: zAccountPolicyRequestData
|
|
2309
2519
|
}).meta({ description: "Classic governance" }),
|
|
2310
|
-
|
|
2311
|
-
type:
|
|
2520
|
+
z14.object({
|
|
2521
|
+
type: z14.literal(AccountGovernanceType.TRADELINK),
|
|
2312
2522
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
2313
2523
|
}).meta({ description: "Tradelink governance" }),
|
|
2314
|
-
|
|
2315
|
-
type:
|
|
2316
|
-
policy:
|
|
2524
|
+
z14.object({
|
|
2525
|
+
type: z14.literal(AccountGovernanceType.RAW_SIGNING),
|
|
2526
|
+
policy: z14.object({ rules: z14.array(zSignDigestsGovRuleData) })
|
|
2317
2527
|
}).meta({ description: "Raw signing governance" })
|
|
2318
2528
|
]).meta({ description: "Governance fields" });
|
|
2319
|
-
var zEditAccountRequestData =
|
|
2529
|
+
var zEditAccountRequestData = z14.object({
|
|
2320
2530
|
name: zAccountName,
|
|
2321
2531
|
governance: zEditAccountGovernanceData
|
|
2322
2532
|
}).meta({
|
|
2323
2533
|
description: "Edit account request data",
|
|
2324
2534
|
id: "EditAccountRequestData"
|
|
2325
2535
|
});
|
|
2326
|
-
var zEditTokenRuleRequestData =
|
|
2327
|
-
parentAccountId:
|
|
2328
|
-
contractAddress:
|
|
2329
|
-
rules:
|
|
2536
|
+
var zEditTokenRuleRequestData = z14.object({
|
|
2537
|
+
parentAccountId: z14.string().min(1).meta({ description: "Parent account unique ID" }),
|
|
2538
|
+
contractAddress: z14.string().min(1).meta({ description: "Token contract address" }),
|
|
2539
|
+
rules: z14.array(zClassicGovRuleData).meta({ description: "Account governance rules" })
|
|
2330
2540
|
});
|
|
2331
2541
|
|
|
2332
2542
|
// src/accounts/app-utils.ts
|
|
@@ -2395,6 +2605,11 @@ var getAccountAssetFields = (account) => {
|
|
|
2395
2605
|
type: account.type,
|
|
2396
2606
|
address: account.address
|
|
2397
2607
|
};
|
|
2608
|
+
case AccountType.HEDERA_LIKE:
|
|
2609
|
+
return {
|
|
2610
|
+
type: account.type,
|
|
2611
|
+
address: account.address
|
|
2612
|
+
};
|
|
2398
2613
|
/* v8 ignore next -- @preserve */
|
|
2399
2614
|
default:
|
|
2400
2615
|
unreachable(account.type);
|
|
@@ -2455,181 +2670,197 @@ var patchTezosRequestData = (data) => {
|
|
|
2455
2670
|
}
|
|
2456
2671
|
return data;
|
|
2457
2672
|
};
|
|
2458
|
-
var zSciConfigData =
|
|
2459
|
-
dapps:
|
|
2460
|
-
customContractCallEnabled:
|
|
2673
|
+
var zSciConfigData = z14.object({
|
|
2674
|
+
dapps: z14.array(z14.string()).nullable().meta({ description: "Allowed DApps, null allows all" }),
|
|
2675
|
+
customContractCallEnabled: z14.boolean().meta({ description: "Allow non-DApp SCI" })
|
|
2461
2676
|
});
|
|
2462
|
-
var zCreateSciConfigRequestData =
|
|
2463
|
-
account:
|
|
2677
|
+
var zCreateSciConfigRequestData = z14.object({
|
|
2678
|
+
account: z14.string().meta({ description: "Account UUID" }),
|
|
2464
2679
|
config: zSciConfigData
|
|
2465
2680
|
});
|
|
2466
|
-
var zEditSciConfigRequestData =
|
|
2681
|
+
var zEditSciConfigRequestData = z14.object({
|
|
2467
2682
|
config: zSciConfigData
|
|
2468
2683
|
});
|
|
2684
|
+
var zSoftChallenge = z.object({
|
|
2685
|
+
challengeType: z.literal(ChallengeType.SOFT)
|
|
2686
|
+
// soft approval with no challenge to sign
|
|
2687
|
+
});
|
|
2688
|
+
var zChallenge = z.discriminatedUnion("challengeType", [
|
|
2689
|
+
zPsdChallenge,
|
|
2690
|
+
zApiChallenge,
|
|
2691
|
+
zSoftChallenge
|
|
2692
|
+
]);
|
|
2693
|
+
var zSoftChallengeGroup = z.record(zPubKey, zSoftChallenge);
|
|
2694
|
+
var zSoftChallengeSteps = z.array(zSoftChallengeGroup);
|
|
2695
|
+
z.object({
|
|
2696
|
+
stageName: z.string(),
|
|
2697
|
+
steps: zSoftChallengeSteps
|
|
2698
|
+
});
|
|
2469
2699
|
var zRequestReviewStep = z.object({
|
|
2470
2700
|
stageName: z.string().regex(/^\w+$/).meta({ description: "The review stage name" }),
|
|
2471
2701
|
quorum: z.int().min(1).meta({ description: "Quorum for the review step" })
|
|
2472
2702
|
});
|
|
2473
2703
|
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
2474
|
-
var
|
|
2475
|
-
var
|
|
2704
|
+
var zEntityName = z14.string().min(1).max(19).meta({ description: "Entity name" });
|
|
2705
|
+
var zCreateEntityRequestData = z14.object({
|
|
2706
|
+
name: zEntityName,
|
|
2707
|
+
accountIds: z14.array(z14.string()).meta({ description: "List of Account IDs" }),
|
|
2708
|
+
memberIds: z14.array(z14.string()).meta({ description: "List of User IDs" })
|
|
2709
|
+
});
|
|
2710
|
+
var zEditEntityRequestData = zCreateEntityRequestData;
|
|
2711
|
+
var zRevokeEntityRequestData = z14.object({});
|
|
2712
|
+
var zGroupName = z14.string().min(1).max(19).meta({ description: "Group name" });
|
|
2713
|
+
var zCreateGroupRequestData = z14.object({
|
|
2476
2714
|
name: zGroupName,
|
|
2477
|
-
description:
|
|
2478
|
-
members:
|
|
2715
|
+
description: z14.string().nullable().meta({ description: "Group description" }),
|
|
2716
|
+
members: z14.array(z14.string()).meta({ description: "List of group members ids" })
|
|
2479
2717
|
});
|
|
2480
|
-
var zEditGroupRequestData =
|
|
2718
|
+
var zEditGroupRequestData = z14.object({
|
|
2481
2719
|
name: zGroupName,
|
|
2482
|
-
description:
|
|
2483
|
-
members:
|
|
2720
|
+
description: z14.string().nullable().meta({ description: "Group description" }),
|
|
2721
|
+
members: z14.array(z14.string()).meta({ description: "List of group members ids" })
|
|
2484
2722
|
});
|
|
2485
|
-
var zApiKeyName =
|
|
2486
|
-
var zCreateApiKeyRequestData =
|
|
2723
|
+
var zApiKeyName = z14.string().min(1).max(19).meta({ description: "API key name" });
|
|
2724
|
+
var zCreateApiKeyRequestData = z14.object({
|
|
2487
2725
|
name: zApiKeyName,
|
|
2488
|
-
entities:
|
|
2489
|
-
scopes:
|
|
2726
|
+
entities: z14.array(z14.string()).meta({ description: "List of related entities ids" }),
|
|
2727
|
+
scopes: z14.object({}).meta({ description: "FIXME to be precised" })
|
|
2490
2728
|
}).meta({ description: "Create read-only API key request data" });
|
|
2491
2729
|
var zEditApiKeyRequestData = zCreateApiKeyRequestData.meta({
|
|
2492
2730
|
description: "Edit read-only API key request data"
|
|
2493
2731
|
});
|
|
2494
|
-
var zEntityName = z13.string().min(1).max(19).meta({ description: "Entity name" });
|
|
2495
|
-
var zCreateEntityRequestData = z13.object({
|
|
2496
|
-
name: zEntityName,
|
|
2497
|
-
accounts: z13.array(z13.string())
|
|
2498
|
-
});
|
|
2499
|
-
var zEditEntityRequestData = z13.object({
|
|
2500
|
-
name: zEntityName,
|
|
2501
|
-
accounts: z13.array(z13.string())
|
|
2502
|
-
});
|
|
2503
2732
|
|
|
2504
2733
|
// src/requests/request-data.ts
|
|
2505
2734
|
var zVaultRequestMixinsByType = {
|
|
2506
2735
|
// Workspaces
|
|
2507
|
-
[RequestType.UPDATE_QUORUM]:
|
|
2508
|
-
type:
|
|
2736
|
+
[RequestType.UPDATE_QUORUM]: z14.object({
|
|
2737
|
+
type: z14.literal(RequestType.UPDATE_QUORUM),
|
|
2509
2738
|
data: zUpdateQuorumRequestData
|
|
2510
2739
|
}),
|
|
2511
2740
|
// Operator requests
|
|
2512
|
-
[RequestType.CREATE_TRANSACTION]:
|
|
2513
|
-
type:
|
|
2741
|
+
[RequestType.CREATE_TRANSACTION]: z14.object({
|
|
2742
|
+
type: z14.literal(RequestType.CREATE_TRANSACTION),
|
|
2514
2743
|
data: zCreateTransactionRequestData,
|
|
2515
|
-
meta:
|
|
2516
|
-
hash:
|
|
2744
|
+
meta: z14.object({
|
|
2745
|
+
hash: z14.string().nullable()
|
|
2517
2746
|
}).optional().nullable()
|
|
2518
2747
|
}),
|
|
2519
|
-
[RequestType.SIGN_MESSAGE]:
|
|
2520
|
-
type:
|
|
2748
|
+
[RequestType.SIGN_MESSAGE]: z14.object({
|
|
2749
|
+
type: z14.literal(RequestType.SIGN_MESSAGE),
|
|
2521
2750
|
data: zSignMessageRequestData
|
|
2522
2751
|
}),
|
|
2523
|
-
[RequestType.SIGN_DIGESTS]:
|
|
2524
|
-
type:
|
|
2752
|
+
[RequestType.SIGN_DIGESTS]: z14.object({
|
|
2753
|
+
type: z14.literal(RequestType.SIGN_DIGESTS),
|
|
2525
2754
|
data: zSignDigestsRequestData
|
|
2526
2755
|
}),
|
|
2527
2756
|
// Accounts
|
|
2528
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
2529
|
-
type:
|
|
2757
|
+
[RequestType.CREATE_ACCOUNT]: z14.object({
|
|
2758
|
+
type: z14.literal(RequestType.CREATE_ACCOUNT),
|
|
2530
2759
|
data: zCreateAccountRequestData
|
|
2531
2760
|
}),
|
|
2532
|
-
[RequestType.EDIT_ACCOUNT]:
|
|
2533
|
-
type:
|
|
2534
|
-
targetId:
|
|
2761
|
+
[RequestType.EDIT_ACCOUNT]: z14.object({
|
|
2762
|
+
type: z14.literal(RequestType.EDIT_ACCOUNT),
|
|
2763
|
+
targetId: z14.string(),
|
|
2535
2764
|
data: zEditAccountRequestData
|
|
2536
2765
|
}),
|
|
2537
|
-
[RequestType.EDIT_TOKEN_RULE]:
|
|
2538
|
-
type:
|
|
2539
|
-
targetId:
|
|
2766
|
+
[RequestType.EDIT_TOKEN_RULE]: z14.object({
|
|
2767
|
+
type: z14.literal(RequestType.EDIT_TOKEN_RULE),
|
|
2768
|
+
targetId: z14.string(),
|
|
2540
2769
|
data: zEditTokenRuleRequestData
|
|
2541
2770
|
}),
|
|
2542
2771
|
// Groups
|
|
2543
|
-
[RequestType.CREATE_GROUP]:
|
|
2544
|
-
type:
|
|
2772
|
+
[RequestType.CREATE_GROUP]: z14.object({
|
|
2773
|
+
type: z14.literal(RequestType.CREATE_GROUP),
|
|
2545
2774
|
data: zCreateGroupRequestData
|
|
2546
2775
|
}),
|
|
2547
|
-
[RequestType.EDIT_GROUP]:
|
|
2548
|
-
type:
|
|
2549
|
-
targetId:
|
|
2776
|
+
[RequestType.EDIT_GROUP]: z14.object({
|
|
2777
|
+
type: z14.literal(RequestType.EDIT_GROUP),
|
|
2778
|
+
targetId: z14.string(),
|
|
2550
2779
|
data: zEditGroupRequestData
|
|
2551
2780
|
}),
|
|
2552
|
-
[RequestType.REVOKE_GROUP]:
|
|
2553
|
-
type:
|
|
2554
|
-
targetId:
|
|
2781
|
+
[RequestType.REVOKE_GROUP]: z14.object({
|
|
2782
|
+
type: z14.literal(RequestType.REVOKE_GROUP),
|
|
2783
|
+
targetId: z14.string(),
|
|
2555
2784
|
data: zRevokeUserRequestData
|
|
2556
2785
|
}),
|
|
2557
2786
|
// Whitelists
|
|
2558
|
-
[RequestType.CREATE_WHITELIST]:
|
|
2559
|
-
type:
|
|
2787
|
+
[RequestType.CREATE_WHITELIST]: z14.object({
|
|
2788
|
+
type: z14.literal(RequestType.CREATE_WHITELIST),
|
|
2560
2789
|
data: zCreateWhitelistRequestData
|
|
2561
2790
|
}),
|
|
2562
|
-
[RequestType.EDIT_WHITELIST]:
|
|
2563
|
-
type:
|
|
2564
|
-
targetId:
|
|
2791
|
+
[RequestType.EDIT_WHITELIST]: z14.object({
|
|
2792
|
+
type: z14.literal(RequestType.EDIT_WHITELIST),
|
|
2793
|
+
targetId: z14.string(),
|
|
2565
2794
|
data: zEditWhitelistRequestData
|
|
2566
2795
|
}),
|
|
2567
2796
|
// Entities
|
|
2568
|
-
[RequestType.CREATE_ENTITY]:
|
|
2569
|
-
type:
|
|
2797
|
+
[RequestType.CREATE_ENTITY]: z14.object({
|
|
2798
|
+
type: z14.literal(RequestType.CREATE_ENTITY),
|
|
2570
2799
|
data: zCreateEntityRequestData
|
|
2571
2800
|
}),
|
|
2572
|
-
[RequestType.EDIT_ENTITY]:
|
|
2573
|
-
type:
|
|
2801
|
+
[RequestType.EDIT_ENTITY]: z14.object({
|
|
2802
|
+
type: z14.literal(RequestType.EDIT_ENTITY),
|
|
2803
|
+
targetId: z14.string(),
|
|
2574
2804
|
data: zEditEntityRequestData
|
|
2575
2805
|
}),
|
|
2576
|
-
[RequestType.REVOKE_ENTITY]:
|
|
2577
|
-
type:
|
|
2578
|
-
|
|
2806
|
+
[RequestType.REVOKE_ENTITY]: z14.object({
|
|
2807
|
+
type: z14.literal(RequestType.REVOKE_ENTITY),
|
|
2808
|
+
targetId: z14.string(),
|
|
2809
|
+
data: zRevokeEntityRequestData
|
|
2579
2810
|
}),
|
|
2580
2811
|
// Users
|
|
2581
|
-
[RequestType.CREATE_PSD_USER]:
|
|
2582
|
-
type:
|
|
2812
|
+
[RequestType.CREATE_PSD_USER]: z14.object({
|
|
2813
|
+
type: z14.literal(RequestType.CREATE_PSD_USER),
|
|
2583
2814
|
data: zCreatePsdUserRequestData
|
|
2584
2815
|
}),
|
|
2585
|
-
[RequestType.CREATE_API_USER]:
|
|
2586
|
-
type:
|
|
2816
|
+
[RequestType.CREATE_API_USER]: z14.object({
|
|
2817
|
+
type: z14.literal(RequestType.CREATE_API_USER),
|
|
2587
2818
|
data: zCreateApiUserRequestData
|
|
2588
2819
|
}),
|
|
2589
|
-
[RequestType.CREATE_API_USER_ACCESS]:
|
|
2590
|
-
type:
|
|
2820
|
+
[RequestType.CREATE_API_USER_ACCESS]: z14.object({
|
|
2821
|
+
type: z14.literal(RequestType.CREATE_API_USER_ACCESS),
|
|
2591
2822
|
data: zCreateApiUserAccessRequestData
|
|
2592
2823
|
}),
|
|
2593
|
-
[RequestType.REVOKE_USER]:
|
|
2594
|
-
type:
|
|
2595
|
-
targetId:
|
|
2824
|
+
[RequestType.REVOKE_USER]: z14.object({
|
|
2825
|
+
type: z14.literal(RequestType.REVOKE_USER),
|
|
2826
|
+
targetId: z14.string(),
|
|
2596
2827
|
data: zRevokeUserRequestData
|
|
2597
2828
|
}),
|
|
2598
2829
|
// Admin gov rules
|
|
2599
|
-
[RequestType.EDIT_WORKSPACE_RULE]:
|
|
2600
|
-
type:
|
|
2830
|
+
[RequestType.EDIT_WORKSPACE_RULE]: z14.object({
|
|
2831
|
+
type: z14.literal(RequestType.EDIT_WORKSPACE_RULE),
|
|
2601
2832
|
data: zWorkspaceRuleRequestData
|
|
2602
2833
|
}),
|
|
2603
2834
|
// SCI configs
|
|
2604
|
-
[RequestType.CREATE_SCICONFIG]:
|
|
2605
|
-
type:
|
|
2835
|
+
[RequestType.CREATE_SCICONFIG]: z14.object({
|
|
2836
|
+
type: z14.literal(RequestType.CREATE_SCICONFIG),
|
|
2606
2837
|
data: zCreateSciConfigRequestData
|
|
2607
2838
|
}),
|
|
2608
|
-
[RequestType.EDIT_SCICONFIG]:
|
|
2609
|
-
type:
|
|
2839
|
+
[RequestType.EDIT_SCICONFIG]: z14.object({
|
|
2840
|
+
type: z14.literal(RequestType.EDIT_SCICONFIG),
|
|
2610
2841
|
data: zEditSciConfigRequestData
|
|
2611
2842
|
}),
|
|
2612
2843
|
// API keys
|
|
2613
|
-
[RequestType.CREATE_API_KEY]:
|
|
2614
|
-
type:
|
|
2844
|
+
[RequestType.CREATE_API_KEY]: z14.object({
|
|
2845
|
+
type: z14.literal(RequestType.CREATE_API_KEY),
|
|
2615
2846
|
data: zCreateApiKeyRequestData
|
|
2616
2847
|
}),
|
|
2617
|
-
[RequestType.EDIT_API_KEY]:
|
|
2618
|
-
type:
|
|
2848
|
+
[RequestType.EDIT_API_KEY]: z14.object({
|
|
2849
|
+
type: z14.literal(RequestType.EDIT_API_KEY),
|
|
2619
2850
|
data: zEditApiKeyRequestData
|
|
2620
2851
|
}),
|
|
2621
|
-
[RequestType.REVOKE_API_KEY]:
|
|
2622
|
-
type:
|
|
2623
|
-
data:
|
|
2852
|
+
[RequestType.REVOKE_API_KEY]: z14.object({
|
|
2853
|
+
type: z14.literal(RequestType.REVOKE_API_KEY),
|
|
2854
|
+
data: z14.object({})
|
|
2624
2855
|
}),
|
|
2625
2856
|
// Policies
|
|
2626
|
-
[RequestType.CREATE_POLICY]:
|
|
2627
|
-
type:
|
|
2857
|
+
[RequestType.CREATE_POLICY]: z14.object({
|
|
2858
|
+
type: z14.literal(RequestType.CREATE_POLICY),
|
|
2628
2859
|
data: zCreatePublicPolicyRequestData
|
|
2629
2860
|
}),
|
|
2630
|
-
[RequestType.EDIT_POLICY]:
|
|
2631
|
-
type:
|
|
2632
|
-
targetId:
|
|
2861
|
+
[RequestType.EDIT_POLICY]: z14.object({
|
|
2862
|
+
type: z14.literal(RequestType.EDIT_POLICY),
|
|
2863
|
+
targetId: z14.string(),
|
|
2633
2864
|
data: zEditPublicPolicyRequestData
|
|
2634
2865
|
}),
|
|
2635
2866
|
// Tradelink-related requests
|
|
@@ -2637,34 +2868,34 @@ var zVaultRequestMixinsByType = {
|
|
|
2637
2868
|
};
|
|
2638
2869
|
|
|
2639
2870
|
// src/requests/app-types.ts
|
|
2640
|
-
var zRequestReviewResponse =
|
|
2871
|
+
var zRequestReviewResponse = z14.object({
|
|
2641
2872
|
// Note: Do NOT include `quorum` as it is already available in the request's `reviewSteps` field.
|
|
2642
|
-
stepIndex:
|
|
2643
|
-
userId:
|
|
2644
|
-
status:
|
|
2645
|
-
createdAt:
|
|
2646
|
-
updatedAt:
|
|
2647
|
-
});
|
|
2648
|
-
var zVaultRequestCommonMixin =
|
|
2649
|
-
id:
|
|
2650
|
-
legacyId:
|
|
2651
|
-
state:
|
|
2873
|
+
stepIndex: z14.number().int().meta({ description: "Index of the governance step in the request workflow" }),
|
|
2874
|
+
userId: z14.string().meta({ description: "Reviewer id" }),
|
|
2875
|
+
status: z14.enum(RequestReviewStatus).meta({ description: "Review status" }),
|
|
2876
|
+
createdAt: z14.coerce.date().meta({ description: "Created date" }),
|
|
2877
|
+
updatedAt: z14.coerce.date().meta({ description: "Updated date" })
|
|
2878
|
+
});
|
|
2879
|
+
var zVaultRequestCommonMixin = z14.object({
|
|
2880
|
+
id: z14.string().meta({ description: "Request unique identifier" }),
|
|
2881
|
+
legacyId: z14.number().meta({ description: "Legacy internal unique identifier (for retro-compatibility)" }),
|
|
2882
|
+
state: z14.enum(RequestState).meta({ description: "Request state" }),
|
|
2652
2883
|
reviewSteps: zRequestReviewSteps.meta({ description: "Request review steps" }),
|
|
2653
|
-
currentStepIndex:
|
|
2654
|
-
expiresAt:
|
|
2655
|
-
expiredAt:
|
|
2656
|
-
targetId:
|
|
2884
|
+
currentStepIndex: z14.number().int().min(0).meta({ description: "Index of the current approval step" }),
|
|
2885
|
+
expiresAt: z14.coerce.date().meta({ description: "Request expiration date" }),
|
|
2886
|
+
expiredAt: z14.coerce.date().optional().meta({ description: "Deprecated: use expiresAt" }),
|
|
2887
|
+
targetId: z14.string().nullable().meta({ description: "Optional ID of the target object" }),
|
|
2657
2888
|
note: zNote.nullable().meta({ description: "Optional request note" }),
|
|
2658
|
-
reviews:
|
|
2889
|
+
reviews: z14.array(zRequestReviewResponse).meta({ description: "Requests reviews" }),
|
|
2659
2890
|
// `type` and `data` are correlated -- See `zVaultRequestMixinsByType`
|
|
2660
|
-
createdAt:
|
|
2661
|
-
updatedAt:
|
|
2662
|
-
createdById:
|
|
2891
|
+
createdAt: z14.coerce.date().meta({ description: "Creation timestamp" }),
|
|
2892
|
+
updatedAt: z14.coerce.date().meta({ description: "Last modification timestamp" }),
|
|
2893
|
+
createdById: z14.string().meta({ description: "ID of the user who created the request" }),
|
|
2663
2894
|
// `inflight` is fetched from ONGOING RequestSaga
|
|
2664
|
-
inflight:
|
|
2665
|
-
lastError:
|
|
2666
|
-
numFailed:
|
|
2667
|
-
retryAfter:
|
|
2895
|
+
inflight: z14.object({
|
|
2896
|
+
lastError: z14.string().nullable().meta({ description: "Error message from the last failure" }),
|
|
2897
|
+
numFailed: z14.number().int().meta({ description: "Number of failures so far" }),
|
|
2898
|
+
retryAfter: z14.coerce.date().meta({ description: "Date after which next retry is scheduled" })
|
|
2668
2899
|
}).optional().meta({ description: "Extra information if the request is currently being processed" })
|
|
2669
2900
|
});
|
|
2670
2901
|
var allowedRequestCreationInputByType = {
|
|
@@ -2676,14 +2907,14 @@ var allowedRequestCreationInputByType = {
|
|
|
2676
2907
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
2677
2908
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
2678
2909
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
2679
|
-
[RequestType.SIGN_MESSAGE]:
|
|
2680
|
-
type:
|
|
2910
|
+
[RequestType.SIGN_MESSAGE]: z14.object({
|
|
2911
|
+
type: z14.literal(RequestType.SIGN_MESSAGE),
|
|
2681
2912
|
data: zSignMessageUserInputData
|
|
2682
2913
|
}),
|
|
2683
2914
|
[RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
|
|
2684
2915
|
[RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
|
|
2685
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
2686
|
-
type:
|
|
2916
|
+
[RequestType.CREATE_ACCOUNT]: z14.object({
|
|
2917
|
+
type: z14.literal(RequestType.CREATE_ACCOUNT),
|
|
2687
2918
|
data: zCreateAccountUserInputData
|
|
2688
2919
|
}),
|
|
2689
2920
|
[RequestType.EDIT_ACCOUNT]: zVaultRequestMixinsByType[RequestType.EDIT_ACCOUNT],
|
|
@@ -2701,13 +2932,16 @@ var allowedRequestCreationInputByType = {
|
|
|
2701
2932
|
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW],
|
|
2702
2933
|
[RequestType.TRADELINK_ARBITRATE]: zVaultRequestMixinsByType[RequestType.TRADELINK_ARBITRATE],
|
|
2703
2934
|
[RequestType.REVOKE_USER]: zVaultRequestMixinsByType[RequestType.REVOKE_USER],
|
|
2704
|
-
[RequestType.EDIT_WORKSPACE_RULE]: zVaultRequestMixinsByType[RequestType.EDIT_WORKSPACE_RULE]
|
|
2935
|
+
[RequestType.EDIT_WORKSPACE_RULE]: zVaultRequestMixinsByType[RequestType.EDIT_WORKSPACE_RULE],
|
|
2936
|
+
[RequestType.CREATE_ENTITY]: zVaultRequestMixinsByType[RequestType.CREATE_ENTITY],
|
|
2937
|
+
[RequestType.EDIT_ENTITY]: zVaultRequestMixinsByType[RequestType.EDIT_ENTITY],
|
|
2938
|
+
[RequestType.REVOKE_ENTITY]: zVaultRequestMixinsByType[RequestType.REVOKE_ENTITY]
|
|
2705
2939
|
};
|
|
2706
|
-
var zRequestCreationInputCommonMixin =
|
|
2940
|
+
var zRequestCreationInputCommonMixin = z14.object({
|
|
2707
2941
|
note: zNote.optional().meta({ description: "Optional request note" })
|
|
2708
2942
|
});
|
|
2709
|
-
|
|
2710
|
-
request:
|
|
2943
|
+
z14.object({
|
|
2944
|
+
request: z14.discriminatedUnion(
|
|
2711
2945
|
"type",
|
|
2712
2946
|
ensureNonEmptyArray(
|
|
2713
2947
|
Object.values(allowedRequestCreationInputByType).map((_) => {
|
|
@@ -2719,7 +2953,7 @@ z13.object({
|
|
|
2719
2953
|
)
|
|
2720
2954
|
)
|
|
2721
2955
|
});
|
|
2722
|
-
var zVaultRequestResponse =
|
|
2956
|
+
var zVaultRequestResponse = z14.discriminatedUnion(
|
|
2723
2957
|
"type",
|
|
2724
2958
|
ensureNonEmptyArray(
|
|
2725
2959
|
Object.values(zVaultRequestMixinsByType).map((_) => {
|
|
@@ -2733,18 +2967,30 @@ var zVaultRequestResponse = z13.discriminatedUnion(
|
|
|
2733
2967
|
description: "Vault request response data",
|
|
2734
2968
|
id: "VaultRequestResponse"
|
|
2735
2969
|
});
|
|
2736
|
-
|
|
2970
|
+
z14.enum([
|
|
2737
2971
|
"state",
|
|
2738
2972
|
"expiresAt",
|
|
2739
2973
|
"createdAt",
|
|
2740
2974
|
"updatedAt"
|
|
2741
2975
|
]).default("createdAt");
|
|
2742
|
-
|
|
2743
|
-
pubKey:
|
|
2744
|
-
challenge:
|
|
2976
|
+
z14.object({
|
|
2977
|
+
pubKey: z14.string().meta({ description: "Public key of the current user" }),
|
|
2978
|
+
challenge: zChallenge.meta({
|
|
2745
2979
|
description: "Challenge data to sign with the user's private key"
|
|
2746
2980
|
})
|
|
2747
2981
|
});
|
|
2982
|
+
z14.object({
|
|
2983
|
+
id: z14.string().meta({ description: "ID of the request to approve" }),
|
|
2984
|
+
data: z14.discriminatedUnion("challengeType", [
|
|
2985
|
+
z14.object({
|
|
2986
|
+
challengeType: z14.enum([ChallengeType.PSD, ChallengeType.API]).meta({ description: "Challenge type" }),
|
|
2987
|
+
signature: z14.string().min(1).meta({ description: "Challenge signature" })
|
|
2988
|
+
}),
|
|
2989
|
+
z14.object({
|
|
2990
|
+
challengeType: z14.enum([ChallengeType.SOFT]).meta({ description: "Challenge type" })
|
|
2991
|
+
})
|
|
2992
|
+
])
|
|
2993
|
+
});
|
|
2748
2994
|
|
|
2749
2995
|
// src/requests/app-utils/index.ts
|
|
2750
2996
|
function serializeVaultRequest(request) {
|