Skip to content

Conversation

@MarcosNicolau
Copy link
Member

@MarcosNicolau MarcosNicolau commented Oct 6, 2025

Description

Adds unlock, lock and withdraw funds from aligned in sdk and cli.

How to test

  1. Start anvil:
make anvil_start
  1. Deposit in aligned (for example with a anvil rich account):
cd crates/cli
cargo run --release -- deposit-to-batcher \
    --amount 1ether \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \
    --network devnet \
    --rpc_url http://localhost:8545
  1. Try to withdraw:
cd crates/cli
cargo run --release -- withdraw-funds \
    --amount 1ether \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \
    --network devnet \
    --rpc_url http://localhost:8545

You should see that the cli tells you that you need to unlock your funds first.

  1. Unlock your funds:
cargo run --release -- unlock-funds \
    --network devnet \
    --rpc_url http://localhost:8545 \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
  1. Try to withdraw again:
cd crates/cli
cargo run --release -- withdraw-funds \
    --amount 1ether \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \
    --network devnet \
    --rpc_url http://localhost:8545

You should see that the cli shows the minutes needed to wait to withdraw

  1. Advance blocks:
 curl http://localhost:8545 \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"evm_increaseTime","params":[20000],"id":1}'
  1. Withdraw your funds:
cd crates/cli
cargo run --release -- withdraw-funds \
    --amount 1ether \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \
    --network devnet \
    --rpc_url http://localhost:8545
  1. Verify your funds have been withdrawn:
cargo run --release -- get-user-balance --network devnet --user_addr 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f

You can also test locking your funds after unlocking them:

cargo run --release -- funds \
    --network devnet \
    --rpc_url http://localhost:8545 \
    --private_key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97

Type of change

  • New feature

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change crates/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@MarcosNicolau MarcosNicolau changed the title feat: unlock.lock and withdraw funds in sdk and cli feat: unlock, lock and withdraw funds in sdk and cli Oct 6, 2025
@MarcosNicolau MarcosNicolau marked this pull request as ready for review October 6, 2025 18:46
@JuArce JuArce added this pull request to the merge queue Oct 6, 2025
Merged via the queue into staging with commit 9d8d86c Oct 6, 2025
3 checks passed
@JuArce JuArce deleted the feat/withdraw-funds-cli branch October 6, 2025 22:32
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.

4 participants