Skip to content

authorize command #72

@ilitteri

Description

@ilitteri

Context

We want to implement a command to sign an authorization tuple from EIP-7702

Description

The command authorize should take a private-key as a parameter, the address of the authority the authorization tuple delegates to, the chain-id optional parameter and the nonce optional parameter
The command should call the rpc endpoint to get the nonce for the authorization tuple or use the one passed as a parameter so that the user can create authorization tuples even if offline
It is also required to extend the rex send command to use this authorization tuple to create an eip-2718 type 0x04 transaction that includes this authorization tuple

Expected Usage of rex authorize

rex authorize <AUTHORITY_ADDRESS> [RPC_URL] <PRIVATE_KEY> --chain-id [id] --nonce [nonce]
rex l2 authorize <AUTHORITY_ADDRESS> [RPC_URL] <PRIVATE_KEY> --chain-id [id] --nonce [nonce]

Expected Usage of rex send

rex send <TO> <VALUE> <PRIVATE_KEY> [RPC_URL] --auth-tuple [auth-tuple]
rex l2 send <TO> <VALUE> <PRIVATE_KEY> [RPC_URL] --auth-tuple [auth-tuple]

Note

  • Keep consistency.
    • The CLI is a frontend of the SDK. The main logic must live in the SDK, and the CLI should have minimal logic.
    • If a command exists for the L1 and could also exist for the L2, revise the existing commands and follow the same approach to do this to avoid repeating code unnecessarily.
    • All RPC requests should be added as methods of the SDK's EthClient.
  • Focus on UX
    • There are minor subtleties that improve the UX, such as making arguments positional, allowing you to skip writing the whole flag (e.g., instead of writing --some-flag <value>, you just write <value>). This is achieved by avoiding adding the short and long opts to the flag configuration.
    • Keep commands and flags well documented. For flags, we have help and long_help, and about for commands.
    • Keep commands and flags well aliased. For commands we have visible_alias and visible_aliases, and for flags we have short to enable adding the flag just using one dash and the first letter of the flag's name (e.g. -e is the short of --explorer), long to enable adding flags by using double dash (e.g. --explorer) and none of them to avoid using dashes at all (read two bullets above for more details on this).
  • Test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions