@parabolfi/core
Version:
Core utilities for Parabol SDK
120 lines • 4.52 kB
TypeScript
import { Address, TypedDataDomain } from "viem";
import { SupportedChainId } from "../config/global";
/**
* Prepares the signature data for a permit lend operation.
*
* @param {Object} params - The parameters for preparing the permit lend signature.
* @param {Address} params.walletAddress - The address of the wallet initiating the lend.
* @param {SupportedChainId} params.chainId - The ID of the blockchain network.
* @param {bigint} params.principal - The amount of Parabol's ERC-20 token to be lent.
* @param {bigint} params.nonce - The current nonce of the ParabolUSD contract for the wallet address.
* @param {string} params.ParabolUSDName - The name of the ParabolUSD token.
* @param {string} params.ParabolUSDVersion - The version of the ParabolUSD token.
*
* @returns {Object} An object containing the domain, types, and data for the permit signature.
* @property {TypedDataDomain} domain - The domain data for the signature.
* @property {TypedData} types - The types definition for the permit data.
* @property {Permit} data - The actual permit data to be signed.
*
* @example
* const signatureData = preparePermitLendSignature({
* walletAddress: '0x...',
* chainId: 324 as SupportedChainId,
* principal: BigInt(1000000),
* nonce: BigInt(5),
* ParabolUSDName: 'ParabolUSD',
* ParabolUSDVersion: '1'
* });
*/
export declare function preparePermitLendSignature({ walletAddress, chainId, principal, nonce, ParabolUSDName, ParabolUSDVersion, }: {
walletAddress: Address;
chainId: SupportedChainId;
principal: string;
nonce: bigint;
ParabolUSDName: string;
ParabolUSDVersion: string;
}): {
domain: TypedDataDomain;
types: {
readonly Permit: readonly [{
readonly name: "owner";
readonly type: "address";
}, {
readonly name: "spender";
readonly type: "address";
}, {
readonly name: "value";
readonly type: "uint256";
}, {
readonly name: "nonce";
readonly type: "uint256";
}, {
readonly name: "deadline";
readonly type: "uint256";
}];
};
data: {
owner: `0x${string}`;
spender: `0x${string}`;
value: bigint;
nonce: bigint;
deadline: bigint;
};
deadline: bigint;
};
/**
* Prepares the signature data for a permit claim operation.
*
* @param {Object} params - The parameters for preparing the permit claim signature.
* @param {SupportedChainId} params.chainId - The ID of the blockchain network.
* @param {bigint} params.tokenId - The ID of the token to be claimed.
* @param {bigint} params.nonce - The current nonce of the NonFungibleNotePosition contract for tokenId.
* @param {string} params.NonFungibleNotePositionName - The name of the NonFungibleNotePosition contract.
* @param {string} params.NonFungibleNotePositionVersion - The version of the NonFungibleNotePosition contract.
*
* @returns {Object} An object containing the domain, types, and data for the permit signature.
* @property {TypedDataDomain} domain - The domain data for the signature.
* @property {TypedData} types - The types definition for the permit data.
* @property {Object} data - The actual permit data to be signed.
*
* @example
* const signatureData = preparePermitClaimSignature({
* chainId: 324 as SupportedChainId,
* tokenId: BigInt(123),
* nonce: BigInt(5),
* NonFungibleNotePositionName: 'paraUSD RSP Note NFT-V1',
* NonFungibleNotePositionVersion: '1'
* });
*/
export declare function preparePermitClaimSignature({ chainId, tokenId, nonce, NonFungibleNotePositionName, NonFungibleNotePositionVersion, }: {
chainId: SupportedChainId;
tokenId: bigint;
nonce: bigint;
NonFungibleNotePositionName: string;
NonFungibleNotePositionVersion: string;
}): {
domain: TypedDataDomain;
types: {
readonly Permit: readonly [{
readonly name: "spender";
readonly type: "address";
}, {
readonly name: "tokenId";
readonly type: "uint256";
}, {
readonly name: "nonce";
readonly type: "uint256";
}, {
readonly name: "deadline";
readonly type: "uint256";
}];
};
data: {
spender: `0x${string}`;
tokenId: bigint;
nonce: bigint;
deadline: bigint;
};
deadline: bigint;
};
//# sourceMappingURL=permitSignatureHelpers.d.ts.map