web3-eth 0.2.38 → 0.2.43
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/lib/web3/eth.rb +1 -0
- data/lib/web3/eth/abi/abi_coder.rb +13 -1
- data/lib/web3/eth/contract.rb +1 -1
- data/lib/web3/eth/parity_module.rb +26 -0
- data/lib/web3/eth/rpc.rb +10 -5
- data/lib/web3/eth/trace_module.rb +6 -0
- data/lib/web3/eth/version.rb +1 -1
- 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: 1fbfec63edeacffa6dd8bc88cff464503436bc2976454b43cc7589b73855cb4c
         | 
| 4 | 
            +
              data.tar.gz: 9d2c121745c860f955e42a5413eb63ae1677d42c1df998d1dd1b96d81c207d68
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8e0f5d16691861ecaae6cac991cc9564a68e22ef41058234913bfc3dbda62dae3888fc103cce6b09b33ba52f42e21c654f0597b3ec72f37c2d7a260d19920e0a
         | 
| 7 | 
            +
              data.tar.gz: 7f0ab0a306c04bd132685ed77c3fcb0d359f483bd07c3f3a06f2ace02fe9326d78d4dc5f6596f35b75e1f3f78d944adb419d49360e76ddb6c9bf3aac54b18b26
         | 
    
        data/lib/web3/eth.rb
    CHANGED
    
    
| @@ -231,7 +231,7 @@ module Web3::Eth::Abi | |
| 231 231 |  | 
| 232 232 | 
             
                      pos += 32
         | 
| 233 233 | 
             
                    else
         | 
| 234 | 
            -
                      outputs[i] = data | 
| 234 | 
            +
                      outputs[i] = zero_padding data, pos, t.size, start_positions
         | 
| 235 235 | 
             
                      pos += t.size
         | 
| 236 236 | 
             
                    end
         | 
| 237 237 | 
             
                  end
         | 
| @@ -266,6 +266,18 @@ module Web3::Eth::Abi | |
| 266 266 | 
             
                end
         | 
| 267 267 | 
             
                alias :decode :decode_abi
         | 
| 268 268 |  | 
| 269 | 
            +
                def zero_padding data, pos, count, start_positions
         | 
| 270 | 
            +
                  if pos >= data.size
         | 
| 271 | 
            +
                    start_positions[start_positions.size-1] += count
         | 
| 272 | 
            +
                    "\x00"*count
         | 
| 273 | 
            +
                  elsif pos + count > data.size
         | 
| 274 | 
            +
                    start_positions[start_positions.size-1] += ( count - (data.size-pos))
         | 
| 275 | 
            +
                    data[pos,data.size-pos] + "\x00"*( count - (data.size-pos))
         | 
| 276 | 
            +
                  else
         | 
| 277 | 
            +
                    data[pos, count]
         | 
| 278 | 
            +
                  end
         | 
| 279 | 
            +
                end
         | 
| 280 | 
            +
             | 
| 269 281 | 
             
                def decode_typed_data type_name, data
         | 
| 270 282 | 
             
                  decode_primitive_type Type.parse(type_name), data
         | 
| 271 283 | 
             
                end
         | 
    
        data/lib/web3/eth/contract.rb
    CHANGED
    
    | @@ -92,7 +92,7 @@ module Web3 | |
| 92 92 | 
             
                    def do_call web3_rpc, contract_address, args
         | 
| 93 93 | 
             
                      data = '0x' + signature_hash + encode_hex(encode_abi(input_types, args) )
         | 
| 94 94 |  | 
| 95 | 
            -
                      response = web3_rpc. | 
| 95 | 
            +
                      response = web3_rpc.eth.call [{ to: contract_address, data: data}, 'latest']
         | 
| 96 96 |  | 
| 97 97 | 
             
                      string_data = [remove_0x_head(response)].pack('H*')
         | 
| 98 98 | 
             
                      return nil if string_data.empty?
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            module Web3
         | 
| 2 | 
            +
              module Eth
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                class ParityModule
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  include Web3::Eth::Utility
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  PREFIX = 'parity_'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def initialize web3_rpc
         | 
| 11 | 
            +
                    @web3_rpc = web3_rpc
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def method_missing m, *args
         | 
| 15 | 
            +
                    @web3_rpc.request "#{PREFIX}#{m}", args[0]
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def getBlockReceiptsByBlockNumber block
         | 
| 19 | 
            +
                    @web3_rpc.request("#{PREFIX}getBlockReceipts", [hex(block)]).collect{|tr|
         | 
| 20 | 
            +
                      TransactionReceipt.new tr
         | 
| 21 | 
            +
                    }
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
    
        data/lib/web3/eth/rpc.rb
    CHANGED
    
    | @@ -17,7 +17,7 @@ module Web3 | |
| 17 17 | 
             
                  DEFAULT_HOST = 'localhost'
         | 
| 18 18 | 
             
                  DEFAULT_PORT = 8545
         | 
| 19 19 |  | 
| 20 | 
            -
                  attr_reader :eth, : | 
| 20 | 
            +
                  attr_reader :eth, :connect_options
         | 
| 21 21 |  | 
| 22 22 | 
             
                  def initialize host: DEFAULT_HOST, port: DEFAULT_PORT, connect_options: DEFAULT_CONNECT_OPTIONS
         | 
| 23 23 |  | 
| @@ -27,15 +27,20 @@ module Web3 | |
| 27 27 | 
             
                    @connect_options = connect_options
         | 
| 28 28 |  | 
| 29 29 | 
             
                    @eth = EthModule.new self
         | 
| 30 | 
            -
                    @trace = TraceModule.new self
         | 
| 31 30 |  | 
| 32 31 | 
             
                  end
         | 
| 33 32 |  | 
| 33 | 
            +
                  def trace
         | 
| 34 | 
            +
                    @trace ||= TraceModule.new(self)
         | 
| 35 | 
            +
                  end
         | 
| 34 36 |  | 
| 35 | 
            -
                  def  | 
| 36 | 
            -
                     | 
| 37 | 
            +
                  def parity
         | 
| 38 | 
            +
                    @parity ||= ParityModule.new(self)
         | 
| 37 39 | 
             
                  end
         | 
| 38 40 |  | 
| 41 | 
            +
                  def debug
         | 
| 42 | 
            +
                    @debug ||= Debug::DebugModule.new(self)
         | 
| 43 | 
            +
                  end
         | 
| 39 44 |  | 
| 40 45 | 
             
                  def request method, params = nil
         | 
| 41 46 |  | 
| @@ -48,7 +53,7 @@ module Web3 | |
| 48 53 |  | 
| 49 54 | 
             
                      raise "Error code #{response.code} on request #{@uri.to_s} #{request.body}" unless response.kind_of? Net::HTTPOK
         | 
| 50 55 |  | 
| 51 | 
            -
                      body = JSON.parse(response.body)
         | 
| 56 | 
            +
                      body = JSON.parse(response.body, max_nesting: 1500)
         | 
| 52 57 |  | 
| 53 58 | 
             
                      if body['result']
         | 
| 54 59 | 
             
                        body['result']
         | 
    
        data/lib/web3/eth/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: web3-eth
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.43
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - studnev
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-07-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rlp
         | 
| @@ -110,6 +110,7 @@ files: | |
| 110 110 | 
             
            - lib/web3/eth/eth_module.rb
         | 
| 111 111 | 
             
            - lib/web3/eth/etherscan.rb
         | 
| 112 112 | 
             
            - lib/web3/eth/log.rb
         | 
| 113 | 
            +
            - lib/web3/eth/parity_module.rb
         | 
| 113 114 | 
             
            - lib/web3/eth/rpc.rb
         | 
| 114 115 | 
             
            - lib/web3/eth/trace_module.rb
         | 
| 115 116 | 
             
            - lib/web3/eth/transaction.rb
         |