Skip to main content

Imports

Imports can take your idea and team productivity to the next level 🚀. Through imports, we can reduce the amount of code, we need to write by using CIDLs provided by Código or the community to write composable CIDLs.

tip

You can define any number of imports required for your use case.

tip

Imported CIDL can reference types, methods, and Solana seed definition

Definition

imports is an array of objects where each object is a CIDL that will be imported

imports:
- ref: compression
loc: ./solana_state_compression.cidl
solana:
progid: cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK
note

Currently, loc only supports the file system.

KeywordTypeOptionalityDescription
importsImportsBodyOptional

Imports Body

The import object defines from where the CIDL is being imported

KeywordTypeOptionalityDescription
refstringRequiredReference name. Used as a prefix when an element of this CIDL is used locally. Each ref has to be unique
locstringRequiredLocation of the CIDL. The location can be: Local File System, URL (GitHub, HTTP), CIDL Hub. Locations can include a version indicator to lock the external CIDL to a stable version
solanaSolanaRequired
Solana Import Extension

The solana import extension object defines the additional configuration for the CIDL import

KeywordTypeOptionalityDescription
progidPublicKeyRequiredThe Program ID ( as a Public Key ) of the Program generated by the imported CIDL.

Web-based documentation

The imports object can be visualized in the CIDL web-based doc. The documentation is automatically generated from our vscode-codigo extension.

CIDL Web-based doc

Next steps

We are almost done with this learning path that began with the documentation on native and extended data types, read about native and extended data types here. To finalize this journey follow the following links:

Join the Código community 💚

Código is a growing community of developers. Join us on Discord and GitHub