Skip to content

feat(sdk): keystore full example #144

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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

feat(sdk): keystore full example #144

wants to merge 33 commits into from

Conversation

Mechanix97
Copy link
Contributor

@Mechanix97 Mechanix97 commented Jun 19, 2025

Motivation

New example using the new keystore feature.

Description

This PR adds an example that:

  1. Downloads contract deps and compile contract.
  2. Creates a new keystore named "RexTest" in the "ContractKeystores" directory.
  3. Loads the keystore with the password.
  4. Funds the keystore account.
  5. Deploys the signer recovery example contract with the keystore account.
  6. Prepares the calldata to call the example contract.
    i. Prepares a message.
    ii. Signs the hash of the message with the keystore private key.
    iii. ABI-encodes the parameters.
  7. Prepares and send the transaction for calling the example contract.
  8. Gets the log emitted by the contract call execution.
  9. Compares it with the expected one.

How to test

  1. Run a local L1 node (this is optional as this could be tested in a testnet).
  2. Run the following command from the root of the repo. The private key must have funds in L1, and the RPC URL defaults to http://localhost:8545:
    cargo run --release --package rex-sdk --example keystore -- --private-key <PRIVATE_KEY> --rpc-url <RPC_URL>

@Mechanix97 Mechanix97 changed the title Mecha/add examples feat(sdk): add example using new features Jun 19, 2025
@Mechanix97 Mechanix97 marked this pull request as ready for review June 23, 2025 16:20
@Mechanix97 Mechanix97 requested a review from a team as a code owner June 23, 2025 16:20
Copy link
Collaborator

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the PR description and make it step by step:

  1. Download contract deps and compile example contract.
  2. Create a new keystore named "LambdaClass" in the "ContractKeystores" directory.
  3. Load the keystore.
  4. Fund the keystore account.
  5. Deploy the signer recovery example contract with the keystore account.
  6. Prepare the calldata to call the example contract
    1. Prepare a message.
    2. Sign the hash of the message with the keystore private key.
    3. ABI-encode the parameters.
  7. Prepare and send the transaction for calling the example contract.
  8. Get the log emitted by the contract call execution.
  9. Compare it with the expected one.

Do the same for the comments in the code (add 1., 2., etc, consistently with the PRs description).

Also add to the PR description a step by step of how to run this (we should consider adding the rich account private key as an argument, or either the path to a funded keystore).

@Mechanix97 Mechanix97 requested a review from ilitteri June 23, 2025 18:58
@Mechanix97 Mechanix97 requested a review from ilitteri June 24, 2025 16:59
@ilitteri ilitteri dismissed their stale review June 24, 2025 21:35

The requested changes were addressed.

@ilitteri ilitteri changed the title feat(sdk): add example using new features feat(sdk): keystore full example Jun 24, 2025
@ilitteri ilitteri requested a review from MauroToscano June 24, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants