@openocean.finance/wallet 0.4.0 → 0.4.3

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.
Files changed (73) hide show
  1. package/lib/.DS_Store +0 -0
  2. package/lib/Chains/BaseChain.d.ts +1 -1
  3. package/lib/Chains/BaseChain.js +8 -0
  4. package/lib/Chains/EthChain.d.ts +1 -1
  5. package/lib/Chains/EthChain.js +41 -0
  6. package/lib/Chains/index.js +1 -0
  7. package/lib/WalletManager.js +117 -0
  8. package/lib/Wallets/BaseWallet.d.ts +2 -2
  9. package/lib/Wallets/BaseWallet.js +8 -0
  10. package/lib/Wallets/BraveWallet.js +129 -0
  11. package/lib/Wallets/BscWallet.js +112 -0
  12. package/lib/Wallets/CloverWallet.js +136 -0
  13. package/lib/Wallets/Coin98.js +139 -0
  14. package/lib/Wallets/CoinbaseWallet.js +111 -0
  15. package/lib/Wallets/CryptoCom.d.ts +16 -0
  16. package/lib/Wallets/CryptoCom.js +111 -0
  17. package/lib/Wallets/Cyano.d.ts +1 -1
  18. package/lib/Wallets/Cyano.js +108 -0
  19. package/lib/Wallets/ImTokenWallet.js +111 -0
  20. package/lib/Wallets/KeplrWallet.js +121 -0
  21. package/lib/Wallets/MathWallet.js +111 -0
  22. package/lib/Wallets/MetaMask.js +130 -0
  23. package/lib/Wallets/MetaXWallet.js +112 -0
  24. package/lib/Wallets/OKExWallet.js +112 -0
  25. package/lib/Wallets/OntoMobile.js +111 -0
  26. package/lib/Wallets/OntoWallet.js +112 -0
  27. package/lib/Wallets/Phantom.js +65 -0
  28. package/lib/Wallets/SafePalWallet.js +126 -0
  29. package/lib/Wallets/SlopeWallet.js +110 -0
  30. package/lib/Wallets/SolflareWallet.js +106 -0
  31. package/lib/Wallets/Sollet.js +67 -0
  32. package/lib/Wallets/SolletIo.js +64 -0
  33. package/lib/Wallets/TerraStation.js +64 -0
  34. package/lib/Wallets/TokenPocket.js +111 -0
  35. package/lib/Wallets/TronLink.js +101 -0
  36. package/lib/Wallets/TrustWallet.js +163 -0
  37. package/lib/Wallets/WalletConnect.js +163 -0
  38. package/lib/Wallets/{XDEFIWallet.d.ts → XDeFiWallet.d.ts} +0 -0
  39. package/lib/Wallets/XDeFiWallet.js +138 -0
  40. package/lib/assets/.DS_Store +0 -0
  41. package/lib/assets/approveErc20Abi.json +23 -0
  42. package/lib/assets/brave.svg +24 -0
  43. package/lib/assets/bscwallet.svg +23 -0
  44. package/lib/assets/clover.svg +11 -0
  45. package/lib/assets/coin98.svg +18 -0
  46. package/lib/assets/coinbase.svg +17 -0
  47. package/lib/assets/cryptoCom.svg +14 -0
  48. package/lib/assets/cyano.svg +7 -0
  49. package/lib/assets/erc20Abi.json +222 -0
  50. package/lib/assets/imtoken.svg +12 -0
  51. package/lib/assets/keplr.png +0 -0
  52. package/lib/assets/math.svg +1 -0
  53. package/lib/assets/metamask.svg +1 -0
  54. package/lib/assets/metax.svg +10 -0
  55. package/lib/assets/okex.svg +21 -0
  56. package/lib/assets/onto.svg +1 -0
  57. package/lib/assets/phantom.svg +22 -0
  58. package/lib/assets/safepal.svg +1 -0
  59. package/lib/assets/slope.svg +25 -0
  60. package/lib/assets/solflare.svg +23 -0
  61. package/lib/assets/sollet.svg +7 -0
  62. package/lib/assets/terra.svg +17 -0
  63. package/lib/assets/tokenpocket.svg +1 -0
  64. package/lib/assets/tronlink.svg +25 -0
  65. package/lib/assets/trust.svg +10 -0
  66. package/lib/assets/walletconnect.svg +1 -0
  67. package/lib/assets/xdefi.svg +15 -0
  68. package/lib/index.d.ts +4 -3
  69. package/lib/index.js +72 -2
  70. package/lib/types.d.ts +5 -3
  71. package/lib/types.js +101 -0
  72. package/package.json +4 -3
  73. package/lib/index.js.LICENSE.txt +0 -180
package/lib/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @name types
3
- * @author gen
3
+ * @author openocean
4
4
  * @date 2021/4/20
5
5
  * @desc
6
6
  */
@@ -66,7 +66,8 @@ export declare enum EnumWalletName {
66
66
  SolflareWallet = "Solflare Wallet",
67
67
  MetaXWallet = "MetaX Wallet",
68
68
  keplrWallet = "Keplr Wallet",
69
- BraveWallet = "Brave Wallet"
69
+ BraveWallet = "Brave Wallet",
70
+ CryptoCom = "Crypto.com DeFi Wallet"
70
71
  }
71
72
  export declare enum EnumErrors {
72
73
  NotMetamask = "40001",
@@ -92,7 +93,8 @@ export declare enum EnumErrors {
92
93
  NoOnto = "40022",
93
94
  OntoChainIdNotMath = "40023",
94
95
  NoKeplr = "40024",
95
- NoBrave = "40025"
96
+ NoBrave = "40025",
97
+ NoCryptoCom = "40026"
96
98
  }
97
99
  export interface ConnectResult {
98
100
  chain: EnumChains;
package/lib/types.js ADDED
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /**
3
+ * @name types
4
+ * @author openocean
5
+ * @date 2021/4/20
6
+ * @desc
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EnumErrors = exports.EnumWalletName = exports.EnumWalletType = exports.EnumChains = void 0;
10
+ var EnumChains;
11
+ (function (EnumChains) {
12
+ EnumChains["ETH"] = "eth";
13
+ EnumChains["ROPSTEN"] = "ropsten";
14
+ EnumChains["ONT"] = "ont";
15
+ EnumChains["BSC"] = "bsc";
16
+ EnumChains["BSCTEST"] = "bsctest";
17
+ EnumChains["TRON"] = "tron";
18
+ EnumChains["Solana"] = "solana";
19
+ EnumChains["Polygon"] = "polygon";
20
+ EnumChains["XDai"] = "xdai";
21
+ EnumChains["HECO"] = "heco";
22
+ EnumChains["Fantom"] = "fantom";
23
+ EnumChains["Avalanche"] = "avax";
24
+ EnumChains["OKEX"] = "okex";
25
+ EnumChains["Arbitrum"] = "arbitrum";
26
+ EnumChains["Optimism"] = "optimism";
27
+ EnumChains["Terra"] = "terra";
28
+ EnumChains["Boba"] = "boba";
29
+ EnumChains["Moonriver"] = "moonriver";
30
+ EnumChains["Aurora"] = "aurora";
31
+ EnumChains["Cronos"] = "cronos";
32
+ EnumChains["Harmony"] = "harmony";
33
+ EnumChains["Osmosis"] = "osmosis";
34
+ EnumChains["Sifchain"] = "sifchain";
35
+ })(EnumChains = exports.EnumChains || (exports.EnumChains = {}));
36
+ var EnumWalletType;
37
+ (function (EnumWalletType) {
38
+ EnumWalletType["Extension"] = "Extension";
39
+ EnumWalletType["WalletConnect"] = "WalletConnect";
40
+ EnumWalletType["Web"] = "Web";
41
+ EnumWalletType["Mobile"] = "Mobile";
42
+ })(EnumWalletType = exports.EnumWalletType || (exports.EnumWalletType = {}));
43
+ var EnumWalletName;
44
+ (function (EnumWalletName) {
45
+ EnumWalletName["MetaMask"] = "MetaMask";
46
+ EnumWalletName["BscWallet"] = "Binance Wallet";
47
+ EnumWalletName["Cyano"] = "Cyano";
48
+ EnumWalletName["TronLink"] = "TronLink";
49
+ EnumWalletName["WalletConnect"] = "WalletConnect";
50
+ EnumWalletName["Sollet"] = "Sollet";
51
+ EnumWalletName["SolletIo"] = "Sollet.io";
52
+ EnumWalletName["OntoMobile"] = "ONTO Mobile";
53
+ EnumWalletName["OntoExt"] = "ONTO Extension";
54
+ EnumWalletName["TrustWallet"] = "Trust Wallet";
55
+ EnumWalletName["MathWallet"] = "Math Wallet";
56
+ EnumWalletName["TokenPocket"] = "Token Pocket";
57
+ EnumWalletName["SafePalWallet"] = "SafePal Wallet";
58
+ EnumWalletName["ImTokenWallet"] = "ImToken Wallet";
59
+ EnumWalletName["OntoWallet"] = "ONTO Wallet";
60
+ EnumWalletName["Coin98"] = "Coin98 Wallet";
61
+ EnumWalletName["OKExWallet"] = "OKEx Wallet";
62
+ EnumWalletName["Phantom"] = "Phantom";
63
+ EnumWalletName["TerraStation"] = "Terra Station";
64
+ EnumWalletName["CoinbaseWallet"] = "Coinbase Wallet";
65
+ EnumWalletName["CloverWallet"] = "Clover Wallet";
66
+ EnumWalletName["XDEFIWallet"] = "XDEFI Wallet";
67
+ EnumWalletName["SlopeWallet"] = "Slope Wallet";
68
+ EnumWalletName["SolflareWallet"] = "Solflare Wallet";
69
+ EnumWalletName["MetaXWallet"] = "MetaX Wallet";
70
+ EnumWalletName["keplrWallet"] = "Keplr Wallet";
71
+ EnumWalletName["BraveWallet"] = "Brave Wallet";
72
+ EnumWalletName["CryptoCom"] = "Crypto.com DeFi Wallet";
73
+ })(EnumWalletName = exports.EnumWalletName || (exports.EnumWalletName = {}));
74
+ var EnumErrors;
75
+ (function (EnumErrors) {
76
+ EnumErrors["NotMetamask"] = "40001";
77
+ EnumErrors["NotBinance"] = "40002";
78
+ EnumErrors["NoTronLink"] = "40003";
79
+ EnumErrors["NoTronLinkAccount"] = "40004";
80
+ EnumErrors["NoSollet"] = "40005";
81
+ EnumErrors["ChainIdNotMath"] = "40006";
82
+ EnumErrors["UserCanceled"] = "40007";
83
+ EnumErrors["NotConnected"] = "40008";
84
+ EnumErrors["UnSupported"] = "40009";
85
+ EnumErrors["NoCoin98"] = "40011";
86
+ EnumErrors["NoMath"] = "40012";
87
+ EnumErrors["NoPhantom"] = "40013";
88
+ EnumErrors["NoOKExWallet"] = "40014";
89
+ EnumErrors["NoTerraStation"] = "40015";
90
+ EnumErrors["NoCoinbase"] = "40016";
91
+ EnumErrors["NoClover"] = "40017";
92
+ EnumErrors["NoXDeFi"] = "40018";
93
+ EnumErrors["NoSlope"] = "40019";
94
+ EnumErrors["NoSolflare"] = "40020";
95
+ EnumErrors["NoMetaX"] = "40021";
96
+ EnumErrors["NoOnto"] = "40022";
97
+ EnumErrors["OntoChainIdNotMath"] = "40023";
98
+ EnumErrors["NoKeplr"] = "40024";
99
+ EnumErrors["NoBrave"] = "40025";
100
+ EnumErrors["NoCryptoCom"] = "40026";
101
+ })(EnumErrors = exports.EnumErrors || (exports.EnumErrors = {}));
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
- "build": "webpack",
7
+ "build": "tsc",
8
+ "buildWeb": "webpack",
8
9
  "test": "echo \"Error: no test specified\" && exit 1"
9
10
  },
10
- "author": "support@openocean.finance",
11
+ "author": "openocean",
11
12
  "license": "ISC",
12
13
  "repository": {
13
14
  "type": "git",
@@ -1,180 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- /*!
8
- * The buffer module from node.js, for the browser.
9
- *
10
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
11
- * @license MIT
12
- */
13
-
14
- /*!
15
- * The buffer module from node.js, for the browser.
16
- *
17
- * @author Feross Aboukhadijeh <https://feross.org>
18
- * @license MIT
19
- */
20
-
21
- /*!
22
- * v2.1.4-104-gc868b3a
23
- *
24
- */
25
-
26
- /*! @ont-community/window-post-message-proxy v0.2.14 | (c) 2016 Microsoft Corporation MIT */
27
-
28
- /*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
29
-
30
- /*! https://mths.be/punycode v1.3.2 by @mathias */
31
-
32
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
33
-
34
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
35
-
36
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
37
-
38
- /**
39
- * Support for translating between Uint8Array instances and JavaScript
40
- * native types.
41
- *
42
- * {@link module:Layout~Layout|Layout} is the basis of a class
43
- * hierarchy that associates property names with sequences of encoded
44
- * bytes.
45
- *
46
- * Layouts are supported for these scalar (numeric) types:
47
- * * {@link module:Layout~UInt|Unsigned integers in little-endian
48
- * format} with {@link module:Layout.u8|8-bit}, {@link
49
- * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},
50
- * {@link module:Layout.u32|32-bit}, {@link
51
- * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}
52
- * representation ranges;
53
- * * {@link module:Layout~UIntBE|Unsigned integers in big-endian
54
- * format} with {@link module:Layout.u16be|16-bit}, {@link
55
- * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},
56
- * {@link module:Layout.u40be|40-bit}, and {@link
57
- * module:Layout.u48be|48-bit} representation ranges;
58
- * * {@link module:Layout~Int|Signed integers in little-endian
59
- * format} with {@link module:Layout.s8|8-bit}, {@link
60
- * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},
61
- * {@link module:Layout.s32|32-bit}, {@link
62
- * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}
63
- * representation ranges;
64
- * * {@link module:Layout~IntBE|Signed integers in big-endian format}
65
- * with {@link module:Layout.s16be|16-bit}, {@link
66
- * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},
67
- * {@link module:Layout.s40be|40-bit}, and {@link
68
- * module:Layout.s48be|48-bit} representation ranges;
69
- * * 64-bit integral values that decode to an exact (if magnitude is
70
- * less than 2^53) or nearby integral Number in {@link
71
- * module:Layout.nu64|unsigned little-endian}, {@link
72
- * module:Layout.nu64be|unsigned big-endian}, {@link
73
- * module:Layout.ns64|signed little-endian}, and {@link
74
- * module:Layout.ns64be|unsigned big-endian} encodings;
75
- * * 32-bit floating point values with {@link
76
- * module:Layout.f32|little-endian} and {@link
77
- * module:Layout.f32be|big-endian} representations;
78
- * * 64-bit floating point values with {@link
79
- * module:Layout.f64|little-endian} and {@link
80
- * module:Layout.f64be|big-endian} representations;
81
- * * {@link module:Layout.const|Constants} that take no space in the
82
- * encoded expression.
83
- *
84
- * and for these aggregate types:
85
- * * {@link module:Layout.seq|Sequence}s of instances of a {@link
86
- * module:Layout~Layout|Layout}, with JavaScript representation as
87
- * an Array and constant or data-dependent {@link
88
- * module:Layout~Sequence#count|length};
89
- * * {@link module:Layout.struct|Structure}s that aggregate a
90
- * heterogeneous sequence of {@link module:Layout~Layout|Layout}
91
- * instances, with JavaScript representation as an Object;
92
- * * {@link module:Layout.union|Union}s that support multiple {@link
93
- * module:Layout~VariantLayout|variant layouts} over a fixed
94
- * (padded) or variable (not padded) span of bytes, using an
95
- * unsigned integer at the start of the data or a separate {@link
96
- * module:Layout.unionLayoutDiscriminator|layout element} to
97
- * determine which layout to use when interpreting the buffer
98
- * contents;
99
- * * {@link module:Layout.bits|BitStructure}s that contain a sequence
100
- * of individual {@link
101
- * module:Layout~BitStructure#addField|BitField}s packed into an 8,
102
- * 16, 24, or 32-bit unsigned integer starting at the least- or
103
- * most-significant bit;
104
- * * {@link module:Layout.cstr|C strings} of varying length;
105
- * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link
106
- * module:Layout~Blob#length|length} raw data.
107
- *
108
- * All {@link module:Layout~Layout|Layout} instances are immutable
109
- * after construction, to prevent internal state from becoming
110
- * inconsistent.
111
- *
112
- * @local Layout
113
- * @local ExternalLayout
114
- * @local GreedyCount
115
- * @local OffsetLayout
116
- * @local UInt
117
- * @local UIntBE
118
- * @local Int
119
- * @local IntBE
120
- * @local NearUInt64
121
- * @local NearUInt64BE
122
- * @local NearInt64
123
- * @local NearInt64BE
124
- * @local Float
125
- * @local FloatBE
126
- * @local Double
127
- * @local DoubleBE
128
- * @local Sequence
129
- * @local Structure
130
- * @local UnionDiscriminator
131
- * @local UnionLayoutDiscriminator
132
- * @local Union
133
- * @local VariantLayout
134
- * @local BitStructure
135
- * @local BitField
136
- * @local Boolean
137
- * @local Blob
138
- * @local CString
139
- * @local Constant
140
- * @local bindConstructorLayout
141
- * @module Layout
142
- * @license MIT
143
- * @author Peter A. Bigot
144
- * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
145
- */
146
-
147
- /**
148
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
149
- *
150
- * @version 0.5.7
151
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
152
- * @copyright Chen, Yi-Cyuan 2015-2016
153
- * @license MIT
154
- */
155
-
156
- /**
157
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
158
- *
159
- * @version 0.8.0
160
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
161
- * @copyright Chen, Yi-Cyuan 2015-2018
162
- * @license MIT
163
- */
164
-
165
- /** @preserve
166
- * Counter block mode compatible with Dr Brian Gladman fileenc.c
167
- * derived from CryptoJS.mode.CTR
168
- * Jan Hruby jhruby.web@gmail.com
169
- */
170
-
171
- /** @preserve
172
- (c) 2012 by Cédric Mesnil. All rights reserved.
173
-
174
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
175
-
176
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
177
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
178
-
179
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
180
- */