Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentations #11

Open
ayrat555 opened this issue Oct 16, 2017 · 11 comments
Open

Add documentations #11

ayrat555 opened this issue Oct 16, 2017 · 11 comments

Comments

@ayrat555
Copy link
Member

The library is purely documented. Fix that

@hickscorp
Copy link

It'd be nice to add a small paragraph in the docs on how to use the lib to perform smart contracts method calls, given a JSON ABI.

@hayesgm
Copy link
Collaborator

hayesgm commented Jan 15, 2018

Sure, I'll work on adding this to the README, but for those curious, it'll be something like this:

Add https://hex.pm/packages/blockchain and https://hex.pm/packages/abi

abi_encoded_data = ABI.encode("baz(uint,address)", [50, <<1::160>> |> :binary.decode_unsigned])

transaction_data = %Blockchain.Transaction{
    data: abi_encoded_data,
    gas_limit: 100_000,
    gas_price: 16_000_000_000,
    init: <<>>,
    nonce: 5,
    to: <<>>,
    value: 0
}
|> Blockchain.Transaction.Signature.sign_transaction(private_key)
|> Blockchain.Transaction.serialize()
|> ExRLP.encode()
|> Base.encode16(case: :lower)

Ethereumex.HttpClient.eth_send_raw_transaction("0x" <> transaction_data)

@hickscorp
Copy link

That would be most helpful indeed - and IMO small things like this are the only roadblock preventing more exposure of this great library.

@tzumby
Copy link
Contributor

tzumby commented Jun 7, 2018

@hayesgm did you get a chance to add that snipped to the README ? I went through a similar process to get the eth_call working. I can submit a PR with the docs and include your snippet as well.

@ayrat555
Copy link
Member Author

ayrat555 commented Jun 8, 2018

@tzumby it'd be great

@tzumby
Copy link
Contributor

tzumby commented Jun 11, 2018

@ayrat555 PR is in :)

@ghbutton
Copy link
Contributor

Can we close this issue if it has been resolved?

@ayrat555
Copy link
Member Author

@ghbutton After adding doctests and moduledocs we can close it

@hayesgm
Copy link
Collaborator

hayesgm commented Jul 27, 2018

Would doctests be difficult since they are pretty side-effecting? Doctests are great for pure functions, but they aren't as clean for impure code.

@hickscorp
Copy link

@hayesgm I usually go for module doc for such examples. Maybe that's the way to go.

@ayrat555
Copy link
Member Author

Good point, Geoff. I think just descriptions for methods and their params would be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants