过程2单交易的以太坊交易
我正在使用第三方SDK方法并成功完成交易。我试图在单个ETH交易中两次执行相同的功能。 SDK方法是不可能的。我试图通过使用此功能来部署自己的智能合约,但不幸的是,它没有function/smart Contract的ABI。我已经检查了Web3,Ethers.js是否有任何解决方案,但找不到一个解决方案。
const firstTx = await api.method(); // returns transactionHash
const secondTx = await api.method(); // returns transactionHash
它们单独工作,但是我需要通过一次交易来处理它们。第二个事务取决于第一个事务,因此必须等待第一个功能。另外,如果任何功能失败,则两项交易都应失败。
const singleTx = async() => {firstTX(); secondTx()} or {firstTx().then(()=>secondTx())} //returns single transactionHash
我需要以类似的方式实施它。我遇到了超过2天的问题。 任何建议都非常感谢!
I'm using third party SDK method and completing the transaction successfully. I'm trying to do the same function twice within a single ETH transaction. It's impossible with SDK method. I tried to deploy my own smart contract by using this function, but unfortunately, it doesn't have function's/smart contract's ABI. I have checked web3, ethers.js for any solution but could not find one.
const firstTx = await api.method(); // returns transactionHash
const secondTx = await api.method(); // returns transactionHash
Separately they work perfectly, but I need to process them with a single transaction. The second transaction depends on the first one, so it has to wait for the first function. Also, if any of the functions fail, both transactions should fail.
const singleTx = async() => {firstTX(); secondTx()} or {firstTx().then(()=>secondTx())} //returns single transactionHash
I need to implement it in a similar way. I'm stuck with that issue for more than 2 days.
Any recommendation is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 web3js .SEND 函数返回承诺事件。该事件返回一些参数,在这里您正在寻找
确认
。您可以按照以下方式进行操作:
In web3js, there's a
.send
function that returns a promise event. The event returns a few parameters, here you're looking forconfirmation
.You could do something along the lines of: