Skip to content

CLI command

CLI command development tools for fast testing and simplification.




install: npm i -g opstack-kit
call: ok

Note: 🟣 Required 🟡 Optional

depositTransaction

Deposit ETH, "OptimismPortal.depositTransaction" address.

Command:

bash
ok depositTransaction <Amount>

Amount to Deposit

Option:

  • 🟣 -pk, --privateKey <key>: Private key for signing the transaction
  • 🟣 -c1, --chainIdL1 <id>: Chain ID for Layer 1
  • 🟣 -r1, --rpcUrlL1 <url>: RPC URL for Layer 1
  • 🟣 -p, --portal <address>: Portal contract address
  • 🟡 -g, --gasLimit <gas>: Gas limit for Transaction, '21000'
  • 🟡 -s1, --scanL1Url <url>: Block Explorer URL for Layer 1, 'undefined'

Usage:

bash
ok depositTransaction <Amount> --privateKey <key> --chainIdL1 <id> --rpcUrlL1 <url> --portal <address> --gasLimit <gas> --scanL1Url <url>

initiateWithdrawal

Withdraw ETH, "L2ToL1MessagePasser.initiateWithdrawal" address.

TIP

For ETH Native and CustomGasToken only.

Command:

bash
ok initiateWithdrawal <Amount>

Amount to Withdraw

Option:

  • 🟣 -pk, --privateKey <key>: Private key for signing the transaction
  • 🟣 -c2, --chainIdL2 <id>: Chain ID for Layer 2
  • 🟣 -r2, --rpcUrlL2 <url>: RPC URL for Layer 2
  • 🟡 -g, --gasLimit <gas>: Gas limit for Transaction, '21000'
  • 🟡 -s2, --scanL2Url <url>: Block Explorer URL for Layer 2, 'undefined'

Usage:

bash
ok initiateWithdrawal <Amount> --privateKey <key> --chainIdL2 <id> --rpcUrlL2 <url> --gasLimit <gas> --scanL2Url <url>

prove (proveWithdrawal)

Prove withdrawal using transaction hash, "OptimismPortal.proveWithdrawal" address.

TIP

Non-Fault proofs: disputeGameFactory = 0x_l2OutputOracle
Fault proofs: l2OutputOracle = 0x_disputeGameFactory

Command:

bash
ok prove <WithdrawalTxHashL2>

Transaction hash of the Layer 2 withdrawal

Option:

  • 🟣 -pk, --privateKey <key>: Private key for signing the transaction
  • 🟣 -c1, --chainIdL1 <id>: Chain ID for Layer 1
  • 🟣 -r1, --rpcUrlL1 <url>: RPC URL for Layer 1
  • 🟣 -c2, --chainIdL2 <id>: Chain ID for Layer 2
  • 🟣 -r2, --rpcUrlL2 <url>: RPC URL for Layer 2
  • 🟣 -p, --portal <address>: Portal contract address
  • 🟣 -o, --l2OutputOracle <address>: Portal contract address
  • 🟣 -d, --disputeGameFactory <address>: Dispute Game Factory contract address
  • 🟡 -s1, --scanL1Url <url>: Block Explorer URL for Layer 1, 'undefined'

Usage:

bash
ok prove <WithdrawalTxHashL2> --privateKey <key> --chainIdL1 <id> --rpcUrlL1 <url> --chainIdL2 <id> --rpcUrlL2 <url> --portal <address> --l2OutputOracle <address> --disputeGameFactory <address> --scanL1Url <url>

finalize (finalizeWithdrawal)

Finalize withdrawal using transaction hash after proving, "OptimismPortal.finalizeWithdrawal" address.

Command:

bash
ok finalize <WithdrawalTxHashL2>

Transaction hash of the Layer 2 withdrawal

Option:

  • 🟣 -pk, --privateKey <key>: Private key for signing the transaction
  • 🟣 -c1, --chainIdL1 <id>: Chain ID for Layer 1
  • 🟣 -r1, --rpcUrlL1 <url>: RPC URL for Layer 1
  • 🟣 -c2, --chainIdL2 <id>: Chain ID for Layer 2
  • 🟣 -r2, --rpcUrlL2 <url>: RPC URL for Layer 2
  • 🟣 -p, --portal <address>: Portal contract address
  • 🟡 -s1, --scanL1Url <url>: Block Explorer URL for Layer 1, 'undefined'

Usage:

bash
ok finalize <WithdrawalTxHashL2> --privateKey <key> --chainIdL1 <id> --rpcUrlL1 <url> --chainIdL2 <id> --rpcUrlL2 <url> --portal <address> --scanL1Url <url>

Released under the MIT License.