nba-smart-contracts icon indicating copy to clipboard operation
nba-smart-contracts copied to clipboard

FEATURE: Javascript templates and contracts package

Open joshuahannan opened this issue 4 years ago • 2 comments

Issue To Be Solved

We current have a go package for getting transaction templates, but we should also have a javascript package so users of the contracts can import and use the correct versions without having to copy and paste.

Suggest A Solution

Create a lib/go/javascript/templates package that does a similar thing to the lib/go/templates package. It should use the transactions and scripts in transactions/ as a source of truth, replace the import addresses with user provided addresses, and return the correct transaction texts.

joshuahannan avatar Feb 04 '21 17:02 joshuahannan

might be able to help with this one but i think i need some more deets. is this just string replacing the addresses? also is this for a node environment?

marcusmolchany avatar Feb 23 '21 05:02 marcusmolchany

Thank you for offering to help @marcusmolchany! Yeah, I kind of just intended it for string replacing the addresses, but there is another PR in the core contracts repo that someone else was working on for this exact feature that might be useful to you: https://github.com/onflow/flow-core-contracts/pull/116 You could potentially connect with Max (the author) and discuss what you think might be best for something like this.

There also were some recent features added to the CLI to allow importing contracts from files that serve as aliases for addresses on different networks: https://github.com/onflow/flow-cli/issues/30 so there are some ideas to start using something like that instead of string replacing. Example in the kitty items repo here: https://github.com/onflow/kitty-items/pull/32

I apologize for the deluge of information. We'd love your input on these if you'd like to contribute! And we'll definitely need help converting this repo to use something like that when the designs are more finalized.

Thanks again for reaching out! 😃

joshuahannan avatar Feb 23 '21 18:02 joshuahannan