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