multisigns-sdk 1.0.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.
@@ -0,0 +1,1181 @@
1
+ /**
2
+ * Supported blockchain chain types
3
+ */
4
+ type ChainType = "EVM" | "SOL" | "TRON" | "BTC" | "BTC_T3";
5
+ declare enum EChainType {
6
+ EVM = "EVM",
7
+ SOL = "SOL",
8
+ TRON = "TRON",
9
+ BTC = "BTC",
10
+ BTC_T3 = "BTC_T3"
11
+ }
12
+ /**
13
+ * Returns the appropriate BTC chain type based on the current network mode.
14
+ * - Mainnet: EChainType.BTC
15
+ * - Testnet: EChainType.BTC_T3
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const btcChain = getBtcChainType(); // Returns EChainType.BTC or EChainType.BTC_T3
20
+ * ```
21
+ */
22
+ declare function getBtcChainType(): EChainType.BTC | EChainType.BTC_T3;
23
+ declare enum TestnetChainId {
24
+ BASE_SEPOLIA = "84532",
25
+ ARBITRUM_SEPOLIA = "421614",
26
+ SOLANA_DEVNET = "sol_devnet",
27
+ BTC = "BTC_T3",
28
+ BNB = "97",
29
+ POL = "80002",
30
+ ETH_SEPOLIA = "11155111",
31
+ OPTIMISM_SEPOLIA = "11155420",
32
+ TRON = "tron_shasta"
33
+ }
34
+ declare enum MainnetChainId {
35
+ BASE = "8453",
36
+ ARBITRUM = "42161",
37
+ SOLANA = "sol_mainnet",
38
+ BTC = "btc",
39
+ BNB = "56",
40
+ POL = "137",
41
+ ETH = "1",
42
+ OPTIMISM = "10",
43
+ TRON = "tron_mainnet"
44
+ }
45
+ /**
46
+ * Union of all possible chain ID values (EVM chain IDs are strings here for consistency)
47
+ */
48
+ type ChainIdValue = `${MainnetChainId}` | `${TestnetChainId}`;
49
+ interface TWallet {
50
+ name: string | null;
51
+ chain: EChainType;
52
+ address: string;
53
+ share: string;
54
+ isImported: boolean;
55
+ }
56
+ /**
57
+ * Response from wallet creation/import
58
+ */
59
+ interface CreateWalletResponse {
60
+ wallets: TWallet[];
61
+ }
62
+ /**
63
+ * Single wallet details response
64
+ */
65
+ interface SingleWalletDetailsResponse {
66
+ data: TWallet;
67
+ }
68
+ /**
69
+ * Paginated wallets response
70
+ */
71
+ interface PaginatedWalletsResponse {
72
+ wallets: TWallet[];
73
+ total: number;
74
+ page: number;
75
+ limit: number;
76
+ }
77
+ /**
78
+ * Multisig status enum
79
+ */
80
+ declare enum MultisigStatus {
81
+ PENDING = "pending",
82
+ ACTIVE = "active",
83
+ INACTIVE = "inactive"
84
+ }
85
+ /**
86
+ * Multisig params with deployment data
87
+ */
88
+ interface MultisigParams {
89
+ chainType: EChainType;
90
+ to: string;
91
+ data: string;
92
+ paymentToken: string;
93
+ payment: string;
94
+ vaultAddress: string;
95
+ paymentReceiverAddress: string;
96
+ fallbackAddress: string;
97
+ singleton: string;
98
+ initializer: string;
99
+ deployData: string;
100
+ share?: string;
101
+ }
102
+ /**
103
+ * Token within a multisig
104
+ */
105
+ interface MultisignToken extends TokenMultisignBalance {
106
+ }
107
+ /**
108
+ * Multisig vault/safe object
109
+ */
110
+ interface MultisigsItem {
111
+ id: string;
112
+ address: string | null;
113
+ chainId: ChainIdValue;
114
+ status: "created" | "execution" | "deployed";
115
+ threshold: string;
116
+ chainType: EChainType;
117
+ isDeployed: boolean;
118
+ factoryId: string;
119
+ name: string;
120
+ params: MultisigParams;
121
+ updatedAt: string;
122
+ createdAt: string;
123
+ owners: {
124
+ walletAddress: string;
125
+ }[];
126
+ tokens: MultisignToken[];
127
+ factoryAddress: string;
128
+ }
129
+ interface MultisigBaseDTO {
130
+ address: string;
131
+ chainType: EChainType;
132
+ data: MultisigsItem[];
133
+ }
134
+ /**
135
+ * Order status enum
136
+ */
137
+ declare enum OrderStatus {
138
+ PENDING = "pending",
139
+ APPROVED = "approved",
140
+ EXECUTED = "executed",
141
+ REJECTED = "rejected",
142
+ CANCELLED = "cancelled",
143
+ FAILED = "failed"
144
+ }
145
+ /**
146
+ * Order method types - the action the order will perform
147
+ */
148
+ type OrderMethodType = "native" | "erc20" | "spl" | "trc20" | "trc" | "addOwner" | "removeOwner" | "changeThreshold" | "addOwnerWithThreshold" | "AddOwner" | "RemoveOwner" | "ChangeThreshold" | "multiSend" | "MultiSend" | "updateOwners" | "updateOwnerThreshold";
149
+ /**
150
+ * Solana instruction types
151
+ */
152
+ declare enum ESolanaInstructionType {
153
+ native = "native",
154
+ spl = "spl",
155
+ addOwner = "addOwner",
156
+ removeOwner = "removeOwner",
157
+ changeThreshold = "changeThreshold",
158
+ MultiSend = "MultiSend",
159
+ NATIVE = "native",
160
+ SPL = "spl",
161
+ ADD_OWNER = "addOwner",
162
+ REMOVE_OWNER = "removeOwner",
163
+ CHANGE_THRESHOLD = "changeThreshold"
164
+ }
165
+ /**
166
+ * EVM method types for Gnosis Safe
167
+ */
168
+ type EvmMethodType = "execTransaction" | "addOwnerWithThreshold" | "AddOwner" | "removeOwner" | "RemoveOwner" | "changeThreshold" | "ChangeThreshold" | "multiSend" | "MultiSend";
169
+ /**
170
+ * Tron order types
171
+ */
172
+ declare enum ETronOrderType {
173
+ native = "native",
174
+ trc20 = "trc20",
175
+ trc = "trc",
176
+ addOwner = "addOwner",
177
+ removeOwner = "removeOwner",
178
+ changeThreshold = "changeThreshold",
179
+ updateOwners = "updateOwners",
180
+ updateOwnerThreshold = "updateOwnerThreshold"
181
+ }
182
+ /**
183
+ * Order instruction for creating orders
184
+ */
185
+ interface OrderInstruction {
186
+ to?: string;
187
+ toPubkey?: string;
188
+ amount?: string;
189
+ tokenAddress?: string;
190
+ decimals?: number;
191
+ type?: string;
192
+ newOwner?: string;
193
+ owners?: string[];
194
+ removeOwner?: string;
195
+ ownerToRemove?: string;
196
+ newThreshold?: number;
197
+ data?: string;
198
+ value?: string;
199
+ }
200
+ interface OrderSigner {
201
+ address: string;
202
+ signature?: string;
203
+ signedAt?: string;
204
+ }
205
+ type OrdersToken = {
206
+ name: string;
207
+ symbol: string;
208
+ logoURL: string;
209
+ priceUSD: number;
210
+ price24hChange: number;
211
+ decimals: number;
212
+ amount: number;
213
+ };
214
+ type InstructionArg = string | number | boolean;
215
+ interface OrderMethod {
216
+ method: string;
217
+ args: InstructionArg[];
218
+ }
219
+ interface OrderInstructions {
220
+ type?: ESolanaInstructionType | ETronOrderType | EvmMethodType;
221
+ toPubkey?: string;
222
+ amount?: string;
223
+ newThreshold?: number;
224
+ newOwner?: string;
225
+ removeOwner?: string;
226
+ tokenAddress?: string;
227
+ to?: string;
228
+ value?: string;
229
+ data?: string;
230
+ owners?: string[];
231
+ }
232
+ interface OrderParams {
233
+ expireTime?: Date;
234
+ chainType: string;
235
+ proposalHash: string;
236
+ transactionIndex: string;
237
+ instructions: OrderInstructions[];
238
+ safeTxGas?: string;
239
+ token?: OrdersToken;
240
+ methods?: OrderMethod[];
241
+ operation?: "0" | "1" | string;
242
+ data?: string;
243
+ baseGas?: string;
244
+ gasPrice?: string;
245
+ gasToken?: string;
246
+ value?: string;
247
+ refundReceiver?: string;
248
+ feeSats?: string;
249
+ utxo?: Array<{
250
+ value: number;
251
+ }>;
252
+ transaction?: {
253
+ raw_data_hex?: string;
254
+ };
255
+ }
256
+ interface Signature {
257
+ id: string;
258
+ orderId: string;
259
+ multisigOwnerId: string;
260
+ signedHash: string;
261
+ createdAt: string;
262
+ updatedAt: string;
263
+ }
264
+ interface Signatures {
265
+ walletAddress: string;
266
+ signedHash: string;
267
+ status: string;
268
+ }
269
+ declare enum EOrderStatus {
270
+ proposed = "proposed",
271
+ created = "created",
272
+ pending = "pending",
273
+ ready = "ready",
274
+ rejected = "rejected",
275
+ execution = "execution",
276
+ expired = "expired",
277
+ completed = "completed"
278
+ }
279
+ /**
280
+ * Order object
281
+ */
282
+ interface Order {
283
+ id: string;
284
+ type?: string;
285
+ multisigId: string;
286
+ to: string;
287
+ data: string;
288
+ value: string;
289
+ method: string;
290
+ operation: number;
291
+ hashToSing: string;
292
+ txHash: string | null;
293
+ updatedAt: string;
294
+ createdAt: string;
295
+ nonce: number;
296
+ walletInitiator: string;
297
+ signature: Signature;
298
+ status: EOrderStatus;
299
+ multisig: MultisigsItem;
300
+ signatures: Signatures[];
301
+ params?: OrderParams;
302
+ isSmallestNonce?: boolean;
303
+ }
304
+ /**
305
+ * Paginated orders response
306
+ */
307
+ interface PaginatedOrdersResponse {
308
+ orders: Order[];
309
+ total: number;
310
+ page: number;
311
+ limit: number;
312
+ }
313
+ interface TokenInfo {
314
+ address: string;
315
+ symbol: string;
316
+ name?: string;
317
+ decimals: number;
318
+ logoUrl?: string;
319
+ priceUsd?: string;
320
+ balance?: string;
321
+ }
322
+ /**
323
+ * Supported token from backend
324
+ */
325
+ interface SupportedToken {
326
+ address: string;
327
+ symbol: string;
328
+ name: string;
329
+ decimals: number;
330
+ chainType: EChainType;
331
+ chainId: ChainIdValue;
332
+ logoUrl?: string;
333
+ }
334
+ /**
335
+ * Token balance for multisig
336
+ */
337
+ interface TokenMultisignBalance {
338
+ name: string;
339
+ symbol: string;
340
+ balanceWei: string;
341
+ balance: string;
342
+ decimals: number;
343
+ address: string;
344
+ logoURL: string;
345
+ nativeTokenSymbol: string;
346
+ nativeTokenName: string;
347
+ amountNum?: number;
348
+ priceUsd?: number;
349
+ priceUSD?: number;
350
+ priceChange24h?: number;
351
+ price24hChange?: number;
352
+ valueUsd?: number;
353
+ balanceUSD?: number;
354
+ }
355
+ /**
356
+ * Wallet portfolio response
357
+ */
358
+ interface TokensBalance {
359
+ name: string;
360
+ symbol: string;
361
+ balanceWei: string;
362
+ balance: string;
363
+ priceUSD: number;
364
+ price24hChange: number;
365
+ balanceUSD: number;
366
+ decimals: number;
367
+ address: string;
368
+ logoURL: string;
369
+ }
370
+ interface WalletPortfolioResponse {
371
+ walletAddress: string;
372
+ chainType: EChainType;
373
+ chain: ChainIdValue;
374
+ tokens: TokensBalance[];
375
+ }
376
+ /**
377
+ * Portfolio request payload
378
+ */
379
+ interface PortfolioRequest {
380
+ walletAddress: string;
381
+ chainType: EChainType;
382
+ chain: string;
383
+ }
384
+ /**
385
+ * Total asset value response
386
+ */
387
+ interface TotalAssetValueResponse {
388
+ totalAssetValueUSD: string;
389
+ }
390
+ /**
391
+ * Supported tokens response
392
+ */
393
+ interface SupportedTokensResponse {
394
+ tokens: SupportedToken[];
395
+ total: number;
396
+ }
397
+ /**
398
+ * Estimated fee response
399
+ */
400
+ interface EstimatedFee {
401
+ estimatedFee: string;
402
+ gasLimit?: string;
403
+ gasPrice?: string;
404
+ nativeFeeLamports?: number;
405
+ gasFeeRaw?: string;
406
+ maxFeePerGas?: string;
407
+ maxPriorityFeePerGas?: string;
408
+ energyFee?: string;
409
+ bandwidthFee?: string;
410
+ priorityFee?: string;
411
+ feeRate?: number;
412
+ feeInUsd?: string;
413
+ totalFee?: string;
414
+ currency?: string;
415
+ }
416
+ /**
417
+ * Transaction history item
418
+ */
419
+ interface TokenData {
420
+ symbol: string;
421
+ value: string;
422
+ logoURL: string;
423
+ }
424
+ interface TransactionDetails {
425
+ to: string;
426
+ value: string;
427
+ data: string;
428
+ operation: number;
429
+ safeTxGas: string;
430
+ baseGas: number;
431
+ gasPrice: number;
432
+ gasToken: number;
433
+ refundReceiver: string;
434
+ nonce: number;
435
+ }
436
+ interface TransactionHistoryItem {
437
+ chainType: EChainType;
438
+ chainId: ChainIdValue;
439
+ threshold: string;
440
+ executed: string;
441
+ status: "success" | "failed" | "pending";
442
+ method: string;
443
+ from: string;
444
+ to: string;
445
+ value: string;
446
+ creator: string;
447
+ confirmations: string[];
448
+ token: TokenData;
449
+ details: TransactionDetails;
450
+ hash: string;
451
+ time: string;
452
+ }
453
+ interface HistoryResponse {
454
+ total: number;
455
+ page: number;
456
+ limit: number;
457
+ items: TransactionHistoryItem[];
458
+ }
459
+ /**
460
+ * Status filter for history queries
461
+ */
462
+ declare enum StatusFilterEnum {
463
+ ALL = "all",
464
+ PENDING = "pending",
465
+ EXECUTED = "executed",
466
+ REJECTED = "rejected"
467
+ }
468
+ interface TxHistoryToken {
469
+ symbol: string;
470
+ logoURL: string;
471
+ value: string;
472
+ name?: string;
473
+ priceUSD?: number;
474
+ price24hChange?: number;
475
+ }
476
+ interface TxHistoryMethod {
477
+ args: (string | number)[];
478
+ method: string;
479
+ }
480
+ interface Instruction {
481
+ type: "native" | "spl" | "trc20" | string;
482
+ amount: string;
483
+ toPubkey?: string;
484
+ to?: string;
485
+ tokenAddress?: string;
486
+ }
487
+ interface TxHistoryDetails {
488
+ to: string;
489
+ value: string;
490
+ data: string;
491
+ operation: number;
492
+ safeTxGas: string;
493
+ baseGas: number;
494
+ gasPrice: number;
495
+ gasToken: number;
496
+ refundReceiver: string;
497
+ nonce: number;
498
+ instructions?: Instruction | Instruction[];
499
+ token: TxHistoryToken;
500
+ methods: TxHistoryMethod[];
501
+ chainType: string;
502
+ }
503
+ interface TxHistoryItem {
504
+ id: string;
505
+ status: string;
506
+ method: string;
507
+ chainId: string;
508
+ chainType: string;
509
+ threshold: string;
510
+ from: string;
511
+ to: string;
512
+ value: string;
513
+ token: TxHistoryToken;
514
+ details?: TxHistoryDetails;
515
+ hash: string;
516
+ time: string;
517
+ executed: string;
518
+ creator: string;
519
+ confirmations: string[];
520
+ }
521
+ /**
522
+ * Combined transaction history for multisigs
523
+ */
524
+ interface TxHistoryCombinedResponse {
525
+ items: TxHistoryItem[];
526
+ limit: number;
527
+ total: number;
528
+ page: number;
529
+ }
530
+ /**
531
+ * Input for activateMultisig
532
+ */
533
+ interface ActivateMultisigInput {
534
+ chain: ChainType;
535
+ multisigId: string;
536
+ multisigAddress: string;
537
+ walletAddress: string;
538
+ deviceShare: string;
539
+ feeQuote: EstimatedFee;
540
+ chainId?: ChainIdValue;
541
+ /** Full multisig object for EVM activation */
542
+ multisig: MultisigsItem;
543
+ /** Gas limit override */
544
+ gasLimit?: string;
545
+ /** Gas price override */
546
+ gasPrice?: string;
547
+ }
548
+ /**
549
+ * SDK error codes
550
+ */
551
+ declare enum SDKErrorCode {
552
+ UNKNOWN = "UNKNOWN",
553
+ NETWORK_ERROR = "NETWORK_ERROR",
554
+ API_ERROR = "API_ERROR",
555
+ INVALID_INPUT = "INVALID_INPUT",
556
+ CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED",
557
+ INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
558
+ KEY_MISMATCH = "KEY_MISMATCH",
559
+ KEY_RECONSTRUCTION_FAILED = "KEY_RECONSTRUCTION_FAILED",
560
+ SIGNATURE_FAILED = "SIGNATURE_FAILED",
561
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
562
+ BROADCAST_FAILED = "BROADCAST_FAILED",
563
+ ORDER_NOT_FOUND = "ORDER_NOT_FOUND",
564
+ MULTISIG_NOT_FOUND = "MULTISIG_NOT_FOUND",
565
+ WALLET_NOT_FOUND = "WALLET_NOT_FOUND",
566
+ THRESHOLD_NOT_MET = "THRESHOLD_NOT_MET",
567
+ UNAUTHORIZED = "UNAUTHORIZED",
568
+ RATE_LIMITED = "RATE_LIMITED",
569
+ TIMEOUT = "TIMEOUT"
570
+ }
571
+ /**
572
+ * SDK error interface
573
+ */
574
+ interface SDKError {
575
+ code: SDKErrorCode;
576
+ message: string;
577
+ chain?: ChainType;
578
+ operation?: string;
579
+ details?: Record<string, unknown>;
580
+ cause?: Error;
581
+ }
582
+ /**
583
+ * Network mode
584
+ */
585
+ type NetworkMode = "mainnet" | "testnet";
586
+ /**
587
+ * RPC overrides per chain
588
+ */
589
+ interface RpcOverrides {
590
+ evm?: Record<number, string>;
591
+ solana?: string;
592
+ tron?: string;
593
+ btc?: string;
594
+ }
595
+ /**
596
+ * SDK configuration options
597
+ */
598
+ interface SDKConfig {
599
+ /** API key for authentication (use this OR accessToken) */
600
+ apiKey?: string;
601
+ /** Access token for authentication (use this OR apiKey) */
602
+ accessToken?: string;
603
+ network?: NetworkMode;
604
+ apiBaseUrl?: string;
605
+ rpcOverrides?: RpcOverrides;
606
+ timeout?: number;
607
+ }
608
+ /**
609
+ * Wallet rename response
610
+ */
611
+ interface WalletRenameResponse {
612
+ data: {
613
+ wallet: TWallet;
614
+ };
615
+ }
616
+ /**
617
+ * Delete operation response
618
+ */
619
+ interface DeleteResponse {
620
+ success: boolean;
621
+ }
622
+
623
+ interface CreateWalletInput {
624
+ chain: EChainType;
625
+ }
626
+ interface CreateWalletOutput {
627
+ wallets: TWallet[];
628
+ deviceShare: string;
629
+ }
630
+ interface ImportWalletInput {
631
+ chain: EChainType;
632
+ privateKey: string;
633
+ }
634
+ interface DeleteWalletInput {
635
+ chain: EChainType;
636
+ address: string;
637
+ }
638
+ interface GetWalletInput {
639
+ address: string;
640
+ }
641
+ interface GetWalletsInput {
642
+ chain?: EChainType;
643
+ page?: number;
644
+ limit?: number;
645
+ }
646
+ interface GetPortfolioInput {
647
+ chain: EChainType;
648
+ address: string;
649
+ chainId: ChainIdValue;
650
+ }
651
+ interface SendTransactionInput {
652
+ chain: EChainType;
653
+ from: string;
654
+ to: string;
655
+ amount: string;
656
+ deviceShare: string;
657
+ chainId?: number;
658
+ feeHint?: EstimatedFee;
659
+ }
660
+ interface SendTransactionOutput {
661
+ txHash: string;
662
+ updatedDeviceShare: string | null;
663
+ }
664
+ interface SendTokenInput {
665
+ chain: EChainType;
666
+ from: string;
667
+ to: string;
668
+ amount: string;
669
+ tokenAddress: string;
670
+ decimals: number;
671
+ deviceShare: string;
672
+ chainId?: number;
673
+ }
674
+ /** Input for estimateFee */
675
+ interface EstimateFeeInput {
676
+ chain: EChainType;
677
+ txType: "send" | "sendToken" | "createOrder" | "signOrder" | "executeOrder" | "activateMultisig";
678
+ from?: string;
679
+ to?: string;
680
+ amount?: string;
681
+ tokenAddress?: string;
682
+ decimals?: number;
683
+ chainId?: number;
684
+ orderId?: string;
685
+ multisigId?: string;
686
+ }
687
+ /** Input for exportWallet */
688
+ interface ExportWalletInput {
689
+ chain: EChainType;
690
+ address: string;
691
+ deviceShare: string;
692
+ format?: "hex" | "wif" | "bs58";
693
+ }
694
+ /** Output for exportWallet */
695
+ interface ExportWalletOutput {
696
+ privateKey: string;
697
+ updatedDeviceShare: string | null;
698
+ }
699
+ /** Input for updateWalletName */
700
+ interface UpdateWalletNameInput {
701
+ chain: EChainType;
702
+ address: string;
703
+ name: string;
704
+ }
705
+ /** Input for createMultisig */
706
+ interface CreateMultisigInput {
707
+ chain: EChainType;
708
+ owners: string[];
709
+ threshold: number;
710
+ chainIds?: ChainIdValue[];
711
+ }
712
+ /** Input for getMultisigs */
713
+ interface GetMultisigsInput {
714
+ chain: EChainType;
715
+ walletAddress?: string;
716
+ }
717
+ /** Input for getMultisigById */
718
+ interface GetMultisigByIdInput {
719
+ chain: EChainType;
720
+ address: string;
721
+ }
722
+
723
+ /** Output for activateMultisig */
724
+ interface ActivateMultisigOutput {
725
+ txHash: string;
726
+ updatedDeviceShare: string | null;
727
+ }
728
+ /** Input for estimateActivationFee */
729
+ interface EstimateActivationFeeInput {
730
+ chain: EChainType;
731
+ multisigId?: string;
732
+ owners?: string[];
733
+ threshold?: number;
734
+ chainId?: ChainIdValue;
735
+ }
736
+ /** Input for updateMultisigName */
737
+ interface UpdateMultisigNameInput {
738
+ chain: EChainType;
739
+ multisigId: string;
740
+ name: string;
741
+ walletAddress: string;
742
+ }
743
+ /** Input for deleteMultisig */
744
+ interface DeleteMultisigInput {
745
+ chain: EChainType;
746
+ multisigId: string;
747
+ }
748
+ /** Input for createOrder */
749
+ interface CreateOrderInput {
750
+ chain: EChainType;
751
+ multisigId: string;
752
+ walletAddress: string;
753
+ method: OrderMethodType;
754
+ instructions: OrderInstruction[];
755
+ threshold?: number;
756
+ token?: TokenInfo;
757
+ deviceShare: string;
758
+ }
759
+ /** Output for createOrder */
760
+ interface CreateOrderOutput {
761
+ order: Order;
762
+ proposalHash?: string;
763
+ updatedDeviceShare: string | null;
764
+ }
765
+ /** Input for signOrder */
766
+ interface SignOrderInput {
767
+ chain: EChainType;
768
+ order: Order;
769
+ walletAddress: string;
770
+ deviceShare: string;
771
+ multisigId?: string;
772
+ }
773
+ /** Output for signOrder */
774
+ interface SignOrderOutput {
775
+ signature: string;
776
+ order: Order;
777
+ updatedDeviceShare: string | null;
778
+ }
779
+ /** Input for rejectOrder */
780
+ interface RejectOrderInput {
781
+ chain: EChainType;
782
+ order: Order;
783
+ multisig: MultisigsItem;
784
+ walletAddress: string;
785
+ deviceShare?: string;
786
+ }
787
+ /** Input for executeOrder */
788
+ interface ExecuteOrderInput {
789
+ chain: EChainType;
790
+ order: Order;
791
+ multisig: MultisigsItem;
792
+ walletAddress: string;
793
+ deviceShare: string;
794
+ feeQuote?: EstimatedFee;
795
+ }
796
+ /** Output for executeOrder */
797
+ interface ExecuteOrderOutput {
798
+ txHash: string;
799
+ order: Order;
800
+ updatedDeviceShare: string | null;
801
+ }
802
+ /** Input for estimateOrderExecutionFee */
803
+ interface EstimateOrderExecutionFeeInput {
804
+ chain: EChainType;
805
+ orderId: string;
806
+ walletAddress: string;
807
+ chainId?: ChainIdValue;
808
+ }
809
+ /** Input for getOrders */
810
+ interface GetOrdersInput {
811
+ chain: EChainType;
812
+ multisigId: string;
813
+ page?: number;
814
+ limit?: number;
815
+ }
816
+ /** Input for getOrderById */
817
+ interface GetOrderByIdInput {
818
+ chain: EChainType;
819
+ orderId: string;
820
+ }
821
+ /** Input for deleteOrder */
822
+ interface DeleteOrderInput {
823
+ chain: EChainType;
824
+ orderId: string;
825
+ }
826
+ /** Input for getSupportedTokens */
827
+ interface GetSupportedTokensInput {
828
+ chain: EChainType;
829
+ chainId: ChainIdValue;
830
+ page?: number;
831
+ limit?: number;
832
+ search?: string;
833
+ }
834
+ /** Input for getWalletHistory */
835
+ interface GetWalletHistoryInput {
836
+ chain: EChainType;
837
+ walletAddress: string;
838
+ page?: number;
839
+ limit?: number;
840
+ }
841
+ /** Input for getMultisigTxHistory */
842
+ interface GetMultisigTxHistoryInput {
843
+ multisigId: string;
844
+ page?: number;
845
+ limit?: number;
846
+ }
847
+ declare class AfridaxSDK {
848
+ private readonly resolvedConfig;
849
+ private readonly client;
850
+ private readonly walletService;
851
+ private readonly multisigApi;
852
+ private readonly orderApi;
853
+ private readonly blockchainAdapter;
854
+ private readonly keyManager;
855
+ private readonly txService;
856
+ constructor(config: SDKConfig);
857
+ /**
858
+ * 1.1 Create a new MPC wallet with Shamir secret sharing
859
+ */
860
+ createWallet(input: CreateWalletInput): Promise<CreateWalletOutput>;
861
+ /**
862
+ * 1.2 Import an existing wallet via private key
863
+ */
864
+ importWallet(input: ImportWalletInput): Promise<CreateWalletResponse>;
865
+ /**
866
+ * 1.3 Remove wallet from account
867
+ */
868
+ deleteWallet(input: DeleteWalletInput): Promise<DeleteResponse>;
869
+ /**
870
+ * 1.4 Fetch single wallet details
871
+ */
872
+ getWallet(input: GetWalletInput): Promise<TWallet>;
873
+ /**
874
+ * 1.5 List all wallets for user (with optional pagination)
875
+ */
876
+ getWallets(input?: GetWalletsInput): Promise<PaginatedWalletsResponse>;
877
+ /**
878
+ * 1.6 Get wallet token balances and portfolio (batch request)
879
+ * User constructs the PortfolioRequest array themselves
880
+ */
881
+ getWalletsPortfolio(requests: PortfolioRequest[]): Promise<WalletPortfolioResponse[]>;
882
+ /**
883
+ * 1.7 Get wallet portfolio for a single wallet (convenience method)
884
+ */
885
+ getPortfolio(input: GetPortfolioInput): Promise<WalletPortfolioResponse>;
886
+ /**
887
+ * 1.7 Send native currency (ETH/SOL/TRX/BTC)
888
+ */
889
+ sendTransaction(input: SendTransactionInput): Promise<SendTransactionOutput>;
890
+ /**
891
+ * 1.8 Send token (ERC20/SPL/TRC20)
892
+ */
893
+ sendToken(input: SendTokenInput): Promise<SendTransactionOutput>;
894
+ /**
895
+ * 1.9 Estimate transaction fee for any operation
896
+ */
897
+ estimateFee(input: EstimateFeeInput): Promise<EstimatedFee>;
898
+ /**
899
+ * 1.10 Export private key (reconstructs from shares)
900
+ * Works with empty deviceShare by fetching recovery+server shares from API
901
+ */
902
+ exportWallet(input: ExportWalletInput): Promise<ExportWalletOutput>;
903
+ /**
904
+ * 1.11 Rename a wallet
905
+ */
906
+ updateWalletName(input: UpdateWalletNameInput): Promise<WalletRenameResponse>;
907
+ /**
908
+ * 2.1 Create a new multisig vault
909
+ */
910
+ createMultisig(input: CreateMultisigInput): Promise<MultisigsItem | MultisigsItem[]>;
911
+ /**
912
+ * 2.2 List all multisigs for user
913
+ */
914
+ getMultisigs(input: GetMultisigsInput): Promise<MultisigBaseDTO[]>;
915
+ /**
916
+ * 2.3 Get single multisig details
917
+ */
918
+ getMultisigById(input: GetMultisigByIdInput): Promise<MultisigBaseDTO>;
919
+ /**
920
+ * 2.4 Deploy/activate multisig on-chain
921
+ */
922
+ activateMultisig(input: ActivateMultisigInput): Promise<ActivateMultisigOutput>;
923
+ /**
924
+ * 2.5 Estimate gas/fee for multisig activation
925
+ * Note: Returns a placeholder fee. Use chain-specific methods for accurate estimates.
926
+ */
927
+ estimateActivationFee(input: EstimateActivationFeeInput): Promise<EstimatedFee>;
928
+ /**
929
+ * 2.6 Rename multisig vault
930
+ */
931
+ updateMultisigName(input: UpdateMultisigNameInput): Promise<MultisigBaseDTO>;
932
+ /**
933
+ * 2.7 Remove multisig from account
934
+ */
935
+ deleteMultisig(input: DeleteMultisigInput): Promise<DeleteResponse>;
936
+ /**
937
+ * 2.8 Create a new transaction proposal
938
+ */
939
+ createOrder(input: CreateOrderInput): Promise<CreateOrderOutput>;
940
+ /**
941
+ * 2.8a Create a send order (token transfer) - Simplified API
942
+ * Automatically detects method and builds instructions
943
+ */
944
+ createSendOrder(input: {
945
+ multisigId: string;
946
+ walletAddress: string;
947
+ to: string;
948
+ amount: string;
949
+ token?: TokenInfo;
950
+ deviceShare: string;
951
+ chainId: string;
952
+ }): Promise<CreateOrderOutput>;
953
+ /**
954
+ * 2.8b Create a settings order (multisig configuration change) - Simplified API
955
+ * Automatically calculates changes and determines method
956
+ */
957
+ createSettingsOrder(input: {
958
+ multisigId: string;
959
+ multisig: MultisigsItem;
960
+ walletAddress: string;
961
+ newOwners: string[];
962
+ newThreshold?: number;
963
+ deviceShare: string;
964
+ }): Promise<CreateOrderOutput>;
965
+ /**
966
+ * 2.9 Sign/approve a pending order
967
+ * Uses blockchainAdapter to properly reconstruct key and sign order hash
968
+ */
969
+ signOrder(input: SignOrderInput): Promise<SignOrderOutput>;
970
+ private getChainIdForSignOrder;
971
+ /**
972
+ * 2.10 Reject a pending order
973
+ */
974
+ rejectOrder(input: RejectOrderInput): Promise<Order>;
975
+ /**
976
+ * 2.11 Execute a fully-signed order
977
+ */
978
+ executeOrder(input: ExecuteOrderInput): Promise<ExecuteOrderOutput>;
979
+ /**
980
+ * 2.12 Estimate fee for executing order
981
+ * Note: Returns a placeholder fee. Use chain-specific methods for accurate estimates.
982
+ */
983
+ estimateOrderExecutionFee(input: EstimateOrderExecutionFeeInput): Promise<EstimatedFee>;
984
+ /**
985
+ * 2.13 List orders for a multisig
986
+ */
987
+ getOrders(input: GetOrdersInput): Promise<PaginatedOrdersResponse>;
988
+ /**
989
+ * 2.14 Get single order details
990
+ */
991
+ getOrderById(input: GetOrderByIdInput): Promise<{
992
+ order: Order;
993
+ }>;
994
+ /**
995
+ * 2.15 Delete a pending order
996
+ */
997
+ deleteOrder(input: DeleteOrderInput): Promise<DeleteResponse>;
998
+ /**
999
+ * 3.1 List supported tokens for a chain
1000
+ */
1001
+ getSupportedTokens(input: GetSupportedTokensInput): Promise<SupportedTokensResponse>;
1002
+ /**
1003
+ * 3.2 Get aggregate portfolio value across all wallets
1004
+ */
1005
+ getTotalAssetValue(): Promise<TotalAssetValueResponse>;
1006
+ /**
1007
+ * 4.1 Get transaction history for a wallet
1008
+ */
1009
+ getWalletHistory(input: GetWalletHistoryInput): Promise<HistoryResponse>;
1010
+ /**
1011
+ * 4.2 Get order/execution history for a multisig
1012
+ */
1013
+ getMultisigTxHistory(input: GetMultisigTxHistoryInput): Promise<TxHistoryCombinedResponse>;
1014
+ }
1015
+
1016
+ declare abstract class AfridaxBaseError extends Error implements SDKError {
1017
+ readonly code: SDKErrorCode;
1018
+ readonly chain?: ChainType;
1019
+ readonly operation?: string;
1020
+ readonly details?: Record<string, unknown>;
1021
+ readonly cause?: Error;
1022
+ constructor(code: SDKErrorCode, message: string, options?: {
1023
+ chain?: ChainType;
1024
+ operation?: string;
1025
+ details?: Record<string, unknown>;
1026
+ cause?: Error;
1027
+ });
1028
+ /**
1029
+ * Converts the error to a plain SDKError object for serialization
1030
+ */
1031
+ toJSON(): SDKError;
1032
+ /**
1033
+ * Returns a formatted string representation of the error
1034
+ */
1035
+ toString(): string;
1036
+ }
1037
+ /**
1038
+ * Error thrown when an API request fails.
1039
+ * Includes HTTP status code and response details.
1040
+ */
1041
+ declare class ApiError extends AfridaxBaseError {
1042
+ readonly statusCode?: number;
1043
+ readonly responseBody?: unknown;
1044
+ constructor(message: string, options?: {
1045
+ statusCode?: number;
1046
+ responseBody?: unknown;
1047
+ chain?: ChainType;
1048
+ operation?: string;
1049
+ details?: Record<string, unknown>;
1050
+ cause?: Error;
1051
+ });
1052
+ toJSON(): SDKError & {
1053
+ statusCode?: number;
1054
+ };
1055
+ }
1056
+ /**
1057
+ * Error thrown when reconstructed private key does not match expected address.
1058
+ * Indicates device share may be stale and requires force update.
1059
+ */
1060
+ declare class KeyMismatchError extends AfridaxBaseError {
1061
+ readonly expectedAddress: string;
1062
+ readonly derivedAddress?: string;
1063
+ constructor(message: string, options: {
1064
+ expectedAddress: string;
1065
+ derivedAddress?: string;
1066
+ chain?: ChainType;
1067
+ operation?: string;
1068
+ details?: Record<string, unknown>;
1069
+ cause?: Error;
1070
+ });
1071
+ toJSON(): SDKError & {
1072
+ expectedAddress: string;
1073
+ derivedAddress?: string;
1074
+ };
1075
+ }
1076
+ /**
1077
+ * Error thrown when wallet has insufficient balance for a transaction.
1078
+ * Includes required and available amounts.
1079
+ */
1080
+ declare class InsufficientBalanceError extends AfridaxBaseError {
1081
+ readonly requiredAmount: string;
1082
+ readonly availableAmount: string;
1083
+ readonly currency: string;
1084
+ constructor(message: string, options: {
1085
+ requiredAmount: string;
1086
+ availableAmount: string;
1087
+ currency: string;
1088
+ chain?: ChainType;
1089
+ operation?: string;
1090
+ details?: Record<string, unknown>;
1091
+ cause?: Error;
1092
+ });
1093
+ toJSON(): SDKError & {
1094
+ requiredAmount: string;
1095
+ availableAmount: string;
1096
+ currency: string;
1097
+ };
1098
+ }
1099
+ /**
1100
+ * Error thrown when an operation is attempted on an unsupported chain.
1101
+ */
1102
+ declare class ChainNotSupportedError extends AfridaxBaseError {
1103
+ readonly requestedChain: string;
1104
+ readonly supportedChains: string[];
1105
+ constructor(message: string, options: {
1106
+ requestedChain: string;
1107
+ supportedChains: string[];
1108
+ operation?: string;
1109
+ details?: Record<string, unknown>;
1110
+ cause?: Error;
1111
+ });
1112
+ toJSON(): SDKError & {
1113
+ requestedChain: string;
1114
+ supportedChains: string[];
1115
+ };
1116
+ }
1117
+ /**
1118
+ * Error thrown when a network request fails (connection issues, timeouts, etc.).
1119
+ */
1120
+ declare class NetworkError extends AfridaxBaseError {
1121
+ readonly endpoint?: string;
1122
+ readonly isTimeout: boolean;
1123
+ constructor(message: string, options?: {
1124
+ endpoint?: string;
1125
+ isTimeout?: boolean;
1126
+ chain?: ChainType;
1127
+ operation?: string;
1128
+ details?: Record<string, unknown>;
1129
+ cause?: Error;
1130
+ });
1131
+ toJSON(): SDKError & {
1132
+ endpoint?: string;
1133
+ isTimeout: boolean;
1134
+ };
1135
+ }
1136
+ /**
1137
+ * Error thrown when input validation fails.
1138
+ */
1139
+ declare class InvalidInputError extends AfridaxBaseError {
1140
+ readonly field?: string;
1141
+ readonly value?: unknown;
1142
+ constructor(message: string, options?: {
1143
+ field?: string;
1144
+ value?: unknown;
1145
+ chain?: ChainType;
1146
+ operation?: string;
1147
+ details?: Record<string, unknown>;
1148
+ cause?: Error;
1149
+ });
1150
+ }
1151
+ /**
1152
+ * Error thrown when authorization fails (invalid API key, expired token, etc.).
1153
+ */
1154
+ declare class UnauthorizedError extends AfridaxBaseError {
1155
+ constructor(message: string, options?: {
1156
+ operation?: string;
1157
+ details?: Record<string, unknown>;
1158
+ cause?: Error;
1159
+ });
1160
+ }
1161
+ /**
1162
+ * Error thrown when a resource is not found.
1163
+ */
1164
+ declare class NotFoundError extends AfridaxBaseError {
1165
+ readonly resourceType: 'order' | 'multisig' | 'wallet';
1166
+ readonly resourceId: string;
1167
+ constructor(message: string, options: {
1168
+ resourceType: 'order' | 'multisig' | 'wallet';
1169
+ resourceId: string;
1170
+ chain?: ChainType;
1171
+ operation?: string;
1172
+ details?: Record<string, unknown>;
1173
+ cause?: Error;
1174
+ });
1175
+ }
1176
+ /**
1177
+ * Type guard to check if an error is an AfridaxBaseError
1178
+ */
1179
+ declare function isAfridaxError(error: unknown): error is AfridaxBaseError;
1180
+
1181
+ export { type ActivateMultisigInput, type ActivateMultisigOutput, AfridaxBaseError, AfridaxSDK, ApiError, type ChainIdValue, ChainNotSupportedError, type ChainType, type CreateMultisigInput, type CreateOrderInput, type CreateOrderOutput, type CreateWalletInput, type CreateWalletOutput, type CreateWalletResponse, type DeleteMultisigInput, type DeleteOrderInput, type DeleteResponse, type DeleteWalletInput, EChainType, type EstimateActivationFeeInput, type EstimateFeeInput, type EstimateOrderExecutionFeeInput, type EstimatedFee, type ExecuteOrderInput, type ExecuteOrderOutput, type ExportWalletInput, type ExportWalletOutput, type GetMultisigByIdInput, type GetMultisigTxHistoryInput, type GetMultisigsInput, type GetOrderByIdInput, type GetOrdersInput, type GetPortfolioInput, type GetSupportedTokensInput, type GetWalletHistoryInput, type GetWalletInput, type GetWalletsInput, type HistoryResponse, type ImportWalletInput, InsufficientBalanceError, InvalidInputError, KeyMismatchError, type MultisigBaseDTO, MultisigStatus, type MultisigsItem, NetworkError, NotFoundError, type Order, type OrderInstruction, type OrderMethodType, type OrderSigner, OrderStatus, type PaginatedOrdersResponse, type PaginatedWalletsResponse, type RejectOrderInput, type SDKConfig, type SendTokenInput, type SendTransactionInput, type SendTransactionOutput, type SignOrderInput, type SignOrderOutput, type SingleWalletDetailsResponse, StatusFilterEnum, type SupportedTokensResponse, type TWallet, type TokenInfo, type TotalAssetValueResponse, type TransactionHistoryItem, type TxHistoryCombinedResponse, UnauthorizedError, type UpdateMultisigNameInput, type UpdateWalletNameInput, type WalletPortfolioResponse, type WalletRenameResponse, AfridaxSDK as default, getBtcChainType, isAfridaxError };