Skip to content

undefined method `eventName' for #<Ethereum::Contract:0x007fa63617ab40> #11

@wenweih

Description

@wenweih

hi, thx for contributors nice and hard work. I met a problem and look for help here.
I have build and deploy a smart contract, get the contract object in irb as follow

2.3.1 :067 > con = Ethereum::Contract.new("hello",contracts[0].code, contracts[0].abi)
=> #<Ethereum::Contract:0x007fa63617ab40 @name="hello", @code="0x6060604052600080546c0100000000000000000000000033810204600160a060020a031990911617905560ed806100366000396000f36060604052361560275760e060020a600035046341c0e1b581146075578063e522538114609f575b60eb6000341115607357604080513481529051605891600160a060020a033316917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35b565b3460025760eb60005433600160a060020a0390811691161415607357600054600160a060020a0316ff5b3460025760eb60005433600160a060020a039081169116141560735760008054604051600160a060020a0391821692309092163180156108fc0292909190818181858888f15050505050565b00", @abi=[{"constant"=>false, "inputs"=>[], "name"=>"kill", "outputs"=>[], "payable"=>false, "type"=>"function"}, {"constant"=>false, "inputs"=>[], "name"=>"collect", "outputs"=>[], "payable"=>false, "type"=>"function"}, {"inputs"=>[], "type"=>"constructor"}, {"payable"=>true, "type"=>"fallback"}, {"anonymous"=>false, "inputs"=>[{"indexed"=>true, "name"=>"_from", "type"=>"address"}, {"indexed"=>true, "name"=>"_band", "type"=>"uint256"}, {"indexed"=>false, "name"=>"_value", "type"=>"uint256"}], "name"=>"Deposit", "type"=>"event"}], @functions=[#<Ethereum::Function:0x007fa63617a5a0 @name="kill", @constant=false, @inputs=[], @outputs=[], @function_string="kill()", @Signature="41c0e1b5">, #<Ethereum::Function:0x007fa63680ea10 @name="collect", @constant=false, @inputs=[], @outputs=[], @function_string="collect()", @Signature="e5225381">], @events=[#<Ethereum::ContractEvent:0x007fa6364219c0 @name="Deposit", @input_types=["address", "uint256", "uint256"], @inputs=["_from", "_band", "_value"], @event_string="Deposit(address,uint256,uint256)", @Signature="90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15">], @constructor_inputs=[]>

there is event named Deposit in the contract, and i want to do as web3.js method in Ruby

var event = myContractInstance.MyEvent({valueA: 23} [, additionalFilterObject])
event.watch(function(error, result){
  if (!error)
    console.log(result);
});

But when coninstance call Deposit method, NoMethodError: undefined method `Deposit' for #<Ethereum::Contract:0x007fa63617ab40> error occur
meanwhile, when i call watch method by event object

2.3.1 :074 > instance = SmartExchange.new
 => #<SmartExchange:0x007fa63631b6e8>

the same error occur. 😦
Is there a way to call event.watch method as web3.js contract-events
many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions