@openocean.finance/openocean-sdk 0.1.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/lib/api/index.d.ts +16 -0
- package/lib/api/vo/RequestVo.d.ts +66 -0
- package/lib/asset/abi/aggregator.d.ts +28 -0
- package/lib/config/Chains.d.ts +14 -0
- package/lib/config/Wallets.d.ts +27 -0
- package/lib/config/index.d.ts +46 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +2 -0
- package/lib/index.js.LICENSE.txt +105 -0
- package/lib/swapSdk/Approve.d.ts +17 -0
- package/lib/swapSdk/ConnectWallet.d.ts +4 -0
- package/lib/swapSdk/NotoMobile.d.ts +17 -0
- package/lib/swapSdk/RequestVo.d.ts +22 -0
- package/lib/swapSdk/Swap.d.ts +30 -0
- package/lib/swapSdk/getAllowance.d.ts +1 -0
- package/lib/swapSdk/getBalance.d.ts +1 -0
- package/lib/swapSdk/index.d.ts +24 -0
- package/lib/swapSdk/jupiterDex.d.ts +1 -0
- package/lib/utils/ajx.d.ts +2 -0
- package/lib/utils/index.d.ts +36 -0
- package/lib/utils/web3.d.ts +3 -0
- package/package.json +61 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TxsVo, TransactionVo, ChainName, ReqSwapVo, ReqBanlanceVo, ReqAllowanceVo, ReqQuoteVo } from "./vo/RequestVo";
|
|
2
|
+
export declare class Api {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
constructor(baseUrl?: string);
|
|
5
|
+
getGasPrice(option: any): Promise<any>;
|
|
6
|
+
quote(option: ReqQuoteVo): Promise<any>;
|
|
7
|
+
swapQuote(option: ReqSwapVo): Promise<any>;
|
|
8
|
+
getTransaction(option: TransactionVo): Promise<any>;
|
|
9
|
+
getTokenList(option: ChainName): Promise<any>;
|
|
10
|
+
dexList(option: ChainName): Promise<any>;
|
|
11
|
+
getTxs(option: TxsVo): Promise<any>;
|
|
12
|
+
createWallet(option: ChainName): Promise<any>;
|
|
13
|
+
getTokenPrice(id: string): any;
|
|
14
|
+
getBalance(option: ReqBanlanceVo): Promise<any>;
|
|
15
|
+
getAllowance(option: ReqAllowanceVo): Promise<any>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export declare class ReqBase {
|
|
3
|
+
chainId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ChainName {
|
|
6
|
+
chain: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class UserCode {
|
|
9
|
+
code: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ReqBanlanceVo extends ChainName {
|
|
12
|
+
account: string;
|
|
13
|
+
inTokenAddress: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class TransactionVo extends ChainName {
|
|
16
|
+
hash: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class TxsVo extends ChainName {
|
|
19
|
+
account: string;
|
|
20
|
+
pageSize: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class ReqAllowanceVo extends ChainName {
|
|
23
|
+
account: string;
|
|
24
|
+
inTokenAddress: string;
|
|
25
|
+
contractAddress: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class ReqTokenPriceVo {
|
|
28
|
+
ids: string;
|
|
29
|
+
vs_currencies: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class ReqTokenInfoVo {
|
|
32
|
+
id: string;
|
|
33
|
+
contract_address: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class ReqQuoteVo extends ChainName {
|
|
36
|
+
inTokenAddress: string;
|
|
37
|
+
outTokenAddress: string;
|
|
38
|
+
amount: Number;
|
|
39
|
+
gasPrice: String;
|
|
40
|
+
}
|
|
41
|
+
export declare class ReqSwapVo extends ChainName {
|
|
42
|
+
inTokenAddress: string;
|
|
43
|
+
dex: string;
|
|
44
|
+
outTokenAddress: string;
|
|
45
|
+
amount: Number;
|
|
46
|
+
slippage: Number;
|
|
47
|
+
account: String;
|
|
48
|
+
gasPrice: String;
|
|
49
|
+
referrer: String;
|
|
50
|
+
}
|
|
51
|
+
export declare class ReqGetTokenVo extends ChainName {
|
|
52
|
+
address: string;
|
|
53
|
+
}
|
|
54
|
+
export declare class ReqTransactionReceiptVo extends ChainName {
|
|
55
|
+
hash: string;
|
|
56
|
+
}
|
|
57
|
+
export declare class ReqTransactionVo extends ReqTransactionReceiptVo {
|
|
58
|
+
type: string;
|
|
59
|
+
}
|
|
60
|
+
export declare class ReqtransferVo extends ChainName {
|
|
61
|
+
inTokenAddress: string;
|
|
62
|
+
decimals: Number;
|
|
63
|
+
amount: Number;
|
|
64
|
+
gasPrice: Number;
|
|
65
|
+
targetAddress: Number;
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const aggregator: ({
|
|
2
|
+
anonymous: boolean;
|
|
3
|
+
inputs: {
|
|
4
|
+
indexed: boolean;
|
|
5
|
+
internalType: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
outputs?: undefined;
|
|
12
|
+
stateMutability?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
inputs: {
|
|
15
|
+
internalType: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
name: string;
|
|
20
|
+
outputs: {
|
|
21
|
+
internalType: string;
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
}[];
|
|
25
|
+
stateMutability: string;
|
|
26
|
+
type: string;
|
|
27
|
+
anonymous?: undefined;
|
|
28
|
+
})[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class Chains {
|
|
2
|
+
ethereumChainParams: any;
|
|
3
|
+
chainObj: any;
|
|
4
|
+
chainList: any[];
|
|
5
|
+
chainIds: String[];
|
|
6
|
+
chainNames: String[];
|
|
7
|
+
chainApproveNames: String[];
|
|
8
|
+
constructor();
|
|
9
|
+
isNativeToken(chainName: string, address: string): boolean;
|
|
10
|
+
getNativeToken(chainName: string): any;
|
|
11
|
+
getProxyContract(chainName: string): string | undefined;
|
|
12
|
+
getIsNewChain(): string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const chains: Chains;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum WalletNames {
|
|
2
|
+
'MetaMask' = 0,
|
|
3
|
+
'WalletConnect' = 1,
|
|
4
|
+
'BscWallet' = 2,
|
|
5
|
+
'Cyano' = 3,
|
|
6
|
+
'OntoMobile' = 4,
|
|
7
|
+
'TronLink' = 5,
|
|
8
|
+
'Sollet' = 6,
|
|
9
|
+
'SolflareWallet' = 7,
|
|
10
|
+
'TrustWallet' = 8,
|
|
11
|
+
'MathWallet' = 9,
|
|
12
|
+
'TokenPocket' = 10,
|
|
13
|
+
'SafePalWallet' = 11,
|
|
14
|
+
'OntoWallet' = 12,
|
|
15
|
+
'Coin98Wallet' = 13,
|
|
16
|
+
'ImTokenWallet' = 14,
|
|
17
|
+
'Phantom' = 15,
|
|
18
|
+
'OkExWallet' = 16,
|
|
19
|
+
'TerraStation' = 17,
|
|
20
|
+
'CoinbaseWallet' = 18
|
|
21
|
+
}
|
|
22
|
+
export declare class Wallets {
|
|
23
|
+
walletObj: any;
|
|
24
|
+
walletList: any[];
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare const wallets: Wallets;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Wallets } from "./Wallets";
|
|
2
|
+
import { Chains } from "./Chains";
|
|
3
|
+
export declare const ERC20_abi: ({
|
|
4
|
+
constant: boolean;
|
|
5
|
+
inputs: {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
name: string;
|
|
10
|
+
outputs: {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
}[];
|
|
14
|
+
payable: boolean;
|
|
15
|
+
stateMutability: string;
|
|
16
|
+
type: string;
|
|
17
|
+
anonymous?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
payable: boolean;
|
|
20
|
+
stateMutability: string;
|
|
21
|
+
type: string;
|
|
22
|
+
constant?: undefined;
|
|
23
|
+
inputs?: undefined;
|
|
24
|
+
name?: undefined;
|
|
25
|
+
outputs?: undefined;
|
|
26
|
+
anonymous?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
anonymous: boolean;
|
|
29
|
+
inputs: {
|
|
30
|
+
indexed: boolean;
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
}[];
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
constant?: undefined;
|
|
37
|
+
outputs?: undefined;
|
|
38
|
+
payable?: undefined;
|
|
39
|
+
stateMutability?: undefined;
|
|
40
|
+
})[];
|
|
41
|
+
export interface Config {
|
|
42
|
+
chains: Chains;
|
|
43
|
+
wallets: Wallets;
|
|
44
|
+
ERC20_abi: any;
|
|
45
|
+
}
|
|
46
|
+
export declare const config: Config;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Api } from './api';
|
|
2
|
+
import { Utils } from './utils';
|
|
3
|
+
import { Web3 } from './utils/web3';
|
|
4
|
+
import { SwapSdk } from './swapSdk';
|
|
5
|
+
import { Config } from './config';
|
|
6
|
+
interface OpenoceanSdkArg {
|
|
7
|
+
apiUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class OpenoceanSdk {
|
|
10
|
+
web3: Web3;
|
|
11
|
+
utils: Utils;
|
|
12
|
+
config: Config;
|
|
13
|
+
api: Api;
|
|
14
|
+
swapSdk: SwapSdk;
|
|
15
|
+
constructor(sdkArg: OpenoceanSdkArg);
|
|
16
|
+
}
|
|
17
|
+
export {};
|