TOKEN.once() Return Value Question #3051
Webster1234
started this conversation in
General
Replies: 1 comment
-
function getRecentEvent(contract) {
return new Promise((res) => {
const filter = TOKEN.filters.Transfer(from, to, null)
contract.once(filter, (from, to, amount, event) => {
resolve([from,to,amount])
})
})
}
async function main() {
const contract = ...
const rrr = await getRecentEvent(contract); // will wait until once event is occurred
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I know how to use callback to pass the value inside TOKEN.once() to the f function, but is there a way to return the value inside TOKEN.once() to the main() function, this has been bothering me all day :(
Beta Was this translation helpful? Give feedback.
All reactions