difcli
Version:
CLI tool for Diffuse Prime
46 lines • 2.01 kB
TypeScript
import { PublicClient, WalletClient } from 'viem';
import { ChainType } from '../config';
export interface TokenBalance {
balance: string;
symbol: string;
}
export interface AllowanceInfo {
allowance: string;
required: string;
sufficient: boolean;
}
export declare class TokenOperations {
/**
* Gets token balance for an address
*/
static getTokenBalance(address: `0x${string}`, tokenContract: `0x${string}`, publicClient: PublicClient): Promise<TokenBalance>;
/**
* Gets token symbol
*/
static getTokenSymbol(tokenContract: `0x${string}`, publicClient: PublicClient): Promise<string>;
/**
* Checks token allowance
*/
static checkAllowance(owner: `0x${string}`, spender: `0x${string}`, tokenContract: `0x${string}`, publicClient: PublicClient): Promise<bigint>;
/**
* Gets formatted allowance information
*/
static getAllowanceInfo(owner: `0x${string}`, spender: `0x${string}`, tokenContract: `0x${string}`, requiredAmount: bigint, publicClient: PublicClient): Promise<AllowanceInfo>;
/**
* Approves token spending
*/
static approveTokenSpending(tokenContract: `0x${string}`, spender: `0x${string}`, amount: bigint, walletClient: WalletClient, chainType: ChainType): Promise<`0x${string}`>;
/**
* Ensures sufficient allowance, approves if necessary
*/
static ensureAllowance(owner: `0x${string}`, spender: `0x${string}`, tokenContract: `0x${string}`, requiredAmount: bigint, walletClient: WalletClient, publicClient: PublicClient, chainType: ChainType): Promise<void>;
/**
* Validates token balance is sufficient
*/
static validateTokenBalance(address: `0x${string}`, tokenContract: `0x${string}`, requiredAmount: bigint, publicClient: PublicClient): Promise<TokenBalance>;
/**
* Gets native token balance
*/
static getNativeBalance(address: `0x${string}`, publicClient: PublicClient): Promise<string>;
}
//# sourceMappingURL=token-utils.d.ts.map