You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-16Lines changed: 13 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,21 +26,21 @@ There are three methods of interest:
26
26
27
27
Example code:
28
28
```js
29
-
var abi =require('ethereumjs-abi')
29
+
var abi =require('@bifproject/ethereumjs-abi')
30
30
31
31
// returns the encoded binary (as a Buffer) data to be sent
32
-
var encoded =abi.rawEncode([ "address" ], [ "0x0000000000000000000000000000000000000000" ])
32
+
var encoded =abi.rawEncode([ "address" ], [ 'bid:efcx2eHszCy1zDtNiWdBBnsjG316EU5p' ])
33
33
34
34
// returns the decoded array of arguments
35
-
var decoded =abi.rawDecode([ "address" ], data)
35
+
var decoded =abi.stringify([ 'address' ], abi.rawDecode([ "address" ], data))
36
36
```
37
37
38
38
#### Encoding and decoding aided by the JSON ABI definition
39
39
40
40
Planned for the future is supporting the JSON ABI definition:
41
41
42
42
```js
43
-
var abi =require('ethereumjs-abi')
43
+
var abi =require('@bifproject/ethereumjs-abi')
44
44
45
45
// need to have the ABI definition in JSON as per specification
46
46
var tokenAbi = [{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"inputs":[],"type":"constructor"}]
// returns the encoded binary (as a Buffer) data to be sent
59
-
var encoded =abi.simpleEncode("balanceOf(address):(uint256)", "0x0000000000000000000000000000000000000000")
59
+
var encoded =abi.simpleEncode("balanceOf(address):(uint256)", "bid:efcx2eHszCy1zDtNiWdBBnsjG316EU5p")
60
60
61
61
// returns the decoded array of arguments
62
62
var decoded =abi.simpleDecode("balanceOf(address):(uint256)", data)
63
63
```
64
64
65
65
#### Solidity *tightly packed* formats
66
66
67
-
This library also supports creating Solidity's tightly packed data constructs, which are used together with ```sha3```, ```sha256```and ```ripemd160```to create hashes.
67
+
This library also supports creating Solidity's tightly packed data constructs, which are used together with ```sha3```, ```sha256``` to create hashes.
0 commit comments