UNPKG

@flipflop-sdk/node

Version:

FlipFlop Node.js SDK for programmatic token operations

51 lines (50 loc) 2.1 kB
/** * Update name, symbol and image to irys to get metadata uri * This module handles the complete metadata upload process: * 1. Validate image file type and size * 2. Upload image to Irys network * 3. Create metadata JSON with image URL and token info * 4. Upload metadata JSON to Irys network * 5. Return final metadata URL */ import { GenerateMetadataUriOptions, MetadataParams, MetadataUploadResponse, NetworkConfig } from "./types"; import { ApiResponse } from "./raydium/types"; /** * Validates image file type and size based on frontend validation logic * @param imagePath Path to the image file * @returns Object with validation result and error message if any */ declare const validateImageFile: (imagePath: string) => { valid: boolean; error?: string; }; /** * Uploads file to Irys network * @param filePath Path to the file to upload * @param action Type of upload (avatar, banner, metadata) * @returns Promise resolving to the uploaded file URL */ declare const uploadToStorage: (config: NetworkConfig, filePath: string, action?: string) => Promise<string>; /** * Determines MIME type based on file extension * @param filePath Path to the file * @returns MIME type string */ declare const getMimeType: (filePath: string) => string; /** * Creates metadata JSON object and uploads it to Irys * @param params Metadata parameters * @param imageUrl URL of the uploaded image * @returns Promise resolving to the metadata URL */ declare const createAndUploadMetadata: (config: NetworkConfig, params: MetadataParams, imageUrl: string) => Promise<string>; /** * Main function to generate metadata URI from command line parameters * @param name Token name * @param symbol Token symbol * @param description Token description * @param imagePath Path to the image file * @returns Promise resolving to metadata upload result */ declare const generateMetadataUri: (options: GenerateMetadataUriOptions) => Promise<ApiResponse<MetadataUploadResponse>>; export { validateImageFile, uploadToStorage, createAndUploadMetadata, getMimeType, generateMetadataUri, };