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