#ethereum #transaction #builder #chain

rosetta-tx-ethereum

Ethereum transaction builder

3 releases (breaking)

0.4.0 Jun 29, 2023
0.2.5 May 1, 2023
0.1.0 Mar 30, 2023

#251 in #chain

Download history 13/week @ 2024-08-31 9/week @ 2024-09-07 13/week @ 2024-09-14 35/week @ 2024-09-21 47/week @ 2024-09-28 1/week @ 2024-10-05 6/week @ 2024-10-12 11/week @ 2024-10-19 9/week @ 2024-10-26 8/week @ 2024-11-02 10/week @ 2024-11-16 17/week @ 2024-11-23 18/week @ 2024-11-30 26/week @ 2024-12-07 10/week @ 2024-12-14

75 downloads per month
Used in 9 crates (via rosetta-client)

MIT license

16KB
274 lines

This project is used to build transactions for ethereum chains.

EthereumTransactionBuilder:

Its implementation of `TransactionBuilder` and implements the following methods:
1. `transfer`
2. `method_call`
3. `create_and_sign`

transfer:

Creates `EthereumMetadataParams` for transfer call.

method_call:

Creates `EthereumMetadataParams` for contract calls. It takes 
`method`: this is a string contraining contract address and method signature with `-` seperation.
`params`: array of json_value with params taken by contract methods in string format.

It returns `EthereumMetadataParams` with `data` field set to the encoded contract call params.

create_and_sign:

When `metadata` is created we use this call to create Ethereum Transaction and sign it. It takes following arguments.
`config`: chain sepecific config.
`metadata_params`: Metadata params which created metadata for this call.
`metadata`: Metadata required make transaction.
`secret_key`: wallet's secret key (used to sign the transaction).

It creates the transaction and signs it and then returns its bytes.

Dependencies

~16–27MB
~445K SLoC