@wagmi/core 1.0.6 → 1.0.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-present weth, LLC
3
+ Copyright (c) 2022-present weth, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -218,6 +218,7 @@ function deserialize(cachedString) {
218
218
  function getCallParameters(args) {
219
219
  return {
220
220
  accessList: args.accessList,
221
+ account: args.account,
221
222
  blockNumber: args.blockNumber,
222
223
  blockTag: args.blockTag,
223
224
  data: args.data,
@@ -233,6 +234,7 @@ function getCallParameters(args) {
233
234
  function getSendTransactionParameters(args) {
234
235
  return {
235
236
  accessList: args.accessList,
237
+ account: args.account,
236
238
  data: args.data,
237
239
  gas: args.gas,
238
240
  gasPrice: args.gasPrice,
@@ -2062,6 +2064,7 @@ async function prepareWriteContract({
2062
2064
  if (chainId)
2063
2065
  assertActiveChain({ chainId });
2064
2066
  const {
2067
+ account,
2065
2068
  accessList,
2066
2069
  blockNumber,
2067
2070
  blockTag,
@@ -2077,7 +2080,7 @@ async function prepareWriteContract({
2077
2080
  address,
2078
2081
  functionName,
2079
2082
  args,
2080
- account: walletClient.account,
2083
+ account: account || walletClient.account,
2081
2084
  accessList,
2082
2085
  blockNumber,
2083
2086
  blockTag,
@@ -2347,7 +2350,7 @@ async function writeContract(config2) {
2347
2350
  if (config2.mode === "prepared") {
2348
2351
  request = config2;
2349
2352
  } else {
2350
- const { chainId, mode, ...args } = config2;
2353
+ const { chainId: _, mode: __, ...args } = config2;
2351
2354
  const res = await prepareWriteContract(args);
2352
2355
  request = res.request;
2353
2356
  }
package/dist/index.d.ts CHANGED
@@ -250,7 +250,7 @@ type FetchTokenResult = {
250
250
  };
251
251
  declare function fetchToken({ address, chainId, formatUnits: unit, }: FetchTokenArgs): Promise<FetchTokenResult>;
252
252
 
253
- type PrepareWriteContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChainId extends number = number, TWalletClient extends WalletClient = WalletClient> = Omit<SimulateContractParameters<TAbi, TFunctionName>, 'account' | 'chain'> & {
253
+ type PrepareWriteContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChainId extends number = number, TWalletClient extends WalletClient = WalletClient> = Omit<SimulateContractParameters<TAbi, TFunctionName>, 'chain'> & {
254
254
  /** Chain id to use for Public Client. */
255
255
  chainId?: TChainId | number;
256
256
  /** Custom Wallet Client. */
@@ -342,7 +342,7 @@ type WriteContractPreparedArgs<TAbi extends Abi | readonly unknown[] = readonly
342
342
  /** Chain id. */
343
343
  chainId?: number;
344
344
  };
345
- type WriteContractUnpreparedArgs<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = Omit<WriteContractParameters<TAbi, TFunctionName, Chain$1, Account>, 'account' | 'chain'> & {
345
+ type WriteContractUnpreparedArgs<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = Omit<WriteContractParameters<TAbi, TFunctionName, Chain$1, Account>, 'chain'> & {
346
346
  mode?: never;
347
347
  /** Chain id. */
348
348
  chainId?: number;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  watchWalletClient,
59
59
  watchWebSocketPublicClient,
60
60
  writeContract
61
- } from "./chunk-BMHDSNLV.js";
61
+ } from "./chunk-OKULXQAF.js";
62
62
  import {
63
63
  mainnet,
64
64
  sepolia
@@ -1,8 +1,5 @@
1
1
  import { CallParameters, SendTransactionParameters } from 'viem';
2
2
 
3
- declare function getCallParameters(args: Omit<CallParameters, 'account'>): Omit<CallParameters, 'account'>;
4
- declare function getSendTransactionParameters(args: Omit<SendTransactionParameters, 'account' | 'chain'>): Omit<SendTransactionParameters, 'account' | 'chain'>;
5
-
6
3
  /**
7
4
  * Converts properties of {@link T} to never
8
5
  *
@@ -16,5 +13,12 @@ declare function getSendTransactionParameters(args: Omit<SendTransactionParamete
16
13
  type Never<T> = {
17
14
  [K in keyof T]: never;
18
15
  };
16
+ /**
17
+ * Makes {@link TKeys} optional in {@link TType} while preserving type inference.
18
+ */
19
+ type PartialBy<TType, TKeys extends keyof TType> = Partial<Pick<TType, TKeys>> & Omit<TType, TKeys>;
20
+
21
+ declare function getCallParameters(args: Omit<CallParameters, 'chain'>): CallParameters;
22
+ declare function getSendTransactionParameters(args: PartialBy<Omit<SendTransactionParameters, 'chain'>, 'account'>): PartialBy<Omit<SendTransactionParameters, 'chain'>, 'account'>;
19
23
 
20
24
  export { Never, getCallParameters, getSendTransactionParameters };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCallParameters,
3
3
  getSendTransactionParameters
4
- } from "../chunk-BMHDSNLV.js";
4
+ } from "../chunk-OKULXQAF.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-BMHDSNLV.js";
2
+ import "../chunk-OKULXQAF.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.6",
5
+ "version": "1.0.7",
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/chains": "0.2.25",
127
- "@wagmi/connectors": "1.0.5"
126
+ "@wagmi/chains": "0.3.1",
127
+ "@wagmi/connectors": "2.0.0"
128
128
  },
129
129
  "devDependencies": {
130
130
  "viem": "~0.3.35"