Skip to content

A promisified web3.eth.sendTransaction that waits for confirmation.

License

Notifications You must be signed in to change notification settings

raineorshine/wait-transaction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wait-transaction

A promisified web3.eth.sendTransaction that waits for confirmation.

Install

$ npm install --save wait-transaction

Usage

// pass a valid web3 instance that the providers set
const waitTransaction = require('wait-transaction')(web3)

waitTransaction({ from: web3.eth.accounts[0], to: emptyAccount.address, value: 1000 })
  .then(() => web3.eth.getBalance(emptyAccount.address).valueOf())
  .then(balance => assert.equal(1000, balance))

Options:

require('wait-transaction')(web, {
  maxAttempts: 240 // number of attempts to check that the transaction was mined before giving up
  timeInterval: 1000 // number of milliseconds between attempts
})

License

MIT

About

A promisified web3.eth.sendTransaction that waits for confirmation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published