mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 08:54:05 +00:00
Implement eth_call for methods returning struct type (#59)
* Handle tuple return type in ethereum host API * Update graph-cli version to fix eth_call error * Handle all types in struct based on abi Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -5,6 +5,11 @@ pragma solidity ^0.8.0;
|
||||
contract Example {
|
||||
uint256 private _test;
|
||||
|
||||
struct Bid {
|
||||
uint128 bidAmount1;
|
||||
uint128 bidAmount2;
|
||||
}
|
||||
|
||||
event Test(string param1, uint8 param2);
|
||||
|
||||
function getMethod() public view virtual returns (string memory)
|
||||
@@ -12,8 +17,21 @@ contract Example {
|
||||
return 'test';
|
||||
}
|
||||
|
||||
function addMethod(uint128 bidAmount1, uint128 bidAmount2) public pure returns (uint) {
|
||||
return bidAmount1 + bidAmount2;
|
||||
}
|
||||
|
||||
function structMethod(uint128 bidAmount1, uint128 bidAmount2) public pure returns (Bid memory) {
|
||||
Bid memory bid;
|
||||
bid.bidAmount1 = bidAmount2;
|
||||
bid.bidAmount2 = bidAmount1;
|
||||
|
||||
return bid;
|
||||
}
|
||||
|
||||
function emitEvent() public virtual returns (bool) {
|
||||
emit Test('abc', 123);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user