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