@wagmi/core 1.0.1 → 1.0.2

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.
@@ -2058,7 +2058,7 @@ async function prepareWriteContract({
2058
2058
  if (!walletClient)
2059
2059
  throw new ConnectorNotFoundError();
2060
2060
  if (chainId)
2061
- assertActiveChain({ chainId, walletClient });
2061
+ assertActiveChain({ chainId });
2062
2062
  const {
2063
2063
  accessList,
2064
2064
  blockNumber,
@@ -2334,11 +2334,11 @@ function watchReadContracts(args, callback) {
2334
2334
 
2335
2335
  // src/actions/contracts/writeContract.ts
2336
2336
  async function writeContract(config2) {
2337
- const walletClient = await getWalletClient();
2337
+ const walletClient = await getWalletClient({ chainId: config2.chainId });
2338
2338
  if (!walletClient)
2339
2339
  throw new ConnectorNotFoundError();
2340
2340
  if (config2.chainId)
2341
- assertActiveChain({ chainId: config2.chainId, walletClient });
2341
+ assertActiveChain({ chainId: config2.chainId });
2342
2342
  let request;
2343
2343
  if (config2.mode === "prepared") {
2344
2344
  request = config2;
@@ -2511,7 +2511,7 @@ async function signTypedData({
2511
2511
  throw new ConnectorNotFoundError();
2512
2512
  const { chainId } = domain;
2513
2513
  if (chainId)
2514
- assertActiveChain({ chainId, walletClient });
2514
+ assertActiveChain({ chainId });
2515
2515
  return walletClient.signTypedData({
2516
2516
  message,
2517
2517
  primaryType,
@@ -2696,7 +2696,7 @@ async function prepareSendTransaction({
2696
2696
  if (!walletClient)
2697
2697
  throw new ConnectorNotFoundError();
2698
2698
  if (chainId)
2699
- assertActiveChain({ chainId, walletClient });
2699
+ assertActiveChain({ chainId });
2700
2700
  const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
2701
2701
  if (to && !isAddress(to))
2702
2702
  throw new Error("Invalid address");
@@ -2731,11 +2731,11 @@ async function sendTransaction({
2731
2731
  to,
2732
2732
  value
2733
2733
  }) {
2734
- const walletClient = await getWalletClient();
2734
+ const walletClient = await getWalletClient({ chainId });
2735
2735
  if (!walletClient)
2736
2736
  throw new ConnectorNotFoundError();
2737
2737
  if (chainId)
2738
- assertActiveChain({ chainId, walletClient });
2738
+ assertActiveChain({ chainId });
2739
2739
  let args;
2740
2740
  if (mode === "prepared") {
2741
2741
  args = {
@@ -2766,7 +2766,7 @@ async function sendTransaction({
2766
2766
  value
2767
2767
  });
2768
2768
  }
2769
- const hash = await walletClient.sendTransaction(args);
2769
+ const hash = await walletClient.sendTransaction({ ...args, chain: null });
2770
2770
  return { hash };
2771
2771
  }
2772
2772
 
@@ -2839,10 +2839,7 @@ function watchPendingTransactions(args, callback) {
2839
2839
  }
2840
2840
 
2841
2841
  // src/utils/assertActiveChain.ts
2842
- function assertActiveChain({
2843
- chainId,
2844
- walletClient
2845
- }) {
2842
+ function assertActiveChain({ chainId }) {
2846
2843
  const { chain: activeChain, chains } = getNetwork();
2847
2844
  const activeChainId = activeChain?.id;
2848
2845
  if (activeChainId && chainId !== activeChainId) {
@@ -2851,16 +2848,6 @@ function assertActiveChain({
2851
2848
  targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`
2852
2849
  });
2853
2850
  }
2854
- if (walletClient) {
2855
- const walletClientChainId = walletClient.chain.id;
2856
- if (walletClientChainId && chainId !== walletClientChainId) {
2857
- const connector = getConfig().connector;
2858
- throw new ChainNotConfiguredError({
2859
- chainId,
2860
- connectorId: connector?.id ?? "unknown"
2861
- });
2862
- }
2863
- }
2864
2851
  }
2865
2852
 
2866
2853
  export {
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  watchWalletClient,
59
59
  watchWebSocketPublicClient,
60
60
  writeContract
61
- } from "./chunk-4FHLBJG5.js";
61
+ } from "./chunk-VEUO7GWU.js";
62
62
  import {
63
63
  mainnet,
64
64
  sepolia
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCallParameters,
3
3
  getSendTransactionParameters
4
- } from "../chunk-4FHLBJG5.js";
4
+ } from "../chunk-VEUO7GWU.js";
5
5
  import "../chunk-BVC4KGLQ.js";
6
6
  import "../chunk-MQXBDTVK.js";
7
7
  export {
@@ -1,5 +1,5 @@
1
1
  import "../chunk-KX4UEHS5.js";
2
- import "../chunk-4FHLBJG5.js";
2
+ import "../chunk-VEUO7GWU.js";
3
3
  import {
4
4
  foundry,
5
5
  goerli,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "Vanilla JS library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "1.0.1",
5
+ "version": "1.0.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -123,8 +123,8 @@
123
123
  "abitype": "0.8.1",
124
124
  "eventemitter3": "^4.0.7",
125
125
  "zustand": "^4.3.1",
126
- "@wagmi/connectors": "1.0.1",
127
- "@wagmi/chains": "0.2.22"
126
+ "@wagmi/chains": "0.2.22",
127
+ "@wagmi/connectors": "1.0.2"
128
128
  },
129
129
  "devDependencies": {
130
130
  "viem": "~0.3.18"
@@ -1,4 +0,0 @@
1
- {
2
- "type": "module",
3
- "main": "../../dist/connectors/walletConnectV1.js"
4
- }
@@ -1,11 +0,0 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../../src/internal";
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
9
-
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../..", "../..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../../src/internal.ts");
15
-
16
- unregister();
@@ -1,11 +0,0 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../../../src/providers/alchemy";
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
9
-
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../../../src/providers/alchemy.ts");
15
-
16
- unregister();
@@ -1,11 +0,0 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../../../src/providers/infura";
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
9
-
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../../../src/providers/infura.ts");
15
-
16
- unregister();
@@ -1,11 +0,0 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../../../src/providers/jsonRpc";
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
9
-
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../../../src/providers/jsonRpc.ts");
15
-
16
- unregister();
@@ -1,11 +0,0 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../../../src/providers/public";
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
9
-
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../../../src/providers/public.ts");
15
-
16
- unregister();