Skip to content
On this page

Redeem Request

  • redeemRequest(sender, tokenOut, amount): Prepares a redeem request transaction if tokenOut is not fiat. The prepared transaction will transfer amount in mToken to contract and fee in mToken to feeReceiver. This method is used when instant redemption is not possible due to liquidity constraints.

Parameters

  • sender (string): The address of the transaction sender
  • tokenOut (string): The token address to redeem to (must be supported by redemption vault)
  • amount (BigNumberish): The amount of mToken to redeem

Code Example

ts
import { HYSP } from "@everstake/wallet-sdk-hysp";
import { ethers } from "ethers";

// Initialize SDK
const hysp = new HYSP();
await hysp.init("eth_mainnet", "mmev");

const walletAddress = "0x...";
const usdcAddress = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const redeemAmount = "500.0";

// Create redeem request transaction
const redeemRequestTx = await hysp.redeemRequest(
  walletAddress,
  usdcAddress,
  redeemAmount
);

// Sign and send transaction
const signer = await ethers.getSigner();
const txResponse = await signer.sendTransaction(redeemRequestTx);
await txResponse.wait();

Prerequisites

  • Token must be in hysp.supportedRedemptionTokensAddresses
  • Sufficient collateral balance required
  • Token must not be a fiat token