You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current API is designed to only care for sending a transaction and waiting it to be mined. E.g.,
constdata=awaitcontract.postNote(...)
When this promise resolves, it means the transaction has been sent and mined.
This makes the following situation hard to handle:
The app only needs to know that a transaction has been sent. For example, the app wants to distinguish the two steps so as to show the loading prompt as "Sending" and "Mining".
The app wants to do multicall which involves in multiple contract function getting encoded, sent, and mined.
Proposal
Chain methods are adopted to the new API. The new methods are:
.send()
.data()
anything else?
The new API will go like this:
constfn=awaitcontract.postNote(...)// only encodes the contract functionconsttx=awaitfn.send()// sends transactionconstdata=awaittx.data()// waits the transaction to be mined and returns data// or in chainconstdata=awaitcontract.postNote().send().data()
consttxPromise=awaitcontract.note.post(...)constdata=awaittxPromise.data()// waits the transaction to be mined and returns data// or in chainconstdata=awaitcontract.postNote().data()
Background
The current API is designed to only care for sending a transaction and waiting it to be mined. E.g.,
When this promise resolves, it means the transaction has been sent and mined.
This makes the following situation hard to handle:
multicall
which involves in multiple contract function getting encoded, sent, and mined.Proposal
Chain methods are adopted to the new API. The new methods are:
.send()
.data()
The new API will go like this:
If the app wants to do
multicall
:Let me know what you think?
The text was updated successfully, but these errors were encountered: