@wagmi/core 0.8.2 → 0.8.4
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/chains/package.json +1 -1
- package/connectors/coinbaseWallet/package.json +1 -1
- package/connectors/ledger/package.json +4 -0
- package/connectors/metaMask/package.json +1 -1
- package/connectors/mock/package.json +2 -2
- package/connectors/package.json +4 -0
- package/connectors/walletConnect/package.json +1 -1
- package/dist/chains.d.ts +1 -1
- package/dist/chains.js +7 -3
- package/dist/chunk-BVC4KGLQ.js +8 -0
- package/dist/{chunk-63RNYADG.js → chunk-DYHSCPJD.js} +22 -330
- package/dist/chunk-EQOEZP46.js +6 -0
- package/dist/chunk-KFW652VN.js +7 -0
- package/dist/{chunk-J6DUE3KA.js → chunk-KX4UEHS5.js} +0 -0
- package/dist/{chunk-6KG5TOAU.js → chunk-PCWDCFP4.js} +6 -2
- package/dist/connectors/coinbaseWallet.d.ts +1 -60
- package/dist/connectors/coinbaseWallet.js +2 -213
- package/dist/connectors/index.d.ts +2 -0
- package/dist/connectors/index.js +9 -0
- package/dist/connectors/injected.d.ts +1 -0
- package/dist/connectors/injected.js +7 -0
- package/dist/connectors/ledger.d.ts +1 -0
- package/dist/connectors/ledger.js +7 -0
- package/dist/connectors/metaMask.d.ts +1 -34
- package/dist/connectors/metaMask.js +2 -110
- package/dist/connectors/mock.d.ts +1 -0
- package/dist/connectors/mock.js +9 -0
- package/dist/connectors/walletConnect.d.ts +1 -45
- package/dist/connectors/walletConnect.js +2 -167
- package/dist/index.d.ts +3 -4
- package/dist/index.js +9 -5
- package/dist/internal/index.js +2 -2
- package/dist/internal/test.js +6 -4
- package/internal/package.json +1 -1
- package/internal/test/package.json +1 -1
- package/package.json +14 -5
- package/providers/alchemy/package.json +1 -1
- package/providers/infura/package.json +1 -1
- package/providers/jsonRpc/package.json +1 -1
- package/providers/public/package.json +1 -1
- package/dist/base-a82112a9.d.ts +0 -65
- package/dist/chunk-6E4ZWCDO.js +0 -203
- package/dist/connectors/mock/index.d.ts +0 -82
- package/dist/connectors/mock/index.js +0 -11
- package/dist/injected-27788d9f.d.ts +0 -71
package/chains/package.json
CHANGED
package/dist/chains.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Chain, arbitrum, arbitrumGoerli, avalanche, avalancheFuji, bsc, bscTestnet, fantom, fantomTestnet, foundry, goerli, hardhat, localhost, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia } from '@wagmi/chains';
|
|
1
|
+
export { Chain, arbitrum, arbitrumGoerli, avalanche, avalancheFuji, bsc, bscTestnet, fantom, fantomTestnet, foundry, goerli, hardhat, localhost, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia, taraxa, taraxaTestnet } from '@wagmi/chains';
|
package/dist/chains.js
CHANGED
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
optimismGoerli,
|
|
17
17
|
polygon,
|
|
18
18
|
polygonMumbai,
|
|
19
|
-
sepolia
|
|
20
|
-
|
|
19
|
+
sepolia,
|
|
20
|
+
taraxa,
|
|
21
|
+
taraxaTestnet
|
|
22
|
+
} from "./chunk-PCWDCFP4.js";
|
|
21
23
|
import "./chunk-MQXBDTVK.js";
|
|
22
24
|
export {
|
|
23
25
|
arbitrum,
|
|
@@ -37,5 +39,7 @@ export {
|
|
|
37
39
|
optimismGoerli,
|
|
38
40
|
polygon,
|
|
39
41
|
polygonMumbai,
|
|
40
|
-
sepolia
|
|
42
|
+
sepolia,
|
|
43
|
+
taraxa,
|
|
44
|
+
taraxaTestnet
|
|
41
45
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-6KG5TOAU.js";
|
|
2
|
+
InjectedConnector
|
|
3
|
+
} from "./chunk-BVC4KGLQ.js";
|
|
5
4
|
import {
|
|
6
5
|
__privateAdd,
|
|
7
6
|
__privateGet,
|
|
@@ -9,17 +8,9 @@ import {
|
|
|
9
8
|
__privateSet
|
|
10
9
|
} from "./chunk-MQXBDTVK.js";
|
|
11
10
|
|
|
12
|
-
// src/client.ts
|
|
13
|
-
import { persist, subscribeWithSelector } from "zustand/middleware";
|
|
14
|
-
import { default as create } from "zustand/vanilla";
|
|
15
|
-
|
|
16
|
-
// src/connectors/injected.ts
|
|
17
|
-
import { providers as providers2 } from "ethers";
|
|
18
|
-
import { getAddress, hexValue } from "ethers/lib/utils.js";
|
|
19
|
-
|
|
20
11
|
// src/utils/configureChains.ts
|
|
21
12
|
import { providers } from "ethers";
|
|
22
|
-
function configureChains(defaultChains,
|
|
13
|
+
function configureChains(defaultChains, providers2, {
|
|
23
14
|
minQuorum = 1,
|
|
24
15
|
pollingInterval = 4e3,
|
|
25
16
|
targetQuorum = 1,
|
|
@@ -34,7 +25,7 @@ function configureChains(defaultChains, providers3, {
|
|
|
34
25
|
const webSocketProviders_ = {};
|
|
35
26
|
for (const chain of defaultChains) {
|
|
36
27
|
let configExists = false;
|
|
37
|
-
for (const provider of
|
|
28
|
+
for (const provider of providers2) {
|
|
38
29
|
const apiConfig = provider(chain);
|
|
39
30
|
if (!apiConfig)
|
|
40
31
|
continue;
|
|
@@ -138,6 +129,10 @@ function fallbackProvider(targetQuorum, minQuorum, providers_, { stallTimeout })
|
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
|
|
132
|
+
// src/client.ts
|
|
133
|
+
import { persist, subscribeWithSelector } from "zustand/middleware";
|
|
134
|
+
import { default as create } from "zustand/vanilla";
|
|
135
|
+
|
|
141
136
|
// src/utils/assertActiveChain.ts
|
|
142
137
|
function assertActiveChain({
|
|
143
138
|
chainId,
|
|
@@ -315,65 +310,6 @@ function isArgOfType(arg, abiParameter) {
|
|
|
315
310
|
}
|
|
316
311
|
}
|
|
317
312
|
|
|
318
|
-
// src/utils/getInjectedName.ts
|
|
319
|
-
function getInjectedName(ethereum) {
|
|
320
|
-
if (!ethereum)
|
|
321
|
-
return "Injected";
|
|
322
|
-
const getName = (provider) => {
|
|
323
|
-
if (provider.isAvalanche)
|
|
324
|
-
return "Core Wallet";
|
|
325
|
-
if (provider.isBitKeep)
|
|
326
|
-
return "BitKeep";
|
|
327
|
-
if (provider.isBraveWallet)
|
|
328
|
-
return "Brave Wallet";
|
|
329
|
-
if (provider.isCoinbaseWallet)
|
|
330
|
-
return "Coinbase Wallet";
|
|
331
|
-
if (provider.isExodus)
|
|
332
|
-
return "Exodus";
|
|
333
|
-
if (provider.isFrame)
|
|
334
|
-
return "Frame";
|
|
335
|
-
if (provider.isKuCoinWallet)
|
|
336
|
-
return "KuCoin Wallet";
|
|
337
|
-
if (provider.isMathWallet)
|
|
338
|
-
return "MathWallet";
|
|
339
|
-
if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet)
|
|
340
|
-
return "1inch Wallet";
|
|
341
|
-
if (provider.isOpera)
|
|
342
|
-
return "Opera";
|
|
343
|
-
if (provider.isPhantom)
|
|
344
|
-
return "Phantom";
|
|
345
|
-
if (provider.isPortal)
|
|
346
|
-
return "Ripio Portal";
|
|
347
|
-
if (provider.isTally)
|
|
348
|
-
return "Tally";
|
|
349
|
-
if (provider.isTokenPocket)
|
|
350
|
-
return "TokenPocket";
|
|
351
|
-
if (provider.isTokenary)
|
|
352
|
-
return "Tokenary";
|
|
353
|
-
if (provider.isTrust || provider.isTrustWallet)
|
|
354
|
-
return "Trust Wallet";
|
|
355
|
-
if (provider.isMetaMask)
|
|
356
|
-
return "MetaMask";
|
|
357
|
-
};
|
|
358
|
-
if (ethereum.providers?.length) {
|
|
359
|
-
const nameSet = /* @__PURE__ */ new Set();
|
|
360
|
-
let unknownCount = 1;
|
|
361
|
-
for (const provider of ethereum.providers) {
|
|
362
|
-
let name = getName(provider);
|
|
363
|
-
if (!name) {
|
|
364
|
-
name = `Unknown Wallet #${unknownCount}`;
|
|
365
|
-
unknownCount += 1;
|
|
366
|
-
}
|
|
367
|
-
nameSet.add(name);
|
|
368
|
-
}
|
|
369
|
-
const names = [...nameSet];
|
|
370
|
-
if (names.length)
|
|
371
|
-
return names;
|
|
372
|
-
return names[0] ?? "Injected";
|
|
373
|
-
}
|
|
374
|
-
return getName(ethereum) ?? "Injected";
|
|
375
|
-
}
|
|
376
|
-
|
|
377
313
|
// src/utils/logger.ts
|
|
378
314
|
function logWarn(message) {
|
|
379
315
|
getClient()?.config.logger?.warn?.(message);
|
|
@@ -490,254 +426,6 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
490
426
|
);
|
|
491
427
|
}
|
|
492
428
|
|
|
493
|
-
// src/connectors/base.ts
|
|
494
|
-
import { default as EventEmitter } from "eventemitter3";
|
|
495
|
-
var Connector = class extends EventEmitter {
|
|
496
|
-
constructor({
|
|
497
|
-
chains = [mainnet, goerli],
|
|
498
|
-
options
|
|
499
|
-
}) {
|
|
500
|
-
super();
|
|
501
|
-
this.chains = chains;
|
|
502
|
-
this.options = options;
|
|
503
|
-
}
|
|
504
|
-
getBlockExplorerUrls(chain) {
|
|
505
|
-
const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};
|
|
506
|
-
if (blockExplorer)
|
|
507
|
-
return [
|
|
508
|
-
blockExplorer.url,
|
|
509
|
-
...Object.values(blockExplorers).map((x) => x.url)
|
|
510
|
-
];
|
|
511
|
-
}
|
|
512
|
-
isChainUnsupported(chainId) {
|
|
513
|
-
return !this.chains.some((x) => x.id === chainId);
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
// src/connectors/injected.ts
|
|
518
|
-
var _provider, _switchingChains;
|
|
519
|
-
var InjectedConnector = class extends Connector {
|
|
520
|
-
constructor({
|
|
521
|
-
chains,
|
|
522
|
-
options: options_
|
|
523
|
-
} = {}) {
|
|
524
|
-
const options = {
|
|
525
|
-
shimDisconnect: true,
|
|
526
|
-
shimChainChangedDisconnect: true,
|
|
527
|
-
getProvider: () => typeof window !== "undefined" ? window.ethereum : void 0,
|
|
528
|
-
...options_
|
|
529
|
-
};
|
|
530
|
-
super({ chains, options });
|
|
531
|
-
__privateAdd(this, _provider, void 0);
|
|
532
|
-
__privateAdd(this, _switchingChains, void 0);
|
|
533
|
-
this.shimDisconnectKey = "injected.shimDisconnect";
|
|
534
|
-
this.onAccountsChanged = (accounts) => {
|
|
535
|
-
if (accounts.length === 0)
|
|
536
|
-
this.emit("disconnect");
|
|
537
|
-
else
|
|
538
|
-
this.emit("change", {
|
|
539
|
-
account: getAddress(accounts[0])
|
|
540
|
-
});
|
|
541
|
-
};
|
|
542
|
-
this.onChainChanged = (chainId) => {
|
|
543
|
-
const id = normalizeChainId(chainId);
|
|
544
|
-
const unsupported = this.isChainUnsupported(id);
|
|
545
|
-
this.emit("change", { chain: { id, unsupported } });
|
|
546
|
-
};
|
|
547
|
-
this.onDisconnect = () => {
|
|
548
|
-
if (this.options.shimChainChangedDisconnect && __privateGet(this, _switchingChains)) {
|
|
549
|
-
__privateSet(this, _switchingChains, false);
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
this.emit("disconnect");
|
|
553
|
-
if (this.options.shimDisconnect)
|
|
554
|
-
getClient().storage?.removeItem(this.shimDisconnectKey);
|
|
555
|
-
};
|
|
556
|
-
const provider = options.getProvider();
|
|
557
|
-
if (typeof options.name === "string")
|
|
558
|
-
this.name = options.name;
|
|
559
|
-
else if (provider) {
|
|
560
|
-
const detectedName = getInjectedName(provider);
|
|
561
|
-
if (options.name)
|
|
562
|
-
this.name = options.name(detectedName);
|
|
563
|
-
else {
|
|
564
|
-
if (typeof detectedName === "string")
|
|
565
|
-
this.name = detectedName;
|
|
566
|
-
else
|
|
567
|
-
this.name = detectedName[0];
|
|
568
|
-
}
|
|
569
|
-
} else
|
|
570
|
-
this.name = "Injected";
|
|
571
|
-
this.id = "injected";
|
|
572
|
-
this.ready = !!provider;
|
|
573
|
-
}
|
|
574
|
-
async connect({ chainId } = {}) {
|
|
575
|
-
try {
|
|
576
|
-
const provider = await this.getProvider();
|
|
577
|
-
if (!provider)
|
|
578
|
-
throw new ConnectorNotFoundError();
|
|
579
|
-
if (provider.on) {
|
|
580
|
-
provider.on("accountsChanged", this.onAccountsChanged);
|
|
581
|
-
provider.on("chainChanged", this.onChainChanged);
|
|
582
|
-
provider.on("disconnect", this.onDisconnect);
|
|
583
|
-
}
|
|
584
|
-
this.emit("message", { type: "connecting" });
|
|
585
|
-
const accounts = await provider.request({
|
|
586
|
-
method: "eth_requestAccounts"
|
|
587
|
-
});
|
|
588
|
-
const account = getAddress(accounts[0]);
|
|
589
|
-
let id = await this.getChainId();
|
|
590
|
-
let unsupported = this.isChainUnsupported(id);
|
|
591
|
-
if (chainId && id !== chainId) {
|
|
592
|
-
const chain = await this.switchChain(chainId);
|
|
593
|
-
id = chain.id;
|
|
594
|
-
unsupported = this.isChainUnsupported(id);
|
|
595
|
-
}
|
|
596
|
-
if (this.options.shimDisconnect)
|
|
597
|
-
getClient().storage?.setItem(this.shimDisconnectKey, true);
|
|
598
|
-
return { account, chain: { id, unsupported }, provider };
|
|
599
|
-
} catch (error) {
|
|
600
|
-
if (this.isUserRejectedRequestError(error))
|
|
601
|
-
throw new UserRejectedRequestError(error);
|
|
602
|
-
if (error.code === -32002)
|
|
603
|
-
throw new ResourceUnavailableError(error);
|
|
604
|
-
throw error;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
async disconnect() {
|
|
608
|
-
const provider = await this.getProvider();
|
|
609
|
-
if (!provider?.removeListener)
|
|
610
|
-
return;
|
|
611
|
-
provider.removeListener("accountsChanged", this.onAccountsChanged);
|
|
612
|
-
provider.removeListener("chainChanged", this.onChainChanged);
|
|
613
|
-
provider.removeListener("disconnect", this.onDisconnect);
|
|
614
|
-
if (this.options.shimDisconnect)
|
|
615
|
-
getClient().storage?.removeItem(this.shimDisconnectKey);
|
|
616
|
-
}
|
|
617
|
-
async getAccount() {
|
|
618
|
-
const provider = await this.getProvider();
|
|
619
|
-
if (!provider)
|
|
620
|
-
throw new ConnectorNotFoundError();
|
|
621
|
-
const accounts = await provider.request({
|
|
622
|
-
method: "eth_accounts"
|
|
623
|
-
});
|
|
624
|
-
return getAddress(accounts[0]);
|
|
625
|
-
}
|
|
626
|
-
async getChainId() {
|
|
627
|
-
const provider = await this.getProvider();
|
|
628
|
-
if (!provider)
|
|
629
|
-
throw new ConnectorNotFoundError();
|
|
630
|
-
return provider.request({ method: "eth_chainId" }).then(normalizeChainId);
|
|
631
|
-
}
|
|
632
|
-
async getProvider() {
|
|
633
|
-
const provider = this.options.getProvider();
|
|
634
|
-
if (provider)
|
|
635
|
-
__privateSet(this, _provider, provider);
|
|
636
|
-
return __privateGet(this, _provider);
|
|
637
|
-
}
|
|
638
|
-
async getSigner({ chainId } = {}) {
|
|
639
|
-
const [provider, account] = await Promise.all([
|
|
640
|
-
this.getProvider(),
|
|
641
|
-
this.getAccount()
|
|
642
|
-
]);
|
|
643
|
-
return new providers2.Web3Provider(
|
|
644
|
-
provider,
|
|
645
|
-
chainId
|
|
646
|
-
).getSigner(account);
|
|
647
|
-
}
|
|
648
|
-
async isAuthorized() {
|
|
649
|
-
try {
|
|
650
|
-
if (this.options.shimDisconnect && !getClient().storage?.getItem(this.shimDisconnectKey))
|
|
651
|
-
return false;
|
|
652
|
-
const provider = await this.getProvider();
|
|
653
|
-
if (!provider)
|
|
654
|
-
throw new ConnectorNotFoundError();
|
|
655
|
-
const account = await this.getAccount();
|
|
656
|
-
return !!account;
|
|
657
|
-
} catch {
|
|
658
|
-
return false;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
async switchChain(chainId) {
|
|
662
|
-
if (this.options.shimChainChangedDisconnect)
|
|
663
|
-
__privateSet(this, _switchingChains, true);
|
|
664
|
-
const provider = await this.getProvider();
|
|
665
|
-
if (!provider)
|
|
666
|
-
throw new ConnectorNotFoundError();
|
|
667
|
-
const id = hexValue(chainId);
|
|
668
|
-
try {
|
|
669
|
-
await provider.request({
|
|
670
|
-
method: "wallet_switchEthereumChain",
|
|
671
|
-
params: [{ chainId: id }]
|
|
672
|
-
});
|
|
673
|
-
return this.chains.find((x) => x.id === chainId) ?? {
|
|
674
|
-
id: chainId,
|
|
675
|
-
name: `Chain ${id}`,
|
|
676
|
-
network: `${id}`,
|
|
677
|
-
nativeCurrency: { name: "Ether", decimals: 18, symbol: "ETH" },
|
|
678
|
-
rpcUrls: { default: { http: [""] } }
|
|
679
|
-
};
|
|
680
|
-
} catch (error) {
|
|
681
|
-
const chain = this.chains.find((x) => x.id === chainId);
|
|
682
|
-
if (!chain)
|
|
683
|
-
throw new ChainNotConfiguredError({ chainId, connectorId: this.id });
|
|
684
|
-
if (error.code === 4902 || error?.data?.originalError?.code === 4902) {
|
|
685
|
-
try {
|
|
686
|
-
await provider.request({
|
|
687
|
-
method: "wallet_addEthereumChain",
|
|
688
|
-
params: [
|
|
689
|
-
{
|
|
690
|
-
chainId: id,
|
|
691
|
-
chainName: chain.name,
|
|
692
|
-
nativeCurrency: chain.nativeCurrency,
|
|
693
|
-
rpcUrls: [
|
|
694
|
-
chain.rpcUrls.public?.http[0] ?? chain.rpcUrls.default.http[0] ?? ""
|
|
695
|
-
],
|
|
696
|
-
blockExplorerUrls: this.getBlockExplorerUrls(chain)
|
|
697
|
-
}
|
|
698
|
-
]
|
|
699
|
-
});
|
|
700
|
-
return chain;
|
|
701
|
-
} catch (addError) {
|
|
702
|
-
if (this.isUserRejectedRequestError(addError))
|
|
703
|
-
throw new UserRejectedRequestError(error);
|
|
704
|
-
throw new AddChainError();
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
if (this.isUserRejectedRequestError(error))
|
|
708
|
-
throw new UserRejectedRequestError(error);
|
|
709
|
-
throw new SwitchChainError(error);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
async watchAsset({
|
|
713
|
-
address,
|
|
714
|
-
decimals = 18,
|
|
715
|
-
image,
|
|
716
|
-
symbol
|
|
717
|
-
}) {
|
|
718
|
-
const provider = await this.getProvider();
|
|
719
|
-
if (!provider)
|
|
720
|
-
throw new ConnectorNotFoundError();
|
|
721
|
-
return provider.request({
|
|
722
|
-
method: "wallet_watchAsset",
|
|
723
|
-
params: {
|
|
724
|
-
type: "ERC20",
|
|
725
|
-
options: {
|
|
726
|
-
address,
|
|
727
|
-
decimals,
|
|
728
|
-
image,
|
|
729
|
-
symbol
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
isUserRejectedRequestError(error) {
|
|
735
|
-
return error.code === 4001;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
_provider = new WeakMap();
|
|
739
|
-
_switchingChains = new WeakMap();
|
|
740
|
-
|
|
741
429
|
// src/storage.ts
|
|
742
430
|
var noopStorage = {
|
|
743
431
|
getItem: (_key) => "",
|
|
@@ -2881,7 +2569,7 @@ async function fetchTransaction({
|
|
|
2881
2569
|
import { isAddress as isAddress2 } from "ethers/lib/utils.js";
|
|
2882
2570
|
|
|
2883
2571
|
// src/actions/ens/fetchEnsAddress.ts
|
|
2884
|
-
import { getAddress
|
|
2572
|
+
import { getAddress } from "ethers/lib/utils.js";
|
|
2885
2573
|
async function fetchEnsAddress({
|
|
2886
2574
|
chainId,
|
|
2887
2575
|
name
|
|
@@ -2889,7 +2577,7 @@ async function fetchEnsAddress({
|
|
|
2889
2577
|
const provider = getProvider({ chainId });
|
|
2890
2578
|
const address = await provider.resolveName(name);
|
|
2891
2579
|
try {
|
|
2892
|
-
return address ?
|
|
2580
|
+
return address ? getAddress(address) : null;
|
|
2893
2581
|
} catch (_error) {
|
|
2894
2582
|
return null;
|
|
2895
2583
|
}
|
|
@@ -2906,13 +2594,13 @@ async function fetchEnsAvatar({
|
|
|
2906
2594
|
}
|
|
2907
2595
|
|
|
2908
2596
|
// src/actions/ens/fetchEnsName.ts
|
|
2909
|
-
import { getAddress as
|
|
2597
|
+
import { getAddress as getAddress2 } from "ethers/lib/utils.js";
|
|
2910
2598
|
async function fetchEnsName({
|
|
2911
2599
|
address,
|
|
2912
2600
|
chainId
|
|
2913
2601
|
}) {
|
|
2914
2602
|
const provider = getProvider({ chainId });
|
|
2915
|
-
return provider.lookupAddress(
|
|
2603
|
+
return provider.lookupAddress(getAddress2(address));
|
|
2916
2604
|
}
|
|
2917
2605
|
|
|
2918
2606
|
// src/actions/ens/fetchEnsResolver.ts
|
|
@@ -2973,7 +2661,7 @@ async function sendTransaction({
|
|
|
2973
2661
|
);
|
|
2974
2662
|
return { hash, wait };
|
|
2975
2663
|
} catch (error) {
|
|
2976
|
-
if (error.code === 4001)
|
|
2664
|
+
if (error.code === 4001 || error.code === "ACTION_REJECTED")
|
|
2977
2665
|
throw new UserRejectedRequestError(error);
|
|
2978
2666
|
throw error;
|
|
2979
2667
|
}
|
|
@@ -3232,7 +2920,7 @@ async function signMessage(args) {
|
|
|
3232
2920
|
args.message
|
|
3233
2921
|
);
|
|
3234
2922
|
} catch (error) {
|
|
3235
|
-
if (error.code === 4001)
|
|
2923
|
+
if (error.code === 4001 || error.code === "ACTION_REJECTED")
|
|
3236
2924
|
throw new UserRejectedRequestError(error);
|
|
3237
2925
|
throw error;
|
|
3238
2926
|
}
|
|
@@ -3255,7 +2943,13 @@ async function signTypedData({
|
|
|
3255
2943
|
types2[key] = attributes.filter((attr) => attr.type !== "EIP712Domain");
|
|
3256
2944
|
return types2;
|
|
3257
2945
|
}, {});
|
|
3258
|
-
|
|
2946
|
+
try {
|
|
2947
|
+
return await signer._signTypedData(domain, types_, value);
|
|
2948
|
+
} catch (error) {
|
|
2949
|
+
if (error.code === 4001 || error.code === "ACTION_REJECTED")
|
|
2950
|
+
throw new UserRejectedRequestError(error);
|
|
2951
|
+
throw error;
|
|
2952
|
+
}
|
|
3259
2953
|
}
|
|
3260
2954
|
|
|
3261
2955
|
// src/actions/accounts/switchNetwork.ts
|
|
@@ -3565,6 +3259,7 @@ var UserRejectedRequestError = class extends ProviderRpcError {
|
|
|
3565
3259
|
};
|
|
3566
3260
|
|
|
3567
3261
|
export {
|
|
3262
|
+
configureChains,
|
|
3568
3263
|
RpcError,
|
|
3569
3264
|
ProviderRpcError,
|
|
3570
3265
|
AddChainError,
|
|
@@ -3582,7 +3277,6 @@ export {
|
|
|
3582
3277
|
SwitchChainError,
|
|
3583
3278
|
SwitchChainNotSupportedError,
|
|
3584
3279
|
UserRejectedRequestError,
|
|
3585
|
-
configureChains,
|
|
3586
3280
|
debounce,
|
|
3587
3281
|
deepEqual,
|
|
3588
3282
|
deserialize,
|
|
@@ -3590,8 +3284,6 @@ export {
|
|
|
3590
3284
|
normalizeChainId,
|
|
3591
3285
|
parseContractResult,
|
|
3592
3286
|
serialize,
|
|
3593
|
-
Connector,
|
|
3594
|
-
InjectedConnector,
|
|
3595
3287
|
noopStorage,
|
|
3596
3288
|
createStorage,
|
|
3597
3289
|
Client,
|
|
File without changes
|
|
@@ -17,7 +17,9 @@ import {
|
|
|
17
17
|
optimismGoerli,
|
|
18
18
|
polygon,
|
|
19
19
|
polygonMumbai,
|
|
20
|
-
sepolia
|
|
20
|
+
sepolia,
|
|
21
|
+
taraxa,
|
|
22
|
+
taraxaTestnet
|
|
21
23
|
} from "@wagmi/chains";
|
|
22
24
|
|
|
23
25
|
export {
|
|
@@ -38,5 +40,7 @@ export {
|
|
|
38
40
|
optimismGoerli,
|
|
39
41
|
polygon,
|
|
40
42
|
polygonMumbai,
|
|
41
|
-
sepolia
|
|
43
|
+
sepolia,
|
|
44
|
+
taraxa,
|
|
45
|
+
taraxaTestnet
|
|
42
46
|
};
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { CoinbaseWalletSDKOptions } from '@coinbase/wallet-sdk/dist/CoinbaseWalletSDK';
|
|
3
|
-
import { providers } from 'ethers';
|
|
4
|
-
import { Chain } from '@wagmi/chains';
|
|
5
|
-
import { C as Connector } from '../base-a82112a9.js';
|
|
6
|
-
import 'abitype';
|
|
7
|
-
import 'eventemitter3';
|
|
8
|
-
|
|
9
|
-
type Options = CoinbaseWalletSDKOptions & {
|
|
10
|
-
/**
|
|
11
|
-
* Fallback Ethereum JSON RPC URL
|
|
12
|
-
* @default ""
|
|
13
|
-
*/
|
|
14
|
-
jsonRpcUrl?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Fallback Ethereum Chain ID
|
|
17
|
-
* @default 1
|
|
18
|
-
*/
|
|
19
|
-
chainId?: number;
|
|
20
|
-
};
|
|
21
|
-
declare class CoinbaseWalletConnector extends Connector<CoinbaseWalletProvider, Options, providers.JsonRpcSigner> {
|
|
22
|
-
#private;
|
|
23
|
-
readonly id = "coinbaseWallet";
|
|
24
|
-
readonly name = "Coinbase Wallet";
|
|
25
|
-
readonly ready = true;
|
|
26
|
-
constructor({ chains, options }: {
|
|
27
|
-
chains?: Chain[];
|
|
28
|
-
options: Options;
|
|
29
|
-
});
|
|
30
|
-
connect({ chainId }?: {
|
|
31
|
-
chainId?: number;
|
|
32
|
-
}): Promise<{
|
|
33
|
-
account: `0x${string}`;
|
|
34
|
-
chain: {
|
|
35
|
-
id: number;
|
|
36
|
-
unsupported: boolean;
|
|
37
|
-
};
|
|
38
|
-
provider: providers.Web3Provider;
|
|
39
|
-
}>;
|
|
40
|
-
disconnect(): Promise<void>;
|
|
41
|
-
getAccount(): Promise<`0x${string}`>;
|
|
42
|
-
getChainId(): Promise<number>;
|
|
43
|
-
getProvider(): Promise<CoinbaseWalletProvider>;
|
|
44
|
-
getSigner({ chainId }?: {
|
|
45
|
-
chainId?: number;
|
|
46
|
-
}): Promise<providers.JsonRpcSigner>;
|
|
47
|
-
isAuthorized(): Promise<boolean>;
|
|
48
|
-
switchChain(chainId: number): Promise<Chain>;
|
|
49
|
-
watchAsset({ address, decimals, image, symbol, }: {
|
|
50
|
-
address: string;
|
|
51
|
-
decimals?: number;
|
|
52
|
-
image?: string;
|
|
53
|
-
symbol: string;
|
|
54
|
-
}): Promise<boolean>;
|
|
55
|
-
protected onAccountsChanged: (accounts: string[]) => void;
|
|
56
|
-
protected onChainChanged: (chainId: number | string) => void;
|
|
57
|
-
protected onDisconnect: () => void;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { CoinbaseWalletConnector };
|
|
1
|
+
export { CoinbaseWalletConnector } from '@wagmi/connectors/coinbaseWallet';
|