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

[Feature] Add Transaction types, implement sign_transaction #73

Closed
DaniPopes opened this issue Dec 12, 2023 · 2 comments
Closed

[Feature] Add Transaction types, implement sign_transaction #73

DaniPopes opened this issue Dec 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@DaniPopes
Copy link
Member

Component

providers

Describe the feature you would like

builder style Request types (Optional fields) that have a corresponding Transaction type (valid Transaction).

yes, love this plan :)

going from Request -> Transaction is what we called fill in ethers.

This is a little more complex, I think. The TransactionRequest generally allows a from field, which the Transaction that implements RLP should not

So we may want something like:

  • Transaction - complete, no from field, implements RLP, no serde
  • SignedTransaction - complete, no from field, contains Transaction + Signature, no serde
  • TransactionRequest - builder for the JSON request object
  • Provider::fill(&mut TransactionRequest)
    • populates all possible fields from RPC node
    • should ensure that TransactionRequest::try_into_transaction definitely succeeds
  • Signer::sign_transaction(&TransactionRequest) -> Result<SignedTransaction>
    • errors when the request is missing info, or if from is populated with address signer can't sign from
  • TransactionResponse - JSON object returned by eth_getTransactionByXXXX methods
    • should ALWAYS contain a SignedTransaction

Originally posted by @prestwich in #44 (comment)

Additional context

No response

@DaniPopes DaniPopes added the enhancement New feature or request label Dec 12, 2023
@prestwich
Copy link
Member

Per conversation today:

Here is the full matrix of types to be implemented. The primitive column should derive RLP. The req/response should be in alloy json rpc types (and already partially exist)

All req+response types should allow extra fields. signature on TransactionResponse should be Optional to support Optimism.

Responses should inherit primitives
Reqs should be builders, and should have an option to build into the primitive types
Provider should use req/resp

cc @Evalir

          | Primitive         | Req                | Resp 
Legacy    | TransactionLegacy | RequestLegacy      | ResponseLegacy  
1559      | Transaction1559   | Request1559        | Response1559
2930      | Transaction2930   | Request2930        | Response2930

enum      | Transaction       | TransactionRequest | TransactionResponse

receipt   | Receipt           | n/a                | ReceiptResponse

signed    | Signed<T: Transaction> 

@DaniPopes
Copy link
Member Author

Signing and transactions have been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants