@openocean.finance/openocean-sdk 0.5.34 → 1.0.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.js +139 -0
- package/lib/api/vo/RequestVo.js +411 -0
- package/lib/asset/abi/ERC20_abi.js +119 -0
- package/lib/asset/abi/aggregator.js +391 -0
- package/lib/config/Chains.js +666 -0
- package/lib/config/Wallets.d.ts +2 -1
- package/lib/config/Wallets.js +99 -0
- package/lib/config/index.d.ts +2 -2
- package/lib/config/index.js +33 -0
- package/lib/index.js +20 -2
- package/lib/swapSdk/Approve.d.ts +1 -0
- package/lib/swapSdk/Approve.js +342 -0
- package/lib/swapSdk/ConnectWallet.js +339 -0
- package/lib/swapSdk/NotoMobile.js +141 -0
- package/lib/swapSdk/RequestVo.js +94 -0
- package/lib/swapSdk/Swap.d.ts +2 -1
- package/lib/swapSdk/Swap.js +1123 -0
- package/lib/swapSdk/getAllowance.js +97 -0
- package/lib/swapSdk/getBalance.js +280 -0
- package/lib/swapSdk/index.d.ts +2 -17
- package/lib/swapSdk/index.js +257 -0
- package/lib/swapSdk/qrcode.d.ts +6 -0
- package/lib/swapSdk/qrcode.js +969 -0
- package/lib/utils/ajx.js +150 -0
- package/lib/utils/index.js +369 -0
- package/lib/utils/web3.js +9 -0
- package/package.json +3 -4
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wallets = exports.Wallets = exports.WalletNames = void 0;
|
|
4
|
+
var wallet_1 = require("@openocean.finance/wallet");
|
|
5
|
+
var WalletNames;
|
|
6
|
+
(function (WalletNames) {
|
|
7
|
+
WalletNames[WalletNames["MetaMask"] = 0] = "MetaMask";
|
|
8
|
+
WalletNames[WalletNames["WalletConnect"] = 1] = "WalletConnect";
|
|
9
|
+
WalletNames[WalletNames["BscWallet"] = 2] = "BscWallet";
|
|
10
|
+
WalletNames[WalletNames["Cyano"] = 3] = "Cyano";
|
|
11
|
+
WalletNames[WalletNames["OntoMobile"] = 4] = "OntoMobile";
|
|
12
|
+
WalletNames[WalletNames["TronLink"] = 5] = "TronLink";
|
|
13
|
+
WalletNames[WalletNames["Sollet"] = 6] = "Sollet";
|
|
14
|
+
WalletNames[WalletNames["SolflareWallet"] = 7] = "SolflareWallet";
|
|
15
|
+
WalletNames[WalletNames["TrustWallet"] = 8] = "TrustWallet";
|
|
16
|
+
WalletNames[WalletNames["MathWallet"] = 9] = "MathWallet";
|
|
17
|
+
WalletNames[WalletNames["TokenPocket"] = 10] = "TokenPocket";
|
|
18
|
+
WalletNames[WalletNames["SafePalWallet"] = 11] = "SafePalWallet";
|
|
19
|
+
WalletNames[WalletNames["OntoWallet"] = 12] = "OntoWallet";
|
|
20
|
+
WalletNames[WalletNames["Coin98Wallet"] = 13] = "Coin98Wallet";
|
|
21
|
+
WalletNames[WalletNames["ImTokenWallet"] = 14] = "ImTokenWallet";
|
|
22
|
+
WalletNames[WalletNames["Phantom"] = 15] = "Phantom";
|
|
23
|
+
WalletNames[WalletNames["TerraStation"] = 16] = "TerraStation";
|
|
24
|
+
WalletNames[WalletNames["CoinbaseWallet"] = 17] = "CoinbaseWallet";
|
|
25
|
+
WalletNames[WalletNames["GnosisSafeWallet"] = 18] = "GnosisSafeWallet";
|
|
26
|
+
WalletNames[WalletNames["BitKeepWallet"] = 19] = "BitKeepWallet";
|
|
27
|
+
WalletNames[WalletNames["CloverWallet"] = 20] = "CloverWallet";
|
|
28
|
+
WalletNames[WalletNames["CryptoCom"] = 21] = "CryptoCom";
|
|
29
|
+
WalletNames[WalletNames["BraveWallet"] = 22] = "BraveWallet";
|
|
30
|
+
WalletNames[WalletNames["XDEFIWallet"] = 23] = "XDEFIWallet";
|
|
31
|
+
WalletNames[WalletNames["OKXWallet"] = 24] = "OKXWallet";
|
|
32
|
+
WalletNames[WalletNames["SlopeWallet"] = 25] = "SlopeWallet";
|
|
33
|
+
WalletNames[WalletNames["KeplrWallet"] = 26] = "KeplrWallet";
|
|
34
|
+
WalletNames[WalletNames["BloctoWallet"] = 27] = "BloctoWallet";
|
|
35
|
+
WalletNames[WalletNames["PetraWallet"] = 28] = "PetraWallet";
|
|
36
|
+
WalletNames[WalletNames["MartianWallet"] = 29] = "MartianWallet";
|
|
37
|
+
WalletNames[WalletNames["PontemWallet"] = 30] = "PontemWallet";
|
|
38
|
+
WalletNames[WalletNames["UnstoppableDomains"] = 31] = "UnstoppableDomains";
|
|
39
|
+
WalletNames[WalletNames["NearWallet"] = 32] = "NearWallet";
|
|
40
|
+
WalletNames[WalletNames["MyNearWallet"] = 33] = "MyNearWallet";
|
|
41
|
+
WalletNames[WalletNames["MeteorWallet"] = 34] = "MeteorWallet";
|
|
42
|
+
WalletNames[WalletNames["SenderWallet"] = 35] = "SenderWallet";
|
|
43
|
+
WalletNames[WalletNames["LedgerWallet"] = 36] = "LedgerWallet";
|
|
44
|
+
})(WalletNames = exports.WalletNames || (exports.WalletNames = {}));
|
|
45
|
+
var WalletObj = {
|
|
46
|
+
MetaMask: new wallet_1.MetaMask(),
|
|
47
|
+
CryptoCom: new wallet_1.CryptoCom(),
|
|
48
|
+
TrustWallet: new wallet_1.TrustWallet(),
|
|
49
|
+
LedgerWallet: new wallet_1.LedgerWallet(),
|
|
50
|
+
OKXWallet: new wallet_1.OKXWallet(),
|
|
51
|
+
BscWallet: new wallet_1.BscWallet(),
|
|
52
|
+
UnstoppableDomains: new wallet_1.UnstoppableDomains(),
|
|
53
|
+
WalletConnect: new wallet_1.WalletConnect(),
|
|
54
|
+
CoinbaseWallet: new wallet_1.CoinbaseWallet(),
|
|
55
|
+
SafePalWallet: new wallet_1.SafePalWallet(),
|
|
56
|
+
BraveWallet: new wallet_1.BraveWallet(),
|
|
57
|
+
BitKeepWallet: new wallet_1.BitKeepWallet(),
|
|
58
|
+
XDEFIWallet: new wallet_1.XDEFIWallet(),
|
|
59
|
+
OntoWallet: new wallet_1.OntoWallet(),
|
|
60
|
+
Coin98Wallet: new wallet_1.Coin98(),
|
|
61
|
+
TokenPocket: new wallet_1.TokenPocket(),
|
|
62
|
+
CloverWallet: new wallet_1.CloverWallet(),
|
|
63
|
+
ImTokenWallet: new wallet_1.ImTokenWallet(),
|
|
64
|
+
MathWallet: new wallet_1.MathWallet(),
|
|
65
|
+
Cyano: new wallet_1.Cyano(),
|
|
66
|
+
OntoMobile: new wallet_1.OntoMobile(),
|
|
67
|
+
TronLink: new wallet_1.TronLink(),
|
|
68
|
+
Sollet: new wallet_1.Sollet(),
|
|
69
|
+
SolflareWallet: new wallet_1.SolflareWallet(),
|
|
70
|
+
Phantom: new wallet_1.Phantom(),
|
|
71
|
+
TerraStation: new wallet_1.TerraStation(),
|
|
72
|
+
GnosisSafeWallet: new wallet_1.GnosisSafeWallet(),
|
|
73
|
+
SlopeWallet: new wallet_1.SlopeWallet(),
|
|
74
|
+
KeplrWallet: new wallet_1.KeplrWallet(),
|
|
75
|
+
BloctoWallet: new wallet_1.BloctoWallet(),
|
|
76
|
+
PetraWallet: new wallet_1.PetraWallet(),
|
|
77
|
+
MartianWallet: new wallet_1.MartianWallet(),
|
|
78
|
+
PontemWallet: new wallet_1.PontemWallet(),
|
|
79
|
+
NearWallet: new wallet_1.NearWallet(),
|
|
80
|
+
MyNearWallet: new wallet_1.MyNearWallet(),
|
|
81
|
+
MeteorWallet: new wallet_1.MeteorWallet(),
|
|
82
|
+
SenderWallet: new wallet_1.SenderWallet(),
|
|
83
|
+
};
|
|
84
|
+
var Wallets = /** @class */ (function () {
|
|
85
|
+
function Wallets() {
|
|
86
|
+
this.walletObj = {};
|
|
87
|
+
this.walletList = [];
|
|
88
|
+
WalletObj.MetaMask.supportChains.push('rinkeby');
|
|
89
|
+
WalletObj.MetaMask.supportChains.push('ropsten');
|
|
90
|
+
this.walletObj = WalletObj;
|
|
91
|
+
this.walletList = Object.keys(WalletObj).map(function (key) {
|
|
92
|
+
WalletObj[key].key = key;
|
|
93
|
+
return WalletObj[key];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return Wallets;
|
|
97
|
+
}());
|
|
98
|
+
exports.Wallets = Wallets;
|
|
99
|
+
exports.wallets = new Wallets();
|
package/lib/config/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Wallets } from
|
|
2
|
-
import { Chains } from "./Chains";
|
|
1
|
+
import { Chains, Wallets } from '@openocean.finance/wallet';
|
|
3
2
|
export declare const ERC20_abi: ({
|
|
4
3
|
constant: boolean;
|
|
5
4
|
inputs: {
|
|
@@ -44,3 +43,4 @@ export interface Config {
|
|
|
44
43
|
ERC20_abi: any;
|
|
45
44
|
}
|
|
46
45
|
export declare const config: Config;
|
|
46
|
+
export declare function getProxyContract(chainName: string): string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProxyContract = exports.config = exports.ERC20_abi = void 0;
|
|
4
|
+
// import { wallets, Wallets } from "./Wallets";
|
|
5
|
+
// import { chains, Chains } from "./Chains";
|
|
6
|
+
var wallet_1 = require("@openocean.finance/wallet");
|
|
7
|
+
exports.ERC20_abi = [{ "constant": true, "inputs": [], "name": "name", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "approve", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [{ "name": "", "type": "uint8" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }], "name": "balanceOf", "outputs": [{ "name": "balance", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transfer", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" }], "name": "allowance", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "owner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Transfer", "type": "event" }];
|
|
8
|
+
exports.config = {
|
|
9
|
+
chains: wallet_1.chainsObj,
|
|
10
|
+
wallets: wallet_1.walletsObj,
|
|
11
|
+
ERC20_abi: exports.ERC20_abi
|
|
12
|
+
};
|
|
13
|
+
function getProxyContract(chainName) {
|
|
14
|
+
return {
|
|
15
|
+
eth: '0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3',
|
|
16
|
+
bsc: "0x7aeef1035ba6794c0478718a2330671ec8802af1",
|
|
17
|
+
fantom: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
18
|
+
avax: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
19
|
+
polygon: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
20
|
+
okex: "0x6D5630eC1Ee74C907617a6fb7BCAdC4Bf0EF3fcA",
|
|
21
|
+
optimism: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
22
|
+
harmony: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
23
|
+
cronos: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
24
|
+
moonriver: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
25
|
+
arbitrum: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
26
|
+
heco: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
27
|
+
boba: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
28
|
+
xdai: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
29
|
+
tron: "TTpcMZbsojNCMhea2a9LFHq9DLCxsgGZVv",
|
|
30
|
+
}[chainName];
|
|
31
|
+
}
|
|
32
|
+
exports.getProxyContract = getProxyContract;
|
|
33
|
+
;
|