Skip to content

Instantly share code, notes, and snippets.

@jamesmorgan
Last active September 29, 2019 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamesmorgan/50da45da47537d7f7486427fd512e8fa to your computer and use it in GitHub Desktop.
Save jamesmorgan/50da45da47537d7f7486427fd512e8fa to your computer and use it in GitHub Desktop.
transaction-handling.js
contract
.purchase(edition.edition, {
from: account,
value: priceInWei
})
.on('transactionHash', hash => {
console.log('Purchase transaction submitted', hash);
})
.on('receipt', receipt => {
console.log('Purchase successful - Ive been mined', receipt);
})
.on('error', error => {
console.log('Purchase error', error);
})
.on('confirmation', (confNumber, receipt) => {
console.log(`Confirmation [${confNumber}]`, receipt);
})
.catch((error) => {
console.log('Purchase error', error);
})
.finally(() => {
...do something when its all finished
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment