UNPKG

@open-social-protocol/osp-plugin-api-types

Version:
68 lines (54 loc) 2.33 kB
export interface Result extends ReadonlyArray<unknown> { readonly [key: string]: unknown; } export interface ICoder { encode: (abi: string, values: Array<unknown>) => string decode: (abi: string, data: string) => Result } type ApproveResult = { success: boolean; } /** * Utility interface for approving ERC20 token transfers. */ export interface ERC20ApproveUtils { /** * Approves a spender to transfer a specified amount of tokens on behalf of the caller. * @param spender - The address of the spender. * @param tokenAddress - The address of the token to be approved for transfer. * @param amount - The amount of tokens to be approved for transfer. * @returns A promise that resolves when the approval transaction is complete. */ approve: (spender: string, tokenAddress: string, amount: string) => Promise<ApproveResult>; } /** * Utility interface for approving ERC721 token transfers. */ export interface ERC721ApproveUtils { /** * Approves a spender to transfer a specific token on behalf of the caller. * @param spender - The address of the spender. * @param tokenAddress - The address of the token contract. * @param tokenId - The ID of the token to be approved for transfer. * @param amount - The amount of the token to be approved for transfer. * @returns A promise that resolves when the approval transaction is complete. */ approve: (spender: string, tokenAddress: string, tokenId: string, amout: string) => Promise<ApproveResult>; } /** * Utility interface for approving ERC1155 token transfers. */ export interface ERC1155ApproveUtils { /** * Approves a spender to transfer a specific amount of a token on behalf of the caller. * @param spender - The address of the spender. * @param tokenAddress - The address of the token contract. * @param tokenId - The ID of the token to be approved for transfer. * @param amount - The amount of the token to be approved for transfer. * @returns A promise that resolves when the approval transaction is complete. */ approve: (spender: string, tokenAddress: string, tokenId: string, amount: string) => Promise<ApproveResult>; } export declare interface IContract { readonly [key: string]: ContractFunction | unknown; }