question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support usage of Cadence `.cdc` files as JS objects and address replacement via `flow.json`

See original GitHub issue

Instructions

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.config for 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 the flow.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 .cdc files in bespoke ways.
  • Use the code in the Cadence files as direct inputs to FCL query and mutate interfaces in the cadence field.
  • Have all the updates to any changes in .cdc files 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.config should determine which addresses are replaced (using flow.json)
  • The developer should have a script they can run npm fcl compile --dev to manually bundle their cadence or have it watch for changes to any .cdc files in the cadence folder 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:open
  • Created a year ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bjartekcommented, Nov 12, 2022

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.

1reaction
bjartekcommented, Nov 12, 2022

@bluesign not sure if CLI is the place for that, because I don’t want it to become a build tool for all possible languages, but I feel the notion of leaving that to be solved by existing built tools for languages would be better.

Overflow has this. We use it in .find

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found