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