@orderly.network/core 1.5.13 → 2.0.0-alpha.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/dist/index.d.mts +228 -72
- package/dist/index.d.ts +228 -72
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
2
|
export { default as EventEmitter } from 'eventemitter3';
|
|
3
|
-
import { definedTypes, API, AccountStatusEnum } from '@orderly.network/types';
|
|
3
|
+
import { definedTypes, API, ChainNamespace, AccountStatusEnum } from '@orderly.network/types';
|
|
4
|
+
import { BigNumberish } from 'ethers/src.ts/utils';
|
|
4
5
|
import { parseUnits, TransactionResponse, ethers } from 'ethers';
|
|
5
6
|
|
|
6
7
|
interface OrderlyKeyPair {
|
|
@@ -24,6 +25,7 @@ interface OrderlyKeyStore {
|
|
|
24
25
|
setAccountId: (address: string, accountId: string) => void;
|
|
25
26
|
getAddress: () => string | undefined | null;
|
|
26
27
|
setAddress: (address: string) => void;
|
|
28
|
+
removeAddress: () => void;
|
|
27
29
|
generateKey: () => OrderlyKeyPair;
|
|
28
30
|
cleanKey: (address: string, key: string) => void;
|
|
29
31
|
cleanAllKey: (address: string) => void;
|
|
@@ -37,6 +39,7 @@ declare abstract class BaseKeyStore implements OrderlyKeyStore {
|
|
|
37
39
|
abstract setAccountId(address: string, accountId: string): void;
|
|
38
40
|
abstract getAddress(): string | undefined | null;
|
|
39
41
|
abstract setAddress(address: string): void;
|
|
42
|
+
abstract removeAddress(): void;
|
|
40
43
|
abstract generateKey(): OrderlyKeyPair;
|
|
41
44
|
abstract setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
|
|
42
45
|
abstract cleanAllKey(address: string): void;
|
|
@@ -49,6 +52,7 @@ declare class LocalStorageStore extends BaseKeyStore {
|
|
|
49
52
|
setAccountId(address: string, accountId: string): void;
|
|
50
53
|
getAddress(): string | undefined | null;
|
|
51
54
|
setAddress(address: string): void;
|
|
55
|
+
removeAddress(): void;
|
|
52
56
|
generateKey(): OrderlyKeyPair;
|
|
53
57
|
setKey(address: string, orderlyKey: OrderlyKeyPair): void;
|
|
54
58
|
cleanAllKey(address: string): void;
|
|
@@ -65,6 +69,7 @@ declare class MockKeyStore implements OrderlyKeyStore {
|
|
|
65
69
|
setAccountId(accountId: string): void;
|
|
66
70
|
getAddress(): string;
|
|
67
71
|
setAddress(address: string): void;
|
|
72
|
+
removeAddress(): void;
|
|
68
73
|
setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
|
|
69
74
|
cleanAllKey(): void;
|
|
70
75
|
cleanKey(key: string): void;
|
|
@@ -124,7 +129,7 @@ declare function parseBrokerHash(brokerId: string): string;
|
|
|
124
129
|
declare function parseAccountId(userAddress: string, brokerId: string): string;
|
|
125
130
|
declare function parseTokenHash(tokenSymbol: string): string;
|
|
126
131
|
declare function calculateStringHash(input: string): string;
|
|
127
|
-
declare function formatByUnits(amount:
|
|
132
|
+
declare function formatByUnits(amount: BigNumberish, unit?: number | "ether" | "gwei"): string;
|
|
128
133
|
declare function isHex(value: string): boolean;
|
|
129
134
|
declare function isHexString(value: string): boolean;
|
|
130
135
|
declare const getGlobalObject: () => typeof globalThis;
|
|
@@ -214,7 +219,10 @@ declare function generateAddOrderlyKeyMessage(inputs: {
|
|
|
214
219
|
primaryType: keyof typeof definedTypes;
|
|
215
220
|
expiration?: number;
|
|
216
221
|
timestamp?: number;
|
|
222
|
+
scope?: string;
|
|
223
|
+
tag?: string;
|
|
217
224
|
}): readonly [{
|
|
225
|
+
tag?: string | undefined;
|
|
218
226
|
brokerId: string;
|
|
219
227
|
orderlyKey: string;
|
|
220
228
|
scope: string;
|
|
@@ -229,6 +237,7 @@ declare function generateAddOrderlyKeyMessage(inputs: {
|
|
|
229
237
|
verifyingContract: string;
|
|
230
238
|
};
|
|
231
239
|
message: {
|
|
240
|
+
tag?: string | undefined;
|
|
232
241
|
brokerId: string;
|
|
233
242
|
orderlyKey: string;
|
|
234
243
|
scope: string;
|
|
@@ -236,7 +245,7 @@ declare function generateAddOrderlyKeyMessage(inputs: {
|
|
|
236
245
|
timestamp: number;
|
|
237
246
|
expiration: number;
|
|
238
247
|
};
|
|
239
|
-
primaryType: "
|
|
248
|
+
primaryType: "EIP712Domain" | "Registration" | "Withdraw" | "AddOrderlyKey" | "SettlePnl";
|
|
240
249
|
types: {
|
|
241
250
|
[x: string]: readonly [{
|
|
242
251
|
readonly name: "name";
|
|
@@ -399,6 +408,8 @@ type OrderlyContracts = {
|
|
|
399
408
|
vaultAddress: string;
|
|
400
409
|
vaultAbi: any;
|
|
401
410
|
verifyContractAddress: string;
|
|
411
|
+
solanaUSDCAddress: string;
|
|
412
|
+
solanaVaultAddress: string;
|
|
402
413
|
};
|
|
403
414
|
interface IContract {
|
|
404
415
|
getContractInfoByEnv(): OrderlyContracts;
|
|
@@ -449,6 +460,8 @@ declare class BaseContract implements IContract {
|
|
|
449
460
|
anonymous?: undefined;
|
|
450
461
|
})[];
|
|
451
462
|
vaultAddress: string;
|
|
463
|
+
solanaVaultAddress: string;
|
|
464
|
+
solanaUSDCAddress: string;
|
|
452
465
|
vaultAbi: ({
|
|
453
466
|
inputs: never[];
|
|
454
467
|
stateMutability: string;
|
|
@@ -562,46 +575,6 @@ declare class SimpleDI {
|
|
|
562
575
|
private constructor();
|
|
563
576
|
}
|
|
564
577
|
|
|
565
|
-
interface IWalletAdapter {
|
|
566
|
-
get chainId(): number;
|
|
567
|
-
get addresses(): string;
|
|
568
|
-
/**
|
|
569
|
-
* Set the chain id
|
|
570
|
-
*/
|
|
571
|
-
set chainId(chainId: number);
|
|
572
|
-
parseUnits: (amount: string) => string;
|
|
573
|
-
formatUnits: (amount: string) => string;
|
|
574
|
-
send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
|
|
575
|
-
sendTransaction(contractAddress: string, method: string, payload: {
|
|
576
|
-
from: string;
|
|
577
|
-
to?: string;
|
|
578
|
-
data: any[];
|
|
579
|
-
value?: bigint;
|
|
580
|
-
}, options: {
|
|
581
|
-
abi: any;
|
|
582
|
-
}): Promise<TransactionResponse>;
|
|
583
|
-
getTransactionRecipect: (txHash: string) => Promise<any>;
|
|
584
|
-
signTypedData: (address: string, data: any) => Promise<string>;
|
|
585
|
-
pollTransactionReceiptWithBackoff: (txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number) => Promise<any>;
|
|
586
|
-
getBalance: (userAddress: string) => Promise<any>;
|
|
587
|
-
call(address: string, method: string, params: any, options: {
|
|
588
|
-
abi: any;
|
|
589
|
-
}): Promise<any>;
|
|
590
|
-
callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any, options: {
|
|
591
|
-
abi: any;
|
|
592
|
-
}): Promise<any>;
|
|
593
|
-
on(eventName: any, listener: any): void;
|
|
594
|
-
off(eventName: any, listener: any): void;
|
|
595
|
-
}
|
|
596
|
-
type WalletAdapterOptions = {
|
|
597
|
-
provider: any;
|
|
598
|
-
address: string;
|
|
599
|
-
chain: {
|
|
600
|
-
id: number;
|
|
601
|
-
};
|
|
602
|
-
};
|
|
603
|
-
type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
|
|
604
|
-
|
|
605
578
|
declare class Assets {
|
|
606
579
|
private readonly configStore;
|
|
607
580
|
private readonly contractManger;
|
|
@@ -613,7 +586,6 @@ declare class Assets {
|
|
|
613
586
|
amount: string | number;
|
|
614
587
|
allowCrossChainWithdraw: boolean;
|
|
615
588
|
}): Promise<any>;
|
|
616
|
-
private _generateWithdrawMessage;
|
|
617
589
|
private getWithdrawalNonce;
|
|
618
590
|
getNativeBalance(options?: {
|
|
619
591
|
decimals?: number;
|
|
@@ -621,26 +593,119 @@ declare class Assets {
|
|
|
621
593
|
getBalance(address?: string, options?: {
|
|
622
594
|
decimals?: number;
|
|
623
595
|
}): Promise<string>;
|
|
624
|
-
getBalanceByAddress(address: string
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
596
|
+
getBalanceByAddress(address: string, options?: {
|
|
597
|
+
decimals?: number;
|
|
598
|
+
}): Promise<string>;
|
|
599
|
+
getAllowance(inputs?: string | {
|
|
600
|
+
address?: string;
|
|
601
|
+
vaultAddress?: string;
|
|
602
|
+
decimals?: number;
|
|
603
|
+
}, _vaultAddress?: string): Promise<string>;
|
|
604
|
+
approve(inputs?: string | {
|
|
605
|
+
address?: string;
|
|
628
606
|
amount?: string;
|
|
607
|
+
vaultAddress?: string;
|
|
608
|
+
decimals?: number;
|
|
609
|
+
}, _amount?: string, _vaultAddress?: string): Promise<any>;
|
|
610
|
+
approveByAddress(inputs: {
|
|
629
611
|
address: string;
|
|
612
|
+
amount?: string;
|
|
613
|
+
decimals?: number;
|
|
630
614
|
}): Promise<any>;
|
|
631
|
-
private _approve;
|
|
632
|
-
getDepositData(amount: string): {
|
|
633
|
-
accountId: string | undefined;
|
|
634
|
-
brokerHash: string;
|
|
635
|
-
tokenHash: string;
|
|
636
|
-
tokenAmount: string;
|
|
637
|
-
};
|
|
638
615
|
getDepositFee(amount: string, chain: API.NetworkInfos): Promise<any>;
|
|
639
|
-
deposit(amount: string, fee?: bigint): Promise<
|
|
616
|
+
deposit(amount: string, fee?: bigint): Promise<any>;
|
|
640
617
|
private _simpleFetch;
|
|
641
618
|
get usdcAddress(): string;
|
|
642
619
|
}
|
|
643
620
|
|
|
621
|
+
type ChainType = "EVM" | "SOL";
|
|
622
|
+
interface Message {
|
|
623
|
+
message: {
|
|
624
|
+
chainType: ChainType;
|
|
625
|
+
[key: string]: any;
|
|
626
|
+
};
|
|
627
|
+
signatured: string;
|
|
628
|
+
}
|
|
629
|
+
type RegisterAccountInputs = {
|
|
630
|
+
brokerId: string;
|
|
631
|
+
registrationNonce: number;
|
|
632
|
+
timestamp: number;
|
|
633
|
+
};
|
|
634
|
+
type WithdrawInputs = {
|
|
635
|
+
brokerId: string;
|
|
636
|
+
receiver: string;
|
|
637
|
+
token: string;
|
|
638
|
+
amount: string;
|
|
639
|
+
nonce: number;
|
|
640
|
+
timestamp: number;
|
|
641
|
+
verifyContract?: string;
|
|
642
|
+
};
|
|
643
|
+
type SettleInputs = {
|
|
644
|
+
brokerId: string;
|
|
645
|
+
settlePnlNonce: string;
|
|
646
|
+
timestamp: number;
|
|
647
|
+
verifyContract?: string;
|
|
648
|
+
};
|
|
649
|
+
type AddOrderlyKeyInputs = {
|
|
650
|
+
publicKey: string;
|
|
651
|
+
brokerId: string;
|
|
652
|
+
expiration: number;
|
|
653
|
+
timestamp: number;
|
|
654
|
+
scope?: string;
|
|
655
|
+
tag?: string;
|
|
656
|
+
};
|
|
657
|
+
interface WalletAdapter<Config = any> {
|
|
658
|
+
chainNamespace: ChainNamespace;
|
|
659
|
+
get chainId(): number;
|
|
660
|
+
get address(): string;
|
|
661
|
+
set chainId(chainId: number);
|
|
662
|
+
set address(addresses: string);
|
|
663
|
+
active(config: Config): void;
|
|
664
|
+
update(config: Config): void;
|
|
665
|
+
deactivate(): void;
|
|
666
|
+
generateSecretKey(): string;
|
|
667
|
+
/**
|
|
668
|
+
* business methods
|
|
669
|
+
*/
|
|
670
|
+
generateRegisterAccountMessage(inputs: RegisterAccountInputs): Promise<Message>;
|
|
671
|
+
generateWithdrawMessage(inputs: WithdrawInputs): Promise<Message & {
|
|
672
|
+
domain: SignatureDomain;
|
|
673
|
+
}>;
|
|
674
|
+
generateSettleMessage(inputs: SettleInputs): Promise<Message & {
|
|
675
|
+
domain: SignatureDomain;
|
|
676
|
+
}>;
|
|
677
|
+
generateAddOrderlyKeyMessage(inputs: AddOrderlyKeyInputs): Promise<Message>;
|
|
678
|
+
/**
|
|
679
|
+
* ===== general methods =====
|
|
680
|
+
*/
|
|
681
|
+
/**
|
|
682
|
+
* call contract
|
|
683
|
+
*/
|
|
684
|
+
call(address: string, method: string, params: any[], options?: {
|
|
685
|
+
abi: any;
|
|
686
|
+
}): Promise<any>;
|
|
687
|
+
/**
|
|
688
|
+
* send transaction
|
|
689
|
+
*/
|
|
690
|
+
sendTransaction(contractAddress: string, method: string, payload: {
|
|
691
|
+
from: string;
|
|
692
|
+
to?: string;
|
|
693
|
+
data: any[];
|
|
694
|
+
value?: bigint;
|
|
695
|
+
}, options: {
|
|
696
|
+
abi: any;
|
|
697
|
+
}): Promise<any>;
|
|
698
|
+
callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
699
|
+
abi: any;
|
|
700
|
+
}): Promise<any>;
|
|
701
|
+
getBalance(): Promise<bigint>;
|
|
702
|
+
pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
|
|
703
|
+
parseUnits: (amount: string, decimals?: number) => string;
|
|
704
|
+
formatUnits: (amount: BigNumberish, decimals?: number) => string;
|
|
705
|
+
on(eventName: string, listener: (...args: any[]) => void): void;
|
|
706
|
+
off(eventName: string, listener: (...args: any[]) => void): void;
|
|
707
|
+
}
|
|
708
|
+
|
|
644
709
|
interface AccountState {
|
|
645
710
|
status: AccountStatusEnum;
|
|
646
711
|
/**
|
|
@@ -650,10 +715,12 @@ interface AccountState {
|
|
|
650
715
|
accountId?: string;
|
|
651
716
|
userId?: string;
|
|
652
717
|
address?: string;
|
|
718
|
+
chainNamespace?: ChainNamespace;
|
|
653
719
|
/** new account */
|
|
654
720
|
isNew?: boolean;
|
|
655
721
|
connectWallet?: {
|
|
656
722
|
name: string;
|
|
723
|
+
chainId: number;
|
|
657
724
|
};
|
|
658
725
|
}
|
|
659
726
|
/**
|
|
@@ -667,16 +734,14 @@ interface AccountState {
|
|
|
667
734
|
declare class Account {
|
|
668
735
|
private readonly configStore;
|
|
669
736
|
readonly keyStore: OrderlyKeyStore;
|
|
670
|
-
private readonly getWalletAdapter;
|
|
671
737
|
static instanceName: string;
|
|
672
738
|
private _singer?;
|
|
673
739
|
private _ee;
|
|
740
|
+
private walletAdapterManager;
|
|
674
741
|
assetsManager: Assets;
|
|
675
742
|
private _state;
|
|
676
743
|
private readonly contractManger;
|
|
677
|
-
|
|
678
|
-
constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, getWalletAdapter: getWalletAdapterFunc, // private readonly walletAdapterClass: { new (options: any): WalletAdapter } // private walletClient?: WalletClient
|
|
679
|
-
options?: Partial<{
|
|
744
|
+
constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletAdapters: WalletAdapter[], options?: Partial<{
|
|
680
745
|
/**
|
|
681
746
|
* smart contract configuration class
|
|
682
747
|
* provide contract address and abi
|
|
@@ -684,12 +749,13 @@ declare class Account {
|
|
|
684
749
|
contracts: IContract;
|
|
685
750
|
}>);
|
|
686
751
|
logout(): void;
|
|
687
|
-
setAddress(address: string, wallet
|
|
752
|
+
setAddress(address: string, wallet: {
|
|
688
753
|
provider: any;
|
|
689
754
|
chain: {
|
|
690
755
|
id: string | number;
|
|
756
|
+
namespace: ChainNamespace;
|
|
691
757
|
};
|
|
692
|
-
wallet
|
|
758
|
+
wallet: {
|
|
693
759
|
name: string;
|
|
694
760
|
};
|
|
695
761
|
[key: string]: any;
|
|
@@ -699,28 +765,35 @@ declare class Account {
|
|
|
699
765
|
get accountIdHashStr(): string | undefined;
|
|
700
766
|
get address(): string | undefined;
|
|
701
767
|
get chainId(): number | string | undefined;
|
|
702
|
-
/**
|
|
703
|
-
* set user positions count
|
|
704
|
-
*/
|
|
705
768
|
private _bindEvents;
|
|
706
769
|
private _checkAccount;
|
|
707
770
|
private _checkAccountExist;
|
|
708
771
|
createAccount(): Promise<any>;
|
|
709
|
-
|
|
710
|
-
|
|
772
|
+
createApiKey(expiration?: number, options?: {
|
|
773
|
+
tag?: string;
|
|
774
|
+
scope?: string;
|
|
775
|
+
}): Promise<{
|
|
776
|
+
key: string;
|
|
777
|
+
secretKey: string;
|
|
778
|
+
}>;
|
|
779
|
+
createOrderlyKey(expiration?: number, options?: {
|
|
780
|
+
tag?: string;
|
|
781
|
+
scope?: string;
|
|
782
|
+
}): Promise<any>;
|
|
783
|
+
private generateAPiKey;
|
|
711
784
|
settle(): Promise<any>;
|
|
785
|
+
destoryOrderlyKey(): Promise<void>;
|
|
712
786
|
disconnect(): Promise<void>;
|
|
713
787
|
switchChainId(chainId: number | string): void;
|
|
714
788
|
private parseChainId;
|
|
715
789
|
private _checkOrderlyKeyState;
|
|
716
790
|
get signer(): Signer;
|
|
717
|
-
get
|
|
791
|
+
get walletAdapter(): WalletAdapter<any> | undefined;
|
|
718
792
|
private _getRegisterationNonce;
|
|
719
793
|
private _getTimestampFromServer;
|
|
720
794
|
private _getAccountInfo;
|
|
721
795
|
private _getSettleNonce;
|
|
722
796
|
private _simpleFetch;
|
|
723
|
-
getDomain(onChainDomain?: boolean): SignatureDomain;
|
|
724
797
|
get on(): <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
|
|
725
798
|
get once(): <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
|
|
726
799
|
get off(): <T extends string | symbol>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean | undefined) => EventEmitter<string | symbol, any>;
|
|
@@ -735,13 +808,96 @@ declare class DefaultConfigStore implements ConfigStore {
|
|
|
735
808
|
clear(): void;
|
|
736
809
|
}
|
|
737
810
|
|
|
811
|
+
declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config> {
|
|
812
|
+
abstract generateRegisterAccountMessage(inputs: RegisterAccountInputs): Promise<Message>;
|
|
813
|
+
abstract generateWithdrawMessage(inputs: WithdrawInputs): Promise<Message & {
|
|
814
|
+
domain: SignatureDomain;
|
|
815
|
+
}>;
|
|
816
|
+
abstract generateSettleMessage(inputs: SettleInputs): Promise<Message & {
|
|
817
|
+
domain: SignatureDomain;
|
|
818
|
+
}>;
|
|
819
|
+
abstract generateAddOrderlyKeyMessage(inputs: AddOrderlyKeyInputs): Promise<Message>;
|
|
820
|
+
abstract getBalance(): Promise<bigint>;
|
|
821
|
+
abstract chainNamespace: ChainNamespace;
|
|
822
|
+
abstract call(address: string, method: string, params: any[], options?: {
|
|
823
|
+
abi: any;
|
|
824
|
+
}): Promise<any>;
|
|
825
|
+
abstract sendTransaction(contractAddress: string, method: string, payload: {
|
|
826
|
+
from: string;
|
|
827
|
+
to?: string;
|
|
828
|
+
data: any[];
|
|
829
|
+
value?: bigint;
|
|
830
|
+
}, options: {
|
|
831
|
+
abi: any;
|
|
832
|
+
}): Promise<any>;
|
|
833
|
+
abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
834
|
+
abi: any;
|
|
835
|
+
}): Promise<any>;
|
|
836
|
+
get address(): string;
|
|
837
|
+
get chainId(): number;
|
|
838
|
+
active(config: Config): void;
|
|
839
|
+
abstract deactivate(): void;
|
|
840
|
+
update(config: Config): void;
|
|
841
|
+
generateSecretKey(): string;
|
|
842
|
+
parseUnits(amount: string, decimals?: number): string;
|
|
843
|
+
formatUnits(amount: BigNumberish, decimals?: number): string;
|
|
844
|
+
on(eventName: string, listener: (...args: any[]) => void): void;
|
|
845
|
+
off(eventName: string, listener: (...args: any[]) => void): void;
|
|
846
|
+
abstract pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface Ed25519Keypair {
|
|
850
|
+
secretKey: string;
|
|
851
|
+
publicKey: string;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
interface IWalletAdapter {
|
|
855
|
+
get chainId(): number;
|
|
856
|
+
get addresses(): string;
|
|
857
|
+
/**
|
|
858
|
+
* Set the chain id
|
|
859
|
+
*/
|
|
860
|
+
set chainId(chainId: number);
|
|
861
|
+
parseUnits: (amount: string, decimals?: number) => string;
|
|
862
|
+
formatUnits: (amount: string, decimals?: number) => string;
|
|
863
|
+
send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
|
|
864
|
+
sendTransaction(contractAddress: string, method: string, payload: {
|
|
865
|
+
from: string;
|
|
866
|
+
to?: string;
|
|
867
|
+
data: any[];
|
|
868
|
+
value?: bigint;
|
|
869
|
+
}, options: {
|
|
870
|
+
abi: any;
|
|
871
|
+
}): Promise<TransactionResponse>;
|
|
872
|
+
getTransactionRecipect: (txHash: string) => Promise<any>;
|
|
873
|
+
signTypedData: (address: string, data: any) => Promise<string>;
|
|
874
|
+
pollTransactionReceiptWithBackoff: (txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number) => Promise<any>;
|
|
875
|
+
getBalance: (userAddress: string) => Promise<any>;
|
|
876
|
+
call(address: string, method: string, params: any, options: {
|
|
877
|
+
abi: any;
|
|
878
|
+
}): Promise<any>;
|
|
879
|
+
callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any, options: {
|
|
880
|
+
abi: any;
|
|
881
|
+
}): Promise<any>;
|
|
882
|
+
on(eventName: any, listener: any): void;
|
|
883
|
+
off(eventName: any, listener: any): void;
|
|
884
|
+
}
|
|
885
|
+
type WalletAdapterOptions = {
|
|
886
|
+
provider: any;
|
|
887
|
+
address: string;
|
|
888
|
+
chain: {
|
|
889
|
+
id: number;
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
|
|
893
|
+
|
|
738
894
|
declare class EtherAdapter implements IWalletAdapter {
|
|
739
895
|
private provider?;
|
|
740
896
|
private _chainId;
|
|
741
897
|
private _address;
|
|
742
898
|
constructor(options: WalletAdapterOptions);
|
|
743
|
-
parseUnits(amount: string): string;
|
|
744
|
-
formatUnits(amount: string): string;
|
|
899
|
+
parseUnits(amount: string, decimals?: number): string;
|
|
900
|
+
formatUnits(amount: string, decimals?: number): string;
|
|
745
901
|
getBalance(userAddress: string): Promise<any>;
|
|
746
902
|
deposit(from: string, to: string, amount: string): Promise<any>;
|
|
747
903
|
call(address: string, method: string, params: any[], options: {
|
|
@@ -776,4 +932,4 @@ declare class EtherAdapter implements IWalletAdapter {
|
|
|
776
932
|
getContract(address: string, abi: any): ethers.Contract;
|
|
777
933
|
}
|
|
778
934
|
|
|
779
|
-
export { Account, type AccountState, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, type ConfigKey, type ConfigStore, DefaultConfigStore, EtherAdapter, type IContract, LocalStorageStore, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type SignedMessagePayload, type Signer, SimpleDI, type
|
|
935
|
+
export { Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, type Ed25519Keypair, EtherAdapter, type IContract, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };
|