@wagmi/connectors 3.0.0-cjs → 3.1.0-cjs
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/LICENSE +1 -1
- package/coinbaseWallet/package.json +1 -1
- package/dist/{base-98051e7c.d.ts → base-ff961c9d.d.ts} +1 -1
- package/dist/{chunk-YZRVUC6Y.js → chunk-JA6XQLQA.js} +21 -24
- package/dist/{chunk-ZCAPXGBX.js → chunk-UGBGYVBH.js} +4 -8
- package/dist/{chunk-QYMCVNHT.js → chunk-W65LBPLT.js} +2 -12
- package/dist/coinbaseWallet.d.ts +2 -2
- package/dist/coinbaseWallet.js +23 -24
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/injected.d.ts +2 -2
- package/dist/injected.js +4 -4
- package/dist/ledger.d.ts +2 -2
- package/dist/ledger.js +45 -46
- package/dist/metaMask.d.ts +2 -2
- package/dist/metaMask.js +10 -11
- package/dist/mock/index.d.ts +2 -2
- package/dist/mock/index.js +32 -34
- package/dist/safe.d.ts +2 -2
- package/dist/safe.js +17 -18
- package/dist/walletConnect.d.ts +2 -2
- package/dist/walletConnect.js +69 -70
- package/dist/walletConnectLegacy.d.ts +2 -2
- package/dist/walletConnectLegacy.js +20 -21
- package/injected/package.json +1 -1
- package/ledger/package.json +1 -1
- package/metaMask/package.json +1 -1
- package/mock/package.json +1 -1
- package/package.json +41 -7
- package/safe/package.json +1 -1
- package/walletConnect/package.json +1 -1
- package/walletConnectLegacy/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Chain as Chain$1 } from '@wagmi/chains';
|
|
2
1
|
import EventEmitter from 'eventemitter3';
|
|
3
2
|
import { EIP1193Provider, Transport, Chain, Account, WalletClient as WalletClient$1, Address } from 'viem';
|
|
3
|
+
import { Chain as Chain$1 } from 'viem/chains';
|
|
4
4
|
|
|
5
5
|
type InjectedProviderFlags = {
|
|
6
6
|
isApexWallet?: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkUGBGYVBHjs = require('./chunk-UGBGYVBH.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
@@ -10,8 +10,7 @@ var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
var _chunkQYMCVNHTjs = require('./chunk-QYMCVNHT.js');
|
|
13
|
+
var _chunkW65LBPLTjs = require('./chunk-W65LBPLT.js');
|
|
15
14
|
|
|
16
15
|
// src/injected.ts
|
|
17
16
|
|
|
@@ -139,7 +138,7 @@ function getInjectedName(ethereum) {
|
|
|
139
138
|
|
|
140
139
|
// src/injected.ts
|
|
141
140
|
var _provider;
|
|
142
|
-
var InjectedConnector = class extends
|
|
141
|
+
var InjectedConnector = class extends _chunkW65LBPLTjs.Connector {
|
|
143
142
|
constructor({
|
|
144
143
|
chains,
|
|
145
144
|
options: options_
|
|
@@ -157,25 +156,23 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
157
156
|
...options_
|
|
158
157
|
};
|
|
159
158
|
super({ chains, options });
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
_chunkQYMCVNHTjs.__publicField.call(void 0, this, "shimDisconnectKey", `${this.id}.shimDisconnect`);
|
|
165
|
-
_chunkQYMCVNHTjs.__publicField.call(void 0, this, "onAccountsChanged", (accounts) => {
|
|
159
|
+
this.id = "injected";
|
|
160
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _provider, void 0);
|
|
161
|
+
this.shimDisconnectKey = `${this.id}.shimDisconnect`;
|
|
162
|
+
this.onAccountsChanged = (accounts) => {
|
|
166
163
|
if (accounts.length === 0)
|
|
167
164
|
this.emit("disconnect");
|
|
168
165
|
else
|
|
169
166
|
this.emit("change", {
|
|
170
167
|
account: _viem.getAddress.call(void 0, accounts[0])
|
|
171
168
|
});
|
|
172
|
-
}
|
|
173
|
-
|
|
169
|
+
};
|
|
170
|
+
this.onChainChanged = (chainId) => {
|
|
174
171
|
const id = _chunkOQILYQDOjs.normalizeChainId.call(void 0, chainId);
|
|
175
172
|
const unsupported = this.isChainUnsupported(id);
|
|
176
173
|
this.emit("change", { chain: { id, unsupported } });
|
|
177
|
-
}
|
|
178
|
-
|
|
174
|
+
};
|
|
175
|
+
this.onDisconnect = async (error) => {
|
|
179
176
|
if (error.code === 1013) {
|
|
180
177
|
const provider = await this.getProvider();
|
|
181
178
|
if (provider) {
|
|
@@ -187,7 +184,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
187
184
|
this.emit("disconnect");
|
|
188
185
|
if (this.options.shimDisconnect)
|
|
189
186
|
_optionalChain([this, 'access', _4 => _4.storage, 'optionalAccess', _5 => _5.removeItem, 'call', _6 => _6(this.shimDisconnectKey)]);
|
|
190
|
-
}
|
|
187
|
+
};
|
|
191
188
|
const provider = options.getProvider();
|
|
192
189
|
if (typeof options.name === "string")
|
|
193
190
|
this.name = options.name;
|
|
@@ -209,7 +206,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
209
206
|
try {
|
|
210
207
|
const provider = await this.getProvider();
|
|
211
208
|
if (!provider)
|
|
212
|
-
throw new (0,
|
|
209
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
213
210
|
if (provider.on) {
|
|
214
211
|
provider.on("accountsChanged", this.onAccountsChanged);
|
|
215
212
|
provider.on("chainChanged", this.onChainChanged);
|
|
@@ -251,7 +248,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
251
248
|
async getAccount() {
|
|
252
249
|
const provider = await this.getProvider();
|
|
253
250
|
if (!provider)
|
|
254
|
-
throw new (0,
|
|
251
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
255
252
|
const accounts = await provider.request({
|
|
256
253
|
method: "eth_accounts"
|
|
257
254
|
});
|
|
@@ -260,14 +257,14 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
260
257
|
async getChainId() {
|
|
261
258
|
const provider = await this.getProvider();
|
|
262
259
|
if (!provider)
|
|
263
|
-
throw new (0,
|
|
260
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
264
261
|
return provider.request({ method: "eth_chainId" }).then(_chunkOQILYQDOjs.normalizeChainId);
|
|
265
262
|
}
|
|
266
263
|
async getProvider() {
|
|
267
264
|
const provider = this.options.getProvider();
|
|
268
265
|
if (provider)
|
|
269
|
-
|
|
270
|
-
return
|
|
266
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _provider, provider);
|
|
267
|
+
return _chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider);
|
|
271
268
|
}
|
|
272
269
|
async getWalletClient({
|
|
273
270
|
chainId
|
|
@@ -291,7 +288,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
291
288
|
return false;
|
|
292
289
|
const provider = await this.getProvider();
|
|
293
290
|
if (!provider)
|
|
294
|
-
throw new (0,
|
|
291
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
295
292
|
const account = await this.getAccount();
|
|
296
293
|
return !!account;
|
|
297
294
|
} catch (e) {
|
|
@@ -301,7 +298,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
301
298
|
async switchChain(chainId) {
|
|
302
299
|
const provider = await this.getProvider();
|
|
303
300
|
if (!provider)
|
|
304
|
-
throw new (0,
|
|
301
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
305
302
|
const id = _viem.numberToHex.call(void 0, chainId);
|
|
306
303
|
try {
|
|
307
304
|
await Promise.all([
|
|
@@ -326,7 +323,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
326
323
|
} catch (error) {
|
|
327
324
|
const chain = this.chains.find((x) => x.id === chainId);
|
|
328
325
|
if (!chain)
|
|
329
|
-
throw new (0,
|
|
326
|
+
throw new (0, _chunkUGBGYVBHjs.ChainNotConfiguredForConnectorError)({
|
|
330
327
|
chainId,
|
|
331
328
|
connectorId: this.id
|
|
332
329
|
});
|
|
@@ -367,7 +364,7 @@ var InjectedConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
367
364
|
}) {
|
|
368
365
|
const provider = await this.getProvider();
|
|
369
366
|
if (!provider)
|
|
370
|
-
throw new (0,
|
|
367
|
+
throw new (0, _chunkUGBGYVBHjs.ConnectorNotFoundError)();
|
|
371
368
|
return provider.request({
|
|
372
369
|
method: "wallet_watchAsset",
|
|
373
370
|
params: {
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
|
|
3
|
-
var _chunkQYMCVNHTjs = require('./chunk-QYMCVNHT.js');
|
|
4
|
-
|
|
5
|
-
// src/errors.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/errors.ts
|
|
6
2
|
var ChainNotConfiguredForConnectorError = class extends Error {
|
|
7
3
|
constructor({
|
|
8
4
|
chainId,
|
|
9
5
|
connectorId
|
|
10
6
|
}) {
|
|
11
7
|
super(`Chain "${chainId}" not configured for connector "${connectorId}".`);
|
|
12
|
-
|
|
8
|
+
this.name = "ChainNotConfiguredForConnectorError";
|
|
13
9
|
}
|
|
14
10
|
};
|
|
15
11
|
var ConnectorNotFoundError = class extends Error {
|
|
16
12
|
constructor() {
|
|
17
13
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
this.name = "ConnectorNotFoundError";
|
|
15
|
+
this.message = "Connector not found";
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
18
|
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
var __accessCheck = (obj, member, msg) => {
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var __accessCheck = (obj, member, msg) => {
|
|
8
2
|
if (!member.has(obj))
|
|
9
3
|
throw TypeError("Cannot " + msg);
|
|
10
4
|
};
|
|
@@ -36,9 +30,6 @@ var Connector = class extends _eventemitter32.default {
|
|
|
36
30
|
options
|
|
37
31
|
}) {
|
|
38
32
|
super();
|
|
39
|
-
__publicField(this, "chains");
|
|
40
|
-
__publicField(this, "options");
|
|
41
|
-
__publicField(this, "storage");
|
|
42
33
|
this.chains = chains;
|
|
43
34
|
this.options = options;
|
|
44
35
|
}
|
|
@@ -64,5 +55,4 @@ var Connector = class extends _eventemitter32.default {
|
|
|
64
55
|
|
|
65
56
|
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
exports.__publicField = __publicField; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateMethod = __privateMethod; exports.Connector = Connector;
|
|
58
|
+
exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateMethod = __privateMethod; exports.Connector = Connector;
|
package/dist/coinbaseWallet.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CoinbaseWalletProvider } from '@coinbase/wallet-sdk';
|
|
2
2
|
import { CoinbaseWalletSDKOptions } from '@coinbase/wallet-sdk/dist/CoinbaseWalletSDK';
|
|
3
|
-
import { Chain } from '
|
|
4
|
-
import { C as Connector, c as WalletClient } from './base-
|
|
3
|
+
import { Chain } from 'viem/chains';
|
|
4
|
+
import { C as Connector, c as WalletClient } from './base-ff961c9d.js';
|
|
5
5
|
import 'eventemitter3';
|
|
6
6
|
import 'viem';
|
|
7
7
|
|
package/dist/coinbaseWallet.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUGBGYVBHjs = require('./chunk-UGBGYVBH.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
@@ -9,8 +9,7 @@ var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
var _chunkQYMCVNHTjs = require('./chunk-QYMCVNHT.js');
|
|
12
|
+
var _chunkW65LBPLTjs = require('./chunk-W65LBPLT.js');
|
|
14
13
|
|
|
15
14
|
// src/coinbaseWallet.ts
|
|
16
15
|
|
|
@@ -22,7 +21,7 @@ var _chunkQYMCVNHTjs = require('./chunk-QYMCVNHT.js');
|
|
|
22
21
|
|
|
23
22
|
var _viem = require('viem');
|
|
24
23
|
var _client, _provider;
|
|
25
|
-
var CoinbaseWalletConnector = class extends
|
|
24
|
+
var CoinbaseWalletConnector = class extends _chunkW65LBPLTjs.Connector {
|
|
26
25
|
constructor({ chains, options }) {
|
|
27
26
|
super({
|
|
28
27
|
chains,
|
|
@@ -31,25 +30,25 @@ var CoinbaseWalletConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
31
30
|
...options
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
this.id = "coinbaseWallet";
|
|
34
|
+
this.name = "Coinbase Wallet";
|
|
35
|
+
this.ready = true;
|
|
36
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _client, void 0);
|
|
37
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _provider, void 0);
|
|
38
|
+
this.onAccountsChanged = (accounts) => {
|
|
40
39
|
if (accounts.length === 0)
|
|
41
40
|
this.emit("disconnect");
|
|
42
41
|
else
|
|
43
42
|
this.emit("change", { account: _viem.getAddress.call(void 0, accounts[0]) });
|
|
44
|
-
}
|
|
45
|
-
|
|
43
|
+
};
|
|
44
|
+
this.onChainChanged = (chainId) => {
|
|
46
45
|
const id = _chunkOQILYQDOjs.normalizeChainId.call(void 0, chainId);
|
|
47
46
|
const unsupported = this.isChainUnsupported(id);
|
|
48
47
|
this.emit("change", { chain: { id, unsupported } });
|
|
49
|
-
}
|
|
50
|
-
|
|
48
|
+
};
|
|
49
|
+
this.onDisconnect = () => {
|
|
51
50
|
this.emit("disconnect");
|
|
52
|
-
}
|
|
51
|
+
};
|
|
53
52
|
}
|
|
54
53
|
async connect({ chainId } = {}) {
|
|
55
54
|
try {
|
|
@@ -80,7 +79,7 @@ var CoinbaseWalletConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
async disconnect() {
|
|
83
|
-
if (!
|
|
82
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider))
|
|
84
83
|
return;
|
|
85
84
|
const provider = await this.getProvider();
|
|
86
85
|
provider.removeListener("accountsChanged", this.onAccountsChanged);
|
|
@@ -102,24 +101,24 @@ var CoinbaseWalletConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
102
101
|
return chainId;
|
|
103
102
|
}
|
|
104
103
|
async getProvider() {
|
|
105
|
-
if (!
|
|
106
|
-
let CoinbaseWalletSDK = (await Promise.resolve().then(() => require("@coinbase/wallet-sdk"))).default;
|
|
104
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider)) {
|
|
105
|
+
let CoinbaseWalletSDK = (await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/wallet-sdk")))).default;
|
|
107
106
|
if (typeof CoinbaseWalletSDK !== "function" && typeof CoinbaseWalletSDK.default === "function")
|
|
108
107
|
CoinbaseWalletSDK = CoinbaseWalletSDK.default;
|
|
109
|
-
|
|
108
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _client, new CoinbaseWalletSDK(this.options));
|
|
110
109
|
class WalletProvider {
|
|
111
110
|
}
|
|
112
111
|
class Client {
|
|
113
112
|
}
|
|
114
|
-
const walletExtensionChainId = _optionalChain([
|
|
113
|
+
const walletExtensionChainId = _optionalChain([_chunkW65LBPLTjs.__privateGet.call(void 0, this, _client), 'access', _ => _.walletExtension, 'optionalAccess', _2 => _2.getChainId, 'call', _3 => _3()]);
|
|
115
114
|
const chain = this.chains.find(
|
|
116
115
|
(chain2) => this.options.chainId ? chain2.id === this.options.chainId : chain2.id === walletExtensionChainId
|
|
117
116
|
) || this.chains[0];
|
|
118
117
|
const chainId = this.options.chainId || _optionalChain([chain, 'optionalAccess', _4 => _4.id]);
|
|
119
118
|
const jsonRpcUrl = this.options.jsonRpcUrl || _optionalChain([chain, 'optionalAccess', _5 => _5.rpcUrls, 'access', _6 => _6.default, 'access', _7 => _7.http, 'access', _8 => _8[0]]);
|
|
120
|
-
|
|
119
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _provider, _chunkW65LBPLTjs.__privateGet.call(void 0, this, _client).makeWeb3Provider(jsonRpcUrl, chainId));
|
|
121
120
|
}
|
|
122
|
-
return
|
|
121
|
+
return _chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider);
|
|
123
122
|
}
|
|
124
123
|
async getWalletClient({
|
|
125
124
|
chainId
|
|
@@ -163,7 +162,7 @@ var CoinbaseWalletConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
163
162
|
} catch (error) {
|
|
164
163
|
const chain = this.chains.find((x) => x.id === chainId);
|
|
165
164
|
if (!chain)
|
|
166
|
-
throw new (0,
|
|
165
|
+
throw new (0, _chunkUGBGYVBHjs.ChainNotConfiguredForConnectorError)({
|
|
167
166
|
chainId,
|
|
168
167
|
connectorId: this.id
|
|
169
168
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as Connector, a as ConnectorData, b as ConnectorEvents, W as WindowProvider } from './base-
|
|
2
|
-
import '@wagmi/chains';
|
|
1
|
+
export { C as Connector, a as ConnectorData, b as ConnectorEvents, W as WindowProvider } from './base-ff961c9d.js';
|
|
3
2
|
import 'eventemitter3';
|
|
4
3
|
import 'viem';
|
|
4
|
+
import 'viem/chains';
|
|
5
5
|
|
|
6
6
|
declare class ChainNotConfiguredForConnectorError extends Error {
|
|
7
7
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkUGBGYVBHjs = require('./chunk-UGBGYVBH.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkW65LBPLTjs = require('./chunk-W65LBPLT.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.ChainNotConfiguredForConnectorError =
|
|
16
|
+
exports.ChainNotConfiguredForConnectorError = _chunkUGBGYVBHjs.ChainNotConfiguredForConnectorError; exports.Connector = _chunkW65LBPLTjs.Connector; exports.ConnectorNotFoundError = _chunkUGBGYVBHjs.ConnectorNotFoundError; exports.normalizeChainId = _chunkOQILYQDOjs.normalizeChainId;
|
package/dist/injected.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Chain } from '@wagmi/chains';
|
|
2
1
|
import { Address } from 'viem';
|
|
3
|
-
import {
|
|
2
|
+
import { Chain } from 'viem/chains';
|
|
3
|
+
import { W as WindowProvider, C as Connector, c as WalletClient } from './base-ff961c9d.js';
|
|
4
4
|
import 'eventemitter3';
|
|
5
5
|
|
|
6
6
|
type InjectedConnectorOptions = {
|
package/dist/injected.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkJA6XQLQAjs = require('./chunk-JA6XQLQA.js');
|
|
4
|
+
require('./chunk-UGBGYVBH.js');
|
|
5
5
|
require('./chunk-OQILYQDO.js');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-W65LBPLT.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.InjectedConnector =
|
|
9
|
+
exports.InjectedConnector = _chunkJA6XQLQAjs.InjectedConnector;
|
package/dist/ledger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthereumProvider } from '@ledgerhq/connect-kit-loader';
|
|
2
|
-
import { Chain } from '@wagmi/chains';
|
|
3
2
|
import { EthereumProviderOptions } from '@walletconnect/ethereum-provider/dist/types/EthereumProvider';
|
|
4
|
-
import {
|
|
3
|
+
import { Chain } from 'viem/chains';
|
|
4
|
+
import { C as Connector, c as WalletClient } from './base-ff961c9d.js';
|
|
5
5
|
import 'eventemitter3';
|
|
6
6
|
import 'viem';
|
|
7
7
|
|
package/dist/ledger.js
CHANGED
|
@@ -7,8 +7,7 @@ var _chunkOQILYQDOjs = require('./chunk-OQILYQDO.js');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
var _chunkQYMCVNHTjs = require('./chunk-QYMCVNHT.js');
|
|
10
|
+
var _chunkW65LBPLTjs = require('./chunk-W65LBPLT.js');
|
|
12
11
|
|
|
13
12
|
// src/ledger.ts
|
|
14
13
|
|
|
@@ -24,40 +23,40 @@ var _connectkitloader = require('@ledgerhq/connect-kit-loader');
|
|
|
24
23
|
|
|
25
24
|
var _viem = require('viem');
|
|
26
25
|
var _provider, _initProviderPromise, _isV1, _createProvider, createProvider_fn, _initProvider, initProvider_fn, _setupListeners, setupListeners_fn, _removeListeners, removeListeners_fn;
|
|
27
|
-
var LedgerConnector = class extends
|
|
26
|
+
var LedgerConnector = class extends _chunkW65LBPLTjs.Connector {
|
|
28
27
|
constructor(config) {
|
|
29
28
|
super({
|
|
30
29
|
...config,
|
|
31
30
|
options: { ...config.options }
|
|
32
31
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _createProvider);
|
|
33
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _initProvider);
|
|
34
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _setupListeners);
|
|
35
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _removeListeners);
|
|
36
|
+
this.id = "ledger";
|
|
37
|
+
this.name = "Ledger";
|
|
38
|
+
this.ready = true;
|
|
39
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _provider, void 0);
|
|
40
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _initProviderPromise, void 0);
|
|
41
|
+
_chunkW65LBPLTjs.__privateAdd.call(void 0, this, _isV1, void 0);
|
|
42
|
+
this.onAccountsChanged = (accounts) => {
|
|
44
43
|
if (accounts.length === 0)
|
|
45
44
|
this.emit("disconnect");
|
|
46
45
|
else
|
|
47
46
|
this.emit("change", { account: _viem.getAddress.call(void 0, accounts[0]) });
|
|
48
|
-
}
|
|
49
|
-
|
|
47
|
+
};
|
|
48
|
+
this.onChainChanged = (chainId) => {
|
|
50
49
|
const id = _chunkOQILYQDOjs.normalizeChainId.call(void 0, chainId);
|
|
51
50
|
const unsupported = this.isChainUnsupported(id);
|
|
52
51
|
this.emit("change", { chain: { id, unsupported } });
|
|
53
|
-
}
|
|
54
|
-
|
|
52
|
+
};
|
|
53
|
+
this.onDisconnect = () => {
|
|
55
54
|
this.emit("disconnect");
|
|
56
|
-
}
|
|
57
|
-
|
|
55
|
+
};
|
|
56
|
+
this.onConnect = () => {
|
|
58
57
|
this.emit("connect", {});
|
|
59
|
-
}
|
|
60
|
-
|
|
58
|
+
};
|
|
59
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _isV1, this.walletConnectVersion === 1);
|
|
61
60
|
}
|
|
62
61
|
get walletConnectVersion() {
|
|
63
62
|
if (this.options.walletConnectVersion)
|
|
@@ -69,7 +68,7 @@ var LedgerConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
69
68
|
async connect({ chainId } = {}) {
|
|
70
69
|
try {
|
|
71
70
|
const provider = await this.getProvider({ create: true });
|
|
72
|
-
|
|
71
|
+
_chunkW65LBPLTjs.__privateMethod.call(void 0, this, _setupListeners, setupListeners_fn).call(this);
|
|
73
72
|
if (!provider.session) {
|
|
74
73
|
this.emit("message", { type: "connecting" });
|
|
75
74
|
await provider.request({
|
|
@@ -105,8 +104,8 @@ var LedgerConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
105
104
|
if (!/No matching key/i.test(error.message))
|
|
106
105
|
throw error;
|
|
107
106
|
} finally {
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
_chunkW65LBPLTjs.__privateMethod.call(void 0, this, _removeListeners, removeListeners_fn).call(this);
|
|
108
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _isV1) && typeof localStorage !== "undefined" && localStorage.removeItem("walletconnect");
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
async getAccount() {
|
|
@@ -127,12 +126,12 @@ var LedgerConnector = class extends _chunkQYMCVNHTjs.Connector {
|
|
|
127
126
|
async getProvider({ chainId, create } = {
|
|
128
127
|
create: false
|
|
129
128
|
}) {
|
|
130
|
-
if (!
|
|
131
|
-
await
|
|
129
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider) || _chunkW65LBPLTjs.__privateGet.call(void 0, this, _isV1) && create) {
|
|
130
|
+
await _chunkW65LBPLTjs.__privateMethod.call(void 0, this, _createProvider, createProvider_fn).call(this);
|
|
132
131
|
}
|
|
133
132
|
if (chainId)
|
|
134
133
|
await this.switchChain(chainId);
|
|
135
|
-
return
|
|
134
|
+
return _chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider);
|
|
136
135
|
}
|
|
137
136
|
async getWalletClient({
|
|
138
137
|
chainId
|
|
@@ -179,10 +178,10 @@ _initProviderPromise = new WeakMap();
|
|
|
179
178
|
_isV1 = new WeakMap();
|
|
180
179
|
_createProvider = new WeakSet();
|
|
181
180
|
createProvider_fn = async function() {
|
|
182
|
-
if (!
|
|
183
|
-
|
|
181
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _initProviderPromise) && typeof window !== "undefined") {
|
|
182
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _initProviderPromise, _chunkW65LBPLTjs.__privateMethod.call(void 0, this, _initProvider, initProvider_fn).call(this));
|
|
184
183
|
}
|
|
185
|
-
return
|
|
184
|
+
return _chunkW65LBPLTjs.__privateGet.call(void 0, this, _initProviderPromise);
|
|
186
185
|
};
|
|
187
186
|
_initProvider = new WeakSet();
|
|
188
187
|
initProvider_fn = async function() {
|
|
@@ -191,7 +190,7 @@ initProvider_fn = async function() {
|
|
|
191
190
|
connectKit.enableDebugLogs();
|
|
192
191
|
}
|
|
193
192
|
let checkSupportOptions;
|
|
194
|
-
if (
|
|
193
|
+
if (_chunkW65LBPLTjs.__privateGet.call(void 0, this, _isV1)) {
|
|
195
194
|
const { chainId, bridge } = this.options;
|
|
196
195
|
checkSupportOptions = {
|
|
197
196
|
providerType: _connectkitloader.SupportedProviders.Ethereum,
|
|
@@ -234,28 +233,28 @@ initProvider_fn = async function() {
|
|
|
234
233
|
};
|
|
235
234
|
}
|
|
236
235
|
connectKit.checkSupport(checkSupportOptions);
|
|
237
|
-
|
|
236
|
+
_chunkW65LBPLTjs.__privateSet.call(void 0, this, _provider, await connectKit.getProvider());
|
|
238
237
|
};
|
|
239
238
|
_setupListeners = new WeakSet();
|
|
240
239
|
setupListeners_fn = function() {
|
|
241
|
-
if (!
|
|
240
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider))
|
|
242
241
|
return;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
242
|
+
_chunkW65LBPLTjs.__privateMethod.call(void 0, this, _removeListeners, removeListeners_fn).call(this);
|
|
243
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).on("accountsChanged", this.onAccountsChanged);
|
|
244
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).on("chainChanged", this.onChainChanged);
|
|
245
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).on("disconnect", this.onDisconnect);
|
|
246
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).on("session_delete", this.onDisconnect);
|
|
247
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).on("connect", this.onConnect);
|
|
249
248
|
};
|
|
250
249
|
_removeListeners = new WeakSet();
|
|
251
250
|
removeListeners_fn = function() {
|
|
252
|
-
if (!
|
|
251
|
+
if (!_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider))
|
|
253
252
|
return;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).removeListener("accountsChanged", this.onAccountsChanged);
|
|
254
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).removeListener("chainChanged", this.onChainChanged);
|
|
255
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).removeListener("disconnect", this.onDisconnect);
|
|
256
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).removeListener("session_delete", this.onDisconnect);
|
|
257
|
+
_chunkW65LBPLTjs.__privateGet.call(void 0, this, _provider).removeListener("connect", this.onConnect);
|
|
259
258
|
};
|
|
260
259
|
|
|
261
260
|
|
package/dist/metaMask.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Chain } from '
|
|
1
|
+
import { Chain } from 'viem/chains';
|
|
2
2
|
import { InjectedConnectorOptions, InjectedConnector } from './injected.js';
|
|
3
|
-
import { W as WindowProvider } from './base-
|
|
3
|
+
import { W as WindowProvider } from './base-ff961c9d.js';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import 'eventemitter3';
|
|
6
6
|
|