web3-hpb 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e372dcdc3e93d69a4319d7ce15da4ba63855639a4eeb110c12c40c3d62ea5d8e
4
- data.tar.gz: eb572757b4463669b635db3cd53882dd833846681636b8ce799d090ed78bad35
3
+ metadata.gz: d0b506357083c13c835b6b5ca001bbeda3f5e66fd13fa8c34bff441cf377e71c
4
+ data.tar.gz: 1aea792b7956f15efd3c777367b2e4f11750b4d9ec9b4e9485a8cdbf319dfc4b
5
5
  SHA512:
6
- metadata.gz: 37f5be5db727b1fac8c886b02fc9c9d4ccf900a83f2e9cbee061010b68d4159aa01b1a43fecf0053e79822714001c102c589224882e590f2a3e5b11f0c843d4a
7
- data.tar.gz: 64c4bde04933db85b8a13ce880f275f32e3d21a88ab776c96057ee6ff0221e4c5a6c34b07b0ebbdd13ed76e5e6acab22d35996651f765a3815905b0ff36bb0a3
6
+ metadata.gz: 8187b3dc63cd3f1ee7f2bd904b9020a38fa9109ad0ff145cf5565b48c1ef5eb72f4b8bdf28354e3aab6252e3d7684cf3e34a5b5bc502482ecf4188d587e46a05
7
+ data.tar.gz: 2c8b56766bac220fd55565fdc92ebd6d9dacec27af5d84ae9069f60f83f811866b1faf6f2ff7ccac1ea6dd5139082270b1e17aaae1ca5ee8ed54131a70380ce9
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
3
  # Specify your gem's dependencies in web3-hpb.gemspec
6
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- web3-hpb (0.0.1)
4
+ web3-hpb (0.0.2)
5
5
  digest-sha3 (~> 1.1.0)
6
6
  rlp (~> 0.7.3)
7
7
 
data/README.md CHANGED
@@ -22,7 +22,55 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
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
 
@@ -1,5 +1,5 @@
1
1
  module Web3
2
- module Eth
2
+ module Hpb
3
3
 
4
4
  class Transaction
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Web3
2
2
  module Hpb
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.0
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-29 00:00:00.000000000 Z
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: