pwasm-abi icon indicating copy to clipboard operation
pwasm-abi copied to clipboard

Add support for repr enums

Open Pzixel opened this issue 6 years ago • 2 comments

Consider following code:

#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
enum MyEnum
{
	A,
	B,
	C
}

#[eth_abi(TokenEndpoint, TokenClient)]
pub trait SampleContractInterface {
	fn constructor(&mut self, myEnum: MyEnum);
}

Expected result: everything works

Actual result:

error: custom attribute panicked
  --> src\lib.rs:65:5
   |
65 |     #[eth_abi(TokenEndpoint, TokenClient)]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: Unable to handle param of type MyEnum: not supported by abi

error: aborting due to previous error

error: Could not compile `pwasm-abstractions-contract`.

Pzixel avatar Jul 18 '18 16:07 Pzixel

Btw, u8/i8/u16/i16 types are "not supported by abi" too. I believe they should be here too.

Pzixel avatar Jul 18 '18 16:07 Pzixel

Im getting similar error for string type. How did you resolved that error??

AchalaSB avatar Sep 12 '18 10:09 AchalaSB