Notice

Please strictly follow the steps below to perform recovery. Before proceeding, please read the step-by-step example and reference screenshot in the README.

Two wallets: Step 2 signs offline with your Beacon Chain wallet (no gas). Step 4 only generates a payload — broadcasting the recover tx requires the BNB Chain key for To BSC Address, which must hold BNB for gas.

1. Input Your Beacon Chain Address to Get Recoverable Tokens

2. Generate Sign Message for Wallet to Sign (Beacon Chain)

// beaconChainAddress: string — the bnb1... Beacon Chain address
// messageToSign: string — the JSON message shown above
// Sign the message with the Beacon Chain wallet (e.g., Trust Wallet)
const bbcSigned = await window.TrustBinanceChain.bnbSign(
  beaconChainAddress,
  messageToSign
);
// Never print the full signature in production builds.
console.log("Signed; bbcSigned ready");
// Example bbcSigned shape (do not log this in production):
// {
//   "signature": "0x...",
//   "publicKey": "0x..."
// }

Note: The signature returned by the wallet may not be 0x-prefixed. Make sure to prepend 0x if it's missing before using the signature in the next steps.

Security: window.TrustBinanceChain is a plain global — any browser extension can inject or override it (and provider.isTrust can be set by anyone). Before signing, make sure only the legitimate Trust Wallet extension is enabled and you're not on a shared/untrusted browser. Avoid signing with multiple wallet extensions installed simultaneously.

3. Submit Signed Result to Get Approval

null

4. Build Recover Payload (BNB Chain)

Note: Both the Owner Signature (from the wallet) and the Approval Signature (from the server) must be 0x-prefixed. If either is missing the prefix, prepend 0x before submitting.

This step only generates the payload. No transaction is broadcast here. You must call the contract's recover function yourself with a BNB Chain wallet that holds BNB for gas — see the code example below.
null
Contract: https://bscscan.com/address/0x0000000000000000000000000000000000003000
const SECURITY_RECOVER_GAS_LIMIT = 1000000;

const receipt = await contract.recover(
  recoverPayload.tokenSymbol,
  recoverPayload.amount,
  recoverPayload.ownerPubKey,
  recoverPayload.ownerSignature,
  recoverPayload.approvalSignature,
  recoverPayload.merkleProof,
  {
    gasLimit: SECURITY_RECOVER_GAS_LIMIT,
  },
);
// 'receipt' is the tx receipt — safe to log; never print the payload's signatures.
console.log(receipt);