Value' does not exist in type 'Overrides & { from?: `0x${string}`
Value' does not exist in type 'Overrides & { from?: `0x${string}`
Loading saved threads...
Mubashir Waheed · External communityPost link
External question — Ethereum Stack Exchange
Author: Mubashir Waheed
Original post: https://ethereum.stackexchange.com/questions/140290
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I have next app with typescript template and using wagmi (
https://www.npmjs.com/package/wagmi
) package I am trying to send ether to the contract function
Code
const { config } = usePrepareContractWrite({
address: "0x53f2d86edcb67c9ea04eada4c2333aebeab717ef",
abi: [
{
name: "mint",
type: "function",
stateMutability: "payable",
inputs: [{ name: "quantity", type: "uint256" }],
outputs: [],
},
],
functionName: "mint",
args: [ethers.BigNumber.from(props.q)],
overrides: {
from: "0xfc2df69DF76Fe18866bFc5396f35255e7EFa274a",
value: ethers.utils.parseEther("0.001"),
},
});
I am getting below error
Type '{ from: "0xfc2df69DF76Fe18866bFc5396f35255e7EFa274a"; value: ethers.BigNumber; }' is not assignable to type 'Overrides & { from?: `0x${string}` | undefined; }'.
Object literal may only specify known properties, and 'value' does not exist in type 'Overrides & { from?: `0x${string}` | undefined; }'
According to docs (
https://wagmi.sh/react/prepare-hooks/usePrepareContractWrite#overrides-optional
), I should be able to send ether to the function but I am getting type error
Quote
Report
sarem eskandary · External communityPost link
External answer — Ethereum Stack Exchange
Author: sarem eskandary
Original post: https://ethereum.stackexchange.com/a/152769
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
for type '
0x${string}
you can use
type Address
you can import it like this:
import { Address } from "wagmi";
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Ethereum Stack Exchange Author: Mubashir Waheed Source score (net votes, not local likes): 4 Original post: https://ethereum.stackexchange.com/questions/140290 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have next app with typescript template and using wagmi ( https://www.npmjs.com/package/wagmi ) package I am trying to send ether to the contract function Code const { config } = usePrepareContractWrite({ address: "0x53f2d86edcb67c9ea04eada4c2333aebeab717ef", abi: [ { name: "mint", type: "function", stateMutability: "payable", inputs: [{ name: "quantity", type: "uint256" }], outputs: [], }, ], functionName: "mint", args: [ethers.BigNumber.from(props.q)], overrides: { from: "0xfc2df69DF76Fe18866bFc5396f35255e7EFa274a", value: ethers.utils.parseEther("0.001"), }, }); I am getting below error Type '{ from: "0xfc2df69DF76Fe18866bFc5396f35255e7EFa274a"; value: ethers.BigNumber; }' is not assignable to type 'Overrides & { from?: `0x${string}` | undefined; }'. Object literal may only specify known properties, and 'value' does not exist in type 'Overrides & { from?: `0x${string}` | undefined; }' According to docs ( https://wagmi.sh/react/prepare-hooks/usePrepareContractWrite#overrides-optional ), I should be able to send ether to the function but I am getting type error
Checking account access…