Support usage of Cadence `.cdc` files as JS objects and address replacement via `flow.json`
See original GitHub issueInstructions
Issue To Be Solved
As a developer new to Flow, I want to be able to:
- Use a single source of truth for all my contract code and configuration so I don’t need to repeat configurations in the
fcl.configfor things like address replacements based on network so when switching between local and live networks, there should be little to no additional logic or configuration required past theflow.json. - Import my cadence files into my JS project without needing to write additional code so that I’m able to focus on the logic of my contracts as I develop and not need to manage
.cdcfiles in bespoke ways. - Use the code in the Cadence files as direct inputs to FCL
queryandmutateinterfaces in thecadencefield. - Have all the updates to any changes in
.cdcfiles be reflected in realtime when developing.
Solution - TBD
Freshmint is using webpack and onflow/cadut to achieve similar functionality: https://github.com/packagelabs/freshmint/tree/alpha/packages/cadence-loader
We would like to do something similar.
Requirements
- We should not bloat the FCL package such that it impacts current FCL users in their page load times, etc.
- The network defined in
fcl.configshould determine which addresses are replaced (usingflow.json) - The developer should have a script they can run
npm fcl compile --devto manually bundle their cadence or have it watch for changes to any .cdc files in thecadencefolder of the project. We should try to minimize the time it takes to rebuild. - The solution should be compatible (or easily configurable) with most if not all common JS frameworks, however, it should be highly optimized for any React-based project.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
JSON-Cadence Data Interchange Format - Flow Developers
JSON -Cadence is a data interchange format used to represent Cadence values as language-independent JSON objects.
Read more >onflow/flow-core-contracts: Cadence smart contracts ... - GitHub
This is the contract that defines the network token for Flow. This token is used for account creation fees, transaction fees, staking, and...
Read more >How to Create NFTs Like NBA Top Shot With Flow and IPFS
json file that we will be making use of soon. First, create a folder called cadence . Within that folder, add another folder...
Read more >Working with JSON - Learn web development | MDN
Even though it closely resembles JavaScript object literal syntax, it can be used independently from JavaScript, and many programming ...
Read more >Untitled
Adelaide zoo address, Mersin anamur son dakika haberleri, Panis et circenses caetano veloso, Esprit d'initiative exemple, Zalozenie spolki zoo przez ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I firmly belive that a cadence/blockchain dev should not have to be a frontend dev. And the other way around.
Cadence code should be tested and verified long before it hits the ui.
Many devs currently hold both hats but encouraging patterns where that is always the case is not optimal in my view.
Overflow has this. We use it in .find