在ethers.js文档中,它是用来检索数据的,如下所示
// 'contract' is an instance of Contract made with ethers.js
// Get the current value
let currentValue = await contract.getValue();
console.log(currentValue);
// "Hello World"但是我的合同从智能契约函数中返回两个值。下面是该函数的接口
function targetNFT() external view returns(address _nftToken, uint256 _nftTokenId);如何使用ethers.js检索从智能契约返回的多个值?
发布于 2022-05-08 17:38:19
const result = await contractInstance.yourFunction();
const {0: variable_1, 1: variable_2} = result;参考资料:https://blockheroes.dev/js-read-multiple-returned-values-solidity/
希望能帮上忙。
https://ethereum.stackexchange.com/questions/100225
复制相似问题