Unshield base token

Unshielding requires you to "Generate Proof" and, optionally, make use of "Relayers": See UX for Private Transactions UX for Private Transactions

Unshield only the base token for a network (eg. ETH) from shielded wETH in a single transaction.

Base tokens cannot be shielded by themselves, as they are not ERC-20 tokens. They must be shielded as a wrapped token, eg. wETH for the Ethereum network. You can choose to unshield a wrapped base token (like wETH) from a user's private balance to the equivalent base token.

Base token unshields are executed as a multi call through RAILGUN Relay Adapt, which unwraps the wETH into ETH at a 1:1 ratio and unshields the result into a public balance. This transaction is performed in isolation and cannot be paired with ERC-20 unshields.

Imports

import {
  calculateGasPrice,
  TXIDVersion,
  type NetworkName,
  type RailgunERC20Amount,
  type RailgunERC20AmountRecipient,
  type RailgunWalletInfo,
  type TransactionGasDetails,
} from "@railgun-community/shared-models";
import { TEST_NETWORK, TEST_TOKEN } from "../../utils/constants";
import {
  getGasDetailsForTransaction,
  getOriginalGasDetailsForTransaction,
} from "../util";
import {
  gasEstimateForUnprovenUnshieldBaseToken,
  generateUnshieldBaseTokenProof,
  populateProvedUnshieldBaseToken,
} from "@railgun-community/wallet";
import { getProviderWallet } from "../../utils/provider";

Gas Estimate

Generate Proof

Populate Transaction

Example Usage

Last updated