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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b74aa93e42dc1018e37a97771b504ce6f9afd8e54cd71d2356878e7a0b96d6f
4
- data.tar.gz: 27c316fccb2c0e8a794e743ccd4c5f9f9bddac9510ad5d0e5060f351333e54ab
3
+ metadata.gz: f85cf1ee58c2ddc1ebfcd7694fa848c25a875ac214ada4b04e071076cd86e2bc
4
+ data.tar.gz: d668bf2afb6be4ecb1f906f067589373c1ed5dae8186744a6bb3b0b0f62e14e2
5
5
  SHA512:
6
- metadata.gz: 25d498145373bbcc9e769208eebbd37cfbbdfa3abdcb2f4ef1fb0d6abe3fe4ac3831ac05adb578b70a1c27bc4fdd682647b7a6e9be6af44e904bbddabaa28b7d
7
- data.tar.gz: 96195888ad12015a29f3cf5da1d15ec7ffd2ccf8c9241eabd74308121c2a3dac14bab565c52c1ae2f5622704dcf462d6db044a1129b286ae6b88989b3715d65a
6
+ metadata.gz: b5998791c03e071e9dd73820fcdf470787d74e5a4d3cf4c3ca319bfa3efd4f02523a998c00f6e7ad8307f233d4a367931f3708c9666910568d4b9be07782be4c
7
+ data.tar.gz: 413a6b53730f91e305b40c0596abad70c731318bb26d6773b0e33214dcc7ef24431d95cea819402e24b553bd91e1449db3ad54739252241952d293e327d39bd6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- platon (0.2.8)
4
+ platon (0.2.9)
5
5
  activesupport (>= 4.0)
6
6
  digest-sha3 (~> 1.1)
7
7
  ffi (~> 1.0)
@@ -57,6 +57,7 @@ GEM
57
57
 
58
58
  PLATFORMS
59
59
  x86_64-darwin-18
60
+ x86_64-darwin-20
60
61
 
61
62
  DEPENDENCIES
62
63
  bundler (~> 2.0)
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, :log, :logger, :default_account, :gas_price, :gas_limit, :ppos, :hrp,:chain_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,log = false)
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
- if @log == true
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, log = false)
33
- return IpcClient.new(host_or_ipcpath, log) if host_or_ipcpath.end_with? '.ipc'
34
- return HttpClient.new(host_or_ipcpath, log) if host_or_ipcpath.start_with? 'http'
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
 
@@ -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,
@@ -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, log = false)
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
@@ -8,8 +8,8 @@ module Platon
8
8
  "#{ENV['HOME']}/alaya-node/data/platon.ipc"
9
9
  ]
10
10
 
11
- def initialize(ipcpath = nil, log = true)
12
- super(nil,log)
11
+ def initialize(ipcpath = nil)
12
+ super(nil)
13
13
  ipcpath ||= IpcClient.default_path
14
14
  @ipcpath = ipcpath
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Platon
4
- VERSION = "0.2.9"
4
+ VERSION = "1.0.0"
5
5
  end
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.2.9
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-07-01 00:00:00.000000000 Z
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
@@ -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
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,10 +0,0 @@
1
- Style/StringLiterals:
2
- Enabled: true
3
- EnforcedStyle: double_quotes
4
-
5
- Style/StringLiteralsInInterpolation:
6
- Enabled: true
7
- EnforcedStyle: double_quotes
8
-
9
- Layout/LineLength:
10
- Max: 120