UNPKG

@shogun-sdk/money-legos

Version:

Shogun Money Legos: clients and types for quotes, memes, prices, balances, fees, validations, etc.

131 lines 3.14 kB
/** * Response data structure returned by the Lego API */ interface IResponseData { steps: IStep[]; details: IDetails; fees: IFees; } /** * Transaction details including sender, recipient and token information */ interface IDetails { sender: string; recipient: string; tokenIn: ITokenIn; } /** * Token information including amount, chain, and metadata */ interface ITokenIn { amountUsd: string; chainId: number; address: string; symbol: string; name: string; decimals: number; amount?: string; } /** * Fee information for transactions */ interface IFees { gas: ITokenIn; } /** * Individual transaction step with blockchain interaction details */ interface IStep { from: string; to: string; data: string; value: string; chainId: number; gas: string; maxFeePerGas: string; maxPriorityFeePerGas: string; } /** * Represents a single NFT item with its contract address and token ID */ interface INFTItem { address: string; tokenId: string; } /** * Represents the token being used for the purchase */ interface IToken { address: string; decimals: number; chainId: number; } /** * Input parameters required for fetching Lego data */ interface IFetchLegoProps { items: INFTItem[]; token: IToken; userAddress: string; recipientAddress?: string; } /** * Output structure returned by the MagicEden.SwapForNFT function */ interface ILegoResult { status: boolean; error?: string | null; data?: IResponseData | null; refetch: () => Promise<ILegoResult>; } /** * Configuration options for the LegoClient */ interface ILegoClientConfig { /** * API key for authentication */ apiKey: string; } /** * Client for interacting with the Lego API * * @example * ```typescript * const legoClient = new LegoClient({ apiKey: 'your-api-key' }); * const result = await legoClient.MagicEden.SwapForNFT({ items, token, userAddress, recipientAddress }); * const updatedResult = await result.refetch(); * ``` */ export declare class LegoClient { private apiKey; private activeControllers; /** * Creates a new LegoClient instance * * @param {LegoClientConfig} config - Configuration options including API key */ constructor(config: ILegoClientConfig); /** * Generates a unique request ID for tracking purposes * * @param {IFetchLegoProps} props - The fetch parameters * @returns {string} - A unique identifier for this request * @private */ private generateRequestId; /** * MagicEden marketplace operations */ MagicEden: { /** * Swaps tokens for NFTs on MagicEden with support for refetching * * @param {IFetchLegoProps} props - Input parameters containing NFT items, token, and user address * @returns {Promise<ILegoResult>} - Result containing status, data, error message, and refetch function */ SwapForNFT: (props: IFetchLegoProps) => Promise<ILegoResult>; }; } export {}; //# sourceMappingURL=shogun-lego-api-client.d.ts.map