navskit
Version:
Deploy TypeScript logic on Ethereum. Includes core library, CLI tools, and utilities.
33 lines (32 loc) • 1.18 kB
TypeScript
/**
* Decodes a task result from its binary form
*
* @param type The return type of the function
* @param data The encoded result data
* @returns The decoded result value
*/
export declare function decodeTaskResult(type: string, data: `0x${string}`): any;
/**
* Decodes a value from its encoded form based on the type
*
* @param type The type to decode to (can be Promise<T> which will be unwrapped to T)
* @param data The encoded result data
* @returns The decoded value
*/
export declare function decodeValue(type: string, data: `0x${string}`): any;
/**
* Helper function to encode function arguments to bytes
*
* @param types Array of parameter types
* @param values Array of values to encode
* @returns Encoded bytes as a hex string
*/
export declare function encodeArgs(types: string[], values: any[]): `0x${string}`;
/**
* Creates a function to decode encoded bytes back into appropriate arguments
* using viem's decodeAbiParameters
*
* @param types Array of parameter types
* @returns A function that decodes bytes into an array of typed arguments
*/
export declare function createDecoder(types: string[]): (encodedArgs: `0x${string}`) => any[];