Skip to main content
Looking for Contributors! This Skill needs an implementation.Contributing a Skill involves:
  1. Writing a reference implementation with full functionality
  2. Adding comprehensive tests
  3. Writing documentation with usage examples
See the ethers-provider Skill for an example of a complete Skill implementation.Interested? Open an issue or PR at github.com/evmts/voltaire.
Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.
Build on Optimism, Base, and any OP Stack chain with native bridging.

Planned Implementation

Provider Setup

import { OpStack } from './OpStack.js';

const op = OpStack({
  l1Provider,
  l2Provider,
  l1CrossDomainMessenger: L1_MESSENGER,
  l2CrossDomainMessenger: L2_MESSENGER,
  l1StandardBridge: L1_BRIDGE,
  l2StandardBridge: L2_BRIDGE,
});

Bridge Assets

// Deposit ETH
await op.depositETH({
  amount: parseEther('1'),
  signer: l1Signer,
});

// Deposit ERC20
await op.depositERC20({
  l1Token: USDC_L1,
  l2Token: USDC_L2,
  amount: parseUnits('1000', 6),
  signer: l1Signer,
});

// Withdraw (7 day challenge period)
await op.withdrawETH({
  amount: parseEther('1'),
  signer: l2Signer,
});

Message Passing

// Send L1 -> L2 message
await op.sendMessage({
  target: l2Contract,
  message: encodedCall,
  gasLimit: 1000000,
  signer: l1Signer,
});

// Relay L2 -> L1 message after challenge period
await op.finalizeMessage({
  withdrawalTx,
  signer: l1Signer,
});

Prove & Finalize Withdrawals

// Get withdrawal status
const status = await op.getWithdrawalStatus(withdrawalHash);
// 'waiting' | 'ready_to_prove' | 'in_challenge' | 'ready_to_finalize' | 'finalized'

// Prove withdrawal
await op.proveWithdrawal({
  withdrawalTx,
  signer: l1Signer,
});

// Finalize after challenge period
await op.finalizeWithdrawal({
  withdrawalTx,
  signer: l1Signer,
});

L1 Block Info

// Get L1 block info on L2
const l1Info = await op.l1Block.number();
const l1Timestamp = await op.l1Block.timestamp();
const baseFee = await op.l1Block.basefee();

Supported Chains

  • Optimism Mainnet
  • Base
  • Zora
  • Mode
  • Any OP Stack chain

Resources