TODO: update web3.js examples ?
-
uses BN instead of BigNumber
-
added websockets and new events for these providers (web3.currentProvider.on 'connect', 'end', 'error', 'timeout')
-
changed
web3.eth.sendRawTransaction
->web3.eth.sendSignedTransaction
-
added
web3.eth.subscription
web3.eth.subscription('logs', {address: '0x12', topics: [], fromBlock: ''})
allows onlyfromBlock
, useweb3.eth.getPastLogs
for a specifc range of past blocks.- subscriptions return events like:
- for "logs": "error", "log", "deleted/reverted"
- for syncing: "error", "started", "processing", "ended"
- for transaction: "error", "transaction"
-
added
web3.eth.getPastLogs
-
made
myContract.myEvent
subscription based- event return values are now called
returnValues
(beforeargs
) - added a
myContract.myEvent.getPastEvents(options)
function - moved indexed parameters into the options object, of events and getPastEvents
{filter: {myValue1: 23, myValue2: [3,5], ...}, fromBlock:.., toBlock:...}
- event return values are now called
-
contracts changed:
- added: ethereum/EIPs#68
- all addresses returned are checksum addresses
- events moved
data
andtopcis
toraw
- contract events return receipts with "rawLogs" and "events" property
-
add
toChecksumAddress
andisChecksumAddress
// packages:
-
add
pkg.providers
andpkg.setProvider
andpkg.currentProvider
to all (sub) packages -
web3.providers are now separate pacakges
-
Providers don't have
provider.isConnected()
anymore.
web3._extend
- changed to
web3.extend
and addpkg.extend
- now structure can just be:
web3.extend({
property: 'admin',
methods: [{
name: 'myMethod',
call: 'eth_myCall',
params: 3,
inputFormatter: [null, web3.extend.formatters.inputTransactionFormatter, web3.extend.utils.fromDecimal]
outputFormatter
},{...}]
});
web3.personal:
- moved to web3.eth
- personal.listAccounts -> personal.getAccounts()
web3.net
-
moved to web3.eth
-
net.listening
->eth.net.isListening
-
net.peerCount
->eth.net.getPeerCount
-
net.version
->eth.net.getId
web3.eth -
web3.eth.contract -> web3.eth.Contract
-
web3.createBatch -> new web3.BatchRequest()
-
sendRawTransaction -> sendSignedTransaction
-
isSyncing -> subscribe('syncing')
-
eth.syncing -> isSyncing()
-
removed eth.sendIBANTransaction
-
removed eth.namereg
-
removed eth.icapNamereg
-
removed eth.iban (move to ?)
-
all
eth.<properties>
toeth.get<Property>()
-
property mining to
eth.isMining()
-
- web3.eth.iban -> web3.eth.Iban
eth.iban.toAddress(iban)
eth.iban.toIban(address)
- change iban.fromAddress -> Iban.toIbanInstance
- change iban.address -> Iban.ethereumAddress
utils
- utils -> web3.utils
- toBigNumber -> toBN
- fromDecimal -> numberToHex
- toDecimal -> hexToNumberString returns now string
- add hexToNumber
- add hexToBytes
- add bytesToHex
- add isBN
- isChecksumAddress -> checkAddressChecksum
- sha3 autodetecs HEX strings now, no
{hex: true}
anymore - added soliditySha3