@kodiak-finance/orderly-core 2.8.33 → 2.9.0-rc.2
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 +121 -82
- package/dist/index.d.ts +121 -82
- package/dist/index.js +239 -419
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +241 -419
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
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 '@kodiak-finance/orderly-types';
|
|
4
4
|
import { BigNumberish } from 'ethers/src.ts/utils';
|
|
5
|
-
import { parseUnits, TransactionResponse
|
|
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,48 +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
|
-
}): Promise<any>;
|
|
969
|
-
private getWithdrawalNonce;
|
|
970
|
-
getNativeBalance(options?: {
|
|
971
|
-
/** token decimals on chain, default is 18 */
|
|
972
|
-
decimals?: number;
|
|
973
|
-
}): Promise<string>;
|
|
974
976
|
getBalance(
|
|
975
977
|
/** token address */
|
|
976
978
|
address: string, options: {
|
|
977
|
-
/** token decimals on chain
|
|
979
|
+
/** token decimals on chain */
|
|
980
|
+
decimals?: number;
|
|
981
|
+
}): Promise<string>;
|
|
982
|
+
getNativeBalance(options?: {
|
|
983
|
+
/** token decimals on chain */
|
|
978
984
|
decimals?: number;
|
|
979
985
|
}): Promise<string>;
|
|
980
986
|
/**
|
|
981
987
|
* @deprecated use getBalance instead, will be removed in the future
|
|
982
988
|
*/
|
|
983
|
-
getBalanceByAddress(
|
|
984
|
-
/** token address */
|
|
985
|
-
address: string, options?: {
|
|
986
|
-
/** token decimals on chain, default is 18 */
|
|
989
|
+
getBalanceByAddress(address: string, options?: {
|
|
987
990
|
decimals?: number;
|
|
988
991
|
}): Promise<string>;
|
|
992
|
+
getBalances(tokens: API.TokenInfo[]): Promise<Record<string, string>>;
|
|
989
993
|
getAllowance(inputs: {
|
|
990
994
|
/** token address */
|
|
991
995
|
address: string;
|
|
992
996
|
/** vault address */
|
|
993
997
|
vaultAddress?: string;
|
|
994
|
-
/** token decimals on chain
|
|
998
|
+
/** token decimals on chain */
|
|
995
999
|
decimals?: number;
|
|
996
1000
|
}): Promise<string>;
|
|
997
1001
|
approve(inputs: {
|
|
@@ -999,11 +1003,11 @@ declare class Assets {
|
|
|
999
1003
|
address?: string;
|
|
1000
1004
|
/** vault address */
|
|
1001
1005
|
vaultAddress?: string;
|
|
1006
|
+
/** token decimals on chain */
|
|
1007
|
+
decimals: number;
|
|
1002
1008
|
/** token amount */
|
|
1003
1009
|
amount?: string;
|
|
1004
1010
|
isSetMaxValue?: boolean;
|
|
1005
|
-
/** token decimals on chain, default is 18 */
|
|
1006
|
-
decimals: number;
|
|
1007
1011
|
}): Promise<any>;
|
|
1008
1012
|
/**
|
|
1009
1013
|
* @deprecated use approve instead, will be removed in the future
|
|
@@ -1013,38 +1017,93 @@ declare class Assets {
|
|
|
1013
1017
|
address: string;
|
|
1014
1018
|
/** token amount */
|
|
1015
1019
|
amount?: string;
|
|
1016
|
-
/** token decimals on chain
|
|
1020
|
+
/** token decimals on chain */
|
|
1017
1021
|
decimals: number;
|
|
1018
1022
|
}): Promise<any>;
|
|
1019
1023
|
getDepositFee(inputs: {
|
|
1020
1024
|
amount: string;
|
|
1021
1025
|
/** chain info */
|
|
1022
1026
|
chain: API.NetworkInfos;
|
|
1023
|
-
/** token decimals on chain
|
|
1027
|
+
/** token decimals on chain */
|
|
1024
1028
|
decimals: number;
|
|
1025
1029
|
token?: string;
|
|
1026
1030
|
/** token address */
|
|
1027
1031
|
address?: string;
|
|
1028
1032
|
}): Promise<any>;
|
|
1029
|
-
|
|
1030
|
-
depositNativeToken(inputs: {
|
|
1033
|
+
estimateDepositGasFee(inputs: {
|
|
1031
1034
|
amount: string;
|
|
1032
1035
|
fee: bigint;
|
|
1033
|
-
/** token decimals on chain
|
|
1036
|
+
/** token decimals on chain */
|
|
1034
1037
|
decimals: number;
|
|
1035
1038
|
token?: string;
|
|
1036
|
-
|
|
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
|
+
}>;
|
|
1037
1077
|
deposit(inputs: {
|
|
1038
1078
|
amount: string;
|
|
1039
1079
|
fee: bigint;
|
|
1040
|
-
/** token decimals on chain
|
|
1080
|
+
/** token decimals on chain */
|
|
1041
1081
|
decimals: number;
|
|
1042
1082
|
token?: string;
|
|
1043
1083
|
/** token address */
|
|
1044
1084
|
address?: string;
|
|
1045
1085
|
/** vault address */
|
|
1046
|
-
vaultAddress
|
|
1086
|
+
vaultAddress: string;
|
|
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;
|
|
1047
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;
|
|
1048
1107
|
internalTransfer(inputs: {
|
|
1049
1108
|
token: string;
|
|
1050
1109
|
amount: string;
|
|
@@ -1052,9 +1111,21 @@ declare class Assets {
|
|
|
1052
1111
|
/** orderly token decimals */
|
|
1053
1112
|
decimals: number;
|
|
1054
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>;
|
|
1055
1123
|
private getTransferNonce;
|
|
1056
1124
|
private _simpleFetch;
|
|
1057
1125
|
get usdcAddress(): string;
|
|
1126
|
+
private isSolana;
|
|
1127
|
+
private isAbstract;
|
|
1128
|
+
private getAgwGlobalAddress;
|
|
1058
1129
|
}
|
|
1059
1130
|
|
|
1060
1131
|
type SubAccount = {
|
|
@@ -1318,6 +1389,7 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
|
|
|
1318
1389
|
domain: SignatureDomain;
|
|
1319
1390
|
}>;
|
|
1320
1391
|
abstract getBalance(): Promise<bigint>;
|
|
1392
|
+
abstract getBalances(addresses: string[]): Promise<any>;
|
|
1321
1393
|
abstract chainNamespace: ChainNamespace;
|
|
1322
1394
|
signMessageByOrderlyKey(payload: any): Promise<SignedMessagePayload>;
|
|
1323
1395
|
abstract call(address: string, method: string, params: any[], options?: {
|
|
@@ -1334,6 +1406,14 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
|
|
|
1334
1406
|
abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
1335
1407
|
abi: any;
|
|
1336
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>;
|
|
1337
1417
|
get address(): string;
|
|
1338
1418
|
get chainId(): number;
|
|
1339
1419
|
active(config: Config): void;
|
|
@@ -1392,45 +1472,4 @@ type WalletAdapterOptions = {
|
|
|
1392
1472
|
};
|
|
1393
1473
|
type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
|
|
1394
1474
|
|
|
1395
|
-
|
|
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 };
|
|
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 '@kodiak-finance/orderly-types';
|
|
4
4
|
import { BigNumberish } from 'ethers/src.ts/utils';
|
|
5
|
-
import { parseUnits, TransactionResponse
|
|
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,48 +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
|
-
}): Promise<any>;
|
|
969
|
-
private getWithdrawalNonce;
|
|
970
|
-
getNativeBalance(options?: {
|
|
971
|
-
/** token decimals on chain, default is 18 */
|
|
972
|
-
decimals?: number;
|
|
973
|
-
}): Promise<string>;
|
|
974
976
|
getBalance(
|
|
975
977
|
/** token address */
|
|
976
978
|
address: string, options: {
|
|
977
|
-
/** token decimals on chain
|
|
979
|
+
/** token decimals on chain */
|
|
980
|
+
decimals?: number;
|
|
981
|
+
}): Promise<string>;
|
|
982
|
+
getNativeBalance(options?: {
|
|
983
|
+
/** token decimals on chain */
|
|
978
984
|
decimals?: number;
|
|
979
985
|
}): Promise<string>;
|
|
980
986
|
/**
|
|
981
987
|
* @deprecated use getBalance instead, will be removed in the future
|
|
982
988
|
*/
|
|
983
|
-
getBalanceByAddress(
|
|
984
|
-
/** token address */
|
|
985
|
-
address: string, options?: {
|
|
986
|
-
/** token decimals on chain, default is 18 */
|
|
989
|
+
getBalanceByAddress(address: string, options?: {
|
|
987
990
|
decimals?: number;
|
|
988
991
|
}): Promise<string>;
|
|
992
|
+
getBalances(tokens: API.TokenInfo[]): Promise<Record<string, string>>;
|
|
989
993
|
getAllowance(inputs: {
|
|
990
994
|
/** token address */
|
|
991
995
|
address: string;
|
|
992
996
|
/** vault address */
|
|
993
997
|
vaultAddress?: string;
|
|
994
|
-
/** token decimals on chain
|
|
998
|
+
/** token decimals on chain */
|
|
995
999
|
decimals?: number;
|
|
996
1000
|
}): Promise<string>;
|
|
997
1001
|
approve(inputs: {
|
|
@@ -999,11 +1003,11 @@ declare class Assets {
|
|
|
999
1003
|
address?: string;
|
|
1000
1004
|
/** vault address */
|
|
1001
1005
|
vaultAddress?: string;
|
|
1006
|
+
/** token decimals on chain */
|
|
1007
|
+
decimals: number;
|
|
1002
1008
|
/** token amount */
|
|
1003
1009
|
amount?: string;
|
|
1004
1010
|
isSetMaxValue?: boolean;
|
|
1005
|
-
/** token decimals on chain, default is 18 */
|
|
1006
|
-
decimals: number;
|
|
1007
1011
|
}): Promise<any>;
|
|
1008
1012
|
/**
|
|
1009
1013
|
* @deprecated use approve instead, will be removed in the future
|
|
@@ -1013,38 +1017,93 @@ declare class Assets {
|
|
|
1013
1017
|
address: string;
|
|
1014
1018
|
/** token amount */
|
|
1015
1019
|
amount?: string;
|
|
1016
|
-
/** token decimals on chain
|
|
1020
|
+
/** token decimals on chain */
|
|
1017
1021
|
decimals: number;
|
|
1018
1022
|
}): Promise<any>;
|
|
1019
1023
|
getDepositFee(inputs: {
|
|
1020
1024
|
amount: string;
|
|
1021
1025
|
/** chain info */
|
|
1022
1026
|
chain: API.NetworkInfos;
|
|
1023
|
-
/** token decimals on chain
|
|
1027
|
+
/** token decimals on chain */
|
|
1024
1028
|
decimals: number;
|
|
1025
1029
|
token?: string;
|
|
1026
1030
|
/** token address */
|
|
1027
1031
|
address?: string;
|
|
1028
1032
|
}): Promise<any>;
|
|
1029
|
-
|
|
1030
|
-
depositNativeToken(inputs: {
|
|
1033
|
+
estimateDepositGasFee(inputs: {
|
|
1031
1034
|
amount: string;
|
|
1032
1035
|
fee: bigint;
|
|
1033
|
-
/** token decimals on chain
|
|
1036
|
+
/** token decimals on chain */
|
|
1034
1037
|
decimals: number;
|
|
1035
1038
|
token?: string;
|
|
1036
|
-
|
|
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
|
+
}>;
|
|
1037
1077
|
deposit(inputs: {
|
|
1038
1078
|
amount: string;
|
|
1039
1079
|
fee: bigint;
|
|
1040
|
-
/** token decimals on chain
|
|
1080
|
+
/** token decimals on chain */
|
|
1041
1081
|
decimals: number;
|
|
1042
1082
|
token?: string;
|
|
1043
1083
|
/** token address */
|
|
1044
1084
|
address?: string;
|
|
1045
1085
|
/** vault address */
|
|
1046
|
-
vaultAddress
|
|
1086
|
+
vaultAddress: string;
|
|
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;
|
|
1047
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;
|
|
1048
1107
|
internalTransfer(inputs: {
|
|
1049
1108
|
token: string;
|
|
1050
1109
|
amount: string;
|
|
@@ -1052,9 +1111,21 @@ declare class Assets {
|
|
|
1052
1111
|
/** orderly token decimals */
|
|
1053
1112
|
decimals: number;
|
|
1054
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>;
|
|
1055
1123
|
private getTransferNonce;
|
|
1056
1124
|
private _simpleFetch;
|
|
1057
1125
|
get usdcAddress(): string;
|
|
1126
|
+
private isSolana;
|
|
1127
|
+
private isAbstract;
|
|
1128
|
+
private getAgwGlobalAddress;
|
|
1058
1129
|
}
|
|
1059
1130
|
|
|
1060
1131
|
type SubAccount = {
|
|
@@ -1318,6 +1389,7 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
|
|
|
1318
1389
|
domain: SignatureDomain;
|
|
1319
1390
|
}>;
|
|
1320
1391
|
abstract getBalance(): Promise<bigint>;
|
|
1392
|
+
abstract getBalances(addresses: string[]): Promise<any>;
|
|
1321
1393
|
abstract chainNamespace: ChainNamespace;
|
|
1322
1394
|
signMessageByOrderlyKey(payload: any): Promise<SignedMessagePayload>;
|
|
1323
1395
|
abstract call(address: string, method: string, params: any[], options?: {
|
|
@@ -1334,6 +1406,14 @@ declare abstract class BaseWalletAdapter<Config> implements WalletAdapter<Config
|
|
|
1334
1406
|
abstract callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
1335
1407
|
abi: any;
|
|
1336
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>;
|
|
1337
1417
|
get address(): string;
|
|
1338
1418
|
get chainId(): number;
|
|
1339
1419
|
active(config: Config): void;
|
|
@@ -1392,45 +1472,4 @@ type WalletAdapterOptions = {
|
|
|
1392
1472
|
};
|
|
1393
1473
|
type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
|
|
1394
1474
|
|
|
1395
|
-
|
|
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 };
|
|
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 };
|