Permit Helpers

Overview

Permit helpers facilitate the creation of EIP-712 typed data signatures for gasless approval operations in the Parabol protocol. These helpers support both lending and claiming operations.

Functions

preparePermitLendSignature

Prepares the signature data for permitting paraUSD token spending for lending operations.

Example

import { preparePermitLendSignature } from "@parabolfi/core";
 
const { domain, types, data, deadline } = preparePermitLendSignature({
  walletAddress,
  chainId,
  principal: "1000", // Amount to lend in paraUSD
  nonce,
  ParabolUSDName,
  ParabolUSDVersion,
});
ℹ️

nonce, ParabolUSDName, and ParabolUSDVersion can be retrieved from the ParabolServer client. See ParabolServer for more details.

Parameters

  • walletAddress: Address - The wallet address of the lender.
  • chainId: SupportedChainIds - The chain ID of the network.
  • principal: string - The amount of paraUSD to lend. (in ether units)
  • nonce: bigint - The nonce of the Parabol USD contract.
  • ParabolUSDName: string - The name of the Parabol USD contract.
  • ParabolUSDVersion: string - The version of the Parabol USD contract.

Returns

  • domain: TypedDataDomain - EIP-712 domain data
  • types: TypedData - Type definitions for the permit
  • data: TypedData - The permit data to be signed
  • deadline: bigint - The timestamp when the permit expires

preparePermitClaimSignature

Prepares the signature data for permitting Note Position token claiming operations.

Example

import { preparePermitClaimSignature } from "@parabolfi/core";
 
const { domain, types, data, deadline } = preparePermitClaimSignature({
  chainId,
  tokenId,
  nonce,
  NonFungibleNotePositionName,
  NonFungibleNotePositionVersion,
});
ℹ️

nonce, NonFungibleNotePositionName, and NonFungibleNotePositionVersion can be retrieved from the ParabolServer client. See ParabolServer for more details.

Parameters

  • chainId: SupportedChainIds - The chain ID of the network.
  • tokenId: string - The token ID of the Note Position.
  • nonce: bigint - The nonce of the Note Position contract.
  • NonFungibleNotePositionName: string - The name of the Note Position contract.
  • NonFungibleNotePositionVersion: string - The version of the Note Position contract.

Returns

  • domain: TypedDataDomain - EIP-712 domain data
  • types: TypedData - Type definitions for the permit
  • data: TypedData - The permit data to be signed
  • deadline: bigint - The timestamp when the permit expires

Notes

Permit Deadline

  • Default deadline is set to 1 hour from the current timestamp

Nonce Management

  • Nonces must be retrieved from the respective contracts
  • Each nonce can only be used once

Chain ID Validation

  • Always verify chain ID support before preparing permits
  • Use appropriate contract addresses for the selected chain