@ledgerhq/revault-api 1.23.1 → 1.28.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-DRwjhbZ9.d.mts} +8738 -7150
- package/lib/fakes.d.mts +707 -806
- package/lib/fakes.mjs +648 -659
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +3893 -3219
- package/package.json +5 -5
package/lib/fakes.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
|
-
import
|
|
3
|
-
import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, ActivationStatus, WhitelistType,
|
|
2
|
+
import z32, { z } from 'zod';
|
|
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';
|
|
@@ -34,9 +34,10 @@ var ensureNonEmptyArray = (values, message) => {
|
|
|
34
34
|
function unreachable(value) {
|
|
35
35
|
throw new Error(`Un-covered: ${value}`);
|
|
36
36
|
}
|
|
37
|
-
var zBigInt = z.string().regex(/^0|[1-9]\d*$/);
|
|
38
|
-
var zIntString = z.string().min(1).regex(/^-?\d+$/);
|
|
39
37
|
var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
|
|
38
|
+
var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
|
|
39
|
+
var zUnsignedIntString = z.string().nonempty().regex(/^([1-9]\d*|0)$/);
|
|
40
|
+
var zCurrency = z.string().nonempty().max(40).regex(/^\w+$/).describe("Currency");
|
|
40
41
|
|
|
41
42
|
// src/hsm/types.ts
|
|
42
43
|
var zHsmObjectId = z.string().regex(/^[\w-]+$/).min(1);
|
|
@@ -88,7 +89,7 @@ z.object({
|
|
|
88
89
|
stageName: z.string(),
|
|
89
90
|
steps: zHsmChallengeSteps
|
|
90
91
|
});
|
|
91
|
-
|
|
92
|
+
z.object({
|
|
92
93
|
name: z.string().describe("Name of the user to register"),
|
|
93
94
|
psdModel: z.nativeEnum(PsdModel).describe("Device model"),
|
|
94
95
|
pubKey: zPubKey.describe("Device public key"),
|
|
@@ -96,7 +97,7 @@ var zUserRegistrationDeviceData = z.object({
|
|
|
96
97
|
psdEphemeralKey: zPubKey,
|
|
97
98
|
psdEphemeralKeyAttestation: zHsmCertificate
|
|
98
99
|
}).describe("Data generated by the PSD to register on HSM");
|
|
99
|
-
|
|
100
|
+
z.object({
|
|
100
101
|
challenge: z.string(),
|
|
101
102
|
ephemeralPublicKey: zPubKey,
|
|
102
103
|
ephemeralPublicKeyAttestation: zHsmCertificate,
|
|
@@ -145,8 +146,8 @@ var zHsmSignature = z.object({
|
|
|
145
146
|
),
|
|
146
147
|
pubkey: zHexString.nullable().describe("Public key for signature verification, 32 or 33 bytes")
|
|
147
148
|
});
|
|
148
|
-
var zBitcoinLikeTransactionType =
|
|
149
|
-
var zCardanoLikeTransactionType =
|
|
149
|
+
var zBitcoinLikeTransactionType = z32.enum(["BITCOIN_LIKE_SEND", "BITCOIN_LIKE_RECEIVE"]).describe("Bitcoin-like transaction type");
|
|
150
|
+
var zCardanoLikeTransactionType = z32.enum([
|
|
150
151
|
"CARDANO_LIKE_SEND",
|
|
151
152
|
"CARDANO_LIKE_RECEIVE",
|
|
152
153
|
"CARDANO_LIKE_STAKING_REGISTER",
|
|
@@ -154,9 +155,9 @@ var zCardanoLikeTransactionType = z5.enum([
|
|
|
154
155
|
"CARDANO_LIKE_STAKING_DELEGATE",
|
|
155
156
|
"CARDANO_LIKE_STAKING_WITHDRAW"
|
|
156
157
|
]).describe("Cardano-like transaction type");
|
|
157
|
-
var zEthereumLikeTransferTransactionType =
|
|
158
|
-
var zEthereumLikeContractTransactionType =
|
|
159
|
-
var zPolkadotLikeTransactionType =
|
|
158
|
+
var zEthereumLikeTransferTransactionType = z32.enum(["ETHEREUM_LIKE_SEND", "ETHEREUM_LIKE_RECEIVE"]).describe("Ethereum-like transaction type");
|
|
159
|
+
var zEthereumLikeContractTransactionType = z32.enum(["ETHEREUM_LIKE_EXECUTE_CONTRACT", "ETHEREUM_LIKE_DEPLOY_CONTRACT"]).describe("Ethereum-like transaction type");
|
|
160
|
+
var zPolkadotLikeTransactionType = z32.enum([
|
|
160
161
|
"POLKADOT_LIKE_SEND",
|
|
161
162
|
"POLKADOT_LIKE_RECEIVE",
|
|
162
163
|
"POLKADOT_LIKE_ADDPROXY",
|
|
@@ -178,8 +179,8 @@ var zPolkadotLikeTransactionType = z5.enum([
|
|
|
178
179
|
"POLKADOT_LIKE_CHILL",
|
|
179
180
|
"POLKADOT_LIKE_TRANSFERALL"
|
|
180
181
|
]).describe("Polkadot-like transaction type");
|
|
181
|
-
var zRippleLikeTransactionType =
|
|
182
|
-
var zSolanaLikeTransactionType =
|
|
182
|
+
var zRippleLikeTransactionType = z32.enum(["RIPPLE_LIKE_SEND", "RIPPLE_LIKE_RECEIVE"]).describe("Ripple-like transaction type");
|
|
183
|
+
var zSolanaLikeTransactionType = z32.enum([
|
|
183
184
|
"SOLANA_LIKE_SEND",
|
|
184
185
|
"SOLANA_LIKE_RECEIVE",
|
|
185
186
|
"SOLANA_LIKE_CREATE_DELEGATE_STAKE",
|
|
@@ -192,16 +193,16 @@ var zSolanaLikeTransactionType = z5.enum([
|
|
|
192
193
|
"SOLANA_LIKE_SEND_TOKEN",
|
|
193
194
|
"SOLANA_LIKE_FUND_TOKEN"
|
|
194
195
|
]).describe("Solana-like transaction type");
|
|
195
|
-
var zStellarLikeTransactionType =
|
|
196
|
-
var zTezosLikeTransactionType =
|
|
196
|
+
var zStellarLikeTransactionType = z32.enum(["STELLAR_LIKE_SEND", "STELLAR_LIKE_RECEIVE"]).describe("Stellar-like transaction type");
|
|
197
|
+
var zTezosLikeTransactionType = z32.enum([
|
|
197
198
|
"TEZOS_LIKE_SEND",
|
|
198
199
|
"TEZOS_LIKE_RECEIVE",
|
|
199
200
|
"TEZOS_LIKE_REVEAL",
|
|
200
201
|
"TEZOS_LIKE_DELEGATE",
|
|
201
202
|
"TEZOS_LIKE_UNDELEGATE"
|
|
202
203
|
]).describe("Tezos-like transaction type");
|
|
203
|
-
var zGenericTransactionType =
|
|
204
|
-
|
|
204
|
+
var zGenericTransactionType = z32.enum(["GENERIC_TRANSACTION"]).describe("Generic transaction type");
|
|
205
|
+
z32.union([
|
|
205
206
|
zBitcoinLikeTransactionType,
|
|
206
207
|
zCardanoLikeTransactionType,
|
|
207
208
|
zEthereumLikeTransferTransactionType,
|
|
@@ -215,267 +216,270 @@ z5.union([
|
|
|
215
216
|
]);
|
|
216
217
|
|
|
217
218
|
// src/transactions/request-data.ts
|
|
218
|
-
var zHexDataString =
|
|
219
|
+
var zHexDataString = z32.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/).transform((hex) => `0x${hex.toLowerCase().replace("0x", "")}`);
|
|
219
220
|
if ("openapi" in zHexDataString) {
|
|
220
221
|
zHexDataString = zHexDataString.openapi?.({ effectType: "same" });
|
|
221
222
|
}
|
|
222
|
-
var zCommonTransactionData =
|
|
223
|
-
amount:
|
|
224
|
-
currency:
|
|
223
|
+
var zCommonTransactionData = z32.object({
|
|
224
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
225
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
225
226
|
// TODO: strict literal or enum?
|
|
226
|
-
maxFee:
|
|
227
|
-
recipient:
|
|
227
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
228
|
+
recipient: z32.string().describe("Transaction recipient")
|
|
228
229
|
});
|
|
229
|
-
var zFeeStrategyCustom =
|
|
230
|
-
type:
|
|
230
|
+
var zFeeStrategyCustom = z32.object({
|
|
231
|
+
type: z32.enum(["SLOW", "NORMAL", "FAST", "CUSTOM"])
|
|
231
232
|
});
|
|
232
|
-
var zFeeStrategy =
|
|
233
|
-
type:
|
|
233
|
+
var zFeeStrategy = z32.object({
|
|
234
|
+
type: z32.enum(["SLOW", "NORMAL", "FAST"])
|
|
234
235
|
});
|
|
235
236
|
var zBitcoinLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
236
237
|
// nullish is optional + nullable, it is easier to seed rather than just optional
|
|
237
|
-
feePerByte:
|
|
238
|
+
feePerByte: zUnsignedIntString.nullish().describe("Fee per byte")
|
|
238
239
|
}).describe("Bitcoin-like fee strategy");
|
|
239
240
|
var zBitcoinLikeSendData = zCommonTransactionData.extend({
|
|
240
|
-
type:
|
|
241
|
+
type: z32.literal(zBitcoinLikeTransactionType.enum.BITCOIN_LIKE_SEND),
|
|
241
242
|
feeStrategy: zBitcoinLikeFeeStrategy
|
|
242
243
|
}).describe("Bitcoin-like send data");
|
|
243
|
-
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
244
|
+
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
245
|
+
gasPrice: zUnsignedIntString.describe("Gas price"),
|
|
246
|
+
gasLimit: zUnsignedIntString.describe("Gas limit")
|
|
247
|
+
}).describe("Ethereum-like legacy fee strategy");
|
|
244
248
|
var zEthereumLikeEip1559FeeStrategy = zFeeStrategyCustom.extend({
|
|
245
|
-
maxPriorityFeePerGas:
|
|
246
|
-
maxFeePerGas:
|
|
247
|
-
gasLimit:
|
|
249
|
+
maxPriorityFeePerGas: zUnsignedIntString.describe("Maximum priority fee per gas"),
|
|
250
|
+
maxFeePerGas: zUnsignedIntString.describe("Maximum fee per gas (base + priority)"),
|
|
251
|
+
gasLimit: zUnsignedIntString.describe("Gas limit")
|
|
248
252
|
}).describe("Ethereum-like EIP-1559 fee strategy");
|
|
249
|
-
var zEthereumLikeFeeStrategy =
|
|
253
|
+
var zEthereumLikeFeeStrategy = z32.union([zEthereumLikeLegacyFeeStrategy, zEthereumLikeEip1559FeeStrategy]).describe("Ethereum-like fee strategy");
|
|
250
254
|
var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
251
|
-
type:
|
|
255
|
+
type: z32.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_DEPLOY_CONTRACT),
|
|
252
256
|
// force the recipient to be the zero address
|
|
253
|
-
recipient:
|
|
257
|
+
recipient: z32.literal("0x0000000000000000000000000000000000000000"),
|
|
254
258
|
contractData: zHexDataString.describe("Contract data in hexadecimal format"),
|
|
255
259
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
256
260
|
}).describe("Ethereum-like deploy contract data");
|
|
257
261
|
var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
258
|
-
type:
|
|
262
|
+
type: z32.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_EXECUTE_CONTRACT),
|
|
259
263
|
contractData: zHexDataString.describe("Contract call data in hexadecimal format"),
|
|
260
264
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
261
265
|
}).describe("Ethereum-like execute contract data");
|
|
262
266
|
var zEthereumLikeSendData = zCommonTransactionData.extend({
|
|
263
|
-
type:
|
|
267
|
+
type: z32.literal(zEthereumLikeTransferTransactionType.enum.ETHEREUM_LIKE_SEND),
|
|
264
268
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
265
269
|
}).describe("Ethereum-like send data");
|
|
266
270
|
var zTezosLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
267
|
-
gasLimit:
|
|
268
|
-
storageLimit:
|
|
271
|
+
gasLimit: zUnsignedIntString.describe("Gas limit"),
|
|
272
|
+
storageLimit: zUnsignedIntString.nullable().describe("Storage limit")
|
|
269
273
|
}).describe("Tezos-like fee strategy");
|
|
270
274
|
var zTezosLikeDelegateData = zCommonTransactionData.extend({
|
|
271
|
-
type:
|
|
275
|
+
type: z32.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_DELEGATE),
|
|
272
276
|
feeStrategy: zTezosLikeFeeStrategy
|
|
273
277
|
}).describe("Tezos-like delegate data");
|
|
274
278
|
var zTezosLikeSendData = zCommonTransactionData.extend({
|
|
275
|
-
type:
|
|
279
|
+
type: z32.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_SEND),
|
|
276
280
|
feeStrategy: zTezosLikeFeeStrategy
|
|
277
281
|
}).describe("Tezos-like send data");
|
|
278
282
|
var zTezosLikeUndelegateData = zCommonTransactionData.extend({
|
|
279
|
-
type:
|
|
283
|
+
type: z32.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_UNDELEGATE),
|
|
280
284
|
feeStrategy: zTezosLikeFeeStrategy
|
|
281
285
|
}).describe("Tezos-like undelegate data");
|
|
282
|
-
var zPolkadotRewardDestination =
|
|
283
|
-
var zPolkadotLikeAddProxyData =
|
|
284
|
-
type:
|
|
285
|
-
currency:
|
|
286
|
-
kind:
|
|
287
|
-
proxy:
|
|
286
|
+
var zPolkadotRewardDestination = z32.enum(["Staked", "Stash"]);
|
|
287
|
+
var zPolkadotLikeAddProxyData = z32.object({
|
|
288
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ADDPROXY),
|
|
289
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
290
|
+
kind: z32.literal("Staking").describe("Proxy kind"),
|
|
291
|
+
proxy: z32.string().describe("Proxy address")
|
|
288
292
|
}).describe("Polkadot-like add proxy data");
|
|
289
|
-
var zPolkadotLikeAnonymousProxyData =
|
|
290
|
-
type:
|
|
291
|
-
currency:
|
|
293
|
+
var zPolkadotLikeAnonymousProxyData = z32.object({
|
|
294
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ANONYMOUSPROXY),
|
|
295
|
+
currency: zCurrency.describe("Transaction currency")
|
|
292
296
|
}).describe("Polkadot-like anonymous proxy data");
|
|
293
|
-
var zPolkadotLikeBondData =
|
|
294
|
-
type:
|
|
295
|
-
currency:
|
|
297
|
+
var zPolkadotLikeBondData = z32.object({
|
|
298
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BOND),
|
|
299
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
296
300
|
payee: zPolkadotRewardDestination,
|
|
297
|
-
amount:
|
|
301
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
298
302
|
}).describe("Polkadot-like bond data");
|
|
299
|
-
var zPolkadotLikeBondExtraData =
|
|
300
|
-
type:
|
|
301
|
-
currency:
|
|
302
|
-
amount:
|
|
303
|
+
var zPolkadotLikeBondExtraData = z32.object({
|
|
304
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BONDEXTRA),
|
|
305
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
306
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
303
307
|
}).describe("Polkadot-like bond extra data");
|
|
304
|
-
var zPolkadotLikeChillData =
|
|
305
|
-
type:
|
|
306
|
-
currency:
|
|
308
|
+
var zPolkadotLikeChillData = z32.object({
|
|
309
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_CHILL),
|
|
310
|
+
currency: zCurrency.describe("Transaction currency")
|
|
307
311
|
}).describe("Polkadot-like chill data");
|
|
308
|
-
var zPolkadotLikeKillAnonymousData =
|
|
309
|
-
type:
|
|
310
|
-
currency:
|
|
312
|
+
var zPolkadotLikeKillAnonymousData = z32.object({
|
|
313
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_KILLANONYMOUS),
|
|
314
|
+
currency: zCurrency.describe("Transaction currency")
|
|
311
315
|
}).describe("Polkadot-like kill anonymous data");
|
|
312
|
-
var zPolkadotLikeRebondData =
|
|
313
|
-
type:
|
|
314
|
-
currency:
|
|
315
|
-
amount:
|
|
316
|
+
var zPolkadotLikeRebondData = z32.object({
|
|
317
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REBOND),
|
|
318
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
319
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
316
320
|
}).describe("Polkadot-like rebond data");
|
|
317
|
-
var zPolkadotLikeRemoveProxyData =
|
|
318
|
-
type:
|
|
319
|
-
currency:
|
|
320
|
-
kind:
|
|
321
|
-
proxy:
|
|
321
|
+
var zPolkadotLikeRemoveProxyData = z32.object({
|
|
322
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REMOVEPROXY),
|
|
323
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
324
|
+
kind: z32.literal("Staking"),
|
|
325
|
+
proxy: z32.string().describe("Proxy address")
|
|
322
326
|
}).describe("Polkadot-like remove proxy data");
|
|
323
327
|
var zPolkadotLikeSendData = zCommonTransactionData.extend({
|
|
324
|
-
type:
|
|
328
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SEND)
|
|
325
329
|
}).describe("Polkadot-like send data");
|
|
326
|
-
var zPolkadotLikeSetPayeeData =
|
|
327
|
-
type:
|
|
328
|
-
currency:
|
|
330
|
+
var zPolkadotLikeSetPayeeData = z32.object({
|
|
331
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SETPAYEE),
|
|
332
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
329
333
|
payee: zPolkadotRewardDestination
|
|
330
334
|
}).describe("Polkadot-like set payee data");
|
|
331
|
-
var zPolkadotLikeUnbondData =
|
|
332
|
-
type:
|
|
333
|
-
currency:
|
|
334
|
-
amount:
|
|
335
|
+
var zPolkadotLikeUnbondData = z32.object({
|
|
336
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_UNBOND),
|
|
337
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
338
|
+
amount: zUnsignedIntString.describe("Amount")
|
|
335
339
|
}).describe("Polkadot-like unbond data");
|
|
336
|
-
var zPolkadotLikeWithdrawUnbondedData =
|
|
337
|
-
type:
|
|
338
|
-
currency:
|
|
340
|
+
var zPolkadotLikeWithdrawUnbondedData = z32.object({
|
|
341
|
+
type: z32.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_WITHDRAWUNBONDED),
|
|
342
|
+
currency: zCurrency.describe("Transaction currency")
|
|
339
343
|
}).describe("Polkadot-like withdraw unbonded data");
|
|
340
344
|
var zRippleLikeSendData = zCommonTransactionData.extend({
|
|
341
|
-
type:
|
|
345
|
+
type: z32.literal(zRippleLikeTransactionType.enum.RIPPLE_LIKE_SEND),
|
|
342
346
|
destinationTag: zIntString.nullable().describe("Destination tag"),
|
|
343
347
|
feeStrategy: zFeeStrategyCustom.describe("Ripple-like fee strategy")
|
|
344
348
|
}).describe("Ripple-like send data");
|
|
345
|
-
var zStellarMemo =
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
MEMO_HASH:
|
|
349
|
+
var zStellarMemo = z32.union([
|
|
350
|
+
z32.object({ MEMO_TEXT: z32.string().max(28).describe("Text memo (at most a 28 bytes string)") }).describe("Text memo"),
|
|
351
|
+
z32.object({ MEMO_ID: zIntString.describe("Id memo (unsigned 64 bits integer)") }).describe("Id memo"),
|
|
352
|
+
z32.object({
|
|
353
|
+
MEMO_HASH: z32.string().max(128).regex(/^[a-fA-F0-9]+$/).describe("Transaction hash memo (64 bytes hexadecimal string)")
|
|
350
354
|
}).describe("Hash memo"),
|
|
351
|
-
|
|
352
|
-
MEMO_RETURN:
|
|
355
|
+
z32.object({
|
|
356
|
+
MEMO_RETURN: z32.string().max(128).regex(/^[a-fA-F0-9]+$/).describe(
|
|
353
357
|
"A 64 bytes hexadecimal string intended to be interpreted as the hash of the transaction the sender is refunding."
|
|
354
358
|
)
|
|
355
359
|
}).describe("Return memo")
|
|
356
360
|
]);
|
|
357
361
|
var zStellarLikeSendData = zCommonTransactionData.extend({
|
|
358
|
-
type:
|
|
362
|
+
type: z32.literal(zStellarLikeTransactionType.enum.STELLAR_LIKE_SEND),
|
|
359
363
|
memo: zStellarMemo.nullable().describe("Stellar memo"),
|
|
360
364
|
feeStrategy: zFeeStrategy.describe("Stellar-like fee strategy")
|
|
361
365
|
}).describe("Stellar-like send data");
|
|
362
366
|
var zSolanaLikeCreateDelegateStakeData = zCommonTransactionData.extend({
|
|
363
|
-
type:
|
|
364
|
-
recipient:
|
|
367
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_DELEGATE_STAKE),
|
|
368
|
+
recipient: z32.string().describe("Delegated vote address"),
|
|
365
369
|
// Re-described
|
|
366
370
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
367
371
|
}).describe("Solana-like create delegate stake data");
|
|
368
|
-
var zSolanaLikeDeactivateStakeData =
|
|
369
|
-
type:
|
|
370
|
-
currency:
|
|
371
|
-
maxFee:
|
|
372
|
-
stakeAccount:
|
|
372
|
+
var zSolanaLikeDeactivateStakeData = z32.object({
|
|
373
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DEACTIVATE_STAKE),
|
|
374
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
375
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
376
|
+
stakeAccount: z32.string().describe("Stake account address"),
|
|
373
377
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
374
378
|
// No recipient, no amount
|
|
375
379
|
}).describe("Solana-like deactivate stake data");
|
|
376
|
-
var zSolanaLikeDelegateStakeData =
|
|
377
|
-
type:
|
|
378
|
-
currency:
|
|
379
|
-
maxFee:
|
|
380
|
-
recipient:
|
|
381
|
-
stakeAccount:
|
|
380
|
+
var zSolanaLikeDelegateStakeData = z32.object({
|
|
381
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DELEGATE_STAKE),
|
|
382
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
383
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
384
|
+
recipient: z32.string().describe("Delegated vote address"),
|
|
385
|
+
stakeAccount: z32.string().describe("Stake account address"),
|
|
382
386
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
383
387
|
// No amount
|
|
384
388
|
}).describe("Solana-like delegate stake data");
|
|
385
|
-
var zSolanaLikeMergeStakeData =
|
|
386
|
-
type:
|
|
387
|
-
currency:
|
|
388
|
-
maxFee:
|
|
389
|
-
mergeSrcAccount:
|
|
390
|
-
mergeDstAccount:
|
|
389
|
+
var zSolanaLikeMergeStakeData = z32.object({
|
|
390
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_MERGE_STAKE),
|
|
391
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
392
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
393
|
+
mergeSrcAccount: z32.string().describe("Source stake address"),
|
|
394
|
+
mergeDstAccount: z32.string().describe("Destination stake address"),
|
|
391
395
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
392
396
|
// No recipient, no amount
|
|
393
397
|
}).describe("Solana-like merge stake data");
|
|
394
398
|
var zSolanaLikeSendData = zCommonTransactionData.extend({
|
|
395
|
-
type:
|
|
399
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND),
|
|
396
400
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
397
401
|
}).describe("Solana-like send data");
|
|
398
|
-
var zSolanaLikeSplitDeactivateStakeData =
|
|
399
|
-
type:
|
|
400
|
-
amount:
|
|
401
|
-
currency:
|
|
402
|
-
maxFee:
|
|
403
|
-
stakeAccount:
|
|
402
|
+
var zSolanaLikeSplitDeactivateStakeData = z32.object({
|
|
403
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE),
|
|
404
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
405
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
406
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
407
|
+
stakeAccount: z32.string().describe("Stake account address"),
|
|
404
408
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
405
409
|
// No recipient
|
|
406
410
|
}).describe("Solana-like split deactivate stake data");
|
|
407
|
-
var zSolanaLikeSplitStakeData =
|
|
408
|
-
type:
|
|
409
|
-
amount:
|
|
410
|
-
currency:
|
|
411
|
-
maxFee:
|
|
412
|
-
stakeAccount:
|
|
411
|
+
var zSolanaLikeSplitStakeData = z32.object({
|
|
412
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_STAKE),
|
|
413
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
414
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
415
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
416
|
+
stakeAccount: z32.string().describe("Stake account address"),
|
|
413
417
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
414
418
|
// No recipient
|
|
415
419
|
}).describe("Solana-like split stake data");
|
|
416
|
-
var zSolanaLikeWithdrawStakeData =
|
|
417
|
-
type:
|
|
418
|
-
amount:
|
|
419
|
-
currency:
|
|
420
|
-
maxFee:
|
|
421
|
-
stakeAccount:
|
|
420
|
+
var zSolanaLikeWithdrawStakeData = z32.object({
|
|
421
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_WITHDRAW_STAKE),
|
|
422
|
+
amount: zUnsignedIntString.describe("Transaction amount"),
|
|
423
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
424
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
425
|
+
stakeAccount: z32.string().describe("Stake account address"),
|
|
422
426
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
423
427
|
// No recipient
|
|
424
428
|
}).describe("Solana-like delegate stake data");
|
|
425
429
|
var zSolanaLikeSendTokenData = zCommonTransactionData.extend({
|
|
426
|
-
type:
|
|
430
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND_TOKEN),
|
|
427
431
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
428
432
|
}).describe("Solana-like send token data");
|
|
429
433
|
var zSolanaLikeFundTokenData = zCommonTransactionData.extend({
|
|
430
|
-
type:
|
|
434
|
+
type: z32.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_FUND_TOKEN),
|
|
431
435
|
feeStrategy: zFeeStrategy.describe("Solana-like fee strategy")
|
|
432
436
|
}).describe("Solana-like fund token data");
|
|
433
437
|
var zCardanoSendData = zCommonTransactionData.extend({
|
|
434
|
-
type:
|
|
438
|
+
type: z32.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_SEND),
|
|
435
439
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy")
|
|
436
440
|
}).describe("Cardano-like send data");
|
|
437
|
-
var zCardanoStakingDelegateData =
|
|
438
|
-
type:
|
|
439
|
-
currency:
|
|
441
|
+
var zCardanoStakingDelegateData = z32.object({
|
|
442
|
+
type: z32.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DELEGATE),
|
|
443
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
440
444
|
// TODO: strict literal or enum?
|
|
441
|
-
maxFee:
|
|
445
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
442
446
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
443
447
|
// DELEGATE doesn't have neither amount nor recipient
|
|
444
|
-
stakePoolId:
|
|
448
|
+
stakePoolId: z32.string().min(1).max(100).describe("")
|
|
445
449
|
}).describe("Cardano-like staking delegate");
|
|
446
|
-
var zCardanoStakingDeregisterData =
|
|
447
|
-
type:
|
|
448
|
-
currency:
|
|
450
|
+
var zCardanoStakingDeregisterData = z32.object({
|
|
451
|
+
type: z32.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DEREGISTER),
|
|
452
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
449
453
|
// TODO: strict literal or enum?
|
|
450
|
-
maxFee:
|
|
454
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
451
455
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
452
456
|
// DEREGISTER doesn't have a recipient
|
|
453
|
-
amount:
|
|
457
|
+
amount: zUnsignedIntString.describe("Amount to deregister")
|
|
454
458
|
}).describe("Cardano-like staking deregister data");
|
|
455
|
-
var zCardanoStakingRegisterData =
|
|
456
|
-
type:
|
|
457
|
-
currency:
|
|
459
|
+
var zCardanoStakingRegisterData = z32.object({
|
|
460
|
+
type: z32.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
461
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
458
462
|
// TODO: strict literal or enum?
|
|
459
|
-
maxFee:
|
|
463
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
460
464
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
461
465
|
// REGISTER doesn't have a recipient
|
|
462
|
-
amount:
|
|
466
|
+
amount: zUnsignedIntString.describe("Amount to register")
|
|
463
467
|
}).describe("Cardano-like staking register data");
|
|
464
|
-
var zCardanoStakingWithdrawData =
|
|
465
|
-
type:
|
|
466
|
-
currency:
|
|
468
|
+
var zCardanoStakingWithdrawData = z32.object({
|
|
469
|
+
type: z32.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_WITHDRAW),
|
|
470
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
467
471
|
// TODO: strict literal or enum?
|
|
468
|
-
maxFee:
|
|
472
|
+
maxFee: zUnsignedIntString.nullable().describe("Transaction max fee"),
|
|
469
473
|
feeStrategy: zFeeStrategy.describe("Cardano-like fee strategy"),
|
|
470
474
|
// WITHDRAW doesn't have a recipient
|
|
471
|
-
amount:
|
|
475
|
+
amount: zUnsignedIntString.describe("Amount to withdraw")
|
|
472
476
|
}).describe("Cardano-like staking withdraw data");
|
|
473
|
-
var zGenericTransactionData =
|
|
474
|
-
type:
|
|
475
|
-
currency:
|
|
476
|
-
rawTx:
|
|
477
|
+
var zGenericTransactionData = z32.object({
|
|
478
|
+
type: z32.literal(zGenericTransactionType.enum.GENERIC_TRANSACTION),
|
|
479
|
+
currency: zCurrency.describe("Transaction currency"),
|
|
480
|
+
rawTx: z32.string().describe("Raw tx")
|
|
477
481
|
}).describe("Generic transaction data");
|
|
478
|
-
var zTransactionData =
|
|
482
|
+
var zTransactionData = z32.discriminatedUnion("type", [
|
|
479
483
|
// Bitcoin
|
|
480
484
|
zBitcoinLikeSendData,
|
|
481
485
|
// Cardano
|
|
@@ -523,7 +527,7 @@ var zTransactionData = z5.discriminatedUnion("type", [
|
|
|
523
527
|
zTezosLikeSendData,
|
|
524
528
|
zTezosLikeUndelegateData
|
|
525
529
|
]);
|
|
526
|
-
var zSendOnlyTransactionData =
|
|
530
|
+
var zSendOnlyTransactionData = z32.discriminatedUnion("type", [
|
|
527
531
|
zBitcoinLikeSendData,
|
|
528
532
|
zCardanoSendData,
|
|
529
533
|
zEthereumLikeSendData,
|
|
@@ -533,28 +537,28 @@ var zSendOnlyTransactionData = z5.discriminatedUnion("type", [
|
|
|
533
537
|
zStellarLikeSendData,
|
|
534
538
|
zTezosLikeSendData
|
|
535
539
|
]);
|
|
536
|
-
var zCreateTransactionRequestData =
|
|
537
|
-
accountId:
|
|
540
|
+
var zCreateTransactionRequestData = z32.object({
|
|
541
|
+
accountId: z32.string().min(1).describe("Target account id"),
|
|
538
542
|
transaction: zTransactionData
|
|
539
543
|
});
|
|
540
|
-
var zSignMessageRequestData =
|
|
541
|
-
accountId:
|
|
542
|
-
message:
|
|
543
|
-
address:
|
|
544
|
+
var zSignMessageRequestData = z32.object({
|
|
545
|
+
accountId: z32.string().min(1).describe("Target account id"),
|
|
546
|
+
message: z32.string().nonempty().describe("Hex data to sign, either a json string for EIP712, or a raw string for EIP191"),
|
|
547
|
+
address: z32.string().nonempty().nullable().describe("Address for which to sign the message")
|
|
544
548
|
});
|
|
545
|
-
|
|
549
|
+
z32.object({
|
|
546
550
|
signature: zHsmSignature
|
|
547
551
|
});
|
|
548
|
-
var zDigestData =
|
|
552
|
+
var zDigestData = z32.object({
|
|
549
553
|
digest: zHexString.describe("The hex string digest to sign"),
|
|
550
|
-
derivationPath:
|
|
554
|
+
derivationPath: z32.string().nonempty().describe("The derivation path with which to sign the digest")
|
|
551
555
|
});
|
|
552
|
-
var zSignDigestsRequestData =
|
|
553
|
-
accountId:
|
|
554
|
-
digests:
|
|
556
|
+
var zSignDigestsRequestData = z32.object({
|
|
557
|
+
accountId: z32.string().min(1).describe("Target account id"),
|
|
558
|
+
digests: z32.array(zDigestData).describe("The digests to sign")
|
|
555
559
|
});
|
|
556
|
-
|
|
557
|
-
signatures:
|
|
560
|
+
z32.object({
|
|
561
|
+
signatures: z32.array(zHsmSignature)
|
|
558
562
|
});
|
|
559
563
|
var zAccountOperationType = z.enum([
|
|
560
564
|
"SEND",
|
|
@@ -566,62 +570,62 @@ var zAccountOperationType = z.enum([
|
|
|
566
570
|
"ACTIVATE_TOKEN"
|
|
567
571
|
]);
|
|
568
572
|
var zOperationType = z.enum([...zAccountOperationType.options]);
|
|
569
|
-
var zNote =
|
|
570
|
-
title:
|
|
571
|
-
content:
|
|
573
|
+
var zNote = z32.object({
|
|
574
|
+
title: z32.string().describe("Request note title"),
|
|
575
|
+
content: z32.string().describe("Request note content")
|
|
572
576
|
});
|
|
573
577
|
|
|
574
578
|
// src/accounts/clients/types.ts
|
|
575
|
-
var zTransactionStatus =
|
|
576
|
-
var zBitcoinLikeCoinFields =
|
|
579
|
+
var zTransactionStatus = z32.enum(["SUCCESSFUL", "FAILED"]);
|
|
580
|
+
var zBitcoinLikeCoinFields = z32.object({
|
|
577
581
|
type: zBitcoinLikeTransactionType
|
|
578
582
|
});
|
|
579
|
-
var zCardanoLikeCoinFields =
|
|
583
|
+
var zCardanoLikeCoinFields = z32.object({
|
|
580
584
|
type: zCardanoLikeTransactionType
|
|
581
585
|
});
|
|
582
|
-
var zEthereumLikeTransferCoinFields =
|
|
586
|
+
var zEthereumLikeTransferCoinFields = z32.object({
|
|
583
587
|
type: zEthereumLikeTransferTransactionType,
|
|
584
|
-
gasPrice:
|
|
585
|
-
gasLimit:
|
|
586
|
-
nonce:
|
|
588
|
+
gasPrice: z32.string(),
|
|
589
|
+
gasLimit: z32.string(),
|
|
590
|
+
nonce: z32.string()
|
|
587
591
|
});
|
|
588
592
|
var zEthereumLikeContractCoinFields = zEthereumLikeTransferCoinFields.extend({
|
|
589
593
|
type: zEthereumLikeContractTransactionType,
|
|
590
|
-
contractData:
|
|
594
|
+
contractData: z32.string().describe("Contract deployment or contract execution data")
|
|
591
595
|
});
|
|
592
|
-
var zGenericCoinFields =
|
|
596
|
+
var zGenericCoinFields = z32.object({
|
|
593
597
|
type: zGenericTransactionType
|
|
594
598
|
});
|
|
595
|
-
var zPolkadotLikeCoinFields =
|
|
599
|
+
var zPolkadotLikeCoinFields = z32.object({
|
|
596
600
|
type: zPolkadotLikeTransactionType
|
|
597
601
|
});
|
|
598
|
-
var zRippleLikeCoinFields =
|
|
602
|
+
var zRippleLikeCoinFields = z32.object({
|
|
599
603
|
type: zRippleLikeTransactionType,
|
|
600
|
-
memos:
|
|
601
|
-
destinationTag:
|
|
604
|
+
memos: z32.array(z32.string()),
|
|
605
|
+
destinationTag: z32.string()
|
|
602
606
|
});
|
|
603
|
-
var zSolanaLikeCoinFields =
|
|
607
|
+
var zSolanaLikeCoinFields = z32.object({
|
|
604
608
|
type: zSolanaLikeTransactionType
|
|
605
609
|
});
|
|
606
|
-
var zStellarLikeCoinFields =
|
|
610
|
+
var zStellarLikeCoinFields = z32.object({
|
|
607
611
|
type: zStellarLikeTransactionType
|
|
608
612
|
});
|
|
609
|
-
var zTezosLikeCoinFields =
|
|
613
|
+
var zTezosLikeCoinFields = z32.object({
|
|
610
614
|
type: zTezosLikeTransactionType
|
|
611
615
|
});
|
|
612
|
-
var zCommonTransactionResponse =
|
|
613
|
-
id:
|
|
614
|
-
hash:
|
|
615
|
-
block:
|
|
616
|
-
height:
|
|
617
|
-
time:
|
|
616
|
+
var zCommonTransactionResponse = z32.object({
|
|
617
|
+
id: z32.string().describe("Internal unique identifier"),
|
|
618
|
+
hash: z32.string().describe("Transaction hash"),
|
|
619
|
+
block: z32.object({
|
|
620
|
+
height: z32.string().nullable().describe("Transaction block height"),
|
|
621
|
+
time: z32.string().nullable().describe("Transaction block time")
|
|
618
622
|
}),
|
|
619
623
|
status: zTransactionStatus.describe("Transaction status"),
|
|
620
|
-
confirmations:
|
|
621
|
-
amount:
|
|
622
|
-
fee:
|
|
623
|
-
senders:
|
|
624
|
-
recipients:
|
|
624
|
+
confirmations: z32.string().describe("Block confirmations"),
|
|
625
|
+
amount: z32.string().describe("Transaction amount"),
|
|
626
|
+
fee: z32.string().describe("Transaction fee"),
|
|
627
|
+
senders: z32.array(z32.string()).describe("Senders (can be multiple for UTXOs-based accounts)"),
|
|
628
|
+
recipients: z32.array(z32.string()).describe("Recipients (can be multiple for multi-output transactions)")
|
|
625
629
|
});
|
|
626
630
|
var zBitcoinLikeTransactionResponse = zCommonTransactionResponse.merge(zBitcoinLikeCoinFields).describe("Bitcoin-like transaction");
|
|
627
631
|
var zCardanoLikeTransactionResponse = zCommonTransactionResponse.merge(zCardanoLikeCoinFields).describe("Cardano-like transaction");
|
|
@@ -633,7 +637,7 @@ var zRippleLikeTransactionResponse = zCommonTransactionResponse.merge(zRippleLik
|
|
|
633
637
|
var zSolanaLikeTransactionResponse = zCommonTransactionResponse.merge(zSolanaLikeCoinFields).describe("Solana-like transaction");
|
|
634
638
|
var zStellarLikeTransactionResponse = zCommonTransactionResponse.merge(zStellarLikeCoinFields).describe("Stellar-like transaction");
|
|
635
639
|
var zTezosLikeTransactionResponse = zCommonTransactionResponse.merge(zTezosLikeCoinFields).describe("Tezos-like transaction");
|
|
636
|
-
var zTransactionResponse =
|
|
640
|
+
var zTransactionResponse = z32.discriminatedUnion("type", [
|
|
637
641
|
zBitcoinLikeTransactionResponse,
|
|
638
642
|
zCardanoLikeTransactionResponse,
|
|
639
643
|
zEthereumLikeTransferTransactionResponse,
|
|
@@ -645,123 +649,123 @@ var zTransactionResponse = z5.discriminatedUnion("type", [
|
|
|
645
649
|
zStellarLikeTransactionResponse,
|
|
646
650
|
zTezosLikeTransactionResponse
|
|
647
651
|
]);
|
|
648
|
-
|
|
652
|
+
z32.discriminatedUnion(
|
|
649
653
|
zTransactionResponse.discriminator,
|
|
650
654
|
ensureNonEmptyArray(
|
|
651
655
|
zTransactionResponse.options.map((_) => _.extend({ note: zNote.nullable() }))
|
|
652
656
|
)
|
|
653
657
|
);
|
|
654
|
-
var zCardanoLikeStakingData =
|
|
655
|
-
staked:
|
|
658
|
+
var zCardanoLikeStakingData = z32.object({
|
|
659
|
+
staked: z32.string().describe("Staked balance")
|
|
656
660
|
}).nullable().describe("Cardano-like staking data");
|
|
657
|
-
var zCardanoLikeStakingFields =
|
|
658
|
-
type:
|
|
661
|
+
var zCardanoLikeStakingFields = z32.object({
|
|
662
|
+
type: z32.literal(AccountType.CARDANO_LIKE).describe("Account type"),
|
|
659
663
|
staking: zCardanoLikeStakingData.optional()
|
|
660
664
|
});
|
|
661
|
-
var zEthereumLikeStakingData =
|
|
662
|
-
totalStaking:
|
|
663
|
-
totalRewards:
|
|
664
|
-
availableRewards:
|
|
665
|
-
networkApy:
|
|
665
|
+
var zEthereumLikeStakingData = z32.object({
|
|
666
|
+
totalStaking: z32.string().describe("Total staked amount"),
|
|
667
|
+
totalRewards: z32.string().describe("Total of rewards"),
|
|
668
|
+
availableRewards: z32.string().describe("Available rewards"),
|
|
669
|
+
networkApy: z32.number().describe("Network APY")
|
|
666
670
|
}).nullable().describe("Ethereum-like staking data");
|
|
667
|
-
var zEthereumLikeStakingFields =
|
|
668
|
-
type:
|
|
671
|
+
var zEthereumLikeStakingFields = z32.object({
|
|
672
|
+
type: z32.literal(AccountType.ETHEREUM_LIKE).describe("Account type"),
|
|
669
673
|
staking: zEthereumLikeStakingData.optional()
|
|
670
674
|
});
|
|
671
|
-
var zPolkadotUnbondingAmount =
|
|
672
|
-
amount:
|
|
673
|
-
waiting_time:
|
|
674
|
-
});
|
|
675
|
-
var zPolkadotLikeStakingData =
|
|
676
|
-
info:
|
|
677
|
-
controllerAddress:
|
|
678
|
-
rewardsDestination:
|
|
679
|
-
proxies:
|
|
680
|
-
legacyStaking:
|
|
681
|
-
isNominator:
|
|
675
|
+
var zPolkadotUnbondingAmount = z32.object({
|
|
676
|
+
amount: z32.string().describe("Amount"),
|
|
677
|
+
waiting_time: z32.string().describe("Waiting time")
|
|
678
|
+
});
|
|
679
|
+
var zPolkadotLikeStakingData = z32.object({
|
|
680
|
+
info: z32.object({
|
|
681
|
+
controllerAddress: z32.string().nullable().describe("Controller address"),
|
|
682
|
+
rewardsDestination: z32.string().nullable().describe("Rewards destination"),
|
|
683
|
+
proxies: z32.array(z32.string()).describe("Proxies"),
|
|
684
|
+
legacyStaking: z32.boolean().describe("True if account uses legacy staking"),
|
|
685
|
+
isNominator: z32.boolean().describe("True if is nominator")
|
|
682
686
|
}),
|
|
683
|
-
balances:
|
|
684
|
-
free:
|
|
685
|
-
reserved:
|
|
686
|
-
frozen:
|
|
687
|
-
bonded:
|
|
688
|
-
available:
|
|
689
|
-
unbonding:
|
|
690
|
-
unbonded:
|
|
691
|
-
totalUnbonding:
|
|
692
|
-
totalUnbonded:
|
|
687
|
+
balances: z32.object({
|
|
688
|
+
free: z32.string().describe("Free balance"),
|
|
689
|
+
reserved: z32.string().describe("Reserved balance"),
|
|
690
|
+
frozen: z32.string().describe("Frozen balance"),
|
|
691
|
+
bonded: z32.string().describe("Bonded balance"),
|
|
692
|
+
available: z32.string().describe("Available balance"),
|
|
693
|
+
unbonding: z32.array(zPolkadotUnbondingAmount).describe("Unbonding balances"),
|
|
694
|
+
unbonded: z32.array(zPolkadotUnbondingAmount).describe("Unbonded balances"),
|
|
695
|
+
totalUnbonding: z32.string().describe("Total unbonding"),
|
|
696
|
+
totalUnbonded: z32.string().describe("Total unbonded")
|
|
693
697
|
}),
|
|
694
|
-
anonymousProxy:
|
|
695
|
-
address:
|
|
696
|
-
createdAt:
|
|
697
|
-
isController:
|
|
698
|
-
isMain:
|
|
699
|
-
balances:
|
|
700
|
-
free:
|
|
701
|
-
reserved:
|
|
702
|
-
frozen:
|
|
703
|
-
bonded:
|
|
704
|
-
available:
|
|
705
|
-
total:
|
|
698
|
+
anonymousProxy: z32.object({
|
|
699
|
+
address: z32.string().describe("Address"),
|
|
700
|
+
createdAt: z32.string().describe("Creation date"),
|
|
701
|
+
isController: z32.boolean().describe("True if is controller"),
|
|
702
|
+
isMain: z32.boolean().describe("True if is main"),
|
|
703
|
+
balances: z32.object({
|
|
704
|
+
free: z32.string().describe("Anonymous proxy free balance"),
|
|
705
|
+
reserved: z32.string().describe("Anonymous proxy reserved balance"),
|
|
706
|
+
frozen: z32.string().describe("Anonymous proxy frozen balance"),
|
|
707
|
+
bonded: z32.string().describe("Anonymous proxy bonded balance"),
|
|
708
|
+
available: z32.string().describe("Anonymous proxy available balance"),
|
|
709
|
+
total: z32.string().describe("Anonymous proxy total balance")
|
|
706
710
|
}).nullable(),
|
|
707
|
-
blockHeight:
|
|
708
|
-
extIndex:
|
|
709
|
-
index:
|
|
710
|
-
kind:
|
|
711
|
+
blockHeight: z32.string().describe("Anonymous proxy block height"),
|
|
712
|
+
extIndex: z32.string().describe("Ext index"),
|
|
713
|
+
index: z32.string().describe("Index"),
|
|
714
|
+
kind: z32.string().describe("Kind")
|
|
711
715
|
}).nullable().describe("Anonymous proxy")
|
|
712
716
|
}).nullable().describe("Polkadot-like staking data");
|
|
713
|
-
var zPolkadotLikeStakingFields =
|
|
714
|
-
type:
|
|
717
|
+
var zPolkadotLikeStakingFields = z32.object({
|
|
718
|
+
type: z32.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
715
719
|
staking: zPolkadotLikeStakingData.optional()
|
|
716
720
|
});
|
|
717
|
-
var zSolanaStakingAccountStatus =
|
|
718
|
-
var zSolanaLikeStakingData =
|
|
719
|
-
staked:
|
|
720
|
-
rewards:
|
|
721
|
-
total:
|
|
722
|
-
last7:
|
|
723
|
-
last30:
|
|
721
|
+
var zSolanaStakingAccountStatus = z32.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).describe("Staking account status");
|
|
722
|
+
var zSolanaLikeStakingData = z32.object({
|
|
723
|
+
staked: z32.string().describe("Staked balance"),
|
|
724
|
+
rewards: z32.object({
|
|
725
|
+
total: z32.string().describe("Total rewards"),
|
|
726
|
+
last7: z32.string().describe("Rewards on last 7 days"),
|
|
727
|
+
last30: z32.string().describe("Rewards on last 30 days")
|
|
724
728
|
}),
|
|
725
|
-
stakes:
|
|
726
|
-
|
|
727
|
-
uid:
|
|
728
|
-
baseAccountUid:
|
|
729
|
-
pubKey:
|
|
730
|
-
validatorPubKey:
|
|
731
|
-
initialAmount:
|
|
732
|
-
activeAmount:
|
|
733
|
-
inactiveAmount:
|
|
734
|
-
totalBalance:
|
|
735
|
-
creationDate:
|
|
736
|
-
activationEpoch:
|
|
737
|
-
activationDate:
|
|
738
|
-
deactivationEpoch:
|
|
739
|
-
deactivationDate:
|
|
729
|
+
stakes: z32.array(
|
|
730
|
+
z32.object({
|
|
731
|
+
uid: z32.string(),
|
|
732
|
+
baseAccountUid: z32.string(),
|
|
733
|
+
pubKey: z32.string().describe("Public key"),
|
|
734
|
+
validatorPubKey: z32.string().nullable().describe("Validator public key"),
|
|
735
|
+
initialAmount: z32.string().describe("Initial amount"),
|
|
736
|
+
activeAmount: z32.string().describe("Active amount"),
|
|
737
|
+
inactiveAmount: z32.string().describe("Inactive amount"),
|
|
738
|
+
totalBalance: z32.string().describe("Total balance"),
|
|
739
|
+
creationDate: z32.string().describe("Creation date"),
|
|
740
|
+
activationEpoch: z32.string().nullable().describe("Activation epoch"),
|
|
741
|
+
activationDate: z32.string().nullable().describe("Activation date"),
|
|
742
|
+
deactivationEpoch: z32.string().nullable().describe("Deactivation epoch"),
|
|
743
|
+
deactivationDate: z32.string().nullable().describe("Deactivation date"),
|
|
740
744
|
status: zSolanaStakingAccountStatus,
|
|
741
|
-
rentExemptReserve:
|
|
742
|
-
withdrawableAmount:
|
|
743
|
-
totalRewards:
|
|
744
|
-
creationTxHash:
|
|
745
|
-
actionsTxHashes:
|
|
745
|
+
rentExemptReserve: z32.string().describe("Rent exempt reserve"),
|
|
746
|
+
withdrawableAmount: z32.string().describe("Withdrawable amount"),
|
|
747
|
+
totalRewards: z32.string().describe("Total rewards"),
|
|
748
|
+
creationTxHash: z32.string().nullable().describe("Creation transaction hash"),
|
|
749
|
+
actionsTxHashes: z32.array(z32.string()).describe("Actions transactions hashes")
|
|
746
750
|
})
|
|
747
751
|
)
|
|
748
752
|
}).nullable().describe("Solana-like staking data");
|
|
749
|
-
var zSolanaLikeStakingFields =
|
|
750
|
-
type:
|
|
753
|
+
var zSolanaLikeStakingFields = z32.object({
|
|
754
|
+
type: z32.literal(AccountType.SOLANA_LIKE).describe("Account type"),
|
|
751
755
|
staking: zSolanaLikeStakingData.optional()
|
|
752
756
|
});
|
|
753
|
-
var zTezosLikeStakingData =
|
|
754
|
-
delegations:
|
|
755
|
-
|
|
756
|
-
address:
|
|
757
|
+
var zTezosLikeStakingData = z32.object({
|
|
758
|
+
delegations: z32.array(
|
|
759
|
+
z32.object({
|
|
760
|
+
address: z32.string()
|
|
757
761
|
})
|
|
758
762
|
)
|
|
759
763
|
}).nullable().describe("Tezos-like staking data");
|
|
760
|
-
var zTezosLikeStakingFields =
|
|
761
|
-
type:
|
|
764
|
+
var zTezosLikeStakingFields = z32.object({
|
|
765
|
+
type: z32.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
762
766
|
staking: zTezosLikeStakingData.optional()
|
|
763
767
|
});
|
|
764
|
-
|
|
768
|
+
z32.discriminatedUnion("type", [
|
|
765
769
|
zCardanoLikeStakingFields,
|
|
766
770
|
zEthereumLikeStakingFields,
|
|
767
771
|
zPolkadotLikeStakingFields,
|
|
@@ -848,57 +852,57 @@ var zReviewStepData = z.union([
|
|
|
848
852
|
}).describe("Review step with group")
|
|
849
853
|
]);
|
|
850
854
|
var zReviewStepsArray = z.array(zReviewStepData).min(1).describe("Review steps");
|
|
851
|
-
var zWorkspaceName =
|
|
855
|
+
var zWorkspaceName = z32.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
852
856
|
|
|
853
857
|
// src/tradelink/types.ts
|
|
854
|
-
var zTradelinkWhitelistAddress =
|
|
855
|
-
name:
|
|
856
|
-
currency:
|
|
857
|
-
address:
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
var zTradelinkId =
|
|
861
|
-
var zTradelinkOrgEntityResponse =
|
|
858
|
+
var zTradelinkWhitelistAddress = z32.object({
|
|
859
|
+
name: z32.string().min(1),
|
|
860
|
+
currency: zCurrency,
|
|
861
|
+
address: z32.string().min(1)
|
|
862
|
+
});
|
|
863
|
+
z32.array(zTradelinkWhitelistAddress);
|
|
864
|
+
var zTradelinkId = z32.string().describe("Unique identifier in Tradelink service");
|
|
865
|
+
var zTradelinkOrgEntityResponse = z32.object({
|
|
862
866
|
tradelinkId: zTradelinkId,
|
|
863
|
-
name:
|
|
864
|
-
code:
|
|
865
|
-
logoUrl:
|
|
867
|
+
name: z32.string().describe("Name"),
|
|
868
|
+
code: z32.string().describe("Code"),
|
|
869
|
+
logoUrl: z32.string().describe("Logo URL")
|
|
866
870
|
});
|
|
867
871
|
zTradelinkOrgEntityResponse.omit({
|
|
868
872
|
tradelinkId: true
|
|
869
873
|
});
|
|
870
|
-
|
|
874
|
+
z32.object({
|
|
871
875
|
tradelinkId: zTradelinkId
|
|
872
876
|
});
|
|
873
|
-
var zTradelinkExchangeConfig =
|
|
874
|
-
exchangeId:
|
|
875
|
-
repledgeAuthorized:
|
|
876
|
-
needsAssetManagerApprovalForSettlements:
|
|
877
|
+
var zTradelinkExchangeConfig = z32.object({
|
|
878
|
+
exchangeId: z32.string().describe("Tradelink exchange id"),
|
|
879
|
+
repledgeAuthorized: z32.boolean().describe("Determines whether this exchange is authorized to repledge on this account"),
|
|
880
|
+
needsAssetManagerApprovalForSettlements: z32.boolean().describe(
|
|
877
881
|
'Determines whether asset manager will "pre-approve" the settlement requests on this account'
|
|
878
882
|
)
|
|
879
883
|
});
|
|
880
|
-
var zTradelinkExchangeConfigs =
|
|
881
|
-
|
|
884
|
+
var zTradelinkExchangeConfigs = z32.array(zTradelinkExchangeConfig);
|
|
885
|
+
z32.object({
|
|
882
886
|
workspaceName: zWorkspaceName,
|
|
883
|
-
custodian:
|
|
884
|
-
assetManagers:
|
|
885
|
-
exchanges:
|
|
887
|
+
custodian: z32.object({ name: z32.string() }),
|
|
888
|
+
assetManagers: z32.array(z32.object({ name: z32.string() })),
|
|
889
|
+
exchanges: z32.array(z32.object({ name: z32.string() }))
|
|
886
890
|
});
|
|
887
|
-
|
|
888
|
-
tradelinkId:
|
|
891
|
+
z32.object({
|
|
892
|
+
tradelinkId: z32.string(),
|
|
889
893
|
workspaceName: zWorkspaceName,
|
|
890
894
|
custodian: zTradelinkOrgEntityResponse,
|
|
891
|
-
assetManagers:
|
|
892
|
-
exchanges:
|
|
895
|
+
assetManagers: z32.array(zTradelinkOrgEntityResponse),
|
|
896
|
+
exchanges: z32.array(zTradelinkOrgEntityResponse)
|
|
893
897
|
});
|
|
894
|
-
var zTradelinkAsset =
|
|
895
|
-
name:
|
|
896
|
-
magnitude:
|
|
898
|
+
var zTradelinkAsset = z32.object({
|
|
899
|
+
name: z32.string(),
|
|
900
|
+
magnitude: z32.number().int().nonnegative()
|
|
897
901
|
});
|
|
898
|
-
|
|
902
|
+
z32.object({
|
|
899
903
|
tradelinkId: zTradelinkId,
|
|
900
904
|
asset: zTradelinkAsset,
|
|
901
|
-
state:
|
|
905
|
+
state: z32.enum([
|
|
902
906
|
"PLEDGE_READY",
|
|
903
907
|
"PLEDGE_INCREMENT_PENDING_APPROVAL",
|
|
904
908
|
"PLEDGE_APPROVED",
|
|
@@ -915,28 +919,28 @@ z5.object({
|
|
|
915
919
|
"RECOVERING_FROM_FAILURE",
|
|
916
920
|
"PLEDGE_CONSUMED"
|
|
917
921
|
]),
|
|
918
|
-
isLocked:
|
|
919
|
-
amount:
|
|
920
|
-
pending:
|
|
921
|
-
repledge:
|
|
922
|
-
exchangeTradelinkId:
|
|
923
|
-
accountId:
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
workspaceName:
|
|
927
|
-
clientAccountId:
|
|
922
|
+
isLocked: z32.boolean(),
|
|
923
|
+
amount: z32.string().describe("Currently pledged amount"),
|
|
924
|
+
pending: z32.string().describe("Requested pledge increment, not yet approved"),
|
|
925
|
+
repledge: z32.string().describe("TODO: describe this field"),
|
|
926
|
+
exchangeTradelinkId: z32.string(),
|
|
927
|
+
accountId: z32.string()
|
|
928
|
+
});
|
|
929
|
+
z32.object({
|
|
930
|
+
workspaceName: z32.string(),
|
|
931
|
+
clientAccountId: z32.string().describe("Account ID from the client side"),
|
|
928
932
|
exchangeTradelinkId: zTradelinkId,
|
|
929
933
|
asset: zTradelinkAsset
|
|
930
934
|
});
|
|
931
|
-
|
|
935
|
+
z32.object({
|
|
932
936
|
pledgeTradelinkId: zTradelinkId,
|
|
933
|
-
amount:
|
|
937
|
+
amount: zUnsignedIntString,
|
|
934
938
|
asset: zTradelinkAsset
|
|
935
939
|
});
|
|
936
|
-
|
|
937
|
-
tradelinkId:
|
|
938
|
-
pledgeTradelinkId:
|
|
939
|
-
state:
|
|
940
|
+
z32.object({
|
|
941
|
+
tradelinkId: z32.string(),
|
|
942
|
+
pledgeTradelinkId: z32.string(),
|
|
943
|
+
state: z32.enum([
|
|
940
944
|
"REGISTERED",
|
|
941
945
|
"PENDING_REPLEDGE_CREATION_APPROVAL",
|
|
942
946
|
"PENDING_REPLEDGE_APPROVAL",
|
|
@@ -949,36 +953,45 @@ z5.object({
|
|
|
949
953
|
"FAILED"
|
|
950
954
|
]),
|
|
951
955
|
// For now we only consider the outbound settlement
|
|
952
|
-
outboundTransactionHash:
|
|
956
|
+
outboundTransactionHash: z32.string().nullable()
|
|
953
957
|
});
|
|
954
958
|
|
|
955
959
|
// src/tradelink/request-data.ts
|
|
956
|
-
var zCustodianRequestData =
|
|
960
|
+
var zCustodianRequestData = z32.object({
|
|
957
961
|
settlement: zReviewStepWithUsersArray.describe("List of settlement review steps"),
|
|
958
962
|
withdraw: zReviewStepWithUsersArray.describe("List of withdraw review steps"),
|
|
959
963
|
arbitration: zReviewStepWithUsersArray.describe("List of arbitration review steps")
|
|
960
964
|
});
|
|
961
|
-
var zTradelinkEntityRequestData =
|
|
962
|
-
tradelinkId:
|
|
965
|
+
var zTradelinkEntityRequestData = z32.object({
|
|
966
|
+
tradelinkId: z32.string().min(1),
|
|
963
967
|
groups: zReviewStepWithUsersArray.describe("List of asset manager review groups"),
|
|
964
|
-
whitelist:
|
|
968
|
+
whitelist: z32.array(zTradelinkWhitelistAddress).describe("List of asset manager whitelisted addresses")
|
|
969
|
+
});
|
|
970
|
+
var zAdjustPledgeRequestData = z32.object({
|
|
971
|
+
accountId: z32.string().describe("Account id"),
|
|
972
|
+
exchangeId: z32.string().describe("Exchange id"),
|
|
973
|
+
amount: zIntString.describe("Amount to add to pledge")
|
|
965
974
|
});
|
|
966
|
-
var
|
|
967
|
-
accountId:
|
|
968
|
-
exchangeId:
|
|
975
|
+
var zRepledgeRequestData = z32.object({
|
|
976
|
+
accountId: z32.string().describe("Account id"),
|
|
977
|
+
exchangeId: z32.string().describe("Exchange id"),
|
|
969
978
|
amount: zIntString.describe("Amount to add to pledge")
|
|
970
979
|
});
|
|
971
|
-
var zCreateSettlementRequestData =
|
|
972
|
-
accountId:
|
|
973
|
-
exchangeId:
|
|
980
|
+
var zCreateSettlementRequestData = z32.object({
|
|
981
|
+
accountId: z32.string().describe("Account id"),
|
|
982
|
+
exchangeId: z32.string().describe("Exchange id"),
|
|
974
983
|
transaction: zSendOnlyTransactionData
|
|
975
984
|
});
|
|
976
|
-
var zForceUnpledgeRequestData =
|
|
977
|
-
accountId:
|
|
978
|
-
exchangeId:
|
|
985
|
+
var zForceUnpledgeRequestData = z32.object({
|
|
986
|
+
accountId: z32.string().describe("Account id"),
|
|
987
|
+
exchangeId: z32.string().describe("Exchange id")
|
|
988
|
+
});
|
|
989
|
+
var zTradelinkWithdrawRequestData = z32.object({
|
|
990
|
+
accountId: z32.string().describe("Account id"),
|
|
991
|
+
transaction: zSendOnlyTransactionData
|
|
979
992
|
});
|
|
980
|
-
var
|
|
981
|
-
accountId:
|
|
993
|
+
var zTradelinkArbitrationRequestData = z32.object({
|
|
994
|
+
accountId: z32.string().describe("Account id"),
|
|
982
995
|
transaction: zSendOnlyTransactionData
|
|
983
996
|
});
|
|
984
997
|
|
|
@@ -995,27 +1008,27 @@ var zTradelinkAccountGovernanceFields = z.object({
|
|
|
995
1008
|
var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).describe("Governance fields");
|
|
996
1009
|
|
|
997
1010
|
// src/accounts/types.ts
|
|
998
|
-
var zAccountCommonFields =
|
|
999
|
-
id:
|
|
1000
|
-
legacyId:
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
createdAt:
|
|
1007
|
-
updatedAt:
|
|
1008
|
-
});
|
|
1009
|
-
var zAccountBalanceFields =
|
|
1010
|
-
total:
|
|
1011
|
-
pending:
|
|
1011
|
+
var zAccountCommonFields = z32.object({
|
|
1012
|
+
id: z32.string().describe("Internal unique identifier"),
|
|
1013
|
+
legacyId: z32.number().describe("Legacy internal unique identifier (for retro-compatibility)"),
|
|
1014
|
+
name: z32.string().describe("Name"),
|
|
1015
|
+
currency: zCurrency,
|
|
1016
|
+
index: z32.number().gte(0).describe("BIP44 account index"),
|
|
1017
|
+
derivationPath: z32.string().describe("Derivation path"),
|
|
1018
|
+
status: z32.nativeEnum(ActivationStatus).describe("Status"),
|
|
1019
|
+
createdAt: z32.coerce.date().describe("Creation timestamp"),
|
|
1020
|
+
updatedAt: z32.coerce.date().describe("Last modification timestamp")
|
|
1021
|
+
});
|
|
1022
|
+
var zAccountBalanceFields = z32.object({
|
|
1023
|
+
total: z32.string().describe("Total balance"),
|
|
1024
|
+
pending: z32.string().describe("Pending balance")
|
|
1012
1025
|
}).describe("Balance fields");
|
|
1013
1026
|
var zAccountResponse = zAccountCommonFields.extend({
|
|
1014
1027
|
balance: zAccountBalanceFields.optional(),
|
|
1015
1028
|
asset: zAccountAssetFields,
|
|
1016
1029
|
governance: zAccountGovernanceFields
|
|
1017
1030
|
});
|
|
1018
|
-
|
|
1031
|
+
z32.enum([
|
|
1019
1032
|
"name",
|
|
1020
1033
|
"currency",
|
|
1021
1034
|
"index",
|
|
@@ -1024,58 +1037,56 @@ z5.enum([
|
|
|
1024
1037
|
]).default("createdAt");
|
|
1025
1038
|
|
|
1026
1039
|
// src/accounts/app-types.ts
|
|
1027
|
-
var zNote2 =
|
|
1028
|
-
title:
|
|
1029
|
-
content:
|
|
1040
|
+
var zNote2 = z32.object({
|
|
1041
|
+
title: z32.string().describe("Transaction note title"),
|
|
1042
|
+
content: z32.string().describe("Transaction note content")
|
|
1030
1043
|
}).describe("Optional transaction note");
|
|
1031
|
-
|
|
1044
|
+
z32.discriminatedUnion(
|
|
1032
1045
|
zTransactionResponse.discriminator,
|
|
1033
1046
|
ensureNonEmptyArray(
|
|
1034
1047
|
zTransactionResponse.options.map((_) => _.extend({ note: zNote2.nullable() }))
|
|
1035
1048
|
)
|
|
1036
1049
|
);
|
|
1037
|
-
var zWhitelistAddress =
|
|
1038
|
-
name:
|
|
1039
|
-
currency:
|
|
1040
|
-
address:
|
|
1050
|
+
var zWhitelistAddress = z32.object({
|
|
1051
|
+
name: z32.string().min(1).max(50),
|
|
1052
|
+
currency: zCurrency,
|
|
1053
|
+
address: z32.string().min(1).max(200),
|
|
1041
1054
|
// Destination tags are numeric-only or alpha-numeric.
|
|
1042
1055
|
// Empty array (or undefined) means no check on destination tag.
|
|
1043
|
-
destinationTags:
|
|
1056
|
+
destinationTags: z32.array(z32.string().min(1).regex(/^\w+$/)).optional()
|
|
1044
1057
|
});
|
|
1045
|
-
var zWhitelistAddresses =
|
|
1046
|
-
var zWhitelistName =
|
|
1047
|
-
var zCreateWhitelistRequestData =
|
|
1058
|
+
var zWhitelistAddresses = z32.array(zWhitelistAddress);
|
|
1059
|
+
var zWhitelistName = z32.string().min(1).max(45).describe("Whitelist name");
|
|
1060
|
+
var zCreateWhitelistRequestData = z32.object({
|
|
1048
1061
|
name: zWhitelistName,
|
|
1049
|
-
description:
|
|
1062
|
+
description: z32.string().nullable(),
|
|
1050
1063
|
addresses: zWhitelistAddresses,
|
|
1051
|
-
type:
|
|
1064
|
+
type: z32.nativeEnum(WhitelistType)
|
|
1052
1065
|
});
|
|
1053
|
-
var zEditWhitelistRequestData =
|
|
1066
|
+
var zEditWhitelistRequestData = z32.object({
|
|
1054
1067
|
name: zWhitelistName,
|
|
1055
1068
|
addresses: zWhitelistAddresses
|
|
1056
1069
|
});
|
|
1057
1070
|
|
|
1058
1071
|
// src/policies/db-utils.ts
|
|
1059
|
-
var zThreshold =
|
|
1060
|
-
min:
|
|
1061
|
-
|
|
1062
|
-
max: z5.string().regex(/^\d+$/).nullable().describe("Maximum transaction amount")
|
|
1063
|
-
// bigint
|
|
1072
|
+
var zThreshold = z32.object({
|
|
1073
|
+
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
1074
|
+
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
1064
1075
|
}).describe("Threshold for the transaction value");
|
|
1065
|
-
var zWhitelistIds =
|
|
1066
|
-
var zGovRuleJsonObject =
|
|
1076
|
+
var zWhitelistIds = z32.array(z32.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
1077
|
+
var zGovRuleJsonObject = z32.object({
|
|
1067
1078
|
// Required.
|
|
1068
1079
|
operationType: zOperationType.describe("Allowed operation type"),
|
|
1069
1080
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1070
1081
|
threshold: zThreshold,
|
|
1071
1082
|
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1072
1083
|
whitelistIds: zWhitelistIds,
|
|
1073
|
-
reviewConfigId:
|
|
1084
|
+
reviewConfigId: z32.string().min(1).describe("Id of ReviewConfig"),
|
|
1074
1085
|
// HSM id for the rule
|
|
1075
1086
|
hsmId: zHsmObjectId
|
|
1076
1087
|
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
1077
|
-
|
|
1078
|
-
var zAccountGovRuleData =
|
|
1088
|
+
z32.array(zGovRuleJsonObject);
|
|
1089
|
+
var zAccountGovRuleData = z32.object({
|
|
1079
1090
|
operationType: zAccountOperationType.describe("Allowed operation type"),
|
|
1080
1091
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1081
1092
|
threshold: zThreshold.optional(),
|
|
@@ -1083,72 +1094,71 @@ var zAccountGovRuleData = z5.object({
|
|
|
1083
1094
|
whitelistIds: zWhitelistIds.optional(),
|
|
1084
1095
|
reviewSteps: zReviewStepsArray
|
|
1085
1096
|
}).describe("Account governance rule");
|
|
1086
|
-
var zGovRuleData =
|
|
1087
|
-
var zPolicyName =
|
|
1088
|
-
var
|
|
1089
|
-
var zCreatePolicyRequestData =
|
|
1097
|
+
var zGovRuleData = z32.discriminatedUnion("operationType", [zAccountGovRuleData]).describe("Governance rule");
|
|
1098
|
+
var zPolicyName = z32.string().min(1).max(19).describe("Policy name");
|
|
1099
|
+
var zCurrency2 = z32.string().min(1).max(40).regex(/^\w+$/).describe("Currency");
|
|
1100
|
+
var zCreatePolicyRequestData = z32.object({
|
|
1090
1101
|
name: zPolicyName,
|
|
1091
|
-
description:
|
|
1092
|
-
currency:
|
|
1093
|
-
govRules:
|
|
1102
|
+
description: z32.string().nullable().describe("Description"),
|
|
1103
|
+
currency: zCurrency2.nullable(),
|
|
1104
|
+
govRules: z32.array(zGovRuleData).describe("Governance rules")
|
|
1094
1105
|
});
|
|
1095
|
-
var zEditPolicyRequestData =
|
|
1106
|
+
var zEditPolicyRequestData = z32.object({
|
|
1096
1107
|
name: zPolicyName,
|
|
1097
|
-
description:
|
|
1098
|
-
govRules:
|
|
1108
|
+
description: z32.string().nullable().describe("Description"),
|
|
1109
|
+
govRules: z32.array(zGovRuleData).describe("Governance rules")
|
|
1099
1110
|
});
|
|
1100
1111
|
|
|
1101
1112
|
// src/accounts/request-data.ts
|
|
1102
|
-
var zAccountName =
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
z5.object({ type: z5.literal(PolicyType.ACCOUNT_PRIVATE_POLICY), rules: z5.array(zGovRuleData) }).describe("Account governance rules")
|
|
1113
|
+
var zAccountName = z32.string().min(1).max(40).describe("Account name");
|
|
1114
|
+
var zAccountPolicyRequestData = z32.union([
|
|
1115
|
+
z32.object({ policyId: z32.string() }).describe("Account policy"),
|
|
1116
|
+
z32.object({ rules: z32.array(zGovRuleData) }).describe("Account governance rules")
|
|
1107
1117
|
]).describe("Account policy or governance rules");
|
|
1108
|
-
var zCreateAccountGovernanceData =
|
|
1109
|
-
|
|
1110
|
-
type:
|
|
1118
|
+
var zCreateAccountGovernanceData = z32.discriminatedUnion("type", [
|
|
1119
|
+
z32.object({
|
|
1120
|
+
type: z32.literal(AccountGovernanceType.CLASSIC),
|
|
1111
1121
|
policy: zAccountPolicyRequestData
|
|
1112
1122
|
}),
|
|
1113
|
-
|
|
1114
|
-
type:
|
|
1115
|
-
assetManagerId:
|
|
1123
|
+
z32.object({
|
|
1124
|
+
type: z32.literal(AccountGovernanceType.TRADELINK),
|
|
1125
|
+
assetManagerId: z32.string(),
|
|
1116
1126
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1117
1127
|
})
|
|
1118
1128
|
]);
|
|
1119
|
-
var zCreateAccountUserInputData =
|
|
1129
|
+
var zCreateAccountUserInputData = z32.object({
|
|
1120
1130
|
name: zAccountName,
|
|
1121
|
-
type:
|
|
1131
|
+
type: z32.nativeEnum(AccountType),
|
|
1122
1132
|
// "BITCOIN_LIKE"
|
|
1123
|
-
currency:
|
|
1133
|
+
currency: zCurrency,
|
|
1124
1134
|
// "bitcoin"
|
|
1125
|
-
index:
|
|
1126
|
-
contractAddress:
|
|
1135
|
+
index: z32.number().nonnegative().optional().describe("Account index"),
|
|
1136
|
+
contractAddress: z32.string().min(1).optional().describe("Account contract address"),
|
|
1127
1137
|
governance: zCreateAccountGovernanceData
|
|
1128
1138
|
});
|
|
1129
1139
|
var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }).extend({
|
|
1130
|
-
index:
|
|
1131
|
-
derivationPath:
|
|
1140
|
+
index: z32.number().nonnegative().describe("Account index"),
|
|
1141
|
+
derivationPath: z32.string().describe("Account bip44 derivation path")
|
|
1132
1142
|
});
|
|
1133
|
-
var zEditAccountGovernanceData =
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1143
|
+
var zEditAccountGovernanceData = z32.discriminatedUnion("type", [
|
|
1144
|
+
z32.object({
|
|
1145
|
+
type: z32.literal(AccountGovernanceType.CLASSIC),
|
|
1136
1146
|
policy: zAccountPolicyRequestData
|
|
1137
1147
|
}),
|
|
1138
|
-
|
|
1139
|
-
type:
|
|
1148
|
+
z32.object({
|
|
1149
|
+
type: z32.literal(AccountGovernanceType.TRADELINK),
|
|
1140
1150
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1141
1151
|
})
|
|
1142
1152
|
]);
|
|
1143
|
-
var zEditAccountRequestData =
|
|
1153
|
+
var zEditAccountRequestData = z32.object({
|
|
1144
1154
|
name: zAccountName,
|
|
1145
1155
|
governance: zEditAccountGovernanceData
|
|
1146
1156
|
});
|
|
1147
|
-
var zActivateAccountRequestData =
|
|
1148
|
-
var zEditTokenRuleRequestData =
|
|
1149
|
-
parentAccountId:
|
|
1150
|
-
contractAddress:
|
|
1151
|
-
rules:
|
|
1157
|
+
var zActivateAccountRequestData = z32.object({});
|
|
1158
|
+
var zEditTokenRuleRequestData = z32.object({
|
|
1159
|
+
parentAccountId: z32.string().min(1).describe("Parent account unique ID"),
|
|
1160
|
+
contractAddress: z32.string().min(1).describe("Token contract address"),
|
|
1161
|
+
rules: z32.array(zGovRuleData).describe("Account governance rules")
|
|
1152
1162
|
});
|
|
1153
1163
|
|
|
1154
1164
|
// src/accounts/app-utils.ts
|
|
@@ -1243,32 +1253,22 @@ var serializeAccount = (account) => {
|
|
|
1243
1253
|
};
|
|
1244
1254
|
return zAccountResponse.parse(response);
|
|
1245
1255
|
};
|
|
1246
|
-
var
|
|
1247
|
-
|
|
1248
|
-
|
|
1256
|
+
var zSciConfigData = z32.object({
|
|
1257
|
+
dapps: z32.array(z32.string()).nullable().describe("Allowed DApps, null allows all"),
|
|
1258
|
+
customContractCallEnabled: z32.boolean().describe("Allow non-DApp SCI")
|
|
1249
1259
|
});
|
|
1250
|
-
var
|
|
1251
|
-
|
|
1252
|
-
dapps: z5.array(z5.string()).nullable().describe("Allowed DApps, null allows all"),
|
|
1253
|
-
customContractCallEnabled: z5.boolean().describe("Allow non-DApp SCI")
|
|
1254
|
-
});
|
|
1255
|
-
var zCreateSciConfigRequestData = z5.object({
|
|
1256
|
-
account: z5.string().describe("Account UUID"),
|
|
1260
|
+
var zCreateSciConfigRequestData = z32.object({
|
|
1261
|
+
account: z32.string().describe("Account UUID"),
|
|
1257
1262
|
config: zSciConfigData
|
|
1258
1263
|
});
|
|
1259
|
-
var zEditSciConfigRequestData =
|
|
1264
|
+
var zEditSciConfigRequestData = z32.object({
|
|
1260
1265
|
config: zSciConfigData
|
|
1261
1266
|
});
|
|
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")
|
|
1267
|
+
var zRequestReviewStep = z.object({
|
|
1268
|
+
stageName: z.string().regex(/^\w+$/).describe("The review stage name"),
|
|
1269
|
+
quorum: z.number().int().min(1).describe("Quorum for the review step")
|
|
1271
1270
|
});
|
|
1271
|
+
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1272
1272
|
var zUserName = z.string().min(1).max(19).describe("User name");
|
|
1273
1273
|
var zUserRegistrationCreateInput = z.object({
|
|
1274
1274
|
name: zUserName,
|
|
@@ -1279,320 +1279,315 @@ var zUserRegistrationCreateInput = z.object({
|
|
|
1279
1279
|
zUserRegistrationCreateInput.extend({
|
|
1280
1280
|
id: z.string().describe("User registration ID"),
|
|
1281
1281
|
workspaceName: z.string().describe("Workspace name"),
|
|
1282
|
-
state: z.nativeEnum(UserRegistrationState).describe("User registration state")
|
|
1282
|
+
state: z.nativeEnum(UserRegistrationState).describe("User registration state"),
|
|
1283
|
+
isLocked: z.boolean().describe("Whether the registration is locked by a request")
|
|
1283
1284
|
});
|
|
1284
1285
|
|
|
1285
1286
|
// src/users/request-data.ts
|
|
1286
|
-
var zCreatePsdUserRequestData =
|
|
1287
|
-
registrationId:
|
|
1287
|
+
var zCreatePsdUserRequestData = z32.object({
|
|
1288
|
+
registrationId: z32.string().describe("User registration ID")
|
|
1288
1289
|
});
|
|
1289
|
-
var zCreateApiUserRequestData =
|
|
1290
|
+
var zCreateApiUserRequestData = z32.object({
|
|
1290
1291
|
name: zUserName,
|
|
1291
|
-
|
|
1292
|
+
pubKey: z32.string().describe("Public key"),
|
|
1293
|
+
role: z32.enum(["ADMIN", "OPERATOR"]).describe("User role"),
|
|
1294
|
+
viewAll: z32.boolean().describe("View all data").default(false).optional()
|
|
1292
1295
|
}).describe("Create API user request data");
|
|
1293
|
-
var zCreateApiUserAccessRequestData =
|
|
1296
|
+
var zCreateApiUserAccessRequestData = z32.object({
|
|
1294
1297
|
name: zUserName
|
|
1295
|
-
}).describe("Create API user request data");
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
var
|
|
1311
|
-
|
|
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;
|
|
1321
|
-
var zApiKeyName = z5.string().min(1).max(19).describe("API key name");
|
|
1322
|
-
var zCreateApiKeyRequestData = z5.object({
|
|
1298
|
+
}).describe("Create API user credential request data");
|
|
1299
|
+
z32.object({
|
|
1300
|
+
authUserId: z32.string().describe("Authentication broker ID")
|
|
1301
|
+
}).describe("Managed data for API user");
|
|
1302
|
+
var zGroupName = z32.string().min(1).max(19).describe("Group name");
|
|
1303
|
+
var zCreateGroupRequestData = z32.object({
|
|
1304
|
+
name: zGroupName,
|
|
1305
|
+
description: z32.string().nullable().describe("Group description"),
|
|
1306
|
+
members: z32.array(z32.string()).describe("List of group members ids")
|
|
1307
|
+
});
|
|
1308
|
+
var zEditGroupRequestData = z32.object({
|
|
1309
|
+
name: zGroupName,
|
|
1310
|
+
description: z32.string().nullable().describe("Group description"),
|
|
1311
|
+
members: z32.array(z32.string()).describe("List of group members ids")
|
|
1312
|
+
});
|
|
1313
|
+
var zApiKeyName = z32.string().min(1).max(19).describe("API key name");
|
|
1314
|
+
var zCreateApiKeyRequestData = z32.object({
|
|
1323
1315
|
name: zApiKeyName,
|
|
1324
|
-
entities:
|
|
1325
|
-
scopes:
|
|
1316
|
+
entities: z32.array(z32.string()).describe("List of related entities ids"),
|
|
1317
|
+
scopes: z32.object({}).describe("FIXME to be precised")
|
|
1326
1318
|
}).describe("Create read-only API key request data");
|
|
1327
1319
|
var zEditApiKeyRequestData = zCreateApiKeyRequestData.describe(
|
|
1328
1320
|
"Edit read-only API key request data"
|
|
1329
1321
|
);
|
|
1330
|
-
var zEntityName =
|
|
1331
|
-
var zCreateEntityRequestData =
|
|
1322
|
+
var zEntityName = z32.string().min(1).max(19).describe("Entity name");
|
|
1323
|
+
var zCreateEntityRequestData = z32.object({
|
|
1332
1324
|
name: zEntityName,
|
|
1333
|
-
accounts:
|
|
1325
|
+
accounts: z32.array(z32.string())
|
|
1334
1326
|
});
|
|
1335
|
-
var zEditEntityRequestData =
|
|
1327
|
+
var zEditEntityRequestData = z32.object({
|
|
1336
1328
|
name: zEntityName,
|
|
1337
|
-
accounts:
|
|
1329
|
+
accounts: z32.array(z32.string())
|
|
1338
1330
|
});
|
|
1339
1331
|
var NonRootAdminPermission = omit(AdminPermission, "ROOT");
|
|
1340
|
-
var zWorkspaceRuleRequestData =
|
|
1341
|
-
permission:
|
|
1332
|
+
var zWorkspaceRuleRequestData = z32.object({
|
|
1333
|
+
permission: z32.nativeEnum(NonRootAdminPermission).describe("Granted permissions"),
|
|
1342
1334
|
reviewConfig: zReviewStepWithUsersArray.describe("List of admin review steps")
|
|
1343
1335
|
});
|
|
1344
|
-
var zUpdateQuorumRequestData =
|
|
1345
|
-
quorum:
|
|
1336
|
+
var zUpdateQuorumRequestData = z32.object({
|
|
1337
|
+
quorum: z32.number().int().min(1).describe("Workspace quorum")
|
|
1346
1338
|
});
|
|
1347
1339
|
|
|
1348
1340
|
// src/requests/request-data.ts
|
|
1349
1341
|
var zVaultRequestMixinsByType = {
|
|
1350
1342
|
// Workspaces
|
|
1351
|
-
[RequestType.UPDATE_QUORUM]:
|
|
1352
|
-
type:
|
|
1343
|
+
[RequestType.UPDATE_QUORUM]: z32.object({
|
|
1344
|
+
type: z32.literal(RequestType.UPDATE_QUORUM),
|
|
1353
1345
|
data: zUpdateQuorumRequestData
|
|
1354
1346
|
}),
|
|
1355
1347
|
// Operator requests
|
|
1356
|
-
[RequestType.CREATE_TRANSACTION]:
|
|
1357
|
-
type:
|
|
1348
|
+
[RequestType.CREATE_TRANSACTION]: z32.object({
|
|
1349
|
+
type: z32.literal(RequestType.CREATE_TRANSACTION),
|
|
1358
1350
|
data: zCreateTransactionRequestData,
|
|
1359
|
-
meta:
|
|
1360
|
-
hash:
|
|
1351
|
+
meta: z32.object({
|
|
1352
|
+
hash: z32.string().nullable()
|
|
1361
1353
|
}).optional().nullable()
|
|
1362
1354
|
}),
|
|
1363
|
-
[RequestType.SIGN_MESSAGE]:
|
|
1364
|
-
type:
|
|
1355
|
+
[RequestType.SIGN_MESSAGE]: z32.object({
|
|
1356
|
+
type: z32.literal(RequestType.SIGN_MESSAGE),
|
|
1365
1357
|
data: zSignMessageRequestData
|
|
1366
1358
|
}),
|
|
1367
|
-
[RequestType.SIGN_DIGESTS]:
|
|
1368
|
-
type:
|
|
1359
|
+
[RequestType.SIGN_DIGESTS]: z32.object({
|
|
1360
|
+
type: z32.literal(RequestType.SIGN_DIGESTS),
|
|
1369
1361
|
data: zSignDigestsRequestData
|
|
1370
1362
|
}),
|
|
1371
1363
|
// Accounts
|
|
1372
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
1373
|
-
type:
|
|
1364
|
+
[RequestType.CREATE_ACCOUNT]: z32.object({
|
|
1365
|
+
type: z32.literal(RequestType.CREATE_ACCOUNT),
|
|
1374
1366
|
data: zCreateAccountRequestData
|
|
1375
1367
|
}),
|
|
1376
|
-
[RequestType.EDIT_ACCOUNT]:
|
|
1377
|
-
type:
|
|
1378
|
-
targetId:
|
|
1368
|
+
[RequestType.EDIT_ACCOUNT]: z32.object({
|
|
1369
|
+
type: z32.literal(RequestType.EDIT_ACCOUNT),
|
|
1370
|
+
targetId: z32.string(),
|
|
1379
1371
|
data: zEditAccountRequestData
|
|
1380
1372
|
}),
|
|
1381
|
-
[RequestType.ACTIVATE_TRADELINK_ACCOUNT]:
|
|
1382
|
-
type:
|
|
1383
|
-
targetId:
|
|
1373
|
+
[RequestType.ACTIVATE_TRADELINK_ACCOUNT]: z32.object({
|
|
1374
|
+
type: z32.literal(RequestType.ACTIVATE_TRADELINK_ACCOUNT),
|
|
1375
|
+
targetId: z32.string(),
|
|
1384
1376
|
data: zActivateAccountRequestData
|
|
1385
1377
|
}),
|
|
1386
|
-
[RequestType.EDIT_TOKEN_RULE]:
|
|
1387
|
-
type:
|
|
1388
|
-
targetId:
|
|
1378
|
+
[RequestType.EDIT_TOKEN_RULE]: z32.object({
|
|
1379
|
+
type: z32.literal(RequestType.EDIT_TOKEN_RULE),
|
|
1380
|
+
targetId: z32.string(),
|
|
1389
1381
|
data: zEditTokenRuleRequestData
|
|
1390
1382
|
}),
|
|
1391
1383
|
// Groups
|
|
1392
|
-
[RequestType.CREATE_GROUP]:
|
|
1393
|
-
type:
|
|
1384
|
+
[RequestType.CREATE_GROUP]: z32.object({
|
|
1385
|
+
type: z32.literal(RequestType.CREATE_GROUP),
|
|
1394
1386
|
data: zCreateGroupRequestData
|
|
1395
1387
|
}),
|
|
1396
|
-
[RequestType.EDIT_GROUP]:
|
|
1397
|
-
type:
|
|
1398
|
-
targetId:
|
|
1388
|
+
[RequestType.EDIT_GROUP]: z32.object({
|
|
1389
|
+
type: z32.literal(RequestType.EDIT_GROUP),
|
|
1390
|
+
targetId: z32.string(),
|
|
1399
1391
|
data: zEditGroupRequestData
|
|
1400
1392
|
}),
|
|
1401
|
-
[RequestType.REVOKE_GROUP]:
|
|
1402
|
-
type:
|
|
1403
|
-
data:
|
|
1393
|
+
[RequestType.REVOKE_GROUP]: z32.object({
|
|
1394
|
+
type: z32.literal(RequestType.REVOKE_GROUP),
|
|
1395
|
+
data: z32.object({})
|
|
1404
1396
|
}),
|
|
1405
1397
|
// Whitelists
|
|
1406
|
-
[RequestType.CREATE_WHITELIST]:
|
|
1407
|
-
type:
|
|
1398
|
+
[RequestType.CREATE_WHITELIST]: z32.object({
|
|
1399
|
+
type: z32.literal(RequestType.CREATE_WHITELIST),
|
|
1408
1400
|
data: zCreateWhitelistRequestData
|
|
1409
1401
|
}),
|
|
1410
|
-
[RequestType.EDIT_WHITELIST]:
|
|
1411
|
-
type:
|
|
1412
|
-
targetId:
|
|
1402
|
+
[RequestType.EDIT_WHITELIST]: z32.object({
|
|
1403
|
+
type: z32.literal(RequestType.EDIT_WHITELIST),
|
|
1404
|
+
targetId: z32.string(),
|
|
1413
1405
|
data: zEditWhitelistRequestData
|
|
1414
1406
|
}),
|
|
1415
1407
|
// Entities
|
|
1416
|
-
[RequestType.CREATE_ENTITY]:
|
|
1417
|
-
type:
|
|
1408
|
+
[RequestType.CREATE_ENTITY]: z32.object({
|
|
1409
|
+
type: z32.literal(RequestType.CREATE_ENTITY),
|
|
1418
1410
|
data: zCreateEntityRequestData
|
|
1419
1411
|
}),
|
|
1420
|
-
[RequestType.EDIT_ENTITY]:
|
|
1421
|
-
type:
|
|
1412
|
+
[RequestType.EDIT_ENTITY]: z32.object({
|
|
1413
|
+
type: z32.literal(RequestType.EDIT_ENTITY),
|
|
1422
1414
|
data: zEditEntityRequestData
|
|
1423
1415
|
}),
|
|
1424
|
-
[RequestType.REVOKE_ENTITY]:
|
|
1425
|
-
type:
|
|
1426
|
-
data:
|
|
1416
|
+
[RequestType.REVOKE_ENTITY]: z32.object({
|
|
1417
|
+
type: z32.literal(RequestType.REVOKE_ENTITY),
|
|
1418
|
+
data: z32.object({})
|
|
1427
1419
|
}),
|
|
1428
1420
|
// Users
|
|
1429
|
-
[RequestType.CREATE_PSD_USER]:
|
|
1430
|
-
type:
|
|
1421
|
+
[RequestType.CREATE_PSD_USER]: z32.object({
|
|
1422
|
+
type: z32.literal(RequestType.CREATE_PSD_USER),
|
|
1431
1423
|
data: zCreatePsdUserRequestData
|
|
1432
1424
|
}),
|
|
1433
|
-
[RequestType.CREATE_API_USER]:
|
|
1434
|
-
type:
|
|
1425
|
+
[RequestType.CREATE_API_USER]: z32.object({
|
|
1426
|
+
type: z32.literal(RequestType.CREATE_API_USER),
|
|
1435
1427
|
data: zCreateApiUserRequestData
|
|
1436
1428
|
}),
|
|
1437
|
-
[RequestType.CREATE_API_USER_ACCESS]:
|
|
1438
|
-
type:
|
|
1429
|
+
[RequestType.CREATE_API_USER_ACCESS]: z32.object({
|
|
1430
|
+
type: z32.literal(RequestType.CREATE_API_USER_ACCESS),
|
|
1439
1431
|
data: zCreateApiUserAccessRequestData
|
|
1440
1432
|
}),
|
|
1441
|
-
[RequestType.REVOKE_USER]:
|
|
1442
|
-
type:
|
|
1443
|
-
data:
|
|
1433
|
+
[RequestType.REVOKE_USER]: z32.object({
|
|
1434
|
+
type: z32.literal(RequestType.REVOKE_USER),
|
|
1435
|
+
data: z32.object({})
|
|
1444
1436
|
}),
|
|
1445
1437
|
// Admin gov rules
|
|
1446
|
-
[RequestType.CREATE_WORKSPACE_RULE]:
|
|
1447
|
-
type:
|
|
1438
|
+
[RequestType.CREATE_WORKSPACE_RULE]: z32.object({
|
|
1439
|
+
type: z32.literal(RequestType.CREATE_WORKSPACE_RULE),
|
|
1448
1440
|
data: zWorkspaceRuleRequestData
|
|
1449
1441
|
}),
|
|
1450
|
-
[RequestType.EDIT_WORKSPACE_RULE]:
|
|
1451
|
-
type:
|
|
1442
|
+
[RequestType.EDIT_WORKSPACE_RULE]: z32.object({
|
|
1443
|
+
type: z32.literal(RequestType.EDIT_WORKSPACE_RULE),
|
|
1452
1444
|
data: zWorkspaceRuleRequestData
|
|
1453
1445
|
}),
|
|
1454
1446
|
// SCI configs
|
|
1455
|
-
[RequestType.CREATE_SCICONFIG]:
|
|
1456
|
-
type:
|
|
1447
|
+
[RequestType.CREATE_SCICONFIG]: z32.object({
|
|
1448
|
+
type: z32.literal(RequestType.CREATE_SCICONFIG),
|
|
1457
1449
|
data: zCreateSciConfigRequestData
|
|
1458
1450
|
}),
|
|
1459
|
-
[RequestType.EDIT_SCICONFIG]:
|
|
1460
|
-
type:
|
|
1451
|
+
[RequestType.EDIT_SCICONFIG]: z32.object({
|
|
1452
|
+
type: z32.literal(RequestType.EDIT_SCICONFIG),
|
|
1461
1453
|
data: zEditSciConfigRequestData
|
|
1462
1454
|
}),
|
|
1463
1455
|
// API keys
|
|
1464
|
-
[RequestType.CREATE_API_KEY]:
|
|
1465
|
-
type:
|
|
1456
|
+
[RequestType.CREATE_API_KEY]: z32.object({
|
|
1457
|
+
type: z32.literal(RequestType.CREATE_API_KEY),
|
|
1466
1458
|
data: zCreateApiKeyRequestData
|
|
1467
1459
|
}),
|
|
1468
|
-
[RequestType.EDIT_API_KEY]:
|
|
1469
|
-
type:
|
|
1460
|
+
[RequestType.EDIT_API_KEY]: z32.object({
|
|
1461
|
+
type: z32.literal(RequestType.EDIT_API_KEY),
|
|
1470
1462
|
data: zEditApiKeyRequestData
|
|
1471
1463
|
}),
|
|
1472
|
-
[RequestType.REVOKE_API_KEY]:
|
|
1473
|
-
type:
|
|
1474
|
-
data:
|
|
1464
|
+
[RequestType.REVOKE_API_KEY]: z32.object({
|
|
1465
|
+
type: z32.literal(RequestType.REVOKE_API_KEY),
|
|
1466
|
+
data: z32.object({})
|
|
1475
1467
|
}),
|
|
1476
1468
|
// Policies
|
|
1477
|
-
[RequestType.CREATE_POLICY]:
|
|
1478
|
-
type:
|
|
1469
|
+
[RequestType.CREATE_POLICY]: z32.object({
|
|
1470
|
+
type: z32.literal(RequestType.CREATE_POLICY),
|
|
1479
1471
|
data: zCreatePolicyRequestData
|
|
1480
1472
|
}),
|
|
1481
|
-
[RequestType.EDIT_POLICY]:
|
|
1482
|
-
type:
|
|
1483
|
-
targetId:
|
|
1473
|
+
[RequestType.EDIT_POLICY]: z32.object({
|
|
1474
|
+
type: z32.literal(RequestType.EDIT_POLICY),
|
|
1475
|
+
targetId: z32.string(),
|
|
1484
1476
|
data: zEditPolicyRequestData
|
|
1485
1477
|
}),
|
|
1486
1478
|
// Tradelink
|
|
1487
|
-
[RequestType.CREATE_TRADELINK_CUSTODIAN]:
|
|
1488
|
-
type:
|
|
1479
|
+
[RequestType.CREATE_TRADELINK_CUSTODIAN]: z32.object({
|
|
1480
|
+
type: z32.literal(RequestType.CREATE_TRADELINK_CUSTODIAN),
|
|
1489
1481
|
data: zCustodianRequestData
|
|
1490
1482
|
}),
|
|
1491
|
-
[RequestType.EDIT_TRADELINK_CUSTODIAN]:
|
|
1492
|
-
type:
|
|
1493
|
-
targetId:
|
|
1483
|
+
[RequestType.EDIT_TRADELINK_CUSTODIAN]: z32.object({
|
|
1484
|
+
type: z32.literal(RequestType.EDIT_TRADELINK_CUSTODIAN),
|
|
1485
|
+
targetId: z32.string(),
|
|
1494
1486
|
data: zCustodianRequestData
|
|
1495
1487
|
}),
|
|
1496
|
-
[RequestType.CREATE_TRADELINK_EXCHANGE]:
|
|
1497
|
-
type:
|
|
1488
|
+
[RequestType.CREATE_TRADELINK_EXCHANGE]: z32.object({
|
|
1489
|
+
type: z32.literal(RequestType.CREATE_TRADELINK_EXCHANGE),
|
|
1498
1490
|
data: zTradelinkEntityRequestData
|
|
1499
1491
|
}),
|
|
1500
|
-
[RequestType.EDIT_TRADELINK_EXCHANGE]:
|
|
1501
|
-
type:
|
|
1502
|
-
targetId:
|
|
1492
|
+
[RequestType.EDIT_TRADELINK_EXCHANGE]: z32.object({
|
|
1493
|
+
type: z32.literal(RequestType.EDIT_TRADELINK_EXCHANGE),
|
|
1494
|
+
targetId: z32.string(),
|
|
1503
1495
|
data: zTradelinkEntityRequestData
|
|
1504
1496
|
}),
|
|
1505
|
-
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]:
|
|
1506
|
-
type:
|
|
1497
|
+
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]: z32.object({
|
|
1498
|
+
type: z32.literal(RequestType.CREATE_TRADELINK_ASSET_MANAGER),
|
|
1507
1499
|
data: zTradelinkEntityRequestData
|
|
1508
1500
|
}),
|
|
1509
|
-
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]:
|
|
1510
|
-
type:
|
|
1511
|
-
targetId:
|
|
1501
|
+
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]: z32.object({
|
|
1502
|
+
type: z32.literal(RequestType.EDIT_TRADELINK_ASSET_MANAGER),
|
|
1503
|
+
targetId: z32.string(),
|
|
1512
1504
|
data: zTradelinkEntityRequestData
|
|
1513
1505
|
}),
|
|
1514
|
-
[RequestType.ADJUST_PLEDGE]:
|
|
1515
|
-
type:
|
|
1506
|
+
[RequestType.ADJUST_PLEDGE]: z32.object({
|
|
1507
|
+
type: z32.literal(RequestType.ADJUST_PLEDGE),
|
|
1516
1508
|
data: zAdjustPledgeRequestData
|
|
1517
1509
|
}),
|
|
1518
|
-
[RequestType.
|
|
1519
|
-
type:
|
|
1510
|
+
[RequestType.TRADELINK_REPLEDGE]: z32.object({
|
|
1511
|
+
type: z32.literal(RequestType.TRADELINK_REPLEDGE),
|
|
1512
|
+
data: zRepledgeRequestData
|
|
1513
|
+
}),
|
|
1514
|
+
[RequestType.CREATE_SETTLEMENT]: z32.object({
|
|
1515
|
+
type: z32.literal(RequestType.CREATE_SETTLEMENT),
|
|
1520
1516
|
data: zCreateSettlementRequestData,
|
|
1521
|
-
meta:
|
|
1522
|
-
hash:
|
|
1517
|
+
meta: z32.object({
|
|
1518
|
+
hash: z32.string().nullable()
|
|
1523
1519
|
}).optional().nullable()
|
|
1524
1520
|
}),
|
|
1525
|
-
[RequestType.FORCE_UNPLEDGE]:
|
|
1526
|
-
type:
|
|
1521
|
+
[RequestType.FORCE_UNPLEDGE]: z32.object({
|
|
1522
|
+
type: z32.literal(RequestType.FORCE_UNPLEDGE),
|
|
1527
1523
|
data: zForceUnpledgeRequestData
|
|
1528
1524
|
}),
|
|
1529
|
-
[RequestType.TRADELINK_WITHDRAW]:
|
|
1530
|
-
type:
|
|
1525
|
+
[RequestType.TRADELINK_WITHDRAW]: z32.object({
|
|
1526
|
+
type: z32.literal(RequestType.TRADELINK_WITHDRAW),
|
|
1531
1527
|
data: zTradelinkWithdrawRequestData,
|
|
1532
|
-
meta:
|
|
1533
|
-
hash:
|
|
1528
|
+
meta: z32.object({
|
|
1529
|
+
hash: z32.string().nullable()
|
|
1534
1530
|
}).optional().nullable()
|
|
1535
1531
|
}),
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1532
|
+
[RequestType.TRADELINK_ARBITRATE]: z32.object({
|
|
1533
|
+
type: z32.literal(RequestType.TRADELINK_ARBITRATE),
|
|
1534
|
+
data: zTradelinkArbitrationRequestData,
|
|
1535
|
+
meta: z32.object({
|
|
1536
|
+
hash: z32.string().nullable()
|
|
1537
|
+
}).optional().nullable()
|
|
1540
1538
|
}),
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
};
|
|
1546
|
-
var zVaultRequestMixinsByLegacyType = {
|
|
1547
|
-
CREATE_ADMIN: z5.object({
|
|
1548
|
-
type: z5.literal(RequestType.CREATE_ADMIN),
|
|
1549
|
-
data: zCreateAdminRequestData
|
|
1539
|
+
// Deprecate ADMIN_GOV_RULE
|
|
1540
|
+
[RequestType.CREATE_ADMIN_GOV_RULE]: z32.object({
|
|
1541
|
+
type: z32.literal(RequestType.CREATE_ADMIN_GOV_RULE),
|
|
1542
|
+
data: z32.object({}).describe("Deprecated")
|
|
1550
1543
|
}),
|
|
1551
|
-
|
|
1552
|
-
type:
|
|
1553
|
-
data:
|
|
1544
|
+
[RequestType.EDIT_ADMIN_GOV_RULE]: z32.object({
|
|
1545
|
+
type: z32.literal(RequestType.EDIT_ADMIN_GOV_RULE),
|
|
1546
|
+
data: z32.object({}).describe("Deprecated")
|
|
1554
1547
|
})
|
|
1555
1548
|
};
|
|
1556
1549
|
|
|
1557
1550
|
// src/requests/app-types.ts
|
|
1558
|
-
var zRequestReviewResponse =
|
|
1551
|
+
var zRequestReviewResponse = z32.object({
|
|
1559
1552
|
// Note: Do NOT include `quorum` as it is already available in the request's `reviewSteps` field.
|
|
1560
|
-
stepIndex:
|
|
1561
|
-
userId:
|
|
1562
|
-
status:
|
|
1563
|
-
createdAt:
|
|
1564
|
-
updatedAt:
|
|
1565
|
-
});
|
|
1566
|
-
var zVaultRequestCommonMixin =
|
|
1567
|
-
id:
|
|
1568
|
-
legacyId:
|
|
1569
|
-
state:
|
|
1553
|
+
stepIndex: z32.number().int().describe("Index of the governance step in the request workflow"),
|
|
1554
|
+
userId: z32.string().describe("Reviewer id"),
|
|
1555
|
+
status: z32.nativeEnum(RequestReviewStatus).describe("Review status"),
|
|
1556
|
+
createdAt: z32.coerce.date().describe("Created date"),
|
|
1557
|
+
updatedAt: z32.coerce.date().describe("Updated date")
|
|
1558
|
+
});
|
|
1559
|
+
var zVaultRequestCommonMixin = z32.object({
|
|
1560
|
+
id: z32.string().describe("Request unique identifier"),
|
|
1561
|
+
legacyId: z32.number().describe("Legacy internal unique identifier (for retro-compatibility)"),
|
|
1562
|
+
state: z32.nativeEnum(RequestState).describe("Request state"),
|
|
1570
1563
|
reviewSteps: zRequestReviewSteps.describe("Request review steps"),
|
|
1571
|
-
currentStepIndex:
|
|
1572
|
-
expiredAt:
|
|
1573
|
-
targetId:
|
|
1564
|
+
currentStepIndex: z32.number().int().min(0).describe("Index of the current approval step"),
|
|
1565
|
+
expiredAt: z32.coerce.date().nullable().describe("Optional expiration date"),
|
|
1566
|
+
targetId: z32.string().nullable().describe("Optional ID of the target object"),
|
|
1574
1567
|
note: zNote.nullable().describe("Optional request note"),
|
|
1575
|
-
reviews:
|
|
1568
|
+
reviews: z32.array(zRequestReviewResponse).describe("Requests reviews"),
|
|
1576
1569
|
// `type` and `data` are correlated -- See `zVaultRequestMixinsByType`
|
|
1577
|
-
createdAt:
|
|
1578
|
-
updatedAt:
|
|
1570
|
+
createdAt: z32.coerce.date().describe("Creation timestamp"),
|
|
1571
|
+
updatedAt: z32.coerce.date().describe("Last modification timestamp"),
|
|
1579
1572
|
// `inflight` is fetched from ONGOING RequestSaga
|
|
1580
|
-
inflight:
|
|
1581
|
-
lastError:
|
|
1582
|
-
numFailed:
|
|
1583
|
-
retryAfter:
|
|
1573
|
+
inflight: z32.object({
|
|
1574
|
+
lastError: z32.string().describe("Error message from the last failure"),
|
|
1575
|
+
numFailed: z32.number().int().describe("Number of failures so far"),
|
|
1576
|
+
retryAfter: z32.coerce.date().describe("Date after which next retry is scheduled")
|
|
1584
1577
|
}).optional().describe("Extra information if the request is currently being processed")
|
|
1585
1578
|
});
|
|
1586
1579
|
var allowedRequestCreationInput = {
|
|
1587
1580
|
[RequestType.CREATE_PSD_USER]: zVaultRequestMixinsByType[RequestType.CREATE_PSD_USER],
|
|
1581
|
+
[RequestType.CREATE_API_USER]: zVaultRequestMixinsByType[RequestType.CREATE_API_USER],
|
|
1588
1582
|
[RequestType.CREATE_GROUP]: zVaultRequestMixinsByType[RequestType.CREATE_GROUP],
|
|
1583
|
+
[RequestType.EDIT_GROUP]: zVaultRequestMixinsByType[RequestType.EDIT_GROUP],
|
|
1589
1584
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
1590
1585
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
1591
1586
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
1592
1587
|
[RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
|
|
1593
1588
|
[RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
|
|
1594
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
1595
|
-
type:
|
|
1589
|
+
[RequestType.CREATE_ACCOUNT]: z32.object({
|
|
1590
|
+
type: z32.literal(RequestType.CREATE_ACCOUNT),
|
|
1596
1591
|
data: zCreateAccountUserInputData
|
|
1597
1592
|
}),
|
|
1598
1593
|
[RequestType.EDIT_ACCOUNT]: zVaultRequestMixinsByType[RequestType.EDIT_ACCOUNT],
|
|
@@ -1604,12 +1599,14 @@ var allowedRequestCreationInput = {
|
|
|
1604
1599
|
[RequestType.CREATE_TRADELINK_ASSET_MANAGER]: zVaultRequestMixinsByType[RequestType.CREATE_TRADELINK_ASSET_MANAGER],
|
|
1605
1600
|
[RequestType.EDIT_TRADELINK_ASSET_MANAGER]: zVaultRequestMixinsByType[RequestType.EDIT_TRADELINK_ASSET_MANAGER],
|
|
1606
1601
|
[RequestType.ADJUST_PLEDGE]: zVaultRequestMixinsByType[RequestType.ADJUST_PLEDGE],
|
|
1602
|
+
[RequestType.TRADELINK_REPLEDGE]: zVaultRequestMixinsByType[RequestType.TRADELINK_REPLEDGE],
|
|
1607
1603
|
[RequestType.FORCE_UNPLEDGE]: zVaultRequestMixinsByType[RequestType.FORCE_UNPLEDGE],
|
|
1608
1604
|
[RequestType.CREATE_SETTLEMENT]: zVaultRequestMixinsByType[RequestType.CREATE_SETTLEMENT],
|
|
1609
|
-
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW]
|
|
1605
|
+
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW],
|
|
1606
|
+
[RequestType.TRADELINK_ARBITRATE]: zVaultRequestMixinsByType[RequestType.TRADELINK_ARBITRATE]
|
|
1610
1607
|
};
|
|
1611
|
-
|
|
1612
|
-
request:
|
|
1608
|
+
z32.object({
|
|
1609
|
+
request: z32.discriminatedUnion(
|
|
1613
1610
|
"type",
|
|
1614
1611
|
ensureNonEmptyArray(
|
|
1615
1612
|
Object.values(allowedRequestCreationInput).map((_) => {
|
|
@@ -1619,23 +1616,23 @@ z5.object({
|
|
|
1619
1616
|
)
|
|
1620
1617
|
)
|
|
1621
1618
|
});
|
|
1622
|
-
var zVaultRequestResponse =
|
|
1619
|
+
var zVaultRequestResponse = z32.discriminatedUnion(
|
|
1623
1620
|
"type",
|
|
1624
1621
|
ensureNonEmptyArray(
|
|
1625
|
-
Object.values(
|
|
1622
|
+
Object.values(zVaultRequestMixinsByType).map((_) => {
|
|
1626
1623
|
const requestType = _.shape.type._def.value;
|
|
1627
1624
|
return _.merge(zVaultRequestCommonMixin).describe(`${requestType} request`);
|
|
1628
1625
|
})
|
|
1629
1626
|
)
|
|
1630
1627
|
);
|
|
1631
|
-
|
|
1628
|
+
z32.enum([
|
|
1632
1629
|
"state",
|
|
1633
1630
|
"expiredAt",
|
|
1634
1631
|
"createdAt",
|
|
1635
1632
|
"updatedAt"
|
|
1636
1633
|
]).default("createdAt");
|
|
1637
|
-
|
|
1638
|
-
pubKey:
|
|
1634
|
+
z32.object({
|
|
1635
|
+
pubKey: z32.string().describe("Public key of the current user"),
|
|
1639
1636
|
challenge: zUserChallenge.describe("Challenge data to sign with the user's private key")
|
|
1640
1637
|
});
|
|
1641
1638
|
var shouldHaveTargetHsmId = (request) => {
|
|
@@ -1651,15 +1648,6 @@ var shouldHaveTargetHsmId = (request) => {
|
|
|
1651
1648
|
case RequestType.CREATE_WORKSPACE_RULE:
|
|
1652
1649
|
case RequestType.EDIT_WORKSPACE_RULE:
|
|
1653
1650
|
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
1651
|
case RequestType.CREATE_PSD_USER:
|
|
1664
1652
|
case RequestType.CREATE_API_USER:
|
|
1665
1653
|
case RequestType.CREATE_API_USER_ACCESS:
|
|
@@ -1691,7 +1679,7 @@ var shouldHaveTargetHsmId = (request) => {
|
|
|
1691
1679
|
/* v8 ignore start */
|
|
1692
1680
|
case RequestType.CREATE_ADMIN_GOV_RULE:
|
|
1693
1681
|
case RequestType.EDIT_ADMIN_GOV_RULE:
|
|
1694
|
-
throw new Error(`
|
|
1682
|
+
throw new Error(`RequestType ${request.type} is deprecated`);
|
|
1695
1683
|
}
|
|
1696
1684
|
};
|
|
1697
1685
|
var shouldHaveTargetId = (request) => {
|
|
@@ -1705,8 +1693,6 @@ var shouldHaveTargetId = (request) => {
|
|
|
1705
1693
|
case RequestType.SIGN_DIGESTS:
|
|
1706
1694
|
return false;
|
|
1707
1695
|
case RequestType.CREATE_PSD_USER:
|
|
1708
|
-
case RequestType.CREATE_ADMIN:
|
|
1709
|
-
case RequestType.CREATE_OPERATOR:
|
|
1710
1696
|
case RequestType.CREATE_API_USER:
|
|
1711
1697
|
case RequestType.CREATE_WORKSPACE_RULE:
|
|
1712
1698
|
case RequestType.CREATE_ACCOUNT:
|
|
@@ -1738,14 +1724,16 @@ var shouldHaveTargetId = (request) => {
|
|
|
1738
1724
|
case RequestType.EDIT_TRADELINK_EXCHANGE:
|
|
1739
1725
|
case RequestType.EDIT_TRADELINK_ASSET_MANAGER:
|
|
1740
1726
|
case RequestType.ADJUST_PLEDGE:
|
|
1727
|
+
case RequestType.TRADELINK_REPLEDGE:
|
|
1741
1728
|
case RequestType.CREATE_SETTLEMENT:
|
|
1742
1729
|
case RequestType.FORCE_UNPLEDGE:
|
|
1743
1730
|
case RequestType.TRADELINK_WITHDRAW:
|
|
1731
|
+
case RequestType.TRADELINK_ARBITRATE:
|
|
1744
1732
|
return true;
|
|
1745
1733
|
/* v8 ignore start */
|
|
1746
1734
|
case RequestType.CREATE_ADMIN_GOV_RULE:
|
|
1747
1735
|
case RequestType.EDIT_ADMIN_GOV_RULE:
|
|
1748
|
-
throw new Error(`
|
|
1736
|
+
throw new Error(`RequestType ${request.type} is deprecated`);
|
|
1749
1737
|
}
|
|
1750
1738
|
};
|
|
1751
1739
|
|
|
@@ -1758,6 +1746,7 @@ function serializeVaultRequest(request) {
|
|
|
1758
1746
|
switch (request.type) {
|
|
1759
1747
|
case "CREATE_TRANSACTION":
|
|
1760
1748
|
case "TRADELINK_WITHDRAW":
|
|
1749
|
+
case "TRADELINK_ARBITRATE":
|
|
1761
1750
|
case "CREATE_SETTLEMENT":
|
|
1762
1751
|
Object.assign(serialized, {
|
|
1763
1752
|
meta: {
|
|
@@ -1983,7 +1972,7 @@ var genAccount = (opts) => {
|
|
|
1983
1972
|
var genRequestReviewSteps = (numSteps) => times(1, () => ({ stageName: "default", quorum: 2 }));
|
|
1984
1973
|
var genVaultRequest = (opts) => {
|
|
1985
1974
|
const { type, state = RequestState.PENDING_APPROVAL, data, ...custom } = opts;
|
|
1986
|
-
const targetHsmId = shouldHaveTargetHsmId({ type, state }) ? fakeHsmObjectId() : null;
|
|
1975
|
+
const targetHsmId = shouldHaveTargetHsmId({ type, state }) ? type === RequestType.CREATE_PSD_USER ? fakePubKey() : fakeHsmObjectId() : null;
|
|
1987
1976
|
const targetId = shouldHaveTargetId({ type, state }) ? faker.string.uuid() : null;
|
|
1988
1977
|
return injectSyncId({
|
|
1989
1978
|
id: faker.string.uuid(),
|