onflow / onflow/flixkit-go

JS | TS generator, Support Dictionary Cadence parameter types

Open
#19 0 comments 0 reactions 1 assignee View on GitHub

@bthaile is already working on this.

Since Oct 21, 2023.

Dominant language
Go
Stars
0
Forks
7
Avg merge
2d 5h
Merged PRs (30d)
2

Description

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})
    )
  ])
])

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.