我正在使用useDApp构建一个NFT市场。为了与智能契约交互,我通过声明来异步调用function1
const { send, state } = useContractFunction(contract1, 'function1');.问题是,在不重新声明send的情况下,如何从function2调用contract2?
发布于 2022-09-23 02:03:28
问题解决了,似乎useContractFunction中的send只能在每个类中使用一次。一个解决方案是将该函数替换为
const { library } = useEthers();
const contract1 = new Contract(address1, abi1, library.getSigner());
const contract2 = new Contract(address2, abi2, library.getSigner());
async function execute() {
await contract1.function1(params);
await contract2.function2(params);
}https://stackoverflow.com/questions/73810310
复制相似问题