@wagmi/core 0.2.3 → 0.3.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/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +28 -10
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +28 -10
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +28 -10
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +20 -11
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +20 -11
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +15 -6
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +7 -6
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +7 -6
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +5 -4
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +26 -8
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +26 -8
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +24 -6
- package/dist/{base-5812b724.cjs.dev.js → base-3a506159.cjs.dev.js} +129 -67
- package/dist/{base-159de546.esm.js → base-997b4fec.esm.js} +98 -38
- package/dist/{base-59f3457e.cjs.prod.js → base-cb4198f3.cjs.prod.js} +129 -67
- package/dist/{client-f77a08e4.cjs.dev.js → client-08120ec7.cjs.dev.js} +35 -23
- package/dist/{client-4d8337e7.cjs.prod.js → client-332f5c43.cjs.prod.js} +35 -23
- package/dist/{client-5d456446.esm.js → client-d8d4f4fc.esm.js} +33 -21
- package/dist/declarations/src/actions/accounts/connect.d.ts +4 -4
- package/dist/declarations/src/actions/accounts/getAccount.d.ts +3 -3
- package/dist/declarations/src/actions/accounts/signTypedData.d.ts +15 -6
- package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -3
- package/dist/declarations/src/actions/providers/getProvider.d.ts +3 -3
- package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +3 -3
- package/dist/declarations/src/actions/providers/watchProvider.d.ts +3 -3
- package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +3 -3
- package/dist/declarations/src/chains/configureChains.d.ts +20 -0
- package/dist/declarations/src/chains/index.d.ts +2 -0
- package/dist/declarations/src/client.d.ts +11 -11
- package/dist/declarations/src/connectors/injected.d.ts +1 -1
- package/dist/declarations/src/constants/index.d.ts +1 -1
- package/dist/declarations/src/errors.d.ts +48 -4
- package/dist/declarations/src/index.d.ts +8 -6
- package/dist/declarations/src/providers/alchemy.d.ts +7 -0
- package/dist/declarations/src/providers/infura.d.ts +7 -0
- package/dist/declarations/src/providers/jsonRpc.d.ts +11 -0
- package/dist/declarations/src/providers/public.d.ts +6 -0
- package/dist/declarations/src/storage.d.ts +2 -2
- package/dist/declarations/src/types/index.d.ts +67 -27
- package/dist/rpcs-7cfbd91c.esm.js +30 -0
- package/dist/rpcs-9c4eb960.cjs.dev.js +35 -0
- package/dist/rpcs-b3c52116.cjs.prod.js +35 -0
- package/dist/wagmi-core.cjs.dev.js +126 -27
- package/dist/wagmi-core.cjs.prod.js +126 -27
- package/dist/wagmi-core.esm.js +124 -26
- package/package.json +29 -8
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +1 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +38 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +7 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +38 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +34 -0
- package/providers/alchemy/package.json +4 -0
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +1 -0
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +38 -0
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +7 -0
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +38 -0
- package/providers/infura/dist/wagmi-core-providers-infura.esm.js +34 -0
- package/providers/infura/package.json +4 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +1 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.dev.js +45 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +7 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.prod.js +45 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js +41 -0
- package/providers/jsonRpc/package.json +4 -0
- package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +1 -0
- package/providers/public/dist/wagmi-core-providers-public.cjs.dev.js +34 -0
- package/providers/public/dist/wagmi-core-providers-public.cjs.js +7 -0
- package/providers/public/dist/wagmi-core-providers-public.cjs.prod.js +34 -0
- package/providers/public/dist/wagmi-core-providers-public.esm.js +30 -0
- package/providers/public/package.json +4 -0
- package/dist/classPrivateMethodGet-55c9909f.esm.js +0 -16
- package/dist/classPrivateMethodGet-976c8120.cjs.dev.js +0 -19
- package/dist/classPrivateMethodGet-d7330ed7.cjs.prod.js +0 -19
package/dist/wagmi-core.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as client, g as getClient } from './client-
|
|
2
|
-
export { C as Client, I as InjectedConnector,
|
|
3
|
-
import { C as ConnectorAlreadyConnectedError, a as allChains, b as ConnectorNotFoundError, U as UserRejectedRequestError, S as SwitchChainNotSupportedError } from './base-
|
|
4
|
-
export { A as AddChainError,
|
|
1
|
+
import { c as client, g as getClient } from './client-d8d4f4fc.esm.js';
|
|
2
|
+
export { C as Client, I as InjectedConnector, a as createClient, b as createStorage, n as noopStorage } from './client-d8d4f4fc.esm.js';
|
|
3
|
+
import { C as ConnectorAlreadyConnectedError, a as allChains, b as ConnectorNotFoundError, U as UserRejectedRequestError, S as SwitchChainNotSupportedError } from './base-997b4fec.esm.js';
|
|
4
|
+
export { A as AddChainError, i as ChainNotConfiguredError, c as Connector, C as ConnectorAlreadyConnectedError, b as ConnectorNotFoundError, P as ProviderRpcError, R as ResourceUnavailableError, j as RpcError, k as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, a as allChains, d as chain, e as chainId, f as defaultChains, g as defaultL2Chains, h as etherscanBlockExplorers, n as normalizeChainId } from './base-997b4fec.esm.js';
|
|
5
5
|
import { Contract } from 'ethers/lib/ethers';
|
|
6
6
|
import { formatUnits, getAddress } from 'ethers/lib/utils';
|
|
7
|
-
import { Contract as Contract$1 } from 'ethers';
|
|
8
|
-
|
|
7
|
+
import { Contract as Contract$1, providers } from 'ethers';
|
|
8
|
+
export { a as alchemyRpcUrls, i as infuraRpcUrls } from './rpcs-7cfbd91c.esm.js';
|
|
9
9
|
import 'zustand/vanilla';
|
|
10
10
|
import 'zustand/middleware';
|
|
11
11
|
import 'eventemitter3';
|
|
@@ -13,7 +13,7 @@ import 'eventemitter3';
|
|
|
13
13
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
14
14
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
15
15
|
|
|
16
|
-
const erc721ABI = ['event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId)
|
|
16
|
+
const erc721ABI = ['event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId)', 'event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved)', 'event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId)', 'function approve(address _approved, uint256 _tokenId) external payable', 'function balanceOf(address _owner) external view returns (uint256)', 'function getApproved(uint256 _tokenId) external view returns (address)', 'function isApprovedForAll(address _owner, address _operator) external view returns (bool)', 'function name() view returns (string memory)', 'function ownerOf(uint256 _tokenId) external view returns (address)', 'function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable', 'function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable', 'function setApprovalForAll(address _operator, bool _approved) external', 'function symbol() view returns (string memory)', 'function tokenByIndex(uint256 _index) view returns (uint256)', 'function tokenOfOwnerByIndex(address _owner, uint256 _index) view returns (uint256 tokenId)', 'function tokenURI(uint256 _tokenId) view returns (string memory)', 'function totalSupply() view returns (uint256)', 'function transferFrom(address _from, address _to, uint256 _tokenId) external payable'];
|
|
17
17
|
|
|
18
18
|
// https://github.com/ethers-io/ethers.js/blob/master/packages/units/src.ts/index.ts#L10-L18
|
|
19
19
|
const units = ['wei', 'kwei', 'mwei', 'gwei', 'szabo', 'finney', 'ether'];
|
|
@@ -160,6 +160,7 @@ function getNetwork() {
|
|
|
160
160
|
const activeChain = (_find = [...activeChains, ...allChains].find(x => x.id === chainId)) !== null && _find !== void 0 ? _find : {
|
|
161
161
|
id: chainId,
|
|
162
162
|
name: "Chain ".concat(chainId),
|
|
163
|
+
network: "".concat(chainId),
|
|
163
164
|
rpcUrls: {
|
|
164
165
|
default: ''
|
|
165
166
|
}
|
|
@@ -178,9 +179,8 @@ async function signMessage(args) {
|
|
|
178
179
|
const signer = await fetchSigner();
|
|
179
180
|
if (!signer) throw new ConnectorNotFoundError();
|
|
180
181
|
return await signer.signMessage(args.message);
|
|
181
|
-
} catch (
|
|
182
|
-
|
|
183
|
-
if (error_.code === 4001) error = new UserRejectedRequestError();
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if (error.code === 4001) throw new UserRejectedRequestError(error);
|
|
184
184
|
throw error;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -191,9 +191,8 @@ async function signTypedData(args) {
|
|
|
191
191
|
if (!signer) throw new ConnectorNotFoundError(); // Method name may be changed in the future, see https://docs.ethers.io/v5/api/signer/#Signer-signTypedData
|
|
192
192
|
|
|
193
193
|
return await signer._signTypedData(args.domain, args.types, args.value);
|
|
194
|
-
} catch (
|
|
195
|
-
|
|
196
|
-
if (error_.code === 4001) error = new UserRejectedRequestError();
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (error.code === 4001) throw new UserRejectedRequestError(error);
|
|
197
196
|
throw error;
|
|
198
197
|
}
|
|
199
198
|
}
|
|
@@ -369,17 +368,17 @@ async function fetchBlockNumber() {
|
|
|
369
368
|
function watchBlockNumber(args, callback) {
|
|
370
369
|
var _client$webSocketProv;
|
|
371
370
|
|
|
372
|
-
let
|
|
371
|
+
let previousProvider;
|
|
373
372
|
|
|
374
373
|
const createListener = provider => {
|
|
375
|
-
if (
|
|
376
|
-
var
|
|
374
|
+
if (previousProvider) {
|
|
375
|
+
var _previousProvider;
|
|
377
376
|
|
|
378
|
-
(
|
|
377
|
+
(_previousProvider = previousProvider) === null || _previousProvider === void 0 ? void 0 : _previousProvider.off('block', callback);
|
|
379
378
|
}
|
|
380
379
|
|
|
381
380
|
provider.on('block', callback);
|
|
382
|
-
|
|
381
|
+
previousProvider = provider;
|
|
383
382
|
};
|
|
384
383
|
|
|
385
384
|
const client = getClient();
|
|
@@ -451,12 +450,11 @@ async function writeContract(contractConfig, functionName) {
|
|
|
451
450
|
const contract = getContract(contractConfig);
|
|
452
451
|
const contractWithSigner = contract.connect(signer);
|
|
453
452
|
const contractFunction = contractWithSigner[functionName];
|
|
454
|
-
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
453
|
+
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not exist in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
455
454
|
const response = await contractFunction(...params);
|
|
456
455
|
return response;
|
|
457
|
-
} catch (
|
|
458
|
-
|
|
459
|
-
if (error_.code === 4001) error = new UserRejectedRequestError();
|
|
456
|
+
} catch (error) {
|
|
457
|
+
if (error.code === 4001) throw new UserRejectedRequestError(error);
|
|
460
458
|
throw error;
|
|
461
459
|
}
|
|
462
460
|
}
|
|
@@ -563,9 +561,8 @@ async function sendTransaction(args) {
|
|
|
563
561
|
if (!signer) throw new ConnectorNotFoundError();
|
|
564
562
|
const transaction = await signer.sendTransaction(args.request);
|
|
565
563
|
return transaction;
|
|
566
|
-
} catch (
|
|
567
|
-
|
|
568
|
-
if (error_.code === 4001) error = new UserRejectedRequestError();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
if (error.code === 4001) throw new UserRejectedRequestError(error);
|
|
569
566
|
throw error;
|
|
570
567
|
}
|
|
571
568
|
}
|
|
@@ -590,4 +587,105 @@ async function waitForTransaction(_ref) {
|
|
|
590
587
|
return await promise;
|
|
591
588
|
}
|
|
592
589
|
|
|
593
|
-
|
|
590
|
+
function configureChains(defaultChains, providers) {
|
|
591
|
+
let {
|
|
592
|
+
minQuorum = 1,
|
|
593
|
+
targetQuorum = 1,
|
|
594
|
+
stallTimeout
|
|
595
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
596
|
+
if (targetQuorum < minQuorum) throw new Error('quorum cannot be lower than minQuorum');
|
|
597
|
+
let chains = [];
|
|
598
|
+
const providers_ = {};
|
|
599
|
+
const webSocketProviders_ = {};
|
|
600
|
+
|
|
601
|
+
for (const chain of defaultChains) {
|
|
602
|
+
let configExists = false;
|
|
603
|
+
|
|
604
|
+
for (const provider of providers) {
|
|
605
|
+
const apiConfig = provider(chain); // If no API configuration was found (ie. no RPC URL) for
|
|
606
|
+
// this provider, then we skip and check the next one.
|
|
607
|
+
|
|
608
|
+
if (!apiConfig) continue;
|
|
609
|
+
configExists = true;
|
|
610
|
+
|
|
611
|
+
if (!chains.some(_ref => {
|
|
612
|
+
let {
|
|
613
|
+
id
|
|
614
|
+
} = _ref;
|
|
615
|
+
return id === chain.id;
|
|
616
|
+
})) {
|
|
617
|
+
chains = [...chains, apiConfig.chain];
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
providers_[chain.id] = [...(providers_[chain.id] || []), apiConfig.provider];
|
|
621
|
+
|
|
622
|
+
if (apiConfig.webSocketProvider) {
|
|
623
|
+
webSocketProviders_[chain.id] = [...(webSocketProviders_[chain.id] || []), apiConfig.webSocketProvider];
|
|
624
|
+
}
|
|
625
|
+
} // If no API configuration was found across the providers
|
|
626
|
+
// then we throw an error to the consumer.
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
if (!configExists) {
|
|
630
|
+
throw new Error(["Could not find valid provider configuration for chain \"".concat(chain.name, "\".\n"), "You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.", 'Read more: https://wagmi.sh/docs/providers/jsonRpc'].join('\n'));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
return {
|
|
635
|
+
chains,
|
|
636
|
+
provider: _ref2 => {
|
|
637
|
+
let {
|
|
638
|
+
chainId
|
|
639
|
+
} = _ref2;
|
|
640
|
+
const chainProviders = providers_[chainId && chains.some(x => x.id === chainId) ? chainId : defaultChains[0].id];
|
|
641
|
+
if (chainProviders.length === 1) return chainProviders[0]();
|
|
642
|
+
return fallbackProvider(targetQuorum, minQuorum, chainProviders, {
|
|
643
|
+
stallTimeout
|
|
644
|
+
});
|
|
645
|
+
},
|
|
646
|
+
webSocketProvider: _ref3 => {
|
|
647
|
+
let {
|
|
648
|
+
chainId
|
|
649
|
+
} = _ref3;
|
|
650
|
+
const chainWebSocketProviders = webSocketProviders_[chainId && chains.some(x => x.id === chainId) ? chainId : defaultChains[0].id];
|
|
651
|
+
if (!chainWebSocketProviders) return undefined;
|
|
652
|
+
if (chainWebSocketProviders.length === 1) return chainWebSocketProviders[0](); // WebSockets do not work with `fallbackProvider`
|
|
653
|
+
// Default to first available
|
|
654
|
+
|
|
655
|
+
return chainWebSocketProviders[0]();
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function fallbackProvider(targetQuorum, minQuorum, providers_, _ref4) {
|
|
661
|
+
let {
|
|
662
|
+
stallTimeout
|
|
663
|
+
} = _ref4;
|
|
664
|
+
|
|
665
|
+
try {
|
|
666
|
+
return new providers.FallbackProvider(providers_.map((chainProvider, index) => {
|
|
667
|
+
var _provider$priority, _provider$stallTimeou;
|
|
668
|
+
|
|
669
|
+
const provider = chainProvider();
|
|
670
|
+
return {
|
|
671
|
+
provider,
|
|
672
|
+
priority: (_provider$priority = provider.priority) !== null && _provider$priority !== void 0 ? _provider$priority : index,
|
|
673
|
+
stallTimeout: (_provider$stallTimeou = provider.stallTimeout) !== null && _provider$stallTimeou !== void 0 ? _provider$stallTimeou : stallTimeout,
|
|
674
|
+
weight: provider.weight
|
|
675
|
+
};
|
|
676
|
+
}), targetQuorum);
|
|
677
|
+
} catch (error) {
|
|
678
|
+
var _error$message;
|
|
679
|
+
|
|
680
|
+
if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('quorum will always fail; larger than total weight')) {
|
|
681
|
+
if (targetQuorum === minQuorum) throw error;
|
|
682
|
+
return fallbackProvider(targetQuorum - 1, minQuorum, providers_, {
|
|
683
|
+
stallTimeout
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
throw error;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
export { configureChains, connect, disconnect, erc20ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, readContract, sendTransaction, signMessage, signTypedData, switchNetwork, units, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchSigner, watchWebSocketProvider, writeContract };
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "@wagmi/core",
|
|
3
3
|
"description": "Vanilla JS library for Ethereum",
|
|
4
4
|
"license": "WAGMIT",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
|
+
"repository": "tmm/wagmi",
|
|
6
7
|
"author": "awkweb.eth",
|
|
7
8
|
"ethereum": "awkweb.eth",
|
|
8
|
-
"repository": "tmm/wagmi",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"main": "dist/wagmi-core.cjs.js",
|
|
11
11
|
"module": "dist/wagmi-core.esm.js",
|
|
@@ -30,11 +30,28 @@
|
|
|
30
30
|
"./connectors/walletConnect": {
|
|
31
31
|
"module": "./connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js",
|
|
32
32
|
"default": "./connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.js"
|
|
33
|
+
},
|
|
34
|
+
"./providers/alchemy": {
|
|
35
|
+
"module": "./providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js",
|
|
36
|
+
"default": "./providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js"
|
|
37
|
+
},
|
|
38
|
+
"./providers/public": {
|
|
39
|
+
"module": "./providers/public/dist/wagmi-core-providers-public.esm.js",
|
|
40
|
+
"default": "./providers/public/dist/wagmi-core-providers-public.cjs.js"
|
|
41
|
+
},
|
|
42
|
+
"./providers/infura": {
|
|
43
|
+
"module": "./providers/infura/dist/wagmi-core-providers-infura.esm.js",
|
|
44
|
+
"default": "./providers/infura/dist/wagmi-core-providers-infura.cjs.js"
|
|
45
|
+
},
|
|
46
|
+
"./providers/jsonRpc": {
|
|
47
|
+
"module": "./providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js",
|
|
48
|
+
"default": "./providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js"
|
|
33
49
|
}
|
|
34
50
|
},
|
|
35
51
|
"files": [
|
|
36
|
-
"/
|
|
37
|
-
"/
|
|
52
|
+
"/connectors",
|
|
53
|
+
"/providers",
|
|
54
|
+
"/dist"
|
|
38
55
|
],
|
|
39
56
|
"preconstruct": {
|
|
40
57
|
"entrypoints": [
|
|
@@ -42,7 +59,11 @@
|
|
|
42
59
|
"connectors/coinbaseWallet.ts",
|
|
43
60
|
"connectors/metaMask.ts",
|
|
44
61
|
"connectors/walletConnect.ts",
|
|
45
|
-
"connectors/mock/index.ts"
|
|
62
|
+
"connectors/mock/index.ts",
|
|
63
|
+
"providers/alchemy.ts",
|
|
64
|
+
"providers/public.ts",
|
|
65
|
+
"providers/infura.ts",
|
|
66
|
+
"providers/jsonRpc.ts"
|
|
46
67
|
]
|
|
47
68
|
},
|
|
48
69
|
"peerDependencies": {
|
|
@@ -63,9 +84,9 @@
|
|
|
63
84
|
"zustand": "^4.0.0-rc.1"
|
|
64
85
|
},
|
|
65
86
|
"devDependencies": {
|
|
66
|
-
"@coinbase/wallet-sdk": "^3.0
|
|
67
|
-
"@walletconnect/ethereum-provider": "^1.7.
|
|
68
|
-
"ethers": "^5.6.
|
|
87
|
+
"@coinbase/wallet-sdk": "^3.1.0",
|
|
88
|
+
"@walletconnect/ethereum-provider": "^1.7.8",
|
|
89
|
+
"ethers": "^5.6.5"
|
|
69
90
|
},
|
|
70
91
|
"keywords": [
|
|
71
92
|
"eth",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/alchemy";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-9c4eb960.cjs.dev.js');
|
|
7
|
+
|
|
8
|
+
function alchemyProvider() {
|
|
9
|
+
let {
|
|
10
|
+
alchemyId = rpcs.defaultAlchemyId,
|
|
11
|
+
pollingInterval,
|
|
12
|
+
priority,
|
|
13
|
+
stallTimeout,
|
|
14
|
+
weight
|
|
15
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
return function (chain) {
|
|
17
|
+
if (!chain.rpcUrls.alchemy) return null;
|
|
18
|
+
return {
|
|
19
|
+
chain: { ...chain,
|
|
20
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
21
|
+
default: "".concat(chain.rpcUrls.alchemy, "/").concat(alchemyId)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
provider: () => {
|
|
25
|
+
const provider = new ethers.providers.AlchemyProvider(chain.id, alchemyId);
|
|
26
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
27
|
+
return Object.assign(provider, {
|
|
28
|
+
priority,
|
|
29
|
+
stallTimeout,
|
|
30
|
+
weight
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
webSocketProvider: () => new ethers.providers.AlchemyWebSocketProvider(chain.id, alchemyId)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.alchemyProvider = alchemyProvider;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-b3c52116.cjs.prod.js');
|
|
7
|
+
|
|
8
|
+
function alchemyProvider() {
|
|
9
|
+
let {
|
|
10
|
+
alchemyId = rpcs.defaultAlchemyId,
|
|
11
|
+
pollingInterval,
|
|
12
|
+
priority,
|
|
13
|
+
stallTimeout,
|
|
14
|
+
weight
|
|
15
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
return function (chain) {
|
|
17
|
+
if (!chain.rpcUrls.alchemy) return null;
|
|
18
|
+
return {
|
|
19
|
+
chain: { ...chain,
|
|
20
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
21
|
+
default: "".concat(chain.rpcUrls.alchemy, "/").concat(alchemyId)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
provider: () => {
|
|
25
|
+
const provider = new ethers.providers.AlchemyProvider(chain.id, alchemyId);
|
|
26
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
27
|
+
return Object.assign(provider, {
|
|
28
|
+
priority,
|
|
29
|
+
stallTimeout,
|
|
30
|
+
weight
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
webSocketProvider: () => new ethers.providers.AlchemyWebSocketProvider(chain.id, alchemyId)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.alchemyProvider = alchemyProvider;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
import { d as defaultAlchemyId } from '../../../dist/rpcs-7cfbd91c.esm.js';
|
|
3
|
+
|
|
4
|
+
function alchemyProvider() {
|
|
5
|
+
let {
|
|
6
|
+
alchemyId = defaultAlchemyId,
|
|
7
|
+
pollingInterval,
|
|
8
|
+
priority,
|
|
9
|
+
stallTimeout,
|
|
10
|
+
weight
|
|
11
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
return function (chain) {
|
|
13
|
+
if (!chain.rpcUrls.alchemy) return null;
|
|
14
|
+
return {
|
|
15
|
+
chain: { ...chain,
|
|
16
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
17
|
+
default: "".concat(chain.rpcUrls.alchemy, "/").concat(alchemyId)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
provider: () => {
|
|
21
|
+
const provider = new providers.AlchemyProvider(chain.id, alchemyId);
|
|
22
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
23
|
+
return Object.assign(provider, {
|
|
24
|
+
priority,
|
|
25
|
+
stallTimeout,
|
|
26
|
+
weight
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
webSocketProvider: () => new providers.AlchemyWebSocketProvider(chain.id, alchemyId)
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { alchemyProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/infura";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-9c4eb960.cjs.dev.js');
|
|
7
|
+
|
|
8
|
+
function infuraProvider() {
|
|
9
|
+
let {
|
|
10
|
+
infuraId = rpcs.defaultInfuraId,
|
|
11
|
+
pollingInterval,
|
|
12
|
+
priority,
|
|
13
|
+
stallTimeout,
|
|
14
|
+
weight
|
|
15
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
return function (chain) {
|
|
17
|
+
if (!chain.rpcUrls.infura) return null;
|
|
18
|
+
return {
|
|
19
|
+
chain: { ...chain,
|
|
20
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
21
|
+
default: "".concat(chain.rpcUrls.infura, "/").concat(infuraId)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
provider: () => {
|
|
25
|
+
const provider = new ethers.providers.InfuraProvider(chain.id, infuraId);
|
|
26
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
27
|
+
return Object.assign(provider, {
|
|
28
|
+
priority,
|
|
29
|
+
stallTimeout,
|
|
30
|
+
weight
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
webSocketProvider: () => new ethers.providers.InfuraWebSocketProvider(chain.id, infuraId)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.infuraProvider = infuraProvider;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-b3c52116.cjs.prod.js');
|
|
7
|
+
|
|
8
|
+
function infuraProvider() {
|
|
9
|
+
let {
|
|
10
|
+
infuraId = rpcs.defaultInfuraId,
|
|
11
|
+
pollingInterval,
|
|
12
|
+
priority,
|
|
13
|
+
stallTimeout,
|
|
14
|
+
weight
|
|
15
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
return function (chain) {
|
|
17
|
+
if (!chain.rpcUrls.infura) return null;
|
|
18
|
+
return {
|
|
19
|
+
chain: { ...chain,
|
|
20
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
21
|
+
default: "".concat(chain.rpcUrls.infura, "/").concat(infuraId)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
provider: () => {
|
|
25
|
+
const provider = new ethers.providers.InfuraProvider(chain.id, infuraId);
|
|
26
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
27
|
+
return Object.assign(provider, {
|
|
28
|
+
priority,
|
|
29
|
+
stallTimeout,
|
|
30
|
+
weight
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
webSocketProvider: () => new ethers.providers.InfuraWebSocketProvider(chain.id, infuraId)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.infuraProvider = infuraProvider;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
import { b as defaultInfuraId } from '../../../dist/rpcs-7cfbd91c.esm.js';
|
|
3
|
+
|
|
4
|
+
function infuraProvider() {
|
|
5
|
+
let {
|
|
6
|
+
infuraId = defaultInfuraId,
|
|
7
|
+
pollingInterval,
|
|
8
|
+
priority,
|
|
9
|
+
stallTimeout,
|
|
10
|
+
weight
|
|
11
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
return function (chain) {
|
|
13
|
+
if (!chain.rpcUrls.infura) return null;
|
|
14
|
+
return {
|
|
15
|
+
chain: { ...chain,
|
|
16
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
17
|
+
default: "".concat(chain.rpcUrls.infura, "/").concat(infuraId)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
provider: () => {
|
|
21
|
+
const provider = new providers.InfuraProvider(chain.id, infuraId);
|
|
22
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
23
|
+
return Object.assign(provider, {
|
|
24
|
+
priority,
|
|
25
|
+
stallTimeout,
|
|
26
|
+
weight
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
webSocketProvider: () => new providers.InfuraWebSocketProvider(chain.id, infuraId)
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { infuraProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/providers/jsonRpc";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
|
|
7
|
+
function jsonRpcProvider(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
pollingInterval,
|
|
10
|
+
priority,
|
|
11
|
+
rpc,
|
|
12
|
+
stallTimeout,
|
|
13
|
+
static: static_ = true,
|
|
14
|
+
weight
|
|
15
|
+
} = _ref;
|
|
16
|
+
return function (chain) {
|
|
17
|
+
const rpcConfig = rpc(chain);
|
|
18
|
+
if (!rpcConfig || rpcConfig.http === '') return null;
|
|
19
|
+
return {
|
|
20
|
+
chain: { ...chain,
|
|
21
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
22
|
+
default: rpcConfig.http
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
provider: () => {
|
|
26
|
+
const RpcProvider = static_ ? ethers.providers.StaticJsonRpcProvider : ethers.providers.JsonRpcProvider;
|
|
27
|
+
const provider = new RpcProvider(rpcConfig.http, {
|
|
28
|
+
chainId: chain.id,
|
|
29
|
+
name: chain.network
|
|
30
|
+
});
|
|
31
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
32
|
+
return Object.assign(provider, {
|
|
33
|
+
priority,
|
|
34
|
+
stallTimeout,
|
|
35
|
+
weight
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
...(rpcConfig.webSocket && {
|
|
39
|
+
webSocketProvider: () => new ethers.providers.WebSocketProvider(rpcConfig.webSocket, chain.id)
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.jsonRpcProvider = jsonRpcProvider;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ethers = require('ethers');
|
|
6
|
+
|
|
7
|
+
function jsonRpcProvider(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
pollingInterval,
|
|
10
|
+
priority,
|
|
11
|
+
rpc,
|
|
12
|
+
stallTimeout,
|
|
13
|
+
static: static_ = true,
|
|
14
|
+
weight
|
|
15
|
+
} = _ref;
|
|
16
|
+
return function (chain) {
|
|
17
|
+
const rpcConfig = rpc(chain);
|
|
18
|
+
if (!rpcConfig || rpcConfig.http === '') return null;
|
|
19
|
+
return {
|
|
20
|
+
chain: { ...chain,
|
|
21
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
22
|
+
default: rpcConfig.http
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
provider: () => {
|
|
26
|
+
const RpcProvider = static_ ? ethers.providers.StaticJsonRpcProvider : ethers.providers.JsonRpcProvider;
|
|
27
|
+
const provider = new RpcProvider(rpcConfig.http, {
|
|
28
|
+
chainId: chain.id,
|
|
29
|
+
name: chain.network
|
|
30
|
+
});
|
|
31
|
+
if (pollingInterval) provider.pollingInterval = pollingInterval;
|
|
32
|
+
return Object.assign(provider, {
|
|
33
|
+
priority,
|
|
34
|
+
stallTimeout,
|
|
35
|
+
weight
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
...(rpcConfig.webSocket && {
|
|
39
|
+
webSocketProvider: () => new ethers.providers.WebSocketProvider(rpcConfig.webSocket, chain.id)
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.jsonRpcProvider = jsonRpcProvider;
|