Code Monkey home page Code Monkey logo

Comments (5)

alexhanh avatar alexhanh commented on September 3, 2024 1

I decided to release a simple JSON RPC client gem https://github.com/alexhanh/jeth. Perhaps ethereum-ruby could use that.

from ethereum-ruby.

lgs avatar lgs commented on September 3, 2024

oh my gosh ...

lsoave@basenode:~/github/ethereum-ruby$ bundle exec rspec
Ethereum
  HttpClient
    should work
  IpcClient
    should work (FAILED - 1)
    should support batching (FAILED - 2)
Ethereum
  Ethereum Version
    has a version number (FAILED - 3)
  Deployment
    should deploy a contract with parameters (FAILED - 4)
  Basic contract testing
    should perform a contract transaction, wait for its completion, return an Ethereum::Transaction object (FAILED - 5)
    should test a call_(Ethereum Contract Function) (FAILED - 6)
Failures:
  1) Ethereum IpcClient should work
     Failure/Error: socket = UNIXSocket.new(@ipcpath)
     
     Errno::ENOENT:
       No such file or directory - connect(2) for /home/lsoave/EtherDev/data/geth.ipc
     # ./lib/ethereum/ipc_client.rb:12:in `initialize'
     # ./lib/ethereum/ipc_client.rb:12:in `new'
     # ./lib/ethereum/ipc_client.rb:12:in `send_single'
     # ./lib/ethereum/client.rb:57:in `block (2 levels) in '
     # ./spec/client_spec.rb:17:in `block (3 levels) in '
  2) Ethereum IpcClient should support batching
     Failure/Error: socket = UNIXSocket.new(@ipcpath)
     
     Errno::ENOENT:
       No such file or directory - connect(2) for /home/lsoave/EtherDev/data/geth.ipc
     # ./lib/ethereum/ipc_client.rb:12:in `initialize'
     # ./lib/ethereum/ipc_client.rb:12:in `new'
     # ./lib/ethereum/ipc_client.rb:12:in `send_single'
     # ./lib/ethereum/ipc_client.rb:27:in `send_batch'
     # ./lib/ethereum/client.rb:24:in `batch'
     # ./spec/client_spec.rb:21:in `block (3 levels) in '
  3) Ethereum Ethereum Version has a version number
     Failure/Error: expect(Ethereum::VERSION).to eq("0.4.90")
     
       expected: "0.4.90"
            got: "1.5.2"
     
       (compared using ==)
     # ./spec/ethereum_spec.rb:12:in `block (3 levels) in '
  4) Ethereum Deployment should deploy a contract with parameters
     Failure/Error: sol_output = @client.compile_solidity(@file)
     
     NoMethodError:
       undefined method `compile_solidity' for #
     # ./lib/ethereum/initializer.rb:9:in `initialize'
     # ./spec/ethereum_spec.rb:18:in `new'
     # ./spec/ethereum_spec.rb:18:in `block (3 levels) in '
  5) Ethereum Basic contract testing should perform a contract transaction, wait for its completion, return an Ethereum::Transaction object
     Failure/Error: sol_output = @client.compile_solidity(@file)
     
     NoMethodError:
       undefined method `compile_solidity' for #
     # ./lib/ethereum/initializer.rb:9:in `initialize'
     # ./spec/ethereum_spec.rb:33:in `new'
     # ./spec/ethereum_spec.rb:33:in `block (3 levels) in '
  6) Ethereum Basic contract testing should test a call_(Ethereum Contract Function)
     Failure/Error: sol_output = @client.compile_solidity(@file)
     
     NoMethodError:
       undefined method `compile_solidity' for #
     # ./lib/ethereum/initializer.rb:9:in `initialize'
     # ./spec/ethereum_spec.rb:33:in `new'
     # ./spec/ethereum_spec.rb:33:in `block (3 levels) in '
Finished in 0.01874 seconds (files took 0.38199 seconds to load)
7 examples, 6 failures
Failed examples:
rspec ./spec/client_spec.rb:16 # Ethereum IpcClient should work
rspec ./spec/client_spec.rb:20 # Ethereum IpcClient should support batching
rspec ./spec/ethereum_spec.rb:11 # Ethereum Ethereum Version has a version number
rspec ./spec/ethereum_spec.rb:17 # Ethereum Deployment should deploy a contract with parameters
rspec ./spec/ethereum_spec.rb:39 # Ethereum Basic contract testing should perform a contract transaction, wait for its completion, return an Ethereum::Transaction object
rspec ./spec/ethereum_spec.rb:44 # Ethereum Basic contract testing should test a call_(Ethereum Contract Function)

from ethereum-ruby.

alexhanh avatar alexhanh commented on September 3, 2024

@lgs what version of geth are you running? I got it working with my fork https://github.com/alexhanh/ethereum-ruby
$ geth version Geth Version: 1.4.9-stable-b7e3dfc5
geth --datadir ~/EtherDev/data --minerthreads 1 --nodiscover --maxpeers 0 console
IPC endpoint opened: /Users/alexhanh/EtherDev/data/geth.ipc

Then

client = Ethereum::IpcClient.new("/Users/alexhanh/EtherDev/data/geth.ipc")
puts client.eth_gas_price
{"jsonrpc"=>"2.0", "id"=>1, "result"=>"0x4a817c800"}

from ethereum-ruby.

lgs avatar lgs commented on September 3, 2024

@alexhanh that's good idea but just use #new instead of #create:

$ rails c
Running via Spring preloader in process 5827
Loading development environment (Rails 5.0.0)
irb(main):001:0> client = Jeth::IpcClient.create
NoMethodError: undefined method `create' for Jeth::IpcClient:Class
    from (irb):1
...
irb(main):002:0> client = Jeth::HttpClient.create('http://localhost:8545')
NoMethodError: undefined method `create' for Jeth::HttpClient:Class
    from (irb):4
irb(main):057:0>  client = Jeth::HttpClient.new('http://localhost:8545')
=> # < Jeth::HttpClient:0x005621b980e6f8 @id=0,  @batch=nil, @host="localhost", 
     @port=8545, @ssl=false, @uri=# >
irb(main):058:0> client.eth_gas_price
=> {"jsonrpc"=>"2.0", "id"=>1, "result"=>"0x4a817c800"}
irb(main):059:0> client = Jeth::IpcClient.create
NoMethodError: undefined method `create' for Jeth::IpcClient:Class
    from (irb):59
irb(main):060:0> client = Jeth::IpcClient.new
=> #
irb(main):061:0> client.eth_gas_price
=> {"jsonrpc"=>"2.0", "id"=>1, "result"=>"0x4a817c800"}

the only one working like the README is client = Jeth.create

irb(main):062:0> client = Jeth.create
=> #
irb(main):063:0> client.eth_gas_price
=> {"jsonrpc"=>"2.0", "id"=>1, "result"=>"0x4a817c800"}

from ethereum-ruby.

alexhanh avatar alexhanh commented on September 3, 2024

@tymat This pull request fixes the issues #8, feel free to close the issue.

from ethereum-ruby.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.