Approve paraUSD

The approveParabolUSD method allows you to approve a specific address (spender) to spend a certain amount of your paraUSD tokens.

Usage

const account = new ParabolAccount(Account, chainId);
 
const spender = "0x..."; // Address of the spender
const amount = "1000"; // Amount to approve (in paraUSD)
 
try {
  const txHash = await account.approveParabolUSD(spender, amount);
  console.log("Approval transaction hash:", txHash);
} catch (error) {
  console.error("Error approving paraUSD:", error);
}
💡

This method is necessary if you plan to use the lend functionality. Before lending, you need to approve the paraUSD token to be spent by the Reserve Stability Pool (RSP) contract. See Smart Contracts for more information.

Parameters

  • spender: Address - The address that will be approved to spend the tokens.
  • value: string - The amount of paraUSD to approve (in ether units).

Returns

  • Hex - A promise that resolves to the transaction hash of the approval transaction.

Errors

This method throws a ParabolSDKError if the transaction fails. Always wrap the call in a try-catch block to handle potential errors.