web3-hpb 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/Gemfile.lock +1 -1
- data/README.md +49 -1
- data/lib/web3/hpb/transaction.rb +1 -1
- data/lib/web3/hpb/version.rb +1 -1
- data/web3-hpb-0.1.0.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0b506357083c13c835b6b5ca001bbeda3f5e66fd13fa8c34bff441cf377e71c
|
4
|
+
data.tar.gz: 1aea792b7956f15efd3c777367b2e4f11750b4d9ec9b4e9485a8cdbf319dfc4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8187b3dc63cd3f1ee7f2bd904b9020a38fa9109ad0ff145cf5565b48c1ef5eb72f4b8bdf28354e3aab6252e3d7684cf3e34a5b5bc502482ecf4188d587e46a05
|
7
|
+
data.tar.gz: 2c8b56766bac220fd55565fdc92ebd6d9dacec27af5d84ae9069f60f83f811866b1faf6f2ff7ccac1ea6dd5139082270b1e17aaae1ca5ee8ed54131a70380ce9
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,55 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### 连接
|
26
|
+
初始化一个web3对象
|
27
|
+
```ruby
|
28
|
+
web3 = Web3::Hpb::Rpc.new
|
29
|
+
```
|
30
|
+
默认配置为
|
31
|
+
```ruby
|
32
|
+
web3 = Web3::Hpb::Rpc.new host: 'node.host.com',
|
33
|
+
port: 8545,
|
34
|
+
connect_options: { use_ssl: true, read_timeout: 120 }
|
35
|
+
```
|
36
|
+
|
37
|
+
### 使用hpb接口
|
38
|
+
|
39
|
+
```
|
40
|
+
>> web3.hpb.blockNumber
|
41
|
+
4376369
|
42
|
+
|
43
|
+
>> web3.hpb.getBalance '0x4c8a1996754c11ac255c747fdb36a4288d230541'
|
44
|
+
3916.6597314456685
|
45
|
+
|
46
|
+
>> block = web3.hpb.getBlockByNumber 4376369
|
47
|
+
#<Web3::Hpb::Block:0x007f844d6f1138 @block_data={"author"=>"0x4c8a1996754c11ac255c797fdb36f4288d230541", ...
|
48
|
+
|
49
|
+
>> block.timestamp_time
|
50
|
+
2017-10-17 12:51:36 +0300
|
51
|
+
|
52
|
+
>> block.transactions.count
|
53
|
+
129
|
54
|
+
|
55
|
+
>> block.transactions[0].from
|
56
|
+
"0x4c8a199481ac255c747fdb36f4288d230541"
|
57
|
+
|
58
|
+
>> block.transactions[0].value_eth
|
59
|
+
0.51896811
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
### 使用abi接口
|
64
|
+
```
|
65
|
+
# creation of contract object
|
66
|
+
myContract = web3.hpb.contract(abi);
|
67
|
+
|
68
|
+
# initiate contract for an address
|
69
|
+
myContractInstance = myContract.at('0x57d180cbaffbc97237f572148fc1b283b68d8861');
|
70
|
+
|
71
|
+
# call constant function
|
72
|
+
result = myContractInstance.balanceOf('0x...'); # any constant method works
|
73
|
+
```
|
26
74
|
|
27
75
|
## Development
|
28
76
|
|
data/lib/web3/hpb/transaction.rb
CHANGED
data/lib/web3/hpb/version.rb
CHANGED
data/web3-hpb-0.1.0.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web3-hpb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alize
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rlp
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/web3/hpb/transaction_receipt.rb
|
113
113
|
- lib/web3/hpb/utility.rb
|
114
114
|
- lib/web3/hpb/version.rb
|
115
|
+
- web3-hpb-0.1.0.gem
|
115
116
|
- web3-hpb.gemspec
|
116
117
|
homepage: https://github.com/alize/web3-hpb
|
117
118
|
licenses:
|