Created
April 12, 2022 01:01
-
-
Save KenoLeon/25a57177f0624f1997fb35cfd501459a to your computer and use it in GitHub Desktop.
promise chain 01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function callContract(contractAddress) { | |
| return new Promise((resolve) => { | |
| console.log(`Calling Contract with Address ${contractAddress}`) | |
| setTimeout(() => { | |
| resolve({ | |
| contractAddress: contractAddress, | |
| balance: '10 ETH' | |
| }); | |
| }, 1000); | |
| }) | |
| } | |
| callContract('0x0').then(result => { | |
| console.log(result); | |
| }); | |
| // SHOULD GIVE YOU: | |
| // Calling Contract with Address 0x0 | |
| // { contractAddress: '0x0', balance: '10 ETH' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment