Skip to content

Instantly share code, notes, and snippets.

@KenoLeon
Last active April 12, 2022 01:31
Show Gist options
  • Select an option

  • Save KenoLeon/632eac7c8a7bf10482856bf48923801b to your computer and use it in GitHub Desktop.

Select an option

Save KenoLeon/632eac7c8a7bf10482856bf48923801b to your computer and use it in GitHub Desktop.
Multi Primise Chain 02
function callContract(contractAddress) {
return new Promise((resolve) => {
console.log(`Calling Contract with Address ${contractAddress}`)
setTimeout(() => {
resolve({
contractAddress: contractAddress,
balance: '10 ETH'
});
}, 1000);
})
}
function sendETH(contractResponse) {
return new Promise((resolve) => {
console.log(`Sending ${contractResponse.balance} to Keno's Contract`)
setTimeout(() => {
resolve({
txHash: '0x0....000008'
});
}, 1000);
})
}
callContract('0x0')
.then(sendETH)
.then(result => {
console.log(result);
});
// SHOULD GIVE YOU:
// Calling Contract with Address 0x0
// Sending 10 ETH to Keno's Contract
// { txHash: '0x0....000008' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment