@ledgerhq/revault-api 1.38.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{app-types-PsayzV1q.d.mts → app-types-b9W8_2Yl.d.mts} +1217 -1541
- package/lib/fakes.d.mts +610 -68
- package/lib/fakes.mjs +1162 -1149
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +2280 -2563
- package/package.json +2 -2
package/lib/fakes.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __export } from './chunk-J5LGTIGS.mjs';
|
|
2
2
|
import { faker } from '@faker-js/faker';
|
|
3
|
-
import { AllowedAction, ChallengeType, PsdModel,
|
|
4
|
-
import
|
|
3
|
+
import { AllowedAction, AccountType, ChallengeType, PsdModel, UserRole, UserRegistrationState, AdminPermission, RequestType, MessageType, AccountGovernanceType, ActivationStatus, WhitelistType, RequestReviewStatus, RequestState, GateAccountType } from '@prisma/client';
|
|
4
|
+
import z10, { z } from 'zod';
|
|
5
5
|
import 'axios';
|
|
6
6
|
import invariant from 'invariant';
|
|
7
7
|
import { omit, times, get, isPlainObject } from 'lodash';
|
|
@@ -60,9 +60,9 @@ z.discriminatedUnion("type", [
|
|
|
60
60
|
zValueTransactionOperation,
|
|
61
61
|
zSigningOperation
|
|
62
62
|
]);
|
|
63
|
-
var zNote =
|
|
64
|
-
title:
|
|
65
|
-
content:
|
|
63
|
+
var zNote = z10.object({
|
|
64
|
+
title: z10.string().meta({ description: "Note title" }),
|
|
65
|
+
content: z10.string().meta({ description: "Note content" })
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// src/errors.ts
|
|
@@ -90,268 +90,188 @@ var ensureNonEmptyArray = (values, message) => {
|
|
|
90
90
|
function unreachable(value) {
|
|
91
91
|
throw new Error(`Un-covered: ${value}`);
|
|
92
92
|
}
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
codeHash: z.base64().meta({ description: "Hash of the executable that generated this certificate" }),
|
|
96
|
-
attestationPub: z.base64().meta({ description: "Attestation public key" }),
|
|
97
|
-
certificate: z.base64().meta({ description: "Certificate bytes" }),
|
|
98
|
-
signature: z.base64().meta({ description: "Certificate signature" })
|
|
99
|
-
});
|
|
100
|
-
var zBlob = z.string();
|
|
101
|
-
var zPsdChallenge = z.object({
|
|
102
|
-
challengeType: z.literal(ChallengeType.PSD),
|
|
103
|
-
wActions: z.array(z.string()).meta({ description: "Wrapped blobs that describe the screens to display" }),
|
|
104
|
-
handshake: z.string().meta({ description: "Handshake for the HSM <-> PSD communication" }),
|
|
105
|
-
handshakeAttestation: zHsmCertificate.meta({
|
|
106
|
-
description: "Handshake attestation to verify secure channel between HSM & PSD"
|
|
107
|
-
}),
|
|
108
|
-
partitionId: z.string().meta({ description: "HSM partition id (maybe not useful)" })
|
|
109
|
-
});
|
|
110
|
-
var zApiChallenge = z.object({
|
|
111
|
-
challengeType: z.literal(ChallengeType.API),
|
|
112
|
-
payload: z.object({
|
|
113
|
-
approve: z.string().meta({ description: "JSON payload to sign (as JWS) to approve" }),
|
|
114
|
-
reject: z.string().meta({ description: "JSON payload to sign (as JWS) to reject" })
|
|
115
|
-
}).meta({ description: "JSON payload to approve and to reject" })
|
|
116
|
-
});
|
|
117
|
-
var zUserChallenge = z.discriminatedUnion("challengeType", [
|
|
118
|
-
zPsdChallenge.meta({ description: "Necessary data to approve on a PSD" }),
|
|
119
|
-
zApiChallenge.meta({ description: "Necessary data for approval by an API user" })
|
|
120
|
-
]);
|
|
121
|
-
var zHsmChallengeGroup = z.record(zPubKey, zUserChallenge);
|
|
122
|
-
var zHsmChallengeSteps = z.array(zHsmChallengeGroup);
|
|
123
|
-
var zPsdSignature = z.string().min(1).meta({ description: "Signature from PSD" });
|
|
124
|
-
var zApiSignature = z.string().min(1).meta({ description: "Signature from API (JWS)" });
|
|
125
|
-
var zUserApproval = z.discriminatedUnion("challengeType", [
|
|
126
|
-
z.object({
|
|
127
|
-
challengeType: z.literal(ChallengeType.PSD),
|
|
128
|
-
signature: zPsdSignature
|
|
129
|
-
}),
|
|
130
|
-
z.object({
|
|
131
|
-
challengeType: z.literal(ChallengeType.API),
|
|
132
|
-
signature: zApiSignature
|
|
133
|
-
})
|
|
134
|
-
]);
|
|
135
|
-
var zHsmApprovalGroup = z.record(zPubKey, zUserApproval);
|
|
136
|
-
z.array(zHsmApprovalGroup);
|
|
137
|
-
z.object({
|
|
138
|
-
stageName: z.string(),
|
|
139
|
-
steps: zHsmChallengeSteps
|
|
140
|
-
});
|
|
141
|
-
z.object({
|
|
142
|
-
name: z.string().meta({ description: "Name of the user to register" }),
|
|
143
|
-
psdModel: z.enum(PsdModel).meta({ description: "Device model" }),
|
|
144
|
-
pubKey: zPubKey.meta({ description: "Device public key" }),
|
|
145
|
-
confidentialityKey: zPubKey,
|
|
146
|
-
psdEphemeralKey: zPubKey,
|
|
147
|
-
psdEphemeralKeyAttestation: zHsmCertificate
|
|
148
|
-
}).meta({ description: "Data generated by the PSD to register on HSM" });
|
|
149
|
-
z.object({
|
|
150
|
-
challenge: z.string(),
|
|
151
|
-
ephemeralPublicKey: zPubKey,
|
|
152
|
-
ephemeralPublicKeyAttestation: zHsmCertificate,
|
|
153
|
-
handshake: zHexString,
|
|
154
|
-
handshakeAttestation: zHsmCertificate,
|
|
155
|
-
u2fRegisterData: z.string(),
|
|
156
|
-
ciphertext: z.string(),
|
|
157
|
-
requestId: z.string()
|
|
158
|
-
}).meta({ description: "Challenge generated by HSM\xA0using the PSD registration data" });
|
|
159
|
-
z.object({
|
|
160
|
-
certificate: zHsmCertificate,
|
|
161
|
-
u2fRegister: zHexString,
|
|
162
|
-
u2fKeyHandle: zHexString,
|
|
163
|
-
registerData: z.string(),
|
|
164
|
-
validationKey: zPubKey,
|
|
165
|
-
pairingPayload: z.string()
|
|
166
|
-
}).meta({ description: "Final registration response from PSD to HSM" });
|
|
167
|
-
z.object({
|
|
168
|
-
confidentialityKeyCurve25519: z.string(),
|
|
169
|
-
confidentialityKeySignature: z.string()
|
|
170
|
-
});
|
|
171
|
-
z.object({
|
|
172
|
-
pairing: z.object({
|
|
173
|
-
workspaceName: z.string(),
|
|
174
|
-
partitionKey: z.string(),
|
|
175
|
-
// TODO: Is this `zPubKey`?
|
|
176
|
-
bootstrapEnabled: z.boolean()
|
|
177
|
-
}),
|
|
178
|
-
// TODO: Is this `zHsmCertificate`?
|
|
179
|
-
partitionKeyAttestation: z.object({
|
|
180
|
-
codeHash: z.string(),
|
|
181
|
-
attestationPub: z.string(),
|
|
182
|
-
certificate: z.string(),
|
|
183
|
-
signature: z.string()
|
|
184
|
-
}),
|
|
185
|
-
blob: zBlob
|
|
186
|
-
});
|
|
187
|
-
var zHsmSignature = z.object({
|
|
188
|
-
digest: z.string().nullable().meta({ description: "Signed digest" }),
|
|
189
|
-
derivationPath: z.string().nullable().meta({ description: "Derivation path used to sign the digest" }),
|
|
190
|
-
r: z.base64().meta({ description: "Base64 encoded signature r coordinate" }),
|
|
191
|
-
s: z.base64().meta({ description: "Base64 encoded signature s coordinate" }),
|
|
192
|
-
v: z.union([z.literal(0), z.literal(1)]).nullable().meta({ description: "Ecdsa only, signature recovery value" }),
|
|
193
|
-
der: zHexString.meta({
|
|
194
|
-
description: "Hex string encoded DER signature format (for eddsa, concatenation of r & s)"
|
|
195
|
-
}),
|
|
196
|
-
pubkey: zHexString.nullable().meta({ description: "Public key for signature verification, 32 or 33 bytes" })
|
|
197
|
-
});
|
|
198
|
-
var zBitcoinLikeTransactionType = z7.enum(["BITCOIN_LIKE_SEND", "BITCOIN_LIKE_RECEIVE"]).meta({ description: "Bitcoin-like transaction type" });
|
|
199
|
-
var zCardanoLikeTransactionType = z7.enum([
|
|
200
|
-
"CARDANO_LIKE_SEND",
|
|
201
|
-
"CARDANO_LIKE_RECEIVE",
|
|
202
|
-
"CARDANO_LIKE_STAKING_REGISTER",
|
|
203
|
-
"CARDANO_LIKE_STAKING_DEREGISTER",
|
|
204
|
-
"CARDANO_LIKE_STAKING_DELEGATE",
|
|
205
|
-
"CARDANO_LIKE_STAKING_WITHDRAW"
|
|
206
|
-
]).meta({ description: "Cardano-like transaction type" });
|
|
207
|
-
var zEthereumLikeTransferTransactionType = z7.enum(["ETHEREUM_LIKE_SEND", "ETHEREUM_LIKE_RECEIVE"]).meta({ description: "Ethereum-like transaction type" });
|
|
208
|
-
var zEthereumLikeContractTransactionType = z7.enum(["ETHEREUM_LIKE_EXECUTE_CONTRACT", "ETHEREUM_LIKE_DEPLOY_CONTRACT"]).meta({ description: "Ethereum-like transaction type" });
|
|
209
|
-
var zPolkadotLikeTransactionType = z7.enum([
|
|
210
|
-
"POLKADOT_LIKE_SEND",
|
|
211
|
-
"POLKADOT_LIKE_RECEIVE",
|
|
212
|
-
"POLKADOT_LIKE_ADDPROXY",
|
|
213
|
-
"POLKADOT_LIKE_REMOVEPROXY",
|
|
214
|
-
"POLKADOT_LIKE_BOND",
|
|
215
|
-
"POLKADOT_LIKE_REBOND",
|
|
216
|
-
"POLKADOT_LIKE_BONDEXTRA",
|
|
217
|
-
"POLKADOT_LIKE_UNBOND",
|
|
218
|
-
"POLKADOT_LIKE_WITHDRAWUNBONDED",
|
|
219
|
-
"POLKADOT_LIKE_SETCONTROLLER",
|
|
220
|
-
"POLKADOT_LIKE_SETPAYEE",
|
|
221
|
-
"POLKADOT_LIKE_PROXY",
|
|
222
|
-
"POLKADOT_LIKE_ANONYMOUSPROXY",
|
|
223
|
-
"POLKADOT_LIKE_KILLANONYMOUS",
|
|
224
|
-
"POLKADOT_LIKE_PUREPROXY",
|
|
225
|
-
"POLKADOT_LIKE_KILLPURE",
|
|
226
|
-
"POLKADOT_LIKE_NOMINATE",
|
|
227
|
-
"POLKADOT_LIKE_REWARD",
|
|
228
|
-
"POLKADOT_LIKE_CHILL",
|
|
229
|
-
"POLKADOT_LIKE_TRANSFERALL"
|
|
230
|
-
]).meta({ description: "Polkadot-like transaction type" });
|
|
231
|
-
var zRippleLikeTransactionType = z7.enum(["RIPPLE_LIKE_SEND", "RIPPLE_LIKE_RECEIVE"]).meta({ description: "Ripple-like transaction type" });
|
|
232
|
-
var zSolanaLikeTransactionType = z7.enum([
|
|
233
|
-
"SOLANA_LIKE_SEND",
|
|
234
|
-
"SOLANA_LIKE_RECEIVE",
|
|
235
|
-
"SOLANA_LIKE_CREATE_DELEGATE_STAKE",
|
|
236
|
-
"SOLANA_LIKE_DELEGATE_STAKE",
|
|
237
|
-
"SOLANA_LIKE_WITHDRAW_STAKE",
|
|
238
|
-
"SOLANA_LIKE_DEACTIVATE_STAKE",
|
|
239
|
-
"SOLANA_LIKE_SPLIT_STAKE",
|
|
240
|
-
"SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE",
|
|
241
|
-
"SOLANA_LIKE_MERGE_STAKE",
|
|
242
|
-
"SOLANA_LIKE_SEND_TOKEN",
|
|
243
|
-
"SOLANA_LIKE_FUND_AND_SEND_TOKEN",
|
|
244
|
-
"SOLANA_LIKE_CREATE_SPL_TOKEN_ACCOUNT"
|
|
245
|
-
]).meta({ description: "Solana-like transaction type" });
|
|
246
|
-
var zStellarLikeTransactionType = z7.enum(["STELLAR_LIKE_SEND", "STELLAR_LIKE_RECEIVE"]).meta({ description: "Stellar-like transaction type" });
|
|
247
|
-
var zTezosLikeTransactionType = z7.enum([
|
|
248
|
-
"TEZOS_LIKE_SEND",
|
|
249
|
-
"TEZOS_LIKE_RECEIVE",
|
|
250
|
-
"TEZOS_LIKE_REVEAL",
|
|
251
|
-
"TEZOS_LIKE_DELEGATE",
|
|
252
|
-
"TEZOS_LIKE_UNDELEGATE"
|
|
253
|
-
]).meta({ description: "Tezos-like transaction type" });
|
|
254
|
-
var zGenericTransactionType = z7.enum(["GENERIC_TRANSACTION"]).meta({ description: "Generic transaction type" });
|
|
255
|
-
var zSuiLikeTransactionType = z7.enum([
|
|
256
|
-
"SUI_LIKE_SEND",
|
|
257
|
-
"SUI_LIKE_RECEIVE",
|
|
258
|
-
"SUI_LIKE_SEND_TOKEN",
|
|
259
|
-
"SUI_LIKE_RECEIVE_TOKEN",
|
|
260
|
-
"SUI_LIKE_STAKE",
|
|
261
|
-
"SUI_LIKE_UNSTAKE"
|
|
262
|
-
]).meta({ description: "Sui-like transaction type" });
|
|
263
|
-
var zTronLikeTransactionType = z7.enum(["TRON_LIKE_SEND", "TRON_LIKE_RECEIVE", "TRON_LIKE_SEND_TOKEN", "TRON_LIKE_RECEIVE_TOKEN"]).meta({ description: "Tron-like transaction type" });
|
|
264
|
-
z7.union([
|
|
265
|
-
zBitcoinLikeTransactionType,
|
|
266
|
-
zCardanoLikeTransactionType,
|
|
267
|
-
zEthereumLikeTransferTransactionType,
|
|
268
|
-
zEthereumLikeContractTransactionType,
|
|
269
|
-
zGenericTransactionType,
|
|
270
|
-
zPolkadotLikeTransactionType,
|
|
271
|
-
zRippleLikeTransactionType,
|
|
272
|
-
zSolanaLikeTransactionType,
|
|
273
|
-
zStellarLikeTransactionType,
|
|
274
|
-
zSuiLikeTransactionType,
|
|
275
|
-
zTezosLikeTransactionType,
|
|
276
|
-
zTronLikeTransactionType
|
|
277
|
-
]);
|
|
278
|
-
z7.discriminatedUnion("type", [
|
|
279
|
-
z7.object({
|
|
280
|
-
type: z7.literal("ETHEREUM_LIKE"),
|
|
281
|
-
baseFees: zIntString,
|
|
282
|
-
gasLimit: zIntString,
|
|
283
|
-
nonce: z7.string(),
|
|
284
|
-
priorityFees: zIntString
|
|
285
|
-
}).meta({ description: "Ethereum-like fees" }),
|
|
286
|
-
z7.object({
|
|
287
|
-
type: z7.literal("RIPPLE_LIKE"),
|
|
288
|
-
fee: zIntString
|
|
289
|
-
}).meta({ description: "Ripple-like fees" }),
|
|
290
|
-
z7.object({
|
|
291
|
-
type: z7.literal("STELLAR_LIKE"),
|
|
292
|
-
fee: zIntString
|
|
293
|
-
}).meta({ description: "Stellar-like fees" }),
|
|
294
|
-
z7.object({
|
|
295
|
-
type: z7.literal("TEZOS_LIKE"),
|
|
296
|
-
fee: zIntString
|
|
297
|
-
}).describe("Tezos-like fees"),
|
|
298
|
-
z7.object({
|
|
299
|
-
type: z7.literal("SUI_LIKE"),
|
|
300
|
-
fee: zIntString
|
|
301
|
-
}).meta({ description: "Sui-like fees" }),
|
|
302
|
-
z7.object({
|
|
303
|
-
type: z7.literal("TRON_LIKE"),
|
|
304
|
-
fee: zIntString
|
|
305
|
-
}).meta({ description: "Tron-like fees" })
|
|
306
|
-
]);
|
|
307
|
-
var zMessageType = z7.enum(MessageType).meta({ description: "Type of the message to sign" });
|
|
308
|
-
var zMessageData = zHexString.nonempty().meta({
|
|
309
|
-
description: "Hex data to sign, either a json string for EIP712, or a raw string for EIP191"
|
|
310
|
-
});
|
|
311
|
-
var zMessage = z7.object({
|
|
312
|
-
type: zMessageType,
|
|
313
|
-
data: zMessageData
|
|
314
|
-
});
|
|
315
|
-
z7.object({
|
|
316
|
-
id: z7.string().meta({ description: "Unique identifier" }),
|
|
317
|
-
type: zMessageType,
|
|
318
|
-
data: zMessageData,
|
|
319
|
-
address: z7.string().meta({ description: "Address of the signing key" }),
|
|
320
|
-
derivationPath: z7.string().meta({ description: "Derivation path of the signing key" }),
|
|
321
|
-
signature: zHsmSignature.meta({ description: "Signature of the message" }),
|
|
322
|
-
createdById: z7.string().meta({ description: "ID of the creator" }),
|
|
323
|
-
createdAt: z7.coerce.date().meta({ description: "Creation timestamp" })
|
|
324
|
-
}).meta({ description: "Signed message", id: "SignedMessageResponse" });
|
|
325
|
-
var zHexDataString = z7.codec(z7.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/), z7.string(), {
|
|
93
|
+
var NetworkFamily = omit(AccountType, ["RAW_SIGNING"]);
|
|
94
|
+
var zHexDataString = z10.codec(z10.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/), z10.string(), {
|
|
326
95
|
decode: (hex) => `0x${hex.toLowerCase().replace("0x", "")}`,
|
|
327
96
|
encode: (hex) => hex
|
|
328
97
|
});
|
|
329
|
-
var
|
|
98
|
+
var zCommonLiveData = z10.object({
|
|
99
|
+
id: z10.string().meta({ description: "Account internal unique identifier" }),
|
|
100
|
+
balance: z10.object({
|
|
101
|
+
total: z10.string().meta({ description: "Total balance" }),
|
|
102
|
+
pending: z10.string().meta({ description: "Pending balance" })
|
|
103
|
+
}).meta({ description: "Balance fields" })
|
|
104
|
+
});
|
|
105
|
+
var zCommonTransactionData = z10.object({
|
|
330
106
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
331
107
|
currency: zCurrencyString.meta({
|
|
332
108
|
description: "Will be deprecated soon, use Account.network. Transaction currency"
|
|
333
109
|
}),
|
|
334
110
|
// TODO: to remove, use account.network instead
|
|
335
111
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
336
|
-
recipient:
|
|
112
|
+
recipient: z10.string().nonempty().meta({ description: "Transaction recipient" })
|
|
337
113
|
});
|
|
338
|
-
var zFeeStrategyCustom =
|
|
339
|
-
type:
|
|
114
|
+
var zFeeStrategyCustom = z10.object({
|
|
115
|
+
type: z10.enum(["SLOW", "NORMAL", "FAST", "CUSTOM"])
|
|
340
116
|
});
|
|
341
|
-
var zFeeStrategy =
|
|
342
|
-
type:
|
|
117
|
+
var zFeeStrategy = z10.object({
|
|
118
|
+
type: z10.enum(["SLOW", "NORMAL", "FAST"])
|
|
343
119
|
});
|
|
120
|
+
var zTransactionStatus = z10.enum(["SUCCESSFUL", "FAILED"]);
|
|
121
|
+
var zCommonTransactionResponse = z10.object({
|
|
122
|
+
id: z10.string().meta({ description: "Internal unique identifier" }),
|
|
123
|
+
hash: z10.string().meta({ description: "Transaction hash" }),
|
|
124
|
+
block: z10.object({
|
|
125
|
+
height: z10.string().nullable().meta({ description: "Transaction block height" }),
|
|
126
|
+
time: z10.string().nullable().meta({ description: "Transaction block time" })
|
|
127
|
+
}),
|
|
128
|
+
status: zTransactionStatus.meta({ description: "Transaction status" }),
|
|
129
|
+
confirmations: z10.string().meta({ description: "Block confirmations" }),
|
|
130
|
+
amount: z10.string().meta({ description: "Transaction amount" }),
|
|
131
|
+
fee: z10.string().meta({ description: "Transaction fee" }),
|
|
132
|
+
senders: z10.array(z10.string()).meta({ description: "Senders (can be multiple for UTXOs-based accounts)" }),
|
|
133
|
+
recipients: z10.array(z10.string()).meta({ description: "Recipients (can be multiple for multi-output transactions)" })
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// src/networks/bitcoin.ts
|
|
137
|
+
var zBitcoinLikeAssetFields = z10.object({
|
|
138
|
+
type: z10.literal(NetworkFamily.BITCOIN_LIKE).meta({ description: "Account type" }),
|
|
139
|
+
xpub: z10.string().meta({ description: "xpub (extended public key)" })
|
|
140
|
+
}).meta({ description: "Bitcoin-like" });
|
|
141
|
+
var zBitcoinLikeLiveData = zCommonLiveData.extend({
|
|
142
|
+
type: z10.literal(NetworkFamily.BITCOIN_LIKE).meta({ description: "Account type" })
|
|
143
|
+
}).meta({ description: "Bitcoin-like" });
|
|
144
|
+
var zBitcoinLikeTransactionType = z10.enum(["BITCOIN_LIKE_SEND", "BITCOIN_LIKE_RECEIVE"]).meta({ description: "Bitcoin-like transaction type" });
|
|
344
145
|
var zBitcoinLikeFeeStrategy = zFeeStrategyCustom.extend({
|
|
345
146
|
// nullish is optional + nullable, it is easier to seed rather than just optional
|
|
346
147
|
feePerByte: zUnsignedIntString.nullish().meta({ description: "Fee per byte" })
|
|
347
148
|
}).meta({ description: "Bitcoin-like fee strategy" });
|
|
348
149
|
var zBitcoinLikeSendData = zCommonTransactionData.extend({
|
|
349
|
-
type:
|
|
150
|
+
type: z10.literal(zBitcoinLikeTransactionType.enum.BITCOIN_LIKE_SEND),
|
|
350
151
|
feeStrategy: zBitcoinLikeFeeStrategy
|
|
351
152
|
}).meta({
|
|
352
153
|
description: "Bitcoin-like send data",
|
|
353
154
|
id: "BitcoinLikeSendData"
|
|
354
155
|
});
|
|
156
|
+
var zBitcoinLikeTransactionData = z10.discriminatedUnion("type", [zBitcoinLikeSendData]);
|
|
157
|
+
var zBitcoinLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zBitcoinLikeTransactionType }).meta({ description: "Bitcoin-like transaction" });
|
|
158
|
+
var zCardanoLikeAssetFields = z10.object({
|
|
159
|
+
type: z10.literal(NetworkFamily.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
160
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
161
|
+
}).meta({ description: "Cardano-like" });
|
|
162
|
+
var zCardanoLikeStakingData = z10.object({
|
|
163
|
+
staked: z10.string().meta({ description: "Staked balance" })
|
|
164
|
+
}).nullable().meta({ description: "Cardano-like staking data" });
|
|
165
|
+
var zCardanoLikeStakingFields = z10.object({
|
|
166
|
+
type: z10.literal(NetworkFamily.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
167
|
+
staking: zCardanoLikeStakingData.optional()
|
|
168
|
+
});
|
|
169
|
+
var zCardanoLikeLiveData = zCommonLiveData.extend(zCardanoLikeStakingFields.shape).meta({ description: "Cardano-like" });
|
|
170
|
+
var zCardanoLikeTransactionType = z10.enum([
|
|
171
|
+
"CARDANO_LIKE_SEND",
|
|
172
|
+
"CARDANO_LIKE_RECEIVE",
|
|
173
|
+
"CARDANO_LIKE_STAKING_REGISTER",
|
|
174
|
+
"CARDANO_LIKE_STAKING_DEREGISTER",
|
|
175
|
+
"CARDANO_LIKE_STAKING_DELEGATE",
|
|
176
|
+
"CARDANO_LIKE_STAKING_WITHDRAW"
|
|
177
|
+
]).meta({ description: "Cardano-like transaction type" });
|
|
178
|
+
var zCardanoLikeSendData = zCommonTransactionData.extend({
|
|
179
|
+
type: z10.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_SEND),
|
|
180
|
+
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" })
|
|
181
|
+
}).meta({
|
|
182
|
+
description: "Cardano-like send data",
|
|
183
|
+
id: "CardanoSendData"
|
|
184
|
+
});
|
|
185
|
+
var zCardanoStakingDelegateData = z10.object({
|
|
186
|
+
type: z10.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DELEGATE),
|
|
187
|
+
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
188
|
+
// TODO: strict literal or enum?
|
|
189
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
190
|
+
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
191
|
+
// DELEGATE doesn't have neither amount nor recipient
|
|
192
|
+
stakePoolId: z10.string().min(1).max(100).meta({ description: "" })
|
|
193
|
+
}).meta({
|
|
194
|
+
description: "Cardano-like staking delegate",
|
|
195
|
+
id: "CardanoStakingDelegateData"
|
|
196
|
+
});
|
|
197
|
+
var zCardanoStakingDeregisterData = z10.object({
|
|
198
|
+
type: z10.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_DEREGISTER),
|
|
199
|
+
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
200
|
+
// TODO: strict literal or enum?
|
|
201
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
202
|
+
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
203
|
+
// DEREGISTER doesn't have a recipient
|
|
204
|
+
amount: zUnsignedIntString.meta({ description: "Amount to deregister" })
|
|
205
|
+
}).meta({
|
|
206
|
+
description: "Cardano-like staking deregister data",
|
|
207
|
+
id: "CardanoStakingDeregisterData"
|
|
208
|
+
});
|
|
209
|
+
var zCardanoStakingRegisterData = z10.object({
|
|
210
|
+
type: z10.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
211
|
+
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
212
|
+
// TODO: strict literal or enum?
|
|
213
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
214
|
+
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
215
|
+
// REGISTER doesn't have a recipient
|
|
216
|
+
amount: zUnsignedIntString.meta({ description: "Amount to register" })
|
|
217
|
+
}).meta({
|
|
218
|
+
description: "Cardano-like staking register data",
|
|
219
|
+
id: "CardanoStakingRegisterData"
|
|
220
|
+
});
|
|
221
|
+
var zCardanoStakingWithdrawData = z10.object({
|
|
222
|
+
type: z10.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_WITHDRAW),
|
|
223
|
+
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
224
|
+
// TODO: strict literal or enum?
|
|
225
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
226
|
+
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
227
|
+
// WITHDRAW doesn't have a recipient
|
|
228
|
+
amount: zUnsignedIntString.meta({ description: "Amount to withdraw" })
|
|
229
|
+
}).meta({
|
|
230
|
+
description: "Cardano-like staking withdraw data",
|
|
231
|
+
id: "CardanoStakingWithdrawData"
|
|
232
|
+
});
|
|
233
|
+
var zCardanoLikeTransactionData = z10.discriminatedUnion("type", [
|
|
234
|
+
zCardanoLikeSendData,
|
|
235
|
+
zCardanoStakingDelegateData,
|
|
236
|
+
zCardanoStakingDeregisterData,
|
|
237
|
+
zCardanoStakingRegisterData,
|
|
238
|
+
zCardanoStakingWithdrawData
|
|
239
|
+
]);
|
|
240
|
+
var zCardanoLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zCardanoLikeTransactionType }).meta({ description: "Cardano-like transaction" });
|
|
241
|
+
var zEthereumLikeAssetFields = z10.object({
|
|
242
|
+
type: z10.literal(NetworkFamily.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
243
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
244
|
+
}).meta({ description: "Ethereum-like" });
|
|
245
|
+
var zEthereumTokenLikeAssetFields = z10.object({
|
|
246
|
+
type: z10.enum([NetworkFamily.ERC20_LIKE, NetworkFamily.BEP20_LIKE]).meta({ description: "Account type" }),
|
|
247
|
+
address: z10.string().nullable().meta({ description: "Account address" }),
|
|
248
|
+
contractAddress: z10.string().meta({
|
|
249
|
+
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
250
|
+
}).optional()
|
|
251
|
+
}).meta({ description: "Ethereum-like token" });
|
|
252
|
+
var zEthereumLikeStakingData = z10.object({
|
|
253
|
+
totalStaking: z10.string().meta({ description: "Total staked amount" }),
|
|
254
|
+
totalRewards: z10.string().meta({ description: "Total of rewards" }),
|
|
255
|
+
availableRewards: z10.string().meta({ description: "Available rewards" }),
|
|
256
|
+
networkApy: z10.number().meta({ description: "Network APY" })
|
|
257
|
+
}).nullable().meta({ description: "Ethereum-like staking data" });
|
|
258
|
+
var zEthereumLikeStakingFields = z10.object({
|
|
259
|
+
type: z10.literal(NetworkFamily.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
260
|
+
staking: zEthereumLikeStakingData.optional()
|
|
261
|
+
});
|
|
262
|
+
var zEthereumLikeLiveData = zCommonLiveData.extend(zEthereumLikeStakingFields.shape).meta({ description: "Ethereum-like" });
|
|
263
|
+
var zEthereumTokenLikeLiveData = zCommonLiveData.extend({
|
|
264
|
+
type: z10.enum([NetworkFamily.ERC20_LIKE, NetworkFamily.BEP20_LIKE]).meta({ description: "Account type" })
|
|
265
|
+
}).meta({ description: "Ethereum-like token" });
|
|
266
|
+
var zEthereumLikeEstimatedFees = z10.object({
|
|
267
|
+
type: z10.literal(NetworkFamily.ETHEREUM_LIKE),
|
|
268
|
+
baseFees: zIntString,
|
|
269
|
+
gasLimit: zIntString,
|
|
270
|
+
nonce: z10.string(),
|
|
271
|
+
priorityFees: zIntString
|
|
272
|
+
}).meta({ description: "Ethereum-like fees" });
|
|
273
|
+
var zEthereumLikeTransferTransactionType = z10.enum(["ETHEREUM_LIKE_SEND", "ETHEREUM_LIKE_RECEIVE"]).meta({ description: "Ethereum-like transaction type" });
|
|
274
|
+
var zEthereumLikeContractTransactionType = z10.enum(["ETHEREUM_LIKE_EXECUTE_CONTRACT", "ETHEREUM_LIKE_DEPLOY_CONTRACT"]).meta({ description: "Ethereum-like transaction type" });
|
|
355
275
|
var zEthereumLikeLegacyFeeStrategy = zFeeStrategyCustom.extend({
|
|
356
276
|
gasPrice: zUnsignedIntString.meta({ description: "Gas price" }),
|
|
357
277
|
gasLimit: zUnsignedIntString.meta({ description: "Gas limit" })
|
|
@@ -361,14 +281,14 @@ var zEthereumLikeEip1559FeeStrategy = zFeeStrategyCustom.extend({
|
|
|
361
281
|
maxFeePerGas: zUnsignedIntString.meta({ description: "Maximum fee per gas (base + priority)" }),
|
|
362
282
|
gasLimit: zUnsignedIntString.meta({ description: "Gas limit" })
|
|
363
283
|
}).meta({ description: "Ethereum-like EIP-1559 fee strategy" });
|
|
364
|
-
var zEthereumLikeFeeStrategy =
|
|
284
|
+
var zEthereumLikeFeeStrategy = z10.union([zEthereumLikeLegacyFeeStrategy, zEthereumLikeEip1559FeeStrategy]).meta({
|
|
365
285
|
description: "Ethereum-like fee strategy",
|
|
366
286
|
id: "EthereumLikeFeeStrategy"
|
|
367
287
|
});
|
|
368
288
|
var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
369
|
-
type:
|
|
289
|
+
type: z10.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_DEPLOY_CONTRACT),
|
|
370
290
|
// force the recipient to be the zero address
|
|
371
|
-
recipient:
|
|
291
|
+
recipient: z10.literal("0x0000000000000000000000000000000000000000"),
|
|
372
292
|
contractData: zHexDataString.meta({ description: "Contract data in hexadecimal format" }),
|
|
373
293
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
374
294
|
}).meta({
|
|
@@ -376,7 +296,7 @@ var zEthereumLikeDeployContractData = zCommonTransactionData.extend({
|
|
|
376
296
|
id: "EthereumLikeDeployContractData"
|
|
377
297
|
});
|
|
378
298
|
var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
379
|
-
type:
|
|
299
|
+
type: z10.literal(zEthereumLikeContractTransactionType.enum.ETHEREUM_LIKE_EXECUTE_CONTRACT),
|
|
380
300
|
contractData: zHexDataString.meta({ description: "Contract call data in hexadecimal format" }),
|
|
381
301
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
382
302
|
}).meta({
|
|
@@ -384,71 +304,135 @@ var zEthereumLikeExecuteContractData = zCommonTransactionData.extend({
|
|
|
384
304
|
id: "EthereumLikeExecuteContractData"
|
|
385
305
|
});
|
|
386
306
|
var zEthereumLikeSendData = zCommonTransactionData.extend({
|
|
387
|
-
type:
|
|
307
|
+
type: z10.literal(zEthereumLikeTransferTransactionType.enum.ETHEREUM_LIKE_SEND),
|
|
388
308
|
feeStrategy: zEthereumLikeFeeStrategy
|
|
389
309
|
}).meta({
|
|
390
310
|
description: "Ethereum-like send data",
|
|
391
311
|
id: "EthereumLikeSendData"
|
|
392
312
|
});
|
|
393
|
-
var zEthereumLikeTransactionData =
|
|
313
|
+
var zEthereumLikeTransactionData = z10.discriminatedUnion("type", [
|
|
394
314
|
zEthereumLikeDeployContractData,
|
|
395
315
|
zEthereumLikeExecuteContractData,
|
|
396
316
|
zEthereumLikeSendData
|
|
397
317
|
]);
|
|
398
|
-
var
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
description: "Tezos-like send data",
|
|
404
|
-
id: "TezosLikeSendData"
|
|
318
|
+
var zEthereumLikeTransferCoinFields = z10.object({
|
|
319
|
+
type: zEthereumLikeTransferTransactionType,
|
|
320
|
+
gasPrice: z10.string(),
|
|
321
|
+
gasLimit: z10.string(),
|
|
322
|
+
nonce: z10.string()
|
|
405
323
|
});
|
|
406
|
-
var
|
|
407
|
-
type:
|
|
408
|
-
|
|
409
|
-
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
410
|
-
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
411
|
-
recipient: z7.string().nonempty().meta({ description: "Transaction recipient" }),
|
|
412
|
-
feeStrategy: zTezosLikeFeeStrategy
|
|
413
|
-
}).meta({
|
|
414
|
-
description: "Tezos-like delegate data",
|
|
415
|
-
id: "TezosLikeDelegateData"
|
|
324
|
+
var zEthereumLikeContractCoinFields = zEthereumLikeTransferCoinFields.extend({
|
|
325
|
+
type: zEthereumLikeContractTransactionType,
|
|
326
|
+
contractData: z10.string().meta({ description: "Contract deployment or contract execution data" })
|
|
416
327
|
});
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
|
|
328
|
+
var zEthereumLikeTransferTransactionResponse = zCommonTransactionResponse.extend(zEthereumLikeTransferCoinFields.shape).meta({ description: "Ethereum-like transfer transaction" });
|
|
329
|
+
var zEthereumLikeContractTransactionResponse = zCommonTransactionResponse.extend(zEthereumLikeContractCoinFields.shape).meta({ description: "Ethereum-like contract transaction" });
|
|
330
|
+
var zGenericLikeAssetFields = z10.object({ type: z10.literal(NetworkFamily.GENERIC_LIKE).meta({ description: "Account type" }) }).meta({ description: "Generic-like" });
|
|
331
|
+
var zGenericLikeLiveData = zCommonLiveData.extend({
|
|
332
|
+
type: z10.literal(NetworkFamily.GENERIC_LIKE).meta({ description: "Account type" })
|
|
333
|
+
}).meta({ description: "Generic-like" });
|
|
334
|
+
var zGenericTransactionType = z10.enum(["GENERIC_TRANSACTION"]).meta({ description: "Generic transaction type" });
|
|
335
|
+
var zGenericTransactionData = z10.object({
|
|
336
|
+
type: z10.literal(zGenericTransactionType.enum.GENERIC_TRANSACTION),
|
|
420
337
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
421
|
-
|
|
422
|
-
recipient: z7.string().nonempty().optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
423
|
-
feeStrategy: zTezosLikeFeeStrategy
|
|
338
|
+
rawTx: z10.string().meta({ description: "Raw tx" })
|
|
424
339
|
}).meta({
|
|
425
|
-
description: "
|
|
426
|
-
id: "
|
|
340
|
+
description: "Generic transaction data",
|
|
341
|
+
id: "GenericTransactionData"
|
|
427
342
|
});
|
|
428
|
-
var
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var
|
|
434
|
-
|
|
435
|
-
|
|
343
|
+
var zGenericTransactionResponse = zCommonTransactionResponse.extend({ type: zGenericTransactionType }).meta({ description: "Generic transaction" });
|
|
344
|
+
var zPolkadotLikeAssetFields = z10.object({
|
|
345
|
+
type: z10.literal(NetworkFamily.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
346
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
347
|
+
}).meta({ description: "Polkadot-like" });
|
|
348
|
+
var zPolkadotUnbondingAmount = z10.object({
|
|
349
|
+
amount: z10.string().meta({ description: "Amount" }),
|
|
350
|
+
waiting_time: z10.string().meta({ description: "Waiting time" })
|
|
351
|
+
});
|
|
352
|
+
var zPolkadotLikeStakingData = z10.object({
|
|
353
|
+
info: z10.object({
|
|
354
|
+
controllerAddress: z10.string().nullable().meta({ description: "Controller address" }),
|
|
355
|
+
rewardsDestination: z10.string().nullable().meta({ description: "Rewards destination" }),
|
|
356
|
+
proxies: z10.array(z10.string()).meta({ description: "Proxies" }),
|
|
357
|
+
legacyStaking: z10.boolean().meta({ description: "True if account uses legacy staking" }),
|
|
358
|
+
isNominator: z10.boolean().meta({ description: "True if is nominator" })
|
|
359
|
+
}),
|
|
360
|
+
balances: z10.object({
|
|
361
|
+
free: z10.string().meta({ description: "Free balance" }),
|
|
362
|
+
reserved: z10.string().meta({ description: "Reserved balance" }),
|
|
363
|
+
frozen: z10.string().meta({ description: "Frozen balance" }),
|
|
364
|
+
bonded: z10.string().meta({ description: "Bonded balance" }),
|
|
365
|
+
available: z10.string().meta({ description: "Available balance" }),
|
|
366
|
+
unbonding: z10.array(zPolkadotUnbondingAmount).meta({ description: "Unbonding balances" }),
|
|
367
|
+
unbonded: z10.array(zPolkadotUnbondingAmount).meta({ description: "Unbonded balances" }),
|
|
368
|
+
totalUnbonding: z10.string().meta({ description: "Total unbonding" }),
|
|
369
|
+
totalUnbonded: z10.string().meta({ description: "Total unbonded" })
|
|
370
|
+
}),
|
|
371
|
+
anonymousProxy: z10.object({
|
|
372
|
+
address: z10.string().meta({ description: "Address" }),
|
|
373
|
+
createdAt: z10.string().meta({ description: "Creation date" }),
|
|
374
|
+
isController: z10.boolean().meta({ description: "True if is controller" }),
|
|
375
|
+
isMain: z10.boolean().meta({ description: "True if is main" }),
|
|
376
|
+
balances: z10.object({
|
|
377
|
+
free: z10.string().meta({ description: "Anonymous proxy free balance" }),
|
|
378
|
+
reserved: z10.string().meta({ description: "Anonymous proxy reserved balance" }),
|
|
379
|
+
frozen: z10.string().meta({ description: "Anonymous proxy frozen balance" }),
|
|
380
|
+
bonded: z10.string().meta({ description: "Anonymous proxy bonded balance" }),
|
|
381
|
+
available: z10.string().meta({ description: "Anonymous proxy available balance" }),
|
|
382
|
+
total: z10.string().meta({ description: "Anonymous proxy total balance" })
|
|
383
|
+
}).nullable(),
|
|
384
|
+
blockHeight: z10.string().meta({ description: "Anonymous proxy block height" }),
|
|
385
|
+
extIndex: z10.string().meta({ description: "Ext index" }),
|
|
386
|
+
index: z10.string().meta({ description: "Index" }),
|
|
387
|
+
kind: z10.string().meta({ description: "Kind" })
|
|
388
|
+
}).nullable().meta({ description: "Anonymous proxy" })
|
|
389
|
+
}).nullable().meta({ description: "Polkadot-like staking data" });
|
|
390
|
+
var zPolkadotLikeStakingFields = z10.object({
|
|
391
|
+
type: z10.literal(NetworkFamily.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
392
|
+
staking: zPolkadotLikeStakingData.optional()
|
|
393
|
+
});
|
|
394
|
+
var zPolkadotLikeLiveData = zCommonLiveData.extend(zPolkadotLikeStakingFields.shape).meta({ description: "Polkadot-like" });
|
|
395
|
+
var zPolkadotLikeTransactionType = z10.enum([
|
|
396
|
+
"POLKADOT_LIKE_SEND",
|
|
397
|
+
"POLKADOT_LIKE_RECEIVE",
|
|
398
|
+
"POLKADOT_LIKE_ADDPROXY",
|
|
399
|
+
"POLKADOT_LIKE_REMOVEPROXY",
|
|
400
|
+
"POLKADOT_LIKE_BOND",
|
|
401
|
+
"POLKADOT_LIKE_REBOND",
|
|
402
|
+
"POLKADOT_LIKE_BONDEXTRA",
|
|
403
|
+
"POLKADOT_LIKE_UNBOND",
|
|
404
|
+
"POLKADOT_LIKE_WITHDRAWUNBONDED",
|
|
405
|
+
"POLKADOT_LIKE_SETCONTROLLER",
|
|
406
|
+
"POLKADOT_LIKE_SETPAYEE",
|
|
407
|
+
"POLKADOT_LIKE_PROXY",
|
|
408
|
+
"POLKADOT_LIKE_ANONYMOUSPROXY",
|
|
409
|
+
"POLKADOT_LIKE_KILLANONYMOUS",
|
|
410
|
+
"POLKADOT_LIKE_PUREPROXY",
|
|
411
|
+
"POLKADOT_LIKE_KILLPURE",
|
|
412
|
+
"POLKADOT_LIKE_NOMINATE",
|
|
413
|
+
"POLKADOT_LIKE_REWARD",
|
|
414
|
+
"POLKADOT_LIKE_CHILL",
|
|
415
|
+
"POLKADOT_LIKE_TRANSFERALL"
|
|
416
|
+
]).meta({ description: "Polkadot-like transaction type" });
|
|
417
|
+
var zPolkadotRewardDestination = z10.enum(["Staked", "Stash"]);
|
|
418
|
+
var zPolkadotLikeAddProxyData = z10.object({
|
|
419
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ADDPROXY),
|
|
436
420
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
437
|
-
kind:
|
|
438
|
-
proxy:
|
|
421
|
+
kind: z10.literal("Staking").meta({ description: "Proxy kind" }),
|
|
422
|
+
proxy: z10.string().meta({ description: "Proxy address" })
|
|
439
423
|
}).meta({
|
|
440
424
|
description: "Polkadot-like add proxy data",
|
|
441
425
|
id: "PolkadotLikeAddProxyData"
|
|
442
426
|
});
|
|
443
|
-
var zPolkadotLikeAnonymousProxyData =
|
|
444
|
-
type:
|
|
427
|
+
var zPolkadotLikeAnonymousProxyData = z10.object({
|
|
428
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_ANONYMOUSPROXY),
|
|
445
429
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
446
430
|
}).meta({
|
|
447
431
|
description: "Polkadot-like anonymous proxy data",
|
|
448
432
|
id: "PolkadotLikeAnonymousProxyData"
|
|
449
433
|
});
|
|
450
|
-
var zPolkadotLikeBondData =
|
|
451
|
-
type:
|
|
434
|
+
var zPolkadotLikeBondData = z10.object({
|
|
435
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BOND),
|
|
452
436
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
453
437
|
payee: zPolkadotRewardDestination,
|
|
454
438
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
@@ -456,75 +440,75 @@ var zPolkadotLikeBondData = z7.object({
|
|
|
456
440
|
description: "Polkadot-like bond data",
|
|
457
441
|
id: "PolkadotLikeBondData"
|
|
458
442
|
});
|
|
459
|
-
var zPolkadotLikeBondExtraData =
|
|
460
|
-
type:
|
|
443
|
+
var zPolkadotLikeBondExtraData = z10.object({
|
|
444
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_BONDEXTRA),
|
|
461
445
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
462
446
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
463
447
|
}).meta({
|
|
464
448
|
description: "Polkadot-like bond extra data",
|
|
465
449
|
id: "PolkadotLikeBondExtraData"
|
|
466
450
|
});
|
|
467
|
-
var zPolkadotLikeChillData =
|
|
468
|
-
type:
|
|
451
|
+
var zPolkadotLikeChillData = z10.object({
|
|
452
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_CHILL),
|
|
469
453
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
470
454
|
}).meta({
|
|
471
455
|
description: "Polkadot-like chill data",
|
|
472
456
|
id: "PolkadotLikeChillData"
|
|
473
457
|
});
|
|
474
|
-
var zPolkadotLikeKillAnonymousData =
|
|
475
|
-
type:
|
|
458
|
+
var zPolkadotLikeKillAnonymousData = z10.object({
|
|
459
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_KILLANONYMOUS),
|
|
476
460
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
477
461
|
}).meta({
|
|
478
462
|
description: "Polkadot-like kill anonymous data",
|
|
479
463
|
id: "PolkadotLikeKillAnonymousData"
|
|
480
464
|
});
|
|
481
|
-
var zPolkadotLikeRebondData =
|
|
482
|
-
type:
|
|
465
|
+
var zPolkadotLikeRebondData = z10.object({
|
|
466
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REBOND),
|
|
483
467
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
484
468
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
485
469
|
}).meta({
|
|
486
470
|
description: "Polkadot-like rebond data",
|
|
487
471
|
id: "PolkadotLikeRebondData"
|
|
488
472
|
});
|
|
489
|
-
var zPolkadotLikeRemoveProxyData =
|
|
490
|
-
type:
|
|
473
|
+
var zPolkadotLikeRemoveProxyData = z10.object({
|
|
474
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_REMOVEPROXY),
|
|
491
475
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
492
|
-
kind:
|
|
493
|
-
proxy:
|
|
476
|
+
kind: z10.literal("Staking"),
|
|
477
|
+
proxy: z10.string().meta({ description: "Proxy address" })
|
|
494
478
|
}).meta({
|
|
495
479
|
description: "Polkadot-like remove proxy data",
|
|
496
480
|
id: "PolkadotLikeRemoveProxyData"
|
|
497
481
|
});
|
|
498
482
|
var zPolkadotLikeSendData = zCommonTransactionData.extend({
|
|
499
|
-
type:
|
|
483
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SEND)
|
|
500
484
|
}).meta({
|
|
501
485
|
description: "Polkadot-like send data",
|
|
502
486
|
id: "PolkadotLikeSendData"
|
|
503
487
|
});
|
|
504
|
-
var zPolkadotLikeSetPayeeData =
|
|
505
|
-
type:
|
|
488
|
+
var zPolkadotLikeSetPayeeData = z10.object({
|
|
489
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_SETPAYEE),
|
|
506
490
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
507
491
|
payee: zPolkadotRewardDestination
|
|
508
492
|
}).meta({
|
|
509
493
|
description: "Polkadot-like set payee data",
|
|
510
494
|
id: "PolkadotLikeSetPayeeData"
|
|
511
495
|
});
|
|
512
|
-
var zPolkadotLikeUnbondData =
|
|
513
|
-
type:
|
|
496
|
+
var zPolkadotLikeUnbondData = z10.object({
|
|
497
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_UNBOND),
|
|
514
498
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
515
499
|
amount: zUnsignedIntString.meta({ description: "Amount" })
|
|
516
500
|
}).meta({
|
|
517
501
|
description: "Polkadot-like unbond data",
|
|
518
502
|
id: "PolkadotLikeUnbondData"
|
|
519
503
|
});
|
|
520
|
-
var zPolkadotLikeWithdrawUnbondedData =
|
|
521
|
-
type:
|
|
504
|
+
var zPolkadotLikeWithdrawUnbondedData = z10.object({
|
|
505
|
+
type: z10.literal(zPolkadotLikeTransactionType.enum.POLKADOT_LIKE_WITHDRAWUNBONDED),
|
|
522
506
|
currency: zCurrencyString.meta({ description: "Transaction currency" })
|
|
523
507
|
}).meta({
|
|
524
508
|
description: "Polkadot-like withdraw unbonded data",
|
|
525
509
|
id: "PolkadotLikeWithdrawUnbondedData"
|
|
526
510
|
});
|
|
527
|
-
var zPolkadotLikeTransactionData =
|
|
511
|
+
var zPolkadotLikeTransactionData = z10.discriminatedUnion("type", [
|
|
528
512
|
zPolkadotLikeAddProxyData,
|
|
529
513
|
zPolkadotLikeAnonymousProxyData,
|
|
530
514
|
zPolkadotLikeBondData,
|
|
@@ -538,74 +522,129 @@ var zPolkadotLikeTransactionData = z7.discriminatedUnion("type", [
|
|
|
538
522
|
zPolkadotLikeUnbondData,
|
|
539
523
|
zPolkadotLikeWithdrawUnbondedData
|
|
540
524
|
]);
|
|
525
|
+
var zPolkadotLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zPolkadotLikeTransactionType }).meta({ description: "Polkadot-like transaction" });
|
|
526
|
+
var zRippleLikeAssetFields = z10.object({
|
|
527
|
+
type: z10.literal(NetworkFamily.RIPPLE_LIKE).meta({ description: "Account type" }),
|
|
528
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
529
|
+
}).meta({ description: "Ripple-like" });
|
|
530
|
+
var zRippleLikeLiveData = zCommonLiveData.extend({
|
|
531
|
+
type: z10.literal(NetworkFamily.RIPPLE_LIKE).meta({ description: "Account type" })
|
|
532
|
+
}).meta({ description: "Ripple-like" });
|
|
533
|
+
var zRippleLikeEstimatedFees = z10.object({
|
|
534
|
+
type: z10.literal(NetworkFamily.RIPPLE_LIKE),
|
|
535
|
+
fee: zIntString
|
|
536
|
+
}).meta({ description: "Ripple-like fees" });
|
|
537
|
+
var zRippleLikeTransactionType = z10.enum(["RIPPLE_LIKE_SEND", "RIPPLE_LIKE_RECEIVE"]).meta({ description: "Ripple-like transaction type" });
|
|
541
538
|
var zRippleLikeSendData = zCommonTransactionData.extend({
|
|
542
|
-
type:
|
|
539
|
+
type: z10.literal(zRippleLikeTransactionType.enum.RIPPLE_LIKE_SEND),
|
|
543
540
|
destinationTag: zIntString.nullable().meta({ description: "Destination tag" }),
|
|
544
541
|
feeStrategy: zFeeStrategyCustom.meta({ description: "Ripple-like fee strategy" })
|
|
545
542
|
}).meta({
|
|
546
543
|
description: "Ripple-like send data",
|
|
547
544
|
id: "RippleLikeSendData"
|
|
548
545
|
});
|
|
549
|
-
var
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
]);
|
|
563
|
-
var
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
546
|
+
var zRippleLikeTransactionData = z10.discriminatedUnion("type", [zRippleLikeSendData]);
|
|
547
|
+
var zRippleLikeTransactionResponse = zCommonTransactionResponse.extend({
|
|
548
|
+
type: zRippleLikeTransactionType,
|
|
549
|
+
memos: z10.array(z10.string()),
|
|
550
|
+
destinationTag: z10.string()
|
|
551
|
+
}).meta({ description: "Ripple-like transaction" });
|
|
552
|
+
var zSolanaLikeAssetFields = z10.object({
|
|
553
|
+
type: z10.literal(NetworkFamily.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
554
|
+
address: z10.string().nullable().meta({ description: "Account address" }),
|
|
555
|
+
contractAddress: z10.string().meta({
|
|
556
|
+
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
557
|
+
}).nullable().optional()
|
|
558
|
+
}).meta({ description: "Solana-like" });
|
|
559
|
+
var zSolanaStakingAccountStatus = z10.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).meta({ description: "Staking account status" });
|
|
560
|
+
var zSolanaLikeStakingData = z10.object({
|
|
561
|
+
staked: z10.string().meta({ description: "Staked balance" }),
|
|
562
|
+
rewards: z10.object({
|
|
563
|
+
total: z10.string().meta({ description: "Total rewards" }),
|
|
564
|
+
last7: z10.string().meta({ description: "Rewards on last 7 days" }),
|
|
565
|
+
last30: z10.string().meta({ description: "Rewards on last 30 days" })
|
|
566
|
+
}),
|
|
567
|
+
stakes: z10.array(
|
|
568
|
+
z10.object({
|
|
569
|
+
uid: z10.string(),
|
|
570
|
+
baseAccountUid: z10.string(),
|
|
571
|
+
pubKey: z10.string().meta({ description: "Public key" }),
|
|
572
|
+
validatorPubKey: z10.string().nullable().meta({ description: "Validator public key" }),
|
|
573
|
+
initialAmount: z10.string().meta({ description: "Initial amount" }),
|
|
574
|
+
activeAmount: z10.string().meta({ description: "Active amount" }),
|
|
575
|
+
inactiveAmount: z10.string().meta({ description: "Inactive amount" }),
|
|
576
|
+
totalBalance: z10.string().meta({ description: "Total balance" }),
|
|
577
|
+
creationDate: z10.string().meta({ description: "Creation date" }),
|
|
578
|
+
activationEpoch: z10.string().nullable().meta({ description: "Activation epoch" }),
|
|
579
|
+
activationDate: z10.string().nullable().meta({ description: "Activation date" }),
|
|
580
|
+
deactivationEpoch: z10.string().nullable().meta({ description: "Deactivation epoch" }),
|
|
581
|
+
deactivationDate: z10.string().nullable().meta({ description: "Deactivation date" }),
|
|
582
|
+
status: zSolanaStakingAccountStatus,
|
|
583
|
+
rentExemptReserve: z10.string().meta({ description: "Rent exempt reserve" }),
|
|
584
|
+
withdrawableAmount: z10.string().meta({ description: "Withdrawable amount" }),
|
|
585
|
+
totalRewards: z10.string().meta({ description: "Total rewards" }),
|
|
586
|
+
creationTxHash: z10.string().nullable().meta({ description: "Creation transaction hash" }),
|
|
587
|
+
actionsTxHashes: z10.array(z10.string()).meta({ description: "Actions transactions hashes" })
|
|
588
|
+
})
|
|
589
|
+
)
|
|
590
|
+
}).nullable().meta({ description: "Solana-like staking data" });
|
|
591
|
+
var zSolanaLikeStakingFields = z10.object({
|
|
592
|
+
type: z10.literal(NetworkFamily.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
593
|
+
staking: zSolanaLikeStakingData.optional()
|
|
570
594
|
});
|
|
595
|
+
var zSolanaLikeLiveData = zCommonLiveData.extend(zSolanaLikeStakingFields.shape).meta({ description: "Solana-like" });
|
|
596
|
+
var zSolanaLikeTransactionType = z10.enum([
|
|
597
|
+
"SOLANA_LIKE_SEND",
|
|
598
|
+
"SOLANA_LIKE_RECEIVE",
|
|
599
|
+
"SOLANA_LIKE_CREATE_DELEGATE_STAKE",
|
|
600
|
+
"SOLANA_LIKE_DELEGATE_STAKE",
|
|
601
|
+
"SOLANA_LIKE_WITHDRAW_STAKE",
|
|
602
|
+
"SOLANA_LIKE_DEACTIVATE_STAKE",
|
|
603
|
+
"SOLANA_LIKE_SPLIT_STAKE",
|
|
604
|
+
"SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE",
|
|
605
|
+
"SOLANA_LIKE_MERGE_STAKE",
|
|
606
|
+
"SOLANA_LIKE_SEND_TOKEN",
|
|
607
|
+
"SOLANA_LIKE_FUND_AND_SEND_TOKEN",
|
|
608
|
+
"SOLANA_LIKE_CREATE_SPL_TOKEN_ACCOUNT"
|
|
609
|
+
]).meta({ description: "Solana-like transaction type" });
|
|
571
610
|
var zSolanaLikeCreateDelegateStakeData = zCommonTransactionData.extend({
|
|
572
|
-
type:
|
|
573
|
-
recipient:
|
|
611
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_DELEGATE_STAKE),
|
|
612
|
+
recipient: z10.string().meta({ description: "Delegated vote address" }),
|
|
574
613
|
// Re-described
|
|
575
614
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
576
615
|
}).meta({
|
|
577
616
|
description: "Solana-like create delegate stake data",
|
|
578
617
|
id: "SolanaLikeCreateDelegateStakeData"
|
|
579
618
|
});
|
|
580
|
-
var zSolanaLikeDeactivateStakeData =
|
|
581
|
-
type:
|
|
619
|
+
var zSolanaLikeDeactivateStakeData = z10.object({
|
|
620
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DEACTIVATE_STAKE),
|
|
582
621
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
583
622
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
584
|
-
stakeAccount:
|
|
623
|
+
stakeAccount: z10.string().meta({ description: "Stake account address" }),
|
|
585
624
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
586
625
|
// No recipient, no amount
|
|
587
626
|
}).meta({
|
|
588
627
|
description: "Solana-like deactivate stake data",
|
|
589
628
|
id: "SolanaLikeDeactivateStakeData"
|
|
590
629
|
});
|
|
591
|
-
var zSolanaLikeDelegateStakeData =
|
|
592
|
-
type:
|
|
630
|
+
var zSolanaLikeDelegateStakeData = z10.object({
|
|
631
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_DELEGATE_STAKE),
|
|
593
632
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
594
633
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
595
|
-
recipient:
|
|
596
|
-
stakeAccount:
|
|
634
|
+
recipient: z10.string().meta({ description: "Delegated vote address" }),
|
|
635
|
+
stakeAccount: z10.string().meta({ description: "Stake account address" }),
|
|
597
636
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
598
637
|
// No amount
|
|
599
638
|
}).meta({
|
|
600
639
|
description: "Solana-like delegate stake data",
|
|
601
640
|
id: "SolanaLikeDelegateStakeData"
|
|
602
641
|
});
|
|
603
|
-
var zSolanaLikeMergeStakeData =
|
|
604
|
-
type:
|
|
642
|
+
var zSolanaLikeMergeStakeData = z10.object({
|
|
643
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_MERGE_STAKE),
|
|
605
644
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
606
645
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
607
|
-
mergeSrcAccount:
|
|
608
|
-
mergeDstAccount:
|
|
646
|
+
mergeSrcAccount: z10.string().meta({ description: "Source stake address" }),
|
|
647
|
+
mergeDstAccount: z10.string().meta({ description: "Destination stake address" }),
|
|
609
648
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
610
649
|
// No recipient, no amount
|
|
611
650
|
}).meta({
|
|
@@ -613,42 +652,42 @@ var zSolanaLikeMergeStakeData = z7.object({
|
|
|
613
652
|
id: "SolanaLikeMergeStakeData"
|
|
614
653
|
});
|
|
615
654
|
var zSolanaLikeSendData = zCommonTransactionData.extend({
|
|
616
|
-
type:
|
|
655
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND),
|
|
617
656
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
618
657
|
}).meta({
|
|
619
658
|
description: "Solana-like send data",
|
|
620
659
|
id: "SolanaLikeSendData"
|
|
621
660
|
});
|
|
622
|
-
var zSolanaLikeSplitDeactivateStakeData =
|
|
623
|
-
type:
|
|
661
|
+
var zSolanaLikeSplitDeactivateStakeData = z10.object({
|
|
662
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_DEACTIVATE_STAKE),
|
|
624
663
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
625
664
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
626
665
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
627
|
-
stakeAccount:
|
|
666
|
+
stakeAccount: z10.string().meta({ description: "Stake account address" }),
|
|
628
667
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
629
668
|
// No recipient
|
|
630
669
|
}).meta({
|
|
631
670
|
description: "Solana-like split deactivate stake data",
|
|
632
671
|
id: "SolanaLikeSplitDeactivateStakeData"
|
|
633
672
|
});
|
|
634
|
-
var zSolanaLikeSplitStakeData =
|
|
635
|
-
type:
|
|
673
|
+
var zSolanaLikeSplitStakeData = z10.object({
|
|
674
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SPLIT_STAKE),
|
|
636
675
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
637
676
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
638
677
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
639
|
-
stakeAccount:
|
|
678
|
+
stakeAccount: z10.string().meta({ description: "Stake account address" }),
|
|
640
679
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
641
680
|
// No recipient
|
|
642
681
|
}).meta({
|
|
643
682
|
description: "Solana-like split stake data",
|
|
644
683
|
id: "SolanaLikeSplitStakeData"
|
|
645
684
|
});
|
|
646
|
-
var zSolanaLikeWithdrawStakeData =
|
|
647
|
-
type:
|
|
685
|
+
var zSolanaLikeWithdrawStakeData = z10.object({
|
|
686
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_WITHDRAW_STAKE),
|
|
648
687
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
649
688
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
650
689
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
651
|
-
stakeAccount:
|
|
690
|
+
stakeAccount: z10.string().meta({ description: "Stake account address" }),
|
|
652
691
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
653
692
|
// No recipient
|
|
654
693
|
}).meta({
|
|
@@ -656,21 +695,21 @@ var zSolanaLikeWithdrawStakeData = z7.object({
|
|
|
656
695
|
id: "SolanaLikeWithdrawStakeData"
|
|
657
696
|
});
|
|
658
697
|
var zSolanaLikeSendTokenData = zCommonTransactionData.extend({
|
|
659
|
-
type:
|
|
698
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_SEND_TOKEN),
|
|
660
699
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
661
700
|
}).meta({
|
|
662
701
|
description: "Solana-like send token data",
|
|
663
702
|
id: "SolanaLikeSendTokenData"
|
|
664
703
|
});
|
|
665
704
|
var zSolanaLikeFundAndSendTokenData = zCommonTransactionData.extend({
|
|
666
|
-
type:
|
|
705
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_FUND_AND_SEND_TOKEN),
|
|
667
706
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
668
707
|
}).meta({
|
|
669
708
|
description: "Solana-like fund token account and send token data",
|
|
670
709
|
id: "SolanaLikeFundAndSendTokenData"
|
|
671
710
|
});
|
|
672
|
-
var zSolanaLikeCreateTokenAccountData =
|
|
673
|
-
type:
|
|
711
|
+
var zSolanaLikeCreateTokenAccountData = z10.object({
|
|
712
|
+
type: z10.literal(zSolanaLikeTransactionType.enum.SOLANA_LIKE_CREATE_SPL_TOKEN_ACCOUNT),
|
|
674
713
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
675
714
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
676
715
|
feeStrategy: zFeeStrategy.meta({ description: "Solana-like fee strategy" })
|
|
@@ -678,7 +717,7 @@ var zSolanaLikeCreateTokenAccountData = z7.object({
|
|
|
678
717
|
description: "Solana-like create token account",
|
|
679
718
|
id: "SolanaLikeCreateTokenAccountData"
|
|
680
719
|
});
|
|
681
|
-
var zSolanaLikeTransactionData =
|
|
720
|
+
var zSolanaLikeTransactionData = z10.discriminatedUnion("type", [
|
|
682
721
|
zSolanaLikeCreateDelegateStakeData,
|
|
683
722
|
zSolanaLikeDeactivateStakeData,
|
|
684
723
|
zSolanaLikeDelegateStakeData,
|
|
@@ -691,84 +730,84 @@ var zSolanaLikeTransactionData = z7.discriminatedUnion("type", [
|
|
|
691
730
|
zSolanaLikeFundAndSendTokenData,
|
|
692
731
|
zSolanaLikeCreateTokenAccountData
|
|
693
732
|
]);
|
|
694
|
-
var
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
})
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
description: "
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
})
|
|
725
|
-
var zCardanoStakingRegisterData = z7.object({
|
|
726
|
-
type: z7.literal(zCardanoLikeTransactionType.enum.CARDANO_LIKE_STAKING_REGISTER),
|
|
727
|
-
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
728
|
-
// TODO: strict literal or enum?
|
|
729
|
-
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
730
|
-
feeStrategy: zFeeStrategy.meta({ description: "Cardano-like fee strategy" }),
|
|
731
|
-
// REGISTER doesn't have a recipient
|
|
732
|
-
amount: zUnsignedIntString.meta({ description: "Amount to register" })
|
|
733
|
+
var zSolanaLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zSolanaLikeTransactionType }).meta({ description: "Solana-like transaction" });
|
|
734
|
+
var zStellarLikeAssetFields = z10.object({
|
|
735
|
+
type: z10.literal(NetworkFamily.STELLAR_LIKE).meta({ description: "Account type" }),
|
|
736
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
737
|
+
}).meta({ description: "Stellar-like" });
|
|
738
|
+
var zStellarLikeLiveData = zCommonLiveData.extend({
|
|
739
|
+
type: z10.literal(NetworkFamily.STELLAR_LIKE).meta({ description: "Account type" })
|
|
740
|
+
}).meta({ description: "Stellar-like" });
|
|
741
|
+
var zStellarLikeEstimatedFees = z10.object({
|
|
742
|
+
type: z10.literal(NetworkFamily.STELLAR_LIKE),
|
|
743
|
+
fee: zIntString
|
|
744
|
+
}).meta({ description: "Stellar-like fees" });
|
|
745
|
+
var zStellarLikeTransactionType = z10.enum(["STELLAR_LIKE_SEND", "STELLAR_LIKE_RECEIVE"]).meta({ description: "Stellar-like transaction type" });
|
|
746
|
+
var zStellarMemo = z10.union([
|
|
747
|
+
z10.object({
|
|
748
|
+
MEMO_TEXT: z10.string().max(28).meta({ description: "Text memo (at most a 28 bytes string)" })
|
|
749
|
+
}).meta({ description: "Text memo" }),
|
|
750
|
+
z10.object({ MEMO_ID: zIntString.meta({ description: "Id memo (unsigned 64 bits integer)" }) }).meta({ description: "Id memo" }),
|
|
751
|
+
z10.object({
|
|
752
|
+
MEMO_HASH: z10.string().max(128).regex(/^[a-fA-F0-9]+$/).meta({ description: "Transaction hash memo (64 bytes hexadecimal string)" })
|
|
753
|
+
}).meta({ description: "Hash memo" }),
|
|
754
|
+
z10.object({
|
|
755
|
+
MEMO_RETURN: z10.string().max(128).regex(/^[a-fA-F0-9]+$/).meta({
|
|
756
|
+
description: "A 64 bytes hexadecimal string intended to be interpreted as the hash of the transaction the sender is refunding."
|
|
757
|
+
})
|
|
758
|
+
}).meta({ description: "Return memo" })
|
|
759
|
+
]);
|
|
760
|
+
var zStellarLikeSendData = zCommonTransactionData.extend({
|
|
761
|
+
type: z10.literal(zStellarLikeTransactionType.enum.STELLAR_LIKE_SEND),
|
|
762
|
+
memo: zStellarMemo.nullable().meta({ description: "Stellar memo" }),
|
|
763
|
+
feeStrategy: zFeeStrategy.meta({ description: "Stellar-like fee strategy" })
|
|
733
764
|
}).meta({
|
|
734
|
-
description: "
|
|
735
|
-
id: "
|
|
765
|
+
description: "Stellar-like send data",
|
|
766
|
+
id: "StellarLikeSendData"
|
|
736
767
|
});
|
|
737
|
-
var
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
768
|
+
var zStellarLikeTransactionData = z10.discriminatedUnion("type", [zStellarLikeSendData]);
|
|
769
|
+
var zStellarLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zStellarLikeTransactionType }).meta({ description: "Stellar-like transaction" });
|
|
770
|
+
var zSuiLikeAssetFields = z10.object({
|
|
771
|
+
type: z10.literal(NetworkFamily.SUI_LIKE).meta({ description: "Account type" }),
|
|
772
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
773
|
+
}).meta({ description: "Sui-like" });
|
|
774
|
+
var zSuiLikeStakingData = z10.object({
|
|
775
|
+
totalStaked: z10.string().meta({ description: "Total staked amount" }),
|
|
776
|
+
totalRewards: z10.string().meta({ description: "Total of rewards" })
|
|
777
|
+
}).nullable().meta({ description: "Sui-like staking data" });
|
|
778
|
+
var zSuiLikeStakingFields = z10.object({
|
|
779
|
+
type: z10.literal(NetworkFamily.SUI_LIKE).meta({ description: "Account type" }),
|
|
780
|
+
staking: zSuiLikeStakingData.optional()
|
|
748
781
|
});
|
|
749
|
-
var
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
782
|
+
var zSuiLikeLiveData = zCommonLiveData.extend(zSuiLikeStakingFields.shape).meta({ description: "Sui-like" });
|
|
783
|
+
var zSuiLikeEstimatedFees = z10.object({
|
|
784
|
+
type: z10.literal(NetworkFamily.SUI_LIKE),
|
|
785
|
+
fee: zIntString
|
|
786
|
+
}).meta({ description: "Sui-like fees" });
|
|
787
|
+
var zSuiLikeTransactionType = z10.enum([
|
|
788
|
+
"SUI_LIKE_SEND",
|
|
789
|
+
"SUI_LIKE_RECEIVE",
|
|
790
|
+
"SUI_LIKE_SEND_TOKEN",
|
|
791
|
+
"SUI_LIKE_RECEIVE_TOKEN",
|
|
792
|
+
"SUI_LIKE_STAKE",
|
|
793
|
+
"SUI_LIKE_UNSTAKE"
|
|
794
|
+
]).meta({ description: "Sui-like transaction type" });
|
|
756
795
|
var zSuiLikeSendData = zCommonTransactionData.extend({
|
|
757
|
-
type:
|
|
796
|
+
type: z10.literal(zSuiLikeTransactionType.enum.SUI_LIKE_SEND),
|
|
758
797
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" })
|
|
759
798
|
}).meta({
|
|
760
799
|
description: "Sui-like send data",
|
|
761
800
|
id: "SuiLikeSendData"
|
|
762
801
|
});
|
|
763
802
|
var zSuiLikeTransferTokenData = zCommonTransactionData.extend({
|
|
764
|
-
type:
|
|
803
|
+
type: z10.literal(zSuiLikeTransactionType.enum.SUI_LIKE_SEND_TOKEN),
|
|
765
804
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" })
|
|
766
805
|
}).meta({
|
|
767
806
|
description: "Sui-like transfer token data",
|
|
768
807
|
id: "SuiLikeTransferTokenData"
|
|
769
808
|
});
|
|
770
|
-
var zSuiLikeStakeData =
|
|
771
|
-
type:
|
|
809
|
+
var zSuiLikeStakeData = z10.object({
|
|
810
|
+
type: z10.literal(zSuiLikeTransactionType.enum.SUI_LIKE_STAKE),
|
|
772
811
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" }),
|
|
773
812
|
amount: zUnsignedIntString.meta({ description: "Transaction amount" }),
|
|
774
813
|
currency: zCurrencyString.meta({
|
|
@@ -776,86 +815,233 @@ var zSuiLikeStakeData = z7.object({
|
|
|
776
815
|
}),
|
|
777
816
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
778
817
|
// DELEGATE does not have recipient, but has validator instead
|
|
779
|
-
validator:
|
|
818
|
+
validator: z10.string().nonempty().meta({ description: "Validator address" })
|
|
780
819
|
}).meta({
|
|
781
820
|
description: "Sui-like stake data",
|
|
782
821
|
id: "SuiLikeStakeData"
|
|
783
822
|
});
|
|
784
|
-
var zSuiLikeUnstakeData =
|
|
785
|
-
type:
|
|
823
|
+
var zSuiLikeUnstakeData = z10.object({
|
|
824
|
+
type: z10.literal(zSuiLikeTransactionType.enum.SUI_LIKE_UNSTAKE),
|
|
786
825
|
feeStrategy: zFeeStrategy.meta({ description: "Sui-like fee strategy" }),
|
|
787
826
|
currency: zCurrencyString.meta({
|
|
788
827
|
description: "Will be deprecated soon, use Account.network. Transaction currency"
|
|
789
828
|
}),
|
|
790
829
|
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
791
|
-
stakedSuiId:
|
|
830
|
+
stakedSuiId: z10.string().nonempty().meta({ description: "Staked object to (partially?) unstake" }),
|
|
792
831
|
amount: zUnsignedIntString.meta({ description: "Amount to unstake from the position" }),
|
|
793
|
-
useAllAmount:
|
|
832
|
+
useAllAmount: z10.boolean().meta({
|
|
794
833
|
description: "Whether to unstake the full amount (triggers different sets of transaction commands)"
|
|
795
834
|
})
|
|
796
835
|
}).meta({
|
|
797
836
|
description: "Sui-like unstake data",
|
|
798
837
|
id: "SuiLikeUnstakeData"
|
|
799
838
|
});
|
|
800
|
-
var zSuiLikeTransactionData =
|
|
839
|
+
var zSuiLikeTransactionData = z10.discriminatedUnion("type", [
|
|
801
840
|
zSuiLikeSendData,
|
|
802
841
|
zSuiLikeTransferTokenData,
|
|
803
842
|
zSuiLikeStakeData,
|
|
804
843
|
zSuiLikeUnstakeData
|
|
805
844
|
]);
|
|
806
|
-
var
|
|
807
|
-
|
|
845
|
+
var zSuiLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zSuiLikeTransactionType }).meta({ description: "Sui-like transaction" });
|
|
846
|
+
var zTezosLikeAssetFields = z10.object({
|
|
847
|
+
type: z10.literal(NetworkFamily.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
848
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
849
|
+
}).meta({ description: "Tezos-like" });
|
|
850
|
+
var zTezosLikeStakingData = z10.object({
|
|
851
|
+
delegations: z10.array(
|
|
852
|
+
z10.object({
|
|
853
|
+
address: z10.string()
|
|
854
|
+
})
|
|
855
|
+
)
|
|
856
|
+
}).nullable().meta({ description: "Tezos-like staking data" });
|
|
857
|
+
var zTezosLikeStakingFields = z10.object({
|
|
858
|
+
type: z10.literal(NetworkFamily.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
859
|
+
staking: zTezosLikeStakingData.optional()
|
|
860
|
+
});
|
|
861
|
+
var zTezosLikeLiveData = zCommonLiveData.extend(zTezosLikeStakingFields.shape).meta({ description: "Tezos-like" });
|
|
862
|
+
var zTezosLikeEstimatedFees = z10.object({
|
|
863
|
+
type: z10.literal(NetworkFamily.TEZOS_LIKE),
|
|
864
|
+
fee: zIntString
|
|
865
|
+
}).describe("Tezos-like fees");
|
|
866
|
+
var zTezosLikeTransactionType = z10.enum([
|
|
867
|
+
"TEZOS_LIKE_SEND",
|
|
868
|
+
"TEZOS_LIKE_RECEIVE",
|
|
869
|
+
"TEZOS_LIKE_REVEAL",
|
|
870
|
+
"TEZOS_LIKE_DELEGATE",
|
|
871
|
+
"TEZOS_LIKE_UNDELEGATE"
|
|
872
|
+
]).meta({ description: "Tezos-like transaction type" });
|
|
873
|
+
var zTezosLikeFeeStrategy = zFeeStrategyCustom.meta({ description: "Tezos-like fee strategy" });
|
|
874
|
+
var zTezosLikeSendData = zCommonTransactionData.extend({
|
|
875
|
+
type: z10.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_SEND),
|
|
876
|
+
feeStrategy: zTezosLikeFeeStrategy
|
|
877
|
+
}).meta({
|
|
878
|
+
description: "Tezos-like send data",
|
|
879
|
+
id: "TezosLikeSendData"
|
|
880
|
+
});
|
|
881
|
+
var zTezosLikeDelegateData = z10.object({
|
|
882
|
+
type: z10.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_DELEGATE),
|
|
883
|
+
amount: zUnsignedIntString.optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
808
884
|
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
809
|
-
|
|
885
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
886
|
+
recipient: z10.string().nonempty().meta({ description: "Transaction recipient" }),
|
|
887
|
+
feeStrategy: zTezosLikeFeeStrategy
|
|
810
888
|
}).meta({
|
|
811
|
-
description: "
|
|
812
|
-
id: "
|
|
889
|
+
description: "Tezos-like delegate data",
|
|
890
|
+
id: "TezosLikeDelegateData"
|
|
891
|
+
});
|
|
892
|
+
var zTezosLikeUndelegateData = z10.object({
|
|
893
|
+
type: z10.literal(zTezosLikeTransactionType.enum.TEZOS_LIKE_UNDELEGATE),
|
|
894
|
+
amount: zUnsignedIntString.optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
895
|
+
currency: zCurrencyString.meta({ description: "Transaction currency" }),
|
|
896
|
+
maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
|
|
897
|
+
recipient: z10.string().nonempty().optional().meta({ description: "Deprecated: DO NOT USE!" }),
|
|
898
|
+
feeStrategy: zTezosLikeFeeStrategy
|
|
899
|
+
}).meta({
|
|
900
|
+
description: "Tezos-like undelegate data",
|
|
901
|
+
id: "TezosLikeUndelegateData"
|
|
813
902
|
});
|
|
903
|
+
var zTezosLikeTransactionData = z10.discriminatedUnion("type", [
|
|
904
|
+
zTezosLikeSendData,
|
|
905
|
+
zTezosLikeDelegateData,
|
|
906
|
+
zTezosLikeUndelegateData
|
|
907
|
+
]);
|
|
908
|
+
var zTezosLikeTransactionResponse = zCommonTransactionResponse.extend({ type: zTezosLikeTransactionType }).meta({ description: "Tezos-like transaction" });
|
|
909
|
+
var zTronLikeAssetFields = z10.object({
|
|
910
|
+
type: z10.literal(NetworkFamily.TRON_LIKE).meta({ description: "Account type" }),
|
|
911
|
+
address: z10.string().nullable().meta({ description: "Account address" })
|
|
912
|
+
}).meta({ description: "Tron-like" });
|
|
913
|
+
var zTrc20LikeAssetFields = z10.object({
|
|
914
|
+
type: z10.literal(NetworkFamily.TRC20_LIKE).meta({ description: "Account type" }),
|
|
915
|
+
address: z10.string().nullable().meta({ description: "Account address" }),
|
|
916
|
+
contractAddress: z10.string().meta({
|
|
917
|
+
description: "Will be deprecated, Use contractAddress at root level instead; Token contract address"
|
|
918
|
+
}).optional()
|
|
919
|
+
}).meta({ description: "Tron-like token" });
|
|
920
|
+
var zTronLikeLiveData = zCommonLiveData.extend({
|
|
921
|
+
type: z10.enum([NetworkFamily.TRON_LIKE, NetworkFamily.TRC20_LIKE]).meta({ description: "Account type" })
|
|
922
|
+
}).meta({ description: "Tron-like" });
|
|
923
|
+
var zTronLikeEstimatedFees = z10.object({
|
|
924
|
+
type: z10.literal(NetworkFamily.TRON_LIKE),
|
|
925
|
+
fee: zIntString
|
|
926
|
+
}).meta({ description: "Tron-like fees" });
|
|
927
|
+
var zTronLikeTransactionType = z10.enum(["TRON_LIKE_SEND", "TRON_LIKE_RECEIVE", "TRON_LIKE_SEND_TOKEN", "TRON_LIKE_RECEIVE_TOKEN"]).meta({ description: "Tron-like transaction type" });
|
|
814
928
|
var zTronLikeSendData = zCommonTransactionData.extend({
|
|
815
|
-
type:
|
|
929
|
+
type: z10.literal(zTronLikeTransactionType.enum.TRON_LIKE_SEND),
|
|
816
930
|
feeStrategy: zFeeStrategy.meta({ description: "Tron-like fee strategy" })
|
|
817
931
|
}).meta({
|
|
818
932
|
description: "Tron-like send data",
|
|
819
933
|
id: "TronLikeSendData"
|
|
820
934
|
});
|
|
821
935
|
var zTronLikeSendTokenData = zCommonTransactionData.extend({
|
|
822
|
-
type:
|
|
936
|
+
type: z10.literal(zTronLikeTransactionType.enum.TRON_LIKE_SEND_TOKEN),
|
|
823
937
|
feeStrategy: zFeeStrategy.meta({ description: "Tron-like fee strategy" })
|
|
824
938
|
}).meta({
|
|
825
939
|
description: "Tron-like send token data",
|
|
826
940
|
id: "TronLikeSendTokenData"
|
|
827
941
|
});
|
|
828
|
-
var zTronLikeTransactionData =
|
|
942
|
+
var zTronLikeTransactionData = z10.discriminatedUnion("type", [
|
|
829
943
|
zTronLikeSendData,
|
|
830
944
|
zTronLikeSendTokenData
|
|
831
945
|
]);
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
946
|
+
|
|
947
|
+
// src/networks/index.ts
|
|
948
|
+
var zNetworkAssetFields = z10.discriminatedUnion("type", [
|
|
949
|
+
zBitcoinLikeAssetFields,
|
|
950
|
+
zCardanoLikeAssetFields,
|
|
951
|
+
zEthereumLikeAssetFields,
|
|
952
|
+
zEthereumTokenLikeAssetFields,
|
|
953
|
+
zGenericLikeAssetFields,
|
|
954
|
+
zPolkadotLikeAssetFields,
|
|
955
|
+
zRippleLikeAssetFields,
|
|
956
|
+
zSolanaLikeAssetFields,
|
|
957
|
+
zStellarLikeAssetFields,
|
|
958
|
+
zTezosLikeAssetFields,
|
|
959
|
+
zSuiLikeAssetFields,
|
|
960
|
+
zTronLikeAssetFields,
|
|
961
|
+
zTrc20LikeAssetFields
|
|
962
|
+
]).meta({ description: "Network asset fields" });
|
|
963
|
+
var zAccountLiveData = z10.discriminatedUnion("type", [
|
|
964
|
+
zBitcoinLikeLiveData,
|
|
965
|
+
zCardanoLikeLiveData,
|
|
966
|
+
zEthereumLikeLiveData,
|
|
967
|
+
zEthereumTokenLikeLiveData,
|
|
968
|
+
zGenericLikeLiveData,
|
|
969
|
+
zPolkadotLikeLiveData,
|
|
970
|
+
zRippleLikeLiveData,
|
|
971
|
+
zSolanaLikeLiveData,
|
|
972
|
+
zStellarLikeLiveData,
|
|
973
|
+
zSuiLikeLiveData,
|
|
974
|
+
zTezosLikeLiveData,
|
|
975
|
+
zTronLikeLiveData
|
|
976
|
+
]);
|
|
977
|
+
z10.discriminatedUnion("type", [
|
|
978
|
+
zCardanoLikeStakingFields,
|
|
979
|
+
zEthereumLikeStakingFields,
|
|
980
|
+
zPolkadotLikeStakingFields,
|
|
981
|
+
zSolanaLikeStakingFields,
|
|
982
|
+
zSuiLikeStakingFields,
|
|
983
|
+
zTezosLikeStakingFields
|
|
984
|
+
]);
|
|
985
|
+
z10.discriminatedUnion("type", [
|
|
986
|
+
zEthereumLikeEstimatedFees,
|
|
987
|
+
zRippleLikeEstimatedFees,
|
|
988
|
+
zStellarLikeEstimatedFees,
|
|
989
|
+
zSuiLikeEstimatedFees,
|
|
990
|
+
zTezosLikeEstimatedFees,
|
|
991
|
+
zTronLikeEstimatedFees
|
|
992
|
+
]);
|
|
993
|
+
z10.union([
|
|
994
|
+
zBitcoinLikeTransactionType,
|
|
995
|
+
zCardanoLikeTransactionType,
|
|
996
|
+
zEthereumLikeTransferTransactionType,
|
|
997
|
+
zEthereumLikeContractTransactionType,
|
|
998
|
+
zGenericTransactionType,
|
|
999
|
+
zPolkadotLikeTransactionType,
|
|
1000
|
+
zRippleLikeTransactionType,
|
|
1001
|
+
zSolanaLikeTransactionType,
|
|
1002
|
+
zStellarLikeTransactionType,
|
|
1003
|
+
zSuiLikeTransactionType,
|
|
1004
|
+
zTezosLikeTransactionType,
|
|
1005
|
+
zTronLikeTransactionType
|
|
1006
|
+
]);
|
|
1007
|
+
({
|
|
1008
|
+
...zBitcoinLikeTransactionType.enum,
|
|
1009
|
+
...zCardanoLikeTransactionType.enum,
|
|
1010
|
+
...zEthereumLikeTransferTransactionType.enum,
|
|
1011
|
+
...zEthereumLikeContractTransactionType.enum,
|
|
1012
|
+
...zGenericTransactionType.enum,
|
|
1013
|
+
...zPolkadotLikeTransactionType.enum,
|
|
1014
|
+
...zRippleLikeTransactionType.enum,
|
|
1015
|
+
...zSolanaLikeTransactionType.enum,
|
|
1016
|
+
...zStellarLikeTransactionType.enum,
|
|
1017
|
+
...zSuiLikeTransactionType.enum,
|
|
1018
|
+
...zTezosLikeTransactionType.enum,
|
|
1019
|
+
...zTronLikeTransactionType.enum
|
|
1020
|
+
});
|
|
1021
|
+
({
|
|
1022
|
+
...NetworkFamily,
|
|
1023
|
+
// TODO: Sometimes `NetworkFamily` is not a `TransactionType` prefix - but why?
|
|
1024
|
+
[NetworkFamily.ERC20_LIKE]: "ETHEREUM_LIKE",
|
|
1025
|
+
[NetworkFamily.BEP20_LIKE]: "ETHEREUM_LIKE",
|
|
1026
|
+
[NetworkFamily.TRC20_LIKE]: "TRON_LIKE",
|
|
1027
|
+
[NetworkFamily.GENERIC_LIKE]: "GENERIC"
|
|
1028
|
+
});
|
|
1029
|
+
var zTransactionData = z10.discriminatedUnion("type", [
|
|
1030
|
+
...zBitcoinLikeTransactionData.options,
|
|
836
1031
|
...zCardanoLikeTransactionData.options,
|
|
837
|
-
// Ethereum
|
|
838
1032
|
...zEthereumLikeTransactionData.options,
|
|
839
|
-
// Generic
|
|
840
|
-
zGenericTransactionData,
|
|
841
|
-
// Polkadot
|
|
842
1033
|
...zPolkadotLikeTransactionData.options,
|
|
843
|
-
|
|
844
|
-
zRippleLikeSendData,
|
|
845
|
-
// Solana
|
|
1034
|
+
...zRippleLikeTransactionData.options,
|
|
846
1035
|
...zSolanaLikeTransactionData.options,
|
|
847
|
-
|
|
848
|
-
zStellarLikeSendData,
|
|
849
|
-
// Sui
|
|
1036
|
+
...zStellarLikeTransactionData.options,
|
|
850
1037
|
...zSuiLikeTransactionData.options,
|
|
851
|
-
// Tezos
|
|
852
1038
|
...zTezosLikeTransactionData.options,
|
|
853
|
-
|
|
854
|
-
|
|
1039
|
+
...zTronLikeTransactionData.options,
|
|
1040
|
+
zGenericTransactionData
|
|
855
1041
|
]);
|
|
856
|
-
var zSendOnlyTransactionData =
|
|
1042
|
+
var zSendOnlyTransactionData = z10.discriminatedUnion("type", [
|
|
857
1043
|
zBitcoinLikeSendData,
|
|
858
|
-
|
|
1044
|
+
zCardanoLikeSendData,
|
|
859
1045
|
zEthereumLikeSendData,
|
|
860
1046
|
zPolkadotLikeSendData,
|
|
861
1047
|
zRippleLikeSendData,
|
|
@@ -864,102 +1050,7 @@ var zSendOnlyTransactionData = z7.discriminatedUnion("type", [
|
|
|
864
1050
|
zSuiLikeSendData,
|
|
865
1051
|
zTezosLikeSendData
|
|
866
1052
|
]);
|
|
867
|
-
var
|
|
868
|
-
accountId: z7.string().min(1).meta({ description: "Target account id" }),
|
|
869
|
-
transaction: zTransactionData
|
|
870
|
-
}).meta({
|
|
871
|
-
description: "Create transaction request data",
|
|
872
|
-
id: "CreateTransactionRequestData"
|
|
873
|
-
});
|
|
874
|
-
var zSignMessageRequestData = z7.object({
|
|
875
|
-
message: zMessage.meta({ description: "Message to sign" }),
|
|
876
|
-
accountId: z7.string().min(1).meta({ description: "Target account id" }),
|
|
877
|
-
address: z7.string().nonempty().meta({ description: "Address with which to sign the message" }),
|
|
878
|
-
derivationPath: z7.string().nonempty().meta({ description: "Derivation path of the signing address" })
|
|
879
|
-
});
|
|
880
|
-
var zSignMessageUserInputData = zSignMessageRequestData.partial({
|
|
881
|
-
address: true,
|
|
882
|
-
derivationPath: true
|
|
883
|
-
});
|
|
884
|
-
var zDigestData = z7.object({
|
|
885
|
-
digest: zHexString.meta({ description: "The hex string digest to sign" }),
|
|
886
|
-
derivationPath: z7.string().nonempty().meta({ description: "The derivation path with which to sign the digest" })
|
|
887
|
-
});
|
|
888
|
-
var zSignDigestsRequestData = z7.object({
|
|
889
|
-
accountId: z7.string().min(1).meta({ description: "Target account id" }),
|
|
890
|
-
digests: z7.array(zDigestData).meta({ description: "The digests to sign" })
|
|
891
|
-
});
|
|
892
|
-
z7.object({
|
|
893
|
-
signatures: z7.array(zHsmSignature)
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
// src/accounts/clients/types.ts
|
|
897
|
-
var zTransactionStatus = z7.enum(["SUCCESSFUL", "FAILED"]);
|
|
898
|
-
var zBitcoinLikeCoinFields = z7.object({
|
|
899
|
-
type: zBitcoinLikeTransactionType
|
|
900
|
-
});
|
|
901
|
-
var zCardanoLikeCoinFields = z7.object({
|
|
902
|
-
type: zCardanoLikeTransactionType
|
|
903
|
-
});
|
|
904
|
-
var zEthereumLikeTransferCoinFields = z7.object({
|
|
905
|
-
type: zEthereumLikeTransferTransactionType,
|
|
906
|
-
gasPrice: z7.string(),
|
|
907
|
-
gasLimit: z7.string(),
|
|
908
|
-
nonce: z7.string()
|
|
909
|
-
});
|
|
910
|
-
var zEthereumLikeContractCoinFields = zEthereumLikeTransferCoinFields.extend({
|
|
911
|
-
type: zEthereumLikeContractTransactionType,
|
|
912
|
-
contractData: z7.string().meta({ description: "Contract deployment or contract execution data" })
|
|
913
|
-
});
|
|
914
|
-
var zGenericCoinFields = z7.object({
|
|
915
|
-
type: zGenericTransactionType
|
|
916
|
-
});
|
|
917
|
-
var zPolkadotLikeCoinFields = z7.object({
|
|
918
|
-
type: zPolkadotLikeTransactionType
|
|
919
|
-
});
|
|
920
|
-
var zRippleLikeCoinFields = z7.object({
|
|
921
|
-
type: zRippleLikeTransactionType,
|
|
922
|
-
memos: z7.array(z7.string()),
|
|
923
|
-
destinationTag: z7.string()
|
|
924
|
-
});
|
|
925
|
-
var zSolanaLikeCoinFields = z7.object({
|
|
926
|
-
type: zSolanaLikeTransactionType
|
|
927
|
-
});
|
|
928
|
-
var zStellarLikeCoinFields = z7.object({
|
|
929
|
-
type: zStellarLikeTransactionType
|
|
930
|
-
});
|
|
931
|
-
var zSuiLikeCoinFields = z7.object({
|
|
932
|
-
type: zSuiLikeTransactionType
|
|
933
|
-
});
|
|
934
|
-
var zTezosLikeCoinFields = z7.object({
|
|
935
|
-
type: zTezosLikeTransactionType
|
|
936
|
-
});
|
|
937
|
-
var zCommonTransactionResponse = z7.object({
|
|
938
|
-
id: z7.string().meta({ description: "Internal unique identifier" }),
|
|
939
|
-
hash: z7.string().meta({ description: "Transaction hash" }),
|
|
940
|
-
block: z7.object({
|
|
941
|
-
height: z7.string().nullable().meta({ description: "Transaction block height" }),
|
|
942
|
-
time: z7.string().nullable().meta({ description: "Transaction block time" })
|
|
943
|
-
}),
|
|
944
|
-
status: zTransactionStatus.meta({ description: "Transaction status" }),
|
|
945
|
-
confirmations: z7.string().meta({ description: "Block confirmations" }),
|
|
946
|
-
amount: z7.string().meta({ description: "Transaction amount" }),
|
|
947
|
-
fee: z7.string().meta({ description: "Transaction fee" }),
|
|
948
|
-
senders: z7.array(z7.string()).meta({ description: "Senders (can be multiple for UTXOs-based accounts)" }),
|
|
949
|
-
recipients: z7.array(z7.string()).meta({ description: "Recipients (can be multiple for multi-output transactions)" })
|
|
950
|
-
});
|
|
951
|
-
var zBitcoinLikeTransactionResponse = zCommonTransactionResponse.extend(zBitcoinLikeCoinFields.shape).meta({ description: "Bitcoin-like transaction" });
|
|
952
|
-
var zCardanoLikeTransactionResponse = zCommonTransactionResponse.extend(zCardanoLikeCoinFields.shape).meta({ description: "Cardano-like transaction" });
|
|
953
|
-
var zEthereumLikeTransferTransactionResponse = zCommonTransactionResponse.extend(zEthereumLikeTransferCoinFields.shape).meta({ description: "Ethereum-like transfer transaction" });
|
|
954
|
-
var zEthereumLikeContractTransactionResponse = zCommonTransactionResponse.extend(zEthereumLikeContractCoinFields.shape).meta({ description: "Ethereum-like contract transaction" });
|
|
955
|
-
var zGenericTransactionResponse = zCommonTransactionResponse.extend(zGenericCoinFields.shape).meta({ description: "Generic transaction" });
|
|
956
|
-
var zPolkadotLikeTransactionResponse = zCommonTransactionResponse.extend(zPolkadotLikeCoinFields.shape).meta({ description: "Polkadot-like transaction" });
|
|
957
|
-
var zRippleLikeTransactionResponse = zCommonTransactionResponse.extend(zRippleLikeCoinFields.shape).meta({ description: "Ripple-like transaction" });
|
|
958
|
-
var zSolanaLikeTransactionResponse = zCommonTransactionResponse.extend(zSolanaLikeCoinFields.shape).meta({ description: "Solana-like transaction" });
|
|
959
|
-
var zStellarLikeTransactionResponse = zCommonTransactionResponse.extend(zStellarLikeCoinFields.shape).meta({ description: "Stellar-like transaction" });
|
|
960
|
-
var zTezosLikeTransactionResponse = zCommonTransactionResponse.extend(zTezosLikeCoinFields.shape).meta({ description: "Tezos-like transaction" });
|
|
961
|
-
var zSuiLikeTransactionResponse = zCommonTransactionResponse.extend(zSuiLikeCoinFields.shape).meta({ description: "Sui-like transaction" });
|
|
962
|
-
var zTransactionResponse = z7.discriminatedUnion("type", [
|
|
1053
|
+
var zTransactionResponse = z10.discriminatedUnion("type", [
|
|
963
1054
|
zBitcoinLikeTransactionResponse,
|
|
964
1055
|
zCardanoLikeTransactionResponse,
|
|
965
1056
|
zEthereumLikeTransferTransactionResponse,
|
|
@@ -969,82 +1060,17 @@ var zTransactionResponse = z7.discriminatedUnion("type", [
|
|
|
969
1060
|
zRippleLikeTransactionResponse,
|
|
970
1061
|
zSolanaLikeTransactionResponse,
|
|
971
1062
|
zStellarLikeTransactionResponse,
|
|
972
|
-
zSuiLikeTransactionResponse,
|
|
973
|
-
zTezosLikeTransactionResponse
|
|
974
|
-
]);
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
)
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
xpub: z.string().meta({ description: "xpub (extended public key)" })
|
|
984
|
-
}).meta({ description: "Bitcoin-like" });
|
|
985
|
-
var zCardanoLikeAssetFields = z.object({
|
|
986
|
-
type: z.literal(AccountType.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
987
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
988
|
-
}).meta({ description: "Cardano-like" });
|
|
989
|
-
var zEthereumLikeAssetFields = z.object({
|
|
990
|
-
type: z.literal(AccountType.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
991
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
992
|
-
}).meta({ description: "Ethereum-like" });
|
|
993
|
-
var zEthereumTokenLikeAssetFields = z.object({
|
|
994
|
-
type: z.enum([AccountType.ERC20_LIKE, AccountType.BEP20_LIKE, AccountType.TRC20_LIKE]).meta({ description: "Account type" }),
|
|
995
|
-
address: z.string().nullable().meta({ description: "Account address" }),
|
|
996
|
-
contractAddress: z.string().meta({
|
|
997
|
-
description: "Will be deprecated, Use contractAddress at root objet level instead; Token contract address"
|
|
998
|
-
}).optional()
|
|
999
|
-
}).meta({ description: "Ethereum-like token" });
|
|
1000
|
-
var zGenericLikeAssetFields = z.object({ type: z.literal(AccountType.GENERIC_LIKE).meta({ description: "Account type" }) }).meta({ description: "Generic-like" });
|
|
1001
|
-
var zRawSigningAssetFields = z.object({ type: z.literal(AccountType.RAW_SIGNING).meta({ description: "Account type" }) }).meta({ description: "Raw signing account" });
|
|
1002
|
-
var zPolkadotLikeAssetFields = z.object({
|
|
1003
|
-
type: z.literal(AccountType.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
1004
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1005
|
-
}).meta({ description: "Polkadot-like" });
|
|
1006
|
-
var zRippleLikeAssetFields = z.object({
|
|
1007
|
-
type: z.literal(AccountType.RIPPLE_LIKE).meta({ description: "Account type" }),
|
|
1008
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1009
|
-
}).meta({ description: "Ripple-like" });
|
|
1010
|
-
var zSolanaLikeAssetFields = z.object({
|
|
1011
|
-
type: z.literal(AccountType.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
1012
|
-
address: z.string().nullable().meta({ description: "Account address" }),
|
|
1013
|
-
contractAddress: z.string().meta({
|
|
1014
|
-
description: "Will be deprecated, Use contractAddress at root objet level instead; Token contract address"
|
|
1015
|
-
}).nullable().optional()
|
|
1016
|
-
}).meta({ description: "Solana-like" });
|
|
1017
|
-
var zStellarLikeAssetFields = z.object({
|
|
1018
|
-
type: z.literal(AccountType.STELLAR_LIKE).meta({ description: "Account type" }),
|
|
1019
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1020
|
-
}).meta({ description: "Stellar-like" });
|
|
1021
|
-
var zSuiLikeAssetFields = z.object({
|
|
1022
|
-
type: z.literal(AccountType.SUI_LIKE).meta({ description: "Account type" }),
|
|
1023
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1024
|
-
}).meta({ description: "Sui-like" });
|
|
1025
|
-
var zTezosLikeAssetFields = z.object({
|
|
1026
|
-
type: z.literal(AccountType.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
1027
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1028
|
-
}).meta({ description: "Tezos-like" });
|
|
1029
|
-
var zTronLikeAssetFields = z.object({
|
|
1030
|
-
type: z.literal(AccountType.TRON_LIKE).meta({ description: "Account type" }),
|
|
1031
|
-
address: z.string().nullable().meta({ description: "Account address" })
|
|
1032
|
-
}).meta({ description: "Tron-like" });
|
|
1033
|
-
var zAccountAssetStaticFields = z.discriminatedUnion("type", [
|
|
1034
|
-
zBitcoinLikeAssetFields,
|
|
1035
|
-
zCardanoLikeAssetFields,
|
|
1036
|
-
zEthereumLikeAssetFields,
|
|
1037
|
-
zEthereumTokenLikeAssetFields,
|
|
1038
|
-
zGenericLikeAssetFields,
|
|
1039
|
-
zPolkadotLikeAssetFields,
|
|
1040
|
-
zRawSigningAssetFields,
|
|
1041
|
-
zRippleLikeAssetFields,
|
|
1042
|
-
zSolanaLikeAssetFields,
|
|
1043
|
-
zStellarLikeAssetFields,
|
|
1044
|
-
zTezosLikeAssetFields,
|
|
1045
|
-
zSuiLikeAssetFields,
|
|
1046
|
-
zTronLikeAssetFields
|
|
1047
|
-
]).meta({ description: "Account asset fields" });
|
|
1063
|
+
zSuiLikeTransactionResponse,
|
|
1064
|
+
zTezosLikeTransactionResponse
|
|
1065
|
+
]);
|
|
1066
|
+
|
|
1067
|
+
// src/accounts/clients/types.ts
|
|
1068
|
+
z10.discriminatedUnion(
|
|
1069
|
+
zTransactionResponse._zod.def.discriminator,
|
|
1070
|
+
ensureNonEmptyArray(
|
|
1071
|
+
zTransactionResponse.options.map((_) => _.extend({ note: zNote.nullable() }))
|
|
1072
|
+
)
|
|
1073
|
+
);
|
|
1048
1074
|
var zReviewStepWithUsers = z.object({
|
|
1049
1075
|
quorum: z.number().min(0).meta({ description: "Number of required approvals for the step" }),
|
|
1050
1076
|
userIds: z.array(z.string().min(1)).meta({ description: "User ids in the step" })
|
|
@@ -1103,62 +1129,201 @@ var INCLUDE_MEMBERS = {
|
|
|
1103
1129
|
include: { members: true }
|
|
1104
1130
|
}
|
|
1105
1131
|
};
|
|
1106
|
-
var
|
|
1107
|
-
|
|
1132
|
+
var zPubKey = zHexString.meta({ description: "Public key" });
|
|
1133
|
+
var zHsmCertificate = z.object({
|
|
1134
|
+
codeHash: z.base64().meta({ description: "Hash of the executable that generated this certificate" }),
|
|
1135
|
+
attestationPub: z.base64().meta({ description: "Attestation public key" }),
|
|
1136
|
+
certificate: z.base64().meta({ description: "Certificate bytes" }),
|
|
1137
|
+
signature: z.base64().meta({ description: "Certificate signature" })
|
|
1138
|
+
});
|
|
1139
|
+
var zBlob = z.string();
|
|
1140
|
+
var zPsdChallenge = z.object({
|
|
1141
|
+
challengeType: z.literal(ChallengeType.PSD),
|
|
1142
|
+
wActions: z.array(z.string()).meta({ description: "Wrapped blobs that describe the screens to display" }),
|
|
1143
|
+
handshake: z.string().meta({ description: "Handshake for the HSM <-> PSD communication" }),
|
|
1144
|
+
handshakeAttestation: zHsmCertificate.meta({
|
|
1145
|
+
description: "Handshake attestation to verify secure channel between HSM & PSD"
|
|
1146
|
+
}),
|
|
1147
|
+
partitionId: z.string().meta({ description: "HSM partition id (maybe not useful)" })
|
|
1148
|
+
});
|
|
1149
|
+
var zApiChallenge = z.object({
|
|
1150
|
+
challengeType: z.literal(ChallengeType.API),
|
|
1151
|
+
payload: z.object({
|
|
1152
|
+
approve: z.string().meta({ description: "JSON payload to sign (as JWS) to approve" }),
|
|
1153
|
+
reject: z.string().meta({ description: "JSON payload to sign (as JWS) to reject" })
|
|
1154
|
+
}).meta({ description: "JSON payload to approve and to reject" })
|
|
1155
|
+
});
|
|
1156
|
+
var zUserChallenge = z.discriminatedUnion("challengeType", [
|
|
1157
|
+
zPsdChallenge.meta({ description: "Necessary data to approve on a PSD" }),
|
|
1158
|
+
zApiChallenge.meta({ description: "Necessary data for approval by an API user" })
|
|
1159
|
+
]);
|
|
1160
|
+
var zHsmChallengeGroup = z.record(zPubKey, zUserChallenge);
|
|
1161
|
+
var zHsmChallengeSteps = z.array(zHsmChallengeGroup);
|
|
1162
|
+
var zPsdSignature = z.string().min(1).meta({ description: "Signature from PSD" });
|
|
1163
|
+
var zApiSignature = z.string().min(1).meta({ description: "Signature from API (JWS)" });
|
|
1164
|
+
var zUserApproval = z.discriminatedUnion("challengeType", [
|
|
1165
|
+
z.object({
|
|
1166
|
+
challengeType: z.literal(ChallengeType.PSD),
|
|
1167
|
+
signature: zPsdSignature
|
|
1168
|
+
}),
|
|
1169
|
+
z.object({
|
|
1170
|
+
challengeType: z.literal(ChallengeType.API),
|
|
1171
|
+
signature: zApiSignature
|
|
1172
|
+
})
|
|
1173
|
+
]);
|
|
1174
|
+
var zHsmApprovalGroup = z.record(zPubKey, zUserApproval);
|
|
1175
|
+
z.array(zHsmApprovalGroup);
|
|
1176
|
+
z.object({
|
|
1177
|
+
stageName: z.string(),
|
|
1178
|
+
steps: zHsmChallengeSteps
|
|
1179
|
+
});
|
|
1180
|
+
z.object({
|
|
1181
|
+
name: z.string().meta({ description: "Name of the user to register" }),
|
|
1182
|
+
psdModel: z.enum(PsdModel).meta({ description: "Device model" }),
|
|
1183
|
+
pubKey: zPubKey.meta({ description: "Device public key" }),
|
|
1184
|
+
confidentialityKey: zPubKey,
|
|
1185
|
+
psdEphemeralKey: zPubKey,
|
|
1186
|
+
psdEphemeralKeyAttestation: zHsmCertificate
|
|
1187
|
+
}).meta({ description: "Data generated by the PSD to register on HSM" });
|
|
1188
|
+
z.object({
|
|
1189
|
+
challenge: z.string(),
|
|
1190
|
+
ephemeralPublicKey: zPubKey,
|
|
1191
|
+
ephemeralPublicKeyAttestation: zHsmCertificate,
|
|
1192
|
+
handshake: zHexString,
|
|
1193
|
+
handshakeAttestation: zHsmCertificate,
|
|
1194
|
+
u2fRegisterData: z.string(),
|
|
1195
|
+
ciphertext: z.string(),
|
|
1196
|
+
requestId: z.string()
|
|
1197
|
+
}).meta({ description: "Challenge generated by HSM\xA0using the PSD registration data" });
|
|
1198
|
+
z.object({
|
|
1199
|
+
certificate: zHsmCertificate,
|
|
1200
|
+
u2fRegister: zHexString,
|
|
1201
|
+
u2fKeyHandle: zHexString,
|
|
1202
|
+
registerData: z.string(),
|
|
1203
|
+
validationKey: zPubKey,
|
|
1204
|
+
pairingPayload: z.string()
|
|
1205
|
+
}).meta({ description: "Final registration response from PSD to HSM" });
|
|
1206
|
+
z.object({
|
|
1207
|
+
confidentialityKeyCurve25519: z.string(),
|
|
1208
|
+
confidentialityKeySignature: z.string()
|
|
1209
|
+
});
|
|
1210
|
+
z.object({
|
|
1211
|
+
pairing: z.object({
|
|
1212
|
+
workspaceName: z.string(),
|
|
1213
|
+
partitionKey: z.string(),
|
|
1214
|
+
// TODO: Is this `zPubKey`?
|
|
1215
|
+
bootstrapEnabled: z.boolean()
|
|
1216
|
+
}),
|
|
1217
|
+
// TODO: Is this `zHsmCertificate`?
|
|
1218
|
+
partitionKeyAttestation: z.object({
|
|
1219
|
+
codeHash: z.string(),
|
|
1220
|
+
attestationPub: z.string(),
|
|
1221
|
+
certificate: z.string(),
|
|
1222
|
+
signature: z.string()
|
|
1223
|
+
}),
|
|
1224
|
+
blob: zBlob
|
|
1225
|
+
});
|
|
1226
|
+
var zHsmSignature = z.object({
|
|
1227
|
+
digest: z.string().nullable().meta({ description: "Signed digest" }),
|
|
1228
|
+
derivationPath: z.string().nullable().meta({ description: "Derivation path used to sign the digest" }),
|
|
1229
|
+
r: z.base64().meta({ description: "Base64 encoded signature r coordinate" }),
|
|
1230
|
+
s: z.base64().meta({ description: "Base64 encoded signature s coordinate" }),
|
|
1231
|
+
v: z.union([z.literal(0), z.literal(1)]).nullable().meta({ description: "Ecdsa only, signature recovery value" }),
|
|
1232
|
+
der: zHexString.meta({
|
|
1233
|
+
description: "Hex string encoded DER signature format (for eddsa, concatenation of r & s)"
|
|
1234
|
+
}),
|
|
1235
|
+
pubkey: zHexString.nullable().meta({ description: "Public key for signature verification, 32 or 33 bytes" })
|
|
1236
|
+
});
|
|
1237
|
+
var zWorkspaceName = z10.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
1238
|
+
var zUserName = z.string().min(1).max(19).meta({ description: "User name" });
|
|
1239
|
+
var zUserRegistrationCreateInput = z.object({
|
|
1240
|
+
name: zUserName,
|
|
1241
|
+
role: z.enum([UserRole.ADMIN, UserRole.OPERATOR]).meta({ description: "User role" }),
|
|
1242
|
+
psdModel: z.enum(PsdModel).meta({ description: "PSD model" }),
|
|
1243
|
+
deviceUserId: z.string().meta({ description: "Device user ID" })
|
|
1244
|
+
});
|
|
1245
|
+
zUserRegistrationCreateInput.extend({
|
|
1246
|
+
id: z.string().meta({ description: "User registration ID" }),
|
|
1247
|
+
workspaceName: z.string().meta({ description: "Workspace name" }),
|
|
1248
|
+
state: z.enum(UserRegistrationState).meta({ description: "User registration state" }),
|
|
1249
|
+
isLocked: z.boolean().meta({ description: "Whether the registration is locked by a request" })
|
|
1108
1250
|
});
|
|
1109
|
-
var zWorkspaceName = z7.string().min(1).max(20).regex(/^[a-z0-9]+$/);
|
|
1110
1251
|
|
|
1111
|
-
// src/
|
|
1112
|
-
var
|
|
1113
|
-
|
|
1252
|
+
// src/users/request-data.ts
|
|
1253
|
+
var zCreatePsdUserRequestData = z10.object({
|
|
1254
|
+
registrationId: z10.string().meta({ description: "User registration ID" })
|
|
1255
|
+
});
|
|
1256
|
+
var zCreateApiUserRequestData = z10.object({
|
|
1257
|
+
name: zUserName,
|
|
1258
|
+
pubKey: z10.string().meta({ description: "Public key" }),
|
|
1259
|
+
role: z10.enum(["ADMIN", "OPERATOR"]).meta({ description: "User role" }),
|
|
1260
|
+
viewAll: z10.boolean().meta({ description: "View all data" }).optional()
|
|
1261
|
+
}).meta({ description: "Create API user request data" });
|
|
1262
|
+
var zCreateApiUserAccessRequestData = z10.object({
|
|
1263
|
+
name: zUserName
|
|
1264
|
+
}).meta({ description: "Create API user credential request data" });
|
|
1265
|
+
z10.object({
|
|
1266
|
+
authUserId: z10.string().meta({ description: "Authentication broker ID" })
|
|
1267
|
+
}).meta({ description: "Managed data for API user" });
|
|
1268
|
+
var zRevokeUserRequestData = z10.object({});
|
|
1269
|
+
var zUpdateQuorumRequestData = z10.object({
|
|
1270
|
+
quorum: z10.number().int().min(2).meta({ description: "Workspace quorum" })
|
|
1271
|
+
});
|
|
1272
|
+
var NonRootAdminPermission = omit(AdminPermission, "ROOT");
|
|
1273
|
+
var zWorkspaceRuleRequestData = z10.object({
|
|
1274
|
+
permission: z10.enum(NonRootAdminPermission).meta({ description: "Granted permissions" }),
|
|
1275
|
+
reviewConfig: zReviewStepWithUsersArray.meta({ description: "List of admin review steps" })
|
|
1276
|
+
});
|
|
1277
|
+
var zTradelinkWhitelistAddress = z10.object({
|
|
1278
|
+
name: z10.string().min(1),
|
|
1114
1279
|
currency: zCurrencyString,
|
|
1115
|
-
address:
|
|
1280
|
+
address: z10.string().min(1)
|
|
1116
1281
|
});
|
|
1117
|
-
|
|
1118
|
-
var zTradelinkId =
|
|
1119
|
-
var zTradelinkOrgEntityResponse =
|
|
1282
|
+
z10.array(zTradelinkWhitelistAddress);
|
|
1283
|
+
var zTradelinkId = z10.string().meta({ description: "Unique identifier in Tradelink service" });
|
|
1284
|
+
var zTradelinkOrgEntityResponse = z10.object({
|
|
1120
1285
|
tradelinkId: zTradelinkId,
|
|
1121
|
-
name:
|
|
1122
|
-
code:
|
|
1123
|
-
logoUrl:
|
|
1286
|
+
name: z10.string().meta({ description: "Name" }),
|
|
1287
|
+
code: z10.string().meta({ description: "Code" }),
|
|
1288
|
+
logoUrl: z10.string().meta({ description: "Logo URL" })
|
|
1124
1289
|
});
|
|
1125
1290
|
zTradelinkOrgEntityResponse.omit({
|
|
1126
1291
|
tradelinkId: true
|
|
1127
1292
|
});
|
|
1128
|
-
|
|
1293
|
+
z10.object({
|
|
1129
1294
|
tradelinkId: zTradelinkId
|
|
1130
1295
|
});
|
|
1131
|
-
var zTradelinkExchangeConfig =
|
|
1132
|
-
exchangeId:
|
|
1133
|
-
repledgeAuthorized:
|
|
1296
|
+
var zTradelinkExchangeConfig = z10.object({
|
|
1297
|
+
exchangeId: z10.string().meta({ description: "Tradelink exchange id" }),
|
|
1298
|
+
repledgeAuthorized: z10.boolean().meta({
|
|
1134
1299
|
description: "Determines whether this exchange is authorized to repledge on this account"
|
|
1135
1300
|
}),
|
|
1136
|
-
needsAssetManagerApprovalForSettlements:
|
|
1301
|
+
needsAssetManagerApprovalForSettlements: z10.boolean().meta({
|
|
1137
1302
|
description: 'Determines whether asset manager will "pre-approve" the settlement requests on this account'
|
|
1138
1303
|
})
|
|
1139
1304
|
});
|
|
1140
|
-
var zTradelinkExchangeConfigs =
|
|
1141
|
-
|
|
1305
|
+
var zTradelinkExchangeConfigs = z10.array(zTradelinkExchangeConfig);
|
|
1306
|
+
z10.object({
|
|
1142
1307
|
workspaceName: zWorkspaceName,
|
|
1143
|
-
custodian:
|
|
1144
|
-
assetManagers:
|
|
1145
|
-
exchanges:
|
|
1308
|
+
custodian: z10.object({ name: z10.string() }),
|
|
1309
|
+
assetManagers: z10.array(z10.object({ name: z10.string() })),
|
|
1310
|
+
exchanges: z10.array(z10.object({ name: z10.string() }))
|
|
1146
1311
|
});
|
|
1147
|
-
|
|
1148
|
-
tradelinkId:
|
|
1312
|
+
z10.object({
|
|
1313
|
+
tradelinkId: z10.string(),
|
|
1149
1314
|
workspaceName: zWorkspaceName,
|
|
1150
1315
|
custodian: zTradelinkOrgEntityResponse,
|
|
1151
|
-
assetManagers:
|
|
1152
|
-
exchanges:
|
|
1316
|
+
assetManagers: z10.array(zTradelinkOrgEntityResponse),
|
|
1317
|
+
exchanges: z10.array(zTradelinkOrgEntityResponse)
|
|
1153
1318
|
});
|
|
1154
|
-
var zTradelinkAsset =
|
|
1155
|
-
name:
|
|
1156
|
-
magnitude:
|
|
1319
|
+
var zTradelinkAsset = z10.object({
|
|
1320
|
+
name: z10.string(),
|
|
1321
|
+
magnitude: z10.number().int().nonnegative()
|
|
1157
1322
|
});
|
|
1158
|
-
|
|
1323
|
+
z10.object({
|
|
1159
1324
|
tradelinkId: zTradelinkId,
|
|
1160
1325
|
asset: zTradelinkAsset,
|
|
1161
|
-
state:
|
|
1326
|
+
state: z10.enum([
|
|
1162
1327
|
"PLEDGE_READY",
|
|
1163
1328
|
"PLEDGE_INCREMENT_PENDING_APPROVAL",
|
|
1164
1329
|
"PLEDGE_APPROVED",
|
|
@@ -1175,28 +1340,28 @@ z7.object({
|
|
|
1175
1340
|
"RECOVERING_FROM_FAILURE",
|
|
1176
1341
|
"PLEDGE_CONSUMED"
|
|
1177
1342
|
]),
|
|
1178
|
-
isLocked:
|
|
1179
|
-
amount:
|
|
1180
|
-
pending:
|
|
1181
|
-
repledge:
|
|
1182
|
-
exchangeTradelinkId:
|
|
1183
|
-
accountId:
|
|
1184
|
-
});
|
|
1185
|
-
|
|
1186
|
-
workspaceName:
|
|
1187
|
-
clientAccountId:
|
|
1343
|
+
isLocked: z10.boolean(),
|
|
1344
|
+
amount: z10.string().meta({ description: "Currently pledged amount" }),
|
|
1345
|
+
pending: z10.string().meta({ description: "Requested pledge increment, not yet approved" }),
|
|
1346
|
+
repledge: z10.string().meta({ description: "TODO: describe this field" }),
|
|
1347
|
+
exchangeTradelinkId: z10.string(),
|
|
1348
|
+
accountId: z10.string()
|
|
1349
|
+
});
|
|
1350
|
+
z10.object({
|
|
1351
|
+
workspaceName: z10.string(),
|
|
1352
|
+
clientAccountId: z10.string().meta({ description: "Account ID from the client side" }),
|
|
1188
1353
|
exchangeTradelinkId: zTradelinkId,
|
|
1189
1354
|
asset: zTradelinkAsset
|
|
1190
1355
|
});
|
|
1191
|
-
|
|
1356
|
+
z10.object({
|
|
1192
1357
|
pledgeTradelinkId: zTradelinkId,
|
|
1193
1358
|
amount: zUnsignedIntString,
|
|
1194
1359
|
asset: zTradelinkAsset
|
|
1195
1360
|
});
|
|
1196
|
-
|
|
1197
|
-
tradelinkId:
|
|
1198
|
-
pledgeTradelinkId:
|
|
1199
|
-
state:
|
|
1361
|
+
z10.object({
|
|
1362
|
+
tradelinkId: z10.string(),
|
|
1363
|
+
pledgeTradelinkId: z10.string(),
|
|
1364
|
+
state: z10.enum([
|
|
1200
1365
|
"REGISTERED",
|
|
1201
1366
|
"PENDING_REPLEDGE_CREATION_APPROVAL",
|
|
1202
1367
|
"PENDING_REPLEDGE_APPROVAL",
|
|
@@ -1210,115 +1375,161 @@ z7.object({
|
|
|
1210
1375
|
"CANCELED"
|
|
1211
1376
|
]),
|
|
1212
1377
|
// For now we only consider the outbound settlement
|
|
1213
|
-
outboundTransactionHash:
|
|
1378
|
+
outboundTransactionHash: z10.string().nullable()
|
|
1214
1379
|
});
|
|
1215
1380
|
|
|
1216
1381
|
// src/tradelink/request-data.ts
|
|
1217
|
-
var zTradelinkActivateAccountRequestData =
|
|
1218
|
-
var zTradelinkCustodianRequestData =
|
|
1382
|
+
var zTradelinkActivateAccountRequestData = z10.null();
|
|
1383
|
+
var zTradelinkCustodianRequestData = z10.object({
|
|
1219
1384
|
settlement: zReviewStepWithUsersArray.meta({ description: "List of settlement review steps" }),
|
|
1220
1385
|
withdraw: zReviewStepWithUsersArray.meta({ description: "List of withdraw review steps" }),
|
|
1221
1386
|
arbitration: zReviewStepWithUsersArray.meta({ description: "List of arbitration review steps" })
|
|
1222
1387
|
});
|
|
1223
|
-
var zTradelinkEntityRequestData =
|
|
1224
|
-
tradelinkId:
|
|
1388
|
+
var zTradelinkEntityRequestData = z10.object({
|
|
1389
|
+
tradelinkId: z10.string().min(1),
|
|
1225
1390
|
groups: zReviewStepWithUsersArray.meta({ description: "List of asset manager review groups" }),
|
|
1226
|
-
whitelist:
|
|
1391
|
+
whitelist: z10.array(zTradelinkWhitelistAddress).meta({ description: "List of asset manager whitelisted addresses" })
|
|
1227
1392
|
});
|
|
1228
|
-
var zTradelinkAdjustPledgeRequestData =
|
|
1229
|
-
accountId:
|
|
1230
|
-
exchangeId:
|
|
1393
|
+
var zTradelinkAdjustPledgeRequestData = z10.object({
|
|
1394
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1395
|
+
exchangeId: z10.string().meta({ description: "Exchange id" }),
|
|
1231
1396
|
amount: zIntString.meta({ description: "Amount to add to pledge" })
|
|
1232
1397
|
});
|
|
1233
|
-
var zTradelinkRepledgeRequestData =
|
|
1234
|
-
accountId:
|
|
1235
|
-
exchangeId:
|
|
1398
|
+
var zTradelinkRepledgeRequestData = z10.object({
|
|
1399
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1400
|
+
exchangeId: z10.string().meta({ description: "Exchange id" }),
|
|
1236
1401
|
amount: zIntString.meta({ description: "Amount to add to pledge" })
|
|
1237
1402
|
});
|
|
1238
|
-
var zTradelinkCreateSettlementRequestData =
|
|
1239
|
-
accountId:
|
|
1240
|
-
exchangeId:
|
|
1403
|
+
var zTradelinkCreateSettlementRequestData = z10.object({
|
|
1404
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1405
|
+
exchangeId: z10.string().meta({ description: "Exchange id" }),
|
|
1241
1406
|
transaction: zSendOnlyTransactionData
|
|
1242
1407
|
});
|
|
1243
|
-
var zTradelinkForceUnpledgeRequestData =
|
|
1244
|
-
accountId:
|
|
1245
|
-
exchangeId:
|
|
1408
|
+
var zTradelinkForceUnpledgeRequestData = z10.object({
|
|
1409
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1410
|
+
exchangeId: z10.string().meta({ description: "Exchange id" })
|
|
1246
1411
|
});
|
|
1247
|
-
var zTradelinkWithdrawRequestData =
|
|
1248
|
-
accountId:
|
|
1412
|
+
var zTradelinkWithdrawRequestData = z10.object({
|
|
1413
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1249
1414
|
transaction: zSendOnlyTransactionData
|
|
1250
1415
|
});
|
|
1251
|
-
var zTradelinkArbitrationRequestData =
|
|
1252
|
-
accountId:
|
|
1416
|
+
var zTradelinkArbitrationRequestData = z10.object({
|
|
1417
|
+
accountId: z10.string().meta({ description: "Account id" }),
|
|
1253
1418
|
transaction: zSendOnlyTransactionData
|
|
1254
1419
|
});
|
|
1255
1420
|
var zTradelinkRequestMixinsByType = {
|
|
1256
|
-
[RequestType.TRADELINK_ACTIVATE_ACCOUNT]:
|
|
1257
|
-
type:
|
|
1258
|
-
targetId:
|
|
1421
|
+
[RequestType.TRADELINK_ACTIVATE_ACCOUNT]: z10.object({
|
|
1422
|
+
type: z10.literal(RequestType.TRADELINK_ACTIVATE_ACCOUNT),
|
|
1423
|
+
targetId: z10.string(),
|
|
1259
1424
|
data: zTradelinkActivateAccountRequestData
|
|
1260
1425
|
}),
|
|
1261
|
-
[RequestType.TRADELINK_CREATE_CUSTODIAN]:
|
|
1262
|
-
type:
|
|
1426
|
+
[RequestType.TRADELINK_CREATE_CUSTODIAN]: z10.object({
|
|
1427
|
+
type: z10.literal(RequestType.TRADELINK_CREATE_CUSTODIAN),
|
|
1263
1428
|
data: zTradelinkCustodianRequestData
|
|
1264
1429
|
}),
|
|
1265
|
-
[RequestType.TRADELINK_EDIT_CUSTODIAN]:
|
|
1266
|
-
type:
|
|
1267
|
-
targetId:
|
|
1430
|
+
[RequestType.TRADELINK_EDIT_CUSTODIAN]: z10.object({
|
|
1431
|
+
type: z10.literal(RequestType.TRADELINK_EDIT_CUSTODIAN),
|
|
1432
|
+
targetId: z10.string(),
|
|
1268
1433
|
data: zTradelinkCustodianRequestData
|
|
1269
1434
|
}),
|
|
1270
|
-
[RequestType.TRADELINK_CREATE_EXCHANGE]:
|
|
1271
|
-
type:
|
|
1435
|
+
[RequestType.TRADELINK_CREATE_EXCHANGE]: z10.object({
|
|
1436
|
+
type: z10.literal(RequestType.TRADELINK_CREATE_EXCHANGE),
|
|
1272
1437
|
data: zTradelinkEntityRequestData
|
|
1273
1438
|
}),
|
|
1274
|
-
[RequestType.TRADELINK_EDIT_EXCHANGE]:
|
|
1275
|
-
type:
|
|
1276
|
-
targetId:
|
|
1439
|
+
[RequestType.TRADELINK_EDIT_EXCHANGE]: z10.object({
|
|
1440
|
+
type: z10.literal(RequestType.TRADELINK_EDIT_EXCHANGE),
|
|
1441
|
+
targetId: z10.string(),
|
|
1277
1442
|
data: zTradelinkEntityRequestData
|
|
1278
1443
|
}),
|
|
1279
|
-
[RequestType.TRADELINK_CREATE_ASSET_MANAGER]:
|
|
1280
|
-
type:
|
|
1444
|
+
[RequestType.TRADELINK_CREATE_ASSET_MANAGER]: z10.object({
|
|
1445
|
+
type: z10.literal(RequestType.TRADELINK_CREATE_ASSET_MANAGER),
|
|
1281
1446
|
data: zTradelinkEntityRequestData
|
|
1282
1447
|
}),
|
|
1283
|
-
[RequestType.TRADELINK_EDIT_ASSET_MANAGER]:
|
|
1284
|
-
type:
|
|
1285
|
-
targetId:
|
|
1448
|
+
[RequestType.TRADELINK_EDIT_ASSET_MANAGER]: z10.object({
|
|
1449
|
+
type: z10.literal(RequestType.TRADELINK_EDIT_ASSET_MANAGER),
|
|
1450
|
+
targetId: z10.string(),
|
|
1286
1451
|
data: zTradelinkEntityRequestData
|
|
1287
1452
|
}),
|
|
1288
|
-
[RequestType.TRADELINK_ADJUST_PLEDGE]:
|
|
1289
|
-
type:
|
|
1453
|
+
[RequestType.TRADELINK_ADJUST_PLEDGE]: z10.object({
|
|
1454
|
+
type: z10.literal(RequestType.TRADELINK_ADJUST_PLEDGE),
|
|
1290
1455
|
data: zTradelinkAdjustPledgeRequestData
|
|
1291
1456
|
}),
|
|
1292
|
-
[RequestType.TRADELINK_REPLEDGE]:
|
|
1293
|
-
type:
|
|
1457
|
+
[RequestType.TRADELINK_REPLEDGE]: z10.object({
|
|
1458
|
+
type: z10.literal(RequestType.TRADELINK_REPLEDGE),
|
|
1294
1459
|
data: zTradelinkRepledgeRequestData
|
|
1295
1460
|
}),
|
|
1296
|
-
[RequestType.TRADELINK_CREATE_SETTLEMENT]:
|
|
1297
|
-
type:
|
|
1461
|
+
[RequestType.TRADELINK_CREATE_SETTLEMENT]: z10.object({
|
|
1462
|
+
type: z10.literal(RequestType.TRADELINK_CREATE_SETTLEMENT),
|
|
1298
1463
|
data: zTradelinkCreateSettlementRequestData,
|
|
1299
|
-
meta:
|
|
1300
|
-
hash:
|
|
1464
|
+
meta: z10.object({
|
|
1465
|
+
hash: z10.string().nullable()
|
|
1301
1466
|
}).optional().nullable()
|
|
1302
1467
|
}),
|
|
1303
|
-
[RequestType.TRADELINK_FORCE_UNPLEDGE]:
|
|
1304
|
-
type:
|
|
1468
|
+
[RequestType.TRADELINK_FORCE_UNPLEDGE]: z10.object({
|
|
1469
|
+
type: z10.literal(RequestType.TRADELINK_FORCE_UNPLEDGE),
|
|
1305
1470
|
data: zTradelinkForceUnpledgeRequestData
|
|
1306
1471
|
}),
|
|
1307
|
-
[RequestType.TRADELINK_WITHDRAW]:
|
|
1308
|
-
type:
|
|
1472
|
+
[RequestType.TRADELINK_WITHDRAW]: z10.object({
|
|
1473
|
+
type: z10.literal(RequestType.TRADELINK_WITHDRAW),
|
|
1309
1474
|
data: zTradelinkWithdrawRequestData,
|
|
1310
|
-
meta:
|
|
1311
|
-
hash:
|
|
1475
|
+
meta: z10.object({
|
|
1476
|
+
hash: z10.string().nullable()
|
|
1312
1477
|
}).optional().nullable()
|
|
1313
1478
|
}),
|
|
1314
|
-
[RequestType.TRADELINK_ARBITRATE]:
|
|
1315
|
-
type:
|
|
1479
|
+
[RequestType.TRADELINK_ARBITRATE]: z10.object({
|
|
1480
|
+
type: z10.literal(RequestType.TRADELINK_ARBITRATE),
|
|
1316
1481
|
data: zTradelinkArbitrationRequestData,
|
|
1317
|
-
meta:
|
|
1318
|
-
hash:
|
|
1482
|
+
meta: z10.object({
|
|
1483
|
+
hash: z10.string().nullable()
|
|
1319
1484
|
}).optional().nullable()
|
|
1320
1485
|
})
|
|
1321
1486
|
};
|
|
1487
|
+
var zMessageType = z10.enum(MessageType).meta({ description: "Type of the message to sign" });
|
|
1488
|
+
var zMessageData = zHexString.nonempty().meta({
|
|
1489
|
+
description: "Hex data to sign, either a json string for EIP712, or a raw string for EIP191"
|
|
1490
|
+
});
|
|
1491
|
+
var zMessage = z10.object({
|
|
1492
|
+
type: zMessageType,
|
|
1493
|
+
data: zMessageData
|
|
1494
|
+
});
|
|
1495
|
+
z10.object({
|
|
1496
|
+
id: z10.string().meta({ description: "Unique identifier" }),
|
|
1497
|
+
type: zMessageType,
|
|
1498
|
+
data: zMessageData,
|
|
1499
|
+
address: z10.string().meta({ description: "Address of the signing key" }),
|
|
1500
|
+
derivationPath: z10.string().meta({ description: "Derivation path of the signing key" }),
|
|
1501
|
+
signature: zHsmSignature.meta({ description: "Signature of the message" }),
|
|
1502
|
+
createdById: z10.string().meta({ description: "ID of the creator" }),
|
|
1503
|
+
createdAt: z10.coerce.date().meta({ description: "Creation timestamp" })
|
|
1504
|
+
}).meta({ description: "Signed message", id: "SignedMessageResponse" });
|
|
1505
|
+
var zCreateTransactionRequestData = z10.object({
|
|
1506
|
+
accountId: z10.string().min(1).meta({ description: "Target account id" }),
|
|
1507
|
+
transaction: zTransactionData
|
|
1508
|
+
}).meta({
|
|
1509
|
+
description: "Create transaction request data",
|
|
1510
|
+
id: "CreateTransactionRequestData"
|
|
1511
|
+
});
|
|
1512
|
+
var zSignMessageRequestData = z10.object({
|
|
1513
|
+
message: zMessage.meta({ description: "Message to sign" }),
|
|
1514
|
+
accountId: z10.string().min(1).meta({ description: "Target account id" }),
|
|
1515
|
+
address: z10.string().nonempty().meta({ description: "Address with which to sign the message" }),
|
|
1516
|
+
derivationPath: z10.string().nonempty().meta({ description: "Derivation path of the signing address" })
|
|
1517
|
+
});
|
|
1518
|
+
var zSignMessageUserInputData = zSignMessageRequestData.partial({
|
|
1519
|
+
address: true,
|
|
1520
|
+
derivationPath: true
|
|
1521
|
+
});
|
|
1522
|
+
var zDigestData = z10.object({
|
|
1523
|
+
digest: zHexString.meta({ description: "The hex string digest to sign" }),
|
|
1524
|
+
derivationPath: z10.string().nonempty().meta({ description: "The derivation path with which to sign the digest" })
|
|
1525
|
+
});
|
|
1526
|
+
var zSignDigestsRequestData = z10.object({
|
|
1527
|
+
accountId: z10.string().min(1).meta({ description: "Target account id" }),
|
|
1528
|
+
digests: z10.array(zDigestData).meta({ description: "The digests to sign" })
|
|
1529
|
+
});
|
|
1530
|
+
z10.object({
|
|
1531
|
+
signatures: z10.array(zHsmSignature)
|
|
1532
|
+
});
|
|
1322
1533
|
|
|
1323
1534
|
// src/accounts/account-governance-fields.ts
|
|
1324
1535
|
var zClassicAccountGovernanceFields = z.object({
|
|
@@ -1333,228 +1544,71 @@ var zTradelinkAccountGovernanceFields = z.object({
|
|
|
1333
1544
|
})
|
|
1334
1545
|
}).meta({ description: "Tradelink" });
|
|
1335
1546
|
var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).meta({ description: "Governance fields" });
|
|
1336
|
-
var zCardanoLikeStakingData = z7.object({
|
|
1337
|
-
staked: z7.string().meta({ description: "Staked balance" })
|
|
1338
|
-
}).nullable().meta({ description: "Cardano-like staking data" });
|
|
1339
|
-
var zCardanoLikeStakingFields = z7.object({
|
|
1340
|
-
type: z7.literal(AccountType.CARDANO_LIKE).meta({ description: "Account type" }),
|
|
1341
|
-
staking: zCardanoLikeStakingData.optional()
|
|
1342
|
-
});
|
|
1343
|
-
var zEthereumLikeStakingData = z7.object({
|
|
1344
|
-
totalStaking: z7.string().meta({ description: "Total staked amount" }),
|
|
1345
|
-
totalRewards: z7.string().meta({ description: "Total of rewards" }),
|
|
1346
|
-
availableRewards: z7.string().meta({ description: "Available rewards" }),
|
|
1347
|
-
networkApy: z7.number().meta({ description: "Network APY" })
|
|
1348
|
-
}).nullable().meta({ description: "Ethereum-like staking data" });
|
|
1349
|
-
var zEthereumLikeStakingFields = z7.object({
|
|
1350
|
-
type: z7.literal(AccountType.ETHEREUM_LIKE).meta({ description: "Account type" }),
|
|
1351
|
-
staking: zEthereumLikeStakingData.optional()
|
|
1352
|
-
});
|
|
1353
|
-
var zPolkadotUnbondingAmount = z7.object({
|
|
1354
|
-
amount: z7.string().meta({ description: "Amount" }),
|
|
1355
|
-
waiting_time: z7.string().meta({ description: "Waiting time" })
|
|
1356
|
-
});
|
|
1357
|
-
var zPolkadotLikeStakingData = z7.object({
|
|
1358
|
-
info: z7.object({
|
|
1359
|
-
controllerAddress: z7.string().nullable().meta({ description: "Controller address" }),
|
|
1360
|
-
rewardsDestination: z7.string().nullable().meta({ description: "Rewards destination" }),
|
|
1361
|
-
proxies: z7.array(z7.string()).meta({ description: "Proxies" }),
|
|
1362
|
-
legacyStaking: z7.boolean().meta({ description: "True if account uses legacy staking" }),
|
|
1363
|
-
isNominator: z7.boolean().meta({ description: "True if is nominator" })
|
|
1364
|
-
}),
|
|
1365
|
-
balances: z7.object({
|
|
1366
|
-
free: z7.string().meta({ description: "Free balance" }),
|
|
1367
|
-
reserved: z7.string().meta({ description: "Reserved balance" }),
|
|
1368
|
-
frozen: z7.string().meta({ description: "Frozen balance" }),
|
|
1369
|
-
bonded: z7.string().meta({ description: "Bonded balance" }),
|
|
1370
|
-
available: z7.string().meta({ description: "Available balance" }),
|
|
1371
|
-
unbonding: z7.array(zPolkadotUnbondingAmount).meta({ description: "Unbonding balances" }),
|
|
1372
|
-
unbonded: z7.array(zPolkadotUnbondingAmount).meta({ description: "Unbonded balances" }),
|
|
1373
|
-
totalUnbonding: z7.string().meta({ description: "Total unbonding" }),
|
|
1374
|
-
totalUnbonded: z7.string().meta({ description: "Total unbonded" })
|
|
1375
|
-
}),
|
|
1376
|
-
anonymousProxy: z7.object({
|
|
1377
|
-
address: z7.string().meta({ description: "Address" }),
|
|
1378
|
-
createdAt: z7.string().meta({ description: "Creation date" }),
|
|
1379
|
-
isController: z7.boolean().meta({ description: "True if is controller" }),
|
|
1380
|
-
isMain: z7.boolean().meta({ description: "True if is main" }),
|
|
1381
|
-
balances: z7.object({
|
|
1382
|
-
free: z7.string().meta({ description: "Anonymous proxy free balance" }),
|
|
1383
|
-
reserved: z7.string().meta({ description: "Anonymous proxy reserved balance" }),
|
|
1384
|
-
frozen: z7.string().meta({ description: "Anonymous proxy frozen balance" }),
|
|
1385
|
-
bonded: z7.string().meta({ description: "Anonymous proxy bonded balance" }),
|
|
1386
|
-
available: z7.string().meta({ description: "Anonymous proxy available balance" }),
|
|
1387
|
-
total: z7.string().meta({ description: "Anonymous proxy total balance" })
|
|
1388
|
-
}).nullable(),
|
|
1389
|
-
blockHeight: z7.string().meta({ description: "Anonymous proxy block height" }),
|
|
1390
|
-
extIndex: z7.string().meta({ description: "Ext index" }),
|
|
1391
|
-
index: z7.string().meta({ description: "Index" }),
|
|
1392
|
-
kind: z7.string().meta({ description: "Kind" })
|
|
1393
|
-
}).nullable().meta({ description: "Anonymous proxy" })
|
|
1394
|
-
}).nullable().meta({ description: "Polkadot-like staking data" });
|
|
1395
|
-
var zPolkadotLikeStakingFields = z7.object({
|
|
1396
|
-
type: z7.literal(AccountType.POLKADOT_LIKE).meta({ description: "Account type" }),
|
|
1397
|
-
staking: zPolkadotLikeStakingData.optional()
|
|
1398
|
-
});
|
|
1399
|
-
var zSolanaStakingAccountStatus = z7.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).meta({ description: "Staking account status" });
|
|
1400
|
-
var zSolanaLikeStakingData = z7.object({
|
|
1401
|
-
staked: z7.string().meta({ description: "Staked balance" }),
|
|
1402
|
-
rewards: z7.object({
|
|
1403
|
-
total: z7.string().meta({ description: "Total rewards" }),
|
|
1404
|
-
last7: z7.string().meta({ description: "Rewards on last 7 days" }),
|
|
1405
|
-
last30: z7.string().meta({ description: "Rewards on last 30 days" })
|
|
1406
|
-
}),
|
|
1407
|
-
stakes: z7.array(
|
|
1408
|
-
z7.object({
|
|
1409
|
-
uid: z7.string(),
|
|
1410
|
-
baseAccountUid: z7.string(),
|
|
1411
|
-
pubKey: z7.string().meta({ description: "Public key" }),
|
|
1412
|
-
validatorPubKey: z7.string().nullable().meta({ description: "Validator public key" }),
|
|
1413
|
-
initialAmount: z7.string().meta({ description: "Initial amount" }),
|
|
1414
|
-
activeAmount: z7.string().meta({ description: "Active amount" }),
|
|
1415
|
-
inactiveAmount: z7.string().meta({ description: "Inactive amount" }),
|
|
1416
|
-
totalBalance: z7.string().meta({ description: "Total balance" }),
|
|
1417
|
-
creationDate: z7.string().meta({ description: "Creation date" }),
|
|
1418
|
-
activationEpoch: z7.string().nullable().meta({ description: "Activation epoch" }),
|
|
1419
|
-
activationDate: z7.string().nullable().meta({ description: "Activation date" }),
|
|
1420
|
-
deactivationEpoch: z7.string().nullable().meta({ description: "Deactivation epoch" }),
|
|
1421
|
-
deactivationDate: z7.string().nullable().meta({ description: "Deactivation date" }),
|
|
1422
|
-
status: zSolanaStakingAccountStatus,
|
|
1423
|
-
rentExemptReserve: z7.string().meta({ description: "Rent exempt reserve" }),
|
|
1424
|
-
withdrawableAmount: z7.string().meta({ description: "Withdrawable amount" }),
|
|
1425
|
-
totalRewards: z7.string().meta({ description: "Total rewards" }),
|
|
1426
|
-
creationTxHash: z7.string().nullable().meta({ description: "Creation transaction hash" }),
|
|
1427
|
-
actionsTxHashes: z7.array(z7.string()).meta({ description: "Actions transactions hashes" })
|
|
1428
|
-
})
|
|
1429
|
-
)
|
|
1430
|
-
}).nullable().meta({ description: "Solana-like staking data" });
|
|
1431
|
-
var zSolanaLikeStakingFields = z7.object({
|
|
1432
|
-
type: z7.literal(AccountType.SOLANA_LIKE).meta({ description: "Account type" }),
|
|
1433
|
-
staking: zSolanaLikeStakingData.optional()
|
|
1434
|
-
});
|
|
1435
|
-
var zSuiLikeStakingData = z7.object({
|
|
1436
|
-
totalStaked: z7.string().meta({ description: "Total staked amount" }),
|
|
1437
|
-
totalRewards: z7.string().meta({ description: "Total of rewards" })
|
|
1438
|
-
}).nullable().meta({ description: "Sui-like staking data" });
|
|
1439
|
-
var zSuiLikeStakingFields = z7.object({
|
|
1440
|
-
type: z7.literal(AccountType.SUI_LIKE).meta({ description: "Account type" }),
|
|
1441
|
-
staking: zSuiLikeStakingData.optional()
|
|
1442
|
-
});
|
|
1443
|
-
var zTezosLikeStakingData = z7.object({
|
|
1444
|
-
delegations: z7.array(
|
|
1445
|
-
z7.object({
|
|
1446
|
-
address: z7.string()
|
|
1447
|
-
})
|
|
1448
|
-
)
|
|
1449
|
-
}).nullable().meta({ description: "Tezos-like staking data" });
|
|
1450
|
-
var zTezosLikeStakingFields = z7.object({
|
|
1451
|
-
type: z7.literal(AccountType.TEZOS_LIKE).meta({ description: "Account type" }),
|
|
1452
|
-
staking: zTezosLikeStakingData.optional()
|
|
1453
|
-
});
|
|
1454
|
-
z7.discriminatedUnion("type", [
|
|
1455
|
-
zCardanoLikeStakingFields,
|
|
1456
|
-
zEthereumLikeStakingFields,
|
|
1457
|
-
zPolkadotLikeStakingFields,
|
|
1458
|
-
zSolanaLikeStakingFields,
|
|
1459
|
-
zSuiLikeStakingFields,
|
|
1460
|
-
zTezosLikeStakingFields
|
|
1461
|
-
]);
|
|
1462
1547
|
|
|
1463
1548
|
// src/accounts/types.ts
|
|
1464
|
-
var zAccountCommonFields =
|
|
1465
|
-
id:
|
|
1466
|
-
legacyId:
|
|
1467
|
-
name:
|
|
1549
|
+
var zAccountCommonFields = z10.object({
|
|
1550
|
+
id: z10.string().meta({ description: "Internal unique identifier" }),
|
|
1551
|
+
legacyId: z10.number().meta({ description: "Legacy internal unique identifier (for retro-compatibility)" }),
|
|
1552
|
+
name: z10.string().meta({ description: "Name" }),
|
|
1468
1553
|
currency: zCurrencyString,
|
|
1469
1554
|
network: zNetwork,
|
|
1470
|
-
contractAddress:
|
|
1471
|
-
index:
|
|
1472
|
-
derivationPath:
|
|
1473
|
-
status:
|
|
1474
|
-
createdAt:
|
|
1475
|
-
updatedAt:
|
|
1476
|
-
});
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1479
|
-
pending: z7.string().meta({ description: "Pending balance" })
|
|
1480
|
-
}).meta({ description: "Balance fields" });
|
|
1555
|
+
contractAddress: z10.string().nullable().meta({ description: "Token contract address for Token account" }),
|
|
1556
|
+
index: z10.number().gte(0).meta({ description: "BIP44 account index" }),
|
|
1557
|
+
derivationPath: z10.string().meta({ description: "Derivation path" }),
|
|
1558
|
+
status: z10.enum(ActivationStatus).meta({ description: "Status" }),
|
|
1559
|
+
createdAt: z10.coerce.date().meta({ description: "Creation timestamp" }),
|
|
1560
|
+
updatedAt: z10.coerce.date().meta({ description: "Last modification timestamp" })
|
|
1561
|
+
});
|
|
1562
|
+
var zRawSigningAssetFields = z10.object({ type: z10.literal(AccountType.RAW_SIGNING).meta({ description: "Account type" }) }).meta({ description: "Raw signing account" });
|
|
1563
|
+
var zAccountAssetFields = z10.discriminatedUnion("type", [zRawSigningAssetFields, ...zNetworkAssetFields.options]).meta({ description: "Account asset fields" });
|
|
1481
1564
|
var zAccountResponse = zAccountCommonFields.extend({
|
|
1482
|
-
asset:
|
|
1565
|
+
asset: zAccountAssetFields,
|
|
1483
1566
|
governance: zAccountGovernanceFields
|
|
1484
1567
|
});
|
|
1485
|
-
|
|
1568
|
+
z10.enum([
|
|
1486
1569
|
"name",
|
|
1487
1570
|
"currency",
|
|
1488
1571
|
"index",
|
|
1489
1572
|
"createdAt",
|
|
1490
1573
|
"updatedAt"
|
|
1491
1574
|
]).default("createdAt");
|
|
1492
|
-
var zCommonLiveData = z7.object({
|
|
1493
|
-
id: z7.string().meta({ description: "Account internal unique identifier" }),
|
|
1494
|
-
balance: zAccountBalanceFields
|
|
1495
|
-
});
|
|
1496
|
-
var zBitcoinLikeLiveData = zCommonLiveData.extend({
|
|
1497
|
-
type: z7.literal(AccountType.BITCOIN_LIKE).meta({ description: "Account type" })
|
|
1498
|
-
}).meta({ description: "Bitcoin-like" });
|
|
1499
|
-
var zCardanoLikeLiveData = zCommonLiveData.extend(zCardanoLikeStakingFields.shape).meta({ description: "Cardano-like" });
|
|
1500
|
-
var zEthereumLikeLiveData = zCommonLiveData.extend(zEthereumLikeStakingFields.shape).meta({ description: "Ethereum-like" });
|
|
1501
|
-
var zEthereumTokenLikeLiveData = zCommonLiveData.extend({
|
|
1502
|
-
type: z7.enum([AccountType.ERC20_LIKE, AccountType.BEP20_LIKE]).meta({ description: "Account type" })
|
|
1503
|
-
}).meta({ description: "Ethereum-like token" });
|
|
1504
|
-
var zGenericLikeLiveData = zCommonLiveData.extend({
|
|
1505
|
-
type: z7.literal(AccountType.GENERIC_LIKE).meta({ description: "Account type" })
|
|
1506
|
-
}).meta({ description: "Generic-like" });
|
|
1507
|
-
var zPolkadotLikeLiveData = zCommonLiveData.extend(zPolkadotLikeStakingFields.shape).meta({ description: "Polkadot-like" });
|
|
1508
1575
|
var zRawSigningLiveData = zCommonLiveData.extend({
|
|
1509
|
-
type:
|
|
1576
|
+
type: z10.literal(AccountType.RAW_SIGNING).meta({ description: "Account type" })
|
|
1510
1577
|
}).meta({ description: "Raw signing account" });
|
|
1511
|
-
|
|
1512
|
-
type: z7.literal(AccountType.RIPPLE_LIKE).meta({ description: "Account type" })
|
|
1513
|
-
}).meta({ description: "Ripple-like" });
|
|
1514
|
-
var zSolanaLikeLiveData = zCommonLiveData.extend(zSolanaLikeStakingFields.shape).meta({ description: "Solana-like" });
|
|
1515
|
-
var zStellarLikeLiveData = zCommonLiveData.extend({
|
|
1516
|
-
type: z7.literal(AccountType.STELLAR_LIKE).meta({ description: "Account type" })
|
|
1517
|
-
}).meta({ description: "Stellar-like" });
|
|
1518
|
-
var zSuiLikeLiveData = zCommonLiveData.extend(zSuiLikeStakingFields.shape).meta({ description: "Sui-like" });
|
|
1519
|
-
var zTezosLikeLiveData = zCommonLiveData.extend(zTezosLikeStakingFields.shape).meta({ description: "Tezos-like" });
|
|
1520
|
-
var zTronLikeLiveData = zCommonLiveData.extend({
|
|
1521
|
-
type: z7.enum([AccountType.TRON_LIKE, AccountType.TRC20_LIKE]).meta({ description: "Account type" })
|
|
1522
|
-
}).meta({ description: "Tron-like" });
|
|
1523
|
-
z7.discriminatedUnion("type", [
|
|
1524
|
-
zBitcoinLikeLiveData,
|
|
1525
|
-
zCardanoLikeLiveData,
|
|
1526
|
-
zEthereumLikeLiveData,
|
|
1527
|
-
zEthereumTokenLikeLiveData,
|
|
1528
|
-
zGenericLikeLiveData,
|
|
1529
|
-
zPolkadotLikeLiveData,
|
|
1578
|
+
z10.discriminatedUnion("type", [
|
|
1530
1579
|
zRawSigningLiveData,
|
|
1531
|
-
|
|
1532
|
-
zSolanaLikeLiveData,
|
|
1533
|
-
zStellarLikeLiveData,
|
|
1534
|
-
zSuiLikeLiveData,
|
|
1535
|
-
zTezosLikeLiveData,
|
|
1536
|
-
zTronLikeLiveData
|
|
1580
|
+
...zAccountLiveData.options
|
|
1537
1581
|
]);
|
|
1538
|
-
|
|
1539
|
-
address:
|
|
1540
|
-
derivationPath:
|
|
1582
|
+
z10.object({
|
|
1583
|
+
address: z10.string().meta({ description: "Address" }),
|
|
1584
|
+
derivationPath: z10.string().nullable().meta({ description: "Derivation path" })
|
|
1541
1585
|
});
|
|
1542
|
-
|
|
1586
|
+
z10.object({
|
|
1543
1587
|
amount: zIntString.meta({ description: "Amount in the smallest unit of the currency" }),
|
|
1544
1588
|
currency: zCurrency
|
|
1545
1589
|
});
|
|
1546
|
-
|
|
1547
|
-
id:
|
|
1548
|
-
validator:
|
|
1549
|
-
state:
|
|
1550
|
-
staked:
|
|
1551
|
-
rewards:
|
|
1552
|
-
total:
|
|
1590
|
+
z10.object({
|
|
1591
|
+
id: z10.string().nonempty().meta({ description: "Staking position ID (if applicable)" }),
|
|
1592
|
+
validator: z10.string().nonempty().meta({ description: "Validator address" }),
|
|
1593
|
+
state: z10.enum(["ACTIVE", "INACTIVE", "ACTIVATING", "DEACTIVATING", "UNKNOWN"]).meta({ description: "Stake state" }),
|
|
1594
|
+
staked: z10.string().meta({ description: "Staked amount" }),
|
|
1595
|
+
rewards: z10.object({
|
|
1596
|
+
total: z10.string().meta({ description: "Total rewards" })
|
|
1553
1597
|
})
|
|
1554
1598
|
});
|
|
1599
|
+
z10.object({
|
|
1600
|
+
address: z10.string().meta({ description: "Validator address" }),
|
|
1601
|
+
apy: z10.string().nullable().meta({ description: "Validator APY" }),
|
|
1602
|
+
balance: z10.string().nullable().meta({ description: "Validator balance" }),
|
|
1603
|
+
commissionRate: z10.string().nullable().meta({ description: "Validator commission rate" }),
|
|
1604
|
+
description: z10.string().nullable().meta({ description: "Description" }),
|
|
1605
|
+
logo: z10.string().nullable().meta({ description: "Logo URL" }),
|
|
1606
|
+
name: z10.string().nullable().meta({ description: "Validator name" }),
|
|
1607
|
+
url: z10.string().nullable().meta({ description: "Validator URL" })
|
|
1608
|
+
});
|
|
1555
1609
|
|
|
1556
1610
|
// src/accounts/app-types.ts
|
|
1557
|
-
|
|
1611
|
+
z10.discriminatedUnion(
|
|
1558
1612
|
zTransactionResponse._zod.def.discriminator,
|
|
1559
1613
|
ensureNonEmptyArray(
|
|
1560
1614
|
zTransactionResponse.options.map(
|
|
@@ -1564,29 +1618,29 @@ z7.discriminatedUnion(
|
|
|
1564
1618
|
)
|
|
1565
1619
|
)
|
|
1566
1620
|
);
|
|
1567
|
-
var zWhitelistAddress =
|
|
1568
|
-
name:
|
|
1621
|
+
var zWhitelistAddress = z10.object({
|
|
1622
|
+
name: z10.string().min(1).max(50),
|
|
1569
1623
|
currency: zCurrencyString,
|
|
1570
|
-
address:
|
|
1624
|
+
address: z10.string().min(1).max(200),
|
|
1571
1625
|
// Destination tags are numeric-only or alpha-numeric.
|
|
1572
1626
|
// Empty array (or undefined) means no check on destination tag.
|
|
1573
|
-
destinationTags:
|
|
1627
|
+
destinationTags: z10.array(z10.string().min(1).regex(/^\w+$/)).optional()
|
|
1574
1628
|
});
|
|
1575
|
-
var zWhitelistAddresses =
|
|
1576
|
-
var zWhitelistName =
|
|
1577
|
-
var zCreateWhitelistRequestData =
|
|
1629
|
+
var zWhitelistAddresses = z10.array(zWhitelistAddress);
|
|
1630
|
+
var zWhitelistName = z10.string().min(1).max(45).meta({ description: "Whitelist name" });
|
|
1631
|
+
var zCreateWhitelistRequestData = z10.object({
|
|
1578
1632
|
name: zWhitelistName,
|
|
1579
|
-
description:
|
|
1633
|
+
description: z10.string().nullable(),
|
|
1580
1634
|
addresses: zWhitelistAddresses,
|
|
1581
|
-
type:
|
|
1635
|
+
type: z10.enum(WhitelistType)
|
|
1582
1636
|
});
|
|
1583
|
-
var zEditWhitelistRequestData =
|
|
1637
|
+
var zEditWhitelistRequestData = z10.object({
|
|
1584
1638
|
name: zWhitelistName,
|
|
1585
1639
|
addresses: zWhitelistAddresses
|
|
1586
1640
|
});
|
|
1587
1641
|
|
|
1588
1642
|
// src/policies/db-utils.ts
|
|
1589
|
-
var zBaseGovRuleData =
|
|
1643
|
+
var zBaseGovRuleData = z10.object({
|
|
1590
1644
|
// Steps of users that will need to review operations
|
|
1591
1645
|
reviewSteps: zReviewStepsArray,
|
|
1592
1646
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
@@ -1603,90 +1657,90 @@ zBaseGovRuleData.extend({
|
|
|
1603
1657
|
({
|
|
1604
1658
|
reviewConfigs: { include: review_config_exports.INCLUDE_MEMBERS }
|
|
1605
1659
|
});
|
|
1606
|
-
var zPolicyName =
|
|
1607
|
-
var zCurrency2 =
|
|
1608
|
-
var zCreatePublicPolicyRequestData =
|
|
1660
|
+
var zPolicyName = z10.string().min(1).max(19).meta({ description: "Policy name" });
|
|
1661
|
+
var zCurrency2 = z10.string().min(1).max(40).regex(/^\w+$/).meta({ description: "Currency" });
|
|
1662
|
+
var zCreatePublicPolicyRequestData = z10.object({
|
|
1609
1663
|
name: zPolicyName,
|
|
1610
|
-
description:
|
|
1664
|
+
description: z10.string().nullable().meta({ description: "Description" }),
|
|
1611
1665
|
currency: zCurrency2.nullable(),
|
|
1612
|
-
govRules:
|
|
1666
|
+
govRules: z10.array(zClassicGovRuleData).meta({ description: "Governance rules" })
|
|
1613
1667
|
});
|
|
1614
|
-
var zEditPublicPolicyRequestData =
|
|
1668
|
+
var zEditPublicPolicyRequestData = z10.object({
|
|
1615
1669
|
name: zPolicyName,
|
|
1616
|
-
description:
|
|
1617
|
-
govRules:
|
|
1670
|
+
description: z10.string().nullable().meta({ description: "Description" }),
|
|
1671
|
+
govRules: z10.array(zClassicGovRuleData).meta({ description: "Governance rules" })
|
|
1618
1672
|
});
|
|
1619
|
-
var zAccountName =
|
|
1620
|
-
var zSignDigestsGovRuleData =
|
|
1621
|
-
operationType:
|
|
1673
|
+
var zAccountName = z10.string().min(1).max(40).meta({ description: "Account name" });
|
|
1674
|
+
var zSignDigestsGovRuleData = z10.object({
|
|
1675
|
+
operationType: z10.literal("SIGN_DIGESTS"),
|
|
1622
1676
|
reviewSteps: zReviewStepWithUsersArray
|
|
1623
1677
|
// we need to control for API users only
|
|
1624
1678
|
}).meta({ description: "Digest signing rule" });
|
|
1625
|
-
var zAccountPolicyRequestData =
|
|
1626
|
-
|
|
1627
|
-
|
|
1679
|
+
var zAccountPolicyRequestData = z10.union([
|
|
1680
|
+
z10.object({ policyId: z10.string() }).meta({ description: "Account policy" }),
|
|
1681
|
+
z10.object({ rules: z10.array(zClassicGovRuleData) }).meta({ description: "Account governance rules" })
|
|
1628
1682
|
]).meta({ description: "Account policy or governance rules" });
|
|
1629
|
-
var zCreateAccountGovernanceData =
|
|
1630
|
-
|
|
1631
|
-
type:
|
|
1683
|
+
var zCreateAccountGovernanceData = z10.discriminatedUnion("type", [
|
|
1684
|
+
z10.object({
|
|
1685
|
+
type: z10.literal(AccountGovernanceType.CLASSIC),
|
|
1632
1686
|
policy: zAccountPolicyRequestData
|
|
1633
1687
|
}).meta({ description: "Classic governance" }),
|
|
1634
|
-
|
|
1635
|
-
type:
|
|
1636
|
-
assetManagerId:
|
|
1688
|
+
z10.object({
|
|
1689
|
+
type: z10.literal(AccountGovernanceType.TRADELINK),
|
|
1690
|
+
assetManagerId: z10.string(),
|
|
1637
1691
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1638
1692
|
}).meta({ description: "Tradelink governance" }),
|
|
1639
|
-
|
|
1640
|
-
type:
|
|
1641
|
-
policy:
|
|
1693
|
+
z10.object({
|
|
1694
|
+
type: z10.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1695
|
+
policy: z10.object({ rules: z10.array(zSignDigestsGovRuleData) })
|
|
1642
1696
|
}).meta({ description: "Raw signing governance" })
|
|
1643
1697
|
]).meta({ description: "Governance fields" });
|
|
1644
|
-
var zCreateAccountUserInputData =
|
|
1698
|
+
var zCreateAccountUserInputData = z10.object({
|
|
1645
1699
|
name: zAccountName,
|
|
1646
1700
|
currency: zCurrencyString,
|
|
1647
1701
|
// "bitcoin"
|
|
1648
|
-
index:
|
|
1649
|
-
contractAddress:
|
|
1702
|
+
index: z10.number().nonnegative().optional().meta({ description: "Account index" }),
|
|
1703
|
+
contractAddress: z10.string().min(1).optional().meta({ description: "Account contract address" }),
|
|
1650
1704
|
governance: zCreateAccountGovernanceData
|
|
1651
1705
|
});
|
|
1652
1706
|
var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }).extend({
|
|
1653
|
-
index:
|
|
1654
|
-
derivationPath:
|
|
1655
|
-
type:
|
|
1707
|
+
index: z10.number().nonnegative().meta({ description: "Account index" }),
|
|
1708
|
+
derivationPath: z10.string().meta({ description: "Account bip44 derivation path" }),
|
|
1709
|
+
type: z10.enum(AccountType)
|
|
1656
1710
|
// "BITCOIN_LIKE"
|
|
1657
1711
|
}).meta({
|
|
1658
1712
|
description: "Create account request data",
|
|
1659
1713
|
id: "CreateAccountRequestData"
|
|
1660
1714
|
});
|
|
1661
|
-
var zEditAccountGovernanceData =
|
|
1662
|
-
|
|
1663
|
-
type:
|
|
1715
|
+
var zEditAccountGovernanceData = z10.discriminatedUnion("type", [
|
|
1716
|
+
z10.object({
|
|
1717
|
+
type: z10.literal(AccountGovernanceType.CLASSIC),
|
|
1664
1718
|
policy: zAccountPolicyRequestData
|
|
1665
1719
|
}).meta({ description: "Classic governance" }),
|
|
1666
|
-
|
|
1667
|
-
type:
|
|
1720
|
+
z10.object({
|
|
1721
|
+
type: z10.literal(AccountGovernanceType.TRADELINK),
|
|
1668
1722
|
exchangeConfigs: zTradelinkExchangeConfigs
|
|
1669
1723
|
}).meta({ description: "Tradelink governance" }),
|
|
1670
|
-
|
|
1671
|
-
type:
|
|
1672
|
-
policy:
|
|
1724
|
+
z10.object({
|
|
1725
|
+
type: z10.literal(AccountGovernanceType.RAW_SIGNING),
|
|
1726
|
+
policy: z10.object({ rules: z10.array(zSignDigestsGovRuleData) })
|
|
1673
1727
|
}).meta({ description: "Raw signing governance" })
|
|
1674
1728
|
]).meta({ description: "Governance fields" });
|
|
1675
|
-
var zEditAccountRequestData =
|
|
1729
|
+
var zEditAccountRequestData = z10.object({
|
|
1676
1730
|
name: zAccountName,
|
|
1677
1731
|
governance: zEditAccountGovernanceData
|
|
1678
1732
|
}).meta({
|
|
1679
1733
|
description: "Edit account request data",
|
|
1680
1734
|
id: "EditAccountRequestData"
|
|
1681
1735
|
});
|
|
1682
|
-
var zEditTokenRuleRequestData =
|
|
1683
|
-
parentAccountId:
|
|
1684
|
-
contractAddress:
|
|
1685
|
-
rules:
|
|
1736
|
+
var zEditTokenRuleRequestData = z10.object({
|
|
1737
|
+
parentAccountId: z10.string().min(1).meta({ description: "Parent account unique ID" }),
|
|
1738
|
+
contractAddress: z10.string().min(1).meta({ description: "Token contract address" }),
|
|
1739
|
+
rules: z10.array(zClassicGovRuleData).meta({ description: "Account governance rules" })
|
|
1686
1740
|
});
|
|
1687
1741
|
|
|
1688
1742
|
// src/accounts/app-utils.ts
|
|
1689
|
-
var
|
|
1743
|
+
var getAccountAssetFields = (account) => {
|
|
1690
1744
|
switch (account.type) {
|
|
1691
1745
|
case AccountType.BITCOIN_LIKE:
|
|
1692
1746
|
return {
|
|
@@ -1779,7 +1833,7 @@ var getAccountGovernanceFields = (account) => {
|
|
|
1779
1833
|
}
|
|
1780
1834
|
};
|
|
1781
1835
|
var serializeAccount = (account) => {
|
|
1782
|
-
const asset =
|
|
1836
|
+
const asset = getAccountAssetFields(account);
|
|
1783
1837
|
const governance = getAccountGovernanceFields(account);
|
|
1784
1838
|
const response = {
|
|
1785
1839
|
...account,
|
|
@@ -1812,15 +1866,15 @@ var patchTezosRequestData = (data) => {
|
|
|
1812
1866
|
}
|
|
1813
1867
|
return data;
|
|
1814
1868
|
};
|
|
1815
|
-
var zSciConfigData =
|
|
1816
|
-
dapps:
|
|
1817
|
-
customContractCallEnabled:
|
|
1869
|
+
var zSciConfigData = z10.object({
|
|
1870
|
+
dapps: z10.array(z10.string()).nullable().meta({ description: "Allowed DApps, null allows all" }),
|
|
1871
|
+
customContractCallEnabled: z10.boolean().meta({ description: "Allow non-DApp SCI" })
|
|
1818
1872
|
});
|
|
1819
|
-
var zCreateSciConfigRequestData =
|
|
1820
|
-
account:
|
|
1873
|
+
var zCreateSciConfigRequestData = z10.object({
|
|
1874
|
+
account: z10.string().meta({ description: "Account UUID" }),
|
|
1821
1875
|
config: zSciConfigData
|
|
1822
1876
|
});
|
|
1823
|
-
var zEditSciConfigRequestData =
|
|
1877
|
+
var zEditSciConfigRequestData = z10.object({
|
|
1824
1878
|
config: zSciConfigData
|
|
1825
1879
|
});
|
|
1826
1880
|
var zRequestReviewStep = z.object({
|
|
@@ -1828,205 +1882,165 @@ var zRequestReviewStep = z.object({
|
|
|
1828
1882
|
quorum: z.int().min(1).meta({ description: "Quorum for the review step" })
|
|
1829
1883
|
});
|
|
1830
1884
|
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1831
|
-
var
|
|
1832
|
-
var
|
|
1833
|
-
name: zUserName,
|
|
1834
|
-
role: z.enum([UserRole.ADMIN, UserRole.OPERATOR]).meta({ description: "User role" }),
|
|
1835
|
-
psdModel: z.enum(PsdModel).meta({ description: "PSD model" }),
|
|
1836
|
-
deviceUserId: z.string().meta({ description: "Device user ID" })
|
|
1837
|
-
});
|
|
1838
|
-
zUserRegistrationCreateInput.extend({
|
|
1839
|
-
id: z.string().meta({ description: "User registration ID" }),
|
|
1840
|
-
workspaceName: z.string().meta({ description: "Workspace name" }),
|
|
1841
|
-
state: z.enum(UserRegistrationState).meta({ description: "User registration state" }),
|
|
1842
|
-
isLocked: z.boolean().meta({ description: "Whether the registration is locked by a request" })
|
|
1843
|
-
});
|
|
1844
|
-
|
|
1845
|
-
// src/users/request-data.ts
|
|
1846
|
-
var zCreatePsdUserRequestData = z7.object({
|
|
1847
|
-
registrationId: z7.string().meta({ description: "User registration ID" })
|
|
1848
|
-
});
|
|
1849
|
-
var zCreateApiUserRequestData = z7.object({
|
|
1850
|
-
name: zUserName,
|
|
1851
|
-
pubKey: z7.string().meta({ description: "Public key" }),
|
|
1852
|
-
role: z7.enum(["ADMIN", "OPERATOR"]).meta({ description: "User role" }),
|
|
1853
|
-
viewAll: z7.boolean().meta({ description: "View all data" }).optional()
|
|
1854
|
-
}).meta({ description: "Create API user request data" });
|
|
1855
|
-
var zCreateApiUserAccessRequestData = z7.object({
|
|
1856
|
-
name: zUserName
|
|
1857
|
-
}).meta({ description: "Create API user credential request data" });
|
|
1858
|
-
z7.object({
|
|
1859
|
-
authUserId: z7.string().meta({ description: "Authentication broker ID" })
|
|
1860
|
-
}).meta({ description: "Managed data for API user" });
|
|
1861
|
-
var zRevokeUserRequestData = z7.object({});
|
|
1862
|
-
var zGroupName = z7.string().min(1).max(19).meta({ description: "Group name" });
|
|
1863
|
-
var zCreateGroupRequestData = z7.object({
|
|
1885
|
+
var zGroupName = z10.string().min(1).max(19).meta({ description: "Group name" });
|
|
1886
|
+
var zCreateGroupRequestData = z10.object({
|
|
1864
1887
|
name: zGroupName,
|
|
1865
|
-
description:
|
|
1866
|
-
members:
|
|
1888
|
+
description: z10.string().nullable().meta({ description: "Group description" }),
|
|
1889
|
+
members: z10.array(z10.string()).meta({ description: "List of group members ids" })
|
|
1867
1890
|
});
|
|
1868
|
-
var zEditGroupRequestData =
|
|
1891
|
+
var zEditGroupRequestData = z10.object({
|
|
1869
1892
|
name: zGroupName,
|
|
1870
|
-
description:
|
|
1871
|
-
members:
|
|
1893
|
+
description: z10.string().nullable().meta({ description: "Group description" }),
|
|
1894
|
+
members: z10.array(z10.string()).meta({ description: "List of group members ids" })
|
|
1872
1895
|
});
|
|
1873
|
-
var zApiKeyName =
|
|
1874
|
-
var zCreateApiKeyRequestData =
|
|
1896
|
+
var zApiKeyName = z10.string().min(1).max(19).meta({ description: "API key name" });
|
|
1897
|
+
var zCreateApiKeyRequestData = z10.object({
|
|
1875
1898
|
name: zApiKeyName,
|
|
1876
|
-
entities:
|
|
1877
|
-
scopes:
|
|
1899
|
+
entities: z10.array(z10.string()).meta({ description: "List of related entities ids" }),
|
|
1900
|
+
scopes: z10.object({}).meta({ description: "FIXME to be precised" })
|
|
1878
1901
|
}).meta({ description: "Create read-only API key request data" });
|
|
1879
1902
|
var zEditApiKeyRequestData = zCreateApiKeyRequestData.meta({
|
|
1880
1903
|
description: "Edit read-only API key request data"
|
|
1881
1904
|
});
|
|
1882
|
-
var zEntityName =
|
|
1883
|
-
var zCreateEntityRequestData =
|
|
1905
|
+
var zEntityName = z10.string().min(1).max(19).meta({ description: "Entity name" });
|
|
1906
|
+
var zCreateEntityRequestData = z10.object({
|
|
1884
1907
|
name: zEntityName,
|
|
1885
|
-
accounts:
|
|
1908
|
+
accounts: z10.array(z10.string())
|
|
1886
1909
|
});
|
|
1887
|
-
var zEditEntityRequestData =
|
|
1910
|
+
var zEditEntityRequestData = z10.object({
|
|
1888
1911
|
name: zEntityName,
|
|
1889
|
-
accounts:
|
|
1890
|
-
});
|
|
1891
|
-
var NonRootAdminPermission = omit(AdminPermission, "ROOT");
|
|
1892
|
-
var zWorkspaceRuleRequestData = z7.object({
|
|
1893
|
-
permission: z7.enum(NonRootAdminPermission).meta({ description: "Granted permissions" }),
|
|
1894
|
-
reviewConfig: zReviewStepWithUsersArray.meta({ description: "List of admin review steps" })
|
|
1912
|
+
accounts: z10.array(z10.string())
|
|
1895
1913
|
});
|
|
1896
1914
|
|
|
1897
1915
|
// src/requests/request-data.ts
|
|
1898
1916
|
var zVaultRequestMixinsByType = {
|
|
1899
1917
|
// Workspaces
|
|
1900
|
-
[RequestType.UPDATE_QUORUM]:
|
|
1901
|
-
type:
|
|
1918
|
+
[RequestType.UPDATE_QUORUM]: z10.object({
|
|
1919
|
+
type: z10.literal(RequestType.UPDATE_QUORUM),
|
|
1902
1920
|
data: zUpdateQuorumRequestData
|
|
1903
1921
|
}),
|
|
1904
1922
|
// Operator requests
|
|
1905
|
-
[RequestType.CREATE_TRANSACTION]:
|
|
1906
|
-
type:
|
|
1923
|
+
[RequestType.CREATE_TRANSACTION]: z10.object({
|
|
1924
|
+
type: z10.literal(RequestType.CREATE_TRANSACTION),
|
|
1907
1925
|
data: zCreateTransactionRequestData,
|
|
1908
|
-
meta:
|
|
1909
|
-
hash:
|
|
1926
|
+
meta: z10.object({
|
|
1927
|
+
hash: z10.string().nullable()
|
|
1910
1928
|
}).optional().nullable()
|
|
1911
1929
|
}),
|
|
1912
|
-
[RequestType.SIGN_MESSAGE]:
|
|
1913
|
-
type:
|
|
1930
|
+
[RequestType.SIGN_MESSAGE]: z10.object({
|
|
1931
|
+
type: z10.literal(RequestType.SIGN_MESSAGE),
|
|
1914
1932
|
data: zSignMessageRequestData
|
|
1915
1933
|
}),
|
|
1916
|
-
[RequestType.SIGN_DIGESTS]:
|
|
1917
|
-
type:
|
|
1934
|
+
[RequestType.SIGN_DIGESTS]: z10.object({
|
|
1935
|
+
type: z10.literal(RequestType.SIGN_DIGESTS),
|
|
1918
1936
|
data: zSignDigestsRequestData
|
|
1919
1937
|
}),
|
|
1920
1938
|
// Accounts
|
|
1921
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
1922
|
-
type:
|
|
1939
|
+
[RequestType.CREATE_ACCOUNT]: z10.object({
|
|
1940
|
+
type: z10.literal(RequestType.CREATE_ACCOUNT),
|
|
1923
1941
|
data: zCreateAccountRequestData
|
|
1924
1942
|
}),
|
|
1925
|
-
[RequestType.EDIT_ACCOUNT]:
|
|
1926
|
-
type:
|
|
1927
|
-
targetId:
|
|
1943
|
+
[RequestType.EDIT_ACCOUNT]: z10.object({
|
|
1944
|
+
type: z10.literal(RequestType.EDIT_ACCOUNT),
|
|
1945
|
+
targetId: z10.string(),
|
|
1928
1946
|
data: zEditAccountRequestData
|
|
1929
1947
|
}),
|
|
1930
|
-
[RequestType.EDIT_TOKEN_RULE]:
|
|
1931
|
-
type:
|
|
1932
|
-
targetId:
|
|
1948
|
+
[RequestType.EDIT_TOKEN_RULE]: z10.object({
|
|
1949
|
+
type: z10.literal(RequestType.EDIT_TOKEN_RULE),
|
|
1950
|
+
targetId: z10.string(),
|
|
1933
1951
|
data: zEditTokenRuleRequestData
|
|
1934
1952
|
}),
|
|
1935
1953
|
// Groups
|
|
1936
|
-
[RequestType.CREATE_GROUP]:
|
|
1937
|
-
type:
|
|
1954
|
+
[RequestType.CREATE_GROUP]: z10.object({
|
|
1955
|
+
type: z10.literal(RequestType.CREATE_GROUP),
|
|
1938
1956
|
data: zCreateGroupRequestData
|
|
1939
1957
|
}),
|
|
1940
|
-
[RequestType.EDIT_GROUP]:
|
|
1941
|
-
type:
|
|
1942
|
-
targetId:
|
|
1958
|
+
[RequestType.EDIT_GROUP]: z10.object({
|
|
1959
|
+
type: z10.literal(RequestType.EDIT_GROUP),
|
|
1960
|
+
targetId: z10.string(),
|
|
1943
1961
|
data: zEditGroupRequestData
|
|
1944
1962
|
}),
|
|
1945
|
-
[RequestType.REVOKE_GROUP]:
|
|
1946
|
-
type:
|
|
1947
|
-
targetId:
|
|
1963
|
+
[RequestType.REVOKE_GROUP]: z10.object({
|
|
1964
|
+
type: z10.literal(RequestType.REVOKE_GROUP),
|
|
1965
|
+
targetId: z10.string(),
|
|
1948
1966
|
data: zRevokeUserRequestData
|
|
1949
1967
|
}),
|
|
1950
1968
|
// Whitelists
|
|
1951
|
-
[RequestType.CREATE_WHITELIST]:
|
|
1952
|
-
type:
|
|
1969
|
+
[RequestType.CREATE_WHITELIST]: z10.object({
|
|
1970
|
+
type: z10.literal(RequestType.CREATE_WHITELIST),
|
|
1953
1971
|
data: zCreateWhitelistRequestData
|
|
1954
1972
|
}),
|
|
1955
|
-
[RequestType.EDIT_WHITELIST]:
|
|
1956
|
-
type:
|
|
1957
|
-
targetId:
|
|
1973
|
+
[RequestType.EDIT_WHITELIST]: z10.object({
|
|
1974
|
+
type: z10.literal(RequestType.EDIT_WHITELIST),
|
|
1975
|
+
targetId: z10.string(),
|
|
1958
1976
|
data: zEditWhitelistRequestData
|
|
1959
1977
|
}),
|
|
1960
1978
|
// Entities
|
|
1961
|
-
[RequestType.CREATE_ENTITY]:
|
|
1962
|
-
type:
|
|
1979
|
+
[RequestType.CREATE_ENTITY]: z10.object({
|
|
1980
|
+
type: z10.literal(RequestType.CREATE_ENTITY),
|
|
1963
1981
|
data: zCreateEntityRequestData
|
|
1964
1982
|
}),
|
|
1965
|
-
[RequestType.EDIT_ENTITY]:
|
|
1966
|
-
type:
|
|
1983
|
+
[RequestType.EDIT_ENTITY]: z10.object({
|
|
1984
|
+
type: z10.literal(RequestType.EDIT_ENTITY),
|
|
1967
1985
|
data: zEditEntityRequestData
|
|
1968
1986
|
}),
|
|
1969
|
-
[RequestType.REVOKE_ENTITY]:
|
|
1970
|
-
type:
|
|
1971
|
-
data:
|
|
1987
|
+
[RequestType.REVOKE_ENTITY]: z10.object({
|
|
1988
|
+
type: z10.literal(RequestType.REVOKE_ENTITY),
|
|
1989
|
+
data: z10.object({})
|
|
1972
1990
|
}),
|
|
1973
1991
|
// Users
|
|
1974
|
-
[RequestType.CREATE_PSD_USER]:
|
|
1975
|
-
type:
|
|
1992
|
+
[RequestType.CREATE_PSD_USER]: z10.object({
|
|
1993
|
+
type: z10.literal(RequestType.CREATE_PSD_USER),
|
|
1976
1994
|
data: zCreatePsdUserRequestData
|
|
1977
1995
|
}),
|
|
1978
|
-
[RequestType.CREATE_API_USER]:
|
|
1979
|
-
type:
|
|
1996
|
+
[RequestType.CREATE_API_USER]: z10.object({
|
|
1997
|
+
type: z10.literal(RequestType.CREATE_API_USER),
|
|
1980
1998
|
data: zCreateApiUserRequestData
|
|
1981
1999
|
}),
|
|
1982
|
-
[RequestType.CREATE_API_USER_ACCESS]:
|
|
1983
|
-
type:
|
|
2000
|
+
[RequestType.CREATE_API_USER_ACCESS]: z10.object({
|
|
2001
|
+
type: z10.literal(RequestType.CREATE_API_USER_ACCESS),
|
|
1984
2002
|
data: zCreateApiUserAccessRequestData
|
|
1985
2003
|
}),
|
|
1986
|
-
[RequestType.REVOKE_USER]:
|
|
1987
|
-
type:
|
|
1988
|
-
targetId:
|
|
2004
|
+
[RequestType.REVOKE_USER]: z10.object({
|
|
2005
|
+
type: z10.literal(RequestType.REVOKE_USER),
|
|
2006
|
+
targetId: z10.string(),
|
|
1989
2007
|
data: zRevokeUserRequestData
|
|
1990
2008
|
}),
|
|
1991
2009
|
// Admin gov rules
|
|
1992
|
-
[RequestType.
|
|
1993
|
-
type:
|
|
1994
|
-
data: zWorkspaceRuleRequestData
|
|
1995
|
-
}),
|
|
1996
|
-
[RequestType.EDIT_WORKSPACE_RULE]: z7.object({
|
|
1997
|
-
type: z7.literal(RequestType.EDIT_WORKSPACE_RULE),
|
|
2010
|
+
[RequestType.EDIT_WORKSPACE_RULE]: z10.object({
|
|
2011
|
+
type: z10.literal(RequestType.EDIT_WORKSPACE_RULE),
|
|
1998
2012
|
data: zWorkspaceRuleRequestData
|
|
1999
2013
|
}),
|
|
2000
2014
|
// SCI configs
|
|
2001
|
-
[RequestType.CREATE_SCICONFIG]:
|
|
2002
|
-
type:
|
|
2015
|
+
[RequestType.CREATE_SCICONFIG]: z10.object({
|
|
2016
|
+
type: z10.literal(RequestType.CREATE_SCICONFIG),
|
|
2003
2017
|
data: zCreateSciConfigRequestData
|
|
2004
2018
|
}),
|
|
2005
|
-
[RequestType.EDIT_SCICONFIG]:
|
|
2006
|
-
type:
|
|
2019
|
+
[RequestType.EDIT_SCICONFIG]: z10.object({
|
|
2020
|
+
type: z10.literal(RequestType.EDIT_SCICONFIG),
|
|
2007
2021
|
data: zEditSciConfigRequestData
|
|
2008
2022
|
}),
|
|
2009
2023
|
// API keys
|
|
2010
|
-
[RequestType.CREATE_API_KEY]:
|
|
2011
|
-
type:
|
|
2024
|
+
[RequestType.CREATE_API_KEY]: z10.object({
|
|
2025
|
+
type: z10.literal(RequestType.CREATE_API_KEY),
|
|
2012
2026
|
data: zCreateApiKeyRequestData
|
|
2013
2027
|
}),
|
|
2014
|
-
[RequestType.EDIT_API_KEY]:
|
|
2015
|
-
type:
|
|
2028
|
+
[RequestType.EDIT_API_KEY]: z10.object({
|
|
2029
|
+
type: z10.literal(RequestType.EDIT_API_KEY),
|
|
2016
2030
|
data: zEditApiKeyRequestData
|
|
2017
2031
|
}),
|
|
2018
|
-
[RequestType.REVOKE_API_KEY]:
|
|
2019
|
-
type:
|
|
2020
|
-
data:
|
|
2032
|
+
[RequestType.REVOKE_API_KEY]: z10.object({
|
|
2033
|
+
type: z10.literal(RequestType.REVOKE_API_KEY),
|
|
2034
|
+
data: z10.object({})
|
|
2021
2035
|
}),
|
|
2022
2036
|
// Policies
|
|
2023
|
-
[RequestType.CREATE_POLICY]:
|
|
2024
|
-
type:
|
|
2037
|
+
[RequestType.CREATE_POLICY]: z10.object({
|
|
2038
|
+
type: z10.literal(RequestType.CREATE_POLICY),
|
|
2025
2039
|
data: zCreatePublicPolicyRequestData
|
|
2026
2040
|
}),
|
|
2027
|
-
[RequestType.EDIT_POLICY]:
|
|
2028
|
-
type:
|
|
2029
|
-
targetId:
|
|
2041
|
+
[RequestType.EDIT_POLICY]: z10.object({
|
|
2042
|
+
type: z10.literal(RequestType.EDIT_POLICY),
|
|
2043
|
+
targetId: z10.string(),
|
|
2030
2044
|
data: zEditPublicPolicyRequestData
|
|
2031
2045
|
}),
|
|
2032
2046
|
// Tradelink-related requests
|
|
@@ -2034,34 +2048,34 @@ var zVaultRequestMixinsByType = {
|
|
|
2034
2048
|
};
|
|
2035
2049
|
|
|
2036
2050
|
// src/requests/app-types.ts
|
|
2037
|
-
var zRequestReviewResponse =
|
|
2051
|
+
var zRequestReviewResponse = z10.object({
|
|
2038
2052
|
// Note: Do NOT include `quorum` as it is already available in the request's `reviewSteps` field.
|
|
2039
|
-
stepIndex:
|
|
2040
|
-
userId:
|
|
2041
|
-
status:
|
|
2042
|
-
createdAt:
|
|
2043
|
-
updatedAt:
|
|
2044
|
-
});
|
|
2045
|
-
var zVaultRequestCommonMixin =
|
|
2046
|
-
id:
|
|
2047
|
-
legacyId:
|
|
2048
|
-
state:
|
|
2053
|
+
stepIndex: z10.number().int().meta({ description: "Index of the governance step in the request workflow" }),
|
|
2054
|
+
userId: z10.string().meta({ description: "Reviewer id" }),
|
|
2055
|
+
status: z10.enum(RequestReviewStatus).meta({ description: "Review status" }),
|
|
2056
|
+
createdAt: z10.coerce.date().meta({ description: "Created date" }),
|
|
2057
|
+
updatedAt: z10.coerce.date().meta({ description: "Updated date" })
|
|
2058
|
+
});
|
|
2059
|
+
var zVaultRequestCommonMixin = z10.object({
|
|
2060
|
+
id: z10.string().meta({ description: "Request unique identifier" }),
|
|
2061
|
+
legacyId: z10.number().meta({ description: "Legacy internal unique identifier (for retro-compatibility)" }),
|
|
2062
|
+
state: z10.enum(RequestState).meta({ description: "Request state" }),
|
|
2049
2063
|
reviewSteps: zRequestReviewSteps.meta({ description: "Request review steps" }),
|
|
2050
|
-
currentStepIndex:
|
|
2051
|
-
expiresAt:
|
|
2052
|
-
expiredAt:
|
|
2053
|
-
targetId:
|
|
2064
|
+
currentStepIndex: z10.number().int().min(0).meta({ description: "Index of the current approval step" }),
|
|
2065
|
+
expiresAt: z10.coerce.date().meta({ description: "Request expiration date" }),
|
|
2066
|
+
expiredAt: z10.coerce.date().optional().meta({ description: "Deprecated: use expiresAt" }),
|
|
2067
|
+
targetId: z10.string().nullable().meta({ description: "Optional ID of the target object" }),
|
|
2054
2068
|
note: zNote.nullable().meta({ description: "Optional request note" }),
|
|
2055
|
-
reviews:
|
|
2069
|
+
reviews: z10.array(zRequestReviewResponse).meta({ description: "Requests reviews" }),
|
|
2056
2070
|
// `type` and `data` are correlated -- See `zVaultRequestMixinsByType`
|
|
2057
|
-
createdAt:
|
|
2058
|
-
updatedAt:
|
|
2059
|
-
createdById:
|
|
2071
|
+
createdAt: z10.coerce.date().meta({ description: "Creation timestamp" }),
|
|
2072
|
+
updatedAt: z10.coerce.date().meta({ description: "Last modification timestamp" }),
|
|
2073
|
+
createdById: z10.string().meta({ description: "ID of the user who created the request" }),
|
|
2060
2074
|
// `inflight` is fetched from ONGOING RequestSaga
|
|
2061
|
-
inflight:
|
|
2062
|
-
lastError:
|
|
2063
|
-
numFailed:
|
|
2064
|
-
retryAfter:
|
|
2075
|
+
inflight: z10.object({
|
|
2076
|
+
lastError: z10.string().nullable().meta({ description: "Error message from the last failure" }),
|
|
2077
|
+
numFailed: z10.number().int().meta({ description: "Number of failures so far" }),
|
|
2078
|
+
retryAfter: z10.coerce.date().meta({ description: "Date after which next retry is scheduled" })
|
|
2065
2079
|
}).optional().meta({ description: "Extra information if the request is currently being processed" })
|
|
2066
2080
|
});
|
|
2067
2081
|
var allowedRequestCreationInputByType = {
|
|
@@ -2073,14 +2087,14 @@ var allowedRequestCreationInputByType = {
|
|
|
2073
2087
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
2074
2088
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
2075
2089
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
2076
|
-
[RequestType.SIGN_MESSAGE]:
|
|
2077
|
-
type:
|
|
2090
|
+
[RequestType.SIGN_MESSAGE]: z10.object({
|
|
2091
|
+
type: z10.literal(RequestType.SIGN_MESSAGE),
|
|
2078
2092
|
data: zSignMessageUserInputData
|
|
2079
2093
|
}),
|
|
2080
2094
|
[RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
|
|
2081
2095
|
[RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
|
|
2082
|
-
[RequestType.CREATE_ACCOUNT]:
|
|
2083
|
-
type:
|
|
2096
|
+
[RequestType.CREATE_ACCOUNT]: z10.object({
|
|
2097
|
+
type: z10.literal(RequestType.CREATE_ACCOUNT),
|
|
2084
2098
|
data: zCreateAccountUserInputData
|
|
2085
2099
|
}),
|
|
2086
2100
|
[RequestType.EDIT_ACCOUNT]: zVaultRequestMixinsByType[RequestType.EDIT_ACCOUNT],
|
|
@@ -2097,13 +2111,14 @@ var allowedRequestCreationInputByType = {
|
|
|
2097
2111
|
[RequestType.TRADELINK_CREATE_SETTLEMENT]: zVaultRequestMixinsByType[RequestType.TRADELINK_CREATE_SETTLEMENT],
|
|
2098
2112
|
[RequestType.TRADELINK_WITHDRAW]: zVaultRequestMixinsByType[RequestType.TRADELINK_WITHDRAW],
|
|
2099
2113
|
[RequestType.TRADELINK_ARBITRATE]: zVaultRequestMixinsByType[RequestType.TRADELINK_ARBITRATE],
|
|
2100
|
-
[RequestType.REVOKE_USER]: zVaultRequestMixinsByType[RequestType.REVOKE_USER]
|
|
2114
|
+
[RequestType.REVOKE_USER]: zVaultRequestMixinsByType[RequestType.REVOKE_USER],
|
|
2115
|
+
[RequestType.EDIT_WORKSPACE_RULE]: zVaultRequestMixinsByType[RequestType.EDIT_WORKSPACE_RULE]
|
|
2101
2116
|
};
|
|
2102
|
-
var zRequestCreationInputCommonMixin =
|
|
2117
|
+
var zRequestCreationInputCommonMixin = z10.object({
|
|
2103
2118
|
note: zNote.optional().meta({ description: "Optional request note" })
|
|
2104
2119
|
});
|
|
2105
|
-
|
|
2106
|
-
request:
|
|
2120
|
+
z10.object({
|
|
2121
|
+
request: z10.discriminatedUnion(
|
|
2107
2122
|
"type",
|
|
2108
2123
|
ensureNonEmptyArray(
|
|
2109
2124
|
Object.values(allowedRequestCreationInputByType).map((_) => {
|
|
@@ -2115,7 +2130,7 @@ z7.object({
|
|
|
2115
2130
|
)
|
|
2116
2131
|
)
|
|
2117
2132
|
});
|
|
2118
|
-
var zVaultRequestResponse =
|
|
2133
|
+
var zVaultRequestResponse = z10.discriminatedUnion(
|
|
2119
2134
|
"type",
|
|
2120
2135
|
ensureNonEmptyArray(
|
|
2121
2136
|
Object.values(zVaultRequestMixinsByType).map((_) => {
|
|
@@ -2129,14 +2144,14 @@ var zVaultRequestResponse = z7.discriminatedUnion(
|
|
|
2129
2144
|
description: "Vault request response data",
|
|
2130
2145
|
id: "VaultRequestResponse"
|
|
2131
2146
|
});
|
|
2132
|
-
|
|
2147
|
+
z10.enum([
|
|
2133
2148
|
"state",
|
|
2134
2149
|
"expiresAt",
|
|
2135
2150
|
"createdAt",
|
|
2136
2151
|
"updatedAt"
|
|
2137
2152
|
]).default("createdAt");
|
|
2138
|
-
|
|
2139
|
-
pubKey:
|
|
2153
|
+
z10.object({
|
|
2154
|
+
pubKey: z10.string().meta({ description: "Public key of the current user" }),
|
|
2140
2155
|
challenge: zUserChallenge.meta({
|
|
2141
2156
|
description: "Challenge data to sign with the user's private key"
|
|
2142
2157
|
})
|
|
@@ -2151,7 +2166,6 @@ var shouldHaveTargetHsmId = (request) => {
|
|
|
2151
2166
|
case RequestType.CREATE_API_KEY:
|
|
2152
2167
|
case RequestType.EDIT_API_KEY:
|
|
2153
2168
|
case RequestType.REVOKE_API_KEY:
|
|
2154
|
-
case RequestType.CREATE_WORKSPACE_RULE:
|
|
2155
2169
|
case RequestType.EDIT_WORKSPACE_RULE:
|
|
2156
2170
|
case RequestType.UPDATE_QUORUM:
|
|
2157
2171
|
return false;
|
|
@@ -2196,7 +2210,6 @@ var shouldHaveTargetId = (request) => {
|
|
|
2196
2210
|
case RequestType.UPDATE_QUORUM:
|
|
2197
2211
|
case RequestType.CREATE_PSD_USER:
|
|
2198
2212
|
case RequestType.CREATE_API_USER:
|
|
2199
|
-
case RequestType.CREATE_WORKSPACE_RULE:
|
|
2200
2213
|
case RequestType.CREATE_ACCOUNT:
|
|
2201
2214
|
case RequestType.CREATE_GROUP:
|
|
2202
2215
|
case RequestType.CREATE_WHITELIST:
|