Skip to content

Instantly share code, notes, and snippets.

@KenoLeon
Created April 9, 2022 00:10
Show Gist options
  • Select an option

  • Save KenoLeon/64a583728f0d0df91159e4bca7bb90ed to your computer and use it in GitHub Desktop.

Select an option

Save KenoLeon/64a583728f0d0df91159e4bca7bb90ed to your computer and use it in GitHub Desktop.
prototypical async function with await operator
function EVM_OPERATION() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Done with Operation');
// uncomment this and comment the resolve to test the catch block
// reject('Something went wrong');
}, 600);
});
}
async function callEVM() {
console.log('Sending transaction to EVM');
try {
const result = await EVM_OPERATION();
console.log(result);
}
catch (err) {
console.log(err);
}
}
callEVM();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment