@renegade-fi/node
Version:
Node.js library for Renegade
31 lines • 1.74 kB
TypeScript
import { type WalletClient } from "viem";
export declare function millisecondsToSeconds(milliseconds: number): number;
/**
* Signs a permit allowing a specified spender to transfer a specified amount of tokens from the signer's account.
* This function constructs a domain and message for the permit, signs it using the wallet client, and verifies the signature.
* It also ensures the public key recovered from the signature matches the wallet's public key.
* @param {bigint} amount - The decimal-adjusted amount of tokens to permit the spender to transfer.
* @param {number} chainId - The chain ID of the network.
* @param {string} spender - The address of the spender who is permitted to transfer the tokens.
* @param {string} permit2Address - The address of the deployed Permit2 contract.
* @param {string} tokenAddress - The address of the token to be transferred.
* @param {WalletClient} walletClient - The wallet client used to sign the permit.
*
* @returns {Promise<{signature: string, nonce: bigint, deadline: bigint}>} An object containing the signature, nonce, and deadline of the permit.
*
* @throws {Error} Throws an error if the wallet client's account address is not found, the signature is invalid, or the recovered public key does not match the wallet's public key.
*/
export declare function signPermit2({ amount, chainId, spender, permit2Address, tokenAddress, walletClient, pkRoot, }: {
amount: bigint;
chainId: number;
spender: `0x${string}`;
permit2Address: `0x${string}`;
tokenAddress: `0x${string}`;
walletClient: WalletClient;
pkRoot: bigint[];
}): Promise<{
signature: `0x${string}`;
nonce: bigint;
deadline: bigint;
}>;
//# sourceMappingURL=permit2.d.ts.map