@ledgerhq/revault-api 1.23.1 → 1.29.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-pVQiUA0g.d.mts → app-types-mEeONvZb.d.mts} +21497 -19509
- package/lib/fakes.d.mts +3337 -3252
- package/lib/fakes.mjs +195 -180
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +4873 -4010
- package/package.json +6 -6
package/lib/fakes.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
2
|
import z5, { z } from 'zod';
|
|
3
|
-
import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, ActivationStatus, WhitelistType,
|
|
3
|
+
import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, ActivationStatus, WhitelistType, UserRole, UserRegistrationState, AdminPermission, RequestType, RequestReviewStatus, RequestState, GateAccountType } from '@prisma/client';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import invariant from 'invariant';
|
|
6
6
|
import { omit, times } from 'lodash';
|
|
7
7
|
import 'crypto';
|
|
8
|
-
import 'fs/promises';
|
|
9
|
-
import 'path';
|
|
10
8
|
|
|
11
9
|
// src/__fakes__/responses.ts
|
|
12
10
|
|
|
@@ -34,9 +32,10 @@ var ensureNonEmptyArray = (values, message) => {
|
|
|
34
32
|
function unreachable(value) {
|
|
35
33
|
throw new Error(`Un-covered: ${value}`);
|
|
36
34
|
}
|
|
37
|
-
var zBigInt = z.string().regex(/^0|[1-9]\d*$/);
|
|
38
|
-
var zIntString = z.string().min(1).regex(/^-?\d+$/);
|
|
39
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");
|
|
40
39
|
|
|
41
40
|
// src/hsm/types.ts
|
|
42
41
|
var zHsmObjectId = z.string().regex(/^[\w-]+$/).min(1);
|
|
@@ -88,7 +87,7 @@ z.object({
|
|
|
88
87
|
stageName: z.string(),
|
|
89
88
|
steps: zHsmChallengeSteps
|
|
90
89
|
});
|
|
91
|
-
|
|
90
|
+
z.object({
|
|
92
91
|
name: z.string().describe("Name of the user to register"),
|
|
93
92
|
psdModel: z.nativeEnum(PsdModel).describe("Device model"),
|
|
94
93
|
pubKey: zPubKey.describe("Device public key"),
|
|
@@ -96,7 +95,7 @@ var zUserRegistrationDeviceData = z.object({
|
|
|
96
95
|
psdEphemeralKey: zPubKey,
|
|
97
96
|
psdEphemeralKeyAttestation: zHsmCertificate
|
|
98
97
|
}).describe("Data generated by the PSD to register on HSM");
|
|
99
|
-
|
|
98
|
+
z.object({
|
|
100
99
|
challenge: z.string(),
|
|
101
100
|
ephemeralPublicKey: zPubKey,
|
|
102
101
|
ephemeralPublicKeyAttestation: zHsmCertificate,
|
|
@@ -213,6 +212,15 @@ z5.union([
|
|
|
213
212
|
zStellarLikeTransactionType,
|
|
214
213
|
zTezosLikeTransactionType
|
|
215
214
|
]);
|
|
215
|
+
z5.discriminatedUnion("type", [
|
|
216
|
+
z5.object({
|
|
217
|
+
type: z5.literal("ETHEREUM_LIKE"),
|
|
218
|
+
baseFees: zIntString,
|
|
219
|
+
gasLimit: zIntString,
|
|
220
|
+
nonce: z5.string(),
|
|
221
|
+
priorityFees: zIntString
|
|
222
|
+
})
|
|
223
|
+
]);
|
|
216
224
|
|
|
217
225
|
// src/transactions/request-data.ts
|
|
218
226
|
var zHexDataString = z5.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/).transform((hex) => `0x${hex.toLowerCase().replace("0x", "")}`);
|
|
@@ -220,10 +228,10 @@ if ("openapi" in zHexDataString) {
|
|
|
220
228
|
zHexDataString = zHexDataString.openapi?.({ effectType: "same" });
|
|
221
229
|
}
|
|
222
230
|
var zCommonTransactionData = z5.object({
|
|
223
|
-
amount:
|
|
224
|
-
currency:
|
|
231
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
232
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
225
233
|
// TODO: strict literal or enum?
|
|
226
|
-
maxFee:
|
|
234
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
227
235
|
recipient: z5.string().describe("Transaction recipient")
|
|
228
236
|
});
|
|
229
237
|
var zFeeStrategyCustom = z5.object({
|
|
@@ -234,17 +242,20 @@ var zFeeStrategy = z5.object({
|
|
|
234
242
|
});
|
|
235
243
|
var zBitcoinLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
236
244
|
// nullish is optional + nullable, it is easier to seed rather than just optional
|
|
237
|
-
feePerByte:
|
|
245
|
+
feePerByte: zUnsignedIntString.nullish().describe("Fee per byte")
|
|
238
246
|
}).describe("Bitcoin-like fee strategy");
|
|
239
247
|
var zBitcoinLikeSendData = zCommonTransactionData.extend({
|
|
240
248
|
type: z5.literal(zBitcoinLikeTransactionType.enum.BITCOIN_LIKE_SEND),
|
|
241
249
|
feeStrategy: zBitcoinLikeFeeStrategy
|
|
242
250
|
}).describe("Bitcoin-like send data");
|
|
243
|
-
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
251
|
+
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
252
|
+
gasPrice: zUnsignedIntString.describe("Gas price"),
|
|
253
|
+
gasLimit: zUnsignedIntString.describe("Gas limit")
|
|
254
|
+
}).describe("Ethereum-like legacy fee strategy");
|
|
244
255
|
var zEthereumLikeEip1559FeeStrategy = zFeeStrategyCustom.extend({
|
|
245
|
-
maxPriorityFeePerGas:
|
|
246
|
-
maxFeePerGas:
|
|
247
|
-
gasLimit:
|
|
256
|
+
maxPriorityFeePerGas: zUnsignedIntString.describe("Maximum priority fee per gas"),
|
|
257
|
+
maxFeePerGas: zUnsignedIntString.describe("Maximum fee per gas (base + priority)"),
|
|
258
|
+
gasLimit: zUnsignedIntString.describe("Gas limit")
|
|
248
259
|
}).describe("Ethereum-like EIP-1559 fee strategy");
|
|
249
260
|
var zEthereumLikeFeeStrategy = z5.union([zEthereumLikeLegacyFeeStrategy, zEthereumLikeEip1559FeeStrategy]).describe("Ethereum-like fee strategy");
|
|
250
261
|
var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
@@ -264,8 +275,8 @@ var zEthereumLikeSendData = zCommonTransactionData.extend({
|
|
|
264
275
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
265
276
|
}).describe("Ethereum-like send data");
|
|
266
277
|
var zTezosLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
267
|
-
gasLimit:
|
|
268
|
-
storageLimit:
|
|
278
|
+
gasLimit: zUnsignedIntString.describe("Gas limit"),
|
|
279
|
+
storageLimit: zUnsignedIntString.nullable().describe("Storage limit")
|
|
269
280
|
}).describe("Tezos-like fee strategy");
|
|
270
281
|
var zTezosLikeDelegateData = zCommonTransactionData.extend({
|
|
271
282
|
type: z5.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_DELEGATE),
|
|
@@ -282,41 +293,41 @@ var zTezosLikeUndelegateData = zCommonTransactionData.extend({
|
|
|
282
293
|
var zPolkadotRewardDestination = z5.enum(["Staked", "Stash"]);
|
|
283
294
|
var zPolkadotLikeAddProxyData = z5.object({
|
|
284
295
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ADDPROXY),
|
|
285
|
-
currency:
|
|
296
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
286
297
|
kind: z5.literal("Staking").describe("Proxy kind"),
|
|
287
298
|
proxy: z5.string().describe("Proxy address")
|
|
288
299
|
}).describe("Polkadot-like add proxy data");
|
|
289
300
|
var zPolkadotLikeAnonymousProxyData = z5.object({
|
|
290
301
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ANONYMOUSPROXY),
|
|
291
|
-
currency:
|
|
302
|
+
currency: zCurrency.describe("Transaction currency")
|
|
292
303
|
}).describe("Polkadot-like anonymous proxy data");
|
|
293
304
|
var zPolkadotLikeBondData = z5.object({
|
|
294
305
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BOND),
|
|
295
|
-
currency:
|
|
306
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
296
307
|
payee: zPolkadotRewardDestination,
|
|
297
|
-
amount:
|
|
308
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
298
309
|
}).describe("Polkadot-like bond data");
|
|
299
310
|
var zPolkadotLikeBondExtraData = z5.object({
|
|
300
311
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BONDEXTRA),
|
|
301
|
-
currency:
|
|
302
|
-
amount:
|
|
312
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
313
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
303
314
|
}).describe("Polkadot-like bond extra data");
|
|
304
315
|
var zPolkadotLikeChillData = z5.object({
|
|
305
316
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_CHILL),
|
|
306
|
-
currency:
|
|
317
|
+
currency: zCurrency.describe("Transaction currency")
|
|
307
318
|
}).describe("Polkadot-like chill data");
|
|
308
319
|
var zPolkadotLikeKillAnonymousData = z5.object({
|
|
309
320
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_KILLANONYMOUS),
|
|
310
|
-
currency:
|
|
321
|
+
currency: zCurrency.describe("Transaction currency")
|
|
311
322
|
}).describe("Polkadot-like kill anonymous data");
|
|
312
323
|
var zPolkadotLikeRebondData = z5.object({
|
|
313
324
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REBOND),
|
|
314
|
-
currency:
|
|
315
|
-
amount:
|
|
325
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
326
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
316
327
|
}).describe("Polkadot-like rebond data");
|
|
317
328
|
var zPolkadotLikeRemoveProxyData = z5.object({
|
|
318
329
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REMOVEPROXY),
|
|
319
|
-
currency:
|
|
330
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
320
331
|
kind: z5.literal("Staking"),
|
|
321
332
|
proxy: z5.string().describe("Proxy address")
|
|
322
333
|
}).describe("Polkadot-like remove proxy data");
|
|
@@ -325,17 +336,17 @@ var zPolkadotLikeSendData = zCommonTransactionData.extend({
|
|
|
325
336
|
}).describe("Polkadot-like send data");
|
|
326
337
|
var zPolkadotLikeSetPayeeData = z5.object({
|
|
327
338
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SETPAYEE),
|
|
328
|
-
currency:
|
|
339
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
329
340
|
payee: zPolkadotRewardDestination
|
|
330
341
|
}).describe("Polkadot-like set payee data");
|
|
331
342
|
var zPolkadotLikeUnbondData = z5.object({
|
|
332
343
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_UNBOND),
|
|
333
|
-
currency:
|
|
334
|
-
amount:
|
|
344
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
345
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
335
346
|
}).describe("Polkadot-like unbond data");
|
|
336
347
|
var zPolkadotLikeWithdrawUnbondedData = z5.object({
|
|
337
348
|
type: z5.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_WITHDRAWUNBONDED),
|
|
338
|
-
currency:
|
|
349
|
+
currency: zCurrency.describe("Transaction currency")
|
|
339
350
|
}).describe("Polkadot-like withdraw unbonded data");
|
|
340
351
|
var zRippleLikeSendData = zCommonTransactionData.extend({
|
|
341
352
|
type: z5.literal(zRippleLikeTransactionType.enum.RIPPLE_LIKE_SEND),
|
|
@@ -367,16 +378,16 @@ var zSolanaLikeCreateDelegateStakeData = zCommonTransactionData.extend({
|
|
|
367
378
|
}).describe("Solana-like create delegate stake data");
|
|
368
379
|
var zSolanaLikeDeactivateStakeData = z5.object({
|
|
369
380
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DEACTIVATE_STAKE),
|
|
370
|
-
currency:
|
|
371
|
-
maxFee:
|
|
381
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
382
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
372
383
|
stakeAccount: z5.string().describe("Stake account address"),
|
|
373
384
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
374
385
|
// No recipient, no amount
|
|
375
386
|
}).describe("Solana-like deactivate stake data");
|
|
376
387
|
var zSolanaLikeDelegateStakeData = z5.object({
|
|
377
388
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DELEGATE_STAKE),
|
|
378
|
-
currency:
|
|
379
|
-
maxFee:
|
|
389
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
390
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
380
391
|
recipient: z5.string().describe("Delegated vote address"),
|
|
381
392
|
stakeAccount: z5.string().describe("Stake account address"),
|
|
382
393
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
@@ -384,8 +395,8 @@ var zSolanaLikeDelegateStakeData = z5.object({
|
|
|
384
395
|
}).describe("Solana-like delegate stake data");
|
|
385
396
|
var zSolanaLikeMergeStakeData = z5.object({
|
|
386
397
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_MERGE_STAKE),
|
|
387
|
-
currency:
|
|
388
|
-
maxFee:
|
|
398
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
399
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
389
400
|
mergeSrcAccount: z5.string().describe("Source stake address"),
|
|
390
401
|
mergeDstAccount: z5.string().describe("Destination stake address"),
|
|
391
402
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
@@ -397,27 +408,27 @@ var zSolanaLikeSendData = zCommonTransactionData.extend({
|
|
|
397
408
|
}).describe("Solana-like send data");
|
|
398
409
|
var zSolanaLikeSplitDeactivateStakeData = z5.object({
|
|
399
410
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE),
|
|
400
|
-
amount:
|
|
401
|
-
currency:
|
|
402
|
-
maxFee:
|
|
411
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
412
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
413
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
403
414
|
stakeAccount: z5.string().describe("Stake account address"),
|
|
404
415
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
405
416
|
// No recipient
|
|
406
417
|
}).describe("Solana-like split deactivate stake data");
|
|
407
418
|
var zSolanaLikeSplitStakeData = z5.object({
|
|
408
419
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_STAKE),
|
|
409
|
-
amount:
|
|
410
|
-
currency:
|
|
411
|
-
maxFee:
|
|
420
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
421
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
422
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
412
423
|
stakeAccount: z5.string().describe("Stake account address"),
|
|
413
424
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
414
425
|
// No recipient
|
|
415
426
|
}).describe("Solana-like split stake data");
|
|
416
427
|
var zSolanaLikeWithdrawStakeData = z5.object({
|
|
417
428
|
type: z5.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_WITHDRAW_STAKE),
|
|
418
|
-
amount:
|
|
419
|
-
currency:
|
|
420
|
-
maxFee:
|
|
429
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
430
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
431
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
421
432
|
stakeAccount: z5.string().describe("Stake account address"),
|
|
422
433
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
423
434
|
// No recipient
|
|
@@ -436,43 +447,43 @@ var zCardanoSendData = zCommonTransactionData.extend({
|
|
|
436
447
|
}).describe("Cardano-like send data");
|
|
437
448
|
var zCardanoStakingDelegateData = z5.object({
|
|
438
449
|
type: z5.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DELEGATE),
|
|
439
|
-
currency:
|
|
450
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
440
451
|
// TODO: strict literal or enum?
|
|
441
|
-
maxFee:
|
|
452
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
442
453
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
443
454
|
// DELEGATE doesn't have neither amount nor recipient
|
|
444
455
|
stakePoolId: z5.string().min(1).max(100).describe("")
|
|
445
456
|
}).describe("Cardano-like staking delegate");
|
|
446
457
|
var zCardanoStakingDeregisterData = z5.object({
|
|
447
458
|
type: z5.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DEREGISTER),
|
|
448
|
-
currency:
|
|
459
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
449
460
|
// TODO: strict literal or enum?
|
|
450
|
-
maxFee:
|
|
461
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
451
462
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
452
463
|
// DEREGISTER doesn't have a recipient
|
|
453
|
-
amount:
|
|
464
|
+
amount: zUnsignedIntString.describe("Amount to deregister")
|
|
454
465
|
}).describe("Cardano-like staking deregister data");
|
|
455
466
|
var zCardanoStakingRegisterData = z5.object({
|
|
456
467
|
type: z5.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
457
|
-
currency:
|
|
468
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
458
469
|
// TODO: strict literal or enum?
|
|
459
|
-
maxFee:
|
|
470
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
460
471
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
461
472
|
// REGISTER doesn't have a recipient
|
|
462
|
-
amount:
|
|
473
|
+
amount: zUnsignedIntString.describe("Amount to register")
|
|
463
474
|
}).describe("Cardano-like staking register data");
|
|
464
475
|
var zCardanoStakingWithdrawData = z5.object({
|
|
465
476
|
type: z5.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_WITHDRAW),
|
|
466
|
-
currency:
|
|
477
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
467
478
|
// TODO: strict literal or enum?
|
|
468
|
-
maxFee:
|
|
479
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
469
480
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
470
481
|
// WITHDRAW doesn't have a recipient
|
|
471
|
-
amount:
|
|
482
|
+
amount: zUnsignedIntString.describe("Amount to withdraw")
|
|
472
483
|
}).describe("Cardano-like staking withdraw data");
|
|
473
484
|
var zGenericTransactionData = z5.object({
|
|
474
485
|
type: z5.literal(zGenericTransactionType.enum.GENERIC_TRANSACTION),
|
|
475
|
-
currency:
|
|
486
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
476
487
|
rawTx: z5.string().describe("Raw tx")
|
|
477
488
|
}).describe("Generic transaction data");
|
|
478
489
|
var zTransactionData = z5.discriminatedUnion("type", [
|
|
@@ -556,16 +567,15 @@ var zSignDigestsRequestData = z5.object({
|
|
|
556
567
|
z5.object({
|
|
557
568
|
signatures: z5.array(zHsmSignature)
|
|
558
569
|
});
|
|
559
|
-
var
|
|
570
|
+
var zClassicOperationType = z.enum([
|
|
560
571
|
"SEND",
|
|
561
572
|
"STAKE",
|
|
562
573
|
"DEPLOY_CONTRACT",
|
|
563
574
|
"EXECUTE_CONTRACT",
|
|
564
|
-
"SIGN_DIGESTS",
|
|
565
575
|
"SIGN_MESSAGE",
|
|
566
576
|
"ACTIVATE_TOKEN"
|
|
567
577
|
]);
|
|
568
|
-
var zOperationType = z.enum([...
|
|
578
|
+
var zOperationType = z.enum([...zClassicOperationType.options, "SIGN_DIGESTS"]);
|
|
569
579
|
var zNote = z5.object({
|
|
570
580
|
title: z5.string().describe("Request note title"),
|
|
571
581
|
content: z5.string().describe("Request note content")
|
|
@@ -788,6 +798,7 @@ var zEthereumTokenLikeAssetFields = z.object({
|
|
|
788
798
|
contractAddress: z.string().describe("Token contract address")
|
|
789
799
|
}).describe("Ethereum-like token");
|
|
790
800
|
var zGenericLikeAssetFields = z.object({ type: z.literal(AccountType.GENERIC_LIKE).describe("Account type") }).describe("Generic-like");
|
|
801
|
+
var zRawSigningAssetFields = z.object({ type: z.literal(AccountType.RAW_SIGNING).describe("Account type") }).describe("Raw signing account");
|
|
791
802
|
var zPolkadotLikeAssetFields = z.object({
|
|
792
803
|
type: z.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
793
804
|
address: z.string().describe("Account address").nullable()
|
|
@@ -816,6 +827,7 @@ z.discriminatedUnion("type", [
|
|
|
816
827
|
zEthereumTokenLikeAssetFields,
|
|
817
828
|
zGenericLikeAssetFields,
|
|
818
829
|
zPolkadotLikeAssetFields,
|
|
830
|
+
zRawSigningAssetFields,
|
|
819
831
|
zRippleLikeAssetFields,
|
|
820
832
|
zSolanaLikeAssetFields,
|
|
821
833
|
zStellarLikeAssetFields,
|
|
@@ -828,6 +840,7 @@ var zAccountAssetFields = z.discriminatedUnion("type", [
|
|
|
828
840
|
zEthereumTokenLikeAssetFields,
|
|
829
841
|
zGenericLikeAssetFields,
|
|
830
842
|
zPolkadotLikeAssetFields.merge(zPolkadotLikeStakingFields).describe("Polkadot-like"),
|
|
843
|
+
zRawSigningAssetFields,
|
|
831
844
|
zRippleLikeAssetFields,
|
|
832
845
|
zSolanaLikeAssetFields.merge(zSolanaLikeStakingFields).describe("Solana-like"),
|
|
833
846
|
zStellarLikeAssetFields,
|
|
@@ -848,12 +861,15 @@ var zReviewStepData = z.union([
|
|
|
848
861
|
}).describe("Review step with group")
|
|
849
862
|
]);
|
|
850
863
|
var zReviewStepsArray = z.array(zReviewStepData).min(1).describe("Review steps");
|
|
864
|
+
var zUpdateQuorumRequestData = z5.object({
|
|
865
|
+
quorum: z5.number().int().min(2).describe("Workspace quorum")
|
|
866
|
+
});
|
|
851
867
|
var zWorkspaceName = z5.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
852
868
|
|
|
853
869
|
// src/tradelink/types.ts
|
|
854
870
|
var zTradelinkWhitelistAddress = z5.object({
|
|
855
871
|
name: z5.string().min(1),
|
|
856
|
-
currency:
|
|
872
|
+
currency: zCurrency,
|
|
857
873
|
address: z5.string().min(1)
|
|
858
874
|
});
|
|
859
875
|
z5.array(zTradelinkWhitelistAddress);
|
|
@@ -930,7 +946,7 @@ z5.object({
|
|
|
930
946
|
});
|
|
931
947
|
z5.object({
|
|
932
948
|
pledgeTradelinkId: zTradelinkId,
|
|
933
|
-
amount:
|
|
949
|
+
amount: zUnsignedIntString,
|
|
934
950
|
asset: zTradelinkAsset
|
|
935
951
|
});
|
|
936
952
|
z5.object({
|
|
@@ -968,6 +984,11 @@ var zAdjustPledgeRequestData = z5.object({
|
|
|
968
984
|
exchangeId: z5.string().describe("Exchange id"),
|
|
969
985
|
amount: zIntString.describe("Amount to add to pledge")
|
|
970
986
|
});
|
|
987
|
+
var zRepledgeRequestData = z5.object({
|
|
988
|
+
accountId: z5.string().describe("Account id"),
|
|
989
|
+
exchangeId: z5.string().describe("Exchange id"),
|
|
990
|
+
amount: zIntString.describe("Amount to add to pledge")
|
|
991
|
+
});
|
|
971
992
|
var zCreateSettlementRequestData = z5.object({
|
|
972
993
|
accountId: z5.string().describe("Account id"),
|
|
973
994
|
exchangeId: z5.string().describe("Exchange id"),
|
|
@@ -981,6 +1002,10 @@ var zTradelinkWithdrawRequestData = z5.object({
|
|
|
981
1002
|
accountId: z5.string().describe("Account id"),
|
|
982
1003
|
transaction: zSendOnlyTransactionData
|
|
983
1004
|
});
|
|
1005
|
+
var zTradelinkArbitrationRequestData = z5.object({
|
|
1006
|
+
accountId: z5.string().describe("Account id"),
|
|
1007
|
+
transaction: zSendOnlyTransactionData
|
|
1008
|
+
});
|
|
984
1009
|
|
|
985
1010
|
// src/accounts/account-governance-fields.ts
|
|
986
1011
|
var zClassicAccountGovernanceFields = z.object({
|
|
@@ -998,11 +1023,11 @@ var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGove
|
|
|
998
1023
|
var zAccountCommonFields = z5.object({
|
|
999
1024
|
id: z5.string().describe("Internal unique identifier"),
|
|
1000
1025
|
legacyId: z5.number().describe("Legacy internal unique identifier (for retro-compatibility)"),
|
|
1001
|
-
status: z5.nativeEnum(ActivationStatus).describe("Status"),
|
|
1002
1026
|
name: z5.string().describe("Name"),
|
|
1003
|
-
currency:
|
|
1027
|
+
currency: zCurrency,
|
|
1004
1028
|
index: z5.number().gte(0).describe("BIP44 account index"),
|
|
1005
1029
|
derivationPath: z5.string().describe("Derivation path"),
|
|
1030
|
+
status: z5.nativeEnum(ActivationStatus).describe("Status"),
|
|
1006
1031
|
createdAt: z5.coerce.date().describe("Creation timestamp"),
|
|
1007
1032
|
updatedAt: z5.coerce.date().describe("Last modification timestamp")
|
|
1008
1033
|
});
|
|
@@ -1036,7 +1061,7 @@ z5.discriminatedUnion(
|
|
|
1036
1061
|
);
|
|
1037
1062
|
var zWhitelistAddress = z5.object({
|
|
1038
1063
|
name: z5.string().min(1).max(50),
|
|
1039
|
-
currency:
|
|
1064
|
+
currency: zCurrency,
|
|
1040
1065
|
address: z5.string().min(1).max(200),
|
|
1041
1066
|
// Destination tags are numeric-only or alpha-numeric.
|
|
1042
1067
|
// Empty array (or undefined) means no check on destination tag.
|
|
@@ -1057,10 +1082,8 @@ var zEditWhitelistRequestData = z5.object({
|
|
|
1057
1082
|
|
|
1058
1083
|
// src/policies/db-utils.ts
|
|
1059
1084
|
var zThreshold = z5.object({
|
|
1060
|
-
min:
|
|
1061
|
-
|
|
1062
|
-
max: z5.string().regex(/^\d+$/).nullable().describe("Maximum transaction amount")
|
|
1063
|
-
// bigint
|
|
1085
|
+
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
1086
|
+
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
1064
1087
|
}).describe("Threshold for the transaction value");
|
|
1065
1088
|
var zWhitelistIds = z5.array(z5.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
1066
1089
|
var zGovRuleJsonObject = z5.object({
|
|
@@ -1075,35 +1098,44 @@ var zGovRuleJsonObject = z5.object({
|
|
|
1075
1098
|
hsmId: zHsmObjectId
|
|
1076
1099
|
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
1077
1100
|
z5.array(zGovRuleJsonObject);
|
|
1078
|
-
var
|
|
1079
|
-
|
|
1101
|
+
var zBaseGovRuleData = z5.object({
|
|
1102
|
+
// Steps of users that will need to review operations
|
|
1103
|
+
reviewSteps: zReviewStepsArray,
|
|
1080
1104
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1081
1105
|
threshold: zThreshold.optional(),
|
|
1082
1106
|
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1083
|
-
whitelistIds: zWhitelistIds.optional()
|
|
1084
|
-
|
|
1107
|
+
whitelistIds: zWhitelistIds.optional()
|
|
1108
|
+
});
|
|
1109
|
+
var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
1110
|
+
operationType: zClassicOperationType.describe("Allowed operation type")
|
|
1085
1111
|
}).describe("Account governance rule");
|
|
1086
|
-
|
|
1112
|
+
zBaseGovRuleData.extend({
|
|
1113
|
+
operationType: zOperationType.describe("Allowed operation type")
|
|
1114
|
+
}).describe("Governance rule");
|
|
1087
1115
|
var zPolicyName = z5.string().min(1).max(19).describe("Policy name");
|
|
1088
|
-
var
|
|
1089
|
-
var
|
|
1116
|
+
var zCurrency2 = z5.string().min(1).max(40).regex(/^\w+$/).describe("Currency");
|
|
1117
|
+
var zCreatePublicPolicyRequestData = z5.object({
|
|
1090
1118
|
name: zPolicyName,
|
|
1091
1119
|
description: z5.string().nullable().describe("Description"),
|
|
1092
|
-
currency:
|
|
1093
|
-
govRules: z5.array(
|
|
1120
|
+
currency: zCurrency2.nullable(),
|
|
1121
|
+
govRules: z5.array(zClassicGovRuleData).describe("Governance rules")
|
|
1094
1122
|
});
|
|
1095
|
-
var
|
|
1123
|
+
var zEditPublicPolicyRequestData = z5.object({
|
|
1096
1124
|
name: zPolicyName,
|
|
1097
1125
|
description: z5.string().nullable().describe("Description"),
|
|
1098
|
-
govRules: z5.array(
|
|
1126
|
+
govRules: z5.array(zClassicGovRuleData).describe("Governance rules")
|
|
1099
1127
|
});
|
|
1100
1128
|
|
|
1101
1129
|
// src/accounts/request-data.ts
|
|
1102
1130
|
var zAccountName = z5.string().min(1).max(40).describe("Account name");
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1131
|
+
var zSignDigestsGovRuleData = z5.object({
|
|
1132
|
+
operationType: z5.literal("SIGN_DIGESTS"),
|
|
1133
|
+
reviewSteps: zReviewStepWithUsersArray
|
|
1134
|
+
// we need to control for API users only
|
|
1135
|
+
}).describe("Digest signing rule");
|
|
1136
|
+
var zAccountPolicyRequestData = z5.union([
|
|
1137
|
+
z5.object({ policyId: z5.string() }).describe("Account policy"),
|
|
1138
|
+
z5.object({ rules: z5.array(zClassicGovRuleData) }).describe("Account governance rules")
|
|
1107
1139
|
]).describe("Account policy or governance rules");
|
|
1108
1140
|
var zCreateAccountGovernanceData = z5.discriminatedUnion("type", [
|
|
1109
1141
|
z5.object({
|
|
@@ -1114,13 +1146,15 @@ var zCreateAccountGovernanceData = z5.discriminatedUnion("type", [
|
|
|
1114
1146
|
type: z5.literal(AccountGovernanceType.TRADELINK),
|
|
1115
1147
|
assetManagerId: z5.string(),
|
|
1116
1148
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1149
|
+
}),
|
|
1150
|
+
z5.object({
|
|
1151
|
+
type: z5.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1152
|
+
policy: z5.object({ rules: z5.array(zSignDigestsGovRuleData) })
|
|
1117
1153
|
})
|
|
1118
1154
|
]);
|
|
1119
1155
|
var zCreateAccountUserInputData = z5.object({
|
|
1120
1156
|
name: zAccountName,
|
|
1121
|
-
|
|
1122
|
-
// "BITCOIN_LIKE"
|
|
1123
|
-
currency: zCurrency2,
|
|
1157
|
+
currency: zCurrency,
|
|
1124
1158
|
// "bitcoin"
|
|
1125
1159
|
index: z5.number().nonnegative().optional().describe("Account index"),
|
|
1126
1160
|
contractAddress: z5.string().min(1).optional().describe("Account contract address"),
|
|
@@ -1128,7 +1162,9 @@ var zCreateAccountUserInputData = z5.object({
|
|
|
1128
1162
|
});
|
|
1129
1163
|
var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }).extend({
|
|
1130
1164
|
index: z5.number().nonnegative().describe("Account index"),
|
|
1131
|
-
derivationPath: z5.string().describe("Account bip44 derivation path")
|
|
1165
|
+
derivationPath: z5.string().describe("Account bip44 derivation path"),
|
|
1166
|
+
type: z5.nativeEnum(AccountType)
|
|
1167
|
+
// "BITCOIN_LIKE"
|
|
1132
1168
|
});
|
|
1133
1169
|
var zEditAccountGovernanceData = z5.discriminatedUnion("type", [
|
|
1134
1170
|
z5.object({
|
|
@@ -1138,6 +1174,10 @@ var zEditAccountGovernanceData = z5.discriminatedUnion("type", [
|
|
|
1138
1174
|
z5.object({
|
|
1139
1175
|
type: z5.literal(AccountGovernanceType.TRADELINK),
|
|
1140
1176
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1177
|
+
}),
|
|
1178
|
+
z5.object({
|
|
1179
|
+
type: z5.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1180
|
+
policy: z5.object({ rules: z5.array(zSignDigestsGovRuleData) })
|
|
1141
1181
|
})
|
|
1142
1182
|
]);
|
|
1143
1183
|
var zEditAccountRequestData = z5.object({
|
|
@@ -1148,7 +1188,7 @@ var zActivateAccountRequestData = z5.object({});
|
|
|
1148
1188
|
var zEditTokenRuleRequestData = z5.object({
|
|
1149
1189
|
parentAccountId: z5.string().min(1).describe("Parent account unique ID"),
|
|
1150
1190
|
contractAddress: z5.string().min(1).describe("Token contract address"),
|
|
1151
|
-
rules: z5.array(
|
|
1191
|
+
rules: z5.array(zClassicGovRuleData).describe("Account governance rules")
|
|
1152
1192
|
});
|
|
1153
1193
|
|
|
1154
1194
|
// src/accounts/app-utils.ts
|
|
@@ -1204,6 +1244,7 @@ var getAccountAssetStaticFields = (account) => {
|
|
|
1204
1244
|
address: account.address
|
|
1205
1245
|
};
|
|
1206
1246
|
case AccountType.GENERIC_LIKE:
|
|
1247
|
+
case AccountType.RAW_SIGNING:
|
|
1207
1248
|
return {
|
|
1208
1249
|
type: account.type
|
|
1209
1250
|
};
|
|
@@ -1215,6 +1256,7 @@ var getAccountAssetStaticFields = (account) => {
|
|
|
1215
1256
|
var getAccountGovernanceFields = (account) => {
|
|
1216
1257
|
switch (account.governanceType) {
|
|
1217
1258
|
case AccountGovernanceType.CLASSIC:
|
|
1259
|
+
case AccountGovernanceType.RAW_SIGNING:
|
|
1218
1260
|
return {
|
|
1219
1261
|
type: AccountGovernanceType.CLASSIC,
|
|
1220
1262
|
policyId: account.classicGovernanceMixin.policyId
|
|
@@ -1243,11 +1285,6 @@ var serializeAccount = (account) => {
|
|
|
1243
1285
|
};
|
|
1244
1286
|
return zAccountResponse.parse(response);
|
|
1245
1287
|
};
|
|
1246
|
-
var zRequestReviewStep = z.object({
|
|
1247
|
-
stageName: z.string().regex(/^\w+$/).describe("The review stage name"),
|
|
1248
|
-
quorum: z.number().int().min(1).describe("Quorum for the review step")
|
|
1249
|
-
});
|
|
1250
|
-
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1251
1288
|
var zSciConfigData = z5.object({
|
|
1252
1289
|
dapps: z5.array(z5.string()).nullable().describe("Allowed DApps, null allows all"),
|
|
1253
1290
|
customContractCallEnabled: z5.boolean().describe("Allow non-DApp SCI")
|
|
@@ -1259,16 +1296,11 @@ var zCreateSciConfigRequestData = z5.object({
|
|
|
1259
1296
|
var zEditSciConfigRequestData = z5.object({
|
|
1260
1297
|
config: zSciConfigData
|
|
1261
1298
|
});
|
|
1262
|
-
var
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
description: z5.string().nullable().describe("Group description"),
|
|
1266
|
-
members: z5.array(z5.string()).describe("List of group members ids")
|
|
1267
|
-
});
|
|
1268
|
-
var zEditGroupRequestData = z5.object({
|
|
1269
|
-
name: zGroupName,
|
|
1270
|
-
members: z5.array(z5.string()).describe("List of group members ids")
|
|
1299
|
+
var zRequestReviewStep = z.object({
|
|
1300
|
+
stageName: z.string().regex(/^\w+$/).describe("The review stage name"),
|
|
1301
|
+
quorum: z.number().int().min(1).describe("Quorum for the review step")
|
|
1271
1302
|
});
|
|
1303
|
+
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1272
1304
|
var zUserName = z.string().min(1).max(19).describe("User name");
|
|
1273
1305
|
var zUserRegistrationCreateInput = z.object({
|
|
1274
1306
|
name: zUserName,
|
|
@@ -1279,7 +1311,8 @@ var zUserRegistrationCreateInput = z.object({
|
|
|
1279
1311
|
zUserRegistrationCreateInput.extend({
|
|
1280
1312
|
id: z.string().describe("User registration ID"),
|
|
1281
1313
|
workspaceName: z.string().describe("Workspace name"),
|
|
1282
|
-
state: z.nativeEnum(UserRegistrationState).describe("User registration state")
|
|
1314
|
+
state: z.nativeEnum(UserRegistrationState).describe("User registration state"),
|
|
1315
|
+
isLocked: z.boolean().describe("Whether the registration is locked by a request")
|
|
1283
1316
|
});
|
|
1284
1317
|
|
|
1285
1318
|
// src/users/request-data.ts
|
|
@@ -1288,36 +1321,27 @@ var zCreatePsdUserRequestData = z5.object({
|
|
|
1288
1321
|
});
|
|
1289
1322
|
var zCreateApiUserRequestData = z5.object({
|
|
1290
1323
|
name: zUserName,
|
|
1291
|
-
|
|
1324
|
+
pubKey: z5.string().describe("Public key"),
|
|
1325
|
+
role: z5.enum(["ADMIN", "OPERATOR"]).describe("User role"),
|
|
1326
|
+
viewAll: z5.boolean().describe("View all data").default(false).optional()
|
|
1292
1327
|
}).describe("Create API user request data");
|
|
1293
1328
|
var zCreateApiUserAccessRequestData = z5.object({
|
|
1294
1329
|
name: zUserName
|
|
1295
|
-
}).describe("Create API user request data");
|
|
1296
|
-
|
|
1297
|
-
z5.
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
z5.
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
var zCreateUserWithDeviceData = z5.object({
|
|
1311
|
-
name: zUserName2,
|
|
1312
|
-
deviceType: z5.enum([UserDeviceType.PSD, UserDeviceType.SOFT_PSD]).describe("Device type"),
|
|
1313
|
-
deviceUserId: z5.string().regex(/^[A-F0-9]{16}$/).describe("Device user ID"),
|
|
1314
|
-
registration: zRegistration.optional().describe("Data collected from the new user during registration")
|
|
1315
|
-
}).describe("Create PSD or Soft PSD user request data");
|
|
1316
|
-
var zCreateAdminRequestData = zCreateUserWithDeviceData.extend({
|
|
1317
|
-
deviceType: z5.literal(UserDeviceType.PSD).describe("Device type")
|
|
1318
|
-
// Admin must use PSD
|
|
1319
|
-
});
|
|
1320
|
-
var zCreateOperatorRequestData = zCreateUserWithDeviceData;
|
|
1330
|
+
}).describe("Create API user credential request data");
|
|
1331
|
+
z5.object({
|
|
1332
|
+
authUserId: z5.string().describe("Authentication broker ID")
|
|
1333
|
+
}).describe("Managed data for API user");
|
|
1334
|
+
var zGroupName = z5.string().min(1).max(19).describe("Group name");
|
|
1335
|
+
var zCreateGroupRequestData = z5.object({
|
|
1336
|
+
name: zGroupName,
|
|
1337
|
+
description: z5.string().nullable().describe("Group description"),
|
|
1338
|
+
members: z5.array(z5.string()).describe("List of group members ids")
|
|
1339
|
+
});
|
|
1340
|
+
var zEditGroupRequestData = z5.object({
|
|
1341
|
+
name: zGroupName,
|
|
1342
|
+
description: z5.string().nullable().describe("Group description"),
|
|
1343
|
+
members: z5.array(z5.string()).describe("List of group members ids")
|
|
1344
|
+
});
|
|
1321
1345
|
var zApiKeyName = z5.string().min(1).max(19).describe("API key name");
|
|
1322
1346
|
var zCreateApiKeyRequestData = z5.object({
|
|
1323
1347
|
name: zApiKeyName,
|
|
@@ -1341,9 +1365,6 @@ var zWorkspaceRuleRequestData = z5.object({
|
|
|
1341
1365
|
permission: z5.nativeEnum(NonRootAdminPermission).describe("Granted permissions"),
|
|
1342
1366
|
reviewConfig: zReviewStepWithUsersArray.describe("List of admin review steps")
|
|
1343
1367
|
});
|
|
1344
|
-
var zUpdateQuorumRequestData = z5.object({
|
|
1345
|
-
quorum: z5.number().int().min(1).describe("Workspace quorum")
|
|
1346
|
-
});
|
|
1347
1368
|
|
|
1348
1369
|
// src/requests/request-data.ts
|
|
1349
1370
|
var zVaultRequestMixinsByType = {
|
|
@@ -1476,12 +1497,12 @@ var zVaultRequestMixinsByType = {
|
|
|
1476
1497
|
// Policies
|
|
1477
1498
|
[RequestType.CREATE_POLICY]: z5.object({
|
|
1478
1499
|
type: z5.literal(RequestType.CREATE_POLICY),
|
|
1479
|
-
data:
|
|
1500
|
+
data: zCreatePublicPolicyRequestData
|
|
1480
1501
|
}),
|
|
1481
1502
|
[RequestType.EDIT_POLICY]: z5.object({
|
|
1482
1503
|
type: z5.literal(RequestType.EDIT_POLICY),
|
|
1483
1504
|
targetId: z5.string(),
|
|
1484
|
-
data:
|
|
1505
|
+
data: zEditPublicPolicyRequestData
|
|
1485
1506
|
}),
|
|
1486
1507
|
// Tradelink
|
|
1487
1508
|
[RequestType.CREATE_TRADELINK_CUSTODIAN]: z5.object({
|
|
@@ -1515,6 +1536,10 @@ var zVaultRequestMixinsByType = {
|
|
|
1515
1536
|
type: z5.literal(RequestType.ADJUST_PLEDGE),
|
|
1516
1537
|
data: zAdjustPledgeRequestData
|
|
1517
1538
|
}),
|
|
1539
|
+
[RequestType.TRADELINK_REPLEDGE]: z5.object({
|
|
1540
|
+
type: z5.literal(RequestType.TRADELINK_REPLEDGE),
|
|
1541
|
+
data: zRepledgeRequestData
|
|
1542
|
+
}),
|
|
1518
1543
|
[RequestType.CREATE_SETTLEMENT]: z5.object({
|
|
1519
1544
|
type: z5.literal(RequestType.CREATE_SETTLEMENT),
|
|
1520
1545
|
data: zCreateSettlementRequestData,
|
|
@@ -1533,24 +1558,12 @@ var zVaultRequestMixinsByType = {
|
|
|
1533
1558
|
hash: z5.string().nullable()
|
|
1534
1559
|
}).optional().nullable()
|
|
1535
1560
|
}),
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
type: z5.literal(RequestType.EDIT_ADMIN_GOV_RULE),
|
|
1543
|
-
data: z5.object({}).describe("Deprecated")
|
|
1544
|
-
})
|
|
1545
|
-
};
|
|
1546
|
-
var zVaultRequestMixinsByLegacyType = {
|
|
1547
|
-
CREATE_ADMIN: z5.object({
|
|
1548
|
-
type: z5.literal(RequestType.CREATE_ADMIN),
|
|
1549
|
-
data: zCreateAdminRequestData
|
|
1550
|
-
}),
|
|
1551
|
-
CREATE_OPERATOR: z5.object({
|
|
1552
|
-
type: z5.literal(RequestType.CREATE_OPERATOR),
|
|
1553
|
-
data: zCreateOperatorRequestData
|
|
1561
|
+
[RequestType.TRADELINK_ARBITRATE]: z5.object({
|
|
1562
|
+
type: z5.literal(RequestType.TRADELINK_ARBITRATE),
|
|
1563
|
+
data: zTradelinkArbitrationRequestData,
|
|
1564
|
+
meta: z5.object({
|
|
1565
|
+
hash: z5.string().nullable()
|
|
1566
|
+
}).optional().nullable()
|
|
1554
1567
|
})
|
|
1555
1568
|
};
|
|
1556
1569
|
|
|
@@ -1584,8 +1597,11 @@ var zVaultRequestCommonMixin = z5.object({
|
|
|
1584
1597
|
}).optional().describe("Extra information if the request is currently being processed")
|
|
1585
1598
|
});
|
|
1586
1599
|
var allowedRequestCreationInput = {
|
|
1600
|
+
[RequestType.UPDATE_QUORUM]: zVaultRequestMixinsByType[RequestType.UPDATE_QUORUM],
|
|
1587
1601
|
[RequestType.CREATE_PSD_USER]: zVaultRequestMixinsByType[RequestType.CREATE_PSD_USER],
|
|
1602
|
+
[RequestType.CREATE_API_USER]: zVaultRequestMixinsByType[RequestType.CREATE_API_USER],
|
|
1588
1603
|
[RequestType.CREATE_GROUP]: zVaultRequestMixinsByType[RequestType.CREATE_GROUP],
|
|
1604
|
+
[RequestType.EDIT_GROUP]: zVaultRequestMixinsByType[RequestType.EDIT_GROUP],
|
|
1589
1605
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
1590
1606
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
1591
1607
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
@@ -1604,9 +1620,11 @@ var allowedRequestCreationInput = {
|
|
|
1604
1620
|
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]: zVaultRequestMixinsByType[RequestType.CREATE_TRADELINK_ASSET_MANAGER],
|
|
1605
1621
|
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]: zVaultRequestMixinsByType[RequestType.EDIT_TRADELINK_ASSET_MANAGER],
|
|
1606
1622
|
[RequestType.ADJUST_PLEDGE]: zVaultRequestMixinsByType[RequestType.ADJUST_PLEDGE],
|
|
1623
|
+
[RequestType.TRADELINK_REPLEDGE]: zVaultRequestMixinsByType[RequestType.TRADELINK_REPLEDGE],
|
|
1607
1624
|
[RequestType.FORCE_UNPLEDGE]: zVaultRequestMixinsByType[RequestType.FORCE_UNPLEDGE],
|
|
1608
1625
|
[RequestType.CREATE_SETTLEMENT]: zVaultRequestMixinsByType[RequestType.CREATE_SETTLEMENT],
|
|
1609
|
-
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW]
|
|
1626
|
+
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW],
|
|
1627
|
+
[RequestType.TRADELINK_ARBITRATE]: zVaultRequestMixinsByType[RequestType.TRADELINK_ARBITRATE]
|
|
1610
1628
|
};
|
|
1611
1629
|
z5.object({
|
|
1612
1630
|
request: z5.discriminatedUnion(
|
|
@@ -1622,7 +1640,7 @@ z5.object({
|
|
|
1622
1640
|
var zVaultRequestResponse = z5.discriminatedUnion(
|
|
1623
1641
|
"type",
|
|
1624
1642
|
ensureNonEmptyArray(
|
|
1625
|
-
Object.values(
|
|
1643
|
+
Object.values(zVaultRequestMixinsByType).map((_) => {
|
|
1626
1644
|
const requestType = _.shape.type._def.value;
|
|
1627
1645
|
return _.merge(zVaultRequestCommonMixin).describe(`${requestType} request`);
|
|
1628
1646
|
})
|
|
@@ -1650,22 +1668,13 @@ var shouldHaveTargetHsmId = (request) => {
|
|
|
1650
1668
|
case RequestType.REVOKE_API_KEY:
|
|
1651
1669
|
case RequestType.CREATE_WORKSPACE_RULE:
|
|
1652
1670
|
case RequestType.EDIT_WORKSPACE_RULE:
|
|
1671
|
+
case RequestType.UPDATE_QUORUM:
|
|
1653
1672
|
return false;
|
|
1654
|
-
case RequestType.CREATE_ADMIN:
|
|
1655
|
-
case RequestType.CREATE_OPERATOR:
|
|
1656
|
-
if (request.state === RequestState.INITIAL || request.state === RequestState.PENDING_REGISTRATION) {
|
|
1657
|
-
return false;
|
|
1658
|
-
}
|
|
1659
|
-
if (request.state === RequestState.ABORTED || request.state === RequestState.BLOCKED || request.state === RequestState.EXPIRED) {
|
|
1660
|
-
return void 0;
|
|
1661
|
-
}
|
|
1662
|
-
return true;
|
|
1663
1673
|
case RequestType.CREATE_PSD_USER:
|
|
1664
1674
|
case RequestType.CREATE_API_USER:
|
|
1665
1675
|
case RequestType.CREATE_API_USER_ACCESS:
|
|
1666
1676
|
// targeting / editing an existing `User`
|
|
1667
1677
|
case RequestType.REVOKE_USER:
|
|
1668
|
-
case RequestType.UPDATE_QUORUM:
|
|
1669
1678
|
case RequestType.CREATE_TRANSACTION:
|
|
1670
1679
|
case RequestType.SIGN_MESSAGE:
|
|
1671
1680
|
case RequestType.SIGN_DIGESTS:
|
|
@@ -1688,10 +1697,6 @@ var shouldHaveTargetHsmId = (request) => {
|
|
|
1688
1697
|
return request.state !== RequestState.INITIAL;
|
|
1689
1698
|
case RequestType.EDIT_TOKEN_RULE:
|
|
1690
1699
|
return true;
|
|
1691
|
-
/* v8 ignore start */
|
|
1692
|
-
case RequestType.CREATE_ADMIN_GOV_RULE:
|
|
1693
|
-
case RequestType.EDIT_ADMIN_GOV_RULE:
|
|
1694
|
-
throw new Error(`Admin gov rules requests are deprecated`);
|
|
1695
1700
|
}
|
|
1696
1701
|
};
|
|
1697
1702
|
var shouldHaveTargetId = (request) => {
|
|
@@ -1704,9 +1709,8 @@ var shouldHaveTargetId = (request) => {
|
|
|
1704
1709
|
case RequestType.SIGN_MESSAGE:
|
|
1705
1710
|
case RequestType.SIGN_DIGESTS:
|
|
1706
1711
|
return false;
|
|
1712
|
+
case RequestType.UPDATE_QUORUM:
|
|
1707
1713
|
case RequestType.CREATE_PSD_USER:
|
|
1708
|
-
case RequestType.CREATE_ADMIN:
|
|
1709
|
-
case RequestType.CREATE_OPERATOR:
|
|
1710
1714
|
case RequestType.CREATE_API_USER:
|
|
1711
1715
|
case RequestType.CREATE_WORKSPACE_RULE:
|
|
1712
1716
|
case RequestType.CREATE_ACCOUNT:
|
|
@@ -1719,7 +1723,6 @@ var shouldHaveTargetId = (request) => {
|
|
|
1719
1723
|
case RequestType.CREATE_TRADELINK_EXCHANGE:
|
|
1720
1724
|
case RequestType.CREATE_TRADELINK_ASSET_MANAGER:
|
|
1721
1725
|
return request.state === RequestState.EXECUTED;
|
|
1722
|
-
case RequestType.UPDATE_QUORUM:
|
|
1723
1726
|
case RequestType.EDIT_WORKSPACE_RULE:
|
|
1724
1727
|
case RequestType.EDIT_ACCOUNT:
|
|
1725
1728
|
case RequestType.ACTIVATE_TRADELINK_ACCOUNT:
|
|
@@ -1738,14 +1741,12 @@ var shouldHaveTargetId = (request) => {
|
|
|
1738
1741
|
case RequestType.EDIT_TRADELINK_EXCHANGE:
|
|
1739
1742
|
case RequestType.EDIT_TRADELINK_ASSET_MANAGER:
|
|
1740
1743
|
case RequestType.ADJUST_PLEDGE:
|
|
1744
|
+
case RequestType.TRADELINK_REPLEDGE:
|
|
1741
1745
|
case RequestType.CREATE_SETTLEMENT:
|
|
1742
1746
|
case RequestType.FORCE_UNPLEDGE:
|
|
1743
1747
|
case RequestType.TRADELINK_WITHDRAW:
|
|
1748
|
+
case RequestType.TRADELINK_ARBITRATE:
|
|
1744
1749
|
return true;
|
|
1745
|
-
/* v8 ignore start */
|
|
1746
|
-
case RequestType.CREATE_ADMIN_GOV_RULE:
|
|
1747
|
-
case RequestType.EDIT_ADMIN_GOV_RULE:
|
|
1748
|
-
throw new Error(`Admin gov rules requests are deprecated`);
|
|
1749
1750
|
}
|
|
1750
1751
|
};
|
|
1751
1752
|
|
|
@@ -1758,6 +1759,7 @@ function serializeVaultRequest(request) {
|
|
|
1758
1759
|
switch (request.type) {
|
|
1759
1760
|
case "CREATE_TRANSACTION":
|
|
1760
1761
|
case "TRADELINK_WITHDRAW":
|
|
1762
|
+
case "TRADELINK_ARBITRATE":
|
|
1761
1763
|
case "CREATE_SETTLEMENT":
|
|
1762
1764
|
Object.assign(serialized, {
|
|
1763
1765
|
meta: {
|
|
@@ -1920,6 +1922,17 @@ var genAssetFieldsForType = (type) => {
|
|
|
1920
1922
|
hsmXpub,
|
|
1921
1923
|
hsmChainCode
|
|
1922
1924
|
};
|
|
1925
|
+
case "RAW_SIGNING":
|
|
1926
|
+
return {
|
|
1927
|
+
type,
|
|
1928
|
+
currency: faker.helpers.arrayElement(["ethereum", "bitcoin"]),
|
|
1929
|
+
derivationPath: "44'/118'/0'",
|
|
1930
|
+
address: null,
|
|
1931
|
+
contractAddress: null,
|
|
1932
|
+
xpub: null,
|
|
1933
|
+
hsmXpub,
|
|
1934
|
+
hsmChainCode
|
|
1935
|
+
};
|
|
1923
1936
|
}
|
|
1924
1937
|
};
|
|
1925
1938
|
var genGovernanceFieldsForType = (governanceType, {
|
|
@@ -1929,6 +1942,7 @@ var genGovernanceFieldsForType = (governanceType, {
|
|
|
1929
1942
|
}) => {
|
|
1930
1943
|
switch (governanceType) {
|
|
1931
1944
|
case AccountGovernanceType.CLASSIC:
|
|
1945
|
+
case AccountGovernanceType.RAW_SIGNING:
|
|
1932
1946
|
return {
|
|
1933
1947
|
governanceType,
|
|
1934
1948
|
classicGovernanceMixin: {
|
|
@@ -1983,7 +1997,7 @@ var genAccount = (opts) => {
|
|
|
1983
1997
|
var genRequestReviewSteps = (numSteps) => times(1, () => ({ stageName: "default", quorum: 2 }));
|
|
1984
1998
|
var genVaultRequest = (opts) => {
|
|
1985
1999
|
const { type, state = RequestState.PENDING_APPROVAL, data, ...custom } = opts;
|
|
1986
|
-
const targetHsmId = shouldHaveTargetHsmId({ type, state }) ? fakeHsmObjectId() : null;
|
|
2000
|
+
const targetHsmId = shouldHaveTargetHsmId({ type, state }) ? type === RequestType.CREATE_PSD_USER ? fakePubKey() : fakeHsmObjectId() : null;
|
|
1987
2001
|
const targetId = shouldHaveTargetId({ type, state }) ? faker.string.uuid() : null;
|
|
1988
2002
|
return injectSyncId({
|
|
1989
2003
|
id: faker.string.uuid(),
|
|
@@ -2075,6 +2089,7 @@ var stakingFieldsByAccountType = {
|
|
|
2075
2089
|
}
|
|
2076
2090
|
}),
|
|
2077
2091
|
GENERIC_LIKE: () => null,
|
|
2092
|
+
RAW_SIGNING: () => null,
|
|
2078
2093
|
POLKADOT_LIKE: () => ({
|
|
2079
2094
|
type: "POLKADOT_LIKE",
|
|
2080
2095
|
staking: {
|