wagmi 0.10.15 → 0.11.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/README.md +1 -1
- package/dist/actions.d.ts +1 -1
- package/dist/index.d.ts +20 -19
- package/dist/index.js +78 -80
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -26,5 +26,5 @@ Check out the following places for more wagmi-related content:
|
|
|
26
26
|
If you find wagmi useful, please consider supporting development. Thank you 🙏
|
|
27
27
|
|
|
28
28
|
- [GitHub Sponsors](https://github.com/sponsors/wagmi-dev?metadata_campaign=readme_wagmi)
|
|
29
|
-
- [Gitcoin Grant](https://
|
|
29
|
+
- [Gitcoin Grant](https://wagmi.sh/gitcoin)
|
|
30
30
|
- [wagmi-dev.eth](https://etherscan.io/enslookup-search?search=wagmi-dev.eth)
|
package/dist/actions.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, PrepareWriteContractConfig, PrepareWriteContractResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchContractEventCallback, WatchContractEventConfig, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchPendingTransactionsArgs, WatchPendingTransactionsCallback, WatchPendingTransactionsResult, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, multicall, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchPendingTransactions, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
|
1
|
+
export { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, PrepareWriteContractConfig, PrepareWriteContractResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchContractEventCallback, WatchContractEventConfig, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchPendingTransactionsArgs, WatchPendingTransactionsCallback, WatchPendingTransactionsResult, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractMode, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, multicall, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchPendingTransactions, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as _tanstack_react_query from '@tanstack/react-query';
|
|
|
2
2
|
import { QueryClient, QueryKey, UseInfiniteQueryOptions, QueryFunction, InfiniteQueryObserverResult, UseMutationOptions, UseMutationResult, MutationFunction, MutationKey, UseQueryOptions, QueryObserverResult } from '@tanstack/react-query';
|
|
3
3
|
import { Persister } from '@tanstack/react-query-persist-client';
|
|
4
4
|
import * as _wagmi_core from '@wagmi/core';
|
|
5
|
-
import { Provider, WebSocketProvider, ClientConfig, Client as Client$1, GetAccountResult, FetchBalanceResult, FetchBalanceArgs, ConnectArgs, ConnectResult, Signer, FetchSignerResult, FetchSignerArgs, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, GetContractArgs, GetContractResult, WatchContractEventConfig, ReadContractsResult, ReadContractsConfig, ReadContractResult, ReadContractConfig, WriteContractMode, WriteContractResult,
|
|
6
|
-
export { AddChainError, Chain, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, ChainProviderFn, Connector, ConnectorAlreadyConnectedError, ConnectorData, ConnectorEvents, ConnectorNotFoundError, ContractMethodDoesNotExistError, ContractMethodNoResultError, ContractMethodRevertedError, ContractResultDecodeError, ProviderChainsNotFound, ProviderRpcError, ResourceUnavailableError, RpcError, Storage, SwitchChainError, SwitchChainNotSupportedError, Unit, UserRejectedRequestError,
|
|
5
|
+
import { Provider, WebSocketProvider, ClientConfig, Client as Client$1, GetAccountResult, FetchBalanceResult, FetchBalanceArgs, ConnectArgs, ConnectResult, Signer, FetchSignerResult, FetchSignerArgs, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, GetContractArgs, GetContractResult, WatchContractEventConfig, ReadContractsResult, ReadContractsConfig, ReadContractResult, ReadContractConfig, WriteContractMode, WriteContractResult, WriteContractUnpreparedArgs, WriteContractPreparedArgs, PrepareWriteContractConfig, PrepareWriteContractResult, FetchTokenResult, FetchTokenArgs, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchFeeDataResult, FetchFeeDataArgs, GetProviderArgs, GetWebSocketProviderArgs, PrepareSendTransactionResult, PrepareSendTransactionArgs, SendTransactionResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionUnpreparedRequest, FetchTransactionArgs, FetchTransactionResult, WaitForTransactionArgs, WaitForTransactionResult } from '@wagmi/core';
|
|
6
|
+
export { AddChainError, Chain, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, ChainProviderFn, Connector, ConnectorAlreadyConnectedError, ConnectorData, ConnectorEvents, ConnectorNotFoundError, ContractMethodDoesNotExistError, ContractMethodNoResultError, ContractMethodRevertedError, ContractResultDecodeError, ProviderChainsNotFound, ProviderRpcError, ResourceUnavailableError, RpcError, Storage, SwitchChainError, SwitchChainNotSupportedError, Unit, UserRejectedRequestError, configureChains, createStorage, deepEqual, deserialize, erc20ABI, erc4626ABI, erc721ABI, goerli, mainnet, readContracts, serialize } from '@wagmi/core';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import * as abitype from 'abitype';
|
|
9
9
|
import { Address, TypedData, TypedDataToPrimitiveTypes, TypedDataDomain, ResolvedConfig, Abi, AbiEvent, ExtractAbiEvent, AbiParametersToPrimitiveTypes } from 'abitype';
|
|
@@ -316,18 +316,8 @@ declare function useContractReads<TAbi extends Abi | readonly unknown[], TFuncti
|
|
|
316
316
|
|
|
317
317
|
type UseContractWriteArgs<TMode extends WriteContractMode = WriteContractMode, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
|
|
318
318
|
mode: TMode;
|
|
319
|
-
} & (
|
|
319
|
+
} & (PartialBy<WriteContractPreparedArgs<TAbi, TFunctionName>, 'abi' | 'address' | 'functionName' | 'request'> | PartialBy<WriteContractUnpreparedArgs<TAbi, TFunctionName>, 'abi' | 'address' | 'args' | 'functionName'>);
|
|
320
320
|
type UseContractWriteConfig<TMode extends WriteContractMode = WriteContractMode, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = MutationConfig<WriteContractResult, Error, UseContractWriteArgs<TMode, TAbi, TFunctionName>> & UseContractWriteArgs<TMode, TAbi, TFunctionName>;
|
|
321
|
-
type UseContractWriteMutationArgs<Mode extends 'prepared' | 'recklesslyUnprepared', TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Mode extends 'prepared' ? undefined : {
|
|
322
|
-
/**
|
|
323
|
-
* Recklessly pass through unprepared config. Note: This has
|
|
324
|
-
* [UX pitfalls](https://wagmi.sh/react/prepare-hooks#ux-pitfalls-without-prepare-hooks),
|
|
325
|
-
* it is highly recommended to not use this and instead prepare the config upfront
|
|
326
|
-
* using the `usePrepareContractWrite` function.
|
|
327
|
-
*/
|
|
328
|
-
recklesslySetUnpreparedArgs?: WriteContractArgs<TAbi, TFunctionName>['args'];
|
|
329
|
-
recklesslySetUnpreparedOverrides?: WriteContractArgs<TAbi, TFunctionName>['overrides'];
|
|
330
|
-
};
|
|
331
321
|
/**
|
|
332
322
|
* @description Hook for calling an ethers Contract [write](https://docs.ethers.io/v5/api/contract/contract/#Contract--write)
|
|
333
323
|
* method.
|
|
@@ -346,7 +336,7 @@ type UseContractWriteMutationArgs<Mode extends 'prepared' | 'recklesslyUnprepare
|
|
|
346
336
|
* const { data, isLoading, isSuccess, write } = useContractWrite(config)
|
|
347
337
|
*
|
|
348
338
|
*/
|
|
349
|
-
declare function useContractWrite<TMode extends WriteContractMode, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(
|
|
339
|
+
declare function useContractWrite<TMode extends WriteContractMode, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(config?: UseContractWriteConfig<TMode, TAbi, TFunctionName>): {
|
|
350
340
|
data: _wagmi_core.SendTransactionResult | undefined;
|
|
351
341
|
error: Error | null;
|
|
352
342
|
isError: boolean;
|
|
@@ -356,11 +346,22 @@ declare function useContractWrite<TMode extends WriteContractMode, TAbi extends
|
|
|
356
346
|
reset: () => void;
|
|
357
347
|
status: "error" | "success" | "loading" | "idle";
|
|
358
348
|
variables: UseContractWriteArgs<WriteContractMode, Abi, string> | undefined;
|
|
359
|
-
write:
|
|
360
|
-
writeAsync:
|
|
349
|
+
write: MutationFn<TMode & "prepared", TAbi, TFunctionName, void> | MutationFn<TMode & WriteContractUnpreparedArgs<TAbi, TFunctionName>["mode"], TAbi, TFunctionName, void>;
|
|
350
|
+
writeAsync: MutationFn<TMode & "prepared", TAbi, TFunctionName, Promise<_wagmi_core.SendTransactionResult>> | MutationFn<TMode & WriteContractUnpreparedArgs<TAbi, TFunctionName>["mode"], TAbi, TFunctionName, Promise<_wagmi_core.SendTransactionResult>>;
|
|
351
|
+
};
|
|
352
|
+
type MutationFnArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
|
|
353
|
+
/**
|
|
354
|
+
* Recklessly pass through unprepared config. Note: This has
|
|
355
|
+
* [UX pitfalls](https://wagmi.sh/react/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks),
|
|
356
|
+
* it is highly recommended to not use this and instead prepare the config upfront
|
|
357
|
+
* using the `usePrepareContractWrite` function.
|
|
358
|
+
*/
|
|
359
|
+
recklesslySetUnpreparedArgs?: WriteContractUnpreparedArgs<TAbi, TFunctionName>['args'];
|
|
360
|
+
recklesslySetUnpreparedOverrides?: WriteContractUnpreparedArgs<TAbi, TFunctionName>['overrides'];
|
|
361
361
|
};
|
|
362
|
+
type MutationFn<TMode extends WriteContractMode, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TReturnType> = TMode extends 'prepared' ? (() => TReturnType) | undefined : (config?: MutationFnArgs<TAbi, TFunctionName>) => TReturnType;
|
|
362
363
|
|
|
363
|
-
type UsePrepareContractWriteConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TSigner extends Signer = Signer> = PartialBy<PrepareWriteContractConfig<TAbi, TFunctionName, TSigner>, 'abi' | 'address' | 'args' | 'functionName'> & QueryConfig<PrepareWriteContractResult<TAbi, TFunctionName>, Error>;
|
|
364
|
+
type UsePrepareContractWriteConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChainId extends number = number, TSigner extends Signer = Signer> = PartialBy<PrepareWriteContractConfig<TAbi, TFunctionName, TChainId, TSigner>, 'abi' | 'address' | 'args' | 'functionName'> & QueryConfig<PrepareWriteContractResult<TAbi, TFunctionName, TChainId>, Error>;
|
|
364
365
|
/**
|
|
365
366
|
* @description Hook for preparing a contract write to be sent via [`useContractWrite`](/docs/hooks/useContractWrite).
|
|
366
367
|
*
|
|
@@ -377,12 +378,12 @@ type UsePrepareContractWriteConfig<TAbi extends Abi | readonly unknown[] = Abi,
|
|
|
377
378
|
* const { data, isLoading, isSuccess, write } = useContractWrite(config)
|
|
378
379
|
*
|
|
379
380
|
*/
|
|
380
|
-
declare function usePrepareContractWrite<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ address, abi, functionName, chainId, args, overrides, cacheTime, enabled, scopeKey, staleTime, suspense, onError, onSettled, onSuccess, }?: UsePrepareContractWriteConfig<TAbi, TFunctionName>): Pick<_tanstack_react_query.QueryObserverResult<PrepareWriteContractResult<TAbi, TFunctionName>, Error>, "data" | "error" | "isError" | "isLoading" | "isSuccess" | "isFetched" | "isFetchedAfterMount" | "isFetching" | "isRefetching" | "refetch" | "fetchStatus"> & {
|
|
381
|
+
declare function usePrepareContractWrite<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainId extends number>({ address, abi, functionName, chainId, args, overrides, cacheTime, enabled, scopeKey, staleTime, suspense, onError, onSettled, onSuccess, }?: UsePrepareContractWriteConfig<TAbi, TFunctionName, TChainId>): Pick<_tanstack_react_query.QueryObserverResult<PrepareWriteContractResult<TAbi, TFunctionName, TChainId>, Error>, "data" | "error" | "isError" | "isLoading" | "isSuccess" | "isFetched" | "isFetchedAfterMount" | "isFetching" | "isRefetching" | "refetch" | "fetchStatus"> & {
|
|
381
382
|
isIdle: boolean;
|
|
382
383
|
status: "error" | "success" | "loading" | "idle";
|
|
383
384
|
internal: Pick<_tanstack_react_query.QueryObserverResult<unknown, unknown>, "isLoadingError" | "isRefetchError" | "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isStale" | "remove">;
|
|
384
385
|
} & {
|
|
385
|
-
config: PrepareWriteContractResult<TAbi, TFunctionName>;
|
|
386
|
+
config: PrepareWriteContractResult<TAbi, TFunctionName, TChainId>;
|
|
386
387
|
};
|
|
387
388
|
|
|
388
389
|
type UseTokenArgs = Partial<FetchTokenArgs>;
|
package/dist/index.js
CHANGED
|
@@ -1421,13 +1421,13 @@ import { writeContract } from "@wagmi/core";
|
|
|
1421
1421
|
import * as React19 from "react";
|
|
1422
1422
|
function mutationKey6({
|
|
1423
1423
|
address,
|
|
1424
|
-
args,
|
|
1425
1424
|
chainId,
|
|
1426
1425
|
abi,
|
|
1427
1426
|
functionName,
|
|
1428
|
-
|
|
1429
|
-
request
|
|
1427
|
+
...config
|
|
1430
1428
|
}) {
|
|
1429
|
+
const { request } = config;
|
|
1430
|
+
const { args, overrides } = config;
|
|
1431
1431
|
return [
|
|
1432
1432
|
{
|
|
1433
1433
|
entity: "writeContract",
|
|
@@ -1441,61 +1441,42 @@ function mutationKey6({
|
|
|
1441
1441
|
}
|
|
1442
1442
|
];
|
|
1443
1443
|
}
|
|
1444
|
-
function mutationFn6({
|
|
1445
|
-
address
|
|
1446
|
-
args,
|
|
1447
|
-
chainId,
|
|
1448
|
-
abi,
|
|
1449
|
-
functionName,
|
|
1450
|
-
mode,
|
|
1451
|
-
overrides,
|
|
1452
|
-
request
|
|
1453
|
-
}) {
|
|
1454
|
-
if (!address)
|
|
1444
|
+
function mutationFn6(config) {
|
|
1445
|
+
if (!config.address)
|
|
1455
1446
|
throw new Error("address is required");
|
|
1456
|
-
if (!abi)
|
|
1447
|
+
if (!config.abi)
|
|
1457
1448
|
throw new Error("abi is required");
|
|
1458
|
-
if (!functionName)
|
|
1449
|
+
if (!config.functionName)
|
|
1459
1450
|
throw new Error("functionName is required");
|
|
1460
|
-
switch (mode) {
|
|
1451
|
+
switch (config.mode) {
|
|
1461
1452
|
case "prepared": {
|
|
1462
|
-
if (!request)
|
|
1453
|
+
if (!config.request)
|
|
1463
1454
|
throw new Error("request is required");
|
|
1464
1455
|
return writeContract({
|
|
1465
1456
|
mode: "prepared",
|
|
1466
|
-
address,
|
|
1467
|
-
chainId,
|
|
1468
|
-
abi,
|
|
1469
|
-
functionName,
|
|
1470
|
-
request
|
|
1457
|
+
address: config.address,
|
|
1458
|
+
chainId: config.chainId,
|
|
1459
|
+
abi: config.abi,
|
|
1460
|
+
functionName: config.functionName,
|
|
1461
|
+
request: config.request
|
|
1471
1462
|
});
|
|
1472
1463
|
}
|
|
1473
1464
|
case "recklesslyUnprepared":
|
|
1474
1465
|
return writeContract({
|
|
1475
|
-
address,
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1466
|
+
address: config.address,
|
|
1467
|
+
args: config.args,
|
|
1468
|
+
chainId: config.chainId,
|
|
1469
|
+
abi: config.abi,
|
|
1470
|
+
functionName: config.functionName,
|
|
1480
1471
|
mode: "recklesslyUnprepared",
|
|
1481
|
-
overrides
|
|
1472
|
+
overrides: config.overrides
|
|
1482
1473
|
});
|
|
1483
1474
|
}
|
|
1484
1475
|
}
|
|
1485
|
-
function useContractWrite({
|
|
1486
|
-
address,
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
abi,
|
|
1490
|
-
functionName,
|
|
1491
|
-
mode,
|
|
1492
|
-
overrides,
|
|
1493
|
-
request,
|
|
1494
|
-
onError,
|
|
1495
|
-
onMutate,
|
|
1496
|
-
onSettled,
|
|
1497
|
-
onSuccess
|
|
1498
|
-
} = {}) {
|
|
1476
|
+
function useContractWrite(config = {}) {
|
|
1477
|
+
const { address, abi, functionName, chainId, mode } = config;
|
|
1478
|
+
const { request } = config;
|
|
1479
|
+
const { args, overrides } = config;
|
|
1499
1480
|
const {
|
|
1500
1481
|
data,
|
|
1501
1482
|
error,
|
|
@@ -1513,70 +1494,86 @@ function useContractWrite({
|
|
|
1513
1494
|
address,
|
|
1514
1495
|
abi,
|
|
1515
1496
|
functionName,
|
|
1516
|
-
args,
|
|
1517
1497
|
chainId,
|
|
1518
1498
|
mode,
|
|
1499
|
+
args,
|
|
1519
1500
|
overrides,
|
|
1520
1501
|
request
|
|
1521
1502
|
}),
|
|
1522
1503
|
mutationFn6,
|
|
1523
1504
|
{
|
|
1524
|
-
onError,
|
|
1525
|
-
onMutate,
|
|
1526
|
-
onSettled,
|
|
1527
|
-
onSuccess
|
|
1505
|
+
onError: config.onError,
|
|
1506
|
+
onMutate: config.onMutate,
|
|
1507
|
+
onSettled: config.onSettled,
|
|
1508
|
+
onSuccess: config.onSuccess
|
|
1528
1509
|
}
|
|
1529
1510
|
);
|
|
1530
|
-
const write = React19.
|
|
1531
|
-
(
|
|
1532
|
-
|
|
1511
|
+
const write = React19.useMemo(() => {
|
|
1512
|
+
if (mode === "prepared") {
|
|
1513
|
+
if (!request)
|
|
1514
|
+
return void 0;
|
|
1515
|
+
return () => mutate({
|
|
1533
1516
|
address,
|
|
1534
|
-
args: overrideConfig?.recklesslySetUnpreparedArgs ?? args,
|
|
1535
1517
|
chainId,
|
|
1536
1518
|
abi,
|
|
1537
1519
|
functionName,
|
|
1538
|
-
mode:
|
|
1539
|
-
overrides: overrideConfig?.recklesslySetUnpreparedOverrides ?? overrides,
|
|
1520
|
+
mode: "prepared",
|
|
1540
1521
|
request
|
|
1541
1522
|
});
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1523
|
+
}
|
|
1524
|
+
return (overrideConfig) => mutate({
|
|
1544
1525
|
address,
|
|
1545
|
-
args,
|
|
1526
|
+
args: overrideConfig?.recklesslySetUnpreparedArgs ?? args,
|
|
1546
1527
|
chainId,
|
|
1547
1528
|
abi,
|
|
1548
1529
|
functionName,
|
|
1549
|
-
mode,
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1530
|
+
mode: "recklesslyUnprepared",
|
|
1531
|
+
overrides: overrideConfig?.recklesslySetUnpreparedOverrides ?? overrides
|
|
1532
|
+
});
|
|
1533
|
+
}, [
|
|
1534
|
+
address,
|
|
1535
|
+
chainId,
|
|
1536
|
+
abi,
|
|
1537
|
+
functionName,
|
|
1538
|
+
mode,
|
|
1539
|
+
mutate,
|
|
1540
|
+
args,
|
|
1541
|
+
overrides,
|
|
1542
|
+
request
|
|
1543
|
+
]);
|
|
1544
|
+
const writeAsync = React19.useMemo(() => {
|
|
1545
|
+
if (mode === "prepared") {
|
|
1546
|
+
if (!request)
|
|
1547
|
+
return void 0;
|
|
1548
|
+
return () => mutateAsync({
|
|
1558
1549
|
address,
|
|
1559
|
-
args: overrideConfig?.recklesslySetUnpreparedArgs ?? args,
|
|
1560
1550
|
chainId,
|
|
1561
1551
|
abi,
|
|
1562
1552
|
functionName,
|
|
1563
|
-
mode:
|
|
1564
|
-
overrides: overrideConfig?.recklesslySetUnpreparedOverrides ?? overrides,
|
|
1553
|
+
mode: "prepared",
|
|
1565
1554
|
request
|
|
1566
1555
|
});
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1556
|
+
}
|
|
1557
|
+
return (overrideConfig) => mutateAsync({
|
|
1569
1558
|
address,
|
|
1570
|
-
args,
|
|
1559
|
+
args: overrideConfig?.recklesslySetUnpreparedArgs ?? args,
|
|
1571
1560
|
chainId,
|
|
1572
1561
|
abi,
|
|
1573
1562
|
functionName,
|
|
1574
|
-
mode,
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1563
|
+
mode: "recklesslyUnprepared",
|
|
1564
|
+
overrides: overrideConfig?.recklesslySetUnpreparedOverrides ?? overrides
|
|
1565
|
+
});
|
|
1566
|
+
}, [
|
|
1567
|
+
address,
|
|
1568
|
+
chainId,
|
|
1569
|
+
abi,
|
|
1570
|
+
functionName,
|
|
1571
|
+
mode,
|
|
1572
|
+
mutateAsync,
|
|
1573
|
+
args,
|
|
1574
|
+
overrides,
|
|
1575
|
+
request
|
|
1576
|
+
]);
|
|
1580
1577
|
return {
|
|
1581
1578
|
data,
|
|
1582
1579
|
error,
|
|
@@ -1587,8 +1584,8 @@ function useContractWrite({
|
|
|
1587
1584
|
reset,
|
|
1588
1585
|
status,
|
|
1589
1586
|
variables,
|
|
1590
|
-
write
|
|
1591
|
-
writeAsync
|
|
1587
|
+
write,
|
|
1588
|
+
writeAsync
|
|
1592
1589
|
};
|
|
1593
1590
|
}
|
|
1594
1591
|
|
|
@@ -1684,6 +1681,7 @@ function usePrepareContractWrite({
|
|
|
1684
1681
|
abi,
|
|
1685
1682
|
address,
|
|
1686
1683
|
args,
|
|
1684
|
+
chainId,
|
|
1687
1685
|
functionName,
|
|
1688
1686
|
mode: "prepared",
|
|
1689
1687
|
overrides,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "wagmi",
|
|
3
3
|
"description": "React Hooks for Ethereum",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.11.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"funding": [
|
|
18
18
|
{
|
|
19
19
|
"type": "gitcoin",
|
|
20
|
-
"url": "https://
|
|
20
|
+
"url": "https://wagmi.sh/gitcoin"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"type": "github",
|
|
@@ -96,17 +96,21 @@
|
|
|
96
96
|
],
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"ethers": ">=5.5.1",
|
|
99
|
-
"react": ">=17.0.0"
|
|
99
|
+
"react": ">=17.0.0",
|
|
100
|
+
"typescript": ">=4.9.4"
|
|
101
|
+
},
|
|
102
|
+
"peerDependenciesMeta": {
|
|
103
|
+
"typescript": {
|
|
104
|
+
"optional": true
|
|
105
|
+
}
|
|
100
106
|
},
|
|
101
107
|
"dependencies": {
|
|
102
|
-
"@coinbase/wallet-sdk": "^3.6.0",
|
|
103
108
|
"@tanstack/query-sync-storage-persister": "^4.14.5",
|
|
104
109
|
"@tanstack/react-query": "^4.14.5",
|
|
105
110
|
"@tanstack/react-query-persist-client": "^4.14.5",
|
|
106
|
-
"
|
|
107
|
-
"abitype": "^0.2.5",
|
|
111
|
+
"abitype": "^0.3.0",
|
|
108
112
|
"use-sync-external-store": "^1.2.0",
|
|
109
|
-
"@wagmi/core": "0.
|
|
113
|
+
"@wagmi/core": "0.9.0"
|
|
110
114
|
},
|
|
111
115
|
"devDependencies": {
|
|
112
116
|
"@testing-library/react": "^13.3.0",
|
|
@@ -114,11 +118,11 @@
|
|
|
114
118
|
"@types/react": "^18.0.9",
|
|
115
119
|
"@types/react-dom": "^18.0.3",
|
|
116
120
|
"@types/use-sync-external-store": "^0.0.3",
|
|
121
|
+
"ethers": "^5.7.1",
|
|
117
122
|
"react": "^18.1.0",
|
|
118
123
|
"react-17": "npm:react@17.0.2",
|
|
119
124
|
"react-dom": "^18.1.0",
|
|
120
|
-
"react-dom-17": "npm:react-dom@17.0.2"
|
|
121
|
-
"typescript": "^4.9.3"
|
|
125
|
+
"react-dom-17": "npm:react-dom@17.0.2"
|
|
122
126
|
},
|
|
123
127
|
"keywords": [
|
|
124
128
|
"react",
|