@orderly.network/core 2.9.1 → 2.10.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 CHANGED
@@ -2,7 +2,7 @@ import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
3
  import { definedTypes, ChainNamespace, API, AccountStatusEnum, NetworkId } from '@orderly.network/types';
4
4
  import { BigNumberish } from 'ethers/src.ts/utils';
5
- import { parseUnits, TransactionResponse, ethers } from 'ethers';
5
+ import { parseUnits, TransactionResponse } from 'ethers';
6
6
 
7
7
  interface OrderlyKeyPair {
8
8
  getPublicKey(): Promise<string>;
@@ -510,20 +510,30 @@ interface ConfigStore {
510
510
  * Orderly contracts information
511
511
  */
512
512
  type OrderlyContracts = {
513
- usdcAddress: string;
514
513
  usdcAbi: any;
515
514
  erc20Abi: any;
516
- vaultAddress: string;
517
515
  vaultAbi: any;
518
516
  verifyContractAddress: string;
517
+ usdcAddress: string;
518
+ /** @deprecated, will be removed in the future */
519
+ vaultAddress: string;
520
+ /** @deprecated, will be removed in the future */
519
521
  solanaUSDCAddress: string;
522
+ /** @deprecated, will be removed in the future */
520
523
  solanaVaultAddress: string;
524
+ /** @deprecated, will be removed in the future */
521
525
  storyTestnetVaultAddress?: string;
526
+ /** @deprecated, will be removed in the future */
522
527
  monadTestnetVaultAddress?: string;
528
+ /** @deprecated, will be removed in the future */
523
529
  monadTestnetUSDCAddress?: string;
530
+ /** @deprecated, will be removed in the future */
524
531
  abstractVaultAddress?: string;
532
+ /** @deprecated, will be removed in the future */
525
533
  abstractUSDCAddress?: string;
534
+ /** @deprecated, will be removed in the future */
526
535
  bscVaultAddress?: string;
536
+ /** @deprecated, will be removed in the future */
527
537
  bscUSDCAddress?: string;
528
538
  };
529
539
  interface IContract {
@@ -934,10 +944,23 @@ interface WalletAdapter<Config = any> {
934
944
  }, options: {
935
945
  abi: any;
936
946
  }): Promise<any>;
947
+ /**
948
+ * Estimate gas for a contract call (optional, e.g. EVM adapters).
949
+ * Returns gas limit as bigint. Gas cost in native token = gasLimit * gasPrice.
950
+ */
951
+ estimateGasFee?(contractAddress: string, method: string, payload: {
952
+ from: string;
953
+ to?: string;
954
+ data: any[];
955
+ value?: bigint;
956
+ }, options: {
957
+ abi: any;
958
+ }): Promise<bigint>;
937
959
  callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
938
960
  abi: any;
939
961
  }): Promise<any>;
940
962
  getBalance(): Promise<bigint>;
963
+ getBalances(addresses: string[]): Promise<any>;
941
964
  pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
942
965
  parseUnits: (amount: string, decimals: number) => string;
943
966
  formatUnits: (amount: BigNumberish, decimals: number) => string;
@@ -950,49 +973,29 @@ declare class Assets {
950
973
  private readonly contractManger;
951
974
  private readonly account;
952
975
  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
- receiver?: string;
969
- }): Promise<any>;
970
- private getWithdrawalNonce;
971
- getNativeBalance(options?: {
972
- /** token decimals on chain, default is 18 */
973
- decimals?: number;
974
- }): Promise<string>;
975
976
  getBalance(
976
977
  /** token address */
977
978
  address: string, options: {
978
- /** token decimals on chain, default is 18 */
979
+ /** token decimals on chain */
980
+ decimals?: number;
981
+ }): Promise<string>;
982
+ getNativeBalance(options?: {
983
+ /** token decimals on chain */
979
984
  decimals?: number;
980
985
  }): Promise<string>;
981
986
  /**
982
987
  * @deprecated use getBalance instead, will be removed in the future
983
988
  */
984
- getBalanceByAddress(
985
- /** token address */
986
- address: string, options?: {
987
- /** token decimals on chain, default is 18 */
989
+ getBalanceByAddress(address: string, options?: {
988
990
  decimals?: number;
989
991
  }): Promise<string>;
992
+ getBalances(tokens: API.TokenInfo[]): Promise<Record<string, string>>;
990
993
  getAllowance(inputs: {
991
994
  /** token address */
992
995
  address: string;
993
996
  /** vault address */
994
997
  vaultAddress?: string;
995
- /** token decimals on chain, default is 18 */
998
+ /** token decimals on chain */
996
999
  decimals?: number;
997
1000
  }): Promise<string>;
998
1001
  approve(inputs: {
@@ -1000,11 +1003,11 @@ declare class Assets {
1000
1003
  address?: string;
1001
1004
  /** vault address */
1002
1005
  vaultAddress?: string;
1006
+ /** token decimals on chain */
1007
+ decimals: number;
1003
1008
  /** token amount */
1004
1009
  amount?: string;
1005
1010
  isSetMaxValue?: boolean;
1006
- /** token decimals on chain, default is 18 */
1007
- decimals: number;
1008
1011
  }): Promise<any>;
1009
1012
  /**
1010
1013
  * @deprecated use approve instead, will be removed in the future
@@ -1014,38 +1017,93 @@ declare class Assets {
1014
1017
  address: string;
1015
1018
  /** token amount */
1016
1019
  amount?: string;
1017
- /** token decimals on chain, default is 18 */
1020
+ /** token decimals on chain */
1018
1021
  decimals: number;
1019
1022
  }): Promise<any>;
1020
1023
  getDepositFee(inputs: {
1021
1024
  amount: string;
1022
1025
  /** chain info */
1023
1026
  chain: API.NetworkInfos;
1024
- /** token decimals on chain, default is 18 */
1027
+ /** token decimals on chain */
1025
1028
  decimals: number;
1026
1029
  token?: string;
1027
1030
  /** token address */
1028
1031
  address?: string;
1029
1032
  }): Promise<any>;
1030
- /** deposit native token */
1031
- depositNativeToken(inputs: {
1033
+ estimateDepositGasFee(inputs: {
1032
1034
  amount: string;
1033
1035
  fee: bigint;
1034
- /** token decimals on chain, default is 18 */
1036
+ /** token decimals on chain */
1035
1037
  decimals: number;
1036
1038
  token?: string;
1037
- }): Promise<any>;
1039
+ /** token address */
1040
+ address?: string;
1041
+ /** vault address */
1042
+ vaultAddress: string;
1043
+ }): Promise<bigint>;
1044
+ estimateNativeDepositGasFee(inputs: {
1045
+ amount: string;
1046
+ fee: bigint;
1047
+ /** token decimals on chain */
1048
+ decimals: number;
1049
+ token?: string;
1050
+ /** token address */
1051
+ address?: string;
1052
+ /** vault address */
1053
+ vaultAddress: string;
1054
+ }): Promise<bigint>;
1055
+ getDepositData(inputs: {
1056
+ amount: string;
1057
+ /** token decimals on chain */
1058
+ decimals: number;
1059
+ /** token symbol */
1060
+ token?: string;
1061
+ /** token address */
1062
+ address?: string;
1063
+ }): Promise<{
1064
+ contractMethod: string;
1065
+ userAddress: string | undefined;
1066
+ fromAddress: string | undefined;
1067
+ depositData: {
1068
+ accountId?: string;
1069
+ brokerHash: string;
1070
+ tokenHash: string;
1071
+ tokenAmount: string;
1072
+ tokenAddress?: string;
1073
+ };
1074
+ contractData: any[];
1075
+ abi: any;
1076
+ }>;
1038
1077
  deposit(inputs: {
1039
1078
  amount: string;
1040
1079
  fee: bigint;
1041
- /** token decimals on chain, default is 18 */
1080
+ /** token decimals on chain */
1042
1081
  decimals: number;
1043
1082
  token?: string;
1044
1083
  /** token address */
1045
1084
  address?: string;
1046
1085
  /** vault address */
1047
- vaultAddress?: string;
1086
+ vaultAddress: string;
1048
1087
  }): Promise<any>;
1088
+ /** deposit native token */
1089
+ depositNativeToken(inputs: {
1090
+ amount: string;
1091
+ fee: bigint;
1092
+ /** token decimals on chain */
1093
+ decimals: number;
1094
+ token?: string;
1095
+ vaultAddress: string;
1096
+ }): Promise<any>;
1097
+ withdraw(inputs: {
1098
+ chainId: number;
1099
+ token: string;
1100
+ amount: string | number;
1101
+ /** orderly withdraw decimals, not chain decimals */
1102
+ decimals: number;
1103
+ receiver?: string;
1104
+ allowCrossChainWithdraw: boolean;
1105
+ }): Promise<any>;
1106
+ private getWithdrawalNonce;
1049
1107
  internalTransfer(inputs: {
1050
1108
  token: string;
1051
1109
  amount: string;
@@ -1053,9 +1111,21 @@ declare class Assets {
1053
1111
  /** orderly token decimals */
1054
1112
  decimals: number;
1055
1113
  }): Promise<any>;
1114
+ /**
1115
+ * Convert non-USDC asset to USDC manually
1116
+ */
1117
+ convert(inputs: {
1118
+ slippage: number;
1119
+ amount: number;
1120
+ /** must NOT be USDC */
1121
+ converted_asset: string;
1122
+ }): Promise<any>;
1056
1123
  private getTransferNonce;
1057
1124
  private _simpleFetch;
1058
1125
  get usdcAddress(): string;
1126
+ private isSolana;
1127
+ private isAbstract;
1128
+ private getAgwGlobalAddress;
1059
1129
  }
1060
1130
 
1061
1131
  type SubAccount = {
@@ -1319,6 +1389,7 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
1319
1389
  domain: SignatureDomain;
1320
1390
  }>;
1321
1391
  abstract getBalance(): Promise<bigint>;
1392
+ abstract getBalances(addresses: string[]): Promise<any>;
1322
1393
  abstract chainNamespace: ChainNamespace;
1323
1394
  signMessageByOrderlyKey(payload: any): Promise<SignedMessagePayload>;
1324
1395
  abstract call(address: string, method: string, params: any[], options?: {
@@ -1335,6 +1406,14 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
1335
1406
  abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1336
1407
  abi: any;
1337
1408
  }): Promise<any>;
1409
+ abstract estimateGasFee(contractAddress: string, method: string, payload: {
1410
+ from: string;
1411
+ to?: string;
1412
+ data: any[];
1413
+ value?: bigint;
1414
+ }, options: {
1415
+ abi: any;
1416
+ }): Promise<bigint>;
1338
1417
  get address(): string;
1339
1418
  get chainId(): number;
1340
1419
  active(config: Config): void;
@@ -1393,45 +1472,4 @@ type WalletAdapterOptions = {
1393
1472
  };
1394
1473
  type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
1395
1474
 
1396
- declare class EtherAdapter implements IWalletAdapter {
1397
- private provider?;
1398
- private _chainId;
1399
- private _address;
1400
- constructor(options: WalletAdapterOptions);
1401
- parseUnits(amount: string, decimals: number): string;
1402
- formatUnits(amount: string, decimals: number): string;
1403
- getBalance(userAddress: string): Promise<any>;
1404
- deposit(from: string, to: string, amount: string): Promise<any>;
1405
- call(address: string, method: string, params: any[], options: {
1406
- abi: any;
1407
- }): Promise<any>;
1408
- callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1409
- abi: any;
1410
- }): Promise<any>;
1411
- get chainId(): number;
1412
- set chainId(chainId: number);
1413
- get addresses(): string;
1414
- send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
1415
- sendTransaction(contractAddress: string, method: string, payload: {
1416
- from: string;
1417
- to?: string;
1418
- data: any[];
1419
- value?: bigint;
1420
- }, options: {
1421
- abi: any;
1422
- }): Promise<ethers.TransactionResponse>;
1423
- getTransactionRecipect(txHash: string): Promise<void>;
1424
- pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<ethers.TransactionReceipt>;
1425
- private estimateGas;
1426
- signTypedData(address: string, data: any): Promise<any>;
1427
- verify(data: {
1428
- domain: any;
1429
- message: any;
1430
- types: any;
1431
- }, signature: string): Promise<void>;
1432
- on(eventName: any, listener: any): void;
1433
- off(eventName: any, listener: any): void;
1434
- getContract(address: string, abi: any): ethers.Contract;
1435
- }
1436
-
1437
- 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 };
1475
+ 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, 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 };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
3
  import { definedTypes, ChainNamespace, API, AccountStatusEnum, NetworkId } from '@orderly.network/types';
4
4
  import { BigNumberish } from 'ethers/src.ts/utils';
5
- import { parseUnits, TransactionResponse, ethers } from 'ethers';
5
+ import { parseUnits, TransactionResponse } from 'ethers';
6
6
 
7
7
  interface OrderlyKeyPair {
8
8
  getPublicKey(): Promise<string>;
@@ -510,20 +510,30 @@ interface ConfigStore {
510
510
  * Orderly contracts information
511
511
  */
512
512
  type OrderlyContracts = {
513
- usdcAddress: string;
514
513
  usdcAbi: any;
515
514
  erc20Abi: any;
516
- vaultAddress: string;
517
515
  vaultAbi: any;
518
516
  verifyContractAddress: string;
517
+ usdcAddress: string;
518
+ /** @deprecated, will be removed in the future */
519
+ vaultAddress: string;
520
+ /** @deprecated, will be removed in the future */
519
521
  solanaUSDCAddress: string;
522
+ /** @deprecated, will be removed in the future */
520
523
  solanaVaultAddress: string;
524
+ /** @deprecated, will be removed in the future */
521
525
  storyTestnetVaultAddress?: string;
526
+ /** @deprecated, will be removed in the future */
522
527
  monadTestnetVaultAddress?: string;
528
+ /** @deprecated, will be removed in the future */
523
529
  monadTestnetUSDCAddress?: string;
530
+ /** @deprecated, will be removed in the future */
524
531
  abstractVaultAddress?: string;
532
+ /** @deprecated, will be removed in the future */
525
533
  abstractUSDCAddress?: string;
534
+ /** @deprecated, will be removed in the future */
526
535
  bscVaultAddress?: string;
536
+ /** @deprecated, will be removed in the future */
527
537
  bscUSDCAddress?: string;
528
538
  };
529
539
  interface IContract {
@@ -934,10 +944,23 @@ interface WalletAdapter<Config = any> {
934
944
  }, options: {
935
945
  abi: any;
936
946
  }): Promise<any>;
947
+ /**
948
+ * Estimate gas for a contract call (optional, e.g. EVM adapters).
949
+ * Returns gas limit as bigint. Gas cost in native token = gasLimit * gasPrice.
950
+ */
951
+ estimateGasFee?(contractAddress: string, method: string, payload: {
952
+ from: string;
953
+ to?: string;
954
+ data: any[];
955
+ value?: bigint;
956
+ }, options: {
957
+ abi: any;
958
+ }): Promise<bigint>;
937
959
  callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
938
960
  abi: any;
939
961
  }): Promise<any>;
940
962
  getBalance(): Promise<bigint>;
963
+ getBalances(addresses: string[]): Promise<any>;
941
964
  pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
942
965
  parseUnits: (amount: string, decimals: number) => string;
943
966
  formatUnits: (amount: BigNumberish, decimals: number) => string;
@@ -950,49 +973,29 @@ declare class Assets {
950
973
  private readonly contractManger;
951
974
  private readonly account;
952
975
  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
- receiver?: string;
969
- }): Promise<any>;
970
- private getWithdrawalNonce;
971
- getNativeBalance(options?: {
972
- /** token decimals on chain, default is 18 */
973
- decimals?: number;
974
- }): Promise<string>;
975
976
  getBalance(
976
977
  /** token address */
977
978
  address: string, options: {
978
- /** token decimals on chain, default is 18 */
979
+ /** token decimals on chain */
980
+ decimals?: number;
981
+ }): Promise<string>;
982
+ getNativeBalance(options?: {
983
+ /** token decimals on chain */
979
984
  decimals?: number;
980
985
  }): Promise<string>;
981
986
  /**
982
987
  * @deprecated use getBalance instead, will be removed in the future
983
988
  */
984
- getBalanceByAddress(
985
- /** token address */
986
- address: string, options?: {
987
- /** token decimals on chain, default is 18 */
989
+ getBalanceByAddress(address: string, options?: {
988
990
  decimals?: number;
989
991
  }): Promise<string>;
992
+ getBalances(tokens: API.TokenInfo[]): Promise<Record<string, string>>;
990
993
  getAllowance(inputs: {
991
994
  /** token address */
992
995
  address: string;
993
996
  /** vault address */
994
997
  vaultAddress?: string;
995
- /** token decimals on chain, default is 18 */
998
+ /** token decimals on chain */
996
999
  decimals?: number;
997
1000
  }): Promise<string>;
998
1001
  approve(inputs: {
@@ -1000,11 +1003,11 @@ declare class Assets {
1000
1003
  address?: string;
1001
1004
  /** vault address */
1002
1005
  vaultAddress?: string;
1006
+ /** token decimals on chain */
1007
+ decimals: number;
1003
1008
  /** token amount */
1004
1009
  amount?: string;
1005
1010
  isSetMaxValue?: boolean;
1006
- /** token decimals on chain, default is 18 */
1007
- decimals: number;
1008
1011
  }): Promise<any>;
1009
1012
  /**
1010
1013
  * @deprecated use approve instead, will be removed in the future
@@ -1014,38 +1017,93 @@ declare class Assets {
1014
1017
  address: string;
1015
1018
  /** token amount */
1016
1019
  amount?: string;
1017
- /** token decimals on chain, default is 18 */
1020
+ /** token decimals on chain */
1018
1021
  decimals: number;
1019
1022
  }): Promise<any>;
1020
1023
  getDepositFee(inputs: {
1021
1024
  amount: string;
1022
1025
  /** chain info */
1023
1026
  chain: API.NetworkInfos;
1024
- /** token decimals on chain, default is 18 */
1027
+ /** token decimals on chain */
1025
1028
  decimals: number;
1026
1029
  token?: string;
1027
1030
  /** token address */
1028
1031
  address?: string;
1029
1032
  }): Promise<any>;
1030
- /** deposit native token */
1031
- depositNativeToken(inputs: {
1033
+ estimateDepositGasFee(inputs: {
1032
1034
  amount: string;
1033
1035
  fee: bigint;
1034
- /** token decimals on chain, default is 18 */
1036
+ /** token decimals on chain */
1035
1037
  decimals: number;
1036
1038
  token?: string;
1037
- }): Promise<any>;
1039
+ /** token address */
1040
+ address?: string;
1041
+ /** vault address */
1042
+ vaultAddress: string;
1043
+ }): Promise<bigint>;
1044
+ estimateNativeDepositGasFee(inputs: {
1045
+ amount: string;
1046
+ fee: bigint;
1047
+ /** token decimals on chain */
1048
+ decimals: number;
1049
+ token?: string;
1050
+ /** token address */
1051
+ address?: string;
1052
+ /** vault address */
1053
+ vaultAddress: string;
1054
+ }): Promise<bigint>;
1055
+ getDepositData(inputs: {
1056
+ amount: string;
1057
+ /** token decimals on chain */
1058
+ decimals: number;
1059
+ /** token symbol */
1060
+ token?: string;
1061
+ /** token address */
1062
+ address?: string;
1063
+ }): Promise<{
1064
+ contractMethod: string;
1065
+ userAddress: string | undefined;
1066
+ fromAddress: string | undefined;
1067
+ depositData: {
1068
+ accountId?: string;
1069
+ brokerHash: string;
1070
+ tokenHash: string;
1071
+ tokenAmount: string;
1072
+ tokenAddress?: string;
1073
+ };
1074
+ contractData: any[];
1075
+ abi: any;
1076
+ }>;
1038
1077
  deposit(inputs: {
1039
1078
  amount: string;
1040
1079
  fee: bigint;
1041
- /** token decimals on chain, default is 18 */
1080
+ /** token decimals on chain */
1042
1081
  decimals: number;
1043
1082
  token?: string;
1044
1083
  /** token address */
1045
1084
  address?: string;
1046
1085
  /** vault address */
1047
- vaultAddress?: string;
1086
+ vaultAddress: string;
1048
1087
  }): Promise<any>;
1088
+ /** deposit native token */
1089
+ depositNativeToken(inputs: {
1090
+ amount: string;
1091
+ fee: bigint;
1092
+ /** token decimals on chain */
1093
+ decimals: number;
1094
+ token?: string;
1095
+ vaultAddress: string;
1096
+ }): Promise<any>;
1097
+ withdraw(inputs: {
1098
+ chainId: number;
1099
+ token: string;
1100
+ amount: string | number;
1101
+ /** orderly withdraw decimals, not chain decimals */
1102
+ decimals: number;
1103
+ receiver?: string;
1104
+ allowCrossChainWithdraw: boolean;
1105
+ }): Promise<any>;
1106
+ private getWithdrawalNonce;
1049
1107
  internalTransfer(inputs: {
1050
1108
  token: string;
1051
1109
  amount: string;
@@ -1053,9 +1111,21 @@ declare class Assets {
1053
1111
  /** orderly token decimals */
1054
1112
  decimals: number;
1055
1113
  }): Promise<any>;
1114
+ /**
1115
+ * Convert non-USDC asset to USDC manually
1116
+ */
1117
+ convert(inputs: {
1118
+ slippage: number;
1119
+ amount: number;
1120
+ /** must NOT be USDC */
1121
+ converted_asset: string;
1122
+ }): Promise<any>;
1056
1123
  private getTransferNonce;
1057
1124
  private _simpleFetch;
1058
1125
  get usdcAddress(): string;
1126
+ private isSolana;
1127
+ private isAbstract;
1128
+ private getAgwGlobalAddress;
1059
1129
  }
1060
1130
 
1061
1131
  type SubAccount = {
@@ -1319,6 +1389,7 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
1319
1389
  domain: SignatureDomain;
1320
1390
  }>;
1321
1391
  abstract getBalance(): Promise<bigint>;
1392
+ abstract getBalances(addresses: string[]): Promise<any>;
1322
1393
  abstract chainNamespace: ChainNamespace;
1323
1394
  signMessageByOrderlyKey(payload: any): Promise<SignedMessagePayload>;
1324
1395
  abstract call(address: string, method: string, params: any[], options?: {
@@ -1335,6 +1406,14 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
1335
1406
  abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1336
1407
  abi: any;
1337
1408
  }): Promise<any>;
1409
+ abstract estimateGasFee(contractAddress: string, method: string, payload: {
1410
+ from: string;
1411
+ to?: string;
1412
+ data: any[];
1413
+ value?: bigint;
1414
+ }, options: {
1415
+ abi: any;
1416
+ }): Promise<bigint>;
1338
1417
  get address(): string;
1339
1418
  get chainId(): number;
1340
1419
  active(config: Config): void;
@@ -1393,45 +1472,4 @@ type WalletAdapterOptions = {
1393
1472
  };
1394
1473
  type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
1395
1474
 
1396
- declare class EtherAdapter implements IWalletAdapter {
1397
- private provider?;
1398
- private _chainId;
1399
- private _address;
1400
- constructor(options: WalletAdapterOptions);
1401
- parseUnits(amount: string, decimals: number): string;
1402
- formatUnits(amount: string, decimals: number): string;
1403
- getBalance(userAddress: string): Promise<any>;
1404
- deposit(from: string, to: string, amount: string): Promise<any>;
1405
- call(address: string, method: string, params: any[], options: {
1406
- abi: any;
1407
- }): Promise<any>;
1408
- callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
1409
- abi: any;
1410
- }): Promise<any>;
1411
- get chainId(): number;
1412
- set chainId(chainId: number);
1413
- get addresses(): string;
1414
- send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
1415
- sendTransaction(contractAddress: string, method: string, payload: {
1416
- from: string;
1417
- to?: string;
1418
- data: any[];
1419
- value?: bigint;
1420
- }, options: {
1421
- abi: any;
1422
- }): Promise<ethers.TransactionResponse>;
1423
- getTransactionRecipect(txHash: string): Promise<void>;
1424
- pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<ethers.TransactionReceipt>;
1425
- private estimateGas;
1426
- signTypedData(address: string, data: any): Promise<any>;
1427
- verify(data: {
1428
- domain: any;
1429
- message: any;
1430
- types: any;
1431
- }, signature: string): Promise<void>;
1432
- on(eventName: any, listener: any): void;
1433
- off(eventName: any, listener: any): void;
1434
- getContract(address: string, abi: any): ethers.Contract;
1435
- }
1436
-
1437
- 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 };
1475
+ 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, 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 };