Skip to main content

Solana

One of the main reasons Solana has gained significant traction is the power PDAs bring to building dApps. The CIDL defines a specific section where a seed definition can be specified.

tip

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

tip

Seeds can be linked to inputs or signers, this ensures us that inputs being received in stubs are used to derive the PDA. To learn more about this check Solana Linked Seed Guide

Definition

solana is a key-value object where each key is a definition or configuration specific to Solana. For now, the only possible definition is seeds.

solana:
seeds:
StaticPDA:
items:
- name: "Static Value"
DynamicPDA:
items:
- name: "Static Value"
- name: dynamic
type: u8
PDAWithAllTypes:
items:
- name: u8_type
type: u8
- name: u16_type
type: u16
- name: u32_type
type: u32
- name: u64_type
type: u64
- name: i8_type
type: i8
- name: i16_type
type: i16
- name: i32_type
type: i32
- name: i64_type
type: i64
- name: string_type
type: string
- name: pubkey_type
type: sol:pubkey
KeywordTypeOptionalityDescription
solanaSolanaBodyOptional
Solana Body
KeywordTypeOptionalityDescription
seedsMap<SeedKey, SeedBody>Optional

Seed Key

Seed name <seed-name> must comply with the targeted programming language. The Seed name is the key to the seed object map, and is used to identify the seed definition within the method definition.

Seed Body

The seed body object defines additional keywords to describe the seed

KeywordTypeOptionalityDescription
itemsArray<ItemBody>RequiredAn array of items through which we can define the static and dynamic seeds
Item Body

An item that is part of the seeds array. An item can be a literal static value or a dynamic value. Dynamic value are set on runtime.

KeywordTypeOptionalityDescription
namestringRequiredA literal value or a variable for when the item is dynamic. If the item is dynamic the variable name must comply with the targeted programming language
typenative | extendedOptionalThe seed type of this property.

Web-based documentation

The solana 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

You can follow our guides to start implementing use cases step by step or check our examples here

Join the Código community 💚

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