#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

#209 in #chain

Download history 7/week @ 2024-01-08 3/week @ 2024-01-22 3/week @ 2024-02-05 16/week @ 2024-02-12 23/week @ 2024-02-19 52/week @ 2024-02-26 92/week @ 2024-03-04 24/week @ 2024-03-11 24/week @ 2024-03-18 37/week @ 2024-03-25 68/week @ 2024-04-01 13/week @ 2024-04-08 18/week @ 2024-04-15

137 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–29MB
~447K SLoC