@ledgerhq/revault-api 1.29.4 → 1.31.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-mEeONvZb.d.mts → app-types--WzpkjcT.d.mts} +11201 -9709
- package/lib/fakes.d.mts +201 -183
- package/lib/fakes.mjs +741 -753
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +3671 -3353
- package/package.json +2 -2
package/lib/fakes.mjs
CHANGED
|
@@ -1,12 +1,62 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
|
-
import z5, { z } from 'zod';
|
|
3
2
|
import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, ActivationStatus, WhitelistType, UserRole, UserRegistrationState, AdminPermission, RequestType, RequestReviewStatus, RequestState, GateAccountType } from '@prisma/client';
|
|
3
|
+
import z7, { z } from 'zod';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import invariant from 'invariant';
|
|
6
6
|
import { omit, times } from 'lodash';
|
|
7
7
|
import 'crypto';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
|
|
15
|
+
var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
|
|
16
|
+
var zUnsignedIntString = z.string().nonempty().regex(/^([1-9]\d*|0)$/);
|
|
17
|
+
var zCurrency = z.string().nonempty().max(40).regex(/^\w+$/).describe("Currency");
|
|
18
|
+
var zHsmObjectId = z.string().regex(/^[\w-]+$/).min(1);
|
|
19
|
+
|
|
20
|
+
// src/types/operation.ts
|
|
21
|
+
var zValueTransactionOperationType = z.enum([
|
|
22
|
+
"SEND",
|
|
23
|
+
"STAKE",
|
|
24
|
+
"DEPLOY_CONTRACT",
|
|
25
|
+
"EXECUTE_CONTRACT",
|
|
26
|
+
"ACTIVATE_TOKEN"
|
|
27
|
+
]);
|
|
28
|
+
var zValueTransactionOperation = z.object({
|
|
29
|
+
type: zValueTransactionOperationType,
|
|
30
|
+
currency: zCurrency,
|
|
31
|
+
recipient: z.string().nonempty(),
|
|
32
|
+
destinationTag: z.string().nonempty().optional(),
|
|
33
|
+
value: zUnsignedIntString
|
|
34
|
+
});
|
|
35
|
+
var zSigningOperationType = z.enum(["SIGN_MESSAGE", "SIGN_DIGESTS"]);
|
|
36
|
+
var zSigningOperation = z.object({
|
|
37
|
+
type: zSigningOperationType
|
|
38
|
+
});
|
|
39
|
+
var zClassicOperationType = z.enum([
|
|
40
|
+
"SEND",
|
|
41
|
+
"STAKE",
|
|
42
|
+
"DEPLOY_CONTRACT",
|
|
43
|
+
"EXECUTE_CONTRACT",
|
|
44
|
+
"SIGN_MESSAGE",
|
|
45
|
+
"ACTIVATE_TOKEN"
|
|
46
|
+
]);
|
|
47
|
+
z.enum(["SIGN_DIGESTS"]);
|
|
48
|
+
var zOperationType = z.enum([
|
|
49
|
+
...zValueTransactionOperationType.options,
|
|
50
|
+
...zSigningOperationType.options
|
|
51
|
+
]);
|
|
52
|
+
z.discriminatedUnion("type", [
|
|
53
|
+
zValueTransactionOperation,
|
|
54
|
+
zSigningOperation
|
|
55
|
+
]);
|
|
56
|
+
var zNote = z7.object({
|
|
57
|
+
title: z7.string().describe("Note title"),
|
|
58
|
+
content: z7.string().describe("Note content")
|
|
59
|
+
});
|
|
10
60
|
|
|
11
61
|
// src/errors.ts
|
|
12
62
|
var ValidationError = class extends Error {
|
|
@@ -32,13 +82,6 @@ var ensureNonEmptyArray = (values, message) => {
|
|
|
32
82
|
function unreachable(value) {
|
|
33
83
|
throw new Error(`Un-covered: ${value}`);
|
|
34
84
|
}
|
|
35
|
-
var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
|
|
36
|
-
var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
|
|
37
|
-
var zUnsignedIntString = z.string().nonempty().regex(/^([1-9]\d*|0)$/);
|
|
38
|
-
var zCurrency = z.string().nonempty().max(40).regex(/^\w+$/).describe("Currency");
|
|
39
|
-
|
|
40
|
-
// src/hsm/types.ts
|
|
41
|
-
var zHsmObjectId = z.string().regex(/^[\w-]+$/).min(1);
|
|
42
85
|
var zPubKey = zHexString.describe("Public key");
|
|
43
86
|
var zHsmCertificate = z.object({
|
|
44
87
|
codeHash: z.string().base64().describe("Hash of the executable that generated this certificate"),
|
|
@@ -144,8 +187,8 @@ var zHsmSignature = z.object({
|
|
|
144
187
|
),
|
|
145
188
|
pubkey: zHexString.nullable().describe("Public key for signature verification, 32 or 33 bytes")
|
|
146
189
|
});
|
|
147
|
-
var zBitcoinLikeTransactionType =
|
|
148
|
-
var zCardanoLikeTransactionType =
|
|
190
|
+
var zBitcoinLikeTransactionType = z7.enum(["BITCOIN_LIKE_SEND", "BITCOIN_LIKE_RECEIVE"]).describe("Bitcoin-like transaction type");
|
|
191
|
+
var zCardanoLikeTransactionType = z7.enum([
|
|
149
192
|
"CARDANO_LIKE_SEND",
|
|
150
193
|
"CARDANO_LIKE_RECEIVE",
|
|
151
194
|
"CARDANO_LIKE_STAKING_REGISTER",
|
|
@@ -153,9 +196,9 @@ var zCardanoLikeTransactionType = z5.enum([
|
|
|
153
196
|
"CARDANO_LIKE_STAKING_DELEGATE",
|
|
154
197
|
"CARDANO_LIKE_STAKING_WITHDRAW"
|
|
155
198
|
]).describe("Cardano-like transaction type");
|
|
156
|
-
var zEthereumLikeTransferTransactionType =
|
|
157
|
-
var zEthereumLikeContractTransactionType =
|
|
158
|
-
var zPolkadotLikeTransactionType =
|
|
199
|
+
var zEthereumLikeTransferTransactionType = z7.enum(["ETHEREUM_LIKE_SEND", "ETHEREUM_LIKE_RECEIVE"]).describe("Ethereum-like transaction type");
|
|
200
|
+
var zEthereumLikeContractTransactionType = z7.enum(["ETHEREUM_LIKE_EXECUTE_CONTRACT", "ETHEREUM_LIKE_DEPLOY_CONTRACT"]).describe("Ethereum-like transaction type");
|
|
201
|
+
var zPolkadotLikeTransactionType = z7.enum([
|
|
159
202
|
"POLKADOT_LIKE_SEND",
|
|
160
203
|
"POLKADOT_LIKE_RECEIVE",
|
|
161
204
|
"POLKADOT_LIKE_ADDPROXY",
|
|
@@ -177,8 +220,8 @@ var zPolkadotLikeTransactionType = z5.enum([
|
|
|
177
220
|
"POLKADOT_LIKE_CHILL",
|
|
178
221
|
"POLKADOT_LIKE_TRANSFERALL"
|
|
179
222
|
]).describe("Polkadot-like transaction type");
|
|
180
|
-
var zRippleLikeTransactionType =
|
|
181
|
-
var zSolanaLikeTransactionType =
|
|
223
|
+
var zRippleLikeTransactionType = z7.enum(["RIPPLE_LIKE_SEND", "RIPPLE_LIKE_RECEIVE"]).describe("Ripple-like transaction type");
|
|
224
|
+
var zSolanaLikeTransactionType = z7.enum([
|
|
182
225
|
"SOLANA_LIKE_SEND",
|
|
183
226
|
"SOLANA_LIKE_RECEIVE",
|
|
184
227
|
"SOLANA_LIKE_CREATE_DELEGATE_STAKE",
|
|
@@ -191,16 +234,16 @@ var zSolanaLikeTransactionType = z5.enum([
|
|
|
191
234
|
"SOLANA_LIKE_SEND_TOKEN",
|
|
192
235
|
"SOLANA_LIKE_FUND_TOKEN"
|
|
193
236
|
]).describe("Solana-like transaction type");
|
|
194
|
-
var zStellarLikeTransactionType =
|
|
195
|
-
var zTezosLikeTransactionType =
|
|
237
|
+
var zStellarLikeTransactionType = z7.enum(["STELLAR_LIKE_SEND", "STELLAR_LIKE_RECEIVE"]).describe("Stellar-like transaction type");
|
|
238
|
+
var zTezosLikeTransactionType = z7.enum([
|
|
196
239
|
"TEZOS_LIKE_SEND",
|
|
197
240
|
"TEZOS_LIKE_RECEIVE",
|
|
198
241
|
"TEZOS_LIKE_REVEAL",
|
|
199
242
|
"TEZOS_LIKE_DELEGATE",
|
|
200
243
|
"TEZOS_LIKE_UNDELEGATE"
|
|
201
244
|
]).describe("Tezos-like transaction type");
|
|
202
|
-
var zGenericTransactionType =
|
|
203
|
-
|
|
245
|
+
var zGenericTransactionType = z7.enum(["GENERIC_TRANSACTION"]).describe("Generic transaction type");
|
|
246
|
+
z7.union([
|
|
204
247
|
zBitcoinLikeTransactionType,
|
|
205
248
|
zCardanoLikeTransactionType,
|
|
206
249
|
zEthereumLikeTransferTransactionType,
|
|
@@ -212,40 +255,45 @@ z5.union([
|
|
|
212
255
|
zStellarLikeTransactionType,
|
|
213
256
|
zTezosLikeTransactionType
|
|
214
257
|
]);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
type:
|
|
258
|
+
z7.discriminatedUnion("type", [
|
|
259
|
+
z7.object({
|
|
260
|
+
type: z7.literal("ETHEREUM_LIKE"),
|
|
218
261
|
baseFees: zIntString,
|
|
219
262
|
gasLimit: zIntString,
|
|
220
|
-
nonce:
|
|
263
|
+
nonce: z7.string(),
|
|
221
264
|
priorityFees: zIntString
|
|
222
265
|
})
|
|
223
266
|
]);
|
|
267
|
+
var zMessageType = z7.enum(["EIP191", "EIP712"]);
|
|
268
|
+
var zMessage = z7.object({
|
|
269
|
+
type: zMessageType.describe("Type of the message to sign"),
|
|
270
|
+
data: zHexString.nonempty().describe("Hex data to sign, either a json string for EIP712, or a raw string for EIP191")
|
|
271
|
+
});
|
|
224
272
|
|
|
225
273
|
// src/transactions/request-data.ts
|
|
226
|
-
var zHexDataString =
|
|
274
|
+
var zHexDataString = z7.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/).transform((hex) => `0x${hex.toLowerCase().replace("0x", "")}`);
|
|
227
275
|
if ("openapi" in zHexDataString) {
|
|
228
276
|
zHexDataString = zHexDataString.openapi?.({ effectType: "same" });
|
|
229
277
|
}
|
|
230
|
-
var zCommonTransactionData =
|
|
278
|
+
var zCommonTransactionData = z7.object({
|
|
231
279
|
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
232
280
|
currency: zCurrency.describe("Transaction currency"),
|
|
233
281
|
// TODO: strict literal or enum?
|
|
234
282
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
235
|
-
recipient:
|
|
283
|
+
recipient: z7.string().describe("Transaction recipient")
|
|
236
284
|
});
|
|
237
|
-
var zFeeStrategyCustom =
|
|
238
|
-
type:
|
|
285
|
+
var zFeeStrategyCustom = z7.object({
|
|
286
|
+
type: z7.enum(["SLOW", "NORMAL", "FAST", "CUSTOM"])
|
|
239
287
|
});
|
|
240
|
-
var zFeeStrategy =
|
|
241
|
-
type:
|
|
288
|
+
var zFeeStrategy = z7.object({
|
|
289
|
+
type: z7.enum(["SLOW", "NORMAL", "FAST"])
|
|
242
290
|
});
|
|
243
291
|
var zBitcoinLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
244
292
|
// nullish is optional + nullable, it is easier to seed rather than just optional
|
|
245
293
|
feePerByte: zUnsignedIntString.nullish().describe("Fee per byte")
|
|
246
294
|
}).describe("Bitcoin-like fee strategy");
|
|
247
295
|
var zBitcoinLikeSendData = zCommonTransactionData.extend({
|
|
248
|
-
type:
|
|
296
|
+
type: z7.literal(zBitcoinLikeTransactionType.enum.BITCOIN_LIKE_SEND),
|
|
249
297
|
feeStrategy: zBitcoinLikeFeeStrategy
|
|
250
298
|
}).describe("Bitcoin-like send data");
|
|
251
299
|
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
@@ -257,21 +305,21 @@ var zEthereumLikeEip1559FeeStrategy = zFeeStrategyCustom.extend({
|
|
|
257
305
|
maxFeePerGas: zUnsignedIntString.describe("Maximum fee per gas (base + priority)"),
|
|
258
306
|
gasLimit: zUnsignedIntString.describe("Gas limit")
|
|
259
307
|
}).describe("Ethereum-like EIP-1559 fee strategy");
|
|
260
|
-
var zEthereumLikeFeeStrategy =
|
|
308
|
+
var zEthereumLikeFeeStrategy = z7.union([zEthereumLikeLegacyFeeStrategy, zEthereumLikeEip1559FeeStrategy]).describe("Ethereum-like fee strategy");
|
|
261
309
|
var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
262
|
-
type:
|
|
310
|
+
type: z7.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_DEPLOY_CONTRACT),
|
|
263
311
|
// force the recipient to be the zero address
|
|
264
|
-
recipient:
|
|
312
|
+
recipient: z7.literal("0x0000000000000000000000000000000000000000"),
|
|
265
313
|
contractData: zHexDataString.describe("Contract data in hexadecimal format"),
|
|
266
314
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
267
315
|
}).describe("Ethereum-like deploy contract data");
|
|
268
316
|
var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
269
|
-
type:
|
|
317
|
+
type: z7.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_EXECUTE_CONTRACT),
|
|
270
318
|
contractData: zHexDataString.describe("Contract call data in hexadecimal format"),
|
|
271
319
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
272
320
|
}).describe("Ethereum-like execute contract data");
|
|
273
321
|
var zEthereumLikeSendData = zCommonTransactionData.extend({
|
|
274
|
-
type:
|
|
322
|
+
type: z7.literal(zEthereumLikeTransferTransactionType.enum.ETHEREUM_LIKE_SEND),
|
|
275
323
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
276
324
|
}).describe("Ethereum-like send data");
|
|
277
325
|
var zTezosLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
@@ -279,183 +327,183 @@ var zTezosLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
|
279
327
|
storageLimit: zUnsignedIntString.nullable().describe("Storage limit")
|
|
280
328
|
}).describe("Tezos-like fee strategy");
|
|
281
329
|
var zTezosLikeDelegateData = zCommonTransactionData.extend({
|
|
282
|
-
type:
|
|
330
|
+
type: z7.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_DELEGATE),
|
|
283
331
|
feeStrategy: zTezosLikeFeeStrategy
|
|
284
332
|
}).describe("Tezos-like delegate data");
|
|
285
333
|
var zTezosLikeSendData = zCommonTransactionData.extend({
|
|
286
|
-
type:
|
|
334
|
+
type: z7.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_SEND),
|
|
287
335
|
feeStrategy: zTezosLikeFeeStrategy
|
|
288
336
|
}).describe("Tezos-like send data");
|
|
289
337
|
var zTezosLikeUndelegateData = zCommonTransactionData.extend({
|
|
290
|
-
type:
|
|
338
|
+
type: z7.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_UNDELEGATE),
|
|
291
339
|
feeStrategy: zTezosLikeFeeStrategy
|
|
292
340
|
}).describe("Tezos-like undelegate data");
|
|
293
|
-
var zPolkadotRewardDestination =
|
|
294
|
-
var zPolkadotLikeAddProxyData =
|
|
295
|
-
type:
|
|
341
|
+
var zPolkadotRewardDestination = z7.enum(["Staked", "Stash"]);
|
|
342
|
+
var zPolkadotLikeAddProxyData = z7.object({
|
|
343
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ADDPROXY),
|
|
296
344
|
currency: zCurrency.describe("Transaction currency"),
|
|
297
|
-
kind:
|
|
298
|
-
proxy:
|
|
345
|
+
kind: z7.literal("Staking").describe("Proxy kind"),
|
|
346
|
+
proxy: z7.string().describe("Proxy address")
|
|
299
347
|
}).describe("Polkadot-like add proxy data");
|
|
300
|
-
var zPolkadotLikeAnonymousProxyData =
|
|
301
|
-
type:
|
|
348
|
+
var zPolkadotLikeAnonymousProxyData = z7.object({
|
|
349
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ANONYMOUSPROXY),
|
|
302
350
|
currency: zCurrency.describe("Transaction currency")
|
|
303
351
|
}).describe("Polkadot-like anonymous proxy data");
|
|
304
|
-
var zPolkadotLikeBondData =
|
|
305
|
-
type:
|
|
352
|
+
var zPolkadotLikeBondData = z7.object({
|
|
353
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BOND),
|
|
306
354
|
currency: zCurrency.describe("Transaction currency"),
|
|
307
355
|
payee: zPolkadotRewardDestination,
|
|
308
356
|
amount: zUnsignedIntString.describe("Amount")
|
|
309
357
|
}).describe("Polkadot-like bond data");
|
|
310
|
-
var zPolkadotLikeBondExtraData =
|
|
311
|
-
type:
|
|
358
|
+
var zPolkadotLikeBondExtraData = z7.object({
|
|
359
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BONDEXTRA),
|
|
312
360
|
currency: zCurrency.describe("Transaction currency"),
|
|
313
361
|
amount: zUnsignedIntString.describe("Amount")
|
|
314
362
|
}).describe("Polkadot-like bond extra data");
|
|
315
|
-
var zPolkadotLikeChillData =
|
|
316
|
-
type:
|
|
363
|
+
var zPolkadotLikeChillData = z7.object({
|
|
364
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_CHILL),
|
|
317
365
|
currency: zCurrency.describe("Transaction currency")
|
|
318
366
|
}).describe("Polkadot-like chill data");
|
|
319
|
-
var zPolkadotLikeKillAnonymousData =
|
|
320
|
-
type:
|
|
367
|
+
var zPolkadotLikeKillAnonymousData = z7.object({
|
|
368
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_KILLANONYMOUS),
|
|
321
369
|
currency: zCurrency.describe("Transaction currency")
|
|
322
370
|
}).describe("Polkadot-like kill anonymous data");
|
|
323
|
-
var zPolkadotLikeRebondData =
|
|
324
|
-
type:
|
|
371
|
+
var zPolkadotLikeRebondData = z7.object({
|
|
372
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REBOND),
|
|
325
373
|
currency: zCurrency.describe("Transaction currency"),
|
|
326
374
|
amount: zUnsignedIntString.describe("Amount")
|
|
327
375
|
}).describe("Polkadot-like rebond data");
|
|
328
|
-
var zPolkadotLikeRemoveProxyData =
|
|
329
|
-
type:
|
|
376
|
+
var zPolkadotLikeRemoveProxyData = z7.object({
|
|
377
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REMOVEPROXY),
|
|
330
378
|
currency: zCurrency.describe("Transaction currency"),
|
|
331
|
-
kind:
|
|
332
|
-
proxy:
|
|
379
|
+
kind: z7.literal("Staking"),
|
|
380
|
+
proxy: z7.string().describe("Proxy address")
|
|
333
381
|
}).describe("Polkadot-like remove proxy data");
|
|
334
382
|
var zPolkadotLikeSendData = zCommonTransactionData.extend({
|
|
335
|
-
type:
|
|
383
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SEND)
|
|
336
384
|
}).describe("Polkadot-like send data");
|
|
337
|
-
var zPolkadotLikeSetPayeeData =
|
|
338
|
-
type:
|
|
385
|
+
var zPolkadotLikeSetPayeeData = z7.object({
|
|
386
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SETPAYEE),
|
|
339
387
|
currency: zCurrency.describe("Transaction currency"),
|
|
340
388
|
payee: zPolkadotRewardDestination
|
|
341
389
|
}).describe("Polkadot-like set payee data");
|
|
342
|
-
var zPolkadotLikeUnbondData =
|
|
343
|
-
type:
|
|
390
|
+
var zPolkadotLikeUnbondData = z7.object({
|
|
391
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_UNBOND),
|
|
344
392
|
currency: zCurrency.describe("Transaction currency"),
|
|
345
393
|
amount: zUnsignedIntString.describe("Amount")
|
|
346
394
|
}).describe("Polkadot-like unbond data");
|
|
347
|
-
var zPolkadotLikeWithdrawUnbondedData =
|
|
348
|
-
type:
|
|
395
|
+
var zPolkadotLikeWithdrawUnbondedData = z7.object({
|
|
396
|
+
type: z7.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_WITHDRAWUNBONDED),
|
|
349
397
|
currency: zCurrency.describe("Transaction currency")
|
|
350
398
|
}).describe("Polkadot-like withdraw unbonded data");
|
|
351
399
|
var zRippleLikeSendData = zCommonTransactionData.extend({
|
|
352
|
-
type:
|
|
400
|
+
type: z7.literal(zRippleLikeTransactionType.enum.RIPPLE_LIKE_SEND),
|
|
353
401
|
destinationTag: zIntString.nullable().describe("Destination tag"),
|
|
354
402
|
feeStrategy: zFeeStrategyCustom.describe("Ripple-like fee strategy")
|
|
355
403
|
}).describe("Ripple-like send data");
|
|
356
|
-
var zStellarMemo =
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
MEMO_HASH:
|
|
404
|
+
var zStellarMemo = z7.union([
|
|
405
|
+
z7.object({ MEMO_TEXT: z7.string().max(28).describe("Text memo (at most a 28 bytes string)") }).describe("Text memo"),
|
|
406
|
+
z7.object({ MEMO_ID: zIntString.describe("Id memo (unsigned 64 bits integer)") }).describe("Id memo"),
|
|
407
|
+
z7.object({
|
|
408
|
+
MEMO_HASH: z7.string().max(128).regex(/^[a-fA-F0-9]+$/).describe("Transaction hash memo (64 bytes hexadecimal string)")
|
|
361
409
|
}).describe("Hash memo"),
|
|
362
|
-
|
|
363
|
-
MEMO_RETURN:
|
|
410
|
+
z7.object({
|
|
411
|
+
MEMO_RETURN: z7.string().max(128).regex(/^[a-fA-F0-9]+$/).describe(
|
|
364
412
|
"A 64 bytes hexadecimal string intended to be interpreted as the hash of the transaction the sender is refunding."
|
|
365
413
|
)
|
|
366
414
|
}).describe("Return memo")
|
|
367
415
|
]);
|
|
368
416
|
var zStellarLikeSendData = zCommonTransactionData.extend({
|
|
369
|
-
type:
|
|
417
|
+
type: z7.literal(zStellarLikeTransactionType.enum.STELLAR_LIKE_SEND),
|
|
370
418
|
memo: zStellarMemo.nullable().describe("Stellar memo"),
|
|
371
419
|
feeStrategy: zFeeStrategy.describe("Stellar-like fee strategy")
|
|
372
420
|
}).describe("Stellar-like send data");
|
|
373
421
|
var zSolanaLikeCreateDelegateStakeData = zCommonTransactionData.extend({
|
|
374
|
-
type:
|
|
375
|
-
recipient:
|
|
422
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_DELEGATE_STAKE),
|
|
423
|
+
recipient: z7.string().describe("Delegated vote address"),
|
|
376
424
|
// Re-described
|
|
377
425
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
378
426
|
}).describe("Solana-like create delegate stake data");
|
|
379
|
-
var zSolanaLikeDeactivateStakeData =
|
|
380
|
-
type:
|
|
427
|
+
var zSolanaLikeDeactivateStakeData = z7.object({
|
|
428
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DEACTIVATE_STAKE),
|
|
381
429
|
currency: zCurrency.describe("Transaction currency"),
|
|
382
430
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
383
|
-
stakeAccount:
|
|
431
|
+
stakeAccount: z7.string().describe("Stake account address"),
|
|
384
432
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
385
433
|
// No recipient, no amount
|
|
386
434
|
}).describe("Solana-like deactivate stake data");
|
|
387
|
-
var zSolanaLikeDelegateStakeData =
|
|
388
|
-
type:
|
|
435
|
+
var zSolanaLikeDelegateStakeData = z7.object({
|
|
436
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DELEGATE_STAKE),
|
|
389
437
|
currency: zCurrency.describe("Transaction currency"),
|
|
390
438
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
391
|
-
recipient:
|
|
392
|
-
stakeAccount:
|
|
439
|
+
recipient: z7.string().describe("Delegated vote address"),
|
|
440
|
+
stakeAccount: z7.string().describe("Stake account address"),
|
|
393
441
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
394
442
|
// No amount
|
|
395
443
|
}).describe("Solana-like delegate stake data");
|
|
396
|
-
var zSolanaLikeMergeStakeData =
|
|
397
|
-
type:
|
|
444
|
+
var zSolanaLikeMergeStakeData = z7.object({
|
|
445
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_MERGE_STAKE),
|
|
398
446
|
currency: zCurrency.describe("Transaction currency"),
|
|
399
447
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
400
|
-
mergeSrcAccount:
|
|
401
|
-
mergeDstAccount:
|
|
448
|
+
mergeSrcAccount: z7.string().describe("Source stake address"),
|
|
449
|
+
mergeDstAccount: z7.string().describe("Destination stake address"),
|
|
402
450
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
403
451
|
// No recipient, no amount
|
|
404
452
|
}).describe("Solana-like merge stake data");
|
|
405
453
|
var zSolanaLikeSendData = zCommonTransactionData.extend({
|
|
406
|
-
type:
|
|
454
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND),
|
|
407
455
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
408
456
|
}).describe("Solana-like send data");
|
|
409
|
-
var zSolanaLikeSplitDeactivateStakeData =
|
|
410
|
-
type:
|
|
457
|
+
var zSolanaLikeSplitDeactivateStakeData = z7.object({
|
|
458
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE),
|
|
411
459
|
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
412
460
|
currency: zCurrency.describe("Transaction currency"),
|
|
413
461
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
414
|
-
stakeAccount:
|
|
462
|
+
stakeAccount: z7.string().describe("Stake account address"),
|
|
415
463
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
416
464
|
// No recipient
|
|
417
465
|
}).describe("Solana-like split deactivate stake data");
|
|
418
|
-
var zSolanaLikeSplitStakeData =
|
|
419
|
-
type:
|
|
466
|
+
var zSolanaLikeSplitStakeData = z7.object({
|
|
467
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_STAKE),
|
|
420
468
|
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
421
469
|
currency: zCurrency.describe("Transaction currency"),
|
|
422
470
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
423
|
-
stakeAccount:
|
|
471
|
+
stakeAccount: z7.string().describe("Stake account address"),
|
|
424
472
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
425
473
|
// No recipient
|
|
426
474
|
}).describe("Solana-like split stake data");
|
|
427
|
-
var zSolanaLikeWithdrawStakeData =
|
|
428
|
-
type:
|
|
475
|
+
var zSolanaLikeWithdrawStakeData = z7.object({
|
|
476
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_WITHDRAW_STAKE),
|
|
429
477
|
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
430
478
|
currency: zCurrency.describe("Transaction currency"),
|
|
431
479
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
432
|
-
stakeAccount:
|
|
480
|
+
stakeAccount: z7.string().describe("Stake account address"),
|
|
433
481
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
434
482
|
// No recipient
|
|
435
483
|
}).describe("Solana-like delegate stake data");
|
|
436
484
|
var zSolanaLikeSendTokenData = zCommonTransactionData.extend({
|
|
437
|
-
type:
|
|
485
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND_TOKEN),
|
|
438
486
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
439
487
|
}).describe("Solana-like send token data");
|
|
440
488
|
var zSolanaLikeFundTokenData = zCommonTransactionData.extend({
|
|
441
|
-
type:
|
|
489
|
+
type: z7.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_FUND_TOKEN),
|
|
442
490
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
443
491
|
}).describe("Solana-like fund token data");
|
|
444
492
|
var zCardanoSendData = zCommonTransactionData.extend({
|
|
445
|
-
type:
|
|
493
|
+
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_SEND),
|
|
446
494
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy")
|
|
447
495
|
}).describe("Cardano-like send data");
|
|
448
|
-
var zCardanoStakingDelegateData =
|
|
449
|
-
type:
|
|
496
|
+
var zCardanoStakingDelegateData = z7.object({
|
|
497
|
+
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DELEGATE),
|
|
450
498
|
currency: zCurrency.describe("Transaction currency"),
|
|
451
499
|
// TODO: strict literal or enum?
|
|
452
500
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
453
501
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
454
502
|
// DELEGATE doesn't have neither amount nor recipient
|
|
455
|
-
stakePoolId:
|
|
503
|
+
stakePoolId: z7.string().min(1).max(100).describe("")
|
|
456
504
|
}).describe("Cardano-like staking delegate");
|
|
457
|
-
var zCardanoStakingDeregisterData =
|
|
458
|
-
type:
|
|
505
|
+
var zCardanoStakingDeregisterData = z7.object({
|
|
506
|
+
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DEREGISTER),
|
|
459
507
|
currency: zCurrency.describe("Transaction currency"),
|
|
460
508
|
// TODO: strict literal or enum?
|
|
461
509
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
@@ -463,8 +511,8 @@ var zCardanoStakingDeregisterData = z5.object({
|
|
|
463
511
|
// DEREGISTER doesn't have a recipient
|
|
464
512
|
amount: zUnsignedIntString.describe("Amount to deregister")
|
|
465
513
|
}).describe("Cardano-like staking deregister data");
|
|
466
|
-
var zCardanoStakingRegisterData =
|
|
467
|
-
type:
|
|
514
|
+
var zCardanoStakingRegisterData = z7.object({
|
|
515
|
+
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
468
516
|
currency: zCurrency.describe("Transaction currency"),
|
|
469
517
|
// TODO: strict literal or enum?
|
|
470
518
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
@@ -472,8 +520,8 @@ var zCardanoStakingRegisterData = z5.object({
|
|
|
472
520
|
// REGISTER doesn't have a recipient
|
|
473
521
|
amount: zUnsignedIntString.describe("Amount to register")
|
|
474
522
|
}).describe("Cardano-like staking register data");
|
|
475
|
-
var zCardanoStakingWithdrawData =
|
|
476
|
-
type:
|
|
523
|
+
var zCardanoStakingWithdrawData = z7.object({
|
|
524
|
+
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_WITHDRAW),
|
|
477
525
|
currency: zCurrency.describe("Transaction currency"),
|
|
478
526
|
// TODO: strict literal or enum?
|
|
479
527
|
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
@@ -481,12 +529,12 @@ var zCardanoStakingWithdrawData = z5.object({
|
|
|
481
529
|
// WITHDRAW doesn't have a recipient
|
|
482
530
|
amount: zUnsignedIntString.describe("Amount to withdraw")
|
|
483
531
|
}).describe("Cardano-like staking withdraw data");
|
|
484
|
-
var zGenericTransactionData =
|
|
485
|
-
type:
|
|
532
|
+
var zGenericTransactionData = z7.object({
|
|
533
|
+
type: z7.literal(zGenericTransactionType.enum.GENERIC_TRANSACTION),
|
|
486
534
|
currency: zCurrency.describe("Transaction currency"),
|
|
487
|
-
rawTx:
|
|
535
|
+
rawTx: z7.string().describe("Raw tx")
|
|
488
536
|
}).describe("Generic transaction data");
|
|
489
|
-
var zTransactionData =
|
|
537
|
+
var zTransactionData = z7.discriminatedUnion("type", [
|
|
490
538
|
// Bitcoin
|
|
491
539
|
zBitcoinLikeSendData,
|
|
492
540
|
// Cardano
|
|
@@ -534,7 +582,7 @@ var zTransactionData = z5.discriminatedUnion("type", [
|
|
|
534
582
|
zTezosLikeSendData,
|
|
535
583
|
zTezosLikeUndelegateData
|
|
536
584
|
]);
|
|
537
|
-
var zSendOnlyTransactionData =
|
|
585
|
+
var zSendOnlyTransactionData = z7.discriminatedUnion("type", [
|
|
538
586
|
zBitcoinLikeSendData,
|
|
539
587
|
zCardanoSendData,
|
|
540
588
|
zEthereumLikeSendData,
|
|
@@ -544,94 +592,89 @@ var zSendOnlyTransactionData = z5.discriminatedUnion("type", [
|
|
|
544
592
|
zStellarLikeSendData,
|
|
545
593
|
zTezosLikeSendData
|
|
546
594
|
]);
|
|
547
|
-
var zCreateTransactionRequestData =
|
|
548
|
-
accountId:
|
|
595
|
+
var zCreateTransactionRequestData = z7.object({
|
|
596
|
+
accountId: z7.string().min(1).describe("Target account id"),
|
|
549
597
|
transaction: zTransactionData
|
|
550
598
|
});
|
|
551
|
-
var zSignMessageRequestData =
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
address:
|
|
599
|
+
var zSignMessageRequestData = z7.object({
|
|
600
|
+
message: zMessage.describe("Message to sign"),
|
|
601
|
+
accountId: z7.string().min(1).describe("Target account id"),
|
|
602
|
+
address: z7.string().nonempty().describe("Address with which to sign the message"),
|
|
603
|
+
derivationPath: z7.string().nonempty().describe("Derivation path of the signing address")
|
|
555
604
|
});
|
|
556
|
-
|
|
557
|
-
|
|
605
|
+
var zSignMessageUserInputData = zSignMessageRequestData.partial({
|
|
606
|
+
address: true,
|
|
607
|
+
derivationPath: true
|
|
558
608
|
});
|
|
559
|
-
|
|
609
|
+
z7.object({
|
|
610
|
+
// Populated after input data is validated.
|
|
611
|
+
govRuleHsmId: zHsmObjectId.optional(),
|
|
612
|
+
// Populated after request is executed -- it holds the message-signing result.
|
|
613
|
+
signature: zHsmSignature.optional()
|
|
614
|
+
});
|
|
615
|
+
var zDigestData = z7.object({
|
|
560
616
|
digest: zHexString.describe("The hex string digest to sign"),
|
|
561
|
-
derivationPath:
|
|
617
|
+
derivationPath: z7.string().nonempty().describe("The derivation path with which to sign the digest")
|
|
562
618
|
});
|
|
563
|
-
var zSignDigestsRequestData =
|
|
564
|
-
accountId:
|
|
565
|
-
digests:
|
|
619
|
+
var zSignDigestsRequestData = z7.object({
|
|
620
|
+
accountId: z7.string().min(1).describe("Target account id"),
|
|
621
|
+
digests: z7.array(zDigestData).describe("The digests to sign")
|
|
566
622
|
});
|
|
567
|
-
|
|
568
|
-
signatures:
|
|
569
|
-
});
|
|
570
|
-
var zClassicOperationType = z.enum([
|
|
571
|
-
"SEND",
|
|
572
|
-
"STAKE",
|
|
573
|
-
"DEPLOY_CONTRACT",
|
|
574
|
-
"EXECUTE_CONTRACT",
|
|
575
|
-
"SIGN_MESSAGE",
|
|
576
|
-
"ACTIVATE_TOKEN"
|
|
577
|
-
]);
|
|
578
|
-
var zOperationType = z.enum([...zClassicOperationType.options, "SIGN_DIGESTS"]);
|
|
579
|
-
var zNote = z5.object({
|
|
580
|
-
title: z5.string().describe("Request note title"),
|
|
581
|
-
content: z5.string().describe("Request note content")
|
|
623
|
+
z7.object({
|
|
624
|
+
signatures: z7.array(zHsmSignature)
|
|
582
625
|
});
|
|
583
626
|
|
|
584
627
|
// src/accounts/clients/types.ts
|
|
585
|
-
var zTransactionStatus =
|
|
586
|
-
var zBitcoinLikeCoinFields =
|
|
628
|
+
var zTransactionStatus = z7.enum(["SUCCESSFUL", "FAILED"]);
|
|
629
|
+
var zBitcoinLikeCoinFields = z7.object({
|
|
587
630
|
type: zBitcoinLikeTransactionType
|
|
588
631
|
});
|
|
589
|
-
var zCardanoLikeCoinFields =
|
|
632
|
+
var zCardanoLikeCoinFields = z7.object({
|
|
590
633
|
type: zCardanoLikeTransactionType
|
|
591
634
|
});
|
|
592
|
-
var zEthereumLikeTransferCoinFields =
|
|
635
|
+
var zEthereumLikeTransferCoinFields = z7.object({
|
|
593
636
|
type: zEthereumLikeTransferTransactionType,
|
|
594
|
-
gasPrice:
|
|
595
|
-
gasLimit:
|
|
596
|
-
nonce:
|
|
637
|
+
gasPrice: z7.string(),
|
|
638
|
+
gasLimit: z7.string(),
|
|
639
|
+
nonce: z7.string()
|
|
597
640
|
});
|
|
598
641
|
var zEthereumLikeContractCoinFields = zEthereumLikeTransferCoinFields.extend({
|
|
599
642
|
type: zEthereumLikeContractTransactionType,
|
|
600
|
-
contractData:
|
|
643
|
+
contractData: z7.string().describe("Contract deployment or contract execution data")
|
|
601
644
|
});
|
|
602
|
-
var zGenericCoinFields =
|
|
645
|
+
var zGenericCoinFields = z7.object({
|
|
603
646
|
type: zGenericTransactionType
|
|
604
647
|
});
|
|
605
|
-
var zPolkadotLikeCoinFields =
|
|
648
|
+
var zPolkadotLikeCoinFields = z7.object({
|
|
606
649
|
type: zPolkadotLikeTransactionType
|
|
607
650
|
});
|
|
608
|
-
var zRippleLikeCoinFields =
|
|
651
|
+
var zRippleLikeCoinFields = z7.object({
|
|
609
652
|
type: zRippleLikeTransactionType,
|
|
610
|
-
memos:
|
|
611
|
-
destinationTag:
|
|
653
|
+
memos: z7.array(z7.string()),
|
|
654
|
+
destinationTag: z7.string()
|
|
612
655
|
});
|
|
613
|
-
var zSolanaLikeCoinFields =
|
|
656
|
+
var zSolanaLikeCoinFields = z7.object({
|
|
614
657
|
type: zSolanaLikeTransactionType
|
|
615
658
|
});
|
|
616
|
-
var zStellarLikeCoinFields =
|
|
659
|
+
var zStellarLikeCoinFields = z7.object({
|
|
617
660
|
type: zStellarLikeTransactionType
|
|
618
661
|
});
|
|
619
|
-
var zTezosLikeCoinFields =
|
|
662
|
+
var zTezosLikeCoinFields = z7.object({
|
|
620
663
|
type: zTezosLikeTransactionType
|
|
621
664
|
});
|
|
622
|
-
var zCommonTransactionResponse =
|
|
623
|
-
id:
|
|
624
|
-
hash:
|
|
625
|
-
block:
|
|
626
|
-
height:
|
|
627
|
-
time:
|
|
665
|
+
var zCommonTransactionResponse = z7.object({
|
|
666
|
+
id: z7.string().describe("Internal unique identifier"),
|
|
667
|
+
hash: z7.string().describe("Transaction hash"),
|
|
668
|
+
block: z7.object({
|
|
669
|
+
height: z7.string().nullable().describe("Transaction block height"),
|
|
670
|
+
time: z7.string().nullable().describe("Transaction block time")
|
|
628
671
|
}),
|
|
629
672
|
status: zTransactionStatus.describe("Transaction status"),
|
|
630
|
-
confirmations:
|
|
631
|
-
amount:
|
|
632
|
-
fee:
|
|
633
|
-
senders:
|
|
634
|
-
recipients:
|
|
673
|
+
confirmations: z7.string().describe("Block confirmations"),
|
|
674
|
+
amount: z7.string().describe("Transaction amount"),
|
|
675
|
+
fee: z7.string().describe("Transaction fee"),
|
|
676
|
+
senders: z7.array(z7.string()).describe("Senders (can be multiple for UTXOs-based accounts)"),
|
|
677
|
+
recipients: z7.array(z7.string()).describe("Recipients (can be multiple for multi-output transactions)")
|
|
635
678
|
});
|
|
636
679
|
var zBitcoinLikeTransactionResponse = zCommonTransactionResponse.merge(zBitcoinLikeCoinFields).describe("Bitcoin-like transaction");
|
|
637
680
|
var zCardanoLikeTransactionResponse = zCommonTransactionResponse.merge(zCardanoLikeCoinFields).describe("Cardano-like transaction");
|
|
@@ -643,7 +686,7 @@ var zRippleLikeTransactionResponse = zCommonTransactionResponse.merge(zRippleLik
|
|
|
643
686
|
var zSolanaLikeTransactionResponse = zCommonTransactionResponse.merge(zSolanaLikeCoinFields).describe("Solana-like transaction");
|
|
644
687
|
var zStellarLikeTransactionResponse = zCommonTransactionResponse.merge(zStellarLikeCoinFields).describe("Stellar-like transaction");
|
|
645
688
|
var zTezosLikeTransactionResponse = zCommonTransactionResponse.merge(zTezosLikeCoinFields).describe("Tezos-like transaction");
|
|
646
|
-
var zTransactionResponse =
|
|
689
|
+
var zTransactionResponse = z7.discriminatedUnion("type", [
|
|
647
690
|
zBitcoinLikeTransactionResponse,
|
|
648
691
|
zCardanoLikeTransactionResponse,
|
|
649
692
|
zEthereumLikeTransferTransactionResponse,
|
|
@@ -655,131 +698,12 @@ var zTransactionResponse = z5.discriminatedUnion("type", [
|
|
|
655
698
|
zStellarLikeTransactionResponse,
|
|
656
699
|
zTezosLikeTransactionResponse
|
|
657
700
|
]);
|
|
658
|
-
|
|
701
|
+
z7.discriminatedUnion(
|
|
659
702
|
zTransactionResponse.discriminator,
|
|
660
703
|
ensureNonEmptyArray(
|
|
661
704
|
zTransactionResponse.options.map((_) => _.extend({ note: zNote.nullable() }))
|
|
662
705
|
)
|
|
663
706
|
);
|
|
664
|
-
var zCardanoLikeStakingData = z5.object({
|
|
665
|
-
staked: z5.string().describe("Staked balance")
|
|
666
|
-
}).nullable().describe("Cardano-like staking data");
|
|
667
|
-
var zCardanoLikeStakingFields = z5.object({
|
|
668
|
-
type: z5.literal(AccountType.CARDANO_LIKE).describe("Account type"),
|
|
669
|
-
staking: zCardanoLikeStakingData.optional()
|
|
670
|
-
});
|
|
671
|
-
var zEthereumLikeStakingData = z5.object({
|
|
672
|
-
totalStaking: z5.string().describe("Total staked amount"),
|
|
673
|
-
totalRewards: z5.string().describe("Total of rewards"),
|
|
674
|
-
availableRewards: z5.string().describe("Available rewards"),
|
|
675
|
-
networkApy: z5.number().describe("Network APY")
|
|
676
|
-
}).nullable().describe("Ethereum-like staking data");
|
|
677
|
-
var zEthereumLikeStakingFields = z5.object({
|
|
678
|
-
type: z5.literal(AccountType.ETHEREUM_LIKE).describe("Account type"),
|
|
679
|
-
staking: zEthereumLikeStakingData.optional()
|
|
680
|
-
});
|
|
681
|
-
var zPolkadotUnbondingAmount = z5.object({
|
|
682
|
-
amount: z5.string().describe("Amount"),
|
|
683
|
-
waiting_time: z5.string().describe("Waiting time")
|
|
684
|
-
});
|
|
685
|
-
var zPolkadotLikeStakingData = z5.object({
|
|
686
|
-
info: z5.object({
|
|
687
|
-
controllerAddress: z5.string().nullable().describe("Controller address"),
|
|
688
|
-
rewardsDestination: z5.string().nullable().describe("Rewards destination"),
|
|
689
|
-
proxies: z5.array(z5.string()).describe("Proxies"),
|
|
690
|
-
legacyStaking: z5.boolean().describe("True if account uses legacy staking"),
|
|
691
|
-
isNominator: z5.boolean().describe("True if is nominator")
|
|
692
|
-
}),
|
|
693
|
-
balances: z5.object({
|
|
694
|
-
free: z5.string().describe("Free balance"),
|
|
695
|
-
reserved: z5.string().describe("Reserved balance"),
|
|
696
|
-
frozen: z5.string().describe("Frozen balance"),
|
|
697
|
-
bonded: z5.string().describe("Bonded balance"),
|
|
698
|
-
available: z5.string().describe("Available balance"),
|
|
699
|
-
unbonding: z5.array(zPolkadotUnbondingAmount).describe("Unbonding balances"),
|
|
700
|
-
unbonded: z5.array(zPolkadotUnbondingAmount).describe("Unbonded balances"),
|
|
701
|
-
totalUnbonding: z5.string().describe("Total unbonding"),
|
|
702
|
-
totalUnbonded: z5.string().describe("Total unbonded")
|
|
703
|
-
}),
|
|
704
|
-
anonymousProxy: z5.object({
|
|
705
|
-
address: z5.string().describe("Address"),
|
|
706
|
-
createdAt: z5.string().describe("Creation date"),
|
|
707
|
-
isController: z5.boolean().describe("True if is controller"),
|
|
708
|
-
isMain: z5.boolean().describe("True if is main"),
|
|
709
|
-
balances: z5.object({
|
|
710
|
-
free: z5.string().describe("Anonymous proxy free balance"),
|
|
711
|
-
reserved: z5.string().describe("Anonymous proxy reserved balance"),
|
|
712
|
-
frozen: z5.string().describe("Anonymous proxy frozen balance"),
|
|
713
|
-
bonded: z5.string().describe("Anonymous proxy bonded balance"),
|
|
714
|
-
available: z5.string().describe("Anonymous proxy available balance"),
|
|
715
|
-
total: z5.string().describe("Anonymous proxy total balance")
|
|
716
|
-
}).nullable(),
|
|
717
|
-
blockHeight: z5.string().describe("Anonymous proxy block height"),
|
|
718
|
-
extIndex: z5.string().describe("Ext index"),
|
|
719
|
-
index: z5.string().describe("Index"),
|
|
720
|
-
kind: z5.string().describe("Kind")
|
|
721
|
-
}).nullable().describe("Anonymous proxy")
|
|
722
|
-
}).nullable().describe("Polkadot-like staking data");
|
|
723
|
-
var zPolkadotLikeStakingFields = z5.object({
|
|
724
|
-
type: z5.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
725
|
-
staking: zPolkadotLikeStakingData.optional()
|
|
726
|
-
});
|
|
727
|
-
var zSolanaStakingAccountStatus = z5.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).describe("Staking account status");
|
|
728
|
-
var zSolanaLikeStakingData = z5.object({
|
|
729
|
-
staked: z5.string().describe("Staked balance"),
|
|
730
|
-
rewards: z5.object({
|
|
731
|
-
total: z5.string().describe("Total rewards"),
|
|
732
|
-
last7: z5.string().describe("Rewards on last 7 days"),
|
|
733
|
-
last30: z5.string().describe("Rewards on last 30 days")
|
|
734
|
-
}),
|
|
735
|
-
stakes: z5.array(
|
|
736
|
-
z5.object({
|
|
737
|
-
uid: z5.string(),
|
|
738
|
-
baseAccountUid: z5.string(),
|
|
739
|
-
pubKey: z5.string().describe("Public key"),
|
|
740
|
-
validatorPubKey: z5.string().nullable().describe("Validator public key"),
|
|
741
|
-
initialAmount: z5.string().describe("Initial amount"),
|
|
742
|
-
activeAmount: z5.string().describe("Active amount"),
|
|
743
|
-
inactiveAmount: z5.string().describe("Inactive amount"),
|
|
744
|
-
totalBalance: z5.string().describe("Total balance"),
|
|
745
|
-
creationDate: z5.string().describe("Creation date"),
|
|
746
|
-
activationEpoch: z5.string().nullable().describe("Activation epoch"),
|
|
747
|
-
activationDate: z5.string().nullable().describe("Activation date"),
|
|
748
|
-
deactivationEpoch: z5.string().nullable().describe("Deactivation epoch"),
|
|
749
|
-
deactivationDate: z5.string().nullable().describe("Deactivation date"),
|
|
750
|
-
status: zSolanaStakingAccountStatus,
|
|
751
|
-
rentExemptReserve: z5.string().describe("Rent exempt reserve"),
|
|
752
|
-
withdrawableAmount: z5.string().describe("Withdrawable amount"),
|
|
753
|
-
totalRewards: z5.string().describe("Total rewards"),
|
|
754
|
-
creationTxHash: z5.string().nullable().describe("Creation transaction hash"),
|
|
755
|
-
actionsTxHashes: z5.array(z5.string()).describe("Actions transactions hashes")
|
|
756
|
-
})
|
|
757
|
-
)
|
|
758
|
-
}).nullable().describe("Solana-like staking data");
|
|
759
|
-
var zSolanaLikeStakingFields = z5.object({
|
|
760
|
-
type: z5.literal(AccountType.SOLANA_LIKE).describe("Account type"),
|
|
761
|
-
staking: zSolanaLikeStakingData.optional()
|
|
762
|
-
});
|
|
763
|
-
var zTezosLikeStakingData = z5.object({
|
|
764
|
-
delegations: z5.array(
|
|
765
|
-
z5.object({
|
|
766
|
-
address: z5.string()
|
|
767
|
-
})
|
|
768
|
-
)
|
|
769
|
-
}).nullable().describe("Tezos-like staking data");
|
|
770
|
-
var zTezosLikeStakingFields = z5.object({
|
|
771
|
-
type: z5.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
772
|
-
staking: zTezosLikeStakingData.optional()
|
|
773
|
-
});
|
|
774
|
-
z5.discriminatedUnion("type", [
|
|
775
|
-
zCardanoLikeStakingFields,
|
|
776
|
-
zEthereumLikeStakingFields,
|
|
777
|
-
zPolkadotLikeStakingFields,
|
|
778
|
-
zSolanaLikeStakingFields,
|
|
779
|
-
zTezosLikeStakingFields
|
|
780
|
-
]);
|
|
781
|
-
|
|
782
|
-
// src/accounts/account-asset-fields.ts
|
|
783
707
|
var zBitcoinLikeAssetFields = z.object({
|
|
784
708
|
type: z.literal(AccountType.BITCOIN_LIKE).describe("Account type"),
|
|
785
709
|
xpub: z.string().describe("xpub (extended public key)")
|
|
@@ -820,7 +744,7 @@ var zTezosLikeAssetFields = z.object({
|
|
|
820
744
|
type: z.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
821
745
|
address: z.string().describe("Account address").nullable()
|
|
822
746
|
}).describe("Tezos-like");
|
|
823
|
-
z.discriminatedUnion("type", [
|
|
747
|
+
var zAccountAssetStaticFields = z.discriminatedUnion("type", [
|
|
824
748
|
zBitcoinLikeAssetFields,
|
|
825
749
|
zCardanoLikeAssetFields,
|
|
826
750
|
zEthereumLikeAssetFields,
|
|
@@ -833,19 +757,6 @@ z.discriminatedUnion("type", [
|
|
|
833
757
|
zStellarLikeAssetFields,
|
|
834
758
|
zTezosLikeAssetFields
|
|
835
759
|
]).describe("Account asset fields");
|
|
836
|
-
var zAccountAssetFields = z.discriminatedUnion("type", [
|
|
837
|
-
zBitcoinLikeAssetFields,
|
|
838
|
-
zCardanoLikeAssetFields.merge(zCardanoLikeStakingFields).describe("Cardano-like"),
|
|
839
|
-
zEthereumLikeAssetFields.merge(zEthereumLikeStakingFields).describe("Ethereum-like"),
|
|
840
|
-
zEthereumTokenLikeAssetFields,
|
|
841
|
-
zGenericLikeAssetFields,
|
|
842
|
-
zPolkadotLikeAssetFields.merge(zPolkadotLikeStakingFields).describe("Polkadot-like"),
|
|
843
|
-
zRawSigningAssetFields,
|
|
844
|
-
zRippleLikeAssetFields,
|
|
845
|
-
zSolanaLikeAssetFields.merge(zSolanaLikeStakingFields).describe("Solana-like"),
|
|
846
|
-
zStellarLikeAssetFields,
|
|
847
|
-
zTezosLikeAssetFields.merge(zTezosLikeStakingFields).describe("Tezos-like")
|
|
848
|
-
]).describe("Asset fields");
|
|
849
760
|
var zReviewStepWithUsers = z.object({
|
|
850
761
|
quorum: z.number().min(0).describe("Number of required approvals for the step"),
|
|
851
762
|
userIds: z.array(z.string().min(1)).describe("User ids in the step")
|
|
@@ -861,60 +772,103 @@ var zReviewStepData = z.union([
|
|
|
861
772
|
}).describe("Review step with group")
|
|
862
773
|
]);
|
|
863
774
|
var zReviewStepsArray = z.array(zReviewStepData).min(1).describe("Review steps");
|
|
864
|
-
|
|
865
|
-
|
|
775
|
+
|
|
776
|
+
// src/prisma-utils/policy.ts
|
|
777
|
+
var policy_exports = {};
|
|
778
|
+
__export(policy_exports, {
|
|
779
|
+
parseFields: () => parseFields,
|
|
780
|
+
zGovRuleJsonObject: () => zGovRuleJsonObject,
|
|
781
|
+
zGovRulesJsonArray: () => zGovRulesJsonArray,
|
|
782
|
+
zThreshold: () => zThreshold,
|
|
783
|
+
zWhitelistIds: () => zWhitelistIds
|
|
784
|
+
});
|
|
785
|
+
var zThreshold = z.object({
|
|
786
|
+
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
787
|
+
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
788
|
+
}).describe("Threshold for the transaction value");
|
|
789
|
+
var zWhitelistIds = z.array(z.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
790
|
+
var zGovRuleJsonObject = z.object({
|
|
791
|
+
// Required.
|
|
792
|
+
operationType: zOperationType.describe("Allowed operation type"),
|
|
793
|
+
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
794
|
+
threshold: zThreshold,
|
|
795
|
+
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
796
|
+
whitelistIds: zWhitelistIds,
|
|
797
|
+
reviewConfigId: z.string().min(1).describe("Id of ReviewConfig"),
|
|
798
|
+
// HSM id for the rule
|
|
799
|
+
hsmId: zHsmObjectId
|
|
800
|
+
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
801
|
+
var zGovRulesJsonArray = z.array(zGovRuleJsonObject);
|
|
802
|
+
var parseFields = (policy) => {
|
|
803
|
+
const rulesJsonArray = zGovRulesJsonArray.parse(policy.rulesJsonArray);
|
|
804
|
+
return { ...policy, rulesJsonArray };
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
// src/prisma-utils/review-config.ts
|
|
808
|
+
var review_config_exports = {};
|
|
809
|
+
__export(review_config_exports, {
|
|
810
|
+
INCLUDE_MEMBERS: () => INCLUDE_MEMBERS
|
|
811
|
+
});
|
|
812
|
+
var INCLUDE_MEMBERS = {
|
|
813
|
+
users: true,
|
|
814
|
+
groups: {
|
|
815
|
+
include: { members: true }
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
var zUpdateQuorumRequestData = z7.object({
|
|
819
|
+
quorum: z7.number().int().min(2).describe("Workspace quorum")
|
|
866
820
|
});
|
|
867
|
-
var zWorkspaceName =
|
|
821
|
+
var zWorkspaceName = z7.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
868
822
|
|
|
869
823
|
// src/tradelink/types.ts
|
|
870
|
-
var zTradelinkWhitelistAddress =
|
|
871
|
-
name:
|
|
824
|
+
var zTradelinkWhitelistAddress = z7.object({
|
|
825
|
+
name: z7.string().min(1),
|
|
872
826
|
currency: zCurrency,
|
|
873
|
-
address:
|
|
827
|
+
address: z7.string().min(1)
|
|
874
828
|
});
|
|
875
|
-
|
|
876
|
-
var zTradelinkId =
|
|
877
|
-
var zTradelinkOrgEntityResponse =
|
|
829
|
+
z7.array(zTradelinkWhitelistAddress);
|
|
830
|
+
var zTradelinkId = z7.string().describe("Unique identifier in Tradelink service");
|
|
831
|
+
var zTradelinkOrgEntityResponse = z7.object({
|
|
878
832
|
tradelinkId: zTradelinkId,
|
|
879
|
-
name:
|
|
880
|
-
code:
|
|
881
|
-
logoUrl:
|
|
833
|
+
name: z7.string().describe("Name"),
|
|
834
|
+
code: z7.string().describe("Code"),
|
|
835
|
+
logoUrl: z7.string().describe("Logo URL")
|
|
882
836
|
});
|
|
883
837
|
zTradelinkOrgEntityResponse.omit({
|
|
884
838
|
tradelinkId: true
|
|
885
839
|
});
|
|
886
|
-
|
|
840
|
+
z7.object({
|
|
887
841
|
tradelinkId: zTradelinkId
|
|
888
842
|
});
|
|
889
|
-
var zTradelinkExchangeConfig =
|
|
890
|
-
exchangeId:
|
|
891
|
-
repledgeAuthorized:
|
|
892
|
-
needsAssetManagerApprovalForSettlements:
|
|
843
|
+
var zTradelinkExchangeConfig = z7.object({
|
|
844
|
+
exchangeId: z7.string().describe("Tradelink exchange id"),
|
|
845
|
+
repledgeAuthorized: z7.boolean().describe("Determines whether this exchange is authorized to repledge on this account"),
|
|
846
|
+
needsAssetManagerApprovalForSettlements: z7.boolean().describe(
|
|
893
847
|
'Determines whether asset manager will "pre-approve" the settlement requests on this account'
|
|
894
848
|
)
|
|
895
849
|
});
|
|
896
|
-
var zTradelinkExchangeConfigs =
|
|
897
|
-
|
|
850
|
+
var zTradelinkExchangeConfigs = z7.array(zTradelinkExchangeConfig);
|
|
851
|
+
z7.object({
|
|
898
852
|
workspaceName: zWorkspaceName,
|
|
899
|
-
custodian:
|
|
900
|
-
assetManagers:
|
|
901
|
-
exchanges:
|
|
853
|
+
custodian: z7.object({ name: z7.string() }),
|
|
854
|
+
assetManagers: z7.array(z7.object({ name: z7.string() })),
|
|
855
|
+
exchanges: z7.array(z7.object({ name: z7.string() }))
|
|
902
856
|
});
|
|
903
|
-
|
|
904
|
-
tradelinkId:
|
|
857
|
+
z7.object({
|
|
858
|
+
tradelinkId: z7.string(),
|
|
905
859
|
workspaceName: zWorkspaceName,
|
|
906
860
|
custodian: zTradelinkOrgEntityResponse,
|
|
907
|
-
assetManagers:
|
|
908
|
-
exchanges:
|
|
861
|
+
assetManagers: z7.array(zTradelinkOrgEntityResponse),
|
|
862
|
+
exchanges: z7.array(zTradelinkOrgEntityResponse)
|
|
909
863
|
});
|
|
910
|
-
var zTradelinkAsset =
|
|
911
|
-
name:
|
|
912
|
-
magnitude:
|
|
864
|
+
var zTradelinkAsset = z7.object({
|
|
865
|
+
name: z7.string(),
|
|
866
|
+
magnitude: z7.number().int().nonnegative()
|
|
913
867
|
});
|
|
914
|
-
|
|
868
|
+
z7.object({
|
|
915
869
|
tradelinkId: zTradelinkId,
|
|
916
870
|
asset: zTradelinkAsset,
|
|
917
|
-
state:
|
|
871
|
+
state: z7.enum([
|
|
918
872
|
"PLEDGE_READY",
|
|
919
873
|
"PLEDGE_INCREMENT_PENDING_APPROVAL",
|
|
920
874
|
"PLEDGE_APPROVED",
|
|
@@ -931,28 +885,28 @@ z5.object({
|
|
|
931
885
|
"RECOVERING_FROM_FAILURE",
|
|
932
886
|
"PLEDGE_CONSUMED"
|
|
933
887
|
]),
|
|
934
|
-
isLocked:
|
|
935
|
-
amount:
|
|
936
|
-
pending:
|
|
937
|
-
repledge:
|
|
938
|
-
exchangeTradelinkId:
|
|
939
|
-
accountId:
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
workspaceName:
|
|
943
|
-
clientAccountId:
|
|
888
|
+
isLocked: z7.boolean(),
|
|
889
|
+
amount: z7.string().describe("Currently pledged amount"),
|
|
890
|
+
pending: z7.string().describe("Requested pledge increment, not yet approved"),
|
|
891
|
+
repledge: z7.string().describe("TODO: describe this field"),
|
|
892
|
+
exchangeTradelinkId: z7.string(),
|
|
893
|
+
accountId: z7.string()
|
|
894
|
+
});
|
|
895
|
+
z7.object({
|
|
896
|
+
workspaceName: z7.string(),
|
|
897
|
+
clientAccountId: z7.string().describe("Account ID from the client side"),
|
|
944
898
|
exchangeTradelinkId: zTradelinkId,
|
|
945
899
|
asset: zTradelinkAsset
|
|
946
900
|
});
|
|
947
|
-
|
|
901
|
+
z7.object({
|
|
948
902
|
pledgeTradelinkId: zTradelinkId,
|
|
949
903
|
amount: zUnsignedIntString,
|
|
950
904
|
asset: zTradelinkAsset
|
|
951
905
|
});
|
|
952
|
-
|
|
953
|
-
tradelinkId:
|
|
954
|
-
pledgeTradelinkId:
|
|
955
|
-
state:
|
|
906
|
+
z7.object({
|
|
907
|
+
tradelinkId: z7.string(),
|
|
908
|
+
pledgeTradelinkId: z7.string(),
|
|
909
|
+
state: z7.enum([
|
|
956
910
|
"REGISTERED",
|
|
957
911
|
"PENDING_REPLEDGE_CREATION_APPROVAL",
|
|
958
912
|
"PENDING_REPLEDGE_APPROVAL",
|
|
@@ -966,45 +920,45 @@ z5.object({
|
|
|
966
920
|
"CANCELED"
|
|
967
921
|
]),
|
|
968
922
|
// For now we only consider the outbound settlement
|
|
969
|
-
outboundTransactionHash:
|
|
923
|
+
outboundTransactionHash: z7.string().nullable()
|
|
970
924
|
});
|
|
971
925
|
|
|
972
926
|
// src/tradelink/request-data.ts
|
|
973
|
-
var zCustodianRequestData =
|
|
927
|
+
var zCustodianRequestData = z7.object({
|
|
974
928
|
settlement: zReviewStepWithUsersArray.describe("List of settlement review steps"),
|
|
975
929
|
withdraw: zReviewStepWithUsersArray.describe("List of withdraw review steps"),
|
|
976
930
|
arbitration: zReviewStepWithUsersArray.describe("List of arbitration review steps")
|
|
977
931
|
});
|
|
978
|
-
var zTradelinkEntityRequestData =
|
|
979
|
-
tradelinkId:
|
|
932
|
+
var zTradelinkEntityRequestData = z7.object({
|
|
933
|
+
tradelinkId: z7.string().min(1),
|
|
980
934
|
groups: zReviewStepWithUsersArray.describe("List of asset manager review groups"),
|
|
981
|
-
whitelist:
|
|
935
|
+
whitelist: z7.array(zTradelinkWhitelistAddress).describe("List of asset manager whitelisted addresses")
|
|
982
936
|
});
|
|
983
|
-
var zAdjustPledgeRequestData =
|
|
984
|
-
accountId:
|
|
985
|
-
exchangeId:
|
|
937
|
+
var zAdjustPledgeRequestData = z7.object({
|
|
938
|
+
accountId: z7.string().describe("Account id"),
|
|
939
|
+
exchangeId: z7.string().describe("Exchange id"),
|
|
986
940
|
amount: zIntString.describe("Amount to add to pledge")
|
|
987
941
|
});
|
|
988
|
-
var zRepledgeRequestData =
|
|
989
|
-
accountId:
|
|
990
|
-
exchangeId:
|
|
942
|
+
var zRepledgeRequestData = z7.object({
|
|
943
|
+
accountId: z7.string().describe("Account id"),
|
|
944
|
+
exchangeId: z7.string().describe("Exchange id"),
|
|
991
945
|
amount: zIntString.describe("Amount to add to pledge")
|
|
992
946
|
});
|
|
993
|
-
var zCreateSettlementRequestData =
|
|
994
|
-
accountId:
|
|
995
|
-
exchangeId:
|
|
947
|
+
var zCreateSettlementRequestData = z7.object({
|
|
948
|
+
accountId: z7.string().describe("Account id"),
|
|
949
|
+
exchangeId: z7.string().describe("Exchange id"),
|
|
996
950
|
transaction: zSendOnlyTransactionData
|
|
997
951
|
});
|
|
998
|
-
var zForceUnpledgeRequestData =
|
|
999
|
-
accountId:
|
|
1000
|
-
exchangeId:
|
|
952
|
+
var zForceUnpledgeRequestData = z7.object({
|
|
953
|
+
accountId: z7.string().describe("Account id"),
|
|
954
|
+
exchangeId: z7.string().describe("Exchange id")
|
|
1001
955
|
});
|
|
1002
|
-
var zTradelinkWithdrawRequestData =
|
|
1003
|
-
accountId:
|
|
956
|
+
var zTradelinkWithdrawRequestData = z7.object({
|
|
957
|
+
accountId: z7.string().describe("Account id"),
|
|
1004
958
|
transaction: zSendOnlyTransactionData
|
|
1005
959
|
});
|
|
1006
|
-
var zTradelinkArbitrationRequestData =
|
|
1007
|
-
accountId:
|
|
960
|
+
var zTradelinkArbitrationRequestData = z7.object({
|
|
961
|
+
accountId: z7.string().describe("Account id"),
|
|
1008
962
|
transaction: zSendOnlyTransactionData
|
|
1009
963
|
});
|
|
1010
964
|
|
|
@@ -1019,93 +973,232 @@ var zTradelinkAccountGovernanceFields = z.object({
|
|
|
1019
973
|
exchangeConfigs: zTradelinkExchangeConfigs.describe("Tradelink exchange configurations")
|
|
1020
974
|
}).describe("Tradelink");
|
|
1021
975
|
var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).describe("Governance fields");
|
|
976
|
+
var zCardanoLikeStakingData = z7.object({
|
|
977
|
+
staked: z7.string().describe("Staked balance")
|
|
978
|
+
}).nullable().describe("Cardano-like staking data");
|
|
979
|
+
var zCardanoLikeStakingFields = z7.object({
|
|
980
|
+
type: z7.literal(AccountType.CARDANO_LIKE).describe("Account type"),
|
|
981
|
+
staking: zCardanoLikeStakingData.optional()
|
|
982
|
+
});
|
|
983
|
+
var zEthereumLikeStakingData = z7.object({
|
|
984
|
+
totalStaking: z7.string().describe("Total staked amount"),
|
|
985
|
+
totalRewards: z7.string().describe("Total of rewards"),
|
|
986
|
+
availableRewards: z7.string().describe("Available rewards"),
|
|
987
|
+
networkApy: z7.number().describe("Network APY")
|
|
988
|
+
}).nullable().describe("Ethereum-like staking data");
|
|
989
|
+
var zEthereumLikeStakingFields = z7.object({
|
|
990
|
+
type: z7.literal(AccountType.ETHEREUM_LIKE).describe("Account type"),
|
|
991
|
+
staking: zEthereumLikeStakingData.optional()
|
|
992
|
+
});
|
|
993
|
+
var zPolkadotUnbondingAmount = z7.object({
|
|
994
|
+
amount: z7.string().describe("Amount"),
|
|
995
|
+
waiting_time: z7.string().describe("Waiting time")
|
|
996
|
+
});
|
|
997
|
+
var zPolkadotLikeStakingData = z7.object({
|
|
998
|
+
info: z7.object({
|
|
999
|
+
controllerAddress: z7.string().nullable().describe("Controller address"),
|
|
1000
|
+
rewardsDestination: z7.string().nullable().describe("Rewards destination"),
|
|
1001
|
+
proxies: z7.array(z7.string()).describe("Proxies"),
|
|
1002
|
+
legacyStaking: z7.boolean().describe("True if account uses legacy staking"),
|
|
1003
|
+
isNominator: z7.boolean().describe("True if is nominator")
|
|
1004
|
+
}),
|
|
1005
|
+
balances: z7.object({
|
|
1006
|
+
free: z7.string().describe("Free balance"),
|
|
1007
|
+
reserved: z7.string().describe("Reserved balance"),
|
|
1008
|
+
frozen: z7.string().describe("Frozen balance"),
|
|
1009
|
+
bonded: z7.string().describe("Bonded balance"),
|
|
1010
|
+
available: z7.string().describe("Available balance"),
|
|
1011
|
+
unbonding: z7.array(zPolkadotUnbondingAmount).describe("Unbonding balances"),
|
|
1012
|
+
unbonded: z7.array(zPolkadotUnbondingAmount).describe("Unbonded balances"),
|
|
1013
|
+
totalUnbonding: z7.string().describe("Total unbonding"),
|
|
1014
|
+
totalUnbonded: z7.string().describe("Total unbonded")
|
|
1015
|
+
}),
|
|
1016
|
+
anonymousProxy: z7.object({
|
|
1017
|
+
address: z7.string().describe("Address"),
|
|
1018
|
+
createdAt: z7.string().describe("Creation date"),
|
|
1019
|
+
isController: z7.boolean().describe("True if is controller"),
|
|
1020
|
+
isMain: z7.boolean().describe("True if is main"),
|
|
1021
|
+
balances: z7.object({
|
|
1022
|
+
free: z7.string().describe("Anonymous proxy free balance"),
|
|
1023
|
+
reserved: z7.string().describe("Anonymous proxy reserved balance"),
|
|
1024
|
+
frozen: z7.string().describe("Anonymous proxy frozen balance"),
|
|
1025
|
+
bonded: z7.string().describe("Anonymous proxy bonded balance"),
|
|
1026
|
+
available: z7.string().describe("Anonymous proxy available balance"),
|
|
1027
|
+
total: z7.string().describe("Anonymous proxy total balance")
|
|
1028
|
+
}).nullable(),
|
|
1029
|
+
blockHeight: z7.string().describe("Anonymous proxy block height"),
|
|
1030
|
+
extIndex: z7.string().describe("Ext index"),
|
|
1031
|
+
index: z7.string().describe("Index"),
|
|
1032
|
+
kind: z7.string().describe("Kind")
|
|
1033
|
+
}).nullable().describe("Anonymous proxy")
|
|
1034
|
+
}).nullable().describe("Polkadot-like staking data");
|
|
1035
|
+
var zPolkadotLikeStakingFields = z7.object({
|
|
1036
|
+
type: z7.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
1037
|
+
staking: zPolkadotLikeStakingData.optional()
|
|
1038
|
+
});
|
|
1039
|
+
var zSolanaStakingAccountStatus = z7.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).describe("Staking account status");
|
|
1040
|
+
var zSolanaLikeStakingData = z7.object({
|
|
1041
|
+
staked: z7.string().describe("Staked balance"),
|
|
1042
|
+
rewards: z7.object({
|
|
1043
|
+
total: z7.string().describe("Total rewards"),
|
|
1044
|
+
last7: z7.string().describe("Rewards on last 7 days"),
|
|
1045
|
+
last30: z7.string().describe("Rewards on last 30 days")
|
|
1046
|
+
}),
|
|
1047
|
+
stakes: z7.array(
|
|
1048
|
+
z7.object({
|
|
1049
|
+
uid: z7.string(),
|
|
1050
|
+
baseAccountUid: z7.string(),
|
|
1051
|
+
pubKey: z7.string().describe("Public key"),
|
|
1052
|
+
validatorPubKey: z7.string().nullable().describe("Validator public key"),
|
|
1053
|
+
initialAmount: z7.string().describe("Initial amount"),
|
|
1054
|
+
activeAmount: z7.string().describe("Active amount"),
|
|
1055
|
+
inactiveAmount: z7.string().describe("Inactive amount"),
|
|
1056
|
+
totalBalance: z7.string().describe("Total balance"),
|
|
1057
|
+
creationDate: z7.string().describe("Creation date"),
|
|
1058
|
+
activationEpoch: z7.string().nullable().describe("Activation epoch"),
|
|
1059
|
+
activationDate: z7.string().nullable().describe("Activation date"),
|
|
1060
|
+
deactivationEpoch: z7.string().nullable().describe("Deactivation epoch"),
|
|
1061
|
+
deactivationDate: z7.string().nullable().describe("Deactivation date"),
|
|
1062
|
+
status: zSolanaStakingAccountStatus,
|
|
1063
|
+
rentExemptReserve: z7.string().describe("Rent exempt reserve"),
|
|
1064
|
+
withdrawableAmount: z7.string().describe("Withdrawable amount"),
|
|
1065
|
+
totalRewards: z7.string().describe("Total rewards"),
|
|
1066
|
+
creationTxHash: z7.string().nullable().describe("Creation transaction hash"),
|
|
1067
|
+
actionsTxHashes: z7.array(z7.string()).describe("Actions transactions hashes")
|
|
1068
|
+
})
|
|
1069
|
+
)
|
|
1070
|
+
}).nullable().describe("Solana-like staking data");
|
|
1071
|
+
var zSolanaLikeStakingFields = z7.object({
|
|
1072
|
+
type: z7.literal(AccountType.SOLANA_LIKE).describe("Account type"),
|
|
1073
|
+
staking: zSolanaLikeStakingData.optional()
|
|
1074
|
+
});
|
|
1075
|
+
var zTezosLikeStakingData = z7.object({
|
|
1076
|
+
delegations: z7.array(
|
|
1077
|
+
z7.object({
|
|
1078
|
+
address: z7.string()
|
|
1079
|
+
})
|
|
1080
|
+
)
|
|
1081
|
+
}).nullable().describe("Tezos-like staking data");
|
|
1082
|
+
var zTezosLikeStakingFields = z7.object({
|
|
1083
|
+
type: z7.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
1084
|
+
staking: zTezosLikeStakingData.optional()
|
|
1085
|
+
});
|
|
1086
|
+
z7.discriminatedUnion("type", [
|
|
1087
|
+
zCardanoLikeStakingFields,
|
|
1088
|
+
zEthereumLikeStakingFields,
|
|
1089
|
+
zPolkadotLikeStakingFields,
|
|
1090
|
+
zSolanaLikeStakingFields,
|
|
1091
|
+
zTezosLikeStakingFields
|
|
1092
|
+
]);
|
|
1022
1093
|
|
|
1023
1094
|
// src/accounts/types.ts
|
|
1024
|
-
var zAccountCommonFields =
|
|
1025
|
-
id:
|
|
1026
|
-
legacyId:
|
|
1027
|
-
name:
|
|
1095
|
+
var zAccountCommonFields = z7.object({
|
|
1096
|
+
id: z7.string().describe("Internal unique identifier"),
|
|
1097
|
+
legacyId: z7.number().describe("Legacy internal unique identifier (for retro-compatibility)"),
|
|
1098
|
+
name: z7.string().describe("Name"),
|
|
1028
1099
|
currency: zCurrency,
|
|
1029
|
-
index:
|
|
1030
|
-
derivationPath:
|
|
1031
|
-
status:
|
|
1032
|
-
createdAt:
|
|
1033
|
-
updatedAt:
|
|
1034
|
-
});
|
|
1035
|
-
var zAccountBalanceFields =
|
|
1036
|
-
total:
|
|
1037
|
-
pending:
|
|
1100
|
+
index: z7.number().gte(0).describe("BIP44 account index"),
|
|
1101
|
+
derivationPath: z7.string().describe("Derivation path"),
|
|
1102
|
+
status: z7.nativeEnum(ActivationStatus).describe("Status"),
|
|
1103
|
+
createdAt: z7.coerce.date().describe("Creation timestamp"),
|
|
1104
|
+
updatedAt: z7.coerce.date().describe("Last modification timestamp")
|
|
1105
|
+
});
|
|
1106
|
+
var zAccountBalanceFields = z7.object({
|
|
1107
|
+
total: z7.string().describe("Total balance"),
|
|
1108
|
+
pending: z7.string().describe("Pending balance")
|
|
1038
1109
|
}).describe("Balance fields");
|
|
1039
1110
|
var zAccountResponse = zAccountCommonFields.extend({
|
|
1040
|
-
|
|
1041
|
-
asset: zAccountAssetFields,
|
|
1111
|
+
asset: zAccountAssetStaticFields,
|
|
1042
1112
|
governance: zAccountGovernanceFields
|
|
1043
1113
|
});
|
|
1044
|
-
|
|
1114
|
+
z7.enum([
|
|
1045
1115
|
"name",
|
|
1046
1116
|
"currency",
|
|
1047
1117
|
"index",
|
|
1048
1118
|
"createdAt",
|
|
1049
1119
|
"updatedAt"
|
|
1050
1120
|
]).default("createdAt");
|
|
1121
|
+
var zCommonLiveData = z7.object({
|
|
1122
|
+
id: z7.string().describe("Account internal unique identifier"),
|
|
1123
|
+
balance: zAccountBalanceFields
|
|
1124
|
+
});
|
|
1125
|
+
var zBitcoinLikeLiveData = zCommonLiveData.extend({
|
|
1126
|
+
type: z7.literal(AccountType.BITCOIN_LIKE).describe("Account type")
|
|
1127
|
+
}).describe("Bitcoin-like");
|
|
1128
|
+
var zCardanoLikeLiveData = zCommonLiveData.merge(zCardanoLikeStakingFields).describe("Cardano-like");
|
|
1129
|
+
var zEthereumLikeLiveData = zCommonLiveData.merge(zEthereumLikeStakingFields).describe("Ethereum-like");
|
|
1130
|
+
var zEthereumTokenLikeLiveData = zCommonLiveData.extend({
|
|
1131
|
+
type: z7.enum([AccountType.ERC20_LIKE, AccountType.BEP20_LIKE, AccountType.TRC20_LIKE]).describe("Account type")
|
|
1132
|
+
}).describe("Ethereum-like token");
|
|
1133
|
+
var zGenericLikeLiveData = zCommonLiveData.extend({
|
|
1134
|
+
type: z7.literal(AccountType.GENERIC_LIKE).describe("Account type")
|
|
1135
|
+
}).describe("Generic-like");
|
|
1136
|
+
var zPolkadotLikeLiveData = zCommonLiveData.merge(zPolkadotLikeStakingFields).describe("Polkadot-like");
|
|
1137
|
+
var zRawSigningLiveData = zCommonLiveData.extend({
|
|
1138
|
+
type: z7.literal(AccountType.RAW_SIGNING).describe("Account type")
|
|
1139
|
+
}).describe("Raw signing account");
|
|
1140
|
+
var zRippleLikeLiveData = zCommonLiveData.extend({
|
|
1141
|
+
type: z7.literal(AccountType.RIPPLE_LIKE).describe("Account type")
|
|
1142
|
+
}).describe("Ripple-like");
|
|
1143
|
+
var zSolanaLikeLiveData = zCommonLiveData.merge(zSolanaLikeStakingFields).describe("Solana-like");
|
|
1144
|
+
var zStellarLikeLiveData = zCommonLiveData.extend({
|
|
1145
|
+
type: z7.literal(AccountType.STELLAR_LIKE).describe("Account type")
|
|
1146
|
+
}).describe("Stellar-like");
|
|
1147
|
+
var zTezosLikeLiveData = zCommonLiveData.merge(zTezosLikeStakingFields).describe("Tezos-like");
|
|
1148
|
+
z7.discriminatedUnion("type", [
|
|
1149
|
+
zBitcoinLikeLiveData,
|
|
1150
|
+
zCardanoLikeLiveData,
|
|
1151
|
+
zEthereumLikeLiveData,
|
|
1152
|
+
zEthereumTokenLikeLiveData,
|
|
1153
|
+
zGenericLikeLiveData,
|
|
1154
|
+
zPolkadotLikeLiveData,
|
|
1155
|
+
zRawSigningLiveData,
|
|
1156
|
+
zRippleLikeLiveData,
|
|
1157
|
+
zSolanaLikeLiveData,
|
|
1158
|
+
zStellarLikeLiveData,
|
|
1159
|
+
zTezosLikeLiveData
|
|
1160
|
+
]);
|
|
1051
1161
|
|
|
1052
1162
|
// src/accounts/app-types.ts
|
|
1053
|
-
|
|
1054
|
-
title: z5.string().describe("Transaction note title"),
|
|
1055
|
-
content: z5.string().describe("Transaction note content")
|
|
1056
|
-
}).describe("Optional transaction note");
|
|
1057
|
-
z5.discriminatedUnion(
|
|
1163
|
+
z7.discriminatedUnion(
|
|
1058
1164
|
zTransactionResponse.discriminator,
|
|
1059
1165
|
ensureNonEmptyArray(
|
|
1060
|
-
zTransactionResponse.options.map(
|
|
1166
|
+
zTransactionResponse.options.map(
|
|
1167
|
+
(_) => _.extend({
|
|
1168
|
+
note: zNote.nullable().describe("Optional transaction note")
|
|
1169
|
+
})
|
|
1170
|
+
)
|
|
1061
1171
|
)
|
|
1062
1172
|
);
|
|
1063
|
-
var zWhitelistAddress =
|
|
1064
|
-
name:
|
|
1173
|
+
var zWhitelistAddress = z7.object({
|
|
1174
|
+
name: z7.string().min(1).max(50),
|
|
1065
1175
|
currency: zCurrency,
|
|
1066
|
-
address:
|
|
1176
|
+
address: z7.string().min(1).max(200),
|
|
1067
1177
|
// Destination tags are numeric-only or alpha-numeric.
|
|
1068
1178
|
// Empty array (or undefined) means no check on destination tag.
|
|
1069
|
-
destinationTags:
|
|
1179
|
+
destinationTags: z7.array(z7.string().min(1).regex(/^\w+$/)).optional()
|
|
1070
1180
|
});
|
|
1071
|
-
var zWhitelistAddresses =
|
|
1072
|
-
var zWhitelistName =
|
|
1073
|
-
var zCreateWhitelistRequestData =
|
|
1181
|
+
var zWhitelistAddresses = z7.array(zWhitelistAddress);
|
|
1182
|
+
var zWhitelistName = z7.string().min(1).max(45).describe("Whitelist name");
|
|
1183
|
+
var zCreateWhitelistRequestData = z7.object({
|
|
1074
1184
|
name: zWhitelistName,
|
|
1075
|
-
description:
|
|
1185
|
+
description: z7.string().nullable(),
|
|
1076
1186
|
addresses: zWhitelistAddresses,
|
|
1077
|
-
type:
|
|
1187
|
+
type: z7.nativeEnum(WhitelistType)
|
|
1078
1188
|
});
|
|
1079
|
-
var zEditWhitelistRequestData =
|
|
1189
|
+
var zEditWhitelistRequestData = z7.object({
|
|
1080
1190
|
name: zWhitelistName,
|
|
1081
1191
|
addresses: zWhitelistAddresses
|
|
1082
1192
|
});
|
|
1083
1193
|
|
|
1084
1194
|
// src/policies/db-utils.ts
|
|
1085
|
-
var
|
|
1086
|
-
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
1087
|
-
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
1088
|
-
}).describe("Threshold for the transaction value");
|
|
1089
|
-
var zWhitelistIds = z5.array(z5.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
1090
|
-
var zGovRuleJsonObject = z5.object({
|
|
1091
|
-
// Required.
|
|
1092
|
-
operationType: zOperationType.describe("Allowed operation type"),
|
|
1093
|
-
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1094
|
-
threshold: zThreshold,
|
|
1095
|
-
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1096
|
-
whitelistIds: zWhitelistIds,
|
|
1097
|
-
reviewConfigId: z5.string().min(1).describe("Id of ReviewConfig"),
|
|
1098
|
-
// HSM id for the rule
|
|
1099
|
-
hsmId: zHsmObjectId
|
|
1100
|
-
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
1101
|
-
z5.array(zGovRuleJsonObject);
|
|
1102
|
-
var zBaseGovRuleData = z5.object({
|
|
1195
|
+
var zBaseGovRuleData = z7.object({
|
|
1103
1196
|
// Steps of users that will need to review operations
|
|
1104
1197
|
reviewSteps: zReviewStepsArray,
|
|
1105
1198
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1106
|
-
threshold: zThreshold.optional(),
|
|
1199
|
+
threshold: policy_exports.zThreshold.optional(),
|
|
1107
1200
|
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1108
|
-
whitelistIds: zWhitelistIds.optional()
|
|
1201
|
+
whitelistIds: policy_exports.zWhitelistIds.optional()
|
|
1109
1202
|
});
|
|
1110
1203
|
var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
1111
1204
|
operationType: zClassicOperationType.describe("Allowed operation type")
|
|
@@ -1113,83 +1206,86 @@ var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
|
1113
1206
|
zBaseGovRuleData.extend({
|
|
1114
1207
|
operationType: zOperationType.describe("Allowed operation type")
|
|
1115
1208
|
}).describe("Governance rule");
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1209
|
+
({
|
|
1210
|
+
reviewConfigs: { include: review_config_exports.INCLUDE_MEMBERS }
|
|
1211
|
+
});
|
|
1212
|
+
var zPolicyName = z7.string().min(1).max(19).describe("Policy name");
|
|
1213
|
+
var zCurrency2 = z7.string().min(1).max(40).regex(/^\w+$/).describe("Currency");
|
|
1214
|
+
var zCreatePublicPolicyRequestData = z7.object({
|
|
1119
1215
|
name: zPolicyName,
|
|
1120
|
-
description:
|
|
1216
|
+
description: z7.string().nullable().describe("Description"),
|
|
1121
1217
|
currency: zCurrency2.nullable(),
|
|
1122
|
-
govRules:
|
|
1218
|
+
govRules: z7.array(zClassicGovRuleData).describe("Governance rules")
|
|
1123
1219
|
});
|
|
1124
|
-
var zEditPublicPolicyRequestData =
|
|
1220
|
+
var zEditPublicPolicyRequestData = z7.object({
|
|
1125
1221
|
name: zPolicyName,
|
|
1126
|
-
description:
|
|
1127
|
-
govRules:
|
|
1222
|
+
description: z7.string().nullable().describe("Description"),
|
|
1223
|
+
govRules: z7.array(zClassicGovRuleData).describe("Governance rules")
|
|
1128
1224
|
});
|
|
1129
1225
|
|
|
1130
1226
|
// src/accounts/request-data.ts
|
|
1131
|
-
var zAccountName =
|
|
1132
|
-
var zSignDigestsGovRuleData =
|
|
1133
|
-
operationType:
|
|
1227
|
+
var zAccountName = z7.string().min(1).max(40).describe("Account name");
|
|
1228
|
+
var zSignDigestsGovRuleData = z7.object({
|
|
1229
|
+
operationType: z7.literal("SIGN_DIGESTS"),
|
|
1134
1230
|
reviewSteps: zReviewStepWithUsersArray
|
|
1135
1231
|
// we need to control for API users only
|
|
1136
1232
|
}).describe("Digest signing rule");
|
|
1137
|
-
var zAccountPolicyRequestData =
|
|
1138
|
-
|
|
1139
|
-
|
|
1233
|
+
var zAccountPolicyRequestData = z7.union([
|
|
1234
|
+
z7.object({ policyId: z7.string() }).describe("Account policy"),
|
|
1235
|
+
z7.object({ rules: z7.array(zClassicGovRuleData) }).describe("Account governance rules")
|
|
1140
1236
|
]).describe("Account policy or governance rules");
|
|
1141
|
-
var zCreateAccountGovernanceData =
|
|
1142
|
-
|
|
1143
|
-
type:
|
|
1237
|
+
var zCreateAccountGovernanceData = z7.discriminatedUnion("type", [
|
|
1238
|
+
z7.object({
|
|
1239
|
+
type: z7.literal(AccountGovernanceType.CLASSIC),
|
|
1144
1240
|
policy: zAccountPolicyRequestData
|
|
1145
1241
|
}),
|
|
1146
|
-
|
|
1147
|
-
type:
|
|
1148
|
-
assetManagerId:
|
|
1242
|
+
z7.object({
|
|
1243
|
+
type: z7.literal(AccountGovernanceType.TRADELINK),
|
|
1244
|
+
assetManagerId: z7.string(),
|
|
1149
1245
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1150
1246
|
}),
|
|
1151
|
-
|
|
1152
|
-
type:
|
|
1153
|
-
policy:
|
|
1247
|
+
z7.object({
|
|
1248
|
+
type: z7.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1249
|
+
policy: z7.object({ rules: z7.array(zSignDigestsGovRuleData) })
|
|
1154
1250
|
})
|
|
1155
1251
|
]);
|
|
1156
|
-
var zCreateAccountUserInputData =
|
|
1252
|
+
var zCreateAccountUserInputData = z7.object({
|
|
1157
1253
|
name: zAccountName,
|
|
1158
1254
|
currency: zCurrency,
|
|
1159
1255
|
// "bitcoin"
|
|
1160
|
-
index:
|
|
1161
|
-
contractAddress:
|
|
1256
|
+
index: z7.number().nonnegative().optional().describe("Account index"),
|
|
1257
|
+
contractAddress: z7.string().min(1).optional().describe("Account contract address"),
|
|
1162
1258
|
governance: zCreateAccountGovernanceData
|
|
1163
1259
|
});
|
|
1164
1260
|
var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }).extend({
|
|
1165
|
-
index:
|
|
1166
|
-
derivationPath:
|
|
1167
|
-
type:
|
|
1261
|
+
index: z7.number().nonnegative().describe("Account index"),
|
|
1262
|
+
derivationPath: z7.string().describe("Account bip44 derivation path"),
|
|
1263
|
+
type: z7.nativeEnum(AccountType)
|
|
1168
1264
|
// "BITCOIN_LIKE"
|
|
1169
1265
|
});
|
|
1170
|
-
var zEditAccountGovernanceData =
|
|
1171
|
-
|
|
1172
|
-
type:
|
|
1266
|
+
var zEditAccountGovernanceData = z7.discriminatedUnion("type", [
|
|
1267
|
+
z7.object({
|
|
1268
|
+
type: z7.literal(AccountGovernanceType.CLASSIC),
|
|
1173
1269
|
policy: zAccountPolicyRequestData
|
|
1174
1270
|
}),
|
|
1175
|
-
|
|
1176
|
-
type:
|
|
1271
|
+
z7.object({
|
|
1272
|
+
type: z7.literal(AccountGovernanceType.TRADELINK),
|
|
1177
1273
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1178
1274
|
}),
|
|
1179
|
-
|
|
1180
|
-
type:
|
|
1181
|
-
policy:
|
|
1275
|
+
z7.object({
|
|
1276
|
+
type: z7.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1277
|
+
policy: z7.object({ rules: z7.array(zSignDigestsGovRuleData) })
|
|
1182
1278
|
})
|
|
1183
1279
|
]);
|
|
1184
|
-
var zEditAccountRequestData =
|
|
1280
|
+
var zEditAccountRequestData = z7.object({
|
|
1185
1281
|
name: zAccountName,
|
|
1186
1282
|
governance: zEditAccountGovernanceData
|
|
1187
1283
|
});
|
|
1188
|
-
var zActivateAccountRequestData =
|
|
1189
|
-
var zEditTokenRuleRequestData =
|
|
1190
|
-
parentAccountId:
|
|
1191
|
-
contractAddress:
|
|
1192
|
-
rules:
|
|
1284
|
+
var zActivateAccountRequestData = z7.object({});
|
|
1285
|
+
var zEditTokenRuleRequestData = z7.object({
|
|
1286
|
+
parentAccountId: z7.string().min(1).describe("Parent account unique ID"),
|
|
1287
|
+
contractAddress: z7.string().min(1).describe("Token contract address"),
|
|
1288
|
+
rules: z7.array(zClassicGovRuleData).describe("Account governance rules")
|
|
1193
1289
|
});
|
|
1194
1290
|
|
|
1195
1291
|
// src/accounts/app-utils.ts
|
|
@@ -1286,15 +1382,15 @@ var serializeAccount = (account) => {
|
|
|
1286
1382
|
};
|
|
1287
1383
|
return zAccountResponse.parse(response);
|
|
1288
1384
|
};
|
|
1289
|
-
var zSciConfigData =
|
|
1290
|
-
dapps:
|
|
1291
|
-
customContractCallEnabled:
|
|
1385
|
+
var zSciConfigData = z7.object({
|
|
1386
|
+
dapps: z7.array(z7.string()).nullable().describe("Allowed DApps, null allows all"),
|
|
1387
|
+
customContractCallEnabled: z7.boolean().describe("Allow non-DApp SCI")
|
|
1292
1388
|
});
|
|
1293
|
-
var zCreateSciConfigRequestData =
|
|
1294
|
-
account:
|
|
1389
|
+
var zCreateSciConfigRequestData = z7.object({
|
|
1390
|
+
account: z7.string().describe("Account UUID"),
|
|
1295
1391
|
config: zSciConfigData
|
|
1296
1392
|
});
|
|
1297
|
-
var zEditSciConfigRequestData =
|
|
1393
|
+
var zEditSciConfigRequestData = z7.object({
|
|
1298
1394
|
config: zSciConfigData
|
|
1299
1395
|
});
|
|
1300
1396
|
var zRequestReviewStep = z.object({
|
|
@@ -1317,287 +1413,287 @@ zUserRegistrationCreateInput.extend({
|
|
|
1317
1413
|
});
|
|
1318
1414
|
|
|
1319
1415
|
// src/users/request-data.ts
|
|
1320
|
-
var zCreatePsdUserRequestData =
|
|
1321
|
-
registrationId:
|
|
1416
|
+
var zCreatePsdUserRequestData = z7.object({
|
|
1417
|
+
registrationId: z7.string().describe("User registration ID")
|
|
1322
1418
|
});
|
|
1323
|
-
var zCreateApiUserRequestData =
|
|
1419
|
+
var zCreateApiUserRequestData = z7.object({
|
|
1324
1420
|
name: zUserName,
|
|
1325
|
-
pubKey:
|
|
1326
|
-
role:
|
|
1327
|
-
viewAll:
|
|
1421
|
+
pubKey: z7.string().describe("Public key"),
|
|
1422
|
+
role: z7.enum(["ADMIN", "OPERATOR"]).describe("User role"),
|
|
1423
|
+
viewAll: z7.boolean().describe("View all data").default(false).optional()
|
|
1328
1424
|
}).describe("Create API user request data");
|
|
1329
|
-
var zCreateApiUserAccessRequestData =
|
|
1425
|
+
var zCreateApiUserAccessRequestData = z7.object({
|
|
1330
1426
|
name: zUserName
|
|
1331
1427
|
}).describe("Create API user credential request data");
|
|
1332
|
-
|
|
1333
|
-
authUserId:
|
|
1428
|
+
z7.object({
|
|
1429
|
+
authUserId: z7.string().describe("Authentication broker ID")
|
|
1334
1430
|
}).describe("Managed data for API user");
|
|
1335
|
-
var zGroupName =
|
|
1336
|
-
var zCreateGroupRequestData =
|
|
1431
|
+
var zGroupName = z7.string().min(1).max(19).describe("Group name");
|
|
1432
|
+
var zCreateGroupRequestData = z7.object({
|
|
1337
1433
|
name: zGroupName,
|
|
1338
|
-
description:
|
|
1339
|
-
members:
|
|
1434
|
+
description: z7.string().nullable().describe("Group description"),
|
|
1435
|
+
members: z7.array(z7.string()).describe("List of group members ids")
|
|
1340
1436
|
});
|
|
1341
|
-
var zEditGroupRequestData =
|
|
1437
|
+
var zEditGroupRequestData = z7.object({
|
|
1342
1438
|
name: zGroupName,
|
|
1343
|
-
description:
|
|
1344
|
-
members:
|
|
1439
|
+
description: z7.string().nullable().describe("Group description"),
|
|
1440
|
+
members: z7.array(z7.string()).describe("List of group members ids")
|
|
1345
1441
|
});
|
|
1346
|
-
var zApiKeyName =
|
|
1347
|
-
var zCreateApiKeyRequestData =
|
|
1442
|
+
var zApiKeyName = z7.string().min(1).max(19).describe("API key name");
|
|
1443
|
+
var zCreateApiKeyRequestData = z7.object({
|
|
1348
1444
|
name: zApiKeyName,
|
|
1349
|
-
entities:
|
|
1350
|
-
scopes:
|
|
1445
|
+
entities: z7.array(z7.string()).describe("List of related entities ids"),
|
|
1446
|
+
scopes: z7.object({}).describe("FIXME to be precised")
|
|
1351
1447
|
}).describe("Create read-only API key request data");
|
|
1352
1448
|
var zEditApiKeyRequestData = zCreateApiKeyRequestData.describe(
|
|
1353
1449
|
"Edit read-only API key request data"
|
|
1354
1450
|
);
|
|
1355
|
-
var zEntityName =
|
|
1356
|
-
var zCreateEntityRequestData =
|
|
1451
|
+
var zEntityName = z7.string().min(1).max(19).describe("Entity name");
|
|
1452
|
+
var zCreateEntityRequestData = z7.object({
|
|
1357
1453
|
name: zEntityName,
|
|
1358
|
-
accounts:
|
|
1454
|
+
accounts: z7.array(z7.string())
|
|
1359
1455
|
});
|
|
1360
|
-
var zEditEntityRequestData =
|
|
1456
|
+
var zEditEntityRequestData = z7.object({
|
|
1361
1457
|
name: zEntityName,
|
|
1362
|
-
accounts:
|
|
1458
|
+
accounts: z7.array(z7.string())
|
|
1363
1459
|
});
|
|
1364
1460
|
var NonRootAdminPermission = omit(AdminPermission, "ROOT");
|
|
1365
|
-
var zWorkspaceRuleRequestData =
|
|
1366
|
-
permission:
|
|
1461
|
+
var zWorkspaceRuleRequestData = z7.object({
|
|
1462
|
+
permission: z7.nativeEnum(NonRootAdminPermission).describe("Granted permissions"),
|
|
1367
1463
|
reviewConfig: zReviewStepWithUsersArray.describe("List of admin review steps")
|
|
1368
1464
|
});
|
|
1369
1465
|
|
|
1370
1466
|
// src/requests/request-data.ts
|
|
1371
1467
|
var zVaultRequestMixinsByType = {
|
|
1372
1468
|
// Workspaces
|
|
1373
|
-
[RequestType.UPDATE_QUORUM]:
|
|
1374
|
-
type:
|
|
1469
|
+
[RequestType.UPDATE_QUORUM]: z7.object({
|
|
1470
|
+
type: z7.literal(RequestType.UPDATE_QUORUM),
|
|
1375
1471
|
data: zUpdateQuorumRequestData
|
|
1376
1472
|
}),
|
|
1377
1473
|
// Operator requests
|
|
1378
|
-
[RequestType.CREATE_TRANSACTION]:
|
|
1379
|
-
type:
|
|
1474
|
+
[RequestType.CREATE_TRANSACTION]: z7.object({
|
|
1475
|
+
type: z7.literal(RequestType.CREATE_TRANSACTION),
|
|
1380
1476
|
data: zCreateTransactionRequestData,
|
|
1381
|
-
meta:
|
|
1382
|
-
hash:
|
|
1477
|
+
meta: z7.object({
|
|
1478
|
+
hash: z7.string().nullable()
|
|
1383
1479
|
}).optional().nullable()
|
|
1384
1480
|
}),
|
|
1385
|
-
[RequestType.SIGN_MESSAGE]:
|
|
1386
|
-
type:
|
|
1481
|
+
[RequestType.SIGN_MESSAGE]: z7.object({
|
|
1482
|
+
type: z7.literal(RequestType.SIGN_MESSAGE),
|
|
1387
1483
|
data: zSignMessageRequestData
|
|
1388
1484
|
}),
|
|
1389
|
-
[RequestType.SIGN_DIGESTS]:
|
|
1390
|
-
type:
|
|
1485
|
+
[RequestType.SIGN_DIGESTS]: z7.object({
|
|
1486
|
+
type: z7.literal(RequestType.SIGN_DIGESTS),
|
|
1391
1487
|
data: zSignDigestsRequestData
|
|
1392
1488
|
}),
|
|
1393
1489
|
// Accounts
|
|
1394
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
1395
|
-
type:
|
|
1490
|
+
[RequestType.CREATE_ACCOUNT]: z7.object({
|
|
1491
|
+
type: z7.literal(RequestType.CREATE_ACCOUNT),
|
|
1396
1492
|
data: zCreateAccountRequestData
|
|
1397
1493
|
}),
|
|
1398
|
-
[RequestType.EDIT_ACCOUNT]:
|
|
1399
|
-
type:
|
|
1400
|
-
targetId:
|
|
1494
|
+
[RequestType.EDIT_ACCOUNT]: z7.object({
|
|
1495
|
+
type: z7.literal(RequestType.EDIT_ACCOUNT),
|
|
1496
|
+
targetId: z7.string(),
|
|
1401
1497
|
data: zEditAccountRequestData
|
|
1402
1498
|
}),
|
|
1403
|
-
[RequestType.ACTIVATE_TRADELINK_ACCOUNT]:
|
|
1404
|
-
type:
|
|
1405
|
-
targetId:
|
|
1499
|
+
[RequestType.ACTIVATE_TRADELINK_ACCOUNT]: z7.object({
|
|
1500
|
+
type: z7.literal(RequestType.ACTIVATE_TRADELINK_ACCOUNT),
|
|
1501
|
+
targetId: z7.string(),
|
|
1406
1502
|
data: zActivateAccountRequestData
|
|
1407
1503
|
}),
|
|
1408
|
-
[RequestType.EDIT_TOKEN_RULE]:
|
|
1409
|
-
type:
|
|
1410
|
-
targetId:
|
|
1504
|
+
[RequestType.EDIT_TOKEN_RULE]: z7.object({
|
|
1505
|
+
type: z7.literal(RequestType.EDIT_TOKEN_RULE),
|
|
1506
|
+
targetId: z7.string(),
|
|
1411
1507
|
data: zEditTokenRuleRequestData
|
|
1412
1508
|
}),
|
|
1413
1509
|
// Groups
|
|
1414
|
-
[RequestType.CREATE_GROUP]:
|
|
1415
|
-
type:
|
|
1510
|
+
[RequestType.CREATE_GROUP]: z7.object({
|
|
1511
|
+
type: z7.literal(RequestType.CREATE_GROUP),
|
|
1416
1512
|
data: zCreateGroupRequestData
|
|
1417
1513
|
}),
|
|
1418
|
-
[RequestType.EDIT_GROUP]:
|
|
1419
|
-
type:
|
|
1420
|
-
targetId:
|
|
1514
|
+
[RequestType.EDIT_GROUP]: z7.object({
|
|
1515
|
+
type: z7.literal(RequestType.EDIT_GROUP),
|
|
1516
|
+
targetId: z7.string(),
|
|
1421
1517
|
data: zEditGroupRequestData
|
|
1422
1518
|
}),
|
|
1423
|
-
[RequestType.REVOKE_GROUP]:
|
|
1424
|
-
type:
|
|
1425
|
-
data:
|
|
1519
|
+
[RequestType.REVOKE_GROUP]: z7.object({
|
|
1520
|
+
type: z7.literal(RequestType.REVOKE_GROUP),
|
|
1521
|
+
data: z7.object({})
|
|
1426
1522
|
}),
|
|
1427
1523
|
// Whitelists
|
|
1428
|
-
[RequestType.CREATE_WHITELIST]:
|
|
1429
|
-
type:
|
|
1524
|
+
[RequestType.CREATE_WHITELIST]: z7.object({
|
|
1525
|
+
type: z7.literal(RequestType.CREATE_WHITELIST),
|
|
1430
1526
|
data: zCreateWhitelistRequestData
|
|
1431
1527
|
}),
|
|
1432
|
-
[RequestType.EDIT_WHITELIST]:
|
|
1433
|
-
type:
|
|
1434
|
-
targetId:
|
|
1528
|
+
[RequestType.EDIT_WHITELIST]: z7.object({
|
|
1529
|
+
type: z7.literal(RequestType.EDIT_WHITELIST),
|
|
1530
|
+
targetId: z7.string(),
|
|
1435
1531
|
data: zEditWhitelistRequestData
|
|
1436
1532
|
}),
|
|
1437
1533
|
// Entities
|
|
1438
|
-
[RequestType.CREATE_ENTITY]:
|
|
1439
|
-
type:
|
|
1534
|
+
[RequestType.CREATE_ENTITY]: z7.object({
|
|
1535
|
+
type: z7.literal(RequestType.CREATE_ENTITY),
|
|
1440
1536
|
data: zCreateEntityRequestData
|
|
1441
1537
|
}),
|
|
1442
|
-
[RequestType.EDIT_ENTITY]:
|
|
1443
|
-
type:
|
|
1538
|
+
[RequestType.EDIT_ENTITY]: z7.object({
|
|
1539
|
+
type: z7.literal(RequestType.EDIT_ENTITY),
|
|
1444
1540
|
data: zEditEntityRequestData
|
|
1445
1541
|
}),
|
|
1446
|
-
[RequestType.REVOKE_ENTITY]:
|
|
1447
|
-
type:
|
|
1448
|
-
data:
|
|
1542
|
+
[RequestType.REVOKE_ENTITY]: z7.object({
|
|
1543
|
+
type: z7.literal(RequestType.REVOKE_ENTITY),
|
|
1544
|
+
data: z7.object({})
|
|
1449
1545
|
}),
|
|
1450
1546
|
// Users
|
|
1451
|
-
[RequestType.CREATE_PSD_USER]:
|
|
1452
|
-
type:
|
|
1547
|
+
[RequestType.CREATE_PSD_USER]: z7.object({
|
|
1548
|
+
type: z7.literal(RequestType.CREATE_PSD_USER),
|
|
1453
1549
|
data: zCreatePsdUserRequestData
|
|
1454
1550
|
}),
|
|
1455
|
-
[RequestType.CREATE_API_USER]:
|
|
1456
|
-
type:
|
|
1551
|
+
[RequestType.CREATE_API_USER]: z7.object({
|
|
1552
|
+
type: z7.literal(RequestType.CREATE_API_USER),
|
|
1457
1553
|
data: zCreateApiUserRequestData
|
|
1458
1554
|
}),
|
|
1459
|
-
[RequestType.CREATE_API_USER_ACCESS]:
|
|
1460
|
-
type:
|
|
1555
|
+
[RequestType.CREATE_API_USER_ACCESS]: z7.object({
|
|
1556
|
+
type: z7.literal(RequestType.CREATE_API_USER_ACCESS),
|
|
1461
1557
|
data: zCreateApiUserAccessRequestData
|
|
1462
1558
|
}),
|
|
1463
|
-
[RequestType.REVOKE_USER]:
|
|
1464
|
-
type:
|
|
1465
|
-
data:
|
|
1559
|
+
[RequestType.REVOKE_USER]: z7.object({
|
|
1560
|
+
type: z7.literal(RequestType.REVOKE_USER),
|
|
1561
|
+
data: z7.object({})
|
|
1466
1562
|
}),
|
|
1467
1563
|
// Admin gov rules
|
|
1468
|
-
[RequestType.CREATE_WORKSPACE_RULE]:
|
|
1469
|
-
type:
|
|
1564
|
+
[RequestType.CREATE_WORKSPACE_RULE]: z7.object({
|
|
1565
|
+
type: z7.literal(RequestType.CREATE_WORKSPACE_RULE),
|
|
1470
1566
|
data: zWorkspaceRuleRequestData
|
|
1471
1567
|
}),
|
|
1472
|
-
[RequestType.EDIT_WORKSPACE_RULE]:
|
|
1473
|
-
type:
|
|
1568
|
+
[RequestType.EDIT_WORKSPACE_RULE]: z7.object({
|
|
1569
|
+
type: z7.literal(RequestType.EDIT_WORKSPACE_RULE),
|
|
1474
1570
|
data: zWorkspaceRuleRequestData
|
|
1475
1571
|
}),
|
|
1476
1572
|
// SCI configs
|
|
1477
|
-
[RequestType.CREATE_SCICONFIG]:
|
|
1478
|
-
type:
|
|
1573
|
+
[RequestType.CREATE_SCICONFIG]: z7.object({
|
|
1574
|
+
type: z7.literal(RequestType.CREATE_SCICONFIG),
|
|
1479
1575
|
data: zCreateSciConfigRequestData
|
|
1480
1576
|
}),
|
|
1481
|
-
[RequestType.EDIT_SCICONFIG]:
|
|
1482
|
-
type:
|
|
1577
|
+
[RequestType.EDIT_SCICONFIG]: z7.object({
|
|
1578
|
+
type: z7.literal(RequestType.EDIT_SCICONFIG),
|
|
1483
1579
|
data: zEditSciConfigRequestData
|
|
1484
1580
|
}),
|
|
1485
1581
|
// API keys
|
|
1486
|
-
[RequestType.CREATE_API_KEY]:
|
|
1487
|
-
type:
|
|
1582
|
+
[RequestType.CREATE_API_KEY]: z7.object({
|
|
1583
|
+
type: z7.literal(RequestType.CREATE_API_KEY),
|
|
1488
1584
|
data: zCreateApiKeyRequestData
|
|
1489
1585
|
}),
|
|
1490
|
-
[RequestType.EDIT_API_KEY]:
|
|
1491
|
-
type:
|
|
1586
|
+
[RequestType.EDIT_API_KEY]: z7.object({
|
|
1587
|
+
type: z7.literal(RequestType.EDIT_API_KEY),
|
|
1492
1588
|
data: zEditApiKeyRequestData
|
|
1493
1589
|
}),
|
|
1494
|
-
[RequestType.REVOKE_API_KEY]:
|
|
1495
|
-
type:
|
|
1496
|
-
data:
|
|
1590
|
+
[RequestType.REVOKE_API_KEY]: z7.object({
|
|
1591
|
+
type: z7.literal(RequestType.REVOKE_API_KEY),
|
|
1592
|
+
data: z7.object({})
|
|
1497
1593
|
}),
|
|
1498
1594
|
// Policies
|
|
1499
|
-
[RequestType.CREATE_POLICY]:
|
|
1500
|
-
type:
|
|
1595
|
+
[RequestType.CREATE_POLICY]: z7.object({
|
|
1596
|
+
type: z7.literal(RequestType.CREATE_POLICY),
|
|
1501
1597
|
data: zCreatePublicPolicyRequestData
|
|
1502
1598
|
}),
|
|
1503
|
-
[RequestType.EDIT_POLICY]:
|
|
1504
|
-
type:
|
|
1505
|
-
targetId:
|
|
1599
|
+
[RequestType.EDIT_POLICY]: z7.object({
|
|
1600
|
+
type: z7.literal(RequestType.EDIT_POLICY),
|
|
1601
|
+
targetId: z7.string(),
|
|
1506
1602
|
data: zEditPublicPolicyRequestData
|
|
1507
1603
|
}),
|
|
1508
1604
|
// Tradelink
|
|
1509
|
-
[RequestType.CREATE_TRADELINK_CUSTODIAN]:
|
|
1510
|
-
type:
|
|
1605
|
+
[RequestType.CREATE_TRADELINK_CUSTODIAN]: z7.object({
|
|
1606
|
+
type: z7.literal(RequestType.CREATE_TRADELINK_CUSTODIAN),
|
|
1511
1607
|
data: zCustodianRequestData
|
|
1512
1608
|
}),
|
|
1513
|
-
[RequestType.EDIT_TRADELINK_CUSTODIAN]:
|
|
1514
|
-
type:
|
|
1515
|
-
targetId:
|
|
1609
|
+
[RequestType.EDIT_TRADELINK_CUSTODIAN]: z7.object({
|
|
1610
|
+
type: z7.literal(RequestType.EDIT_TRADELINK_CUSTODIAN),
|
|
1611
|
+
targetId: z7.string(),
|
|
1516
1612
|
data: zCustodianRequestData
|
|
1517
1613
|
}),
|
|
1518
|
-
[RequestType.CREATE_TRADELINK_EXCHANGE]:
|
|
1519
|
-
type:
|
|
1614
|
+
[RequestType.CREATE_TRADELINK_EXCHANGE]: z7.object({
|
|
1615
|
+
type: z7.literal(RequestType.CREATE_TRADELINK_EXCHANGE),
|
|
1520
1616
|
data: zTradelinkEntityRequestData
|
|
1521
1617
|
}),
|
|
1522
|
-
[RequestType.EDIT_TRADELINK_EXCHANGE]:
|
|
1523
|
-
type:
|
|
1524
|
-
targetId:
|
|
1618
|
+
[RequestType.EDIT_TRADELINK_EXCHANGE]: z7.object({
|
|
1619
|
+
type: z7.literal(RequestType.EDIT_TRADELINK_EXCHANGE),
|
|
1620
|
+
targetId: z7.string(),
|
|
1525
1621
|
data: zTradelinkEntityRequestData
|
|
1526
1622
|
}),
|
|
1527
|
-
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]:
|
|
1528
|
-
type:
|
|
1623
|
+
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]: z7.object({
|
|
1624
|
+
type: z7.literal(RequestType.CREATE_TRADELINK_ASSET_MANAGER),
|
|
1529
1625
|
data: zTradelinkEntityRequestData
|
|
1530
1626
|
}),
|
|
1531
|
-
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]:
|
|
1532
|
-
type:
|
|
1533
|
-
targetId:
|
|
1627
|
+
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]: z7.object({
|
|
1628
|
+
type: z7.literal(RequestType.EDIT_TRADELINK_ASSET_MANAGER),
|
|
1629
|
+
targetId: z7.string(),
|
|
1534
1630
|
data: zTradelinkEntityRequestData
|
|
1535
1631
|
}),
|
|
1536
|
-
[RequestType.ADJUST_PLEDGE]:
|
|
1537
|
-
type:
|
|
1632
|
+
[RequestType.ADJUST_PLEDGE]: z7.object({
|
|
1633
|
+
type: z7.literal(RequestType.ADJUST_PLEDGE),
|
|
1538
1634
|
data: zAdjustPledgeRequestData
|
|
1539
1635
|
}),
|
|
1540
|
-
[RequestType.TRADELINK_REPLEDGE]:
|
|
1541
|
-
type:
|
|
1636
|
+
[RequestType.TRADELINK_REPLEDGE]: z7.object({
|
|
1637
|
+
type: z7.literal(RequestType.TRADELINK_REPLEDGE),
|
|
1542
1638
|
data: zRepledgeRequestData
|
|
1543
1639
|
}),
|
|
1544
|
-
[RequestType.CREATE_SETTLEMENT]:
|
|
1545
|
-
type:
|
|
1640
|
+
[RequestType.CREATE_SETTLEMENT]: z7.object({
|
|
1641
|
+
type: z7.literal(RequestType.CREATE_SETTLEMENT),
|
|
1546
1642
|
data: zCreateSettlementRequestData,
|
|
1547
|
-
meta:
|
|
1548
|
-
hash:
|
|
1643
|
+
meta: z7.object({
|
|
1644
|
+
hash: z7.string().nullable()
|
|
1549
1645
|
}).optional().nullable()
|
|
1550
1646
|
}),
|
|
1551
|
-
[RequestType.FORCE_UNPLEDGE]:
|
|
1552
|
-
type:
|
|
1647
|
+
[RequestType.FORCE_UNPLEDGE]: z7.object({
|
|
1648
|
+
type: z7.literal(RequestType.FORCE_UNPLEDGE),
|
|
1553
1649
|
data: zForceUnpledgeRequestData
|
|
1554
1650
|
}),
|
|
1555
|
-
[RequestType.TRADELINK_WITHDRAW]:
|
|
1556
|
-
type:
|
|
1651
|
+
[RequestType.TRADELINK_WITHDRAW]: z7.object({
|
|
1652
|
+
type: z7.literal(RequestType.TRADELINK_WITHDRAW),
|
|
1557
1653
|
data: zTradelinkWithdrawRequestData,
|
|
1558
|
-
meta:
|
|
1559
|
-
hash:
|
|
1654
|
+
meta: z7.object({
|
|
1655
|
+
hash: z7.string().nullable()
|
|
1560
1656
|
}).optional().nullable()
|
|
1561
1657
|
}),
|
|
1562
|
-
[RequestType.TRADELINK_ARBITRATE]:
|
|
1563
|
-
type:
|
|
1658
|
+
[RequestType.TRADELINK_ARBITRATE]: z7.object({
|
|
1659
|
+
type: z7.literal(RequestType.TRADELINK_ARBITRATE),
|
|
1564
1660
|
data: zTradelinkArbitrationRequestData,
|
|
1565
|
-
meta:
|
|
1566
|
-
hash:
|
|
1661
|
+
meta: z7.object({
|
|
1662
|
+
hash: z7.string().nullable()
|
|
1567
1663
|
}).optional().nullable()
|
|
1568
1664
|
})
|
|
1569
1665
|
};
|
|
1570
1666
|
|
|
1571
1667
|
// src/requests/app-types.ts
|
|
1572
|
-
var zRequestReviewResponse =
|
|
1668
|
+
var zRequestReviewResponse = z7.object({
|
|
1573
1669
|
// Note: Do NOT include `quorum` as it is already available in the request's `reviewSteps` field.
|
|
1574
|
-
stepIndex:
|
|
1575
|
-
userId:
|
|
1576
|
-
status:
|
|
1577
|
-
createdAt:
|
|
1578
|
-
updatedAt:
|
|
1579
|
-
});
|
|
1580
|
-
var zVaultRequestCommonMixin =
|
|
1581
|
-
id:
|
|
1582
|
-
legacyId:
|
|
1583
|
-
state:
|
|
1670
|
+
stepIndex: z7.number().int().describe("Index of the governance step in the request workflow"),
|
|
1671
|
+
userId: z7.string().describe("Reviewer id"),
|
|
1672
|
+
status: z7.nativeEnum(RequestReviewStatus).describe("Review status"),
|
|
1673
|
+
createdAt: z7.coerce.date().describe("Created date"),
|
|
1674
|
+
updatedAt: z7.coerce.date().describe("Updated date")
|
|
1675
|
+
});
|
|
1676
|
+
var zVaultRequestCommonMixin = z7.object({
|
|
1677
|
+
id: z7.string().describe("Request unique identifier"),
|
|
1678
|
+
legacyId: z7.number().describe("Legacy internal unique identifier (for retro-compatibility)"),
|
|
1679
|
+
state: z7.nativeEnum(RequestState).describe("Request state"),
|
|
1584
1680
|
reviewSteps: zRequestReviewSteps.describe("Request review steps"),
|
|
1585
|
-
currentStepIndex:
|
|
1586
|
-
expiredAt:
|
|
1587
|
-
targetId:
|
|
1681
|
+
currentStepIndex: z7.number().int().min(0).describe("Index of the current approval step"),
|
|
1682
|
+
expiredAt: z7.coerce.date().nullable().describe("Optional expiration date"),
|
|
1683
|
+
targetId: z7.string().nullable().describe("Optional ID of the target object"),
|
|
1588
1684
|
note: zNote.nullable().describe("Optional request note"),
|
|
1589
|
-
reviews:
|
|
1685
|
+
reviews: z7.array(zRequestReviewResponse).describe("Requests reviews"),
|
|
1590
1686
|
// `type` and `data` are correlated -- See `zVaultRequestMixinsByType`
|
|
1591
|
-
createdAt:
|
|
1592
|
-
updatedAt:
|
|
1687
|
+
createdAt: z7.coerce.date().describe("Creation timestamp"),
|
|
1688
|
+
updatedAt: z7.coerce.date().describe("Last modification timestamp"),
|
|
1593
1689
|
// `inflight` is fetched from ONGOING RequestSaga
|
|
1594
|
-
inflight:
|
|
1595
|
-
lastError:
|
|
1596
|
-
numFailed:
|
|
1597
|
-
retryAfter:
|
|
1690
|
+
inflight: z7.object({
|
|
1691
|
+
lastError: z7.string().describe("Error message from the last failure"),
|
|
1692
|
+
numFailed: z7.number().int().describe("Number of failures so far"),
|
|
1693
|
+
retryAfter: z7.coerce.date().describe("Date after which next retry is scheduled")
|
|
1598
1694
|
}).optional().describe("Extra information if the request is currently being processed")
|
|
1599
1695
|
});
|
|
1600
|
-
var
|
|
1696
|
+
var allowedRequestCreationInputByType = {
|
|
1601
1697
|
[RequestType.UPDATE_QUORUM]: zVaultRequestMixinsByType[RequestType.UPDATE_QUORUM],
|
|
1602
1698
|
[RequestType.CREATE_PSD_USER]: zVaultRequestMixinsByType[RequestType.CREATE_PSD_USER],
|
|
1603
1699
|
[RequestType.CREATE_API_USER]: zVaultRequestMixinsByType[RequestType.CREATE_API_USER],
|
|
@@ -1606,10 +1702,14 @@ var allowedRequestCreationInput = {
|
|
|
1606
1702
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
1607
1703
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
1608
1704
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
1705
|
+
[RequestType.SIGN_MESSAGE]: z7.object({
|
|
1706
|
+
type: z7.literal(RequestType.SIGN_MESSAGE),
|
|
1707
|
+
data: zSignMessageUserInputData
|
|
1708
|
+
}),
|
|
1609
1709
|
[RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
|
|
1610
1710
|
[RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
|
|
1611
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
1612
|
-
type:
|
|
1711
|
+
[RequestType.CREATE_ACCOUNT]: z7.object({
|
|
1712
|
+
type: z7.literal(RequestType.CREATE_ACCOUNT),
|
|
1613
1713
|
data: zCreateAccountUserInputData
|
|
1614
1714
|
}),
|
|
1615
1715
|
[RequestType.EDIT_ACCOUNT]: zVaultRequestMixinsByType[RequestType.EDIT_ACCOUNT],
|
|
@@ -1627,18 +1727,21 @@ var allowedRequestCreationInput = {
|
|
|
1627
1727
|
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW],
|
|
1628
1728
|
[RequestType.TRADELINK_ARBITRATE]: zVaultRequestMixinsByType[RequestType.TRADELINK_ARBITRATE]
|
|
1629
1729
|
};
|
|
1630
|
-
|
|
1631
|
-
|
|
1730
|
+
var zRequestCreationInputCommonMixin = z7.object({
|
|
1731
|
+
note: zNote.optional().describe("Optional request note")
|
|
1732
|
+
});
|
|
1733
|
+
z7.object({
|
|
1734
|
+
request: z7.discriminatedUnion(
|
|
1632
1735
|
"type",
|
|
1633
1736
|
ensureNonEmptyArray(
|
|
1634
|
-
Object.values(
|
|
1737
|
+
Object.values(allowedRequestCreationInputByType).map((_) => {
|
|
1635
1738
|
const requestType = _.shape.type._def.value;
|
|
1636
|
-
return _.describe(`${requestType} request data`);
|
|
1739
|
+
return _.merge(zRequestCreationInputCommonMixin).describe(`${requestType} request data`);
|
|
1637
1740
|
})
|
|
1638
1741
|
)
|
|
1639
1742
|
)
|
|
1640
1743
|
});
|
|
1641
|
-
var zVaultRequestResponse =
|
|
1744
|
+
var zVaultRequestResponse = z7.discriminatedUnion(
|
|
1642
1745
|
"type",
|
|
1643
1746
|
ensureNonEmptyArray(
|
|
1644
1747
|
Object.values(zVaultRequestMixinsByType).map((_) => {
|
|
@@ -1647,14 +1750,14 @@ var zVaultRequestResponse = z5.discriminatedUnion(
|
|
|
1647
1750
|
})
|
|
1648
1751
|
)
|
|
1649
1752
|
);
|
|
1650
|
-
|
|
1753
|
+
z7.enum([
|
|
1651
1754
|
"state",
|
|
1652
1755
|
"expiredAt",
|
|
1653
1756
|
"createdAt",
|
|
1654
1757
|
"updatedAt"
|
|
1655
1758
|
]).default("createdAt");
|
|
1656
|
-
|
|
1657
|
-
pubKey:
|
|
1759
|
+
z7.object({
|
|
1760
|
+
pubKey: z7.string().describe("Public key of the current user"),
|
|
1658
1761
|
challenge: zUserChallenge.describe("Challenge data to sign with the user's private key")
|
|
1659
1762
|
});
|
|
1660
1763
|
var shouldHaveTargetHsmId = (request) => {
|
|
@@ -2062,115 +2165,6 @@ var genVaultRequestReview = (opts) => {
|
|
|
2062
2165
|
};
|
|
2063
2166
|
|
|
2064
2167
|
// src/__fakes__/responses.ts
|
|
2065
|
-
var genericBalanceFields = () => {
|
|
2066
|
-
const total = faker.number.int();
|
|
2067
|
-
const pending = faker.number.int({ min: 0, max: total / 2 });
|
|
2068
|
-
return {
|
|
2069
|
-
total: total.toString(),
|
|
2070
|
-
pending: pending.toString()
|
|
2071
|
-
};
|
|
2072
|
-
};
|
|
2073
|
-
var stakingFieldsByAccountType = {
|
|
2074
|
-
BEP20_LIKE: () => null,
|
|
2075
|
-
BITCOIN_LIKE: () => null,
|
|
2076
|
-
CARDANO_LIKE: () => ({
|
|
2077
|
-
type: "CARDANO_LIKE",
|
|
2078
|
-
staking: {
|
|
2079
|
-
staked: faker.number.int().toString()
|
|
2080
|
-
}
|
|
2081
|
-
}),
|
|
2082
|
-
ERC20_LIKE: () => null,
|
|
2083
|
-
ETHEREUM_LIKE: () => ({
|
|
2084
|
-
type: "ETHEREUM_LIKE",
|
|
2085
|
-
staking: {
|
|
2086
|
-
totalStaking: faker.number.int().toString(),
|
|
2087
|
-
totalRewards: faker.number.int().toString(),
|
|
2088
|
-
availableRewards: faker.number.int().toString(),
|
|
2089
|
-
networkApy: faker.number.float({ min: 0, max: 1 })
|
|
2090
|
-
}
|
|
2091
|
-
}),
|
|
2092
|
-
GENERIC_LIKE: () => null,
|
|
2093
|
-
RAW_SIGNING: () => null,
|
|
2094
|
-
POLKADOT_LIKE: () => ({
|
|
2095
|
-
type: "POLKADOT_LIKE",
|
|
2096
|
-
staking: {
|
|
2097
|
-
info: {
|
|
2098
|
-
controllerAddress: "<fake-controller-address>",
|
|
2099
|
-
rewardsDestination: "<fake-rewards-destination>",
|
|
2100
|
-
proxies: ["<fake-proxy>"],
|
|
2101
|
-
legacyStaking: false,
|
|
2102
|
-
isNominator: false
|
|
2103
|
-
},
|
|
2104
|
-
balances: {
|
|
2105
|
-
free: faker.number.int().toString(),
|
|
2106
|
-
reserved: faker.number.int().toString(),
|
|
2107
|
-
frozen: faker.number.int().toString(),
|
|
2108
|
-
bonded: faker.number.int().toString(),
|
|
2109
|
-
available: faker.number.int().toString(),
|
|
2110
|
-
unbonding: [{ amount: faker.number.int().toString(), waiting_time: "<fake-waiting-time>" }],
|
|
2111
|
-
unbonded: [{ amount: faker.number.int().toString(), waiting_time: "<fake-waiting-time>" }],
|
|
2112
|
-
totalUnbonding: faker.number.int().toString(),
|
|
2113
|
-
totalUnbonded: faker.number.int().toString()
|
|
2114
|
-
},
|
|
2115
|
-
anonymousProxy: {
|
|
2116
|
-
address: "<fake-anonymous-proxy-address>",
|
|
2117
|
-
createdAt: faker.date.past().toISOString(),
|
|
2118
|
-
isController: false,
|
|
2119
|
-
isMain: false,
|
|
2120
|
-
balances: {
|
|
2121
|
-
free: faker.number.int().toString(),
|
|
2122
|
-
reserved: faker.number.int().toString(),
|
|
2123
|
-
frozen: faker.number.int().toString(),
|
|
2124
|
-
bonded: faker.number.int().toString(),
|
|
2125
|
-
available: faker.number.int().toString(),
|
|
2126
|
-
total: faker.number.int().toString()
|
|
2127
|
-
},
|
|
2128
|
-
blockHeight: faker.number.int().toString(),
|
|
2129
|
-
extIndex: faker.number.int().toString(),
|
|
2130
|
-
index: faker.number.int().toString(),
|
|
2131
|
-
kind: "<fake-kind>"
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
}),
|
|
2135
|
-
RIPPLE_LIKE: () => null,
|
|
2136
|
-
SOLANA_LIKE: () => ({
|
|
2137
|
-
type: "SOLANA_LIKE",
|
|
2138
|
-
staking: {
|
|
2139
|
-
staked: faker.number.int().toString(),
|
|
2140
|
-
rewards: {
|
|
2141
|
-
total: faker.number.int().toString(),
|
|
2142
|
-
last7: faker.number.int().toString(),
|
|
2143
|
-
last30: faker.number.int().toString()
|
|
2144
|
-
},
|
|
2145
|
-
stakes: [
|
|
2146
|
-
{
|
|
2147
|
-
uid: "<fake-stake-uid>",
|
|
2148
|
-
baseAccountUid: "<fake-base-account-uid>",
|
|
2149
|
-
pubKey: "<fake-pub-key>",
|
|
2150
|
-
validatorPubKey: "<fake-validator-pub-key>",
|
|
2151
|
-
initialAmount: faker.number.int().toString(),
|
|
2152
|
-
activeAmount: faker.number.int().toString(),
|
|
2153
|
-
inactiveAmount: faker.number.int().toString(),
|
|
2154
|
-
totalBalance: faker.number.int().toString(),
|
|
2155
|
-
creationDate: faker.date.past().toISOString(),
|
|
2156
|
-
activationEpoch: faker.date.past().toISOString(),
|
|
2157
|
-
activationDate: faker.date.past().toISOString(),
|
|
2158
|
-
deactivationEpoch: "<fake-deactivation-epoch>",
|
|
2159
|
-
deactivationDate: faker.date.past().toISOString(),
|
|
2160
|
-
status: "activated",
|
|
2161
|
-
rentExemptReserve: faker.number.int().toString(),
|
|
2162
|
-
withdrawableAmount: faker.number.int().toString(),
|
|
2163
|
-
totalRewards: faker.number.int().toString(),
|
|
2164
|
-
creationTxHash: "<fake-creation-tx-hash>",
|
|
2165
|
-
actionsTxHashes: ["<fake-action-tx-hash>"]
|
|
2166
|
-
}
|
|
2167
|
-
]
|
|
2168
|
-
}
|
|
2169
|
-
}),
|
|
2170
|
-
STELLAR_LIKE: () => null,
|
|
2171
|
-
TEZOS_LIKE: () => null,
|
|
2172
|
-
TRC20_LIKE: () => null
|
|
2173
|
-
};
|
|
2174
2168
|
function genVaultRequestResponse(opts, reviews = []) {
|
|
2175
2169
|
const request = genVaultRequest(opts);
|
|
2176
2170
|
const requestWithReviews = { ...request, reviews };
|
|
@@ -2179,13 +2173,7 @@ function genVaultRequestResponse(opts, reviews = []) {
|
|
|
2179
2173
|
function genAccountResponse(overrides) {
|
|
2180
2174
|
const dbAccount = genAccount(overrides);
|
|
2181
2175
|
const account = serializeAccount(dbAccount);
|
|
2182
|
-
|
|
2183
|
-
Object.assign(account.asset, staking);
|
|
2184
|
-
const response = {
|
|
2185
|
-
...account,
|
|
2186
|
-
balance: genericBalanceFields()
|
|
2187
|
-
};
|
|
2188
|
-
return zAccountResponse.parse(response);
|
|
2176
|
+
return zAccountResponse.parse(account);
|
|
2189
2177
|
}
|
|
2190
2178
|
|
|
2191
2179
|
export { genAccountResponse, genVaultRequestResponse, genVaultRequestReview };
|