我尝试将值从 0.025 以太更改为 1 以太,然后也显示相同的错误。
另外,我尝试过像 1/8 这样的有理数仍然不起作用。
查看了一些答案,但他们没有解决错误。
我在其他项目中有相同的代码并且它在那里工作。
我收到的错误
Uncaught (in promise) Error: invalid BigNumber value (argument="value", value={"value":"25000000000000000"}, code=INVALID_ARGUMENT, version=bignumber/5.5.0)
Could not get the stack frames of error: TypeError: Cannot read properties of null (reading 'length')
Run Code Online (Sandbox Code Playgroud)
这是我的上市价格代码
uint256 listingPrice = 0.025 ether ; // Here ether is denoting the MATIC
function getListingPrice() public view returns (uint256) {
return listingPrice;
}
Run Code Online (Sandbox Code Playgroud)
这是在 UI 中获取值的代码
async function putItem(url) {
const web3Modal = new Web3Modal();
const connection = await web3Modal.connect(); …Run Code Online (Sandbox Code Playgroud)