platon 0.2.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/platon/client.rb +8 -13
- data/lib/platon/contract.rb +1 -1
- data/lib/platon/http_client.rb +1 -1
- data/lib/platon/ipc_client.rb +2 -2
- data/lib/platon/version.rb +1 -1
- metadata +2 -5
- data/.github/workflows/main.yml +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f85cf1ee58c2ddc1ebfcd7694fa848c25a875ac214ada4b04e071076cd86e2bc
|
4
|
+
data.tar.gz: d668bf2afb6be4ecb1f906f067589373c1ed5dae8186744a6bb3b0b0f62e14e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5998791c03e071e9dd73820fcdf470787d74e5a4d3cf4c3ca319bfa3efd4f02523a998c00f6e7ad8307f233d4a367931f3708c9666910568d4b9be07782be4c
|
7
|
+
data.tar.gz: 413a6b53730f91e305b40c0596abad70c731318bb26d6773b0e33214dcc7ef24431d95cea819402e24b553bd91e1449db3ad54739252241952d293e327d39bd6
|
data/Gemfile.lock
CHANGED
data/lib/platon/client.rb
CHANGED
@@ -10,18 +10,15 @@ module Platon
|
|
10
10
|
PLATON_RPC_COMMANDS = %w(platon_evidences admin_getProgramVersion admin_getSchnorrNIZKProve)
|
11
11
|
RPC_MANAGEMENT_COMMANDS = %w(admin_addPeer admin_datadir admin_nodeInfo admin_peers admin_setSolc admin_startRPC admin_startWS admin_stopRPC admin_stopWS debug_backtraceAt debug_blockProfile debug_cpuProfile debug_dumpBlock debug_gcStats debug_getBlockRlp debug_goTrace debug_memStats debug_seedHash debug_setHead debug_setBlockProfileRate debug_stacks debug_startCPUProfile debug_startGoTrace debug_stopCPUProfile debug_stopGoTrace debug_traceBlock debug_traceBlockByNumber debug_traceBlockByHash debug_traceBlockFromFile debug_traceTransaction debug_verbosity debug_vmodule debug_writeBlockProfile debug_writeMemProfile miner_hashrate miner_makeDAG miner_setExtra miner_setGasPrice miner_start miner_startAutoDAG miner_stop miner_stopAutoDAG personal_importRawKey personal_listAccounts personal_lockAccount personal_newAccount personal_unlockAccount personal_sendTransaction txpool_content txpool_inspect txpool_status)
|
12
12
|
|
13
|
-
attr_accessor :command, :id, :
|
13
|
+
attr_accessor :command, :id, :logger, :default_account, :gas_price, :gas_limit, :ppos, :hrp,:chain_id
|
14
14
|
|
15
|
-
def initialize(chain_name=nil
|
15
|
+
def initialize(chain_name=nil)
|
16
16
|
@id = 0
|
17
|
-
@log = log
|
18
17
|
@batch = nil
|
19
18
|
# @formatter = Platon::Formatter.new
|
20
19
|
@gas_price = DEFAULT_GAS_PRICE
|
21
20
|
@gas_limit = DEFAULT_GAS_LIMIT
|
22
|
-
|
23
|
-
@logger = Logger.new("/tmp/platon_ruby_http.log")
|
24
|
-
end
|
21
|
+
|
25
22
|
|
26
23
|
@ppos = Platon::Ppos.new self
|
27
24
|
|
@@ -29,9 +26,9 @@ module Platon
|
|
29
26
|
|
30
27
|
end
|
31
28
|
|
32
|
-
def self.create(host_or_ipcpath
|
33
|
-
return IpcClient.new(host_or_ipcpath
|
34
|
-
return HttpClient.new(host_or_ipcpath
|
29
|
+
def self.create(host_or_ipcpath)
|
30
|
+
return IpcClient.new(host_or_ipcpath) if host_or_ipcpath.end_with? '.ipc'
|
31
|
+
return HttpClient.new(host_or_ipcpath) if host_or_ipcpath.start_with? 'http'
|
35
32
|
raise ArgumentError.new('Unable to detect client type')
|
36
33
|
end
|
37
34
|
|
@@ -139,15 +136,13 @@ module Platon
|
|
139
136
|
|
140
137
|
payload = {jsonrpc: "2.0", method: command, params: encode_params(args), id: get_id}
|
141
138
|
puts payload
|
142
|
-
@logger.info("Sending #{payload.to_json}") if @log
|
139
|
+
# @logger.info("Sending #{payload.to_json}") if @log
|
143
140
|
if @batch
|
144
141
|
@batch << payload
|
145
142
|
return true
|
146
143
|
else
|
147
|
-
# tmp = send_single(payload.to_json)
|
148
|
-
# output = JSON.parse(tmp)
|
149
144
|
p output = JSON.parse(send_single(payload.to_json))
|
150
|
-
@logger.info("Received #{output.to_json}") if @log
|
145
|
+
# @logger.info("Received #{output.to_json}") if @log
|
151
146
|
reset_id
|
152
147
|
raise IOError, output["error"]["message"] if output["error"]
|
153
148
|
|
data/lib/platon/contract.rb
CHANGED
@@ -120,7 +120,7 @@ module Platon
|
|
120
120
|
|
121
121
|
def send_raw_transaction(payload, to = nil)
|
122
122
|
# Platon.configure { |c| c.chain_id = @client.net_version.to_i }
|
123
|
-
@nonce = @client.get_nonce(key.bech32_address)
|
123
|
+
@nonce = @client.get_nonce(key.bech32_address(hrp:@client.hrp))
|
124
124
|
args = {
|
125
125
|
from: key.address,
|
126
126
|
value: 0,
|
data/lib/platon/http_client.rb
CHANGED
@@ -4,7 +4,7 @@ module Platon
|
|
4
4
|
class HttpClient < Client
|
5
5
|
attr_accessor :host, :port, :uri, :ssl, :proxy
|
6
6
|
|
7
|
-
def initialize(host,chain_name, proxy = nil
|
7
|
+
def initialize(host,chain_name, proxy = nil)
|
8
8
|
super(chain_name,log)
|
9
9
|
uri = URI.parse(host)
|
10
10
|
raise ArgumentError unless ['http', 'https'].include? uri.scheme
|
data/lib/platon/ipc_client.rb
CHANGED
data/lib/platon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vianull
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -157,10 +157,7 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
-
- ".github/workflows/main.yml"
|
161
160
|
- ".gitignore"
|
162
|
-
- ".rspec"
|
163
|
-
- ".rubocop.yml"
|
164
161
|
- Gemfile
|
165
162
|
- Gemfile.lock
|
166
163
|
- LICENSE.txt
|
data/.github/workflows/main.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push,pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
11
|
-
uses: ruby/setup-ruby@v1
|
12
|
-
with:
|
13
|
-
ruby-version: 2.3.0
|
14
|
-
- name: Run the default task
|
15
|
-
run: |
|
16
|
-
gem install bundler -v 2.2.4
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
data/.rspec
DELETED