wagmi-extended 1.1.8 → 2.0.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/fetch-functions/erc20/fetchAllowanceX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchBalanceOfX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchERC20DataX.d.ts +18 -0
- package/dist/fetch-functions/erc20/fetchNameX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchSymbolX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchTotalSupplyX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626AssetX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626ConvertToAssetsX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626ConvertToSharesX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626DataX.d.ts +24 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxDepositX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxMintX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxRedeemX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxWithdrawX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626TotalAssetsX.d.ts +4 -0
- package/dist/hooks/{useContractWriteX.d.ts → mutations/useContractWriteX.d.ts} +40 -35
- package/dist/hooks/{useHandleTransactionMutationX.d.ts → mutations/useHandleTransactionMutationX.d.ts} +8 -1
- package/dist/hooks/{useSendTransactionX.d.ts → mutations/useSendTransactionX.d.ts} +14 -13
- package/dist/hooks/queries/useERC20Data.d.ts +22 -0
- package/dist/hooks/queries/useFetchERC4626DataX.d.ts +28 -0
- package/dist/hooks/{useTokenX.d.ts → queries/useTokenX.d.ts} +18 -18
- package/dist/index.cjs.js +349 -114
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +17 -5
- package/dist/index.esm.js +339 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/query-config/index.d.ts +20 -2
- package/dist/utils/ensureClientAndConfig.d.ts +6 -0
- package/package.json +1 -1
- package/src/fetch-functions/erc20/fetchAllowanceX.ts +31 -0
- package/src/fetch-functions/erc20/fetchBalanceOfX.ts +28 -0
- package/src/fetch-functions/erc20/fetchERC20DataX.ts +52 -0
- package/src/fetch-functions/erc20/fetchNameX.ts +26 -0
- package/src/fetch-functions/erc20/fetchSymbolX.ts +26 -0
- package/src/fetch-functions/erc20/fetchTotalSupplyX.ts +26 -0
- package/src/fetch-functions/erc4626/fetchERC4626AssetX.ts +25 -0
- package/src/fetch-functions/erc4626/fetchERC4626ConvertToAssetsX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626ConvertToSharesX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626DataX.ts +60 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxDepositX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxMintX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxRedeemX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxWithdrawX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626TotalAssetsX.ts +25 -0
- package/src/fetch-functions/fetchTokenX.ts +16 -30
- package/src/hooks/{useContractWriteX.ts → mutations/useContractWriteX.ts} +32 -12
- package/src/hooks/{useERC20ApproveX.ts → mutations/useERC20ApproveX.ts} +1 -1
- package/src/hooks/{useHandleTransactionMutationX.ts → mutations/useHandleTransactionMutationX.ts} +30 -4
- package/src/hooks/{useSendTransactionX.ts → mutations/useSendTransactionX.ts} +36 -3
- package/src/hooks/queries/useERC20Data.ts +40 -0
- package/src/hooks/{useFetchAssetAllowanceX.ts → queries/useFetchAssetAllowanceX.ts} +6 -4
- package/src/hooks/queries/useFetchERC4626DataX.ts +39 -0
- package/src/hooks/{useTokenX.ts → queries/useTokenX.ts} +1 -1
- package/src/index.ts +17 -5
- package/src/query-config/index.ts +13 -3
- package/src/utils/ensureClientAndConfig.ts +18 -0
- package/dist/fetch-functions/fetchAllowanceX.d.ts +0 -2
- package/src/fetch-functions/fetchAllowanceX.ts +0 -22
- /package/dist/hooks/{useERC20ApproveX.d.ts → mutations/useERC20ApproveX.d.ts} +0 -0
- /package/dist/hooks/{useInvalidateQueries.d.ts → mutations/useInvalidateQueries.d.ts} +0 -0
- /package/dist/hooks/{useFetchAssetAllowanceX.d.ts → queries/useFetchAssetAllowanceX.d.ts} +0 -0
- /package/src/hooks/{useInvalidateQueries.ts → mutations/useInvalidateQueries.ts} +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Address, erc20Abi } from "viem";
|
|
2
|
-
import { readContract } from "viem/actions";
|
|
3
|
-
|
|
4
|
-
export const fetchAllowance = async (
|
|
5
|
-
asset: Address,
|
|
6
|
-
spender: Address,
|
|
7
|
-
userAddress: Address,
|
|
8
|
-
config: any
|
|
9
|
-
) => {
|
|
10
|
-
const allowance = await readContract(config, {
|
|
11
|
-
address: asset,
|
|
12
|
-
abi: erc20Abi,
|
|
13
|
-
functionName: "allowance",
|
|
14
|
-
args: [userAddress, spender],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
if (allowance == null) {
|
|
18
|
-
throw new Error("Failed to fetch token data or allowance");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return allowance;
|
|
22
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|