JS | TS generator, Support Dictionary Cadence parameter types
Open
@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);
}
- from fcl-js types
https://github.com/onflow/fcl-js/blob/master/packages/types/README.md?plain=1#L348
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.