Skip to content

Conversation

@chasefleming
Copy link
Member

This adds import alias support to Flowkit, allowing contracts to be imported under different names while referencing a canonical contract's source code.

Example

flow.json Configuration

{
  "contracts": {
    "FUSD": {
      "source": "./contracts/FUSD.cdc",
      "aliases": {
        "testnet": "0x9a0766d93b6608b7",
        "mainnet": "0x3c5959b568896393"
      }
    },
    "FUSD1": {
      "source": "./contracts/FUSD.cdc",
      "aliases": {
        "testnet": "0xe223d8a629e49c68",
        "mainnet": "0x8d0e87b65159ae63"
      },
      "canonical": "FUSD"
    },
    "FUSD2": {
      "source": "./contracts/FUSD.cdc", 
      "aliases": {
        "testnet": "0x0f9df91c9121c460",
        "mainnet": "0x754a90d51a1c8e1b"
      },
      "canonical": "FUSD"
    }
  }
}

Import Syntax Conversion

Before Processing:

import "FUSD"
import "FUSD1" 
import "FUSD2"

After Processing by Flowkit:

import FUSD from 0x9a0766d93b6608b7
import FUSD as FUSD1 from 0xe223d8a629e49c68
import FUSD as FUSD2 from 0x0f9df91c9121c460

The canonical contract (FUSD) uses regular import syntax, while alias contracts (FUSD1, FUSD2) use the import X as Y syntax, allowing multiple imports of the same contract with different names.

@chasefleming chasefleming force-pushed the feature/import-aliasing-support branch from dd2c214 to 794c3b1 Compare November 12, 2025 21:06
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 92.50000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
project/imports.go 78.94% 3 Missing and 1 partial ⚠️
state.go 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

Successfully merging this pull request may close these issues.

4 participants