@kodiak-finance/orderly-core 2.7.4

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,1436 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ export { default as EventEmitter } from 'eventemitter3';
3
+ import { definedTypes, ChainNamespace, API, AccountStatusEnum, NetworkId } from '@kodiak-finance/orderly-types';
4
+ import { BigNumberish } from 'ethers/src.ts/utils';
5
+ import { parseUnits, TransactionResponse, ethers } from 'ethers';
6
+
7
+ interface OrderlyKeyPair {
8
+ getPublicKey(): Promise<string>;
9
+ secretKey: string;
10
+ sign: (data: Uint8Array) => Promise<Uint8Array>;
11
+ }
12
+ declare class BaseOrderlyKeyPair implements OrderlyKeyPair {
13
+ secretKey: string;
14
+ private privateKey;
15
+ static generateKey(): OrderlyKeyPair;
16
+ constructor(secretKey: string);
17
+ sign(message: Uint8Array): Promise<Uint8Array>;
18
+ getPublicKey(): Promise<string>;
19
+ toString(): string;
20
+ }
21
+
22
+ interface OrderlyKeyStore {
23
+ getOrderlyKey: (address?: string) => OrderlyKeyPair | null;
24
+ getAccountId: (address: string) => string | undefined | null;
25
+ setAccountId: (address: string, accountId: string) => void;
26
+ getAddress: () => string | undefined | null;
27
+ setAddress: (address: string) => void;
28
+ removeAddress: () => void;
29
+ generateKey: () => OrderlyKeyPair;
30
+ cleanKey: (address: string, key: string) => void;
31
+ cleanAllKey: (address: string) => void;
32
+ setKey: (orderlyKey: string, secretKey: OrderlyKeyPair) => void;
33
+ }
34
+ declare abstract class BaseKeyStore implements OrderlyKeyStore {
35
+ private readonly networkId;
36
+ constructor(networkId?: string);
37
+ abstract getOrderlyKey(address?: string): OrderlyKeyPair | null;
38
+ abstract getAccountId(address: string): string | undefined | null;
39
+ abstract setAccountId(address: string, accountId: string): void;
40
+ abstract getAddress(): string | undefined | null;
41
+ abstract setAddress(address: string): void;
42
+ abstract removeAddress(): void;
43
+ abstract generateKey(): OrderlyKeyPair;
44
+ abstract setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
45
+ abstract cleanAllKey(address: string): void;
46
+ abstract cleanKey(address: string, key: string): void;
47
+ protected get keyPrefix(): string;
48
+ }
49
+ declare class LocalStorageStore extends BaseKeyStore {
50
+ getOrderlyKey(address?: string): OrderlyKeyPair | null;
51
+ getAccountId(address: string): string | undefined | null;
52
+ setAccountId(address: string, accountId: string): void;
53
+ getAddress(): string | undefined | null;
54
+ setAddress(address: string): void;
55
+ removeAddress(): void;
56
+ generateKey(): OrderlyKeyPair;
57
+ setKey(address: string, orderlyKey: OrderlyKeyPair): void;
58
+ cleanAllKey(address: string): void;
59
+ cleanKey(address: string, key: string): void;
60
+ private setItem;
61
+ private getItem;
62
+ }
63
+ declare class MockKeyStore implements OrderlyKeyStore {
64
+ private readonly secretKey;
65
+ constructor(secretKey: string);
66
+ generateKey(): BaseOrderlyKeyPair;
67
+ getOrderlyKey(): BaseOrderlyKeyPair;
68
+ getAccountId(): string;
69
+ setAccountId(accountId: string): void;
70
+ getAddress(): string;
71
+ setAddress(address: string): void;
72
+ removeAddress(): void;
73
+ setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
74
+ cleanAllKey(): void;
75
+ cleanKey(key: string): void;
76
+ }
77
+
78
+ type MessageFactor = {
79
+ url: string;
80
+ method: "GET" | "POST" | "PUT" | "DELETE";
81
+ data?: any;
82
+ };
83
+ type SignedMessagePayload = {
84
+ "orderly-key": string;
85
+ "orderly-timestamp": string;
86
+ "orderly-signature": string;
87
+ "orderly-account-id"?: string;
88
+ };
89
+ /**
90
+ * Singer interface
91
+ * @example
92
+ * ```ts
93
+ * const signer = new BaseSigner(keyStore);
94
+ * const payload = await signer.sign({
95
+ * url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=orderly",
96
+ * method: "GET",
97
+ * data: {
98
+ * address: "0x1234567890",
99
+ * brokerId: "orderly",
100
+ * },
101
+ * });
102
+ * ```
103
+ */
104
+ interface Signer {
105
+ sign: (data: MessageFactor, timestamp?: number) => Promise<SignedMessagePayload>;
106
+ signText: (text: string) => Promise<{
107
+ signature: string;
108
+ publicKey: string;
109
+ }>;
110
+ }
111
+ declare class BaseSigner implements Signer {
112
+ private readonly keyStore;
113
+ constructor(keyStore: OrderlyKeyStore);
114
+ sign(message: MessageFactor, timestamp?: number): Promise<SignedMessagePayload>;
115
+ signText(text: string): Promise<{
116
+ signature: string;
117
+ publicKey: string;
118
+ }>;
119
+ }
120
+
121
+ type SignatureDomain = {
122
+ name: string;
123
+ version: string;
124
+ chainId: number;
125
+ verifyingContract: string;
126
+ };
127
+ declare const base64url: (aStr: string) => string;
128
+ declare function parseBrokerHash(brokerId: string): string;
129
+ declare function parseAccountId(userAddress: string, brokerId: string): string;
130
+ declare function parseTokenHash(tokenSymbol: string): string;
131
+ declare function calculateStringHash(input: string): string;
132
+ declare function formatByUnits(amount: BigNumberish, unit?: number | "ether" | "gwei"): string;
133
+ declare function isHex(value: string): boolean;
134
+ declare function isHexString(value: string): boolean;
135
+ declare const getGlobalObject: () => typeof globalThis;
136
+ declare const getTimestamp: () => number;
137
+
138
+ type utils_SignatureDomain = SignatureDomain;
139
+ declare const utils_base64url: typeof base64url;
140
+ declare const utils_calculateStringHash: typeof calculateStringHash;
141
+ declare const utils_formatByUnits: typeof formatByUnits;
142
+ declare const utils_getGlobalObject: typeof getGlobalObject;
143
+ declare const utils_getTimestamp: typeof getTimestamp;
144
+ declare const utils_isHex: typeof isHex;
145
+ declare const utils_isHexString: typeof isHexString;
146
+ declare const utils_parseAccountId: typeof parseAccountId;
147
+ declare const utils_parseBrokerHash: typeof parseBrokerHash;
148
+ declare const utils_parseTokenHash: typeof parseTokenHash;
149
+ declare const utils_parseUnits: typeof parseUnits;
150
+ declare namespace utils {
151
+ export { type utils_SignatureDomain as SignatureDomain, utils_base64url as base64url, utils_calculateStringHash as calculateStringHash, utils_formatByUnits as formatByUnits, utils_getGlobalObject as getGlobalObject, utils_getTimestamp as getTimestamp, utils_isHex as isHex, utils_isHexString as isHexString, utils_parseAccountId as parseAccountId, utils_parseBrokerHash as parseBrokerHash, utils_parseTokenHash as parseTokenHash, utils_parseUnits as parseUnits };
152
+ }
153
+
154
+ declare const getMockSigner: (secretKey?: string) => BaseSigner;
155
+ declare const getDefaultSigner: () => BaseSigner;
156
+ /**
157
+ * generate `registerAccount` data and to be signed message structure
158
+ */
159
+ declare function generateRegisterAccountMessage(inputs: {
160
+ chainId: number;
161
+ registrationNonce: number;
162
+ brokerId: string;
163
+ timestamp?: number;
164
+ }): readonly [{
165
+ brokerId: string;
166
+ chainId: number;
167
+ timestamp: number;
168
+ registrationNonce: number;
169
+ }, {
170
+ domain: {
171
+ name: string;
172
+ version: string;
173
+ chainId: number;
174
+ verifyingContract: string;
175
+ };
176
+ message: {
177
+ brokerId: string;
178
+ chainId: number;
179
+ timestamp: number;
180
+ registrationNonce: number;
181
+ };
182
+ primaryType: string;
183
+ types: {
184
+ EIP712Domain: readonly [{
185
+ readonly name: "name";
186
+ readonly type: "string";
187
+ }, {
188
+ readonly name: "version";
189
+ readonly type: "string";
190
+ }, {
191
+ readonly name: "chainId";
192
+ readonly type: "uint256";
193
+ }, {
194
+ readonly name: "verifyingContract";
195
+ readonly type: "address";
196
+ }];
197
+ Registration: readonly [{
198
+ readonly name: "brokerId";
199
+ readonly type: "string";
200
+ }, {
201
+ readonly name: "chainId";
202
+ readonly type: "uint256";
203
+ }, {
204
+ readonly name: "timestamp";
205
+ readonly type: "uint64";
206
+ }, {
207
+ readonly name: "registrationNonce";
208
+ readonly type: "uint256";
209
+ }];
210
+ };
211
+ }];
212
+ /**
213
+ * generate `addOrderlyKey` data and to be signed message structure
214
+ */
215
+ declare function generateAddOrderlyKeyMessage(inputs: {
216
+ publicKey: string;
217
+ chainId: number;
218
+ brokerId: string;
219
+ primaryType: keyof typeof definedTypes;
220
+ expiration?: number;
221
+ timestamp?: number;
222
+ scope?: string;
223
+ tag?: string;
224
+ subAccountId?: string;
225
+ }): readonly [{
226
+ subAccountId?: string | undefined;
227
+ tag?: string | undefined;
228
+ brokerId: string;
229
+ orderlyKey: string;
230
+ scope: string;
231
+ chainId: number;
232
+ timestamp: number;
233
+ expiration: number;
234
+ }, {
235
+ domain: {
236
+ name: string;
237
+ version: string;
238
+ chainId: number;
239
+ verifyingContract: string;
240
+ };
241
+ message: {
242
+ subAccountId?: string | undefined;
243
+ tag?: string | undefined;
244
+ brokerId: string;
245
+ orderlyKey: string;
246
+ scope: string;
247
+ chainId: number;
248
+ timestamp: number;
249
+ expiration: number;
250
+ };
251
+ primaryType: "EIP712Domain" | "Registration" | "Withdraw" | "AddOrderlyKey" | "SettlePnl" | "DexRequest" | "InternalTransfer";
252
+ types: {
253
+ [x: string]: readonly [{
254
+ readonly name: "name";
255
+ readonly type: "string";
256
+ }, {
257
+ readonly name: "version";
258
+ readonly type: "string";
259
+ }, {
260
+ readonly name: "chainId";
261
+ readonly type: "uint256";
262
+ }, {
263
+ readonly name: "verifyingContract";
264
+ readonly type: "address";
265
+ }] | readonly [{
266
+ readonly name: "brokerId";
267
+ readonly type: "string";
268
+ }, {
269
+ readonly name: "chainId";
270
+ readonly type: "uint256";
271
+ }, {
272
+ readonly name: "timestamp";
273
+ readonly type: "uint64";
274
+ }, {
275
+ readonly name: "registrationNonce";
276
+ readonly type: "uint256";
277
+ }] | readonly [{
278
+ readonly name: "brokerId";
279
+ readonly type: "string";
280
+ }, {
281
+ readonly name: "chainId";
282
+ readonly type: "uint256";
283
+ }, {
284
+ readonly name: "receiver";
285
+ readonly type: "address";
286
+ }, {
287
+ readonly name: "token";
288
+ readonly type: "string";
289
+ }, {
290
+ readonly name: "amount";
291
+ readonly type: "uint256";
292
+ }, {
293
+ readonly name: "withdrawNonce";
294
+ readonly type: "uint64";
295
+ }, {
296
+ readonly name: "timestamp";
297
+ readonly type: "uint64";
298
+ }] | readonly [{
299
+ readonly name: "brokerId";
300
+ readonly type: "string";
301
+ }, {
302
+ readonly name: "chainId";
303
+ readonly type: "uint256";
304
+ }, {
305
+ readonly name: "orderlyKey";
306
+ readonly type: "string";
307
+ }, {
308
+ readonly name: "scope";
309
+ readonly type: "string";
310
+ }, {
311
+ readonly name: "timestamp";
312
+ readonly type: "uint64";
313
+ }, {
314
+ readonly name: "expiration";
315
+ readonly type: "uint64";
316
+ }] | readonly [{
317
+ readonly name: "brokerId";
318
+ readonly type: "string";
319
+ }, {
320
+ readonly name: "chainId";
321
+ readonly type: "uint256";
322
+ }, {
323
+ readonly name: "settleNonce";
324
+ readonly type: "uint64";
325
+ }, {
326
+ readonly name: "timestamp";
327
+ readonly type: "uint64";
328
+ }] | readonly [{
329
+ readonly name: "payloadType";
330
+ readonly type: "uint8";
331
+ }, {
332
+ readonly name: "nonce";
333
+ readonly type: "uint256";
334
+ }, {
335
+ readonly name: "receiver";
336
+ readonly type: "address";
337
+ }, {
338
+ readonly name: "amount";
339
+ readonly type: "uint256";
340
+ }, {
341
+ readonly name: "vaultId";
342
+ readonly type: "bytes32";
343
+ }, {
344
+ readonly name: "token";
345
+ readonly type: "string";
346
+ }, {
347
+ readonly name: "dexBrokerId";
348
+ readonly type: "string";
349
+ }] | readonly [{
350
+ readonly name: "receiver";
351
+ readonly type: "bytes32";
352
+ }, {
353
+ readonly name: "token";
354
+ readonly type: "string";
355
+ }, {
356
+ readonly name: "amount";
357
+ readonly type: "uint256";
358
+ }, {
359
+ readonly name: "transferNonce";
360
+ readonly type: "uint64";
361
+ }];
362
+ EIP712Domain: readonly [{
363
+ readonly name: "name";
364
+ readonly type: "string";
365
+ }, {
366
+ readonly name: "version";
367
+ readonly type: "string";
368
+ }, {
369
+ readonly name: "chainId";
370
+ readonly type: "uint256";
371
+ }, {
372
+ readonly name: "verifyingContract";
373
+ readonly type: "address";
374
+ }];
375
+ };
376
+ }];
377
+ /**
378
+ * generate `settle` data and to be signed message structure
379
+ */
380
+ declare function generateSettleMessage(inputs: {
381
+ chainId: number;
382
+ brokerId: string;
383
+ settlePnlNonce: string;
384
+ domain: SignatureDomain;
385
+ }): readonly [{
386
+ brokerId: string;
387
+ chainId: number;
388
+ timestamp: number;
389
+ settleNonce: string;
390
+ }, {
391
+ domain: SignatureDomain;
392
+ message: {
393
+ brokerId: string;
394
+ chainId: number;
395
+ timestamp: number;
396
+ settleNonce: string;
397
+ };
398
+ primaryType: string;
399
+ types: {
400
+ EIP712Domain: readonly [{
401
+ readonly name: "name";
402
+ readonly type: "string";
403
+ }, {
404
+ readonly name: "version";
405
+ readonly type: "string";
406
+ }, {
407
+ readonly name: "chainId";
408
+ readonly type: "uint256";
409
+ }, {
410
+ readonly name: "verifyingContract";
411
+ readonly type: "address";
412
+ }];
413
+ SettlePnl: readonly [{
414
+ readonly name: "brokerId";
415
+ readonly type: "string";
416
+ }, {
417
+ readonly name: "chainId";
418
+ readonly type: "uint256";
419
+ }, {
420
+ readonly name: "settleNonce";
421
+ readonly type: "uint64";
422
+ }, {
423
+ readonly name: "timestamp";
424
+ readonly type: "uint64";
425
+ }];
426
+ };
427
+ }];
428
+ /**
429
+ * generate `dexRequest` data and to be signed message structure
430
+ */
431
+ declare function generateDexRequestMessage(inputs: {
432
+ chainId: number;
433
+ payloadType: number;
434
+ nonce: string;
435
+ receiver: string;
436
+ amount: string;
437
+ vaultId: string;
438
+ token: string;
439
+ dexBrokerId: string;
440
+ domain: SignatureDomain;
441
+ timestamp?: number;
442
+ }): readonly [{
443
+ payloadType: number;
444
+ nonce: string;
445
+ receiver: string;
446
+ amount: string;
447
+ vaultId: string;
448
+ token: string;
449
+ dexBrokerId: string;
450
+ }, {
451
+ domain: SignatureDomain;
452
+ message: {
453
+ payloadType: number;
454
+ nonce: string;
455
+ receiver: string;
456
+ amount: string;
457
+ vaultId: string;
458
+ token: string;
459
+ dexBrokerId: string;
460
+ };
461
+ primaryType: string;
462
+ types: {
463
+ EIP712Domain: readonly [{
464
+ readonly name: "name";
465
+ readonly type: "string";
466
+ }, {
467
+ readonly name: "version";
468
+ readonly type: "string";
469
+ }, {
470
+ readonly name: "chainId";
471
+ readonly type: "uint256";
472
+ }, {
473
+ readonly name: "verifyingContract";
474
+ readonly type: "address";
475
+ }];
476
+ DexRequest: readonly [{
477
+ readonly name: "payloadType";
478
+ readonly type: "uint8";
479
+ }, {
480
+ readonly name: "nonce";
481
+ readonly type: "uint256";
482
+ }, {
483
+ readonly name: "receiver";
484
+ readonly type: "address";
485
+ }, {
486
+ readonly name: "amount";
487
+ readonly type: "uint256";
488
+ }, {
489
+ readonly name: "vaultId";
490
+ readonly type: "bytes32";
491
+ }, {
492
+ readonly name: "token";
493
+ readonly type: "string";
494
+ }, {
495
+ readonly name: "dexBrokerId";
496
+ readonly type: "string";
497
+ }];
498
+ };
499
+ }];
500
+
501
+ type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "brokerName" | "networkId" | "env" | "chainNamespace" | "PROD_URL" | "orderly_markets" | "markets";
502
+ interface ConfigStore {
503
+ get<T = string>(key: ConfigKey): T;
504
+ getOr<T = string>(key: ConfigKey, defaultValue: T): T;
505
+ set<T>(key: ConfigKey, value: T): void;
506
+ clear(): void;
507
+ }
508
+
509
+ /**
510
+ * Orderly contracts information
511
+ */
512
+ type OrderlyContracts = {
513
+ usdcAddress: string;
514
+ usdcAbi: any;
515
+ erc20Abi: any;
516
+ vaultAddress: string;
517
+ vaultAbi: any;
518
+ verifyContractAddress: string;
519
+ solanaUSDCAddress: string;
520
+ solanaVaultAddress: string;
521
+ storyTestnetVaultAddress?: string;
522
+ monadTestnetVaultAddress?: string;
523
+ monadTestnetUSDCAddress?: string;
524
+ abstractVaultAddress?: string;
525
+ abstractUSDCAddress?: string;
526
+ bscVaultAddress?: string;
527
+ bscUSDCAddress?: string;
528
+ };
529
+ interface IContract {
530
+ getContractInfoByEnv(): OrderlyContracts;
531
+ }
532
+ /** @hidden */
533
+ declare class BaseContract implements IContract {
534
+ private readonly configStore;
535
+ constructor(configStore: ConfigStore);
536
+ getContractInfoByEnv(): {
537
+ usdcAddress: string;
538
+ usdcAbi: ({
539
+ anonymous: boolean;
540
+ inputs: {
541
+ indexed: boolean;
542
+ internalType: string;
543
+ name: string;
544
+ type: string;
545
+ }[];
546
+ name: string;
547
+ type: string;
548
+ outputs?: undefined;
549
+ stateMutability?: undefined;
550
+ } | {
551
+ inputs: {
552
+ internalType: string;
553
+ name: string;
554
+ type: string;
555
+ }[];
556
+ name: string;
557
+ outputs: {
558
+ internalType: string;
559
+ name: string;
560
+ type: string;
561
+ }[];
562
+ stateMutability: string;
563
+ type: string;
564
+ anonymous?: undefined;
565
+ })[];
566
+ vaultAddress: string;
567
+ vaultAbi: ({
568
+ inputs: never[];
569
+ stateMutability: string;
570
+ type: string;
571
+ name?: undefined;
572
+ anonymous?: undefined;
573
+ outputs?: undefined;
574
+ } | {
575
+ inputs: {
576
+ internalType: string;
577
+ name: string;
578
+ type: string;
579
+ }[];
580
+ name: string;
581
+ type: string;
582
+ stateMutability?: undefined;
583
+ anonymous?: undefined;
584
+ outputs?: undefined;
585
+ } | {
586
+ anonymous: boolean;
587
+ inputs: {
588
+ indexed: boolean;
589
+ internalType: string;
590
+ name: string;
591
+ type: string;
592
+ }[];
593
+ name: string;
594
+ type: string;
595
+ stateMutability?: undefined;
596
+ outputs?: undefined;
597
+ } | {
598
+ inputs: ({
599
+ internalType: string;
600
+ name: string;
601
+ type: string;
602
+ components?: undefined;
603
+ } | {
604
+ components: {
605
+ internalType: string;
606
+ name: string;
607
+ type: string;
608
+ }[];
609
+ internalType: string;
610
+ name: string;
611
+ type: string;
612
+ })[];
613
+ name: string;
614
+ outputs: {
615
+ internalType: string;
616
+ name: string;
617
+ type: string;
618
+ }[];
619
+ stateMutability: string;
620
+ type: string;
621
+ anonymous?: undefined;
622
+ })[];
623
+ verifyContractAddress: string;
624
+ erc20Abi: ({
625
+ anonymous: boolean;
626
+ inputs: {
627
+ indexed: boolean;
628
+ internalType: string;
629
+ name: string;
630
+ type: string;
631
+ }[];
632
+ name: string;
633
+ type: string;
634
+ outputs?: undefined;
635
+ stateMutability?: undefined;
636
+ } | {
637
+ inputs: {
638
+ internalType: string;
639
+ name: string;
640
+ type: string;
641
+ }[];
642
+ name: string;
643
+ outputs: {
644
+ internalType: string;
645
+ name: string;
646
+ type: string;
647
+ }[];
648
+ stateMutability: string;
649
+ type: string;
650
+ anonymous?: undefined;
651
+ })[];
652
+ solanaUSDCAddress: string;
653
+ solanaVaultAddress: string;
654
+ abstractVaultAddress: string;
655
+ abstractUSDCAddress: string;
656
+ bscVaultAddress: string;
657
+ bscUSDCAddress: string;
658
+ storyTestnetVaultAddress?: undefined;
659
+ monadTestnetVaultAddress?: undefined;
660
+ monadTestnetUSDCAddress?: undefined;
661
+ } | {
662
+ usdcAddress: string;
663
+ usdcAbi: ({
664
+ inputs: {
665
+ internalType: string;
666
+ name: string;
667
+ type: string;
668
+ }[];
669
+ stateMutability: string;
670
+ type: string;
671
+ anonymous?: undefined;
672
+ name?: undefined;
673
+ outputs?: undefined;
674
+ } | {
675
+ anonymous: boolean;
676
+ inputs: {
677
+ indexed: boolean;
678
+ internalType: string;
679
+ name: string;
680
+ type: string;
681
+ }[];
682
+ name: string;
683
+ type: string;
684
+ stateMutability?: undefined;
685
+ outputs?: undefined;
686
+ } | {
687
+ inputs: {
688
+ internalType: string;
689
+ name: string;
690
+ type: string;
691
+ }[];
692
+ name: string;
693
+ outputs: {
694
+ internalType: string;
695
+ name: string;
696
+ type: string;
697
+ }[];
698
+ stateMutability: string;
699
+ type: string;
700
+ anonymous?: undefined;
701
+ })[];
702
+ vaultAddress: string;
703
+ solanaVaultAddress: string;
704
+ solanaUSDCAddress: string;
705
+ vaultAbi: ({
706
+ inputs: never[];
707
+ stateMutability: string;
708
+ type: string;
709
+ name?: undefined;
710
+ anonymous?: undefined;
711
+ outputs?: undefined;
712
+ } | {
713
+ inputs: {
714
+ internalType: string;
715
+ name: string;
716
+ type: string;
717
+ }[];
718
+ name: string;
719
+ type: string;
720
+ stateMutability?: undefined;
721
+ anonymous?: undefined;
722
+ outputs?: undefined;
723
+ } | {
724
+ anonymous: boolean;
725
+ inputs: {
726
+ indexed: boolean;
727
+ internalType: string;
728
+ name: string;
729
+ type: string;
730
+ }[];
731
+ name: string;
732
+ type: string;
733
+ stateMutability?: undefined;
734
+ outputs?: undefined;
735
+ } | {
736
+ inputs: ({
737
+ internalType: string;
738
+ name: string;
739
+ type: string;
740
+ components?: undefined;
741
+ } | {
742
+ components: {
743
+ internalType: string;
744
+ name: string;
745
+ type: string;
746
+ }[];
747
+ internalType: string;
748
+ name: string;
749
+ type: string;
750
+ })[];
751
+ name: string;
752
+ outputs: {
753
+ internalType: string;
754
+ name: string;
755
+ type: string;
756
+ }[];
757
+ stateMutability: string;
758
+ type: string;
759
+ anonymous?: undefined;
760
+ })[];
761
+ verifyContractAddress: string;
762
+ erc20Abi: ({
763
+ inputs: {
764
+ internalType: string;
765
+ name: string;
766
+ type: string;
767
+ }[];
768
+ stateMutability: string;
769
+ type: string;
770
+ anonymous?: undefined;
771
+ name?: undefined;
772
+ outputs?: undefined;
773
+ } | {
774
+ anonymous: boolean;
775
+ inputs: {
776
+ indexed: boolean;
777
+ internalType: string;
778
+ name: string;
779
+ type: string;
780
+ }[];
781
+ name: string;
782
+ type: string;
783
+ stateMutability?: undefined;
784
+ outputs?: undefined;
785
+ } | {
786
+ inputs: {
787
+ internalType: string;
788
+ name: string;
789
+ type: string;
790
+ }[];
791
+ name: string;
792
+ outputs: {
793
+ internalType: string;
794
+ name: string;
795
+ type: string;
796
+ }[];
797
+ stateMutability: string;
798
+ type: string;
799
+ anonymous?: undefined;
800
+ })[];
801
+ storyTestnetVaultAddress: string;
802
+ monadTestnetVaultAddress: string;
803
+ monadTestnetUSDCAddress: string;
804
+ abstractUSDCAddress: string;
805
+ abstractVaultAddress: string;
806
+ bscVaultAddress: string;
807
+ bscUSDCAddress: string;
808
+ };
809
+ }
810
+
811
+ declare const EVENT_NAMES: {
812
+ statusChanged: string;
813
+ validateStart: string;
814
+ validateEnd: string;
815
+ switchAccount: string;
816
+ subAccountCreated: string;
817
+ subAccountUpdated: string;
818
+ };
819
+
820
+ declare class SimpleDI {
821
+ private static KEY;
822
+ private static container;
823
+ private static getContainer;
824
+ static register(...serviceClasses: any[]): void;
825
+ static registerByName(name: string, serviceClass: any): void;
826
+ static get<T = any>(name: string): T;
827
+ static getOr<T = any>(name: string, instance: T): T;
828
+ static getAll(): {
829
+ [name: string]: any;
830
+ };
831
+ private constructor();
832
+ }
833
+
834
+ type ChainType = "EVM" | "SOL";
835
+ interface Message {
836
+ message: {
837
+ chainType: ChainType;
838
+ [key: string]: any;
839
+ };
840
+ signatured: string;
841
+ }
842
+ type RegisterAccountInputs = {
843
+ brokerId: string;
844
+ registrationNonce: number;
845
+ timestamp: number;
846
+ };
847
+ type WithdrawInputs = {
848
+ brokerId: string;
849
+ receiver: string;
850
+ token: string;
851
+ amount: string;
852
+ nonce: number;
853
+ timestamp: number;
854
+ verifyContract?: string;
855
+ };
856
+ type InternalTransferInputs = {
857
+ receiver: string;
858
+ token: string;
859
+ amount: string;
860
+ nonce: number;
861
+ verifyContract?: string;
862
+ };
863
+ type SettleInputs = {
864
+ brokerId: string;
865
+ settlePnlNonce: string;
866
+ timestamp: number;
867
+ verifyContract?: string;
868
+ };
869
+ type AddOrderlyKeyInputs = {
870
+ publicKey: string;
871
+ brokerId: string;
872
+ expiration: number;
873
+ timestamp: number;
874
+ scope?: string;
875
+ tag?: string;
876
+ /** @since 2.3.0, when create orderly key for sub account, it's required */
877
+ subAccountId?: string;
878
+ };
879
+ type DexRequestInputs = {
880
+ payloadType: number;
881
+ nonce: string;
882
+ receiver: string;
883
+ amount: string;
884
+ vaultId: string;
885
+ token: string;
886
+ dexBrokerId: string;
887
+ timestamp: number;
888
+ domain: SignatureDomain;
889
+ };
890
+ interface WalletAdapter<Config = any> {
891
+ chainNamespace: ChainNamespace;
892
+ get chainId(): number;
893
+ get address(): string;
894
+ set chainId(chainId: number);
895
+ set address(addresses: string);
896
+ active(config: Config): void;
897
+ update(config: Config): void;
898
+ deactivate(): void;
899
+ generateSecretKey(): string;
900
+ /**
901
+ * business methods
902
+ */
903
+ generateRegisterAccountMessage(inputs: RegisterAccountInputs): Promise<Message>;
904
+ generateWithdrawMessage(inputs: WithdrawInputs): Promise<Message & {
905
+ domain: SignatureDomain;
906
+ }>;
907
+ generateInternalTransferMessage(inputs: InternalTransferInputs): Promise<Message & {
908
+ domain: SignatureDomain;
909
+ }>;
910
+ generateSettleMessage(inputs: SettleInputs): Promise<Message & {
911
+ domain: SignatureDomain;
912
+ }>;
913
+ generateAddOrderlyKeyMessage(inputs: AddOrderlyKeyInputs): Promise<Message>;
914
+ generateDexRequestMessage(inputs: DexRequestInputs): Promise<Message & {
915
+ domain: SignatureDomain;
916
+ }>;
917
+ /**
918
+ * ===== general methods =====
919
+ */
920
+ /**
921
+ * call contract
922
+ */
923
+ call(address: string, method: string, params: any[], options?: {
924
+ abi: any;
925
+ }): Promise<any>;
926
+ /**
927
+ * send transaction
928
+ */
929
+ sendTransaction(contractAddress: string, method: string, payload: {
930
+ from: string;
931
+ to?: string;
932
+ data: any[];
933
+ value?: bigint;
934
+ }, options: {
935
+ abi: any;
936
+ }): Promise<any>;
937
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
938
+ abi: any;
939
+ }): Promise<any>;
940
+ getBalance(): Promise<bigint>;
941
+ pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
942
+ parseUnits: (amount: string, decimals: number) => string;
943
+ formatUnits: (amount: BigNumberish, decimals: number) => string;
944
+ on(eventName: string, listener: (...args: any[]) => void): void;
945
+ off(eventName: string, listener: (...args: any[]) => void): void;
946
+ }
947
+
948
+ declare class Assets {
949
+ private readonly configStore;
950
+ private readonly contractManger;
951
+ private readonly account;
952
+ constructor(configStore: ConfigStore, contractManger: IContract, account: Account);
953
+ /**
954
+ * Convert non-USDC asset to USDC manually
955
+ */
956
+ convert(inputs: {
957
+ slippage: number;
958
+ amount: number;
959
+ converted_asset: string;
960
+ }): Promise<any>;
961
+ withdraw(inputs: {
962
+ chainId: number;
963
+ token: string;
964
+ amount: string | number;
965
+ allowCrossChainWithdraw: boolean;
966
+ /** orderly withdraw decimals */
967
+ decimals: number;
968
+ }): Promise<any>;
969
+ private getWithdrawalNonce;
970
+ getNativeBalance(options?: {
971
+ /** token decimals on chain, default is 18 */
972
+ decimals?: number;
973
+ }): Promise<string>;
974
+ getBalance(
975
+ /** token address */
976
+ address: string, options: {
977
+ /** token decimals on chain, default is 18 */
978
+ decimals?: number;
979
+ }): Promise<string>;
980
+ /**
981
+ * @deprecated use getBalance instead, will be removed in the future
982
+ */
983
+ getBalanceByAddress(
984
+ /** token address */
985
+ address: string, options?: {
986
+ /** token decimals on chain, default is 18 */
987
+ decimals?: number;
988
+ }): Promise<string>;
989
+ getAllowance(inputs: {
990
+ /** token address */
991
+ address: string;
992
+ /** vault address */
993
+ vaultAddress?: string;
994
+ /** token decimals on chain, default is 18 */
995
+ decimals?: number;
996
+ }): Promise<string>;
997
+ approve(inputs: {
998
+ /** token address */
999
+ address?: string;
1000
+ /** vault address */
1001
+ vaultAddress?: string;
1002
+ /** token amount */
1003
+ amount?: string;
1004
+ isSetMaxValue?: boolean;
1005
+ /** token decimals on chain, default is 18 */
1006
+ decimals: number;
1007
+ }): Promise<any>;
1008
+ /**
1009
+ * @deprecated use approve instead, will be removed in the future
1010
+ */
1011
+ approveByAddress(inputs: {
1012
+ /** token address */
1013
+ address: string;
1014
+ /** token amount */
1015
+ amount?: string;
1016
+ /** token decimals on chain, default is 18 */
1017
+ decimals: number;
1018
+ }): Promise<any>;
1019
+ getDepositFee(inputs: {
1020
+ amount: string;
1021
+ /** chain info */
1022
+ chain: API.NetworkInfos;
1023
+ /** token decimals on chain, default is 18 */
1024
+ decimals: number;
1025
+ token?: string;
1026
+ /** token address */
1027
+ address?: string;
1028
+ }): Promise<any>;
1029
+ /** deposit native token */
1030
+ depositNativeToken(inputs: {
1031
+ amount: string;
1032
+ fee: bigint;
1033
+ /** token decimals on chain, default is 18 */
1034
+ decimals: number;
1035
+ token?: string;
1036
+ }): Promise<any>;
1037
+ deposit(inputs: {
1038
+ amount: string;
1039
+ fee: bigint;
1040
+ /** token decimals on chain, default is 18 */
1041
+ decimals: number;
1042
+ token?: string;
1043
+ /** token address */
1044
+ address?: string;
1045
+ /** vault address */
1046
+ vaultAddress?: string;
1047
+ }): Promise<any>;
1048
+ internalTransfer(inputs: {
1049
+ token: string;
1050
+ amount: string;
1051
+ receiver: string;
1052
+ /** orderly token decimals */
1053
+ decimals: number;
1054
+ }): Promise<any>;
1055
+ private getTransferNonce;
1056
+ private _simpleFetch;
1057
+ get usdcAddress(): string;
1058
+ }
1059
+
1060
+ type SubAccount = {
1061
+ id: string;
1062
+ description: string;
1063
+ holding: API.Holding[];
1064
+ };
1065
+
1066
+ interface AccountState {
1067
+ status: AccountStatusEnum;
1068
+ /**
1069
+ * whether the account is validating
1070
+ */
1071
+ validating: boolean;
1072
+ /**
1073
+ * whether the account is revalidating
1074
+ */
1075
+ /**
1076
+ * The current active account ID
1077
+ * Can be either a root account ID or sub-account ID
1078
+ * @since 2.3.0
1079
+ */
1080
+ accountId?: string;
1081
+ /**
1082
+ * root account id
1083
+ * @since 2.3.0
1084
+ */
1085
+ mainAccountId?: string;
1086
+ /**
1087
+ * sub account id
1088
+ * @since 2.3.0
1089
+ */
1090
+ subAccountId?: string | undefined;
1091
+ userId?: string;
1092
+ address?: string;
1093
+ chainNamespace?: ChainNamespace;
1094
+ /** new account */
1095
+ isNew?: boolean;
1096
+ connectWallet?: {
1097
+ name: string;
1098
+ chainId: number;
1099
+ };
1100
+ /**
1101
+ * sub accounts
1102
+ * @since 2.3.0
1103
+ */
1104
+ subAccounts?: SubAccount[];
1105
+ }
1106
+ /**
1107
+ * Account
1108
+ * @example
1109
+ * ```ts
1110
+ * const account = new Account();
1111
+ * account.login("0x1234567890");
1112
+ * ```
1113
+ */
1114
+ declare class Account {
1115
+ private readonly configStore;
1116
+ readonly keyStore: OrderlyKeyStore;
1117
+ static instanceName: string;
1118
+ static additionalInfoRepositoryName: string;
1119
+ static ACTIVE_SUB_ACCOUNT_ID_KEY: string;
1120
+ private _singer?;
1121
+ private _ee;
1122
+ private walletAdapterManager;
1123
+ assetsManager: Assets;
1124
+ private additionalInfoRepository;
1125
+ private _state;
1126
+ private readonly contractManger;
1127
+ constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletAdapters: WalletAdapter[], options?: Partial<{
1128
+ /**
1129
+ * smart contract configuration class
1130
+ * provide contract address and abi
1131
+ */
1132
+ contracts: IContract;
1133
+ }>);
1134
+ logout(): void;
1135
+ setAddress(address: string, wallet: {
1136
+ provider: any;
1137
+ chain: {
1138
+ id: string | number;
1139
+ namespace: ChainNamespace;
1140
+ };
1141
+ wallet: {
1142
+ name: string;
1143
+ };
1144
+ [key: string]: any;
1145
+ }, options?: {
1146
+ /**
1147
+ * @deprecated will be remove this in next minor version
1148
+ */
1149
+ validateOrderlyKeyScope?: (scope: string) => boolean;
1150
+ }): Promise<AccountStatusEnum>;
1151
+ private saveAdditionalInfo;
1152
+ get stateValue(): AccountState;
1153
+ get accountId(): string | undefined;
1154
+ get mainAccountId(): string | undefined;
1155
+ get subAccountId(): string | undefined;
1156
+ get isSubAccount(): boolean;
1157
+ get accountIdHashStr(): string | undefined;
1158
+ get address(): string | undefined;
1159
+ get chainId(): number | string | undefined;
1160
+ get apiBaseUrl(): string | undefined;
1161
+ private updateState;
1162
+ private _bindEvents;
1163
+ private _checkAccount;
1164
+ private _checkAccountExist;
1165
+ private _restoreSubAccount;
1166
+ restoreSubAccount(): Promise<AccountState>;
1167
+ createAccount(): Promise<any>;
1168
+ createSubAccount(description?: string): Promise<any>;
1169
+ updateSubAccount({ subAccountId, description, }: {
1170
+ subAccountId: string;
1171
+ description?: string;
1172
+ }): Promise<any>;
1173
+ switchAccount(accountId: string): void;
1174
+ getSubAccounts(): Promise<({
1175
+ sub_account_id: string;
1176
+ description: string;
1177
+ } & {
1178
+ holding: API.Holding[];
1179
+ })[]>;
1180
+ getSubAccountBalances(): Promise<Record<string, API.Holding[]>>;
1181
+ /**
1182
+ * refresh sub account balances
1183
+ * @since 2.3.0
1184
+ */
1185
+ refreshSubAccountBalances(): Promise<Record<string, API.Holding[]>>;
1186
+ /**
1187
+ * @since 2.3.0
1188
+ * if you are using main account orderly key, you can create api key for sub account
1189
+ */
1190
+ createSubAccountApiKey(
1191
+ /**
1192
+ * expiration days
1193
+ */
1194
+ expiration: number, options: {
1195
+ tag?: string;
1196
+ scope?: string;
1197
+ subAccountId: string;
1198
+ }): Promise<{
1199
+ key: string;
1200
+ secretKey: string;
1201
+ }>;
1202
+ createApiKey(
1203
+ /**
1204
+ * expiration days
1205
+ */
1206
+ expiration: number, options?: {
1207
+ tag?: string;
1208
+ scope?: string;
1209
+ }): Promise<{
1210
+ key: string;
1211
+ secretKey: string;
1212
+ }>;
1213
+ createOrderlyKey(expiration?: number, options?: {
1214
+ tag?: string;
1215
+ scope?: string;
1216
+ }): Promise<any>;
1217
+ private generateApiKey;
1218
+ importOrderlyKey(options: {
1219
+ secretKey: string;
1220
+ address: string;
1221
+ chainNamespace: ChainNamespace;
1222
+ }): Promise<true | undefined>;
1223
+ checkOrderlyKey(address: string, orderlyKey: OrderlyKeyPair, accountId: string): Promise<true | undefined>;
1224
+ /**
1225
+ * @since 2.3.0
1226
+ * settle sub account pnl
1227
+ */
1228
+ settleSubAccount(options?: {
1229
+ /**
1230
+ * if you are main account and want to settle the sub account, you need to pass the subAccountId
1231
+ * if you are sub account, not need to pass the subAccountId
1232
+ * */
1233
+ subAccountId?: string;
1234
+ }): Promise<any>;
1235
+ /** set main account pnl */
1236
+ settle(options?: {
1237
+ /**
1238
+ * if you are main account, you don't need to pass the accountId
1239
+ * if you are sub account and you want to settle the main account, you need to pass main account id
1240
+ * */
1241
+ accountId?: string;
1242
+ }): Promise<any>;
1243
+ private signData;
1244
+ destroyOrderlyKey(): Promise<void>;
1245
+ disconnect(): Promise<void>;
1246
+ switchChainId(chainId: number | string): void;
1247
+ private parseChainId;
1248
+ private _checkOrderlyKeyState;
1249
+ get signer(): Signer;
1250
+ get walletAdapter(): WalletAdapter<any> | undefined;
1251
+ private _getRegisterationNonce;
1252
+ private _getTimestampFromServer;
1253
+ private _getAccountInfo;
1254
+ private _getSettleNonce;
1255
+ private _simpleFetch;
1256
+ private _getVaultOperationNonce;
1257
+ getAdditionalInfo(): Record<string, any> | null;
1258
+ get on(): <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
1259
+ get once(): <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
1260
+ get off(): <T extends string | symbol>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean) => EventEmitter<string | symbol, any>;
1261
+ /**
1262
+ * Generate DexRequest message for DEX operations
1263
+ * @param inputs DexRequest parameters
1264
+ * @returns Signed message and domain
1265
+ */
1266
+ generateDexRequest(inputs: {
1267
+ payloadType: number;
1268
+ amount: string;
1269
+ vaultId: string;
1270
+ token: string;
1271
+ domain: SignatureDomain;
1272
+ }): Promise<{
1273
+ message: {
1274
+ [key: string]: any;
1275
+ chainType: ChainType;
1276
+ };
1277
+ signatured: string;
1278
+ domain: SignatureDomain;
1279
+ }>;
1280
+ /**
1281
+ * Signs a GET MessageFactor payload with the current timestamp.
1282
+ * @param url The URL for the GET request
1283
+ * @returns The signature
1284
+ */
1285
+ private signGetMessageFactor;
1286
+ }
1287
+
1288
+ type ChainNamespaceType = (typeof ChainNamespace)[keyof typeof ChainNamespace];
1289
+ type URLS = {
1290
+ apiBaseUrl: string;
1291
+ publicWsUrl: string;
1292
+ privateWsUrl: string;
1293
+ operatorUrl: Record<ChainNamespaceType, string>;
1294
+ };
1295
+ declare const API_URLS: Record<NetworkId, URLS>;
1296
+ declare class DefaultConfigStore implements ConfigStore {
1297
+ protected map: Map<ConfigKey, any>;
1298
+ constructor(init: Partial<Record<ConfigKey, any>>);
1299
+ get<T>(key: ConfigKey): T;
1300
+ getOr<T>(key: ConfigKey, defaultValue: T): T;
1301
+ set<T>(key: ConfigKey, value: T): void;
1302
+ clear(): void;
1303
+ }
1304
+
1305
+ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config> {
1306
+ abstract generateRegisterAccountMessage(inputs: RegisterAccountInputs): Promise<Message>;
1307
+ abstract generateWithdrawMessage(inputs: WithdrawInputs): Promise<Message & {
1308
+ domain: SignatureDomain;
1309
+ }>;
1310
+ abstract generateInternalTransferMessage(inputs: InternalTransferInputs): Promise<Message & {
1311
+ domain: SignatureDomain;
1312
+ }>;
1313
+ abstract generateSettleMessage(inputs: SettleInputs): Promise<Message & {
1314
+ domain: SignatureDomain;
1315
+ }>;
1316
+ abstract generateAddOrderlyKeyMessage(inputs: AddOrderlyKeyInputs): Promise<Message>;
1317
+ abstract generateDexRequestMessage(inputs: DexRequestInputs): Promise<Message & {
1318
+ domain: SignatureDomain;
1319
+ }>;
1320
+ abstract getBalance(): Promise<bigint>;
1321
+ abstract chainNamespace: ChainNamespace;
1322
+ signMessageByOrderlyKey(payload: any): Promise<SignedMessagePayload>;
1323
+ abstract call(address: string, method: string, params: any[], options?: {
1324
+ abi: any;
1325
+ }): Promise<any>;
1326
+ abstract sendTransaction(contractAddress: string, method: string, payload: {
1327
+ from: string;
1328
+ to?: string;
1329
+ data: any[];
1330
+ value?: bigint;
1331
+ }, options: {
1332
+ abi: any;
1333
+ }): Promise<any>;
1334
+ abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1335
+ abi: any;
1336
+ }): Promise<any>;
1337
+ get address(): string;
1338
+ get chainId(): number;
1339
+ active(config: Config): void;
1340
+ abstract deactivate(): void;
1341
+ update(config: Config): void;
1342
+ generateSecretKey(): string;
1343
+ parseUnits(amount: string, decimals: number): string;
1344
+ formatUnits(amount: BigNumberish, decimals: number): string;
1345
+ on(eventName: string, listener: (...args: any[]) => void): void;
1346
+ off(eventName: string, listener: (...args: any[]) => void): void;
1347
+ abstract pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
1348
+ }
1349
+
1350
+ interface Ed25519Keypair {
1351
+ secretKey: string;
1352
+ publicKey: string;
1353
+ }
1354
+
1355
+ interface IWalletAdapter {
1356
+ get chainId(): number;
1357
+ get addresses(): string;
1358
+ /**
1359
+ * Set the chain id
1360
+ */
1361
+ set chainId(chainId: number);
1362
+ parseUnits: (amount: string, decimals: number) => string;
1363
+ formatUnits: (amount: string, decimals: number) => string;
1364
+ send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
1365
+ sendTransaction(contractAddress: string, method: string, payload: {
1366
+ from: string;
1367
+ to?: string;
1368
+ data: any[];
1369
+ value?: bigint;
1370
+ }, options: {
1371
+ abi: any;
1372
+ }): Promise<TransactionResponse>;
1373
+ getTransactionRecipect: (txHash: string) => Promise<any>;
1374
+ signTypedData: (address: string, data: any) => Promise<string>;
1375
+ pollTransactionReceiptWithBackoff: (txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number) => Promise<any>;
1376
+ getBalance: (userAddress: string) => Promise<any>;
1377
+ call(address: string, method: string, params: any, options: {
1378
+ abi: any;
1379
+ }): Promise<any>;
1380
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any, options: {
1381
+ abi: any;
1382
+ }): Promise<any>;
1383
+ on(eventName: any, listener: any): void;
1384
+ off(eventName: any, listener: any): void;
1385
+ }
1386
+ type WalletAdapterOptions = {
1387
+ provider: any;
1388
+ address: string;
1389
+ chain: {
1390
+ id: number;
1391
+ };
1392
+ };
1393
+ type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
1394
+
1395
+ declare class EtherAdapter implements IWalletAdapter {
1396
+ private provider?;
1397
+ private _chainId;
1398
+ private _address;
1399
+ constructor(options: WalletAdapterOptions);
1400
+ parseUnits(amount: string, decimals: number): string;
1401
+ formatUnits(amount: string, decimals: number): string;
1402
+ getBalance(userAddress: string): Promise<any>;
1403
+ deposit(from: string, to: string, amount: string): Promise<any>;
1404
+ call(address: string, method: string, params: any[], options: {
1405
+ abi: any;
1406
+ }): Promise<any>;
1407
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1408
+ abi: any;
1409
+ }): Promise<any>;
1410
+ get chainId(): number;
1411
+ set chainId(chainId: number);
1412
+ get addresses(): string;
1413
+ send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
1414
+ sendTransaction(contractAddress: string, method: string, payload: {
1415
+ from: string;
1416
+ to?: string;
1417
+ data: any[];
1418
+ value?: bigint;
1419
+ }, options: {
1420
+ abi: any;
1421
+ }): Promise<ethers.TransactionResponse>;
1422
+ getTransactionRecipect(txHash: string): Promise<void>;
1423
+ pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<ethers.TransactionReceipt>;
1424
+ private estimateGas;
1425
+ signTypedData(address: string, data: any): Promise<any>;
1426
+ verify(data: {
1427
+ domain: any;
1428
+ message: any;
1429
+ types: any;
1430
+ }, signature: string): Promise<void>;
1431
+ on(eventName: any, listener: any): void;
1432
+ off(eventName: any, listener: any): void;
1433
+ getContract(address: string, abi: any): ethers.Contract;
1434
+ }
1435
+
1436
+ export { API_URLS, Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, type DexRequestInputs, EVENT_NAMES, type Ed25519Keypair, EtherAdapter, type IContract, type InternalTransferInputs, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type SubAccount, type URLS, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateDexRequestMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };