@wagmi/core 0.8.1 → 0.8.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.
- package/connectors/injected/package.json +4 -0
- package/connectors/ledger/package.json +4 -0
- package/connectors/mock/package.json +1 -1
- package/connectors/package.json +4 -0
- package/dist/{chunk-TQC2HCNN.js → chunk-37HX2X4M.js} +19 -326
- package/dist/chunk-BVC4KGLQ.js +8 -0
- 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/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 -108
- 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-971cda79.d.ts → index-37d6352e.d.ts} +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.js +8 -4
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +2 -2
- package/dist/internal/test.d.ts +1 -1
- package/dist/internal/test.js +5 -3
- package/dist/providers/alchemy.d.ts +1 -1
- package/dist/providers/infura.d.ts +1 -1
- package/dist/providers/jsonRpc.d.ts +1 -1
- package/dist/providers/public.d.ts +1 -1
- package/package.json +15 -6
- package/dist/base-a82112a9.d.ts +0 -65
- package/dist/chunk-SK7UQXOC.js +0 -191
- package/dist/connectors/mock/index.d.ts +0 -79
- package/dist/connectors/mock/index.js +0 -11
- package/dist/injected-610c34b6.d.ts +0 -71
|
@@ -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,63 +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.isPortal)
|
|
344
|
-
return "Ripio Portal";
|
|
345
|
-
if (provider.isTally)
|
|
346
|
-
return "Tally";
|
|
347
|
-
if (provider.isTokenPocket)
|
|
348
|
-
return "TokenPocket";
|
|
349
|
-
if (provider.isTokenary)
|
|
350
|
-
return "Tokenary";
|
|
351
|
-
if (provider.isTrust || provider.isTrustWallet)
|
|
352
|
-
return "Trust Wallet";
|
|
353
|
-
if (provider.isMetaMask)
|
|
354
|
-
return "MetaMask";
|
|
355
|
-
};
|
|
356
|
-
if (ethereum.providers?.length) {
|
|
357
|
-
const nameSet = /* @__PURE__ */ new Set();
|
|
358
|
-
let unknownCount = 1;
|
|
359
|
-
for (const provider of ethereum.providers) {
|
|
360
|
-
let name = getName(provider);
|
|
361
|
-
if (!name) {
|
|
362
|
-
name = `Unknown Wallet #${unknownCount}`;
|
|
363
|
-
unknownCount += 1;
|
|
364
|
-
}
|
|
365
|
-
nameSet.add(name);
|
|
366
|
-
}
|
|
367
|
-
const names = [...nameSet];
|
|
368
|
-
if (names.length)
|
|
369
|
-
return names;
|
|
370
|
-
return names[0] ?? "Injected";
|
|
371
|
-
}
|
|
372
|
-
return getName(ethereum) ?? "Injected";
|
|
373
|
-
}
|
|
374
|
-
|
|
375
313
|
// src/utils/logger.ts
|
|
376
314
|
function logWarn(message) {
|
|
377
315
|
getClient()?.config.logger?.warn?.(message);
|
|
@@ -488,254 +426,6 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
488
426
|
);
|
|
489
427
|
}
|
|
490
428
|
|
|
491
|
-
// src/connectors/base.ts
|
|
492
|
-
import { default as EventEmitter } from "eventemitter3";
|
|
493
|
-
var Connector = class extends EventEmitter {
|
|
494
|
-
constructor({
|
|
495
|
-
chains = [mainnet, goerli],
|
|
496
|
-
options
|
|
497
|
-
}) {
|
|
498
|
-
super();
|
|
499
|
-
this.chains = chains;
|
|
500
|
-
this.options = options;
|
|
501
|
-
}
|
|
502
|
-
getBlockExplorerUrls(chain) {
|
|
503
|
-
const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};
|
|
504
|
-
if (blockExplorer)
|
|
505
|
-
return [
|
|
506
|
-
blockExplorer.url,
|
|
507
|
-
...Object.values(blockExplorers).map((x) => x.url)
|
|
508
|
-
];
|
|
509
|
-
}
|
|
510
|
-
isChainUnsupported(chainId) {
|
|
511
|
-
return !this.chains.some((x) => x.id === chainId);
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
// src/connectors/injected.ts
|
|
516
|
-
var _provider, _switchingChains;
|
|
517
|
-
var InjectedConnector = class extends Connector {
|
|
518
|
-
constructor({
|
|
519
|
-
chains,
|
|
520
|
-
options: options_
|
|
521
|
-
} = {}) {
|
|
522
|
-
const options = {
|
|
523
|
-
shimDisconnect: true,
|
|
524
|
-
shimChainChangedDisconnect: true,
|
|
525
|
-
getProvider: () => typeof window !== "undefined" ? window.ethereum : void 0,
|
|
526
|
-
...options_
|
|
527
|
-
};
|
|
528
|
-
super({ chains, options });
|
|
529
|
-
__privateAdd(this, _provider, void 0);
|
|
530
|
-
__privateAdd(this, _switchingChains, void 0);
|
|
531
|
-
this.shimDisconnectKey = "injected.shimDisconnect";
|
|
532
|
-
this.onAccountsChanged = (accounts) => {
|
|
533
|
-
if (accounts.length === 0)
|
|
534
|
-
this.emit("disconnect");
|
|
535
|
-
else
|
|
536
|
-
this.emit("change", {
|
|
537
|
-
account: getAddress(accounts[0])
|
|
538
|
-
});
|
|
539
|
-
};
|
|
540
|
-
this.onChainChanged = (chainId) => {
|
|
541
|
-
const id = normalizeChainId(chainId);
|
|
542
|
-
const unsupported = this.isChainUnsupported(id);
|
|
543
|
-
this.emit("change", { chain: { id, unsupported } });
|
|
544
|
-
};
|
|
545
|
-
this.onDisconnect = () => {
|
|
546
|
-
if (this.options.shimChainChangedDisconnect && __privateGet(this, _switchingChains)) {
|
|
547
|
-
__privateSet(this, _switchingChains, false);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
this.emit("disconnect");
|
|
551
|
-
if (this.options.shimDisconnect)
|
|
552
|
-
getClient().storage?.removeItem(this.shimDisconnectKey);
|
|
553
|
-
};
|
|
554
|
-
const provider = options.getProvider();
|
|
555
|
-
if (typeof options.name === "string")
|
|
556
|
-
this.name = options.name;
|
|
557
|
-
else if (provider) {
|
|
558
|
-
const detectedName = getInjectedName(provider);
|
|
559
|
-
if (options.name)
|
|
560
|
-
this.name = options.name(detectedName);
|
|
561
|
-
else {
|
|
562
|
-
if (typeof detectedName === "string")
|
|
563
|
-
this.name = detectedName;
|
|
564
|
-
else
|
|
565
|
-
this.name = detectedName[0];
|
|
566
|
-
}
|
|
567
|
-
} else
|
|
568
|
-
this.name = "Injected";
|
|
569
|
-
this.id = "injected";
|
|
570
|
-
this.ready = !!provider;
|
|
571
|
-
}
|
|
572
|
-
async connect({ chainId } = {}) {
|
|
573
|
-
try {
|
|
574
|
-
const provider = await this.getProvider();
|
|
575
|
-
if (!provider)
|
|
576
|
-
throw new ConnectorNotFoundError();
|
|
577
|
-
if (provider.on) {
|
|
578
|
-
provider.on("accountsChanged", this.onAccountsChanged);
|
|
579
|
-
provider.on("chainChanged", this.onChainChanged);
|
|
580
|
-
provider.on("disconnect", this.onDisconnect);
|
|
581
|
-
}
|
|
582
|
-
this.emit("message", { type: "connecting" });
|
|
583
|
-
const accounts = await provider.request({
|
|
584
|
-
method: "eth_requestAccounts"
|
|
585
|
-
});
|
|
586
|
-
const account = getAddress(accounts[0]);
|
|
587
|
-
let id = await this.getChainId();
|
|
588
|
-
let unsupported = this.isChainUnsupported(id);
|
|
589
|
-
if (chainId && id !== chainId) {
|
|
590
|
-
const chain = await this.switchChain(chainId);
|
|
591
|
-
id = chain.id;
|
|
592
|
-
unsupported = this.isChainUnsupported(id);
|
|
593
|
-
}
|
|
594
|
-
if (this.options.shimDisconnect)
|
|
595
|
-
getClient().storage?.setItem(this.shimDisconnectKey, true);
|
|
596
|
-
return { account, chain: { id, unsupported }, provider };
|
|
597
|
-
} catch (error) {
|
|
598
|
-
if (this.isUserRejectedRequestError(error))
|
|
599
|
-
throw new UserRejectedRequestError(error);
|
|
600
|
-
if (error.code === -32002)
|
|
601
|
-
throw new ResourceUnavailableError(error);
|
|
602
|
-
throw error;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
async disconnect() {
|
|
606
|
-
const provider = await this.getProvider();
|
|
607
|
-
if (!provider?.removeListener)
|
|
608
|
-
return;
|
|
609
|
-
provider.removeListener("accountsChanged", this.onAccountsChanged);
|
|
610
|
-
provider.removeListener("chainChanged", this.onChainChanged);
|
|
611
|
-
provider.removeListener("disconnect", this.onDisconnect);
|
|
612
|
-
if (this.options.shimDisconnect)
|
|
613
|
-
getClient().storage?.removeItem(this.shimDisconnectKey);
|
|
614
|
-
}
|
|
615
|
-
async getAccount() {
|
|
616
|
-
const provider = await this.getProvider();
|
|
617
|
-
if (!provider)
|
|
618
|
-
throw new ConnectorNotFoundError();
|
|
619
|
-
const accounts = await provider.request({
|
|
620
|
-
method: "eth_accounts"
|
|
621
|
-
});
|
|
622
|
-
return getAddress(accounts[0]);
|
|
623
|
-
}
|
|
624
|
-
async getChainId() {
|
|
625
|
-
const provider = await this.getProvider();
|
|
626
|
-
if (!provider)
|
|
627
|
-
throw new ConnectorNotFoundError();
|
|
628
|
-
return provider.request({ method: "eth_chainId" }).then(normalizeChainId);
|
|
629
|
-
}
|
|
630
|
-
async getProvider() {
|
|
631
|
-
const provider = this.options.getProvider();
|
|
632
|
-
if (provider)
|
|
633
|
-
__privateSet(this, _provider, provider);
|
|
634
|
-
return __privateGet(this, _provider);
|
|
635
|
-
}
|
|
636
|
-
async getSigner({ chainId } = {}) {
|
|
637
|
-
const [provider, account] = await Promise.all([
|
|
638
|
-
this.getProvider(),
|
|
639
|
-
this.getAccount()
|
|
640
|
-
]);
|
|
641
|
-
return new providers2.Web3Provider(
|
|
642
|
-
provider,
|
|
643
|
-
chainId
|
|
644
|
-
).getSigner(account);
|
|
645
|
-
}
|
|
646
|
-
async isAuthorized() {
|
|
647
|
-
try {
|
|
648
|
-
if (this.options.shimDisconnect && !getClient().storage?.getItem(this.shimDisconnectKey))
|
|
649
|
-
return false;
|
|
650
|
-
const provider = await this.getProvider();
|
|
651
|
-
if (!provider)
|
|
652
|
-
throw new ConnectorNotFoundError();
|
|
653
|
-
const account = await this.getAccount();
|
|
654
|
-
return !!account;
|
|
655
|
-
} catch {
|
|
656
|
-
return false;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
async switchChain(chainId) {
|
|
660
|
-
if (this.options.shimChainChangedDisconnect)
|
|
661
|
-
__privateSet(this, _switchingChains, true);
|
|
662
|
-
const provider = await this.getProvider();
|
|
663
|
-
if (!provider)
|
|
664
|
-
throw new ConnectorNotFoundError();
|
|
665
|
-
const id = hexValue(chainId);
|
|
666
|
-
try {
|
|
667
|
-
await provider.request({
|
|
668
|
-
method: "wallet_switchEthereumChain",
|
|
669
|
-
params: [{ chainId: id }]
|
|
670
|
-
});
|
|
671
|
-
return this.chains.find((x) => x.id === chainId) ?? {
|
|
672
|
-
id: chainId,
|
|
673
|
-
name: `Chain ${id}`,
|
|
674
|
-
network: `${id}`,
|
|
675
|
-
nativeCurrency: { name: "Ether", decimals: 18, symbol: "ETH" },
|
|
676
|
-
rpcUrls: { default: { http: [""] } }
|
|
677
|
-
};
|
|
678
|
-
} catch (error) {
|
|
679
|
-
const chain = this.chains.find((x) => x.id === chainId);
|
|
680
|
-
if (!chain)
|
|
681
|
-
throw new ChainNotConfiguredError({ chainId, connectorId: this.id });
|
|
682
|
-
if (error.code === 4902 || error?.data?.originalError?.code === 4902) {
|
|
683
|
-
try {
|
|
684
|
-
await provider.request({
|
|
685
|
-
method: "wallet_addEthereumChain",
|
|
686
|
-
params: [
|
|
687
|
-
{
|
|
688
|
-
chainId: id,
|
|
689
|
-
chainName: chain.name,
|
|
690
|
-
nativeCurrency: chain.nativeCurrency,
|
|
691
|
-
rpcUrls: [
|
|
692
|
-
chain.rpcUrls.public?.http[0] ?? chain.rpcUrls.default.http[0] ?? ""
|
|
693
|
-
],
|
|
694
|
-
blockExplorerUrls: this.getBlockExplorerUrls(chain)
|
|
695
|
-
}
|
|
696
|
-
]
|
|
697
|
-
});
|
|
698
|
-
return chain;
|
|
699
|
-
} catch (addError) {
|
|
700
|
-
if (this.isUserRejectedRequestError(addError))
|
|
701
|
-
throw new UserRejectedRequestError(error);
|
|
702
|
-
throw new AddChainError();
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
if (this.isUserRejectedRequestError(error))
|
|
706
|
-
throw new UserRejectedRequestError(error);
|
|
707
|
-
throw new SwitchChainError(error);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
async watchAsset({
|
|
711
|
-
address,
|
|
712
|
-
decimals = 18,
|
|
713
|
-
image,
|
|
714
|
-
symbol
|
|
715
|
-
}) {
|
|
716
|
-
const provider = await this.getProvider();
|
|
717
|
-
if (!provider)
|
|
718
|
-
throw new ConnectorNotFoundError();
|
|
719
|
-
return provider.request({
|
|
720
|
-
method: "wallet_watchAsset",
|
|
721
|
-
params: {
|
|
722
|
-
type: "ERC20",
|
|
723
|
-
options: {
|
|
724
|
-
address,
|
|
725
|
-
decimals,
|
|
726
|
-
image,
|
|
727
|
-
symbol
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
isUserRejectedRequestError(error) {
|
|
733
|
-
return error.code === 4001;
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
_provider = new WeakMap();
|
|
737
|
-
_switchingChains = new WeakMap();
|
|
738
|
-
|
|
739
429
|
// src/storage.ts
|
|
740
430
|
var noopStorage = {
|
|
741
431
|
getItem: (_key) => "",
|
|
@@ -2879,7 +2569,7 @@ async function fetchTransaction({
|
|
|
2879
2569
|
import { isAddress as isAddress2 } from "ethers/lib/utils.js";
|
|
2880
2570
|
|
|
2881
2571
|
// src/actions/ens/fetchEnsAddress.ts
|
|
2882
|
-
import { getAddress
|
|
2572
|
+
import { getAddress } from "ethers/lib/utils.js";
|
|
2883
2573
|
async function fetchEnsAddress({
|
|
2884
2574
|
chainId,
|
|
2885
2575
|
name
|
|
@@ -2887,7 +2577,7 @@ async function fetchEnsAddress({
|
|
|
2887
2577
|
const provider = getProvider({ chainId });
|
|
2888
2578
|
const address = await provider.resolveName(name);
|
|
2889
2579
|
try {
|
|
2890
|
-
return address ?
|
|
2580
|
+
return address ? getAddress(address) : null;
|
|
2891
2581
|
} catch (_error) {
|
|
2892
2582
|
return null;
|
|
2893
2583
|
}
|
|
@@ -2904,13 +2594,13 @@ async function fetchEnsAvatar({
|
|
|
2904
2594
|
}
|
|
2905
2595
|
|
|
2906
2596
|
// src/actions/ens/fetchEnsName.ts
|
|
2907
|
-
import { getAddress as
|
|
2597
|
+
import { getAddress as getAddress2 } from "ethers/lib/utils.js";
|
|
2908
2598
|
async function fetchEnsName({
|
|
2909
2599
|
address,
|
|
2910
2600
|
chainId
|
|
2911
2601
|
}) {
|
|
2912
2602
|
const provider = getProvider({ chainId });
|
|
2913
|
-
return provider.lookupAddress(
|
|
2603
|
+
return provider.lookupAddress(getAddress2(address));
|
|
2914
2604
|
}
|
|
2915
2605
|
|
|
2916
2606
|
// src/actions/ens/fetchEnsResolver.ts
|
|
@@ -3308,7 +2998,12 @@ function watchNetwork(callback, { selector = (x) => x } = {}) {
|
|
|
3308
2998
|
import shallow5 from "zustand/shallow";
|
|
3309
2999
|
function watchSigner({ chainId }, callback) {
|
|
3310
3000
|
const client2 = getClient();
|
|
3311
|
-
const handleChange = async () =>
|
|
3001
|
+
const handleChange = async () => {
|
|
3002
|
+
const signer = await fetchSigner({ chainId });
|
|
3003
|
+
if (!getClient().connector)
|
|
3004
|
+
return callback(null);
|
|
3005
|
+
return callback(signer);
|
|
3006
|
+
};
|
|
3312
3007
|
const unsubscribe = client2.subscribe(
|
|
3313
3008
|
({ data, connector }) => ({
|
|
3314
3009
|
account: data?.account,
|
|
@@ -3558,6 +3253,7 @@ var UserRejectedRequestError = class extends ProviderRpcError {
|
|
|
3558
3253
|
};
|
|
3559
3254
|
|
|
3560
3255
|
export {
|
|
3256
|
+
configureChains,
|
|
3561
3257
|
RpcError,
|
|
3562
3258
|
ProviderRpcError,
|
|
3563
3259
|
AddChainError,
|
|
@@ -3575,7 +3271,6 @@ export {
|
|
|
3575
3271
|
SwitchChainError,
|
|
3576
3272
|
SwitchChainNotSupportedError,
|
|
3577
3273
|
UserRejectedRequestError,
|
|
3578
|
-
configureChains,
|
|
3579
3274
|
debounce,
|
|
3580
3275
|
deepEqual,
|
|
3581
3276
|
deserialize,
|
|
@@ -3583,8 +3278,6 @@ export {
|
|
|
3583
3278
|
normalizeChainId,
|
|
3584
3279
|
parseContractResult,
|
|
3585
3280
|
serialize,
|
|
3586
|
-
Connector,
|
|
3587
|
-
InjectedConnector,
|
|
3588
3281
|
noopStorage,
|
|
3589
3282
|
createStorage,
|
|
3590
3283
|
Client,
|
|
File without changes
|
|
@@ -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';
|