Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Multi-network template generation fails #13

Open
bartolomej opened this issue Dec 9, 2023 · 2 comments
Open

[BUG] Multi-network template generation fails #13

bartolomej opened this issue Dec 9, 2023 · 2 comments
Assignees

Comments

@bartolomej
Copy link

bartolomej commented Dec 9, 2023

Current Behavior

Calling await FLIXGenerators.template(...) with dependencies from multiple networks (testnet and mainnet) will result in error:

 throw new HTTPRequestError({
            ^

HTTPRequestError [HTTP Request Error]: 
      HTTP Request Error: An error occurred when interacting with the Access API.
      error=rpc error: code = InvalidArgument desc = address 8f9231920da9af6d is invalid for chain flow-testnet
      hostname=https://rest-testnet.onflow.org
      path=/v1/accounts/8f9231920da9af6d?block_height=138556193&expand=contracts,keys
      method=GET
      
      responseBody={
        "code": 400,
        "message": "rpc error: code = InvalidArgument desc = address 8f9231920da9af6d is invalid for chain flow-testnet"
}
      responseStatusText=Bad Request
      statusCode=400

Expected Behavior

I understand this is probably happening because I can only configure FCL for one network at a time (which I need to do to call FLIXGenerators.template), so it can't resolve addresses from other networks.

But I wonder if there is a way we could avoid this limitation so that multi-network template generation would still work in this way.

Otherwise, I believe developers would need to first generate templates for each network separately and then combine them.

For reference, this is the code I'm using: blocto/flow-transactions#60.

Steps To Reproduce

Run this script: https://github.com/onflowser/blocto-flow-transactions/blob/flix-migration/internal/migrateToFlix.js

What are you currently working on that this is blocking?

I'm trying to migrate Blocto's transaction collection to FLIX (blocto/flow-transactions#59).

@bthaile
Copy link

bthaile commented Dec 11, 2023

would it be easier to use flow-cli to generate flix, it uses flow.json, if deployed contracts are configured then the flix will be populated for all networks.

https://developers.flow.com/tools/flow-cli/flix

Also, we are working on flix version 1.1, which has a different structure. I'll be released using flow-cli initially. Not sure when fcl will support flix version 1.1.

@bartolomej
Copy link
Author

would it be easier to use flow-cli to generate flix, it uses flow.json, if deployed contracts are configured then the flix will be populated for all networks.

Hmm, looks like this could work if we generate flow.json with deployed contracts info instead of providing that to the dependencies array directly when using flow-interaction-template-tools. But that would require a re-implementation of the current migration script in our specific use case.

Will try that out!

Also, we are working on flix version 1.1, which has a different structure. I'll be released using flow-cli initially. Not sure when fcl will support flix version 1.1.

I'm aware of that. My hope is that I can generate FLIX v1.0 structure and merge it to https://github.com/onflow/flow-interaction-template-service repo to be stored with other FLIX v1.0 templates. And later we could write another migration script to migrate all FLIX v1.0 templates to FLIX v1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants