mhw0 / libethc

Open-source Ethereum C library
https://mhw0.github.io/libethc/
MIT License
46 stars 8 forks source link

cpp: add cpp wrappers #22

Open mhw0 opened 10 months ago

mhw0 commented 10 months ago

I think it would be cool if we had cpp wrappers for our C functions. Let's say we want to encode some ABI elements:

#include <ethc/ethcxx.h> // maybe just ethc.hh?

int main(void) {
  eth::ABIEncoder abi;

  abi.encodeUint16(0xffac); // or abi.decodeUint16 on decode? and it returns the decoded element?

  std::cout << abi << std::endl; // ABIEncoder supports streams?

  return 0;
}