@injectivelabs/wallet-evm 1.16.37 → 1.16.38-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/cjs/index.cjs +522 -0
- package/dist/cjs/index.d.cts +99 -0
- package/dist/cjs/package.json +2 -2
- package/dist/esm/index.d.ts +99 -3
- package/dist/esm/index.js +513 -3
- package/dist/esm/package.json +2 -2
- package/package.json +33 -38
- package/dist/cjs/index.d.ts +0 -3
- package/dist/cjs/index.js +0 -21
- package/dist/cjs/strategy/strategy.d.ts +0 -43
- package/dist/cjs/strategy/strategy.js +0 -314
- package/dist/cjs/strategy/utils/Okx.d.ts +0 -4
- package/dist/cjs/strategy/utils/Okx.js +0 -49
- package/dist/cjs/strategy/utils/bitget.d.ts +0 -4
- package/dist/cjs/strategy/utils/bitget.js +0 -43
- package/dist/cjs/strategy/utils/index.d.ts +0 -7
- package/dist/cjs/strategy/utils/index.js +0 -17
- package/dist/cjs/strategy/utils/metamask.d.ts +0 -4
- package/dist/cjs/strategy/utils/metamask.js +0 -44
- package/dist/cjs/strategy/utils/phantom.d.ts +0 -4
- package/dist/cjs/strategy/utils/phantom.js +0 -49
- package/dist/cjs/strategy/utils/rabby.d.ts +0 -4
- package/dist/cjs/strategy/utils/rabby.js +0 -44
- package/dist/cjs/strategy/utils/rainbow.d.ts +0 -4
- package/dist/cjs/strategy/utils/rainbow.js +0 -49
- package/dist/cjs/strategy/utils/trustWallet.d.ts +0 -4
- package/dist/cjs/strategy/utils/trustWallet.js +0 -49
- package/dist/cjs/utils/index.d.ts +0 -5
- package/dist/cjs/utils/index.js +0 -73
- package/dist/esm/strategy/strategy.d.ts +0 -43
- package/dist/esm/strategy/strategy.js +0 -310
- package/dist/esm/strategy/utils/Okx.d.ts +0 -4
- package/dist/esm/strategy/utils/Okx.js +0 -46
- package/dist/esm/strategy/utils/bitget.d.ts +0 -4
- package/dist/esm/strategy/utils/bitget.js +0 -40
- package/dist/esm/strategy/utils/index.d.ts +0 -7
- package/dist/esm/strategy/utils/index.js +0 -7
- package/dist/esm/strategy/utils/metamask.d.ts +0 -4
- package/dist/esm/strategy/utils/metamask.js +0 -41
- package/dist/esm/strategy/utils/phantom.d.ts +0 -4
- package/dist/esm/strategy/utils/phantom.js +0 -46
- package/dist/esm/strategy/utils/rabby.d.ts +0 -4
- package/dist/esm/strategy/utils/rabby.js +0 -41
- package/dist/esm/strategy/utils/rainbow.d.ts +0 -4
- package/dist/esm/strategy/utils/rainbow.js +0 -46
- package/dist/esm/strategy/utils/trustWallet.d.ts +0 -4
- package/dist/esm/strategy/utils/trustWallet.js +0 -46
- package/dist/esm/utils/index.d.ts +0 -5
- package/dist/esm/utils/index.js +0 -68
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
2
|
+
let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
3
|
+
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
4
|
+
let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
|
|
5
|
+
|
|
6
|
+
//#region src/strategy/utils/rabby.ts
|
|
7
|
+
const $window$6 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
8
|
+
async function getRabbyProvider({ timeout } = { timeout: 3e3 }) {
|
|
9
|
+
const provider = getRabbyFromWindow();
|
|
10
|
+
if (provider) return provider;
|
|
11
|
+
return listenForRabbyInitialized({ timeout });
|
|
12
|
+
}
|
|
13
|
+
async function listenForRabbyInitialized({ timeout } = { timeout: 3e3 }) {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
const handleInitialization = () => {
|
|
16
|
+
resolve(getRabbyFromWindow());
|
|
17
|
+
};
|
|
18
|
+
$window$6.addEventListener("rabby#initialized", handleInitialization, { once: true });
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
$window$6.removeEventListener("rabby#initialized", handleInitialization);
|
|
21
|
+
resolve(null);
|
|
22
|
+
}, timeout);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function getRabbyFromWindow() {
|
|
26
|
+
if (!(typeof window !== "undefined" && typeof $window$6.ethereum !== "undefined")) return;
|
|
27
|
+
if ($window$6.ethereum.isRabby) return $window$6.ethereum;
|
|
28
|
+
if ($window$6.providers) return $window$6.providers.find((p) => p.isRabby);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/strategy/utils/Okx.ts
|
|
33
|
+
const $window$5 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
34
|
+
async function getOkxWalletProvider({ timeout } = { timeout: 3e3 }) {
|
|
35
|
+
const provider = getOkxWalletFromWindow();
|
|
36
|
+
if (provider) return provider;
|
|
37
|
+
return listenForOkxWalletInitialized({ timeout });
|
|
38
|
+
}
|
|
39
|
+
async function listenForOkxWalletInitialized({ timeout } = { timeout: 3e3 }) {
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
const handleInitialization = () => {
|
|
42
|
+
resolve(getOkxWalletFromWindow());
|
|
43
|
+
};
|
|
44
|
+
$window$5.addEventListener("okxwallet#initialized", handleInitialization, { once: true });
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
$window$5.removeEventListener("okxwallet#initialized", handleInitialization);
|
|
47
|
+
resolve(null);
|
|
48
|
+
}, timeout);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function getOkxWalletFromWindow() {
|
|
52
|
+
if (!(typeof window !== "undefined" && (typeof $window$5.ethereum !== "undefined" || typeof $window$5.okxwallet !== "undefined"))) return;
|
|
53
|
+
if ($window$5.okxwallet) return $window$5.okxwallet;
|
|
54
|
+
if ($window$5.ethereum.isOkxWallet) return $window$5.ethereum;
|
|
55
|
+
if ($window$5.providers) return $window$5.providers.find((p) => p.isOkxWallet);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/strategy/utils/bitget.ts
|
|
60
|
+
const $window$4 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
61
|
+
async function getBitGetProvider({ timeout } = { timeout: 3e3 }) {
|
|
62
|
+
const provider = getBitGetFromWindow();
|
|
63
|
+
if (provider) return provider;
|
|
64
|
+
return listenForBitGetInitialized({ timeout });
|
|
65
|
+
}
|
|
66
|
+
async function listenForBitGetInitialized({ timeout } = { timeout: 3e3 }) {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
const handleInitialization = () => {
|
|
69
|
+
resolve(getBitGetFromWindow());
|
|
70
|
+
};
|
|
71
|
+
$window$4.addEventListener("bitkeep#initialized", handleInitialization, { once: true });
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
$window$4.removeEventListener("bitkeep#initialized", handleInitialization);
|
|
74
|
+
resolve(null);
|
|
75
|
+
}, timeout);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function getBitGetFromWindow() {
|
|
79
|
+
if (!(typeof window !== "undefined" && (typeof $window$4.ethereum !== "undefined" || typeof $window$4.bitkeep !== "undefined"))) return;
|
|
80
|
+
if ($window$4.bitkeep && $window$4.bitkeep.ethereum) return $window$4.bitkeep.ethereum;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/strategy/utils/phantom.ts
|
|
85
|
+
const $window$3 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
86
|
+
async function getPhantomProvider({ timeout } = { timeout: 3e3 }) {
|
|
87
|
+
const provider = getPhantomFromWindow();
|
|
88
|
+
if (provider) return provider;
|
|
89
|
+
return listenForPhantomInitialized({ timeout });
|
|
90
|
+
}
|
|
91
|
+
async function listenForPhantomInitialized({ timeout } = { timeout: 3e3 }) {
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
const handleInitialization = () => {
|
|
94
|
+
resolve(getPhantomFromWindow());
|
|
95
|
+
};
|
|
96
|
+
$window$3.addEventListener("phantom#initialized", handleInitialization, { once: true });
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
$window$3.removeEventListener("phantom#initialized", handleInitialization);
|
|
99
|
+
resolve(null);
|
|
100
|
+
}, timeout);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function getPhantomFromWindow() {
|
|
104
|
+
if (!(typeof window !== "undefined" && (typeof $window$3.ethereum !== "undefined" || typeof $window$3.phantom !== "undefined"))) return;
|
|
105
|
+
if ($window$3.phantom) return $window$3.phantom.ethereum;
|
|
106
|
+
if ($window$3.ethereum.isPhantom) return $window$3.ethereum;
|
|
107
|
+
if ($window$3.providers) return $window$3.providers.find((p) => p.isPhantom);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/strategy/utils/metamask.ts
|
|
112
|
+
const $window$2 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
113
|
+
async function getMetamaskProvider({ timeout } = { timeout: 3e3 }) {
|
|
114
|
+
const provider = getMetamaskFromWindow();
|
|
115
|
+
if (provider) return provider;
|
|
116
|
+
return listenForMetamaskInitialized({ timeout });
|
|
117
|
+
}
|
|
118
|
+
async function listenForMetamaskInitialized({ timeout } = { timeout: 3e3 }) {
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
const handleInitialization = () => {
|
|
121
|
+
resolve(getMetamaskFromWindow());
|
|
122
|
+
};
|
|
123
|
+
$window$2.addEventListener("ethereum#initialized", handleInitialization, { once: true });
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
$window$2.removeEventListener("ethereum#initialized", handleInitialization);
|
|
126
|
+
resolve(null);
|
|
127
|
+
}, timeout);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function getMetamaskFromWindow() {
|
|
131
|
+
if (!(typeof window !== "undefined" && typeof $window$2.ethereum !== "undefined")) return;
|
|
132
|
+
if ($window$2.ethereum.isMetaMask) return $window$2.ethereum;
|
|
133
|
+
if ($window$2.providers) return $window$2.providers.find((p) => p.isMetaMask);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/strategy/utils/trustWallet.ts
|
|
138
|
+
const $window$1 = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
139
|
+
async function getTrustWalletProvider({ timeout } = { timeout: 3e3 }) {
|
|
140
|
+
const provider = getTrustWalletFromWindow();
|
|
141
|
+
if (provider) return provider;
|
|
142
|
+
return listenForTrustWalletInitialized({ timeout });
|
|
143
|
+
}
|
|
144
|
+
async function listenForTrustWalletInitialized({ timeout } = { timeout: 3e3 }) {
|
|
145
|
+
return new Promise((resolve) => {
|
|
146
|
+
const handleInitialization = () => {
|
|
147
|
+
resolve(getTrustWalletFromWindow());
|
|
148
|
+
};
|
|
149
|
+
$window$1.addEventListener("trustwallet#initialized", handleInitialization, { once: true });
|
|
150
|
+
setTimeout(() => {
|
|
151
|
+
$window$1.removeEventListener("trustwallet#initialized", handleInitialization);
|
|
152
|
+
resolve(null);
|
|
153
|
+
}, timeout);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function getTrustWalletFromWindow() {
|
|
157
|
+
if (!(typeof window !== "undefined" && (typeof $window$1.ethereum !== "undefined" || typeof $window$1.trustWallet !== "undefined"))) return;
|
|
158
|
+
if ($window$1.trustWallet) return $window$1.trustWallet;
|
|
159
|
+
if ($window$1.ethereum.isTrustWallet || $window$1.ethereum.isTrust) return $window$1.ethereum;
|
|
160
|
+
if ($window$1.providers) return $window$1.providers.find((p) => p.isTrustWallet);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/utils/index.ts
|
|
165
|
+
const getEvmProvider = async (wallet) => {
|
|
166
|
+
if (!(0, __injectivelabs_wallet_base.isEvmBrowserWallet)(wallet)) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Evm Wallet for ${(0, __injectivelabs_utils.capitalize)(wallet)} is not supported.`));
|
|
167
|
+
try {
|
|
168
|
+
let provider;
|
|
169
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.Metamask) provider = await getMetamaskProvider();
|
|
170
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.Rabby) provider = await getRabbyProvider();
|
|
171
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.BitGet) provider = await getBitGetProvider();
|
|
172
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.Phantom) provider = await getPhantomProvider();
|
|
173
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.TrustWallet) provider = await getTrustWalletProvider();
|
|
174
|
+
if (wallet === __injectivelabs_wallet_base.Wallet.OkxWallet) provider = await getOkxWalletProvider();
|
|
175
|
+
if (!provider) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Please install ${(0, __injectivelabs_utils.capitalize)(wallet)} Extension`));
|
|
176
|
+
return provider;
|
|
177
|
+
} catch (_unused) {
|
|
178
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Please install ${(0, __injectivelabs_utils.capitalize)(wallet)} Extension`));
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const updateEvmNetwork = async (wallet, chainId) => {
|
|
182
|
+
if (!(0, __injectivelabs_wallet_base.isEvmBrowserWallet)(wallet)) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Evm Wallet for ${(0, __injectivelabs_utils.capitalize)(wallet)} is not supported.`));
|
|
183
|
+
const provider = await getEvmProvider(wallet);
|
|
184
|
+
if (!provider) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Please install ${(0, __injectivelabs_utils.capitalize)(wallet)} Extension`));
|
|
185
|
+
try {
|
|
186
|
+
const chainIdToHex = chainId.toString(16);
|
|
187
|
+
return await Promise.race([provider.request({
|
|
188
|
+
method: "wallet_switchEthereumChain",
|
|
189
|
+
params: [{ chainId: `0x${chainIdToHex}` }]
|
|
190
|
+
}), new Promise((resolve) => provider.on("chainChanged", ({ chain }) => {
|
|
191
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.id) === chainIdToHex) resolve();
|
|
192
|
+
}))]);
|
|
193
|
+
} catch (_unused2) {
|
|
194
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Please update your ${(0, __injectivelabs_utils.capitalize)(wallet)} network`));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/strategy/utils/rainbow.ts
|
|
200
|
+
const $window = (0, __injectivelabs_sdk_ts.isServerSide)() ? {} : window;
|
|
201
|
+
async function getRainbowProvider({ timeout } = { timeout: 3e3 }) {
|
|
202
|
+
const provider = getRainbowWalletFromWindow();
|
|
203
|
+
if (provider) return provider;
|
|
204
|
+
return listenForRainbowWalletInitialized({ timeout });
|
|
205
|
+
}
|
|
206
|
+
async function listenForRainbowWalletInitialized({ timeout } = { timeout: 3e3 }) {
|
|
207
|
+
return new Promise((resolve) => {
|
|
208
|
+
const handleInitialization = () => {
|
|
209
|
+
resolve(getRainbowWalletFromWindow());
|
|
210
|
+
};
|
|
211
|
+
$window.addEventListener("rainbow#initialized", handleInitialization, { once: true });
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
$window.removeEventListener("rainbow#initialized", handleInitialization);
|
|
214
|
+
resolve(null);
|
|
215
|
+
}, timeout);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function getRainbowWalletFromWindow() {
|
|
219
|
+
if (!(typeof window !== "undefined" && (typeof $window.ethereum !== "undefined" || typeof $window.rainbow !== "undefined"))) return;
|
|
220
|
+
if ($window.rainbow) return $window.rainbow;
|
|
221
|
+
if ($window.ethereum.isRainbow) return $window.ethereum;
|
|
222
|
+
if ($window.providers) return $window.providers.find((p) => p.isRainbow);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
|
|
227
|
+
function _typeof(o) {
|
|
228
|
+
"@babel/helpers - typeof";
|
|
229
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
230
|
+
return typeof o$1;
|
|
231
|
+
} : function(o$1) {
|
|
232
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
233
|
+
}, _typeof(o);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region \0@oxc-project+runtime@0.98.0/helpers/toPrimitive.js
|
|
238
|
+
function toPrimitive(t, r) {
|
|
239
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
240
|
+
var e = t[Symbol.toPrimitive];
|
|
241
|
+
if (void 0 !== e) {
|
|
242
|
+
var i = e.call(t, r || "default");
|
|
243
|
+
if ("object" != _typeof(i)) return i;
|
|
244
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
245
|
+
}
|
|
246
|
+
return ("string" === r ? String : Number)(t);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region \0@oxc-project+runtime@0.98.0/helpers/toPropertyKey.js
|
|
251
|
+
function toPropertyKey(t) {
|
|
252
|
+
var i = toPrimitive(t, "string");
|
|
253
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region \0@oxc-project+runtime@0.98.0/helpers/defineProperty.js
|
|
258
|
+
function _defineProperty(e, r, t) {
|
|
259
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
260
|
+
value: t,
|
|
261
|
+
enumerable: !0,
|
|
262
|
+
configurable: !0,
|
|
263
|
+
writable: !0
|
|
264
|
+
}) : e[r] = t, e;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/strategy/strategy.ts
|
|
269
|
+
var EvmWallet = class extends __injectivelabs_wallet_base.BaseConcreteStrategy {
|
|
270
|
+
constructor(args) {
|
|
271
|
+
super(args);
|
|
272
|
+
_defineProperty(this, "wallet", void 0);
|
|
273
|
+
_defineProperty(this, "evmProviders", {});
|
|
274
|
+
if (!(0, __injectivelabs_wallet_base.isEvmBrowserWallet)(args.wallet)) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`Evm Wallet for ${(0, __injectivelabs_utils.capitalize)(args.wallet)} is not supported.`));
|
|
275
|
+
if (!(0, __injectivelabs_sdk_ts.isServerSide)()) {
|
|
276
|
+
window.addEventListener("eip6963:announceProvider", (announcement) => {
|
|
277
|
+
const event = announcement;
|
|
278
|
+
const walletName = event.detail.info.name.toLowerCase();
|
|
279
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.Metamask.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.Metamask] = event.detail.provider;
|
|
280
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.Rabby.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.Rabby] = event.detail.provider;
|
|
281
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.Rainbow.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.Rainbow] = event.detail.provider;
|
|
282
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.Phantom.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.Phantom] = event.detail.provider;
|
|
283
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.OkxWallet.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.OkxWallet] = event.detail.provider;
|
|
284
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.BitGet.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.BitGet] = event.detail.provider;
|
|
285
|
+
if (walletName === __injectivelabs_wallet_base.Wallet.TrustWallet.toLowerCase()) this.evmProviders[__injectivelabs_wallet_base.Wallet.TrustWallet] = event.detail.provider;
|
|
286
|
+
});
|
|
287
|
+
window.dispatchEvent(new Event("eip6963:requestProvider"));
|
|
288
|
+
}
|
|
289
|
+
this.wallet = args.wallet;
|
|
290
|
+
}
|
|
291
|
+
EvmWalletException(error, context) {
|
|
292
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.Metamask) return new __injectivelabs_exceptions.MetamaskException(error, context);
|
|
293
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.BitGet) return new __injectivelabs_exceptions.BitGetException(error, context);
|
|
294
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.OkxWallet) return new __injectivelabs_exceptions.OkxWalletException(error, context);
|
|
295
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.Phantom) return new __injectivelabs_exceptions.MetamaskException(error, context);
|
|
296
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.TrustWallet) return new __injectivelabs_exceptions.TrustWalletException(error, context);
|
|
297
|
+
if (this.wallet === __injectivelabs_wallet_base.Wallet.Rainbow) return new __injectivelabs_exceptions.RainbowWalletException(error, context);
|
|
298
|
+
return new __injectivelabs_exceptions.WalletException(error, context);
|
|
299
|
+
}
|
|
300
|
+
async getWalletDeviceType() {
|
|
301
|
+
return Promise.resolve(__injectivelabs_wallet_base.WalletDeviceType.Browser);
|
|
302
|
+
}
|
|
303
|
+
async enable() {
|
|
304
|
+
return Promise.resolve(true);
|
|
305
|
+
}
|
|
306
|
+
async disconnect() {
|
|
307
|
+
if (this.listeners[__injectivelabs_wallet_base.WalletEventListener.AccountChange]) (await this.getEthereum()).removeListener("accountsChanged", this.listeners[__injectivelabs_wallet_base.WalletEventListener.AccountChange]);
|
|
308
|
+
if (this.listeners[__injectivelabs_wallet_base.WalletEventListener.ChainIdChange]) (await this.getEthereum()).removeListener("chainChanged", this.listeners[__injectivelabs_wallet_base.WalletEventListener.ChainIdChange]);
|
|
309
|
+
this.listeners = {};
|
|
310
|
+
}
|
|
311
|
+
async getAddresses() {
|
|
312
|
+
const ethereum = await this.getEthereum();
|
|
313
|
+
try {
|
|
314
|
+
return await ethereum.request({ method: "eth_requestAccounts" });
|
|
315
|
+
} catch (e) {
|
|
316
|
+
throw this.EvmWalletException(new Error(e.message), {
|
|
317
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
318
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
319
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
async getSessionOrConfirm(address) {
|
|
324
|
+
return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
|
|
325
|
+
}
|
|
326
|
+
async sendEvmTransaction(transaction, _options) {
|
|
327
|
+
const ethereum = await this.getEthereum();
|
|
328
|
+
try {
|
|
329
|
+
return await ethereum.request({
|
|
330
|
+
method: "eth_sendTransaction",
|
|
331
|
+
params: [transaction]
|
|
332
|
+
});
|
|
333
|
+
} catch (e) {
|
|
334
|
+
throw this.EvmWalletException(new Error(e.message), {
|
|
335
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
336
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
337
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SendEvmTransaction
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
async sendTransaction(transaction, options) {
|
|
342
|
+
const { endpoints, txTimeout } = options;
|
|
343
|
+
if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints within the options for using Ethereum native wallets"));
|
|
344
|
+
const response = await new __injectivelabs_sdk_ts.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
|
|
345
|
+
if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
|
|
346
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
347
|
+
contextCode: response.code,
|
|
348
|
+
contextModule: response.codespace
|
|
349
|
+
});
|
|
350
|
+
return response;
|
|
351
|
+
}
|
|
352
|
+
async signEip712TypedData(eip712json, address) {
|
|
353
|
+
const ethereum = await this.getEthereum();
|
|
354
|
+
try {
|
|
355
|
+
return await ethereum.request({
|
|
356
|
+
method: "eth_signTypedData_v4",
|
|
357
|
+
params: [address, eip712json]
|
|
358
|
+
});
|
|
359
|
+
} catch (e) {
|
|
360
|
+
if (e.message.includes("Ledger: The signature doesnt match the right address")) throw new __injectivelabs_exceptions.MetamaskException(/* @__PURE__ */ new Error("Please connect directly with Ledger to sign this transaction"), {
|
|
361
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
362
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
363
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SignTransaction
|
|
364
|
+
});
|
|
365
|
+
throw new __injectivelabs_exceptions.MetamaskException(new Error(e.message), {
|
|
366
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
367
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
368
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SignTransaction
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
async signAminoCosmosTransaction(_transaction) {
|
|
373
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("This wallet does not support signing Cosmos transactions"), {
|
|
374
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
375
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
376
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SignTransaction
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
async signCosmosTransaction(_transaction) {
|
|
380
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("This wallet does not support signing Cosmos transactions"), {
|
|
381
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
382
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
383
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SignTransaction
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
async signArbitrary(signer, data) {
|
|
387
|
+
const ethereum = await this.getEthereum();
|
|
388
|
+
try {
|
|
389
|
+
return await ethereum.request({
|
|
390
|
+
method: "personal_sign",
|
|
391
|
+
params: [(0, __injectivelabs_sdk_ts.toUtf8)(data), signer]
|
|
392
|
+
});
|
|
393
|
+
} catch (e) {
|
|
394
|
+
throw this.EvmWalletException(new Error(e.message), {
|
|
395
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
396
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
397
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.SignArbitrary
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
async getEthereumChainId() {
|
|
402
|
+
const ethereum = await this.getEthereum();
|
|
403
|
+
try {
|
|
404
|
+
return ethereum.request({ method: "eth_chainId" });
|
|
405
|
+
} catch (e) {
|
|
406
|
+
throw this.EvmWalletException(new Error(e.message), {
|
|
407
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
408
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
409
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetChainId
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
async getEvmTransactionReceipt(txHash) {
|
|
414
|
+
const ethereum = await this.getEthereum();
|
|
415
|
+
const chainIdHex = await ethereum.request({ method: "eth_chainId" });
|
|
416
|
+
const publicClient = (0, __injectivelabs_wallet_base.getViemPublicClientFromEip1193Provider)(parseInt(chainIdHex, 16), ethereum);
|
|
417
|
+
try {
|
|
418
|
+
await publicClient.waitForTransactionReceipt({
|
|
419
|
+
hash: txHash,
|
|
420
|
+
timeout: 3e4,
|
|
421
|
+
pollingInterval: 3e3
|
|
422
|
+
});
|
|
423
|
+
return txHash;
|
|
424
|
+
} catch (_unused) {
|
|
425
|
+
throw new Error(`Failed to retrieve transaction receipt for txHash: ${txHash}`);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
async getPubKey() {
|
|
429
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You can only fetch PubKey from Cosmos native wallets"));
|
|
430
|
+
}
|
|
431
|
+
async onChainIdChanged(callback) {
|
|
432
|
+
const ethereum = await this.getEthereum();
|
|
433
|
+
this.listeners = { [__injectivelabs_wallet_base.WalletEventListener.ChainIdChange]: callback };
|
|
434
|
+
ethereum.on("chainChanged", callback);
|
|
435
|
+
}
|
|
436
|
+
async onAccountChange(callback) {
|
|
437
|
+
const ethereum = await this.getEthereum();
|
|
438
|
+
this.listeners = { [__injectivelabs_wallet_base.WalletEventListener.AccountChange]: callback };
|
|
439
|
+
ethereum.on("accountsChanged", callback);
|
|
440
|
+
}
|
|
441
|
+
async getEip1193Provider() {
|
|
442
|
+
return this.getEthereum();
|
|
443
|
+
}
|
|
444
|
+
async addEvmNetwork(chainId) {
|
|
445
|
+
var _chain$rpcUrls, _chain$blockExplorers;
|
|
446
|
+
const ethereum = await this.getEthereum();
|
|
447
|
+
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
448
|
+
const chain = (0, __injectivelabs_wallet_base.getEvmChainConfig)(chainId);
|
|
449
|
+
const params = {
|
|
450
|
+
chainId: chainIdHex,
|
|
451
|
+
chainName: chain.name,
|
|
452
|
+
rpcUrls: [...((_chain$rpcUrls = chain.rpcUrls) === null || _chain$rpcUrls === void 0 || (_chain$rpcUrls = _chain$rpcUrls.default) === null || _chain$rpcUrls === void 0 ? void 0 : _chain$rpcUrls.http) || []],
|
|
453
|
+
blockExplorerUrls: ((_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 || (_chain$blockExplorers = _chain$blockExplorers.default) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.url) ? [chain.blockExplorers.default.url] : [],
|
|
454
|
+
nativeCurrency: chain.nativeCurrency
|
|
455
|
+
};
|
|
456
|
+
const TIMEOUT_MS = 3e4;
|
|
457
|
+
try {
|
|
458
|
+
await Promise.race([ethereum.request({
|
|
459
|
+
method: "wallet_switchEthereumChain",
|
|
460
|
+
params: [{ chainId: chainIdHex }]
|
|
461
|
+
}), new Promise((resolve, reject) => {
|
|
462
|
+
const handleChainChanged = (newChainId) => {
|
|
463
|
+
if (newChainId.toLowerCase() === chainIdHex.toLowerCase()) {
|
|
464
|
+
cleanup();
|
|
465
|
+
resolve();
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
const timeoutId = setTimeout(() => {
|
|
469
|
+
cleanup();
|
|
470
|
+
reject(/* @__PURE__ */ new Error("Chain switch timed out"));
|
|
471
|
+
}, TIMEOUT_MS);
|
|
472
|
+
const cleanup = () => {
|
|
473
|
+
ethereum.removeListener("chainChanged", handleChainChanged);
|
|
474
|
+
clearTimeout(timeoutId);
|
|
475
|
+
};
|
|
476
|
+
ethereum.on("chainChanged", handleChainChanged);
|
|
477
|
+
})]);
|
|
478
|
+
} catch (error) {
|
|
479
|
+
var _code, _data;
|
|
480
|
+
if (((_code = error.code) !== null && _code !== void 0 ? _code : error === null || error === void 0 || (_data = error.data) === null || _data === void 0 || (_data = _data.originalError) === null || _data === void 0 ? void 0 : _data.code) === 4902) {
|
|
481
|
+
await ethereum.request({
|
|
482
|
+
method: "wallet_addEthereumChain",
|
|
483
|
+
params: [params]
|
|
484
|
+
});
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (error.message === "Chain switch timed out") throw this.EvmWalletException(/* @__PURE__ */ new Error("Chain switch timed out"), {
|
|
488
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
489
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
490
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetChainId
|
|
491
|
+
});
|
|
492
|
+
throw this.EvmWalletException(/* @__PURE__ */ new Error(`Something went wrong while adding ${(0, __injectivelabs_utils.capitalize)(this.wallet || "wallet")} network`), {
|
|
493
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
494
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
495
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetChainId
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
async getEthereum() {
|
|
500
|
+
const evmProvider = this.evmProviders[this.wallet];
|
|
501
|
+
if (evmProvider) return evmProvider;
|
|
502
|
+
const backUpProvider = this.wallet === __injectivelabs_wallet_base.Wallet.Metamask ? await getMetamaskProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.Rabby ? await getRabbyProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.Phantom ? await getPhantomProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.BitGet ? await getBitGetProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.OkxWallet ? await getOkxWalletProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.TrustWallet ? await getTrustWalletProvider() : this.wallet === __injectivelabs_wallet_base.Wallet.Rainbow ? await getRainbowProvider() : void 0;
|
|
503
|
+
if (!backUpProvider) throw this.EvmWalletException(/* @__PURE__ */ new Error(`Please install the ${this.wallet} wallet extension.`), {
|
|
504
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
505
|
+
type: __injectivelabs_exceptions.ErrorType.WalletNotInstalledError,
|
|
506
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
|
|
507
|
+
});
|
|
508
|
+
return backUpProvider;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
//#endregion
|
|
513
|
+
exports.EvmWalletStrategy = EvmWallet;
|
|
514
|
+
exports.getBitGetProvider = getBitGetProvider;
|
|
515
|
+
exports.getEvmProvider = getEvmProvider;
|
|
516
|
+
exports.getMetamaskProvider = getMetamaskProvider;
|
|
517
|
+
exports.getOkxWalletProvider = getOkxWalletProvider;
|
|
518
|
+
exports.getPhantomProvider = getPhantomProvider;
|
|
519
|
+
exports.getRabbyProvider = getRabbyProvider;
|
|
520
|
+
exports.getRainbowProvider = getRainbowProvider;
|
|
521
|
+
exports.getTrustWalletProvider = getTrustWalletProvider;
|
|
522
|
+
exports.updateEvmNetwork = updateEvmNetwork;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { BaseConcreteStrategy, BrowserEip1993Provider, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, Eip1193Provider, SendTransactionOptions, StdSignDoc, Wallet, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
2
|
+
import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
|
+
import { ErrorContext, ThrownException } from "@injectivelabs/exceptions";
|
|
4
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw, TxResponse } from "@injectivelabs/sdk-ts";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/index.d.ts
|
|
7
|
+
declare const getEvmProvider: (wallet: Wallet) => Promise<BrowserEip1993Provider>;
|
|
8
|
+
declare const updateEvmNetwork: (wallet: Wallet, chainId: EvmChainId) => Promise<unknown>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/strategy/utils/rabby.d.ts
|
|
11
|
+
declare function getRabbyProvider({
|
|
12
|
+
timeout
|
|
13
|
+
}?: {
|
|
14
|
+
timeout: number;
|
|
15
|
+
}): Promise<BrowserEip1993Provider>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/strategy/utils/bitget.d.ts
|
|
18
|
+
declare function getBitGetProvider({
|
|
19
|
+
timeout
|
|
20
|
+
}?: {
|
|
21
|
+
timeout: number;
|
|
22
|
+
}): Promise<BrowserEip1993Provider>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/strategy/utils/Okx.d.ts
|
|
25
|
+
declare function getOkxWalletProvider({
|
|
26
|
+
timeout
|
|
27
|
+
}?: {
|
|
28
|
+
timeout: number;
|
|
29
|
+
}): Promise<BrowserEip1993Provider>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/strategy/utils/phantom.d.ts
|
|
32
|
+
declare function getPhantomProvider({
|
|
33
|
+
timeout
|
|
34
|
+
}?: {
|
|
35
|
+
timeout: number;
|
|
36
|
+
}): Promise<BrowserEip1993Provider>;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/strategy/utils/rainbow.d.ts
|
|
39
|
+
declare function getRainbowProvider({
|
|
40
|
+
timeout
|
|
41
|
+
}?: {
|
|
42
|
+
timeout: number;
|
|
43
|
+
}): Promise<BrowserEip1993Provider>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/strategy/utils/metamask.d.ts
|
|
46
|
+
declare function getMetamaskProvider({
|
|
47
|
+
timeout
|
|
48
|
+
}?: {
|
|
49
|
+
timeout: number;
|
|
50
|
+
}): Promise<BrowserEip1993Provider>;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/strategy/utils/trustWallet.d.ts
|
|
53
|
+
declare function getTrustWalletProvider({
|
|
54
|
+
timeout
|
|
55
|
+
}?: {
|
|
56
|
+
timeout: number;
|
|
57
|
+
}): Promise<BrowserEip1993Provider>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/strategy/strategy.d.ts
|
|
60
|
+
declare class EvmWallet extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
61
|
+
wallet?: Wallet;
|
|
62
|
+
evmProviders: Partial<Record<Wallet, BrowserEip1993Provider>>;
|
|
63
|
+
constructor(args: (ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs) & {
|
|
64
|
+
wallet: Wallet;
|
|
65
|
+
});
|
|
66
|
+
EvmWalletException(error: Error, context?: ErrorContext): ThrownException;
|
|
67
|
+
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
68
|
+
enable(): Promise<boolean>;
|
|
69
|
+
disconnect(): Promise<void>;
|
|
70
|
+
getAddresses(): Promise<string[]>;
|
|
71
|
+
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
72
|
+
sendEvmTransaction(transaction: unknown, _options: {
|
|
73
|
+
address: AccountAddress;
|
|
74
|
+
evmChainId: EvmChainId;
|
|
75
|
+
}): Promise<string>;
|
|
76
|
+
sendTransaction(transaction: TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
77
|
+
signEip712TypedData(eip712json: string, address: AccountAddress): Promise<string>;
|
|
78
|
+
signAminoCosmosTransaction(_transaction: {
|
|
79
|
+
address: string;
|
|
80
|
+
signDoc: StdSignDoc;
|
|
81
|
+
}): Promise<AminoSignResponse>;
|
|
82
|
+
signCosmosTransaction(_transaction: {
|
|
83
|
+
txRaw: TxRaw;
|
|
84
|
+
accountNumber: number;
|
|
85
|
+
chainId: string;
|
|
86
|
+
address: string;
|
|
87
|
+
}): Promise<DirectSignResponse>;
|
|
88
|
+
signArbitrary(signer: AccountAddress, data: string | Uint8Array): Promise<string>;
|
|
89
|
+
getEthereumChainId(): Promise<string>;
|
|
90
|
+
getEvmTransactionReceipt(txHash: string): Promise<string>;
|
|
91
|
+
getPubKey(): Promise<string>;
|
|
92
|
+
onChainIdChanged(callback: (chain: string) => void): Promise<void>;
|
|
93
|
+
onAccountChange(callback: (account: AccountAddress | string[]) => void): Promise<void>;
|
|
94
|
+
getEip1193Provider(): Promise<Eip1193Provider>;
|
|
95
|
+
addEvmNetwork(chainId: EvmChainId): Promise<void>;
|
|
96
|
+
private getEthereum;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { EvmWallet as EvmWalletStrategy, getBitGetProvider, getEvmProvider, getMetamaskProvider, getOkxWalletProvider, getPhantomProvider, getRabbyProvider, getRainbowProvider, getTrustWalletProvider, updateEvmNetwork };
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"type": "commonjs"
|
|
3
|
+
}
|