vaults-multichain-sdk 1.1.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/README.md +27 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +1955 -0
- package/dist/index.d.ts +1955 -0
- package/dist/index.js +2 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1955 @@
|
|
|
1
|
+
declare const TransactionEstimatingType: {
|
|
2
|
+
readonly ExecOrder: "execOrder";
|
|
3
|
+
readonly Send: "send";
|
|
4
|
+
readonly ActivateMultisig: "activateMultisig";
|
|
5
|
+
readonly SignOrder: "SignOrder";
|
|
6
|
+
readonly CreateOrder: "CreateOrder";
|
|
7
|
+
readonly ChangeMultisig: "ChangeMultisig";
|
|
8
|
+
};
|
|
9
|
+
type TransactionEstimatingTypeValue = typeof TransactionEstimatingType[keyof typeof TransactionEstimatingType];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Supported blockchain chain types
|
|
13
|
+
*/
|
|
14
|
+
type ChainType = "EVM" | "SOL" | "TRON" | "BTC" | "BTC_T3" | "ADA" | "XRP";
|
|
15
|
+
declare enum EChainType {
|
|
16
|
+
EVM = "EVM",
|
|
17
|
+
SOL = "SOL",
|
|
18
|
+
TRON = "TRON",
|
|
19
|
+
BTC = "BTC",
|
|
20
|
+
BTC_T3 = "BTC_T3",
|
|
21
|
+
ADA = "ADA",
|
|
22
|
+
XRP = "XRP"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the appropriate BTC chain type based on the current network mode.
|
|
26
|
+
* - Mainnet: EChainType.BTC
|
|
27
|
+
* - Testnet: EChainType.BTC_T3
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const btcChain = getBtcChainType(); // Returns EChainType.BTC or EChainType.BTC_T3
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function getBtcChainType(): EChainType.BTC | EChainType.BTC_T3;
|
|
35
|
+
declare enum TestnetChainId {
|
|
36
|
+
BASE_SEPOLIA = "84532",
|
|
37
|
+
ARBITRUM_SEPOLIA = "421614",
|
|
38
|
+
SOLANA_DEVNET = "sol_devnet",
|
|
39
|
+
BTC = "BTC_T3",
|
|
40
|
+
BNB = "97",
|
|
41
|
+
POL = "80002",
|
|
42
|
+
ETH_SEPOLIA = "11155111",
|
|
43
|
+
OPTIMISM_SEPOLIA = "11155420",
|
|
44
|
+
TRON = "tron_shasta",
|
|
45
|
+
AVAX_FUJI = "43113",
|
|
46
|
+
ADA_PP = "ada_preprod",
|
|
47
|
+
XRP = "xrp_testnet"
|
|
48
|
+
}
|
|
49
|
+
declare enum MainnetChainId {
|
|
50
|
+
BASE = "8453",
|
|
51
|
+
ARBITRUM = "42161",
|
|
52
|
+
SOLANA = "sol_mainnet",
|
|
53
|
+
BTC = "BTC",
|
|
54
|
+
BNB = "56",
|
|
55
|
+
POL = "137",
|
|
56
|
+
ETH = "1",
|
|
57
|
+
OPTIMISM = "10",
|
|
58
|
+
TRON = "tron_mainnet",
|
|
59
|
+
AVAX = "43114",
|
|
60
|
+
ADA = "ada_mainnet",
|
|
61
|
+
XRP = "xrp_mainnet"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Union of all possible chain ID values (EVM chain IDs are strings here for consistency)
|
|
65
|
+
*/
|
|
66
|
+
type ChainIdValue = `${MainnetChainId}` | `${TestnetChainId}`;
|
|
67
|
+
interface TWallet {
|
|
68
|
+
name: string | null;
|
|
69
|
+
chain: EChainType;
|
|
70
|
+
address: string;
|
|
71
|
+
share: string;
|
|
72
|
+
isImported: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Response from wallet creation/import
|
|
76
|
+
*/
|
|
77
|
+
interface CreateWalletResponse {
|
|
78
|
+
wallets: TWallet[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Single wallet details response
|
|
82
|
+
*/
|
|
83
|
+
interface SingleWalletDetailsResponse {
|
|
84
|
+
data: TWallet;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Paginated wallets response
|
|
88
|
+
*/
|
|
89
|
+
interface PaginatedWalletsResponse {
|
|
90
|
+
wallets: TWallet[];
|
|
91
|
+
total: number;
|
|
92
|
+
page: number;
|
|
93
|
+
limit: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Multisig status enum
|
|
97
|
+
*/
|
|
98
|
+
declare enum MultisigStatus {
|
|
99
|
+
PENDING = "pending",
|
|
100
|
+
ACTIVE = "active",
|
|
101
|
+
INACTIVE = "inactive"
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Multisig params with deployment data
|
|
105
|
+
*/
|
|
106
|
+
interface MultisigParams {
|
|
107
|
+
chainType: EChainType;
|
|
108
|
+
to: string;
|
|
109
|
+
data: string;
|
|
110
|
+
paymentToken: string;
|
|
111
|
+
payment: string;
|
|
112
|
+
vaultAddress: string;
|
|
113
|
+
paymentReceiverAddress: string;
|
|
114
|
+
fallbackAddress: string;
|
|
115
|
+
singleton: string;
|
|
116
|
+
initializer: string;
|
|
117
|
+
deployData: string;
|
|
118
|
+
share?: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Token within a multisig
|
|
122
|
+
*/
|
|
123
|
+
interface MultisignToken extends TokenMultisignBalance {
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Multisig vault/safe object
|
|
127
|
+
*/
|
|
128
|
+
interface MultisigsItem {
|
|
129
|
+
id: string;
|
|
130
|
+
address: string | null;
|
|
131
|
+
chainId: ChainIdValue;
|
|
132
|
+
status: "created" | "execution" | "deployed";
|
|
133
|
+
threshold: string;
|
|
134
|
+
chainType: EChainType;
|
|
135
|
+
isDeployed: boolean;
|
|
136
|
+
factoryId: string;
|
|
137
|
+
name: string;
|
|
138
|
+
params: MultisigParams;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
owners: {
|
|
142
|
+
walletAddress: string;
|
|
143
|
+
}[];
|
|
144
|
+
tokens: MultisignToken[];
|
|
145
|
+
factoryAddress: string;
|
|
146
|
+
}
|
|
147
|
+
interface MultisigBaseDTO {
|
|
148
|
+
address: string;
|
|
149
|
+
chainType: EChainType;
|
|
150
|
+
data: MultisigsItem[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* One grouped multisig row from GET /sdk/multisig (paginated vault list).
|
|
154
|
+
*/
|
|
155
|
+
interface GroupedMultisigResponseDTO {
|
|
156
|
+
address: string;
|
|
157
|
+
chainType: EChainType;
|
|
158
|
+
createdAt: string;
|
|
159
|
+
data: MultisigsItem[];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Paginated vault list (GET /sdk/multisig).
|
|
163
|
+
*/
|
|
164
|
+
interface PaginatedMultisigsWithTokensResponse {
|
|
165
|
+
multisigs: GroupedMultisigResponseDTO[];
|
|
166
|
+
total: number;
|
|
167
|
+
page: number;
|
|
168
|
+
limit: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Order status enum
|
|
172
|
+
*/
|
|
173
|
+
declare enum OrderStatus {
|
|
174
|
+
PENDING = "pending",
|
|
175
|
+
APPROVED = "approved",
|
|
176
|
+
EXECUTED = "executed",
|
|
177
|
+
REJECTED = "rejected",
|
|
178
|
+
CANCELLED = "cancelled",
|
|
179
|
+
FAILED = "failed"
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Order method types - the action the order will perform
|
|
183
|
+
*/
|
|
184
|
+
type OrderMethodType = "native" | "erc20" | "spl" | "trc20" | "trc" | "addOwner" | "removeOwner" | "changeThreshold" | "addOwnerWithThreshold" | "AddOwner" | "RemoveOwner" | "ChangeThreshold" | "multiSend" | "MultiSend" | "updateOwners" | "updateOwnerThreshold" | "ada_native" | "ada_token" | "xrp_native" | "xrp_asset" | "xrp_setTrustLine" | "xrp_removeTrustLine" | "xrp_changeThreshold" | "xrp_updateOwners" | "xrp_updateOwnerThreshold";
|
|
185
|
+
/**
|
|
186
|
+
* Solana instruction types
|
|
187
|
+
*/
|
|
188
|
+
declare enum ESolanaInstructionType {
|
|
189
|
+
native = "native",
|
|
190
|
+
spl = "spl",
|
|
191
|
+
addOwner = "addOwner",
|
|
192
|
+
removeOwner = "removeOwner",
|
|
193
|
+
changeThreshold = "changeThreshold",
|
|
194
|
+
MultiSend = "MultiSend",
|
|
195
|
+
NATIVE = "native",
|
|
196
|
+
SPL = "spl",
|
|
197
|
+
ADD_OWNER = "addOwner",
|
|
198
|
+
REMOVE_OWNER = "removeOwner",
|
|
199
|
+
CHANGE_THRESHOLD = "changeThreshold"
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Tron order types
|
|
203
|
+
*/
|
|
204
|
+
declare enum ETronOrderType {
|
|
205
|
+
native = "native",
|
|
206
|
+
trc20 = "trc20",
|
|
207
|
+
trc = "trc",
|
|
208
|
+
addOwner = "addOwner",
|
|
209
|
+
removeOwner = "removeOwner",
|
|
210
|
+
changeThreshold = "changeThreshold",
|
|
211
|
+
updateOwners = "updateOwners",
|
|
212
|
+
updateOwnerThreshold = "updateOwnerThreshold"
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Order instruction for creating orders
|
|
216
|
+
*/
|
|
217
|
+
interface SolanaSPLInstruction {
|
|
218
|
+
type: ESolanaInstructionType.spl;
|
|
219
|
+
toPubkey: string;
|
|
220
|
+
tokenAddress: string;
|
|
221
|
+
amount: string;
|
|
222
|
+
}
|
|
223
|
+
interface SolanaNativeInstruction {
|
|
224
|
+
type: ESolanaInstructionType.native;
|
|
225
|
+
toPubkey: string;
|
|
226
|
+
amount: string;
|
|
227
|
+
}
|
|
228
|
+
interface SolanaConfigAddOwnerInstruction {
|
|
229
|
+
type: ESolanaInstructionType.addOwner;
|
|
230
|
+
newOwner: string;
|
|
231
|
+
}
|
|
232
|
+
interface SolanaConfigRemoveOwnerInstruction {
|
|
233
|
+
type: ESolanaInstructionType.removeOwner;
|
|
234
|
+
removeOwner: string;
|
|
235
|
+
}
|
|
236
|
+
interface SolanaConfigChangeThresholdInstruction {
|
|
237
|
+
type: ESolanaInstructionType.changeThreshold;
|
|
238
|
+
newThreshold: number;
|
|
239
|
+
}
|
|
240
|
+
type TSolanaCommandInstruction = SolanaNativeInstruction | SolanaSPLInstruction | SolanaConfigAddOwnerInstruction | SolanaConfigRemoveOwnerInstruction | SolanaConfigChangeThresholdInstruction;
|
|
241
|
+
interface TronNativeOrder {
|
|
242
|
+
type: ETronOrderType.native;
|
|
243
|
+
to: string;
|
|
244
|
+
amount: string;
|
|
245
|
+
}
|
|
246
|
+
interface TronTrcOrder {
|
|
247
|
+
type: ETronOrderType.trc | ETronOrderType.trc20;
|
|
248
|
+
to: string;
|
|
249
|
+
tokenAddress: string;
|
|
250
|
+
amount: string;
|
|
251
|
+
}
|
|
252
|
+
interface TronConfigChangeThresholdOrder {
|
|
253
|
+
type: ETronOrderType.changeThreshold;
|
|
254
|
+
newThreshold: number;
|
|
255
|
+
}
|
|
256
|
+
interface TronConfigChangeOwnersOrder {
|
|
257
|
+
type: ETronOrderType.updateOwners;
|
|
258
|
+
owners: string[];
|
|
259
|
+
}
|
|
260
|
+
interface TronConfigChangeOwnerThresholdOrder {
|
|
261
|
+
type: ETronOrderType.updateOwnerThreshold;
|
|
262
|
+
newThreshold: number;
|
|
263
|
+
owners: string[];
|
|
264
|
+
}
|
|
265
|
+
type TTronCommandInstruction = TronNativeOrder | TronTrcOrder | TronConfigChangeOwnersOrder | TronConfigChangeThresholdOrder | TronConfigChangeOwnerThresholdOrder;
|
|
266
|
+
interface BtcNativeInstruction {
|
|
267
|
+
type: "native";
|
|
268
|
+
to: string;
|
|
269
|
+
amount: string | number;
|
|
270
|
+
}
|
|
271
|
+
declare enum EAdaInstructionType {
|
|
272
|
+
native = "native",
|
|
273
|
+
token = "token"
|
|
274
|
+
}
|
|
275
|
+
interface AdaNativeInstruction {
|
|
276
|
+
type: EAdaInstructionType.native;
|
|
277
|
+
to: string;
|
|
278
|
+
amount: string;
|
|
279
|
+
}
|
|
280
|
+
interface AdaTokenInstruction {
|
|
281
|
+
type: EAdaInstructionType.token;
|
|
282
|
+
to: string;
|
|
283
|
+
policyId: string;
|
|
284
|
+
assetName: string;
|
|
285
|
+
amount: string;
|
|
286
|
+
}
|
|
287
|
+
type TAdaCommandInstruction = AdaNativeInstruction | AdaTokenInstruction;
|
|
288
|
+
declare enum EXrpOrderType {
|
|
289
|
+
native = "native",
|
|
290
|
+
asset = "asset",
|
|
291
|
+
setTrustLine = "setTrustLine",
|
|
292
|
+
removeTrustLine = "removeTrustLine",
|
|
293
|
+
changeThreshold = "changeThreshold",
|
|
294
|
+
updateOwners = "updateOwners",
|
|
295
|
+
updateOwnerThreshold = "updateOwnerThreshold"
|
|
296
|
+
}
|
|
297
|
+
interface XrpNativeInstruction {
|
|
298
|
+
type: EXrpOrderType.native;
|
|
299
|
+
to: string;
|
|
300
|
+
amount: string;
|
|
301
|
+
memo?: string;
|
|
302
|
+
}
|
|
303
|
+
interface XrpAssetInstruction {
|
|
304
|
+
type: EXrpOrderType.asset;
|
|
305
|
+
to: string;
|
|
306
|
+
amount: string;
|
|
307
|
+
tokenAddress: string;
|
|
308
|
+
memo?: string;
|
|
309
|
+
}
|
|
310
|
+
interface XrpSetTrustLineInstruction {
|
|
311
|
+
type: EXrpOrderType.setTrustLine;
|
|
312
|
+
tokenAddress: string;
|
|
313
|
+
issuer: string;
|
|
314
|
+
limit?: string;
|
|
315
|
+
}
|
|
316
|
+
interface XrpRemoveTrustLineInstruction {
|
|
317
|
+
type: EXrpOrderType.removeTrustLine;
|
|
318
|
+
currency: string;
|
|
319
|
+
issuer: string;
|
|
320
|
+
}
|
|
321
|
+
interface XrpChangeThresholdInstruction {
|
|
322
|
+
type: EXrpOrderType.changeThreshold;
|
|
323
|
+
newThreshold: number;
|
|
324
|
+
}
|
|
325
|
+
interface XrpUpdateOwnersInstruction {
|
|
326
|
+
type: EXrpOrderType.updateOwners;
|
|
327
|
+
newOwners: string[];
|
|
328
|
+
}
|
|
329
|
+
interface XrpUpdateOwnerThresholdInstruction {
|
|
330
|
+
type: EXrpOrderType.updateOwnerThreshold;
|
|
331
|
+
newOwners: string[];
|
|
332
|
+
newThreshold: number;
|
|
333
|
+
}
|
|
334
|
+
type TXrpCommandInstruction = XrpNativeInstruction | XrpAssetInstruction | XrpSetTrustLineInstruction | XrpRemoveTrustLineInstruction | XrpChangeThresholdInstruction | XrpUpdateOwnersInstruction | XrpUpdateOwnerThresholdInstruction;
|
|
335
|
+
interface OrderParamsMethodsEvmDto {
|
|
336
|
+
method: string;
|
|
337
|
+
args: any[] | string;
|
|
338
|
+
}
|
|
339
|
+
interface OrderParamsSol {
|
|
340
|
+
chainType: EChainType.SOL;
|
|
341
|
+
proposalHash: string;
|
|
342
|
+
transactionIndex: string;
|
|
343
|
+
instructions: TSolanaCommandInstruction[];
|
|
344
|
+
token?: TokenMultisignBalance | null;
|
|
345
|
+
expireTime?: Date;
|
|
346
|
+
}
|
|
347
|
+
interface OrderParamsEvm {
|
|
348
|
+
chainType: EChainType.EVM;
|
|
349
|
+
operation: "0" | "1" | string;
|
|
350
|
+
safeTxGas: string;
|
|
351
|
+
baseGas: string;
|
|
352
|
+
gasPrice: string;
|
|
353
|
+
gasToken: string;
|
|
354
|
+
refundReceiver: string;
|
|
355
|
+
methods: OrderParamsMethodsEvmDto[];
|
|
356
|
+
token?: TokenMultisignBalance | null;
|
|
357
|
+
expireTime?: Date;
|
|
358
|
+
value?: string;
|
|
359
|
+
data?: string;
|
|
360
|
+
}
|
|
361
|
+
interface OrderParamsBtc {
|
|
362
|
+
chainType: EChainType.BTC | EChainType.BTC_T3;
|
|
363
|
+
instructions: BtcNativeInstruction;
|
|
364
|
+
feeSats: string;
|
|
365
|
+
utxo: Array<{
|
|
366
|
+
value: number;
|
|
367
|
+
txid: string;
|
|
368
|
+
vout: number;
|
|
369
|
+
}>;
|
|
370
|
+
token?: TokenMultisignBalance | null;
|
|
371
|
+
expireTime?: Date;
|
|
372
|
+
}
|
|
373
|
+
interface OrderParamsTron {
|
|
374
|
+
chainType: EChainType.TRON;
|
|
375
|
+
instructions: TTronCommandInstruction[];
|
|
376
|
+
transaction?: {
|
|
377
|
+
txID: string;
|
|
378
|
+
raw_data: any;
|
|
379
|
+
raw_data_hex: string;
|
|
380
|
+
visible?: boolean;
|
|
381
|
+
signature?: string[];
|
|
382
|
+
};
|
|
383
|
+
token?: TokenMultisignBalance | null;
|
|
384
|
+
expireTime?: Date | string;
|
|
385
|
+
}
|
|
386
|
+
interface OrderParamsAda {
|
|
387
|
+
chainType: EChainType.ADA;
|
|
388
|
+
policyId?: string;
|
|
389
|
+
nativeScriptCbor?: string;
|
|
390
|
+
feeLovelace?: string;
|
|
391
|
+
instructions?: TAdaCommandInstruction;
|
|
392
|
+
token?: TokenMultisignBalance | null;
|
|
393
|
+
expireTime?: Date;
|
|
394
|
+
}
|
|
395
|
+
interface OrderParamsXrp {
|
|
396
|
+
chainType: EChainType.XRP;
|
|
397
|
+
instructions?: TXrpCommandInstruction;
|
|
398
|
+
token?: TokenMultisignBalance | null;
|
|
399
|
+
expireTime?: Date;
|
|
400
|
+
version?: number;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Legacy support for loose typing (optional, but good for migration)
|
|
404
|
+
* We recommend using Discriminated Union `OrderParams` instead.
|
|
405
|
+
*/
|
|
406
|
+
interface OrderSigner {
|
|
407
|
+
address: string;
|
|
408
|
+
signature?: string;
|
|
409
|
+
signedAt?: string;
|
|
410
|
+
}
|
|
411
|
+
interface OrderInstruction {
|
|
412
|
+
to?: string;
|
|
413
|
+
symbol?: string;
|
|
414
|
+
toPubkey?: string;
|
|
415
|
+
amount?: string;
|
|
416
|
+
tokenAddress?: string;
|
|
417
|
+
decimals?: number;
|
|
418
|
+
type?: string;
|
|
419
|
+
newOwner?: string;
|
|
420
|
+
owners?: string[];
|
|
421
|
+
removeOwner?: string;
|
|
422
|
+
ownerToRemove?: string;
|
|
423
|
+
newThreshold?: number;
|
|
424
|
+
data?: string;
|
|
425
|
+
value?: string;
|
|
426
|
+
memo?: string;
|
|
427
|
+
}
|
|
428
|
+
type OrderParams = OrderParamsSol | OrderParamsEvm | OrderParamsBtc | OrderParamsTron | OrderParamsAda | OrderParamsXrp;
|
|
429
|
+
interface Signature {
|
|
430
|
+
id: string;
|
|
431
|
+
orderId: string;
|
|
432
|
+
multisigOwnerId: string;
|
|
433
|
+
signedHash: string;
|
|
434
|
+
createdAt: string;
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
interface Signatures {
|
|
438
|
+
walletAddress: string;
|
|
439
|
+
signedHash: string;
|
|
440
|
+
status: string;
|
|
441
|
+
}
|
|
442
|
+
declare enum EOrderStatus {
|
|
443
|
+
proposed = "proposed",
|
|
444
|
+
created = "created",
|
|
445
|
+
pending = "pending",
|
|
446
|
+
ready = "ready",
|
|
447
|
+
rejected = "rejected",
|
|
448
|
+
execution = "execution",
|
|
449
|
+
expired = "expired",
|
|
450
|
+
completed = "completed"
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Order object
|
|
454
|
+
*/
|
|
455
|
+
interface Order {
|
|
456
|
+
id: string;
|
|
457
|
+
type?: string;
|
|
458
|
+
multisigId: string;
|
|
459
|
+
to: string;
|
|
460
|
+
data: string;
|
|
461
|
+
value: string;
|
|
462
|
+
method: string;
|
|
463
|
+
operation: number;
|
|
464
|
+
hashToSing: string;
|
|
465
|
+
txHash: string | null;
|
|
466
|
+
updatedAt: string;
|
|
467
|
+
createdAt: string;
|
|
468
|
+
nonce: number;
|
|
469
|
+
walletInitiator: string;
|
|
470
|
+
signature: Signature;
|
|
471
|
+
status: EOrderStatus;
|
|
472
|
+
multisig: MultisigsItem;
|
|
473
|
+
signatures: Signatures[];
|
|
474
|
+
params?: OrderParams;
|
|
475
|
+
isSmallestNonce?: boolean;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Paginated orders response
|
|
479
|
+
*/
|
|
480
|
+
interface PaginatedOrdersResponse {
|
|
481
|
+
orders: Order[];
|
|
482
|
+
total: number;
|
|
483
|
+
page: number;
|
|
484
|
+
limit: number;
|
|
485
|
+
}
|
|
486
|
+
interface TokenInfo {
|
|
487
|
+
address: string;
|
|
488
|
+
symbol: string;
|
|
489
|
+
name?: string;
|
|
490
|
+
decimals: number;
|
|
491
|
+
logoUrl?: string;
|
|
492
|
+
priceUsd?: string;
|
|
493
|
+
balance?: string;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Supported token from backend
|
|
497
|
+
*/
|
|
498
|
+
interface SupportedToken {
|
|
499
|
+
address: string;
|
|
500
|
+
symbol: string;
|
|
501
|
+
name: string;
|
|
502
|
+
decimals: number;
|
|
503
|
+
chainType: EChainType;
|
|
504
|
+
chainId: ChainIdValue;
|
|
505
|
+
logoUrl?: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Token balance for multisig
|
|
509
|
+
*/
|
|
510
|
+
interface TokenMultisignBalance {
|
|
511
|
+
name: string;
|
|
512
|
+
symbol: string;
|
|
513
|
+
balanceWei: string;
|
|
514
|
+
balance: string;
|
|
515
|
+
decimals: number;
|
|
516
|
+
address: string;
|
|
517
|
+
logoURL: string;
|
|
518
|
+
nativeTokenSymbol: string;
|
|
519
|
+
nativeTokenName: string;
|
|
520
|
+
amountNum?: number;
|
|
521
|
+
priceUsd?: number;
|
|
522
|
+
priceUSD?: number;
|
|
523
|
+
priceChange24h?: number;
|
|
524
|
+
price24hChange?: number;
|
|
525
|
+
valueUsd?: number;
|
|
526
|
+
balanceUSD?: number;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Wallet portfolio response
|
|
530
|
+
*/
|
|
531
|
+
interface TokensBalance {
|
|
532
|
+
name: string;
|
|
533
|
+
symbol: string;
|
|
534
|
+
balanceWei: string;
|
|
535
|
+
balance: string;
|
|
536
|
+
priceUSD: number;
|
|
537
|
+
price24hChange: number;
|
|
538
|
+
balanceUSD: number;
|
|
539
|
+
decimals: number;
|
|
540
|
+
address: string;
|
|
541
|
+
logoURL: string;
|
|
542
|
+
}
|
|
543
|
+
interface WalletPortfolioResponse {
|
|
544
|
+
walletAddress: string;
|
|
545
|
+
chainType: EChainType;
|
|
546
|
+
chain: ChainIdValue;
|
|
547
|
+
tokens: TokensBalance[];
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Portfolio request payload
|
|
551
|
+
*/
|
|
552
|
+
interface PortfolioRequest {
|
|
553
|
+
walletAddress: string;
|
|
554
|
+
chainType: EChainType;
|
|
555
|
+
chain: string;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Total asset value response
|
|
559
|
+
*/
|
|
560
|
+
interface TotalAssetValueResponse {
|
|
561
|
+
totalAssetValueUSD: string;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Supported tokens response
|
|
565
|
+
*/
|
|
566
|
+
interface SupportedTokensResponse {
|
|
567
|
+
tokens: SupportedToken[];
|
|
568
|
+
total: number;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Estimated fee response
|
|
572
|
+
*/
|
|
573
|
+
interface EstimatedFee {
|
|
574
|
+
estimatedFee: string;
|
|
575
|
+
gasLimit?: string;
|
|
576
|
+
gasPrice?: string;
|
|
577
|
+
nativeFeeLamports?: number;
|
|
578
|
+
gasFeeRaw?: string;
|
|
579
|
+
maxFeePerGas?: string;
|
|
580
|
+
maxPriorityFeePerGas?: string;
|
|
581
|
+
energyFee?: string;
|
|
582
|
+
bandwidthFee?: string;
|
|
583
|
+
priorityFee?: string;
|
|
584
|
+
feeRate?: number;
|
|
585
|
+
feeInUsd?: string;
|
|
586
|
+
totalFee?: string;
|
|
587
|
+
currency?: string;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Transaction history item
|
|
591
|
+
*/
|
|
592
|
+
interface TokenData {
|
|
593
|
+
symbol: string;
|
|
594
|
+
value: string;
|
|
595
|
+
logoURL: string;
|
|
596
|
+
}
|
|
597
|
+
interface TransactionDetails {
|
|
598
|
+
to: string;
|
|
599
|
+
value: string;
|
|
600
|
+
data: string;
|
|
601
|
+
operation: number;
|
|
602
|
+
safeTxGas: string;
|
|
603
|
+
baseGas: number;
|
|
604
|
+
gasPrice: number;
|
|
605
|
+
gasToken: number;
|
|
606
|
+
refundReceiver: string;
|
|
607
|
+
nonce: number;
|
|
608
|
+
}
|
|
609
|
+
interface TransactionHistoryItem {
|
|
610
|
+
chainType: EChainType;
|
|
611
|
+
chainId: ChainIdValue;
|
|
612
|
+
threshold: string;
|
|
613
|
+
executed: string;
|
|
614
|
+
status: "success" | "failed" | "pending";
|
|
615
|
+
method: string;
|
|
616
|
+
from: string;
|
|
617
|
+
to: string;
|
|
618
|
+
value: string;
|
|
619
|
+
creator: string;
|
|
620
|
+
confirmations: string[];
|
|
621
|
+
token: TokenData;
|
|
622
|
+
details: TransactionDetails;
|
|
623
|
+
hash: string;
|
|
624
|
+
time: string;
|
|
625
|
+
}
|
|
626
|
+
interface HistoryResponse {
|
|
627
|
+
total: number;
|
|
628
|
+
page: number;
|
|
629
|
+
limit: number;
|
|
630
|
+
items: TransactionHistoryItem[];
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Status filter for history queries
|
|
634
|
+
*/
|
|
635
|
+
declare enum StatusFilterEnum {
|
|
636
|
+
ALL = "all",
|
|
637
|
+
PENDING = "pending",
|
|
638
|
+
EXECUTED = "executed",
|
|
639
|
+
REJECTED = "rejected"
|
|
640
|
+
}
|
|
641
|
+
interface TxHistoryToken {
|
|
642
|
+
symbol: string;
|
|
643
|
+
logoURL: string;
|
|
644
|
+
value: string;
|
|
645
|
+
name?: string;
|
|
646
|
+
priceUSD?: number;
|
|
647
|
+
price24hChange?: number;
|
|
648
|
+
}
|
|
649
|
+
interface TxHistoryMethod {
|
|
650
|
+
args: (string | number)[];
|
|
651
|
+
method: string;
|
|
652
|
+
}
|
|
653
|
+
interface Instruction {
|
|
654
|
+
type: "native" | "spl" | "trc20" | string;
|
|
655
|
+
amount: string;
|
|
656
|
+
toPubkey?: string;
|
|
657
|
+
to?: string;
|
|
658
|
+
tokenAddress?: string;
|
|
659
|
+
}
|
|
660
|
+
interface TxHistoryDetails {
|
|
661
|
+
to: string;
|
|
662
|
+
value: string;
|
|
663
|
+
data: string;
|
|
664
|
+
operation: number;
|
|
665
|
+
safeTxGas: string;
|
|
666
|
+
baseGas: number;
|
|
667
|
+
gasPrice: number;
|
|
668
|
+
gasToken: number;
|
|
669
|
+
refundReceiver: string;
|
|
670
|
+
nonce: number;
|
|
671
|
+
instructions?: Instruction | Instruction[];
|
|
672
|
+
token: TxHistoryToken;
|
|
673
|
+
methods: TxHistoryMethod[];
|
|
674
|
+
chainType: string;
|
|
675
|
+
}
|
|
676
|
+
interface TxHistoryItem {
|
|
677
|
+
id: string;
|
|
678
|
+
status: string;
|
|
679
|
+
method: string;
|
|
680
|
+
chainId: string;
|
|
681
|
+
chainType: string;
|
|
682
|
+
threshold: string;
|
|
683
|
+
from: string;
|
|
684
|
+
to: string;
|
|
685
|
+
value: string;
|
|
686
|
+
token: TxHistoryToken;
|
|
687
|
+
details?: TxHistoryDetails;
|
|
688
|
+
hash: string;
|
|
689
|
+
time: string;
|
|
690
|
+
executed: string;
|
|
691
|
+
creator: string;
|
|
692
|
+
confirmations: string[];
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Combined transaction history for multisigs
|
|
696
|
+
*/
|
|
697
|
+
interface TxHistoryCombinedResponse {
|
|
698
|
+
items: TxHistoryItem[];
|
|
699
|
+
limit: number;
|
|
700
|
+
total: number;
|
|
701
|
+
page: number;
|
|
702
|
+
}
|
|
703
|
+
declare enum EAddressBookEntryType {
|
|
704
|
+
CEX = "CEX",
|
|
705
|
+
Wallet = "Wallet"
|
|
706
|
+
}
|
|
707
|
+
type AddressBookEntryType = "CEX" | "Wallet";
|
|
708
|
+
interface AddressBookEntry {
|
|
709
|
+
id: string;
|
|
710
|
+
name: string;
|
|
711
|
+
address: string;
|
|
712
|
+
chainType: ChainType;
|
|
713
|
+
type: AddressBookEntryType;
|
|
714
|
+
memo: string | null;
|
|
715
|
+
createdAt: string;
|
|
716
|
+
}
|
|
717
|
+
interface AddressTypeResponse {
|
|
718
|
+
type: AddressBookEntryType | null;
|
|
719
|
+
}
|
|
720
|
+
/** Org member role as returned by the API (e.g. "MASTER" | "EMPLOYEE"). */
|
|
721
|
+
type OrgMemberRole = string;
|
|
722
|
+
/** Org member account status as returned by the API. */
|
|
723
|
+
type OrgMemberStatus = string;
|
|
724
|
+
/**
|
|
725
|
+
* Individual KYC verification status for an org member.
|
|
726
|
+
* `null` is returned when the invite has not been accepted yet.
|
|
727
|
+
*/
|
|
728
|
+
type OrgMemberKycStatus = "new" | "pending" | "verified" | "failed" | "expired";
|
|
729
|
+
/**
|
|
730
|
+
* A single member row from `GET /sdk/organization/team`.
|
|
731
|
+
* `userId`, `userName`, `kycStatus`, and `joinedAt` are `null` when the
|
|
732
|
+
* invitation has not been accepted yet.
|
|
733
|
+
*/
|
|
734
|
+
interface OrgTeamMember {
|
|
735
|
+
id: string;
|
|
736
|
+
email: string;
|
|
737
|
+
role: OrgMemberRole;
|
|
738
|
+
status: OrgMemberStatus;
|
|
739
|
+
userId: string | null;
|
|
740
|
+
userName: string | null;
|
|
741
|
+
kycStatus: OrgMemberKycStatus | null;
|
|
742
|
+
assignedWalletsCount: number;
|
|
743
|
+
assignedVaultsCount: number;
|
|
744
|
+
invitedAt: string;
|
|
745
|
+
joinedAt: string | null;
|
|
746
|
+
}
|
|
747
|
+
/** Response shape of `GET /sdk/organization/team`. */
|
|
748
|
+
interface OrgTeamDirectoryResponse {
|
|
749
|
+
members: OrgTeamMember[];
|
|
750
|
+
}
|
|
751
|
+
/** Body of `POST /sdk/organization/team/invite`. */
|
|
752
|
+
interface InviteOrgMemberInput {
|
|
753
|
+
email: string;
|
|
754
|
+
}
|
|
755
|
+
/** Response of `POST /sdk/organization/team/invite`. */
|
|
756
|
+
interface InviteOrgMemberResponse {
|
|
757
|
+
memberId: string;
|
|
758
|
+
email: string;
|
|
759
|
+
status: string;
|
|
760
|
+
}
|
|
761
|
+
/** Path params for `DELETE /sdk/organization/team/{memberId}`. */
|
|
762
|
+
interface RemoveOrgMemberInput {
|
|
763
|
+
memberId: string;
|
|
764
|
+
}
|
|
765
|
+
/** Path params for `GET /sdk/organization/team/{memberId}/wallets`. */
|
|
766
|
+
interface ListOrgMemberWalletsInput {
|
|
767
|
+
memberId: string;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Body of `POST /sdk/organization/team/{memberId}/wallets`.
|
|
771
|
+
* `walletId` may refer to either a wallet or a vault — the backend
|
|
772
|
+
* validates ownership.
|
|
773
|
+
*/
|
|
774
|
+
interface AssignOrgWalletInput {
|
|
775
|
+
memberId: string;
|
|
776
|
+
walletId: string;
|
|
777
|
+
}
|
|
778
|
+
/** Response of `POST /sdk/organization/team/{memberId}/wallets`. */
|
|
779
|
+
interface AssignOrgWalletResponse {
|
|
780
|
+
assignmentId: string;
|
|
781
|
+
}
|
|
782
|
+
/** Path params for `DELETE /sdk/organization/team/{memberId}/wallets/{walletId}`. */
|
|
783
|
+
interface UnassignOrgWalletInput {
|
|
784
|
+
memberId: string;
|
|
785
|
+
walletId: string;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* One row from `OrganizationWalletsResponseDto`. Used by both:
|
|
789
|
+
* - `GET /sdk/organization/wallets` (org-wide list)
|
|
790
|
+
* - `GET /sdk/organization/team/{memberId}/wallets` (member-assigned list)
|
|
791
|
+
*/
|
|
792
|
+
interface OrgWalletItem {
|
|
793
|
+
id: string;
|
|
794
|
+
address: string;
|
|
795
|
+
/** Lowercased chain key as returned by the server (e.g. "evm"). */
|
|
796
|
+
chainType: string;
|
|
797
|
+
name: string;
|
|
798
|
+
isImported: boolean;
|
|
799
|
+
}
|
|
800
|
+
/** Response of org wallet list endpoints. */
|
|
801
|
+
interface OrgWalletsResponse {
|
|
802
|
+
wallets: OrgWalletItem[];
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* `GET /sdk/organization/policies` — current org security policy.
|
|
806
|
+
* Returned fields are partially optional/nullable when the corresponding
|
|
807
|
+
* feature is disabled (e.g. business hours fields when `businessHoursEnabled`
|
|
808
|
+
* is `false`).
|
|
809
|
+
*/
|
|
810
|
+
interface OrgPolicy {
|
|
811
|
+
id: string;
|
|
812
|
+
organizationId: string;
|
|
813
|
+
/** Daily spending limit in USD, serialized as a string. `null` when unset. */
|
|
814
|
+
dailySpendingLimitUsd: string | null;
|
|
815
|
+
businessHoursEnabled: boolean;
|
|
816
|
+
/** "HH:MM" in `businessHoursTimezone`. `null` when business hours are off. */
|
|
817
|
+
businessHoursStart: string | null;
|
|
818
|
+
/** "HH:MM" in `businessHoursTimezone`. `null` when business hours are off. */
|
|
819
|
+
businessHoursEnd: string | null;
|
|
820
|
+
/** IANA timezone (e.g. "Europe/Warsaw"). `null` when business hours are off. */
|
|
821
|
+
businessHoursTimezone: string | null;
|
|
822
|
+
/** ISO weekday numbers (1 = Monday, 7 = Sunday). */
|
|
823
|
+
businessHoursDays: number[];
|
|
824
|
+
/** Whether KYC is required for employees in this org. */
|
|
825
|
+
forceEmployeeKyc: boolean;
|
|
826
|
+
/** Whether transfers are restricted to verified Corporate Address Book entries. */
|
|
827
|
+
forceAddressBook: boolean;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Body of `PATCH /sdk/organization/policies` — partial update.
|
|
831
|
+
*
|
|
832
|
+
* Conditional validation enforced server-side:
|
|
833
|
+
* - Enabling `businessHoursEnabled` requires `businessHoursStart`,
|
|
834
|
+
* `businessHoursEnd`, and `businessHoursTimezone`.
|
|
835
|
+
* - `dailySpendingLimitUsd` must be a positive numeric string when set;
|
|
836
|
+
* pass `null` to clear the limit.
|
|
837
|
+
*/
|
|
838
|
+
interface UpdateOrgPolicyInput {
|
|
839
|
+
dailySpendingLimitUsd?: string | null;
|
|
840
|
+
businessHoursEnabled?: boolean;
|
|
841
|
+
businessHoursStart?: string;
|
|
842
|
+
businessHoursEnd?: string;
|
|
843
|
+
businessHoursTimezone?: string;
|
|
844
|
+
businessHoursDays?: number[];
|
|
845
|
+
forceEmployeeKyc?: boolean;
|
|
846
|
+
forceAddressBook?: boolean;
|
|
847
|
+
}
|
|
848
|
+
/** FATF Travel Rule: recipient legal nature. */
|
|
849
|
+
type OrgAddressRecipientType = "individual" | "corporate";
|
|
850
|
+
/** FATF Travel Rule: counterparty wallet category. */
|
|
851
|
+
type OrgAddressWalletType = "self_hosted" | "crypto_service_provider";
|
|
852
|
+
/**
|
|
853
|
+
* One entry from `GET /sdk/organization/address-book`.
|
|
854
|
+
*
|
|
855
|
+
* Travel Rule fields (`beneficiaryName`, `registeredName`, `vaspName`,
|
|
856
|
+
* `vaspLei`) are populated according to `recipientType` / `walletType` rules
|
|
857
|
+
* enforced at create time.
|
|
858
|
+
*
|
|
859
|
+
* `isVerified` indicates whether the entry counts toward transfer
|
|
860
|
+
* whitelisting (`forceAddressBook` policy). API-key flows auto-verify on
|
|
861
|
+
* create; JWT flows may require OTP confirmation (not exposed by this SDK).
|
|
862
|
+
*/
|
|
863
|
+
interface OrgAddressBookEntry {
|
|
864
|
+
id: string;
|
|
865
|
+
name: string;
|
|
866
|
+
address: string;
|
|
867
|
+
chainType: ChainType;
|
|
868
|
+
/** "CEX" | "Wallet". */
|
|
869
|
+
type: "CEX" | "Wallet";
|
|
870
|
+
memo?: string | null;
|
|
871
|
+
recipientType?: OrgAddressRecipientType;
|
|
872
|
+
walletType?: OrgAddressWalletType;
|
|
873
|
+
beneficiaryName?: string | null;
|
|
874
|
+
registeredName?: string | null;
|
|
875
|
+
vaspName?: string | null;
|
|
876
|
+
vaspLei?: string | null;
|
|
877
|
+
isVerified: boolean;
|
|
878
|
+
createdAt: string;
|
|
879
|
+
updatedAt: string;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Body of `POST /sdk/organization/address-book`.
|
|
883
|
+
*
|
|
884
|
+
* Server enforces:
|
|
885
|
+
* - `recipientType === "individual"` → `beneficiaryName` required.
|
|
886
|
+
* - `recipientType === "corporate"` → `registeredName` required.
|
|
887
|
+
* - `walletType === "crypto_service_provider"` → `vaspName` required.
|
|
888
|
+
*/
|
|
889
|
+
interface CreateOrgAddressInput {
|
|
890
|
+
address: string;
|
|
891
|
+
chainType: ChainType;
|
|
892
|
+
name: string;
|
|
893
|
+
type: "CEX" | "Wallet";
|
|
894
|
+
recipientType: OrgAddressRecipientType;
|
|
895
|
+
walletType: OrgAddressWalletType;
|
|
896
|
+
beneficiaryName?: string;
|
|
897
|
+
registeredName?: string;
|
|
898
|
+
vaspName?: string;
|
|
899
|
+
vaspLei?: string;
|
|
900
|
+
memo?: string;
|
|
901
|
+
}
|
|
902
|
+
/** Response of `POST /sdk/organization/address-book`. */
|
|
903
|
+
interface AddOrgAddressResponse {
|
|
904
|
+
id: string;
|
|
905
|
+
address: string;
|
|
906
|
+
isVerified: boolean;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Body of `PATCH /sdk/organization/address-book/{addressId}`.
|
|
910
|
+
*
|
|
911
|
+
* `address` and `chainType` are immutable server-side — they are intentionally
|
|
912
|
+
* absent from this shape.
|
|
913
|
+
*/
|
|
914
|
+
interface UpdateOrgAddressInput {
|
|
915
|
+
name?: string;
|
|
916
|
+
memo?: string;
|
|
917
|
+
type?: "CEX" | "Wallet";
|
|
918
|
+
recipientType?: OrgAddressRecipientType;
|
|
919
|
+
walletType?: OrgAddressWalletType;
|
|
920
|
+
beneficiaryName?: string;
|
|
921
|
+
registeredName?: string;
|
|
922
|
+
vaspName?: string;
|
|
923
|
+
vaspLei?: string;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Audit event labels enumerated by `GET /sdk/organization/audit-logs`.
|
|
927
|
+
*
|
|
928
|
+
* Keep this list in sync with the OpenAPI `eventTypes`/`event` enum in
|
|
929
|
+
* `docs/openapi-trustodian-sdk-production.json` (component
|
|
930
|
+
* `UserAuditLogItemDTO.event`).
|
|
931
|
+
*/
|
|
932
|
+
type OrgAuditEventType = "Account Created" | "Login" | "Password Changed" | "Password Reset" | "Email Changed" | "Email Reverted" | "2FA Disabled" | "2FA Enabled" | "Wallet Created" | "Wallet Imported" | "Wallet Deleted" | "Vault Created" | "Vault Activated" | "Transaction Created" | "Transaction Signed" | "Transaction Rejected" | "Transaction Executed" | "KYC Initiated" | "Org Created" | "Org KYB Initiated" | "Org KYB Completed" | "Org Member Invited" | "Org Member Joined" | "Org Member Removed" | "Org Wallet Assigned" | "Org Wallet Unassigned" | "Org Policy Updated" | "Org Address Added" | "Org Address Verified" | "Org Address Updated" | "Org Address Removed" | "Org Blocked" | "Org Activated";
|
|
933
|
+
/** One row of `GET /sdk/organization/audit-logs`. */
|
|
934
|
+
interface OrgAuditLogItem {
|
|
935
|
+
id: string;
|
|
936
|
+
/** ISO 8601 timestamp. */
|
|
937
|
+
date: string;
|
|
938
|
+
event: OrgAuditEventType;
|
|
939
|
+
ipAddress: string;
|
|
940
|
+
/** "Mobile" | "Tablet" | "Web" — server-derived from User-Agent. */
|
|
941
|
+
device?: string | null;
|
|
942
|
+
/** "iOS" | "Android" | "Windows" | "macOS" | "Linux" — server-derived. */
|
|
943
|
+
platform?: string | null;
|
|
944
|
+
/** Approximate city/country derived from IP. */
|
|
945
|
+
location?: string | null;
|
|
946
|
+
}
|
|
947
|
+
/** Paginated response of `GET /sdk/organization/audit-logs`. */
|
|
948
|
+
interface OrgAuditLogsResponse {
|
|
949
|
+
total: number;
|
|
950
|
+
page: number;
|
|
951
|
+
limit: number;
|
|
952
|
+
totalPages: number;
|
|
953
|
+
items: OrgAuditLogItem[];
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Query of `GET /sdk/organization/audit-logs`.
|
|
957
|
+
*
|
|
958
|
+
* Encoding notes (see `docs/api-contract-clarifications.md`):
|
|
959
|
+
* - `eventTypes` is OpenAPI `type: array` of enum strings; the SDK serializes
|
|
960
|
+
* it using OpenAPI's default `style: form, explode: true` — i.e. repeated
|
|
961
|
+
* keys: `?eventTypes=Login&eventTypes=Wallet+Created`. Confirm the
|
|
962
|
+
* server-accepted form with one staging request before locking down.
|
|
963
|
+
* - `dateFrom` / `dateTo` are ISO 8601 timestamps.
|
|
964
|
+
*/
|
|
965
|
+
interface GetOrgAuditLogsInput {
|
|
966
|
+
page?: number;
|
|
967
|
+
limit?: number;
|
|
968
|
+
dateFrom?: string;
|
|
969
|
+
dateTo?: string;
|
|
970
|
+
eventTypes?: OrgAuditEventType[];
|
|
971
|
+
actorId?: string;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Input for estimateFee
|
|
975
|
+
*/
|
|
976
|
+
interface EstimateFeeInput {
|
|
977
|
+
chain: ChainType;
|
|
978
|
+
txType: TransactionEstimatingTypeValue;
|
|
979
|
+
payload: {
|
|
980
|
+
from?: string;
|
|
981
|
+
to?: string;
|
|
982
|
+
amount?: string;
|
|
983
|
+
tokenAddress?: string;
|
|
984
|
+
decimals?: number;
|
|
985
|
+
orderId?: string;
|
|
986
|
+
multisigId?: string;
|
|
987
|
+
owners?: string[];
|
|
988
|
+
threshold?: number;
|
|
989
|
+
order?: Order;
|
|
990
|
+
multisig?: MultisigsItem;
|
|
991
|
+
method?: any;
|
|
992
|
+
};
|
|
993
|
+
chainId?: ChainIdValue;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Input for GET /sdk/multisig (paginated vault list).
|
|
997
|
+
*/
|
|
998
|
+
interface GetPaginatedMultisigsInput {
|
|
999
|
+
page?: number;
|
|
1000
|
+
limit?: number;
|
|
1001
|
+
/** Serialized as comma-separated chain types (e.g. EVM,SOL). */
|
|
1002
|
+
chainTypes?: EChainType[];
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Input for activateMultisig
|
|
1006
|
+
*/
|
|
1007
|
+
interface ActivateMultisigInput {
|
|
1008
|
+
chain: ChainType;
|
|
1009
|
+
multisigId: string;
|
|
1010
|
+
multisigAddress: string;
|
|
1011
|
+
walletAddress: string;
|
|
1012
|
+
feeQuote: EstimatedFee;
|
|
1013
|
+
chainId?: ChainIdValue;
|
|
1014
|
+
/** Full multisig object for EVM activation */
|
|
1015
|
+
multisig: MultisigsItem;
|
|
1016
|
+
/** Gas limit override */
|
|
1017
|
+
gasLimit?: string;
|
|
1018
|
+
/** Gas price override */
|
|
1019
|
+
gasPrice?: string;
|
|
1020
|
+
/** Device share for wallet key reconstruction (required for SOL) */
|
|
1021
|
+
deviceShare?: string;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* SDK error codes
|
|
1025
|
+
*/
|
|
1026
|
+
declare enum SDKErrorCode {
|
|
1027
|
+
UNKNOWN = "UNKNOWN",
|
|
1028
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
1029
|
+
API_ERROR = "API_ERROR",
|
|
1030
|
+
INVALID_INPUT = "INVALID_INPUT",
|
|
1031
|
+
CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED",
|
|
1032
|
+
INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
|
|
1033
|
+
KEY_MISMATCH = "KEY_MISMATCH",
|
|
1034
|
+
KEY_RECONSTRUCTION_FAILED = "KEY_RECONSTRUCTION_FAILED",
|
|
1035
|
+
SIGNATURE_FAILED = "SIGNATURE_FAILED",
|
|
1036
|
+
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
1037
|
+
BROADCAST_FAILED = "BROADCAST_FAILED",
|
|
1038
|
+
ORDER_NOT_FOUND = "ORDER_NOT_FOUND",
|
|
1039
|
+
MULTISIG_NOT_FOUND = "MULTISIG_NOT_FOUND",
|
|
1040
|
+
WALLET_NOT_FOUND = "WALLET_NOT_FOUND",
|
|
1041
|
+
THRESHOLD_NOT_MET = "THRESHOLD_NOT_MET",
|
|
1042
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
1043
|
+
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
1044
|
+
ORG_POLICY_REJECTED = "ORG_POLICY_REJECTED",
|
|
1045
|
+
RATE_LIMITED = "RATE_LIMITED",
|
|
1046
|
+
TIMEOUT = "TIMEOUT"
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Stable platform codes returned by the server when an order is rejected by
|
|
1050
|
+
* an organization security policy. Applies to the six chain-specific order
|
|
1051
|
+
* creation routes (`POST /sdk/order/create/{evm,sol,btc,tron,ada,xrp}`) and
|
|
1052
|
+
* to any other downstream route that runs the same policy check pipeline.
|
|
1053
|
+
*
|
|
1054
|
+
* The four codes correspond to the four org policy checks documented in
|
|
1055
|
+
* `docs/v3-b2b-sdk-implementation-plan.md` (Step 2b) and
|
|
1056
|
+
* `docs/api-contract-clarifications.md`:
|
|
1057
|
+
*
|
|
1058
|
+
* - `ERROR_KYC_REQUIRED` — caller (or org) has not completed KYC/KYB.
|
|
1059
|
+
* - `ERROR_BUSINESS_HOURS_VIOLATION` — outside the org's allowed window.
|
|
1060
|
+
* - `ERROR_ADDRESS_NOT_WHITELISTED` — `forceAddressBook` is on and the
|
|
1061
|
+
* destination is not a verified Corporate Address Book entry.
|
|
1062
|
+
* - `ERROR_DAILY_LIMIT_EXCEEDED` — `dailySpendingLimitUsd` would be
|
|
1063
|
+
* exceeded by this transfer.
|
|
1064
|
+
*
|
|
1065
|
+
* Master accounts are exempt from these checks server-side, so this error
|
|
1066
|
+
* is never thrown for Master callers.
|
|
1067
|
+
*
|
|
1068
|
+
* Step 7.1 follow-up: confirm staging actually uses these literal strings
|
|
1069
|
+
* (and which JSON field carries them) before flipping
|
|
1070
|
+
* `ORG_POLICY_MAPPING_ENABLED` in `src/api/client.ts` to `true`.
|
|
1071
|
+
*/
|
|
1072
|
+
type OrgPolicyCode = "ERROR_KYC_REQUIRED" | "ERROR_BUSINESS_HOURS_VIOLATION" | "ERROR_ADDRESS_NOT_WHITELISTED" | "ERROR_DAILY_LIMIT_EXCEEDED";
|
|
1073
|
+
/**
|
|
1074
|
+
* Runtime list of every known `OrgPolicyCode`. Kept in sync with the type
|
|
1075
|
+
* union above; used by `extractOrgPolicyCode` in `src/core/errors.ts`.
|
|
1076
|
+
*/
|
|
1077
|
+
declare const ORG_POLICY_CODES: readonly OrgPolicyCode[];
|
|
1078
|
+
/**
|
|
1079
|
+
* SDK error interface
|
|
1080
|
+
*/
|
|
1081
|
+
interface SDKError {
|
|
1082
|
+
code: SDKErrorCode;
|
|
1083
|
+
message: string;
|
|
1084
|
+
chain?: ChainType;
|
|
1085
|
+
operation?: string;
|
|
1086
|
+
details?: Record<string, unknown>;
|
|
1087
|
+
cause?: Error;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Network mode
|
|
1091
|
+
*/
|
|
1092
|
+
type NetworkMode = "mainnet" | "testnet";
|
|
1093
|
+
/**
|
|
1094
|
+
* RPC overrides per chain
|
|
1095
|
+
*/
|
|
1096
|
+
type RpcOverrides = Partial<Record<ChainIdValue, string>>;
|
|
1097
|
+
/**
|
|
1098
|
+
* SDK configuration options
|
|
1099
|
+
*/
|
|
1100
|
+
interface SDKConfig {
|
|
1101
|
+
/** API key for authentication (use this OR accessToken) */
|
|
1102
|
+
apiKey?: string;
|
|
1103
|
+
/** Access token for authentication (use this OR apiKey) */
|
|
1104
|
+
accessToken?: string;
|
|
1105
|
+
network?: NetworkMode;
|
|
1106
|
+
apiBaseUrl?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Base path segment for SDK HTTP routes (default `/sdk`).
|
|
1109
|
+
* Only change this if the API is mounted under a different prefix.
|
|
1110
|
+
*/
|
|
1111
|
+
apiPathPrefix?: string;
|
|
1112
|
+
rpcOverrides?: RpcOverrides;
|
|
1113
|
+
timeout?: number;
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Wallet rename response
|
|
1117
|
+
*/
|
|
1118
|
+
interface WalletRenameResponse {
|
|
1119
|
+
wallet: TWallet;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Delete operation response
|
|
1123
|
+
*/
|
|
1124
|
+
interface DeleteResponse {
|
|
1125
|
+
success: boolean;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
interface XrpAccountReserveInfo {
|
|
1129
|
+
address: string;
|
|
1130
|
+
totalBalance: string;
|
|
1131
|
+
availableBalance: string;
|
|
1132
|
+
totalReserve: string;
|
|
1133
|
+
baseReserve: string;
|
|
1134
|
+
ownerCount: number;
|
|
1135
|
+
ownerReservePerObject: string;
|
|
1136
|
+
objects: {
|
|
1137
|
+
trustLines: number;
|
|
1138
|
+
signerList: boolean;
|
|
1139
|
+
offers: number;
|
|
1140
|
+
escrows: number;
|
|
1141
|
+
otherObjects: number;
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
interface TrustLineInfo {
|
|
1145
|
+
currency: string;
|
|
1146
|
+
issuer: string;
|
|
1147
|
+
balance: string;
|
|
1148
|
+
limit: string;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
interface CreateWalletInput {
|
|
1152
|
+
chain: EChainType;
|
|
1153
|
+
}
|
|
1154
|
+
interface CreateWalletOutput {
|
|
1155
|
+
wallets: TWallet[];
|
|
1156
|
+
}
|
|
1157
|
+
interface ImportWalletInput {
|
|
1158
|
+
chain: EChainType;
|
|
1159
|
+
privateKey: string;
|
|
1160
|
+
}
|
|
1161
|
+
interface DeleteWalletInput {
|
|
1162
|
+
chain: EChainType;
|
|
1163
|
+
address: string;
|
|
1164
|
+
}
|
|
1165
|
+
interface GetWalletInput {
|
|
1166
|
+
address: string;
|
|
1167
|
+
}
|
|
1168
|
+
interface GetWalletsInput {
|
|
1169
|
+
chain?: EChainType;
|
|
1170
|
+
chainTypes?: EChainType[];
|
|
1171
|
+
page?: number;
|
|
1172
|
+
limit?: number;
|
|
1173
|
+
}
|
|
1174
|
+
interface GetPortfolioInput {
|
|
1175
|
+
chain: EChainType;
|
|
1176
|
+
address: string;
|
|
1177
|
+
chainId: ChainIdValue;
|
|
1178
|
+
}
|
|
1179
|
+
interface SendTransactionInput {
|
|
1180
|
+
chain: EChainType;
|
|
1181
|
+
from: string;
|
|
1182
|
+
to: string;
|
|
1183
|
+
amount: string;
|
|
1184
|
+
symbol?: string;
|
|
1185
|
+
chainId?: number;
|
|
1186
|
+
feeHint?: EstimatedFee;
|
|
1187
|
+
tokenAddress: string;
|
|
1188
|
+
decimals: number;
|
|
1189
|
+
isNativeToken?: boolean;
|
|
1190
|
+
memo?: string;
|
|
1191
|
+
}
|
|
1192
|
+
interface SendTransactionOutput {
|
|
1193
|
+
txHash: string;
|
|
1194
|
+
}
|
|
1195
|
+
/** Input for exportWallet */
|
|
1196
|
+
interface ExportWalletInput {
|
|
1197
|
+
chain: EChainType;
|
|
1198
|
+
address: string;
|
|
1199
|
+
format?: "hex" | "wif" | "bs58";
|
|
1200
|
+
}
|
|
1201
|
+
/** Output for exportWallet */
|
|
1202
|
+
interface ExportWalletOutput {
|
|
1203
|
+
privateKey: string;
|
|
1204
|
+
}
|
|
1205
|
+
/** Input for updateWalletName */
|
|
1206
|
+
interface UpdateWalletNameInput {
|
|
1207
|
+
chain: EChainType;
|
|
1208
|
+
address: string;
|
|
1209
|
+
name: string;
|
|
1210
|
+
}
|
|
1211
|
+
/** Input for createMultisig */
|
|
1212
|
+
interface CreateMultisigInput {
|
|
1213
|
+
chain: EChainType;
|
|
1214
|
+
owners: string[];
|
|
1215
|
+
threshold: number;
|
|
1216
|
+
chainIds?: ChainIdValue[];
|
|
1217
|
+
}
|
|
1218
|
+
/** Input for getMultisigs */
|
|
1219
|
+
interface GetMultisigsInput {
|
|
1220
|
+
chain: EChainType;
|
|
1221
|
+
walletAddress?: string;
|
|
1222
|
+
}
|
|
1223
|
+
/** Input for getMultisigById */
|
|
1224
|
+
interface GetMultisigByIdInput {
|
|
1225
|
+
chain: EChainType;
|
|
1226
|
+
address: string;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/** Output for activateMultisig */
|
|
1230
|
+
interface ActivateMultisigOutput {
|
|
1231
|
+
txHash: string;
|
|
1232
|
+
}
|
|
1233
|
+
/** Input for estimateActivationFee */
|
|
1234
|
+
interface EstimateActivationFeeInput {
|
|
1235
|
+
chain: EChainType;
|
|
1236
|
+
multisigId?: string;
|
|
1237
|
+
owners?: string[];
|
|
1238
|
+
threshold?: number;
|
|
1239
|
+
chainId?: ChainIdValue;
|
|
1240
|
+
}
|
|
1241
|
+
/** Input for updateMultisigName */
|
|
1242
|
+
interface UpdateMultisigNameInput {
|
|
1243
|
+
chain: EChainType;
|
|
1244
|
+
multisigId: string;
|
|
1245
|
+
name: string;
|
|
1246
|
+
walletAddress: string;
|
|
1247
|
+
}
|
|
1248
|
+
/** Input for deleteMultisig */
|
|
1249
|
+
interface DeleteMultisigInput {
|
|
1250
|
+
chain: EChainType;
|
|
1251
|
+
multisigId: string;
|
|
1252
|
+
}
|
|
1253
|
+
/** Input for createOrder */
|
|
1254
|
+
interface CreateOrderInput {
|
|
1255
|
+
chain: EChainType;
|
|
1256
|
+
multisigId: string;
|
|
1257
|
+
walletAddress: string;
|
|
1258
|
+
method: OrderMethodType;
|
|
1259
|
+
instructions: OrderInstruction[];
|
|
1260
|
+
threshold?: number;
|
|
1261
|
+
token?: TokenInfo;
|
|
1262
|
+
orderIdToActivate?: string;
|
|
1263
|
+
}
|
|
1264
|
+
/** Output for createOrder */
|
|
1265
|
+
interface CreateOrderOutput {
|
|
1266
|
+
order: Order;
|
|
1267
|
+
proposalHash?: string;
|
|
1268
|
+
}
|
|
1269
|
+
/** Input for signOrder */
|
|
1270
|
+
interface SignOrderInput {
|
|
1271
|
+
chain: EChainType;
|
|
1272
|
+
order: Order;
|
|
1273
|
+
walletAddress: string;
|
|
1274
|
+
multisigId?: string;
|
|
1275
|
+
}
|
|
1276
|
+
/** Output for signOrder */
|
|
1277
|
+
interface SignOrderOutput {
|
|
1278
|
+
signature: string;
|
|
1279
|
+
order: Order;
|
|
1280
|
+
}
|
|
1281
|
+
/** Input for rejectOrder */
|
|
1282
|
+
interface RejectOrderInput {
|
|
1283
|
+
chain: EChainType;
|
|
1284
|
+
order: Order;
|
|
1285
|
+
multisig: MultisigsItem;
|
|
1286
|
+
walletAddress: string;
|
|
1287
|
+
}
|
|
1288
|
+
/** Input for executeOrder */
|
|
1289
|
+
interface ExecuteOrderInput {
|
|
1290
|
+
chain: EChainType;
|
|
1291
|
+
order: Order;
|
|
1292
|
+
multisig: MultisigsItem;
|
|
1293
|
+
walletAddress: string;
|
|
1294
|
+
feeQuote?: EstimatedFee;
|
|
1295
|
+
}
|
|
1296
|
+
/** Output for executeOrder */
|
|
1297
|
+
interface ExecuteOrderOutput {
|
|
1298
|
+
txHash: string;
|
|
1299
|
+
order: Order;
|
|
1300
|
+
}
|
|
1301
|
+
/** Input for estimateOrderExecutionFee */
|
|
1302
|
+
interface EstimateOrderExecutionFeeInput {
|
|
1303
|
+
chain: EChainType;
|
|
1304
|
+
orderId: string;
|
|
1305
|
+
walletAddress: string;
|
|
1306
|
+
chainId?: ChainIdValue;
|
|
1307
|
+
}
|
|
1308
|
+
/** Input for getOrders */
|
|
1309
|
+
interface GetOrdersInput {
|
|
1310
|
+
chain: EChainType;
|
|
1311
|
+
multisigId: string;
|
|
1312
|
+
page?: number;
|
|
1313
|
+
limit?: number;
|
|
1314
|
+
}
|
|
1315
|
+
/** Input for getOrderById */
|
|
1316
|
+
interface GetOrderByIdInput {
|
|
1317
|
+
chain: EChainType;
|
|
1318
|
+
orderId: string;
|
|
1319
|
+
}
|
|
1320
|
+
/** Input for deleteOrder */
|
|
1321
|
+
interface DeleteOrderInput {
|
|
1322
|
+
chain: EChainType;
|
|
1323
|
+
orderId: string;
|
|
1324
|
+
}
|
|
1325
|
+
/** Input for getSupportedTokens */
|
|
1326
|
+
interface GetSupportedTokensInput {
|
|
1327
|
+
chain: EChainType;
|
|
1328
|
+
chainId: ChainIdValue;
|
|
1329
|
+
page?: number;
|
|
1330
|
+
limit?: number;
|
|
1331
|
+
search?: string;
|
|
1332
|
+
}
|
|
1333
|
+
/** Input for getWalletHistory */
|
|
1334
|
+
interface GetWalletHistoryInput {
|
|
1335
|
+
chain: EChainType;
|
|
1336
|
+
walletAddress: string;
|
|
1337
|
+
page?: number;
|
|
1338
|
+
limit?: number;
|
|
1339
|
+
}
|
|
1340
|
+
/** Input for getMultisigTxHistory */
|
|
1341
|
+
interface GetMultisigTxHistoryInput {
|
|
1342
|
+
multisigId: string;
|
|
1343
|
+
page?: number;
|
|
1344
|
+
limit?: number;
|
|
1345
|
+
}
|
|
1346
|
+
/** Input for getXrpAccountReserve */
|
|
1347
|
+
interface GetXrpAccountReserveInput {
|
|
1348
|
+
address: string;
|
|
1349
|
+
}
|
|
1350
|
+
/** Input for getXrpTrustLines */
|
|
1351
|
+
interface GetXrpTrustLinesInput {
|
|
1352
|
+
address: string;
|
|
1353
|
+
}
|
|
1354
|
+
/** Input for activateXrpTrustLine */
|
|
1355
|
+
interface ActivateXrpTrustLineInput {
|
|
1356
|
+
/** XRP wallet address that will open the trust line */
|
|
1357
|
+
address: string;
|
|
1358
|
+
/** Currency code, e.g. "USD" or 40-char hex */
|
|
1359
|
+
currency: string;
|
|
1360
|
+
/** Issuer address, e.g. "rIssuer..." */
|
|
1361
|
+
issuer: string;
|
|
1362
|
+
/** Max token amount to hold (default: "1000000000") */
|
|
1363
|
+
limit?: string;
|
|
1364
|
+
}
|
|
1365
|
+
/** Output for activateXrpTrustLine */
|
|
1366
|
+
interface ActivateXrpTrustLineOutput {
|
|
1367
|
+
/** Transaction hash */
|
|
1368
|
+
hash: string;
|
|
1369
|
+
/** Signed tx blob (hex) */
|
|
1370
|
+
tx: string;
|
|
1371
|
+
/** Engine result, e.g. "tesSUCCESS" */
|
|
1372
|
+
result: string;
|
|
1373
|
+
}
|
|
1374
|
+
interface CreateAddressBookEntryInput {
|
|
1375
|
+
name: string;
|
|
1376
|
+
address: string;
|
|
1377
|
+
chainType: EChainType;
|
|
1378
|
+
type: AddressBookEntryType;
|
|
1379
|
+
memo?: string;
|
|
1380
|
+
}
|
|
1381
|
+
interface GetAddressBookEntriesInput {
|
|
1382
|
+
chainType?: EChainType;
|
|
1383
|
+
type?: AddressBookEntryType;
|
|
1384
|
+
}
|
|
1385
|
+
interface UpdateAddressBookEntryInput {
|
|
1386
|
+
id: string;
|
|
1387
|
+
name?: string;
|
|
1388
|
+
memo?: string | null;
|
|
1389
|
+
}
|
|
1390
|
+
interface DeleteAddressBookEntryInput {
|
|
1391
|
+
id: string;
|
|
1392
|
+
}
|
|
1393
|
+
interface GetAddressTypeInput {
|
|
1394
|
+
chainType: EChainType;
|
|
1395
|
+
address: string;
|
|
1396
|
+
}
|
|
1397
|
+
interface UpdateOrgAddressBookEntryInput extends UpdateOrgAddressInput {
|
|
1398
|
+
/** UUID of the org address-book entry to update. */
|
|
1399
|
+
addressId: string;
|
|
1400
|
+
}
|
|
1401
|
+
interface DeleteOrgAddressBookEntryInput {
|
|
1402
|
+
/** UUID of the org address-book entry to remove. */
|
|
1403
|
+
addressId: string;
|
|
1404
|
+
}
|
|
1405
|
+
declare class AfridaxSDK {
|
|
1406
|
+
private readonly resolvedConfig;
|
|
1407
|
+
private readonly rpcConfig;
|
|
1408
|
+
private readonly client;
|
|
1409
|
+
private readonly walletService;
|
|
1410
|
+
private readonly multisigApi;
|
|
1411
|
+
private readonly orderApi;
|
|
1412
|
+
private readonly blockchainAdapter;
|
|
1413
|
+
private readonly keyManager;
|
|
1414
|
+
private readonly txService;
|
|
1415
|
+
private readonly addressBookApi;
|
|
1416
|
+
private readonly organizationApi;
|
|
1417
|
+
constructor(config: SDKConfig);
|
|
1418
|
+
/**
|
|
1419
|
+
* 1.1 Create a new MPC wallet with Shamir secret sharing
|
|
1420
|
+
*/
|
|
1421
|
+
createWallet(input: CreateWalletInput): Promise<CreateWalletOutput>;
|
|
1422
|
+
/**
|
|
1423
|
+
* 1.2 Import an existing wallet via private key
|
|
1424
|
+
*/
|
|
1425
|
+
importWallet(input: ImportWalletInput): Promise<CreateWalletResponse>;
|
|
1426
|
+
/**
|
|
1427
|
+
* 1.3 Remove wallet from account
|
|
1428
|
+
*/
|
|
1429
|
+
deleteWallet(input: DeleteWalletInput): Promise<DeleteResponse>;
|
|
1430
|
+
/**
|
|
1431
|
+
* 1.4 Fetch single wallet details
|
|
1432
|
+
*/
|
|
1433
|
+
getWallet(input: GetWalletInput): Promise<TWallet>;
|
|
1434
|
+
/**
|
|
1435
|
+
* 1.5 List all wallets for user (with optional pagination)
|
|
1436
|
+
*/
|
|
1437
|
+
getWallets(input?: GetWalletsInput): Promise<PaginatedWalletsResponse>;
|
|
1438
|
+
/**
|
|
1439
|
+
* 1.6 Get wallet token balances and portfolio (batch request)
|
|
1440
|
+
* User constructs the PortfolioRequest array themselves
|
|
1441
|
+
*/
|
|
1442
|
+
getWalletsPortfolio(requests: PortfolioRequest[]): Promise<WalletPortfolioResponse[]>;
|
|
1443
|
+
/**
|
|
1444
|
+
* 1.7 Get wallet portfolio for a single wallet (convenience method)
|
|
1445
|
+
*/
|
|
1446
|
+
getPortfolio(input: GetPortfolioInput): Promise<WalletPortfolioResponse>;
|
|
1447
|
+
/**
|
|
1448
|
+
* 1.7 Send native currency (ETH/SOL/TRX/BTC)
|
|
1449
|
+
*/
|
|
1450
|
+
sendTransaction(input: SendTransactionInput): Promise<SendTransactionOutput>;
|
|
1451
|
+
/**
|
|
1452
|
+
* 1.9 Estimate transaction fee for any operation
|
|
1453
|
+
*/
|
|
1454
|
+
estimateFee(input: EstimateFeeInput): Promise<EstimatedFee>;
|
|
1455
|
+
private getChainIdForEstimation;
|
|
1456
|
+
exportWallet(input: ExportWalletInput): Promise<ExportWalletOutput>;
|
|
1457
|
+
/**
|
|
1458
|
+
* 1.11 Rename a wallet
|
|
1459
|
+
*/
|
|
1460
|
+
updateWalletName(input: UpdateWalletNameInput): Promise<WalletRenameResponse>;
|
|
1461
|
+
/**
|
|
1462
|
+
* 2.1 Create a new multisig vault
|
|
1463
|
+
*/
|
|
1464
|
+
createMultisig(input: CreateMultisigInput): Promise<MultisigsItem | MultisigsItem[]>;
|
|
1465
|
+
/**
|
|
1466
|
+
* 2.2 List all multisigs for user
|
|
1467
|
+
*/
|
|
1468
|
+
getMultisigs(input: GetMultisigsInput): Promise<MultisigBaseDTO[]>;
|
|
1469
|
+
/**
|
|
1470
|
+
* 2.2b Paginated vault list (GET /sdk/multisig) with optional chain filters.
|
|
1471
|
+
*/
|
|
1472
|
+
getPaginatedMultisigs(input?: GetPaginatedMultisigsInput): Promise<PaginatedMultisigsWithTokensResponse>;
|
|
1473
|
+
/**
|
|
1474
|
+
* 2.3 Get single multisig details
|
|
1475
|
+
*/
|
|
1476
|
+
getMultisigById(input: GetMultisigByIdInput): Promise<MultisigBaseDTO>;
|
|
1477
|
+
/**
|
|
1478
|
+
* 2.4 Deploy/activate multisig on-chain
|
|
1479
|
+
*/
|
|
1480
|
+
activateMultisig(input: ActivateMultisigInput): Promise<ActivateMultisigOutput>;
|
|
1481
|
+
/**
|
|
1482
|
+
* 2.5 Estimate gas/fee for multisig activation
|
|
1483
|
+
* Note: Returns a placeholder fee. Use chain-specific methods for accurate estimates.
|
|
1484
|
+
*/
|
|
1485
|
+
estimateActivationFee(input: EstimateActivationFeeInput): Promise<EstimatedFee>;
|
|
1486
|
+
/**
|
|
1487
|
+
* 2.6 Rename multisig vault
|
|
1488
|
+
*/
|
|
1489
|
+
updateMultisigName(input: UpdateMultisigNameInput): Promise<MultisigBaseDTO>;
|
|
1490
|
+
/**
|
|
1491
|
+
* 2.7 Remove multisig from account
|
|
1492
|
+
*/
|
|
1493
|
+
deleteMultisig(input: DeleteMultisigInput): Promise<DeleteResponse>;
|
|
1494
|
+
/**
|
|
1495
|
+
* 2.8 Create a new transaction proposal
|
|
1496
|
+
*/
|
|
1497
|
+
createOrder(input: CreateOrderInput): Promise<CreateOrderOutput>;
|
|
1498
|
+
/**
|
|
1499
|
+
* 2.8a Create a send order (token transfer) - Simplified API
|
|
1500
|
+
* Automatically detects method and builds instructions
|
|
1501
|
+
*/
|
|
1502
|
+
createSendOrder(input: {
|
|
1503
|
+
multisigId: string;
|
|
1504
|
+
walletAddress: string;
|
|
1505
|
+
to: string;
|
|
1506
|
+
amount: string;
|
|
1507
|
+
token?: TokenInfo;
|
|
1508
|
+
chainId: string;
|
|
1509
|
+
memo?: string;
|
|
1510
|
+
}): Promise<CreateOrderOutput>;
|
|
1511
|
+
/**
|
|
1512
|
+
* 2.8b Create a settings order (multisig configuration change) - Simplified API
|
|
1513
|
+
* Automatically calculates changes and determines method
|
|
1514
|
+
*/
|
|
1515
|
+
createSettingsOrder(input: {
|
|
1516
|
+
multisigId: string;
|
|
1517
|
+
multisig: MultisigsItem;
|
|
1518
|
+
walletAddress: string;
|
|
1519
|
+
newOwners: string[];
|
|
1520
|
+
newThreshold?: number;
|
|
1521
|
+
}): Promise<CreateOrderOutput>;
|
|
1522
|
+
/**
|
|
1523
|
+
* 2.9 Sign/approve a pending order
|
|
1524
|
+
* Uses blockchainAdapter to properly reconstruct key and sign order hash
|
|
1525
|
+
*/
|
|
1526
|
+
signOrder(input: SignOrderInput): Promise<SignOrderOutput>;
|
|
1527
|
+
private getChainIdForSignOrder;
|
|
1528
|
+
/**
|
|
1529
|
+
* 2.10 Reject a pending order
|
|
1530
|
+
*/
|
|
1531
|
+
rejectOrder(input: RejectOrderInput): Promise<Order>;
|
|
1532
|
+
/**
|
|
1533
|
+
* 2.11 Execute a fully-signed order
|
|
1534
|
+
*/
|
|
1535
|
+
executeOrder(input: ExecuteOrderInput): Promise<ExecuteOrderOutput>;
|
|
1536
|
+
/**
|
|
1537
|
+
* 2.12 Estimate fee for executing order
|
|
1538
|
+
* Note: Returns a placeholder fee. Use chain-specific methods for accurate estimates.
|
|
1539
|
+
*/
|
|
1540
|
+
estimateOrderExecutionFee(input: EstimateOrderExecutionFeeInput): Promise<EstimatedFee>;
|
|
1541
|
+
/**
|
|
1542
|
+
* 2.13 List orders for a multisig
|
|
1543
|
+
*/
|
|
1544
|
+
getOrders(input: GetOrdersInput): Promise<PaginatedOrdersResponse>;
|
|
1545
|
+
/**
|
|
1546
|
+
* 2.14 Get single order details
|
|
1547
|
+
*/
|
|
1548
|
+
getOrderById(input: GetOrderByIdInput): Promise<{
|
|
1549
|
+
order: Order;
|
|
1550
|
+
}>;
|
|
1551
|
+
/**
|
|
1552
|
+
* 2.15 Delete a pending order
|
|
1553
|
+
*/
|
|
1554
|
+
deleteOrder(input: DeleteOrderInput): Promise<DeleteResponse>;
|
|
1555
|
+
/**
|
|
1556
|
+
* 3.1 List supported tokens for a chain
|
|
1557
|
+
*/
|
|
1558
|
+
getSupportedTokens(input: GetSupportedTokensInput): Promise<SupportedTokensResponse>;
|
|
1559
|
+
/**
|
|
1560
|
+
* 3.2 Get aggregate portfolio value across all wallets
|
|
1561
|
+
*/
|
|
1562
|
+
getTotalAssetValue(): Promise<TotalAssetValueResponse>;
|
|
1563
|
+
/**
|
|
1564
|
+
* 4.1 Get transaction history for a wallet
|
|
1565
|
+
*/
|
|
1566
|
+
getWalletHistory(input: GetWalletHistoryInput): Promise<HistoryResponse>;
|
|
1567
|
+
/**
|
|
1568
|
+
* 4.2 Get order/execution history for a multisig
|
|
1569
|
+
*/
|
|
1570
|
+
getMultisigTxHistory(input: GetMultisigTxHistoryInput): Promise<TxHistoryCombinedResponse>;
|
|
1571
|
+
/**
|
|
1572
|
+
* 5.1 Activate (open) a trust line for an IOU token on a personal XRP wallet.
|
|
1573
|
+
* Builds and broadcasts a TrustSet transaction. Requires ~0.2 XRP available
|
|
1574
|
+
* for the new reserve object.
|
|
1575
|
+
*/
|
|
1576
|
+
activateXrpTrustLine(input: ActivateXrpTrustLineInput): Promise<ActivateXrpTrustLineOutput>;
|
|
1577
|
+
/**
|
|
1578
|
+
* 5.2 Get XRP account reserve breakdown
|
|
1579
|
+
*/
|
|
1580
|
+
getXrpAccountReserve(input: GetXrpAccountReserveInput): Promise<XrpAccountReserveInfo>;
|
|
1581
|
+
/**
|
|
1582
|
+
* 5.2 Get trust lines for an XRP address
|
|
1583
|
+
*/
|
|
1584
|
+
getXrpTrustLines(input: GetXrpTrustLinesInput): Promise<TrustLineInfo[]>;
|
|
1585
|
+
/**
|
|
1586
|
+
* 6.1 Create an address book entry
|
|
1587
|
+
*/
|
|
1588
|
+
createAddressBookEntry(input: CreateAddressBookEntryInput): Promise<AddressBookEntry>;
|
|
1589
|
+
/**
|
|
1590
|
+
* 6.2 List address book entries
|
|
1591
|
+
*/
|
|
1592
|
+
getAddressBookEntries(input?: GetAddressBookEntriesInput): Promise<AddressBookEntry[]>;
|
|
1593
|
+
/**
|
|
1594
|
+
* 6.3 Update an address book entry
|
|
1595
|
+
*/
|
|
1596
|
+
updateAddressBookEntry(input: UpdateAddressBookEntryInput): Promise<AddressBookEntry>;
|
|
1597
|
+
/**
|
|
1598
|
+
* 6.4 Delete an address book entry
|
|
1599
|
+
*/
|
|
1600
|
+
deleteAddressBookEntry(input: DeleteAddressBookEntryInput): Promise<void>;
|
|
1601
|
+
/**
|
|
1602
|
+
* 6.5 Get address type (CEX or Wallet)
|
|
1603
|
+
*/
|
|
1604
|
+
getAddressType(input: GetAddressTypeInput): Promise<AddressTypeResponse>;
|
|
1605
|
+
/**
|
|
1606
|
+
* 7.1 List members of the calling user's organization. Master-only.
|
|
1607
|
+
*
|
|
1608
|
+
* Server route: `GET /sdk/organization/team`.
|
|
1609
|
+
*/
|
|
1610
|
+
getOrgTeam(): Promise<OrgTeamDirectoryResponse>;
|
|
1611
|
+
/**
|
|
1612
|
+
* 7.2 Invite a new member by email. Master-only.
|
|
1613
|
+
*
|
|
1614
|
+
* Server route: `POST /sdk/organization/team/invite`.
|
|
1615
|
+
*
|
|
1616
|
+
* Server enforces the 10-user org limit and the global
|
|
1617
|
+
* 1-organization-per-email rule; both surface as `ApiError(409)`.
|
|
1618
|
+
*/
|
|
1619
|
+
inviteOrgMember(input: InviteOrgMemberInput): Promise<InviteOrgMemberResponse>;
|
|
1620
|
+
/**
|
|
1621
|
+
* 7.3 Remove a member from the org. Master-only.
|
|
1622
|
+
*
|
|
1623
|
+
* Server route: `DELETE /sdk/organization/team/{memberId}`. Cascades
|
|
1624
|
+
* cleanup of wallet assignments, MPC shares, multisig signatures, and
|
|
1625
|
+
* sessions. Resolves with `void` on success (HTTP 204).
|
|
1626
|
+
*/
|
|
1627
|
+
removeOrgMember(input: RemoveOrgMemberInput): Promise<void>;
|
|
1628
|
+
/**
|
|
1629
|
+
* 7.4 List wallets/vaults currently assigned to a specific member.
|
|
1630
|
+
* Master-only.
|
|
1631
|
+
*
|
|
1632
|
+
* Server route: `GET /sdk/organization/team/{memberId}/wallets`.
|
|
1633
|
+
*/
|
|
1634
|
+
listOrgMemberWallets(input: ListOrgMemberWalletsInput): Promise<OrgWalletsResponse>;
|
|
1635
|
+
/**
|
|
1636
|
+
* 7.5 Grant a member access to a wallet or vault. Master-only.
|
|
1637
|
+
*
|
|
1638
|
+
* Server route: `POST /sdk/organization/team/{memberId}/wallets`.
|
|
1639
|
+
* Returns 409 on duplicate assignment.
|
|
1640
|
+
*/
|
|
1641
|
+
assignOrgWallet(input: AssignOrgWalletInput): Promise<AssignOrgWalletResponse>;
|
|
1642
|
+
/**
|
|
1643
|
+
* 7.6 Revoke a member's access to a wallet or vault. Master-only.
|
|
1644
|
+
*
|
|
1645
|
+
* Server route: `DELETE /sdk/organization/team/{memberId}/wallets/{walletId}`.
|
|
1646
|
+
* Triggers MPC share cleanup server-side.
|
|
1647
|
+
*/
|
|
1648
|
+
unassignOrgWallet(input: UnassignOrgWalletInput): Promise<void>;
|
|
1649
|
+
/**
|
|
1650
|
+
* 7.7 List all wallets/vaults owned by the organization (available for
|
|
1651
|
+
* assignment to members). Master-only.
|
|
1652
|
+
*
|
|
1653
|
+
* Server route: `GET /sdk/organization/wallets`.
|
|
1654
|
+
*/
|
|
1655
|
+
listOrgWallets(): Promise<OrgWalletsResponse>;
|
|
1656
|
+
/**
|
|
1657
|
+
* 7.8 Read the org's current security policy. Master-only.
|
|
1658
|
+
*
|
|
1659
|
+
* Server route: `GET /sdk/organization/policies`.
|
|
1660
|
+
*/
|
|
1661
|
+
getOrgPolicies(): Promise<OrgPolicy>;
|
|
1662
|
+
/**
|
|
1663
|
+
* 7.9 Update the org's security policy (partial). Master-only.
|
|
1664
|
+
*
|
|
1665
|
+
* Server route: `PATCH /sdk/organization/policies`. Server enforces
|
|
1666
|
+
* conditional validation (business-hours triplet, positive spending
|
|
1667
|
+
* limit). Returns the full, fresh policy object.
|
|
1668
|
+
*/
|
|
1669
|
+
updateOrgPolicies(input: UpdateOrgPolicyInput): Promise<OrgPolicy>;
|
|
1670
|
+
/**
|
|
1671
|
+
* 7.10 List Corporate Address Book entries (verified and pending).
|
|
1672
|
+
*
|
|
1673
|
+
* Server route: `GET /sdk/organization/address-book`. Accessible to all
|
|
1674
|
+
* org members. Only entries with `isVerified === true` count toward the
|
|
1675
|
+
* `forceAddressBook` transfer whitelist policy.
|
|
1676
|
+
*/
|
|
1677
|
+
listOrgAddresses(): Promise<OrgAddressBookEntry[]>;
|
|
1678
|
+
/**
|
|
1679
|
+
* 7.11 Add an entry to the Corporate Address Book. Master-only.
|
|
1680
|
+
*
|
|
1681
|
+
* Server route: `POST /sdk/organization/address-book`. API-key flows
|
|
1682
|
+
* auto-verify the entry (no OTP). Travel Rule conditional fields are
|
|
1683
|
+
* validated server-side based on `recipientType` / `walletType`.
|
|
1684
|
+
*/
|
|
1685
|
+
addOrgAddress(input: CreateOrgAddressInput): Promise<AddOrgAddressResponse>;
|
|
1686
|
+
/**
|
|
1687
|
+
* 7.12 Update label / memo / type / Travel Rule metadata of an org
|
|
1688
|
+
* address-book entry. Master-only.
|
|
1689
|
+
*
|
|
1690
|
+
* Server route: `PATCH /sdk/organization/address-book/{addressId}`.
|
|
1691
|
+
* `address` and `chainType` are immutable.
|
|
1692
|
+
*/
|
|
1693
|
+
updateOrgAddress(input: UpdateOrgAddressBookEntryInput): Promise<OrgAddressBookEntry>;
|
|
1694
|
+
/**
|
|
1695
|
+
* 7.13 Remove an entry from the Corporate Address Book. Master-only.
|
|
1696
|
+
*
|
|
1697
|
+
* Server route: `DELETE /sdk/organization/address-book/{addressId}`.
|
|
1698
|
+
*/
|
|
1699
|
+
deleteOrgAddress(input: DeleteOrgAddressBookEntryInput): Promise<void>;
|
|
1700
|
+
/**
|
|
1701
|
+
* 7.14 Read the org audit trail. Master-only.
|
|
1702
|
+
*
|
|
1703
|
+
* Server route: `GET /sdk/organization/audit-logs`. Supports pagination,
|
|
1704
|
+
* date range, `actorId`, and a multi-select `eventTypes` filter.
|
|
1705
|
+
* `eventTypes` is serialized as repeated query keys
|
|
1706
|
+
* (`?eventTypes=Login&eventTypes=Wallet+Created`). Verify the exact
|
|
1707
|
+
* server-accepted shape against staging before relying on this filter in
|
|
1708
|
+
* production (see `docs/api-contract-clarifications.md`).
|
|
1709
|
+
*/
|
|
1710
|
+
getOrgAuditLogs(input?: GetOrgAuditLogsInput): Promise<OrgAuditLogsResponse>;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
declare const MEMO_MAX_LENGTH = 200;
|
|
1714
|
+
declare const XRP_MAX_DESTINATION_TAG = 4294967295;
|
|
1715
|
+
declare const MEMO_SUPPORTED_CHAINS: readonly [EChainType.XRP, EChainType.SOL, EChainType.TRON];
|
|
1716
|
+
interface MemoValidationResult {
|
|
1717
|
+
isValid: boolean;
|
|
1718
|
+
error?: string;
|
|
1719
|
+
}
|
|
1720
|
+
declare function isMemoSupported(chainType: EChainType): boolean;
|
|
1721
|
+
declare function validateMemo(memo: string, chainType: EChainType): MemoValidationResult;
|
|
1722
|
+
declare function getMemoPlaceholder(chainType: EChainType): string;
|
|
1723
|
+
|
|
1724
|
+
declare abstract class AfridaxBaseError extends Error implements SDKError {
|
|
1725
|
+
readonly code: SDKErrorCode;
|
|
1726
|
+
readonly chain?: ChainType;
|
|
1727
|
+
readonly operation?: string;
|
|
1728
|
+
readonly details?: Record<string, unknown>;
|
|
1729
|
+
readonly cause?: Error;
|
|
1730
|
+
constructor(code: SDKErrorCode, message: string, options?: {
|
|
1731
|
+
chain?: ChainType;
|
|
1732
|
+
operation?: string;
|
|
1733
|
+
details?: Record<string, unknown>;
|
|
1734
|
+
cause?: Error;
|
|
1735
|
+
});
|
|
1736
|
+
/**
|
|
1737
|
+
* Converts the error to a plain SDKError object for serialization
|
|
1738
|
+
*/
|
|
1739
|
+
toJSON(): SDKError;
|
|
1740
|
+
/**
|
|
1741
|
+
* Returns a formatted string representation of the error
|
|
1742
|
+
*/
|
|
1743
|
+
toString(): string;
|
|
1744
|
+
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Error thrown when an API request fails.
|
|
1747
|
+
* Includes HTTP status code and response details.
|
|
1748
|
+
*/
|
|
1749
|
+
declare class ApiError extends AfridaxBaseError {
|
|
1750
|
+
readonly statusCode?: number;
|
|
1751
|
+
readonly responseBody?: unknown;
|
|
1752
|
+
constructor(message: string, options?: {
|
|
1753
|
+
statusCode?: number;
|
|
1754
|
+
responseBody?: unknown;
|
|
1755
|
+
chain?: ChainType;
|
|
1756
|
+
operation?: string;
|
|
1757
|
+
details?: Record<string, unknown>;
|
|
1758
|
+
cause?: Error;
|
|
1759
|
+
});
|
|
1760
|
+
toJSON(): SDKError & {
|
|
1761
|
+
statusCode?: number;
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Error thrown when reconstructed private key does not match expected address.
|
|
1766
|
+
* Indicates device share may be stale and requires force update.
|
|
1767
|
+
*/
|
|
1768
|
+
declare class KeyMismatchError extends AfridaxBaseError {
|
|
1769
|
+
readonly expectedAddress: string;
|
|
1770
|
+
readonly derivedAddress?: string;
|
|
1771
|
+
constructor(message: string, options: {
|
|
1772
|
+
expectedAddress: string;
|
|
1773
|
+
derivedAddress?: string;
|
|
1774
|
+
chain?: ChainType;
|
|
1775
|
+
operation?: string;
|
|
1776
|
+
details?: Record<string, unknown>;
|
|
1777
|
+
cause?: Error;
|
|
1778
|
+
});
|
|
1779
|
+
toJSON(): SDKError & {
|
|
1780
|
+
expectedAddress: string;
|
|
1781
|
+
derivedAddress?: string;
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Error thrown when wallet has insufficient balance for a transaction.
|
|
1786
|
+
* Includes required and available amounts.
|
|
1787
|
+
*/
|
|
1788
|
+
declare class InsufficientBalanceError extends AfridaxBaseError {
|
|
1789
|
+
readonly requiredAmount: string;
|
|
1790
|
+
readonly availableAmount: string;
|
|
1791
|
+
readonly currency: string;
|
|
1792
|
+
constructor(message: string, options: {
|
|
1793
|
+
requiredAmount: string;
|
|
1794
|
+
availableAmount: string;
|
|
1795
|
+
currency: string;
|
|
1796
|
+
chain?: ChainType;
|
|
1797
|
+
operation?: string;
|
|
1798
|
+
details?: Record<string, unknown>;
|
|
1799
|
+
cause?: Error;
|
|
1800
|
+
});
|
|
1801
|
+
toJSON(): SDKError & {
|
|
1802
|
+
requiredAmount: string;
|
|
1803
|
+
availableAmount: string;
|
|
1804
|
+
currency: string;
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Error thrown when an operation is attempted on an unsupported chain.
|
|
1809
|
+
*/
|
|
1810
|
+
declare class ChainNotSupportedError extends AfridaxBaseError {
|
|
1811
|
+
readonly requestedChain: string;
|
|
1812
|
+
readonly supportedChains: string[];
|
|
1813
|
+
constructor(message: string, options: {
|
|
1814
|
+
requestedChain: string;
|
|
1815
|
+
supportedChains: string[];
|
|
1816
|
+
operation?: string;
|
|
1817
|
+
details?: Record<string, unknown>;
|
|
1818
|
+
cause?: Error;
|
|
1819
|
+
});
|
|
1820
|
+
toJSON(): SDKError & {
|
|
1821
|
+
requestedChain: string;
|
|
1822
|
+
supportedChains: string[];
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Error thrown when a network request fails (connection issues, timeouts, etc.).
|
|
1827
|
+
*/
|
|
1828
|
+
declare class NetworkError extends AfridaxBaseError {
|
|
1829
|
+
readonly endpoint?: string;
|
|
1830
|
+
readonly isTimeout: boolean;
|
|
1831
|
+
constructor(message: string, options?: {
|
|
1832
|
+
endpoint?: string;
|
|
1833
|
+
isTimeout?: boolean;
|
|
1834
|
+
chain?: ChainType;
|
|
1835
|
+
operation?: string;
|
|
1836
|
+
details?: Record<string, unknown>;
|
|
1837
|
+
cause?: Error;
|
|
1838
|
+
});
|
|
1839
|
+
toJSON(): SDKError & {
|
|
1840
|
+
endpoint?: string;
|
|
1841
|
+
isTimeout: boolean;
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Error thrown when input validation fails.
|
|
1846
|
+
*/
|
|
1847
|
+
declare class InvalidInputError extends AfridaxBaseError {
|
|
1848
|
+
readonly field?: string;
|
|
1849
|
+
readonly value?: unknown;
|
|
1850
|
+
constructor(message: string, options?: {
|
|
1851
|
+
field?: string;
|
|
1852
|
+
value?: unknown;
|
|
1853
|
+
chain?: ChainType;
|
|
1854
|
+
operation?: string;
|
|
1855
|
+
details?: Record<string, unknown>;
|
|
1856
|
+
cause?: Error;
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Error thrown when authorization fails (invalid API key, expired token, etc.).
|
|
1861
|
+
*/
|
|
1862
|
+
declare class UnauthorizedError extends AfridaxBaseError {
|
|
1863
|
+
constructor(message: string, options?: {
|
|
1864
|
+
operation?: string;
|
|
1865
|
+
details?: Record<string, unknown>;
|
|
1866
|
+
cause?: Error;
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Error thrown when the API returns HTTP 403 (RBAC / ownership / Master-only).
|
|
1871
|
+
*
|
|
1872
|
+
* Distinct from `UnauthorizedError` (401, "who you say you are"):
|
|
1873
|
+
* `PermissionDeniedError` means the caller is authenticated but lacks the
|
|
1874
|
+
* required role/ownership for this resource. Typical server messages:
|
|
1875
|
+
*
|
|
1876
|
+
* - `"User is not an owner of the multisig or missing permission"`
|
|
1877
|
+
* (order create / sign / reject / execute)
|
|
1878
|
+
* - `"Forbidden — not a Master Account"`
|
|
1879
|
+
* (`/sdk/organization/*` admin routes)
|
|
1880
|
+
*
|
|
1881
|
+
* The raw response body is preserved in `details.responseBody`.
|
|
1882
|
+
*
|
|
1883
|
+
* Note: this is RBAC, not org policy enforcement. The four `ERROR_*` policy
|
|
1884
|
+
* codes (KYC / business hours / address whitelist / daily limit) are a
|
|
1885
|
+
* separate concern and are not yet mapped to a typed error.
|
|
1886
|
+
*/
|
|
1887
|
+
declare class PermissionDeniedError extends AfridaxBaseError {
|
|
1888
|
+
constructor(message: string, options?: {
|
|
1889
|
+
operation?: string;
|
|
1890
|
+
details?: Record<string, unknown>;
|
|
1891
|
+
cause?: Error;
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Error thrown when the server rejects a request because of an organization
|
|
1896
|
+
* security policy (KYC, business hours, address whitelist, daily limit).
|
|
1897
|
+
*
|
|
1898
|
+
* Distinct from `PermissionDeniedError` (RBAC / ownership): policy
|
|
1899
|
+
* rejections only happen for **non-Master** members of an organization with
|
|
1900
|
+
* the corresponding policy turned on. Master accounts are exempt
|
|
1901
|
+
* server-side, individuals never have policies attached, and SDK 2FA bypass
|
|
1902
|
+
* is unchanged by this layer.
|
|
1903
|
+
*
|
|
1904
|
+
* The discriminator is `platformCode` — one of the four stable strings in
|
|
1905
|
+
* `OrgPolicyCode`. The full response body is preserved in
|
|
1906
|
+
* `details.responseBody` so integrators can surface human-readable copy
|
|
1907
|
+
* the server may also return (e.g. localized message, retry-after hint).
|
|
1908
|
+
*
|
|
1909
|
+
* Step 7.1 / 7.3 note: mapping is currently gated behind the
|
|
1910
|
+
* `ORG_POLICY_MAPPING_ENABLED` toggle in `src/api/client.ts` because the
|
|
1911
|
+
* exact JSON field name(s) staging uses for the code is still TBD. Once a
|
|
1912
|
+
* staging capture is recorded in `docs/api-contract-clarifications.md`,
|
|
1913
|
+
* flip the toggle to `true` (and update `extractOrgPolicyCode` below if
|
|
1914
|
+
* the discriminator field doesn't match any of the candidates already
|
|
1915
|
+
* probed).
|
|
1916
|
+
*/
|
|
1917
|
+
declare class OrgPolicyRejectedError extends AfridaxBaseError {
|
|
1918
|
+
readonly platformCode: OrgPolicyCode;
|
|
1919
|
+
readonly statusCode?: number;
|
|
1920
|
+
readonly responseBody?: unknown;
|
|
1921
|
+
constructor(message: string, options: {
|
|
1922
|
+
platformCode: OrgPolicyCode;
|
|
1923
|
+
statusCode?: number;
|
|
1924
|
+
responseBody?: unknown;
|
|
1925
|
+
operation?: string;
|
|
1926
|
+
chain?: ChainType;
|
|
1927
|
+
details?: Record<string, unknown>;
|
|
1928
|
+
cause?: Error;
|
|
1929
|
+
});
|
|
1930
|
+
toJSON(): SDKError & {
|
|
1931
|
+
platformCode: OrgPolicyCode;
|
|
1932
|
+
statusCode?: number;
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Error thrown when a resource is not found.
|
|
1937
|
+
*/
|
|
1938
|
+
declare class NotFoundError extends AfridaxBaseError {
|
|
1939
|
+
readonly resourceType: 'order' | 'multisig' | 'wallet';
|
|
1940
|
+
readonly resourceId: string;
|
|
1941
|
+
constructor(message: string, options: {
|
|
1942
|
+
resourceType: 'order' | 'multisig' | 'wallet';
|
|
1943
|
+
resourceId: string;
|
|
1944
|
+
chain?: ChainType;
|
|
1945
|
+
operation?: string;
|
|
1946
|
+
details?: Record<string, unknown>;
|
|
1947
|
+
cause?: Error;
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Type guard to check if an error is an AfridaxBaseError
|
|
1952
|
+
*/
|
|
1953
|
+
declare function isAfridaxError(error: unknown): error is AfridaxBaseError;
|
|
1954
|
+
|
|
1955
|
+
export { type ActivateMultisigInput, type ActivateMultisigOutput, type ActivateXrpTrustLineInput, type ActivateXrpTrustLineOutput, type AdaNativeInstruction, type AdaTokenInstruction, type AddOrgAddressResponse, type AddressBookEntry, type AddressBookEntryType, type AddressTypeResponse, AfridaxBaseError, AfridaxSDK, ApiError, type AssignOrgWalletInput, type AssignOrgWalletResponse, type ChainIdValue, ChainNotSupportedError, type ChainType, type CreateAddressBookEntryInput, type CreateMultisigInput, type CreateOrderInput, type CreateOrderOutput, type CreateOrgAddressInput, type CreateWalletInput, type CreateWalletOutput, type CreateWalletResponse, type DeleteAddressBookEntryInput, type DeleteMultisigInput, type DeleteOrderInput, type DeleteOrgAddressBookEntryInput, type DeleteResponse, type DeleteWalletInput, EAdaInstructionType, EAddressBookEntryType, EChainType, EXrpOrderType, type EstimateActivationFeeInput, type EstimateFeeInput, type EstimateOrderExecutionFeeInput, type EstimatedFee, type ExecuteOrderInput, type ExecuteOrderOutput, type ExportWalletInput, type ExportWalletOutput, type GetAddressBookEntriesInput, type GetAddressTypeInput, type GetMultisigByIdInput, type GetMultisigTxHistoryInput, type GetMultisigsInput, type GetOrderByIdInput, type GetOrdersInput, type GetOrgAuditLogsInput, type GetPaginatedMultisigsInput, type GetPortfolioInput, type GetSupportedTokensInput, type GetWalletHistoryInput, type GetWalletInput, type GetWalletsInput, type GetXrpAccountReserveInput, type GetXrpTrustLinesInput, type GroupedMultisigResponseDTO, type HistoryResponse, type ImportWalletInput, InsufficientBalanceError, InvalidInputError, type InviteOrgMemberInput, type InviteOrgMemberResponse, KeyMismatchError, type ListOrgMemberWalletsInput, MEMO_MAX_LENGTH, MEMO_SUPPORTED_CHAINS, type MemoValidationResult, type MultisigBaseDTO, MultisigStatus, type MultisigsItem, NetworkError, NotFoundError, ORG_POLICY_CODES, type Order, type OrderInstruction, type OrderMethodType, type OrderParamsAda, type OrderParamsXrp, type OrderSigner, OrderStatus, type OrgAddressBookEntry, type OrgAddressRecipientType, type OrgAddressWalletType, type OrgAuditEventType, type OrgAuditLogItem, type OrgAuditLogsResponse, type OrgMemberKycStatus, type OrgMemberRole, type OrgMemberStatus, type OrgPolicy, type OrgPolicyCode, OrgPolicyRejectedError, type OrgTeamDirectoryResponse, type OrgTeamMember, type OrgWalletItem, type OrgWalletsResponse, type PaginatedMultisigsWithTokensResponse, type PaginatedOrdersResponse, type PaginatedWalletsResponse, PermissionDeniedError, type RejectOrderInput, type RemoveOrgMemberInput, type SDKConfig, type SendTransactionInput, type SendTransactionOutput, type SignOrderInput, type SignOrderOutput, type SingleWalletDetailsResponse, StatusFilterEnum, type SupportedTokensResponse, type TAdaCommandInstruction, type TWallet, type TXrpCommandInstruction, type TokenInfo, type TotalAssetValueResponse, TransactionEstimatingType, type TransactionHistoryItem, type TxHistoryCombinedResponse, type UnassignOrgWalletInput, UnauthorizedError, type UpdateAddressBookEntryInput, type UpdateMultisigNameInput, type UpdateOrgAddressBookEntryInput, type UpdateOrgAddressInput, type UpdateOrgPolicyInput, type UpdateWalletNameInput, type WalletPortfolioResponse, type WalletRenameResponse, XRP_MAX_DESTINATION_TAG, type XrpAccountReserveInfo, type XrpAssetInstruction, type XrpChangeThresholdInstruction, type XrpNativeInstruction, type XrpRemoveTrustLineInstruction, type XrpSetTrustLineInstruction, type TrustLineInfo as XrpTrustLineInfo, type XrpUpdateOwnerThresholdInstruction, type XrpUpdateOwnersInstruction, AfridaxSDK as default, getBtcChainType, getMemoPlaceholder, isAfridaxError, isMemoSupported, validateMemo };
|