import { SdkContext } from "../context/context"; export declare function createDecode(context: SdkContext): (response: any) => Promise; /** * Decodes the response from 'fcl.send()' into the appropriate JSON representation of any values returned from Cadence code. * * The response from Flow contains encoded values that need to be decoded into JavaScript types. This function handles that conversion, including complex types like structs, arrays, and dictionaries. * * @param response Should be the response returned from 'fcl.send([...])' * @returns A JSON representation of the raw string response depending on the cadence code executed. The return value can be a single value and type or an object with multiple types. * * @example * import * as fcl from "@onflow/fcl"; * * // Simple script to add 2 numbers * const response = await fcl.send([ * fcl.script` * access(all) fun main(int1: Int, int2: Int): Int { * return int1 + int2 * } * `, * fcl.args([fcl.arg(1, fcl.t.Int), fcl.arg(2, fcl.t.Int)]) * ]); * * const decoded = await fcl.decode(response); * console.log(decoded); // 3 * console.log(typeof decoded); // "number" * * // Complex return types * const complexResponse = await fcl.send([ * fcl.script` * access(all) fun main(): {String: Int} { * return {"foo": 1, "bar": 2} * } * ` * ]); * * const complexDecoded = await fcl.decode(complexResponse); * console.log(complexDecoded); // {foo: 1, bar: 2} */ export declare const decode: (response: any) => Promise;