Fee authorization

This section describes the fee authorization process for EVM destinations, including signature handling.


Overview

When staking BTC to Ethereum Mainnet or Sepolia, the SDK requires an EIP-712 signature to authorize the network fee. This happens during the authorize() step.


Flow

IDLE → NEEDS_FEE_AUTHORIZATION → READY → ADDRESS_READY
         ↑                          ↑
         prepare()                  authorize()

Example

import { createLombardSDK, Chain, AssetId, BtcActionStatus } from '@lombard.finance/sdk';
import { config } from './lib/lombard';

const sdk = createLombardSDK(config);

const stake = sdk.chain.btc.stake({
  destChain: Chain.ETHEREUM,
  assetOut: AssetId.LBTC,
});

await stake.prepare({
  amount: '0.1',
  recipient: '0x1234567890abcdef1234567890abcdef12345678',
});
// status: BtcActionStatus.NEEDS_FEE_AUTHORIZATION

await stake.authorize();
// Wallet prompts user to sign EIP-712 message
// status: BtcActionStatus.READY

const address = await stake.generateDepositAddress();
// status: BtcActionStatus.ADDRESS_READY

Other Destinations

For all other chains (Base, Solana, Sui, etc.), the flow uses address confirmation instead of fee authorization.


Stored Signatures

Fee signatures can be reused. If a valid signature exists from a previous operation, prepare() will skip directly to READY.

Last updated