@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
|
@@ -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>, '
|
|
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>, '
|
|
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
package/dist/internal/index.d.ts
CHANGED
|
@@ -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 };
|
package/dist/internal/index.js
CHANGED
package/dist/internal/test.js
CHANGED
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.
|
|
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.
|
|
127
|
-
"@wagmi/connectors": "
|
|
126
|
+
"@wagmi/chains": "0.3.1",
|
|
127
|
+
"@wagmi/connectors": "2.0.0"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"viem": "~0.3.35"
|