When generating JS | TS binding files, support Dictionary of simple types like String and Int
Look into getting json-cadence both parameters and return types and convert to types.
TODO: Verify this code example:
async function executeTransaction(myDict: { [key: string]: number }) {
const response = await fcl.send([
fcl.transaction(cadenceTx),
fcl.args([
fcl.arg(myDict, t.Dictionary({ key: t.String, value: t.Int })) // Assuming FCL has a Dictionary type
]),
// Add other transaction configurations...
]);
return await fcl.decode(response);
}
Dictionary
import * as t from "@onflow/types"
sdk.build([
sdk.args([
sdk.arg(
[
{key: 1, value: "one"},
{key: 2, value: "two"},
],
t.Dictionary({key: t.Int, value: t.String})
)
])
])
sdk.build([
sdk.args([
sdk.arg(
[
{key: "a", value: "one"},
{key: "b", value: "two"},
],
t.Dictionary({key: t.String, value: t.String})
)
])
])
When generating JS | TS binding files, support Dictionary of simple types like String and Int
Look into getting json-cadence both parameters and return types and convert to types.
TODO: Verify this code example:
https://github.com/onflow/fcl-js/blob/master/packages/types/README.md?plain=1#L348
Dictionary