Showing preview only (4,884K chars total). Download the full file or copy to clipboard to get everything.
Repository: codama-idl/codama
Branch: main
Commit: 394e9b6afb6e
Files: 1211
Total size: 4.4 MB
Directory structure:
gitextract_ki3ckuuc/
├── .changeset/
│ ├── README.md
│ └── config.json
├── .github/
│ ├── actions/
│ │ └── setup-anchor/
│ │ └── action.yml
│ ├── dependabot.yml
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .prettierignore
├── LICENSE
├── README.md
├── eslint.config.mjs
├── package.json
├── packages/
│ ├── cli/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bin/
│ │ │ └── cli.cjs
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── cli/
│ │ │ │ └── index.ts
│ │ │ ├── commands/
│ │ │ │ ├── convert.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── init.ts
│ │ │ │ └── run.ts
│ │ │ ├── config.ts
│ │ │ ├── index.ts
│ │ │ ├── parsedConfig.ts
│ │ │ ├── program.ts
│ │ │ ├── programOptions.ts
│ │ │ ├── types/
│ │ │ │ └── global.d.ts
│ │ │ └── utils/
│ │ │ ├── childCommands.ts
│ │ │ ├── errors.ts
│ │ │ ├── fs.ts
│ │ │ ├── import.ts
│ │ │ ├── index.ts
│ │ │ ├── logs.ts
│ │ │ ├── nodes.ts
│ │ │ ├── packageInstall.ts
│ │ │ ├── packageJson.ts
│ │ │ ├── packageManager.ts
│ │ │ ├── promises.ts
│ │ │ ├── prompts.ts
│ │ │ └── visitors.ts
│ │ ├── test/
│ │ │ ├── exports/
│ │ │ │ ├── commonjs.cjs
│ │ │ │ ├── mock-config.json
│ │ │ │ ├── mock-idl.json
│ │ │ │ └── module.mjs
│ │ │ └── index.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── dynamic-client/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bin/
│ │ │ └── cli.cjs
│ │ ├── package.json
│ │ ├── scripts/
│ │ │ └── generate-idl-from-anchor.mjs
│ │ ├── src/
│ │ │ ├── cli/
│ │ │ │ ├── commands/
│ │ │ │ │ ├── generate-client-types/
│ │ │ │ │ │ ├── generate-client-types-from-file.ts
│ │ │ │ │ │ ├── generate-client-types.ts
│ │ │ │ │ │ └── register-command.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── program.ts
│ │ │ ├── index.ts
│ │ │ ├── instruction-encoding/
│ │ │ │ ├── accounts/
│ │ │ │ │ ├── create-account-meta.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ └── validate-accounts-input.ts
│ │ │ │ ├── arguments/
│ │ │ │ │ ├── encode-instruction-arguments.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── resolve-argument-from-custom-resolvers.ts
│ │ │ │ │ ├── shared.ts
│ │ │ │ │ └── validate-arguments-input.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── instructions.ts
│ │ │ │ ├── resolvers/
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── resolve-account-address.ts
│ │ │ │ │ ├── resolve-account-value-node-address.ts
│ │ │ │ │ ├── resolve-conditional.ts
│ │ │ │ │ ├── resolve-pda-address.ts
│ │ │ │ │ └── types.ts
│ │ │ │ ├── validators.ts
│ │ │ │ └── visitors/
│ │ │ │ ├── account-default-value.ts
│ │ │ │ ├── condition-node-value.ts
│ │ │ │ ├── default-value-encoder.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── input-value-transformer.ts
│ │ │ │ ├── pda-seed-value.ts
│ │ │ │ └── value-node-value.ts
│ │ │ ├── program-client/
│ │ │ │ ├── collect-pdas.ts
│ │ │ │ ├── create-program-client.ts
│ │ │ │ ├── derive-standalone-pda.ts
│ │ │ │ └── methods-builder.ts
│ │ │ ├── shared/
│ │ │ │ ├── address.ts
│ │ │ │ ├── bytes-encoding.ts
│ │ │ │ ├── codecs.ts
│ │ │ │ ├── nodes.ts
│ │ │ │ ├── types.ts
│ │ │ │ └── util.ts
│ │ │ └── types/
│ │ │ └── index.ts
│ │ ├── test/
│ │ │ ├── programs/
│ │ │ │ ├── anchor/
│ │ │ │ │ ├── Anchor.toml
│ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ ├── programs/
│ │ │ │ │ │ ├── blog/
│ │ │ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ │ │ ├── Xargo.toml
│ │ │ │ │ │ │ └── src/
│ │ │ │ │ │ │ └── lib.rs
│ │ │ │ │ │ └── example/
│ │ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ │ ├── Xargo.toml
│ │ │ │ │ │ └── src/
│ │ │ │ │ │ ├── lib.rs
│ │ │ │ │ │ └── nested_example.rs
│ │ │ │ │ ├── rust-toolchain.toml
│ │ │ │ │ └── tests/
│ │ │ │ │ ├── blog.test.ts
│ │ │ │ │ ├── example.test.ts
│ │ │ │ │ ├── helpers.ts
│ │ │ │ │ └── nested-example-ix.test.ts
│ │ │ │ ├── associated-token-account/
│ │ │ │ │ ├── ata-test-utils.ts
│ │ │ │ │ ├── create-idempotent.test.ts
│ │ │ │ │ ├── create.test.ts
│ │ │ │ │ └── recover-nested.test.ts
│ │ │ │ ├── circular-account-refs/
│ │ │ │ │ └── circular-account-refs.test.ts
│ │ │ │ ├── collection-types/
│ │ │ │ │ └── collection-types.test.ts
│ │ │ │ ├── custom-resolvers/
│ │ │ │ │ ├── account-resolver.test.ts
│ │ │ │ │ ├── argument-resolvers.test.ts
│ │ │ │ │ └── custom-resolvers-test-utils.ts
│ │ │ │ ├── idls/
│ │ │ │ │ ├── associated-token-account-idl.json
│ │ │ │ │ ├── blog-idl.json
│ │ │ │ │ ├── circular-account-refs-idl.json
│ │ │ │ │ ├── collection-types-idl.json
│ │ │ │ │ ├── custom-resolvers-test-idl.json
│ │ │ │ │ ├── example-idl.json
│ │ │ │ │ ├── mpl-token-metadata-idl.json
│ │ │ │ │ ├── pmp-idl.json
│ │ │ │ │ ├── sas-idl.json
│ │ │ │ │ ├── system-program-idl.json
│ │ │ │ │ ├── token-2022-idl.json
│ │ │ │ │ └── token-idl.json
│ │ │ │ ├── mpl-token-metadata/
│ │ │ │ │ ├── create-with-resolvers.test.ts
│ │ │ │ │ ├── create.test.ts
│ │ │ │ │ └── helpers.ts
│ │ │ │ ├── pmp/
│ │ │ │ │ ├── allocate.test.ts
│ │ │ │ │ ├── close.test.ts
│ │ │ │ │ ├── extend.test.ts
│ │ │ │ │ ├── helpers.ts
│ │ │ │ │ ├── initialize.test.ts
│ │ │ │ │ ├── pdas.test.ts
│ │ │ │ │ ├── set-authority.test.ts
│ │ │ │ │ ├── set-data.test.ts
│ │ │ │ │ ├── set-immutable.test.ts
│ │ │ │ │ ├── trim.test.ts
│ │ │ │ │ └── write.test.ts
│ │ │ │ ├── sas/
│ │ │ │ │ ├── change-authorized-signers.test.ts
│ │ │ │ │ ├── change-schema-description.test.ts
│ │ │ │ │ ├── change-schema-status.test.ts
│ │ │ │ │ ├── change-schema-version.test.ts
│ │ │ │ │ ├── close-attestation.test.ts
│ │ │ │ │ ├── close-tokenized-attestation.test.ts
│ │ │ │ │ ├── create-attestation.test.ts
│ │ │ │ │ ├── create-credential.test.ts
│ │ │ │ │ ├── create-schema.test.ts
│ │ │ │ │ ├── create-tokenized-attestation.test.ts
│ │ │ │ │ ├── sas-test-utils.ts
│ │ │ │ │ └── tokenize-schema.test.ts
│ │ │ │ ├── system-program/
│ │ │ │ │ ├── advance-nonce-account.test.ts
│ │ │ │ │ ├── allocate-with-seed.test.ts
│ │ │ │ │ ├── allocate.test.ts
│ │ │ │ │ ├── assign-with-seed.test.ts
│ │ │ │ │ ├── assign.test.ts
│ │ │ │ │ ├── authorize-nonce-account.test.ts
│ │ │ │ │ ├── create-account-with-seed.test.ts
│ │ │ │ │ ├── create-account.test.ts
│ │ │ │ │ ├── initialize-nonce-account.test.ts
│ │ │ │ │ ├── transfer-sol-with-seed.test.ts
│ │ │ │ │ ├── transfer-sol.test.ts
│ │ │ │ │ ├── upgrade-nonce-account.test.ts
│ │ │ │ │ └── withdraw-nonce-account.test.ts
│ │ │ │ ├── test-utils.ts
│ │ │ │ ├── token/
│ │ │ │ │ ├── amount-to-ui-amount.test.ts
│ │ │ │ │ ├── approve-checked.test.ts
│ │ │ │ │ ├── approve.test.ts
│ │ │ │ │ ├── burn-checked.test.ts
│ │ │ │ │ ├── burn.test.ts
│ │ │ │ │ ├── close-account.test.ts
│ │ │ │ │ ├── freeze-account.test.ts
│ │ │ │ │ ├── get-account-data-size.test.ts
│ │ │ │ │ ├── initialize-account.test.ts
│ │ │ │ │ ├── initialize-account2.test.ts
│ │ │ │ │ ├── initialize-account3.test.ts
│ │ │ │ │ ├── initialize-immutable-owner.test.ts
│ │ │ │ │ ├── initialize-mint.test.ts
│ │ │ │ │ ├── initialize-mint2.test.ts
│ │ │ │ │ ├── initialize-multisig.test.ts
│ │ │ │ │ ├── initialize-multisig2.test.ts
│ │ │ │ │ ├── mint-to-checked.test.ts
│ │ │ │ │ ├── mint-to.test.ts
│ │ │ │ │ ├── revoke.test.ts
│ │ │ │ │ ├── set-authority.test.ts
│ │ │ │ │ ├── sync-native.test.ts
│ │ │ │ │ ├── thaw-account.test.ts
│ │ │ │ │ ├── token-test-utils.ts
│ │ │ │ │ ├── transfer-checked.test.ts
│ │ │ │ │ ├── transfer.test.ts
│ │ │ │ │ └── ui-amount-to-amount.test.ts
│ │ │ │ └── token-2022/
│ │ │ │ ├── amount-to-ui-amount.test.ts
│ │ │ │ ├── approve-checked.test.ts
│ │ │ │ ├── approve.test.ts
│ │ │ │ ├── burn-checked.test.ts
│ │ │ │ ├── burn.test.ts
│ │ │ │ ├── close-account.test.ts
│ │ │ │ ├── confidential-transfer-fee.test.ts
│ │ │ │ ├── confidential-transfer.test.ts
│ │ │ │ ├── create-native-mint.test.ts
│ │ │ │ ├── disable-cpi-guard.test.ts
│ │ │ │ ├── disable-memo-transfers.test.ts
│ │ │ │ ├── freeze-account.test.ts
│ │ │ │ ├── get-account-data-size.test.ts
│ │ │ │ ├── group-member-pointer.test.ts
│ │ │ │ ├── group-pointer.test.ts
│ │ │ │ ├── harvest-withheld-tokens-to-mint.test.ts
│ │ │ │ ├── initialize-account.test.ts
│ │ │ │ ├── initialize-account2.test.ts
│ │ │ │ ├── initialize-account3.test.ts
│ │ │ │ ├── initialize-default-account-state.test.ts
│ │ │ │ ├── initialize-immutable-owner.test.ts
│ │ │ │ ├── initialize-interest-bearing-mint.test.ts
│ │ │ │ ├── initialize-mint-close-authority.test.ts
│ │ │ │ ├── initialize-mint.test.ts
│ │ │ │ ├── initialize-mint2.test.ts
│ │ │ │ ├── initialize-multisig.test.ts
│ │ │ │ ├── initialize-multisig2.test.ts
│ │ │ │ ├── initialize-non-transferable-mint.test.ts
│ │ │ │ ├── initialize-permanent-delegate.test.ts
│ │ │ │ ├── metadata-pointer.test.ts
│ │ │ │ ├── mint-to-checked.test.ts
│ │ │ │ ├── mint-to.test.ts
│ │ │ │ ├── pausable.test.ts
│ │ │ │ ├── reallocate.test.ts
│ │ │ │ ├── revoke.test.ts
│ │ │ │ ├── scaled-ui-amount.test.ts
│ │ │ │ ├── set-authority.test.ts
│ │ │ │ ├── sync-native.test.ts
│ │ │ │ ├── thaw-account.test.ts
│ │ │ │ ├── token-2022-test-utils.ts
│ │ │ │ ├── token-group.test.ts
│ │ │ │ ├── token-metadata.test.ts
│ │ │ │ ├── transfer-checked.test.ts
│ │ │ │ ├── transfer-fee.test.ts
│ │ │ │ ├── transfer-hook.test.ts
│ │ │ │ ├── transfer.test.ts
│ │ │ │ ├── ui-amount-to-amount.test.ts
│ │ │ │ ├── update-default-account-state.test.ts
│ │ │ │ ├── update-rate-interest-bearing-mint.test.ts
│ │ │ │ ├── withdraw-excess-lamports.test.ts
│ │ │ │ └── withdraw-withheld-tokens.test.ts
│ │ │ ├── svm-test-context.ts
│ │ │ └── unit/
│ │ │ ├── cli/
│ │ │ │ ├── generate-program-client-types.test.ts
│ │ │ │ └── program-client-types.test.ts
│ │ │ ├── instruction-encoding/
│ │ │ │ ├── arguments.test.ts
│ │ │ │ ├── create-account-meta.test.ts
│ │ │ │ └── validators.test.ts
│ │ │ ├── program-client/
│ │ │ │ └── create-program-client.test.ts
│ │ │ ├── resolvers/
│ │ │ │ ├── resolve-account-value-node-address/
│ │ │ │ │ ├── resolve-account-value-node-address.test.ts
│ │ │ │ │ └── types.test.ts
│ │ │ │ └── resolve-conditional.test.ts
│ │ │ ├── shared/
│ │ │ │ ├── address.test.ts
│ │ │ │ ├── bytes-encoding.test.ts
│ │ │ │ ├── codecs.test.ts
│ │ │ │ ├── types.test.ts
│ │ │ │ └── util.test.ts
│ │ │ └── visitors/
│ │ │ ├── account-default-value/
│ │ │ │ ├── account-default-value-test-utils.ts
│ │ │ │ ├── accountBumpValueNode.test.ts
│ │ │ │ ├── accountValueNode.test.ts
│ │ │ │ ├── argumentValueNode.test.ts
│ │ │ │ ├── conditionalValueNode.test.ts
│ │ │ │ ├── identityValueNode.test.ts
│ │ │ │ ├── payerValueNode.test.ts
│ │ │ │ ├── pdaValueNode.test.ts
│ │ │ │ ├── programIdValueNode.test.ts
│ │ │ │ ├── publicKeyValueNode.test.ts
│ │ │ │ └── resolverValueNode.test.ts
│ │ │ ├── condition-node-value/
│ │ │ │ ├── accountValueNode.test.ts
│ │ │ │ ├── argumentValueNode.test.ts
│ │ │ │ ├── condition-node-value-test-utils.ts
│ │ │ │ └── resolverValueNode.test.ts
│ │ │ ├── default-value-encoder/
│ │ │ │ ├── booleanValueNode.test.ts
│ │ │ │ ├── bytesValueNode.test.ts
│ │ │ │ ├── default-value-encoder-test-utils.ts
│ │ │ │ ├── enumValueNode.test.ts
│ │ │ │ ├── noneValueNode.test.ts
│ │ │ │ ├── numberValueNode.test.ts
│ │ │ │ ├── publicKeyValueNode.test.ts
│ │ │ │ └── stringValueNode.test.ts
│ │ │ ├── input-value-transformer/
│ │ │ │ ├── amountTypeNode.test.ts
│ │ │ │ ├── arrayTypeNode.test.ts
│ │ │ │ ├── booleanTypeNode.test.ts
│ │ │ │ ├── bytesTypeNode.test.ts
│ │ │ │ ├── dateTimeTypeNode.test.ts
│ │ │ │ ├── definedTypeLinkNode.test.ts
│ │ │ │ ├── enumTypeNode.test.ts
│ │ │ │ ├── fixedSizeTypeNode.test.ts
│ │ │ │ ├── hiddenPrefixTypeNode.test.ts
│ │ │ │ ├── hiddenSuffixTypeNode.test.ts
│ │ │ │ ├── input-value-transformer-test-utils.ts
│ │ │ │ ├── mapTypeNode.test.ts
│ │ │ │ ├── numberTypeNode.test.ts
│ │ │ │ ├── optionTypeNode.test.ts
│ │ │ │ ├── postOffsetTypeNode.test.ts
│ │ │ │ ├── preOffsetTypeNode.test.ts
│ │ │ │ ├── publicKeyTypeNode.test.ts
│ │ │ │ ├── remainderOptionTypeNode.test.ts
│ │ │ │ ├── sentinelTypeNode.test.ts
│ │ │ │ ├── setTypeNode.test.ts
│ │ │ │ ├── sizePrefixTypeNode.test.ts
│ │ │ │ ├── solAmountTypeNode.test.ts
│ │ │ │ ├── stringTypeNode.test.ts
│ │ │ │ ├── structTypeNode.test.ts
│ │ │ │ ├── tupleTypeNode.test.ts
│ │ │ │ └── zeroableOptionTypeNode.test.ts
│ │ │ ├── pda-seed-value/
│ │ │ │ ├── accountValueNode.test.ts
│ │ │ │ ├── argumentValueNode.test.ts
│ │ │ │ ├── booleanValueNode.test.ts
│ │ │ │ ├── bytesValueNode.test.ts
│ │ │ │ ├── constantValueNode.test.ts
│ │ │ │ ├── noneValueNode.test.ts
│ │ │ │ ├── numberValueNode.test.ts
│ │ │ │ ├── pda-seed-value-test-utils.ts
│ │ │ │ ├── programIdValueNode.test.ts
│ │ │ │ ├── publicKeyValueNode.test.ts
│ │ │ │ ├── someValueNode.test.ts
│ │ │ │ └── stringValueNode.test.ts
│ │ │ └── value-node-value/
│ │ │ ├── arrayValueNode.test.ts
│ │ │ ├── booleanValueNode.test.ts
│ │ │ ├── bytesValueNode.test.ts
│ │ │ ├── constantValueNode.test.ts
│ │ │ ├── enumValueNode.test.ts
│ │ │ ├── mapValueNode.test.ts
│ │ │ ├── noneValueNode.test.ts
│ │ │ ├── numberValueNode.test.ts
│ │ │ ├── publicKeyValueNode.test.ts
│ │ │ ├── setValueNode.test.ts
│ │ │ ├── someValueNode.test.ts
│ │ │ ├── stringValueNode.test.ts
│ │ │ ├── structValueNode.test.ts
│ │ │ ├── tupleValueNode.test.ts
│ │ │ └── value-node-value-test-utils.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.cli.config.ts
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── dynamic-codecs/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── codecs.ts
│ │ │ ├── index.ts
│ │ │ ├── types/
│ │ │ │ └── global.d.ts
│ │ │ └── values.ts
│ │ ├── test/
│ │ │ ├── _setup.ts
│ │ │ ├── codecs/
│ │ │ │ ├── AccountNode.test.ts
│ │ │ │ ├── ArrayTypeNode.test.ts
│ │ │ │ ├── BooleanTypeNode.test.ts
│ │ │ │ ├── BytesTypeNode.test.ts
│ │ │ │ ├── DefinedTypeLinkNode.test.ts
│ │ │ │ ├── DefinedTypeNode.test.ts
│ │ │ │ ├── EnumTypeNode.test.ts
│ │ │ │ ├── EventNode.test.ts
│ │ │ │ ├── FixedSizeTypeNode.test.ts
│ │ │ │ ├── HiddenPrefixTypeNode.test.ts
│ │ │ │ ├── HiddenSuffixTypeNode.test.ts
│ │ │ │ ├── InstructionArgumentNode.test.ts
│ │ │ │ ├── InstructionNode.test.ts
│ │ │ │ ├── MapTypeNode.test.ts
│ │ │ │ ├── NumberTypeNode.test.ts
│ │ │ │ ├── OptionTypeNode.test.ts
│ │ │ │ ├── PostOffsetTypeNode.test.ts
│ │ │ │ ├── PreOffsetTypeNode.test.ts
│ │ │ │ ├── PublicKeyTypeNode.test.ts
│ │ │ │ ├── RemainderOptionTypeNode.test.ts
│ │ │ │ ├── SentinelTypeNode.test.ts
│ │ │ │ ├── SetTypeNode.test.ts
│ │ │ │ ├── SizePrefixTypeNode.test.ts
│ │ │ │ ├── StringTypeNode.test.ts
│ │ │ │ ├── StructFieldTypeNode.test.ts
│ │ │ │ ├── StructTypeNode.test.ts
│ │ │ │ ├── TupleTypeNode.test.ts
│ │ │ │ └── ZeroableOptionTypeNode.test.ts
│ │ │ ├── types/
│ │ │ │ └── global.d.ts
│ │ │ └── values/
│ │ │ ├── ArrayValueNode.test.ts
│ │ │ ├── BytesValueNode.test.ts
│ │ │ ├── ConstantValueNode.test.ts
│ │ │ ├── EnumValueNode.test.ts
│ │ │ ├── MapValueNode.test.ts
│ │ │ ├── NoneValueNode.test.ts
│ │ │ ├── NumberValueNode.test.ts
│ │ │ ├── PublicKeyValueNode.test.ts
│ │ │ ├── SetValueNode.test.ts
│ │ │ ├── SomeValueNode.test.ts
│ │ │ ├── StringValueNode.test.ts
│ │ │ ├── StructValueNode.test.ts
│ │ │ └── TupleValueNode.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── dynamic-parsers/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── discriminators.ts
│ │ │ ├── identify.ts
│ │ │ ├── index.ts
│ │ │ ├── parsers.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── test/
│ │ │ ├── _setup.ts
│ │ │ ├── discriminators.test.ts
│ │ │ ├── identify.test.ts
│ │ │ ├── parsers.test.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── errors/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bin/
│ │ │ └── cli.cjs
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── cli/
│ │ │ │ └── index.ts
│ │ │ ├── codes.ts
│ │ │ ├── context.ts
│ │ │ ├── error.ts
│ │ │ ├── index.ts
│ │ │ ├── logs.ts
│ │ │ ├── message-formatter.ts
│ │ │ ├── messages.ts
│ │ │ ├── stack-trace.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── test/
│ │ │ ├── error.test.ts
│ │ │ ├── error.typetest.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── library/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bin/
│ │ │ └── cli.cjs
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── cli/
│ │ │ │ └── index.ts
│ │ │ ├── codama.ts
│ │ │ ├── index.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── test/
│ │ │ └── index.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── node-types/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AccountNode.ts
│ │ │ ├── DefinedTypeNode.ts
│ │ │ ├── ErrorNode.ts
│ │ │ ├── EventNode.ts
│ │ │ ├── InstructionAccountNode.ts
│ │ │ ├── InstructionArgumentNode.ts
│ │ │ ├── InstructionByteDeltaNode.ts
│ │ │ ├── InstructionNode.ts
│ │ │ ├── InstructionRemainingAccountsNode.ts
│ │ │ ├── InstructionStatusNode.ts
│ │ │ ├── Node.ts
│ │ │ ├── PdaNode.ts
│ │ │ ├── ProgramNode.ts
│ │ │ ├── RootNode.ts
│ │ │ ├── contextualValueNodes/
│ │ │ │ ├── AccountBumpValueNode.ts
│ │ │ │ ├── AccountValueNode.ts
│ │ │ │ ├── ArgumentValueNode.ts
│ │ │ │ ├── ConditionalValueNode.ts
│ │ │ │ ├── ContextualValueNode.ts
│ │ │ │ ├── IdentityValueNode.ts
│ │ │ │ ├── PayerValueNode.ts
│ │ │ │ ├── PdaSeedValueNode.ts
│ │ │ │ ├── PdaValueNode.ts
│ │ │ │ ├── ProgramIdValueNode.ts
│ │ │ │ ├── ResolverValueNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── countNodes/
│ │ │ │ ├── CountNode.ts
│ │ │ │ ├── FixedCountNode.ts
│ │ │ │ ├── PrefixedCountNode.ts
│ │ │ │ ├── RemainderCountNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── discriminatorNodes/
│ │ │ │ ├── ConstantDiscriminatorNode.ts
│ │ │ │ ├── DiscriminatorNode.ts
│ │ │ │ ├── FieldDiscriminatorNode.ts
│ │ │ │ ├── SizeDiscriminatorNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── index.ts
│ │ │ ├── linkNodes/
│ │ │ │ ├── AccountLinkNode.ts
│ │ │ │ ├── DefinedTypeLinkNode.ts
│ │ │ │ ├── InstructionAccountLinkNode.ts
│ │ │ │ ├── InstructionArgumentLinkNode.ts
│ │ │ │ ├── InstructionLinkNode.ts
│ │ │ │ ├── LinkNode.ts
│ │ │ │ ├── PdaLinkNode.ts
│ │ │ │ ├── ProgramLinkNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── pdaSeedNodes/
│ │ │ │ ├── ConstantPdaSeedNode.ts
│ │ │ │ ├── PdaSeedNode.ts
│ │ │ │ ├── VariablePdaSeedNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── shared/
│ │ │ │ ├── bytesEncoding.ts
│ │ │ │ ├── docs.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── instructionLifecycle.ts
│ │ │ │ ├── stringCases.ts
│ │ │ │ └── version.ts
│ │ │ ├── typeNodes/
│ │ │ │ ├── AmountTypeNode.ts
│ │ │ │ ├── ArrayTypeNode.ts
│ │ │ │ ├── BooleanTypeNode.ts
│ │ │ │ ├── BytesTypeNode.ts
│ │ │ │ ├── DateTimeTypeNode.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.ts
│ │ │ │ ├── EnumStructVariantTypeNode.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.ts
│ │ │ │ ├── EnumTypeNode.ts
│ │ │ │ ├── EnumVariantTypeNode.ts
│ │ │ │ ├── FixedSizeTypeNode.ts
│ │ │ │ ├── HiddenPrefixTypeNode.ts
│ │ │ │ ├── HiddenSuffixTypeNode.ts
│ │ │ │ ├── MapTypeNode.ts
│ │ │ │ ├── NestedTypeNode.ts
│ │ │ │ ├── NumberTypeNode.ts
│ │ │ │ ├── OptionTypeNode.ts
│ │ │ │ ├── PostOffsetTypeNode.ts
│ │ │ │ ├── PreOffsetTypeNode.ts
│ │ │ │ ├── PublicKeyTypeNode.ts
│ │ │ │ ├── RemainderOptionTypeNode.ts
│ │ │ │ ├── SentinelTypeNode.ts
│ │ │ │ ├── SetTypeNode.ts
│ │ │ │ ├── SizePrefixTypeNode.ts
│ │ │ │ ├── SolAmountTypeNode.ts
│ │ │ │ ├── StringTypeNode.ts
│ │ │ │ ├── StructFieldTypeNode.ts
│ │ │ │ ├── StructTypeNode.ts
│ │ │ │ ├── TupleTypeNode.ts
│ │ │ │ ├── TypeNode.ts
│ │ │ │ ├── ZeroableOptionTypeNode.ts
│ │ │ │ └── index.ts
│ │ │ └── valueNodes/
│ │ │ ├── ArrayValueNode.ts
│ │ │ ├── BooleanValueNode.ts
│ │ │ ├── BytesValueNode.ts
│ │ │ ├── ConstantValueNode.ts
│ │ │ ├── EnumValueNode.ts
│ │ │ ├── MapEntryValueNode.ts
│ │ │ ├── MapValueNode.ts
│ │ │ ├── NoneValueNode.ts
│ │ │ ├── NumberValueNode.ts
│ │ │ ├── PublicKeyValueNode.ts
│ │ │ ├── SetValueNode.ts
│ │ │ ├── SomeValueNode.ts
│ │ │ ├── StringValueNode.ts
│ │ │ ├── StructFieldValueNode.ts
│ │ │ ├── StructValueNode.ts
│ │ │ ├── TupleValueNode.ts
│ │ │ ├── ValueNode.ts
│ │ │ └── index.ts
│ │ ├── test/
│ │ │ └── GetNodeFromKind.typetest.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ └── tsup.config.ts
│ ├── nodes/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── AccountNode.md
│ │ │ ├── DefinedTypeNode.md
│ │ │ ├── ErrorNode.md
│ │ │ ├── EventNode.md
│ │ │ ├── InstructionAccountNode.md
│ │ │ ├── InstructionArgumentNode.md
│ │ │ ├── InstructionByteDeltaNode.md
│ │ │ ├── InstructionNode.md
│ │ │ ├── InstructionRemainingAccountsNode.md
│ │ │ ├── InstructionStatusNode.md
│ │ │ ├── PdaNode.md
│ │ │ ├── ProgramNode.md
│ │ │ ├── README.md
│ │ │ ├── RootNode.md
│ │ │ ├── _template.md
│ │ │ ├── contextualValueNodes/
│ │ │ │ ├── AccountBumpValueNode.md
│ │ │ │ ├── AccountValueNode.md
│ │ │ │ ├── ArgumentValueNode.md
│ │ │ │ ├── ConditionalValueNode.md
│ │ │ │ ├── IdentityValueNode.md
│ │ │ │ ├── InstructionInputValueNode.md
│ │ │ │ ├── PayerValueNode.md
│ │ │ │ ├── PdaSeedValueNode.md
│ │ │ │ ├── PdaValueNode.md
│ │ │ │ ├── ProgramIdValueNode.md
│ │ │ │ ├── README.md
│ │ │ │ └── ResolverValueNode.md
│ │ │ ├── countNodes/
│ │ │ │ ├── FixedCountNode.md
│ │ │ │ ├── PrefixedCountNode.md
│ │ │ │ ├── README.md
│ │ │ │ └── RemainderCountNode.md
│ │ │ ├── discriminatorNodes/
│ │ │ │ ├── ConstantDiscriminatorNode.md
│ │ │ │ ├── FieldDiscriminatorNode.md
│ │ │ │ ├── README.md
│ │ │ │ └── SizeDiscriminatorNode.md
│ │ │ ├── linkNodes/
│ │ │ │ ├── AccountLinkNode.md
│ │ │ │ ├── DefinedTypeLinkNode.md
│ │ │ │ ├── InstructionAccountLinkNode.md
│ │ │ │ ├── InstructionArgumentLinkNode.md
│ │ │ │ ├── InstructionLinkNode.md
│ │ │ │ ├── PdaLinkNode.md
│ │ │ │ ├── ProgramLinkNode.md
│ │ │ │ └── README.md
│ │ │ ├── pdaSeedNodes/
│ │ │ │ ├── ConstantPdaSeedNode.md
│ │ │ │ ├── README.md
│ │ │ │ └── VariablePdaSeedNode.md
│ │ │ ├── typeNodes/
│ │ │ │ ├── AmountTypeNode.md
│ │ │ │ ├── ArrayTypeNode.md
│ │ │ │ ├── BooleanTypeNode.md
│ │ │ │ ├── BytesTypeNode.md
│ │ │ │ ├── DateTimeTypeNode.md
│ │ │ │ ├── EnumEmptyVariantTypeNode.md
│ │ │ │ ├── EnumStructVariantTypeNode.md
│ │ │ │ ├── EnumTupleVariantTypeNode.md
│ │ │ │ ├── EnumTypeNode.md
│ │ │ │ ├── EnumVariantTypeNode.md
│ │ │ │ ├── FixedSizeTypeNode.md
│ │ │ │ ├── HiddenPrefixTypeNode.md
│ │ │ │ ├── HiddenSuffixTypeNode.md
│ │ │ │ ├── MapTypeNode.md
│ │ │ │ ├── NestedTypeNode.md
│ │ │ │ ├── NumberTypeNode.md
│ │ │ │ ├── OptionTypeNode.md
│ │ │ │ ├── PostOffsetTypeNode.md
│ │ │ │ ├── PreOffsetTypeNode.md
│ │ │ │ ├── PublicKeyTypeNode.md
│ │ │ │ ├── README.md
│ │ │ │ ├── RemainderOptionTypeNode.md
│ │ │ │ ├── SentinelTypeNode.md
│ │ │ │ ├── SetTypeNode.md
│ │ │ │ ├── SizePrefixTypeNode.md
│ │ │ │ ├── SolAmountTypeNode.md
│ │ │ │ ├── StringTypeNode.md
│ │ │ │ ├── StructFieldTypeNode.md
│ │ │ │ ├── StructTypeNode.md
│ │ │ │ ├── TupleTypeNode.md
│ │ │ │ └── ZeroableOptionTypeNode.md
│ │ │ └── valueNodes/
│ │ │ ├── ArrayValueNode.md
│ │ │ ├── BooleanValueNode.md
│ │ │ ├── BytesValueNode.md
│ │ │ ├── ConstantValueNode.md
│ │ │ ├── EnumValueNode.md
│ │ │ ├── MapEntryValueNode.md
│ │ │ ├── MapValueNode.md
│ │ │ ├── NoneValueNode.md
│ │ │ ├── NumberValueNode.md
│ │ │ ├── PublicKeyValueNode.md
│ │ │ ├── README.md
│ │ │ ├── SetValueNode.md
│ │ │ ├── SomeValueNode.md
│ │ │ ├── StringValueNode.md
│ │ │ ├── StructFieldValueNode.md
│ │ │ ├── StructValueNode.md
│ │ │ └── TupleValueNode.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AccountNode.ts
│ │ │ ├── DefinedTypeNode.ts
│ │ │ ├── ErrorNode.ts
│ │ │ ├── EventNode.ts
│ │ │ ├── InstructionAccountNode.ts
│ │ │ ├── InstructionArgumentNode.ts
│ │ │ ├── InstructionByteDeltaNode.ts
│ │ │ ├── InstructionNode.ts
│ │ │ ├── InstructionRemainingAccountsNode.ts
│ │ │ ├── InstructionStatusNode.ts
│ │ │ ├── Node.ts
│ │ │ ├── PdaNode.ts
│ │ │ ├── ProgramNode.ts
│ │ │ ├── RootNode.ts
│ │ │ ├── contextualValueNodes/
│ │ │ │ ├── AccountBumpValueNode.ts
│ │ │ │ ├── AccountValueNode.ts
│ │ │ │ ├── ArgumentValueNode.ts
│ │ │ │ ├── ConditionalValueNode.ts
│ │ │ │ ├── ContextualValueNode.ts
│ │ │ │ ├── IdentityValueNode.ts
│ │ │ │ ├── PayerValueNode.ts
│ │ │ │ ├── PdaSeedValueNode.ts
│ │ │ │ ├── PdaValueNode.ts
│ │ │ │ ├── ProgramIdValueNode.ts
│ │ │ │ ├── ResolverValueNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── countNodes/
│ │ │ │ ├── CountNode.ts
│ │ │ │ ├── FixedCountNode.ts
│ │ │ │ ├── PrefixedCountNode.ts
│ │ │ │ ├── RemainderCountNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── discriminatorNodes/
│ │ │ │ ├── ConstantDiscriminatorNode.ts
│ │ │ │ ├── DiscriminatorNode.ts
│ │ │ │ ├── FieldDiscriminatorNode.ts
│ │ │ │ ├── SizeDiscriminatorNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── index.ts
│ │ │ ├── linkNodes/
│ │ │ │ ├── AccountLinkNode.ts
│ │ │ │ ├── DefinedTypeLinkNode.ts
│ │ │ │ ├── InstructionAccountLinkNode.ts
│ │ │ │ ├── InstructionArgumentLinkNode.ts
│ │ │ │ ├── InstructionLinkNode.ts
│ │ │ │ ├── LinkNode.ts
│ │ │ │ ├── PdaLinkNode.ts
│ │ │ │ ├── ProgramLinkNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── pdaSeedNodes/
│ │ │ │ ├── ConstantPdaSeedNode.ts
│ │ │ │ ├── PdaSeedNode.ts
│ │ │ │ ├── VariablePdaSeedNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── shared/
│ │ │ │ ├── docs.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── stringCases.ts
│ │ │ ├── typeNodes/
│ │ │ │ ├── AmountTypeNode.ts
│ │ │ │ ├── ArrayTypeNode.ts
│ │ │ │ ├── BooleanTypeNode.ts
│ │ │ │ ├── BytesTypeNode.ts
│ │ │ │ ├── DateTimeTypeNode.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.ts
│ │ │ │ ├── EnumStructVariantTypeNode.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.ts
│ │ │ │ ├── EnumTypeNode.ts
│ │ │ │ ├── EnumVariantTypeNode.ts
│ │ │ │ ├── FixedSizeTypeNode.ts
│ │ │ │ ├── HiddenPrefixTypeNode.ts
│ │ │ │ ├── HiddenSuffixTypeNode.ts
│ │ │ │ ├── MapTypeNode.ts
│ │ │ │ ├── NestedTypeNode.ts
│ │ │ │ ├── NumberTypeNode.ts
│ │ │ │ ├── OptionTypeNode.ts
│ │ │ │ ├── PostOffsetTypeNode.ts
│ │ │ │ ├── PreOffsetTypeNode.ts
│ │ │ │ ├── PublicKeyTypeNode.ts
│ │ │ │ ├── RemainderOptionTypeNode.ts
│ │ │ │ ├── SentinelTypeNode.ts
│ │ │ │ ├── SetTypeNode.ts
│ │ │ │ ├── SizePrefixTypeNode.ts
│ │ │ │ ├── SolAmountTypeNode.ts
│ │ │ │ ├── StringTypeNode.ts
│ │ │ │ ├── StructFieldTypeNode.ts
│ │ │ │ ├── StructTypeNode.ts
│ │ │ │ ├── TupleTypeNode.ts
│ │ │ │ ├── TypeNode.ts
│ │ │ │ ├── ZeroableOptionTypeNode.ts
│ │ │ │ └── index.ts
│ │ │ ├── types/
│ │ │ │ └── global.d.ts
│ │ │ └── valueNodes/
│ │ │ ├── ArrayValueNode.ts
│ │ │ ├── BooleanValueNode.ts
│ │ │ ├── BytesValueNode.ts
│ │ │ ├── ConstantValueNode.ts
│ │ │ ├── EnumValueNode.ts
│ │ │ ├── MapEntryValueNode.ts
│ │ │ ├── MapValueNode.ts
│ │ │ ├── NoneValueNode.ts
│ │ │ ├── NumberValueNode.ts
│ │ │ ├── PublicKeyValueNode.ts
│ │ │ ├── SetValueNode.ts
│ │ │ ├── SomeValueNode.ts
│ │ │ ├── StringValueNode.ts
│ │ │ ├── StructFieldValueNode.ts
│ │ │ ├── StructValueNode.ts
│ │ │ ├── TupleValueNode.ts
│ │ │ ├── ValueNode.ts
│ │ │ └── index.ts
│ │ ├── test/
│ │ │ ├── AccountNode.test.ts
│ │ │ ├── DefinedTypeNode.test.ts
│ │ │ ├── ErrorNode.test.ts
│ │ │ ├── EventNode.test.ts
│ │ │ ├── InstructionAccountNode.test.ts
│ │ │ ├── InstructionArgumentNode.test.ts
│ │ │ ├── InstructionByteDeltaNode.test.ts
│ │ │ ├── InstructionNode.test.ts
│ │ │ ├── InstructionRemainingAccountsNode.test.ts
│ │ │ ├── InstructionStatusNode.test.ts
│ │ │ ├── Node.test.ts
│ │ │ ├── Node.typetest.ts
│ │ │ ├── PdaNode.test.ts
│ │ │ ├── ProgramNode.test.ts
│ │ │ ├── RootNode.test.ts
│ │ │ ├── contextualValueNodes/
│ │ │ │ ├── AccountBumpValueNode.test.ts
│ │ │ │ ├── AccountValueNode.test.ts
│ │ │ │ ├── ArgumentValueNode.test.ts
│ │ │ │ ├── ConditionalValueNode.test.ts
│ │ │ │ ├── ContextualValueNode.typetest.ts
│ │ │ │ ├── IdentityValueNode.test.ts
│ │ │ │ ├── PayerValueNode.test.ts
│ │ │ │ ├── PdaSeedValueNode.test.ts
│ │ │ │ ├── PdaValueNode.test.ts
│ │ │ │ ├── ProgramIdValueNode.test.ts
│ │ │ │ └── ResolverValueNode.test.ts
│ │ │ ├── countNodes/
│ │ │ │ ├── CountNode.typetest.ts
│ │ │ │ ├── FixedCountNode.test.ts
│ │ │ │ ├── PrefixedCountNode.test.ts
│ │ │ │ └── RemainderCountNode.test.ts
│ │ │ ├── discriminatorNodes/
│ │ │ │ ├── ConstantDiscriminatorNode.test.ts
│ │ │ │ ├── DiscriminatorNode.typetest.ts
│ │ │ │ ├── FieldDiscriminatorNode.test.ts
│ │ │ │ └── SizeDiscriminatorNode.test.ts
│ │ │ ├── linkNodes/
│ │ │ │ ├── AccountLinkNode.test.ts
│ │ │ │ ├── DefinedTypeLinkNode.test.ts
│ │ │ │ ├── InstructionAccountLinkNode.test.ts
│ │ │ │ ├── InstructionArgumentLinkNode.test.ts
│ │ │ │ ├── InstructionLinkNode.test.ts
│ │ │ │ ├── LinkNode.typetest.ts
│ │ │ │ ├── PdaLinkNode.test.ts
│ │ │ │ └── ProgramLinkNode.test.ts
│ │ │ ├── pdaSeedNodes/
│ │ │ │ ├── ConstantPdaSeedNode.test.ts
│ │ │ │ ├── PdaSeedNode.typetest.ts
│ │ │ │ └── VariablePdaSeedNode.test.ts
│ │ │ ├── shared/
│ │ │ │ └── stringCases.test.ts
│ │ │ ├── typeNodes/
│ │ │ │ ├── AmountTypeNode.test.ts
│ │ │ │ ├── ArrayTypeNode.test.ts
│ │ │ │ ├── BooleanTypeNode.test.ts
│ │ │ │ ├── BytesTypeNode.test.ts
│ │ │ │ ├── DateTimeTypeNode.test.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.test.ts
│ │ │ │ ├── EnumStructVariantTypeNode.test.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.test.ts
│ │ │ │ ├── EnumTypeNode.test.ts
│ │ │ │ ├── FixedSizeTypeNode.test.ts
│ │ │ │ ├── HiddenPrefixTypeNode.test.ts
│ │ │ │ ├── HiddenSuffixTypeNode.test.ts
│ │ │ │ ├── MapTypeNode.test.ts
│ │ │ │ ├── NestedTypeNode.test.ts
│ │ │ │ ├── NestedTypeNode.typetest.ts
│ │ │ │ ├── NumberTypeNode.test.ts
│ │ │ │ ├── OptionTypeNode.test.ts
│ │ │ │ ├── PostOffsetTypeNode.test.ts
│ │ │ │ ├── PreOffsetTypeNode.test.ts
│ │ │ │ ├── PublicKeyTypeNode.test.ts
│ │ │ │ ├── RemainderOptionTypeNode.test.ts
│ │ │ │ ├── SentinelTypeNode.test.ts
│ │ │ │ ├── SetTypeNode.test.ts
│ │ │ │ ├── SizePrefixTypeNode.test.ts
│ │ │ │ ├── SolAmountTypeNode.test.ts
│ │ │ │ ├── StringTypeNode.test.ts
│ │ │ │ ├── StructFieldTypeNode.test.ts
│ │ │ │ ├── StructTypeNode.test.ts
│ │ │ │ ├── TupleTypeNode.test.ts
│ │ │ │ ├── TypeNode.typetest.ts
│ │ │ │ └── ZeroableOptionTypeNode.test.ts
│ │ │ ├── types/
│ │ │ │ └── global.d.ts
│ │ │ └── valueNodes/
│ │ │ ├── ArrayValueNode.test.ts
│ │ │ ├── BooleanValueNode.test.ts
│ │ │ ├── BytesValueNode.test.ts
│ │ │ ├── ConstantValueNode.test.ts
│ │ │ ├── EnumValueNode.test.ts
│ │ │ ├── MapEntryValueNode.test.ts
│ │ │ ├── MapValueNode.test.ts
│ │ │ ├── NoneValueNode.test.ts
│ │ │ ├── NumberValueNode.test.ts
│ │ │ ├── PublicKeyValueNode.test.ts
│ │ │ ├── SetValueNode.test.ts
│ │ │ ├── SomeValueNode.test.ts
│ │ │ ├── StringValueNode.test.ts
│ │ │ ├── StructFieldValueNode.test.ts
│ │ │ ├── StructValueNode.test.ts
│ │ │ ├── TupleValueNode.test.ts
│ │ │ └── ValueNode.typetest.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── nodes-from-anchor/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── defaultVisitor.ts
│ │ │ ├── discriminators.ts
│ │ │ ├── extractPdasVisitor.ts
│ │ │ ├── index.ts
│ │ │ ├── utils.ts
│ │ │ ├── v00/
│ │ │ │ ├── AccountNode.ts
│ │ │ │ ├── DefinedTypeNode.ts
│ │ │ │ ├── ErrorNode.ts
│ │ │ │ ├── InstructionAccountNode.ts
│ │ │ │ ├── InstructionArgumentNode.ts
│ │ │ │ ├── InstructionNode.ts
│ │ │ │ ├── PdaNode.ts
│ │ │ │ ├── ProgramNode.ts
│ │ │ │ ├── RootNode.ts
│ │ │ │ ├── idl.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── typeNodes/
│ │ │ │ ├── ArrayTypeNode.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.ts
│ │ │ │ ├── EnumStructVariantTypeNode.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.ts
│ │ │ │ ├── EnumTypeNode.ts
│ │ │ │ ├── MapTypeNode.ts
│ │ │ │ ├── OptionTypeNode.ts
│ │ │ │ ├── SetTypeNode.ts
│ │ │ │ ├── StructFieldTypeNode.ts
│ │ │ │ ├── StructTypeNode.ts
│ │ │ │ ├── TupleTypeNode.ts
│ │ │ │ ├── TypeNode.ts
│ │ │ │ └── index.ts
│ │ │ └── v01/
│ │ │ ├── AccountNode.ts
│ │ │ ├── DefinedTypeNode.ts
│ │ │ ├── ErrorNode.ts
│ │ │ ├── EventNode.ts
│ │ │ ├── InstructionAccountNode.ts
│ │ │ ├── InstructionArgumentNode.ts
│ │ │ ├── InstructionNode.ts
│ │ │ ├── PdaSeedNode.ts
│ │ │ ├── ProgramNode.ts
│ │ │ ├── RootNode.ts
│ │ │ ├── idl.ts
│ │ │ ├── index.ts
│ │ │ ├── typeNodes/
│ │ │ │ ├── ArrayTypeNode.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.ts
│ │ │ │ ├── EnumStructVariantTypeNode.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.ts
│ │ │ │ ├── EnumTypeNode.ts
│ │ │ │ ├── OptionTypeNode.ts
│ │ │ │ ├── StructFieldTypeNode.ts
│ │ │ │ ├── StructTypeNode.ts
│ │ │ │ ├── TupleTypeNode.ts
│ │ │ │ ├── TypeNode.ts
│ │ │ │ └── index.ts
│ │ │ └── unwrapGenerics.ts
│ │ ├── test/
│ │ │ ├── discriminator.test.ts
│ │ │ ├── rootNodeFromAnchor.test.ts
│ │ │ ├── v00/
│ │ │ │ ├── AccountNode.test.ts
│ │ │ │ ├── DefinedTypeNode.test.ts
│ │ │ │ ├── ErrorNode.test.ts
│ │ │ │ ├── InstructionAccountNode.test.ts
│ │ │ │ ├── InstructionArgumentNode.test.ts
│ │ │ │ ├── InstructionNode.test.ts
│ │ │ │ ├── PdaNode.test.ts
│ │ │ │ ├── ProgramNode.test.ts
│ │ │ │ ├── RootNode.test.ts
│ │ │ │ └── typeNodes/
│ │ │ │ ├── ArrayTypeNode.test.ts
│ │ │ │ ├── BooleanTypeNode.test.ts
│ │ │ │ ├── BytesTypeNode.test.ts
│ │ │ │ ├── EnumTypeNode.test.ts
│ │ │ │ ├── MapTypeNode.test.ts
│ │ │ │ ├── NumberTypeNode.test.ts
│ │ │ │ ├── OptionTypeNode.test.ts
│ │ │ │ ├── PublicKeyTypeNode.test.ts
│ │ │ │ ├── SetTypeNode.test.ts
│ │ │ │ ├── StringTypeNode.test.ts
│ │ │ │ ├── StructTypeNode.test.ts
│ │ │ │ └── TupleTypeNode.test.ts
│ │ │ └── v01/
│ │ │ ├── AccountNode.test.ts
│ │ │ ├── DefinedTypeNode.test.ts
│ │ │ ├── ErrorNode.test.ts
│ │ │ ├── EventNode.test.ts
│ │ │ ├── InstructionAccountNode.test.ts
│ │ │ ├── InstructionArgumentNode.test.ts
│ │ │ ├── InstructionNode.test.ts
│ │ │ ├── ProgramNode.test.ts
│ │ │ ├── RootNode.test.ts
│ │ │ ├── extractPdasVisitor.test.ts
│ │ │ ├── pdaSeedNode.test.ts
│ │ │ └── typeNodes/
│ │ │ ├── ArrayTypeNode.test.ts
│ │ │ ├── BooleanTypeNode.test.ts
│ │ │ ├── BytesTypeNode.test.ts
│ │ │ ├── EnumTypeNode.test.ts
│ │ │ ├── NumberTypeNode.test.ts
│ │ │ ├── OptionTypeNode.test.ts
│ │ │ ├── PublicKeyTypeNode.test.ts
│ │ │ ├── StringTypeNode.test.ts
│ │ │ ├── StructTypeNode.test.ts
│ │ │ └── TupleTypeNode.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── renderers-core/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── fragment.ts
│ │ │ ├── fs.ts
│ │ │ ├── index.ts
│ │ │ ├── path.ts
│ │ │ ├── renderMap.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── test/
│ │ │ ├── fs.test.json
│ │ │ ├── fs.test.ts
│ │ │ ├── path.test.ts
│ │ │ ├── renderMap.test.ts
│ │ │ └── types/
│ │ │ └── global.d.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── validators/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── ValidationItem.ts
│ │ │ ├── getValidationItemsVisitor.ts
│ │ │ ├── index.ts
│ │ │ └── throwValidatorItemsVisitor.ts
│ │ ├── test/
│ │ │ └── getValidationItemsVisitor.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ ├── visitors/
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── addPdasVisitor.ts
│ │ │ ├── createSubInstructionsFromEnumArgsVisitor.ts
│ │ │ ├── deduplicateIdenticalDefinedTypesVisitor.ts
│ │ │ ├── fillDefaultPdaSeedValuesVisitor.ts
│ │ │ ├── flattenInstructionDataArgumentsVisitor.ts
│ │ │ ├── flattenStructVisitor.ts
│ │ │ ├── getDefinedTypeHistogramVisitor.ts
│ │ │ ├── index.ts
│ │ │ ├── renameHelpers.ts
│ │ │ ├── setAccountDiscriminatorFromFieldVisitor.ts
│ │ │ ├── setFixedAccountSizesVisitor.ts
│ │ │ ├── setInstructionAccountDefaultValuesVisitor.ts
│ │ │ ├── setInstructionDiscriminatorsVisitor.ts
│ │ │ ├── setNumberWrappersVisitor.ts
│ │ │ ├── setStructDefaultValuesVisitor.ts
│ │ │ ├── transformDefinedTypesIntoAccountsVisitor.ts
│ │ │ ├── transformU8ArraysToBytesVisitor.ts
│ │ │ ├── unwrapDefinedTypesVisitor.ts
│ │ │ ├── unwrapInstructionArgsDefinedTypesVisitor.ts
│ │ │ ├── unwrapTupleEnumWithSingleStructVisitor.ts
│ │ │ ├── unwrapTypeDefinedLinksVisitor.ts
│ │ │ ├── updateAccountsVisitor.ts
│ │ │ ├── updateDefinedTypesVisitor.ts
│ │ │ ├── updateErrorsVisitor.ts
│ │ │ ├── updateInstructionsVisitor.ts
│ │ │ └── updateProgramsVisitor.ts
│ │ ├── test/
│ │ │ ├── addPdasVisitor.test.ts
│ │ │ ├── fillDefaultPdaSeedValuesVisitor.test.ts
│ │ │ ├── getDefinedTypeHistogramVisitor.test.ts
│ │ │ ├── setStructDefaultValuesVisitor.test.ts
│ │ │ ├── unwrapDefinedTypesVisitor.test.ts
│ │ │ ├── unwrapInstructionArgsDefinedTypesVisitor.test.ts
│ │ │ ├── updateAccountsVisitor.test.ts
│ │ │ └── updateInstructionsVisitor.test.ts
│ │ ├── tsconfig.declarations.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.config.mts
│ └── visitors-core/
│ ├── .gitignore
│ ├── .prettierignore
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── src/
│ │ ├── LinkableDictionary.ts
│ │ ├── NodePath.ts
│ │ ├── NodeSelector.ts
│ │ ├── NodeStack.ts
│ │ ├── bottomUpTransformerVisitor.ts
│ │ ├── consoleLogVisitor.ts
│ │ ├── deleteNodesVisitor.ts
│ │ ├── extendVisitor.ts
│ │ ├── getByteSizeVisitor.ts
│ │ ├── getDebugStringVisitor.ts
│ │ ├── getMaxByteSizeVisitor.ts
│ │ ├── getResolvedInstructionInputsVisitor.ts
│ │ ├── getUniqueHashStringVisitor.ts
│ │ ├── identityVisitor.ts
│ │ ├── index.ts
│ │ ├── interceptFirstVisitVisitor.ts
│ │ ├── interceptVisitor.ts
│ │ ├── mapVisitor.ts
│ │ ├── mergeVisitor.ts
│ │ ├── nonNullableIdentityVisitor.ts
│ │ ├── pipe.ts
│ │ ├── recordLinkablesVisitor.ts
│ │ ├── recordNodeStackVisitor.ts
│ │ ├── removeDocsVisitor.ts
│ │ ├── singleNodeVisitor.ts
│ │ ├── staticVisitor.ts
│ │ ├── tapVisitor.ts
│ │ ├── topDownTransformerVisitor.ts
│ │ ├── visitor.ts
│ │ └── voidVisitor.ts
│ ├── test/
│ │ ├── NodeSelector.test.ts
│ │ ├── bottomUpTransformerVisitor.test.ts
│ │ ├── deleteNodesVisitor.test.ts
│ │ ├── extendVisitor.test.ts
│ │ ├── getByteSizeVisitor.test.ts
│ │ ├── getDebugStringVisitor.test.ts
│ │ ├── getMaxByteSizeVisitor.test.ts
│ │ ├── getResolvedInstructionInputsVisitor.test.ts
│ │ ├── getUniqueHashStringVisitor.test.ts
│ │ ├── identityVisitor.test.ts
│ │ ├── interceptFirstVisitVisitor.test.ts
│ │ ├── interceptVisitor.test.ts
│ │ ├── mapVisitor.test.ts
│ │ ├── mergeVisitor.test.ts
│ │ ├── nodes/
│ │ │ ├── AccountNode.test.ts
│ │ │ ├── DefinedTypeNode.test.ts
│ │ │ ├── ErrorNode.test.ts
│ │ │ ├── EventNode.test.ts
│ │ │ ├── InstructionAccountNode.test.ts
│ │ │ ├── InstructionArgumentNode.test.ts
│ │ │ ├── InstructionByteDeltaNode.test.ts
│ │ │ ├── InstructionNode.test.ts
│ │ │ ├── InstructionRemainingAccountsNode.test.ts
│ │ │ ├── PdaNode.test.ts
│ │ │ ├── ProgramNode.test.ts
│ │ │ ├── RootNode.test.ts
│ │ │ ├── _setup.ts
│ │ │ ├── contextualValueNodes/
│ │ │ │ ├── AccountBumpValueNode.test.ts
│ │ │ │ ├── AccountValueNode.test.ts
│ │ │ │ ├── ArgumentValueNode.test.ts
│ │ │ │ ├── ConditionalValueNode.test.ts
│ │ │ │ ├── IdentityValueNode.test.ts
│ │ │ │ ├── PayerValueNode.test.ts
│ │ │ │ ├── PdaSeedValueNode.test.ts
│ │ │ │ ├── PdaValueNode.test.ts
│ │ │ │ ├── ProgramIdValueNode.test.ts
│ │ │ │ └── ResolverValueNode.test.ts
│ │ │ ├── discriminatorNodes/
│ │ │ │ ├── ConstantDiscriminatorNode.test.ts
│ │ │ │ ├── FieldDiscriminatorNode.test.ts
│ │ │ │ └── SizeDiscriminatorNode.test.ts
│ │ │ ├── linkNodes/
│ │ │ │ ├── AccountLinkNode.test.ts
│ │ │ │ ├── DefinedTypeLinkNode.test.ts
│ │ │ │ ├── InstructionAccountLinkNode.test.ts
│ │ │ │ ├── InstructionArgumentLinkNode.test.ts
│ │ │ │ ├── InstructionLinkNode.test.ts
│ │ │ │ ├── PdaLinkNode.test.ts
│ │ │ │ └── ProgramLinkNode.test.ts
│ │ │ ├── pdaSeedNodes/
│ │ │ │ ├── ConstantPdaSeedNode.test.ts
│ │ │ │ └── VariablePdaSeedNode.test.ts
│ │ │ ├── sizeNodes/
│ │ │ │ ├── FixedSizeNode.test.ts
│ │ │ │ ├── PrefixedSizeNode.test.ts
│ │ │ │ └── RemainderSizeNode.test.ts
│ │ │ ├── typeNodes/
│ │ │ │ ├── AmountTypeNode.test.ts
│ │ │ │ ├── ArrayTypeNode.test.ts
│ │ │ │ ├── BooleanTypeNode.test.ts
│ │ │ │ ├── BytesTypeNode.test.ts
│ │ │ │ ├── DateTimeTypeNode.test.ts
│ │ │ │ ├── EnumEmptyVariantTypeNode.test.ts
│ │ │ │ ├── EnumStructVariantTypeNode.test.ts
│ │ │ │ ├── EnumTupleVariantTypeNode.test.ts
│ │ │ │ ├── EnumTypeNode.test.ts
│ │ │ │ ├── FixedSizeTypeNode.test.ts
│ │ │ │ ├── HiddenPrefixTypeNode.test.ts
│ │ │ │ ├── HiddenSuffixTypeNode.test.ts
│ │ │ │ ├── MapTypeNode.test.ts
│ │ │ │ ├── NumberTypeNode.test.ts
│ │ │ │ ├── OptionTypeNode.test.ts
│ │ │ │ ├── PostOffsetTypeNode.test.ts
│ │ │ │ ├── PreOffsetTypeNode.test.ts
│ │ │ │ ├── PublicKeyTypeNode.test.ts
│ │ │ │ ├── RemainderOptionTypeNode.test.ts
│ │ │ │ ├── SentinelTypeNode.test.ts
│ │ │ │ ├── SetTypeNode.test.ts
│ │ │ │ ├── SizePrefixTypeNode.test.ts
│ │ │ │ ├── SolAmountTypeNode.test.ts
│ │ │ │ ├── StringTypeNode.test.ts
│ │ │ │ ├── StructFieldTypeNode.test.ts
│ │ │ │ ├── StructTypeNode.test.ts
│ │ │ │ ├── TupleTypeNode.test.ts
│ │ │ │ └── ZeroableOptionTypeNode.test.ts
│ │ │ └── valueNodes/
│ │ │ ├── ArrayValueNode.test.ts
│ │ │ ├── BooleanValueNode.test.ts
│ │ │ ├── BytesValueNode.test.ts
│ │ │ ├── ConstantValueNode.test.ts
│ │ │ ├── EnumValueNode.test.ts
│ │ │ ├── MapEntryValueNode.test.ts
│ │ │ ├── MapValueNode.test.ts
│ │ │ ├── NoneValueNode.test.ts
│ │ │ ├── NumberValueNode.test.ts
│ │ │ ├── PublicKeyValueNode.test.ts
│ │ │ ├── SetValueNode.test.ts
│ │ │ ├── SomeValueNode.test.ts
│ │ │ ├── StringValueNode.test.ts
│ │ │ ├── StructFieldValueNode.test.ts
│ │ │ ├── StructValueNode.test.ts
│ │ │ └── TupleValueNode.test.ts
│ │ ├── nonNullableIdentityVisitor.test.ts
│ │ ├── recordLinkablesVisitor.test.ts
│ │ ├── recordNodeStackVisitor.test.ts
│ │ ├── removeDocsVisitor.test.ts
│ │ ├── singleNodeVisitor.test.ts
│ │ ├── staticVisitor.test.ts
│ │ ├── tapVisitor.test.ts
│ │ ├── topDownTransformerVisitor.test.ts
│ │ ├── visitor.test.ts
│ │ └── voidVisitor.test.ts
│ ├── tsconfig.declarations.json
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── vitest.config.mts
├── pnpm-workspace.yaml
├── tsconfig.json
├── tsup.config.base.ts
├── turbo.json
├── vitest.config.base.mts
└── vitest.config.mts
================================================
FILE CONTENTS
================================================
================================================
FILE: .changeset/README.md
================================================
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
================================================
FILE: .changeset/config.json
================================================
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "codama-idl/codama" }
],
"commit": false,
"fixed": [
[
"codama",
"@codama/errors",
"@codama/node-types",
"@codama/nodes",
"@codama/validators",
"@codama/visitors*"
]
],
"linked": [],
"access": "public",
"baseBranch": "main",
"privatePackages": {
"version": false,
"tag": false
},
"updateInternalDependencies": "patch"
}
================================================
FILE: .github/actions/setup-anchor/action.yml
================================================
name: Setup Anchor CLI
description: Install Rust toolchain and a pinned Anchor CLI version via AVM with caching for CI.
inputs:
anchor-version:
description: Anchor CLI version to install (e.g. 0.32.1)
required: true
rust-version:
description: Rust toolchain version to install (e.g. 1.93.0)
required: true
cargo-lock-path:
description: Path to Cargo.lock for cache key hashing
required: false
default: packages/dynamic-client/test/programs/anchor/Cargo.lock
build-target-path:
description: Path to the build target directory to cache
required: false
default: packages/dynamic-client/test/programs/anchor/target
runs:
using: composite
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ inputs.rust-version }}
- name: Cache Rust and Anchor toolchain
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin/avm
~/.avm
${{ inputs.build-target-path }}
key: ${{ runner.os }}-rust-anchor-${{ inputs.rust-version }}-${{ inputs.anchor-version }}-${{ inputs.cargo-lock-path && hashFiles(inputs.cargo-lock-path) || 'no-lock' }}
restore-keys: |
${{ runner.os }}-rust-anchor-${{ inputs.rust-version }}-${{ inputs.anchor-version }}-
${{ runner.os }}-rust-anchor-${{ inputs.rust-version }}-
- name: Install Anchor (pinned)
shell: bash
run: |
set -euo pipefail
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
echo "$HOME/.avm/bin" >> "$GITHUB_PATH"
export PATH="$HOME/.cargo/bin:$HOME/.avm/bin:$PATH"
desired="${{ inputs.anchor-version }}"
# Install AVM if needed.
if ! command -v avm >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
cargo install --git https://github.com/coral-xyz/anchor avm --locked
fi
# Ensure the desired Anchor version exists and is active.
avm install "$desired"
avm use "$desired"
anchor --version
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: daily
time: '01:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 10
================================================
FILE: .github/workflows/main.yml
================================================
name: Main
on:
push:
branches: [main]
pull_request:
env:
# Among other things, opts out of Turborepo telemetry. See https://consoledonottrack.com/.
DO_NOT_TRACK: '1'
NODE_VERSION: 20
CODAMA_VERSION: 1.x
SOLANA_VERSION: 3.1.8
ANCHOR_VERSION: '0.32.1'
RUST_VERSION: '1.93.0'
jobs:
lint:
name: Check styling
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Compile JS and types
run: pnpm run build
- name: Check linting
run: pnpm run lint
tests:
name: Test
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Install Solana
uses: solana-program/actions/install-solana@v1
with:
version: ${{ env.SOLANA_VERSION }}
- name: Setup Anchor
uses: ./.github/actions/setup-anchor
with:
anchor-version: ${{ env.ANCHOR_VERSION }}
rust-version: ${{ env.RUST_VERSION }}
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build and run tests
run: pnpm run test
- name: Ensure working directory is clean
run: |
git status
test -z "$(git status --porcelain)"
release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: [lint, tests]
permissions:
contents: write
pull-requests: write
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
commit: '[${{ env.CODAMA_VERSION }}] Publish packages'
title: '[${{ env.CODAMA_VERSION }}] Publish packages'
publish: pnpm publish-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
dependabot:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'codama-idl/codama'
needs: [lint, tests]
permissions:
contents: write
pull-requests: write
steps:
- name: Auto-approve the PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# turbo
.turbo
# `solana-test-validator`
.solana/
test-ledger/
target/
CHANGELOG.md
================================================
FILE: .prettierignore
================================================
.changeset/
.github/workflows/PULL_REQUEST_TEMPLATE.md
declarations/
dist/
doc/
lib/
test-ledger/
target/
CHANGELOG.md
pnpm-lock.yaml
pnpm-workspace.yaml
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2025 Codama
Copyright (c) 2024 Metaplex Foundation
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# Codama
[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
[![ci][ci-image]][ci-url]
[npm-downloads-image]: https://img.shields.io/npm/dm/codama.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/codama.svg?style=flat
[npm-url]: https://www.npmjs.com/package/codama
[ci-image]: https://img.shields.io/github/actions/workflow/status/codama-idl/codama/main.yml?logo=GitHub
[ci-url]: https://github.com/codama-idl/codama/actions/workflows/main.yml
Codama is a tool that describes any Solana program in a standardised format called a **Codama IDL**.
A Codama IDL can be used to:
- ✨ Generate **program clients** in various languages and frameworks.
- 📚 Generate **documentation and tooling** for your programs.
- 🗃️ **Register your IDL** for others to discover and index.
- 🔭 Provide valuable information to **explorers and wallets**.

## Table of contents
- [Getting started](#getting-started). Install and use Codama in your project.
- [Coming from Anchor](#coming-from-anchor). Have an Anchor IDL instead? Let’s make that work.
- [Codama scripts](#codama-scripts). Enrich your Codama config file with more scripts.
- [Available visitors](#available-visitors). See what’s available for you to use.
- [Getting a Codama IDL](#getting-a-codama-idl). Extract Codama IDLs from any program.
- [Codama’s architecture](#codamas-architecture). A bit more on the node/visitor design.
- [Other resources](#other-resources).
## Getting started
### Installation
To get started with Codama, simply install `codama` to your project and run the `init` command like so:
```sh
pnpm install codama
codama init
```
You will be prompted for the path of your IDL and asked to select any script presets you would like to use. This will create a Codama configuration file at the root of your project.
### Usage
You may then use the `codama run` command to execute any script defined in your configuration file.
```sh
codama run --all # Run all Codama scripts.
codama run js # Generates a JavaScript client.
codama run rust # Generates a Rust client.
```
## Coming from Anchor
If you are using [Anchor](https://www.anchor-lang.com/docs) or [Shank macros](https://github.com/metaplex-foundation/shank), then you should already have an **Anchor IDL**. To make it work with Codama, you simply need to provide the path to your Anchor IDL in your Codama configuration file. Codama will automatically identify this as an Anchor IDL and will convert it to a Codama IDL before executing your scripts.
```json
{
"idl": "path/to/my/anchor/idl.json"
}
```
## Codama scripts
You can use your Codama configuration file to define any script you want by using one or more visitors that will be invoked when the script is ran.
**Visitors** are objects that will visit your Codama IDL and either perform some operation — like generating a program client — or update the IDL further — like renaming accounts. You can either use visitors from external packages or from a local file, and — in both cases — you can provide any argument the visitor may require.
For instance, the example script below will invoke three visitors:
- The first will use the `default` import from the `my-external-visitor` package and pass `42` as the first argument.
- The second will use the `withDefaults` import from the `my-external-visitor` package.
- The third will use a local visitor located next to the configuration file.
```json
{
"scripts": {
"my-script": [
{ "from": "my-external-visitor", "args": [42] },
"my-external-visitor#withDefaults",
"./my-local-visitor.js"
]
}
}
```
Note that if an external visitor in your script isn’t installed locally, you will be asked to install it next time you try to run that script.
```sh
❯ codama run my-script
▲ Your script requires additional dependencies.
▲ Install command: pnpm install my-external-visitor
? Install dependencies? › (Y/n)
```
You can [learn more about the Codama CLI here](/packages/cli/README.md).
## Available visitors
The tables below aim to help you discover visitors from the Codama ecosystem that you can use in your scripts.
Feel free to PR your own visitor here for others to discover. Note that they are ordered alphabetically.
### Generates documentation
| Visitor | Description | Maintainer |
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------- |
| `@codama/renderers-demo` ([docs](https://github.com/codama-idl/renderers-demo)) | Generates simple documentation as a template to help others create new visitors. | Codama |
### Generates program clients
| Visitor | Description | Maintainer |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| `@codama/renderers-go` ([docs](https://github.com/codama-idl/renderers-go)) | Generates a Go client compatible with [the Solana Go SDK](https://github.com/gagliardetto/solana-go). | [Sonic](hhttps://github.com/sonicfromnewyoke) |
| `@codama/renderers-js` ([docs](https://github.com/codama-idl/renderers-js)) | Generates a JavaScript client compatible with [Solana Kit](https://www.solanakit.com/). | [Anza](https://www.anza.xyz/) |
| `@codama/renderers-js-umi` ([docs](https://github.com/codama-idl/renderers-js-umi)) | Generates a JavaScript client compatible with [the Umi framework](https://developers.metaplex.com/umi). | [Metaplex](https://www.metaplex.com/) |
| `@codama/renderers-rust` ([docs](https://github.com/codama-idl/renderers-rust)) | Generates a Rust client compatible with [the Solana SDK](https://github.com/anza-xyz/solana-sdk). | [Anza](https://www.anza.xyz/) |
| `@codama/renderers-vixen-parser` ([docs](https://github.com/codama-idl/renderers-vixen-parser)) | Generates [Yellowstone](https://github.com/rpcpool/yellowstone-grpc) account and instruction parsers. | [Triton One](https://triton.one/) |
| `@limechain/codama-dart` ([docs](https://github.com/limechain/codama-dart)) | Generates a Dart client. | [LimeChain](https://github.com/limechain/) |
| `codama-py` ([docs](https://github.com/Solana-ZH/codama-py)) | Generates a Python client. | [Solar](https://github.com/Solana-ZH) |
### Provides utility
| Visitor | Description | Maintainer |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `@codama/visitors#*` ([docs](https://github.com/codama-idl/codama/blob/main/packages/visitors/README.md)) | Provides a big library of utility visitors that can be used to manipulate Codama IDLs. For instance, `updateErrorsVisitor` can be used to update error messages in your IDL . [Check out the docs](https://github.com/codama-idl/codama/blob/main/packages/visitors/README.md) to see all available visitors. | Codama |
| `@codama/visitors-core#*` ([docs](https://github.com/codama-idl/codama/blob/main/packages/visitors-core/README.md)) | Everything included in `visitors-core` is also included in `visitors`. The helpers offered in this package are slightly more advanced and can be used to help you [build your own visitors](https://github.com/codama-idl/codama/blob/main/packages/visitors-core/README.md#writing-your-own-visitor). | Codama |
## Getting a Codama IDL
We are currently working on a set of transparent macros that can be added to any program in order to extract a Codama IDL from it. There are still a lot more macros and scenarios for us to support but most programs can already benefit from these macros. You can then extract an IDL from the provided crate path using the Codama API like so:
```rust
use codama::Codama;
let codama = Codama::load(crate_path)?;
let idl_json = codama.get_json_idl()?;
```
We will add documentation on Codama macros when they are fully implemented but feel free to check this example that extract a Codama IDL from the [System program interface](https://github.com/lorisleiva/codama-demo-2025-08/tree/main/3-from-macros/program/src) using a [build script](https://github.com/lorisleiva/codama-demo-2025-08/blob/main/3-from-macros/program/build.rs).
## Codama's architecture
The Codama IDL is designed as a tree of nodes starting with the `RootNode` which contains a `ProgramNode` and additional data such as the Codama version used when the IDL was created. Codama provides over 60 different types of nodes that help describe nearly every aspect of your Solana programs. [You can read more about the Codama nodes here](./packages/nodes).

Because everything is designed as a `Node`, we can transform the IDL, aggregate information, and output various utility tools using special objects that can traverse node trees known as visitors. [See this documentation to learn more about Codama visitors](./packages/visitors-core).

## Other resources
- [Solana Stack Exchange](https://solana.stackexchange.com/questions/tagged/codama).
- Working with Anchor
- [Anchor and Solana Kit tutorial](https://www.youtube.com/watch?v=2T3DOMv7iR4).
- [Anchor Election app](https://github.com/quiknode-labs/anchor-election-2025).
- [Anchor Swap/Escrow app](https://github.com/quiknode-labs/you-will-build-a-solana-program).
================================================
FILE: eslint.config.mjs
================================================
import solanaConfig from '@solana/eslint-config-solana';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
ignores: ['**/dist/**', '**/e2e/**', '**/generated/**', '**/target/**'],
},
{
files: ['**/*.ts', '**/*.(c|m)?js'],
extends: [solanaConfig],
},
{
files: ['packages/cli/**', 'packages/nodes/**', 'packages/node-types/**'],
rules: {
'sort-keys-fix/sort-keys-fix': 'off',
'typescript-sort-keys/interface': 'off',
},
},
]);
================================================
FILE: package.json
================================================
{
"name": "codama-monorepo",
"private": true,
"scripts": {
"build": "turbo run build --log-order grouped",
"lint": "turbo run lint --log-order grouped",
"lint:fix": "turbo lint:fix --log-order grouped && pnpm prettier --ignore-unknown --write '{.,!packages}/*'",
"test": "turbo run test --log-order grouped",
"publish-packages": "pnpm build && changeset publish"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.2",
"@changesets/cli": "^2.29.8",
"@solana/eslint-config-solana": "^5.0.0",
"@solana/prettier-config-solana": "0.0.6",
"@types/node": "^25",
"agadoo": "^3.0.0",
"browserslist-to-esbuild": "^2.1.1",
"eslint": "^9.39.2",
"happy-dom": "^20.1.0",
"prettier": "^3.7.4",
"rimraf": "6.1.2",
"tsup": "^8.5.1",
"turbo": "^2.7.4",
"typescript": "^5.9.3",
"vitest": "^4.0.16"
},
"engines": {
"node": ">=20.18.0"
},
"packageManager": "pnpm@10.15.1",
"prettier": "@solana/prettier-config-solana"
}
================================================
FILE: packages/cli/.gitignore
================================================
dist/
================================================
FILE: packages/cli/.prettierignore
================================================
dist/
test/e2e/
test-ledger/
target/
CHANGELOG.md
================================================
FILE: packages/cli/LICENSE
================================================
MIT License
Copyright (c) 2025 Codama
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: packages/cli/README.md
================================================
# Codama ➤ CLI
[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
[npm-downloads-image]: https://img.shields.io/npm/dm/@codama/cli.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@codama/cli.svg?style=flat&label=%40codama%2Fcli
[npm-url]: https://www.npmjs.com/package/@codama/cli
This package provides a CLI for the Codama library that can be used to run scripts on Codama IDLs.
Note that, whilst the CLI code is located in the `@codama/cli` package, the CLI binary is also included in the main `codama` library.
## Installation
Once you have the `codama` package installed, you can use the CLI using the `codama` binary.
```sh
pnpm install codama
codama --help
```
Note that you may install it from `@codama/cli` instead if you only want the CLI without the rest of the Codama library.
## Commands
### `codama init`
To get started with the Codama CLI, you will first need to create a [Codama configuration file](#configuration-file). You can do this using the `init` command as follows:
```sh
codama init
```
You will be prompted for the path of your IDL and asked to select any script presets you would like to use.
Here are the available options for the `init` command:
| Option | Description |
| ----------------- | --------------------------------------------------------------------------------------------------------- |
| `[output]` | As an optional argument, you may provide the path used to output the configuration file. |
| `--default`, `-d` | Skips all prompts and uses the default values. |
| `--force` | Overwrites any existing configuration file. |
| `--gill` | Initializes a configuration file for a [gill based Codama](https://gill.site/docs/guides/codama) project. |
| `--js` | Generates a JavaScript configuration file instead of a JSON one. |
### `codama run`
Once you have a configuration file, you can run your Codama scripts using the `codama run` command as follows:
```sh
codama run # Only runs your before visitors, no scripts.
codama run js rust # Runs your before visitors followed by the `js` and `rust` scripts.
codama run --all # Runs your before visitors followed by all your scripts.
```
Here are the available options for the `run` command:
| Option | Description |
| ----------------------- | ---------------------------------------------------------------------------------------- |
| `[scripts...]` | As optional arguments, you may provide the names of the scripts you wish to run. |
| `--all`, `-a` | Runs all the scripts defined in your configuration file. |
| `--config <path>`, `-c` | Specifies the path to your configuration file. Defaults to `codama.json` or `codama.js`. |
| `--idl`, `-i` | Overrides the `idl` field in your configuration file. |
## Configuration file
> [!NOTE]
> If you don't have a Codama configuration file yet, you can generate a new one using the `codama init` command as [described above](#codama-init).
The Codama configuration file defines an object containing the following fields:
- `idl` (string): The path to the IDL file. This can be a Codama IDL or an Anchor IDL which will be automatically converted to a Codama IDL.
```json
{
"idl": "path/to/idl"
}
```
- `before` (array): An array of visitors that will run before every script. See [the next section](#using-visitors) for more details on how to use visitors in your configuration file.
```json
{
"before": ["./my-visitor.js", "external-library#someVisitor"]
}
```
- `scripts` (object): An object defining the available Codama scripts. The keys identify the scripts and the values are arrays of visitors that make up the script.
```json
{
"scripts": {
"apple": ["./my-apple-visitor.js"],
"banana": ["./my-banana-visitor.js"]
}
}
```
Whether it is in the `before` array or in the `scripts` values, if you have a single visitor, you may provide it directly instead of wrapping it in an array. For instance, the following configuration file is valid:
```json
{
"idl": "path/to/idl",
"before": "./my-visitor.js",
"scripts": { "apple": "./my-apple-visitor.js" }
}
```
Note that the configuration file can also be a JavaScript file exporting the configuration object as the `default` export.
```js
export default {
idl: 'path/to/idl',
before: './my-visitor.js',
scripts: { apple: './my-apple-visitor.js' },
};
```
## Using visitors
When using a visitor in your configuration file, **you must provide its import path**. This can either be a local path (relative or absolute) or an external NPM package. For instance the following are all valid visitor import paths:
```js
'./my-visitor.js'; // Relative local path.
'/Users/me/my-visitor.js'; // Absolute local path.
'some-library'; // External package.
'@acme/some-library'; // Scoped external package.
```
In all these cases, the visitor will be imported from the `default` export of the module by default. If you want to **import a named export** instead, you may append a `#` followed by the export name to the import path. For instance:
```js
'./my-visitor.js#myExport'; // Named export from a local path.
'@acme/some-library#myExport'; // Named export from an external package.
```
Some visitors may instead be **exported as functions** that return visitor objects. This allows the visitor to receive arguments from the end-user to customize its behavior. When that is the case, you may instead define your visitor as an object with the following fields:
- `from` (string): The import path (and potentially the export name) of the visitor.
- `args` (array): An array of arguments to pass to the visitor. If you don't need to pass any arguments to the visitor function, you may simply provide the import path as a string instead of an object.
```json
{
"from": "@acme/some-library#myExport",
"args": ["hello", { "someOption": true }]
}
```
Finally note that, if the invoked visitor returns a new `RootNode`, this new `RootNode` will be used for the subsequent visitors instead of the original one. This allows us to chain visitors that modify the Codama IDL. Consider the following example such that the `./delete-all-accounts.js` visitor returns a new IDL with all accounts removed it.
```js
export default {
scripts: {
documentation: [
'./delete-all-accounts.js', // After this visitor, the IDL has no accounts.
'./generate-documentation.js', // Generates documentation for an IDL with no accounts.
],
},
};
```
## Recipes
There are plenty of existing visitors that you can use in your Codama scripts. The "[Available visitors](https://github.com/codama-idl/codama?tab=readme-ov-file#available-visitors)" section of the Codama README aims to list as many of them as possible. This includes visitors maintained by various teams across the ecosystem.
The examples below show how to use some of these visitors in your configuration file. They make heavy use of the [`@codama/visitors`](https://github.com/codama-idl/codama/tree/main/packages/visitors/README.md) package which provides a large number of utility visitors.
### Deleting nodes
Returns a new IDL with the specified nodes removed.
See [`deleteNodesVisitor`](https://github.com/codama-idl/codama/tree/main/packages/visitors-core#deletenodesvisitor) and [node selectors](https://github.com/codama-idl/codama/tree/main/packages/visitors-core#selecting-nodes).
In the example below, we remove the `mint` account, the `initializeMint` instruction and all errors from the IDL.
```json
{
"from": "@codama/visitors#deleteNodesVisitor",
"args": [["[accountNode]mint", "[instructionNode]initializeMint", "[errorNode]"]]
}
```
### Generating a JavaScript client
Generates a JavaScript client for the IDL at the specified output path.
See [`@codama/renderer-js`](https://github.com/codama-idl/renderers-js).
```json
{
"from": "@codama/renderers-js",
"args": ["clients/js/src/generated"]
}
```
### Removing documentation
Returns a new IDL with documentation removed from all nodes.
See [`removeDocsVisitor`](https://github.com/codama-idl/codama/tree/main/packages/visitors-core#removedocsvisitor)
```json
"@codama/visitors#removeDocsVisitor"
```
### Unwrapping linked types
Returns a new IDL with specified type links replaced by their underlying types.
See [`unwrapDefinedTypesVisitor`](https://github.com/codama-idl/codama/tree/main/packages/visitors#unwrapDefinedTypesVisitor)
In the example below, any links to the `counter` or `escrow` types will be replaced by the actual definitions of these types.
```json
{
"from": "@codama/visitors#unwrapDefinedTypesVisitor",
"args": [["counter", "escrow"]]
}
```
### Updating accounts
Returns a new IDL with updated account information.
See [`updateAccountsVisitor`](https://github.com/codama-idl/codama/tree/main/packages/visitors#updateAccountsVisitor)
In the example below, we rename the `vault` account to `safe` and update the `authority` field of the `bank` account to `treasury`.
```json
{
"from": "@codama/visitors#updateAccountsVisitor",
"args": [
{
"vault": {
"name": "safe"
},
"bank": {
"data": { "authority": "treasury" }
}
}
]
}
```
================================================
FILE: packages/cli/bin/cli.cjs
================================================
#!/usr/bin/env -S node
const run = require('../dist/cli.cjs').run;
run(process.argv);
================================================
FILE: packages/cli/package.json
================================================
{
"name": "@codama/cli",
"version": "1.5.1",
"description": "A CLI for setting up and managing Codama IDLs",
"exports": {
"types": "./dist/types/index.d.ts",
"node": {
"import": "./dist/index.node.mjs",
"require": "./dist/index.node.cjs"
}
},
"main": "./dist/index.node.cjs",
"module": "./dist/index.node.mjs",
"types": "./dist/types/index.d.ts",
"type": "commonjs",
"bin": {
"codama": "./bin/cli.cjs"
},
"files": [
"./bin",
"./dist/types",
"./dist/cli.*",
"./dist/index.*"
],
"sideEffects": false,
"keywords": [
"codama",
"standard",
"cli"
],
"scripts": {
"build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",
"dev": "vitest --project node",
"lint": "eslint . && prettier --check .",
"lint:fix": "eslint --fix . && prettier --write .",
"test": "pnpm test:types && pnpm test:treeshakability && pnpm test:unit && pnpm test:exports",
"test:exports": "node test/exports/module.mjs && node test/exports/commonjs.cjs",
"test:treeshakability": "for file in dist/index.*.mjs; do agadoo $file; done",
"test:types": "tsc --noEmit",
"test:unit": "vitest run"
},
"dependencies": {
"@codama/nodes": "workspace:*",
"@codama/visitors": "workspace:*",
"@codama/visitors-core": "workspace:*",
"commander": "^14.0.2",
"picocolors": "^1.1.1",
"prompts": "^2.4.2"
},
"devDependencies": {
"@types/prompts": "^2.4.9"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/codama-idl/codama"
},
"bugs": {
"url": "http://github.com/codama-idl/codama/issues"
},
"browserslist": [
"supports bigint and not dead",
"maintained node versions"
]
}
================================================
FILE: packages/cli/src/cli/index.ts
================================================
import { createProgram, runProgram } from '../program';
const program = createProgram();
export async function run(argv: readonly string[]) {
await runProgram(program, argv);
}
================================================
FILE: packages/cli/src/commands/convert.ts
================================================
import { Command } from 'commander';
import { getRootNodeFromIdl, readJson, writeFile } from '../utils';
export function setConvertCommand(program: Command): void {
program
.command('convert')
.argument('<idlPath>', 'Path to the input IDL file (e.g., Anchor or supported standard)')
.argument('<outPath>', 'Path for the output Codama IDL file')
.description('Convert a supported IDL file to Codama IDL format')
.action(doConvert);
}
async function doConvert(idlPath: string, outPath: string) {
const idl = await readJson(idlPath);
const node = await getRootNodeFromIdl(idl);
await writeFile(outPath, JSON.stringify(node, null, 2));
console.log(`Converted IDL written to ${outPath}`);
}
================================================
FILE: packages/cli/src/commands/index.ts
================================================
export * from './init';
export * from './run';
export * from './convert';
================================================
FILE: packages/cli/src/commands/init.ts
================================================
import { Command } from 'commander';
import pico from 'picocolors';
import prompts, { PromptType } from 'prompts';
import { Config, ScriptConfig, ScriptName } from '../config';
import {
canRead,
CliError,
importModuleItem,
installMissingDependencies,
isRootNode,
logBanner,
logSuccess,
PROMPT_OPTIONS,
resolveRelativePath,
writeFile,
} from '../utils';
export function setInitCommand(program: Command): void {
program
.command('init')
.argument('[output]', 'Optional path used to output the configuration file')
.option('-d, --default', 'Bypass prompts and select all defaults options')
.option('--force', 'Overwrite existing configuration file, if any')
.option('--js', 'Forces the output to be a JavaScript file')
.option('--gill', 'Forces the output to be a gill based JavaScript file')
.action(doInit);
}
type InitOptions = {
default?: boolean;
force?: boolean;
gill?: boolean;
js?: boolean;
};
async function doInit(explicitOutput: string | undefined, options: InitOptions) {
const output = getOutputPath(explicitOutput, options);
const configFileType = getConfigFileType(output, options);
if (!options.force && (await canRead(output))) {
throw new CliError(`Configuration file already exists.`, [`${pico.bold('Path')}: ${output}`]);
}
// Start prompts.
logBanner();
const result = await getPromptResult(options, configFileType);
// Check dependencies.
const isAnchor = await isAnchorIdl(result.idlPath);
await installMissingDependencies(`Your configuration requires additional dependencies.`, [
...(isAnchor ? ['@codama/nodes-from-anchor'] : []),
...(result.scripts.includes('js') ? ['@codama/renderers-js'] : []),
...(result.scripts.includes('rust') ? ['@codama/renderers-rust'] : []),
]);
// Write configuration file.
const content = getContentFromPromptResult(result, configFileType);
await writeFile(output, content);
console.log();
logSuccess(pico.bold('Configuration file created.'), [`${pico.bold('Path')}: ${output}`]);
}
function getOutputPath(explicitOutput: string | undefined, options: Pick<InitOptions, 'gill' | 'js'>): string {
if (explicitOutput) {
return resolveRelativePath(explicitOutput);
}
return resolveRelativePath(options.js || options.gill ? 'codama.js' : 'codama.json');
}
type PromptResult = {
idlPath: string;
jsPath?: string;
rustPath?: string;
scripts: string[];
};
async function getPromptResult(
options: Pick<InitOptions, 'default'>,
configFileType: ConfigFileType,
): Promise<PromptResult> {
const defaults = getDefaultPromptResult();
if (options.default) {
return defaults;
}
const hasScript =
(script: string, type: PromptType = 'text') =>
(_: unknown, values: { scripts: string[] }) =>
values.scripts.includes(script) ? type : null;
return await prompts(
[
{
initial: defaults.idlPath,
message: 'Where is your IDL located? (Supports Codama and Anchor IDLs).',
name: 'idlPath',
type: 'text',
},
{
choices: [
{ selected: true, title: 'Generate JavaScript client', value: 'js' },
{ selected: true, title: 'Generate Rust client', value: 'rust' },
],
instructions: '[space] to toggle / [a] to toggle all / [enter] to submit',
message: 'Which script preset would you like to use?',
name: 'scripts',
type: 'multiselect',
onRender() {
if (configFileType === 'gill') {
const value = (this as unknown as { value: prompts.Choice[] }).value;
const jsChoice = value.find(choice => choice.value === 'js')!;
jsChoice.description = pico.yellow('Required with --gill option.');
jsChoice.selected = true;
}
},
},
{
initial: defaults.jsPath,
message: '[js] Where is the JavaScript client package located?',
name: 'jsPath',
type: hasScript('js'),
},
{
initial: defaults.rustPath,
message: '[rust] Where is the Rust client crate located?',
name: 'rustPath',
type: hasScript('rust'),
},
],
PROMPT_OPTIONS,
);
}
function getDefaultPromptResult(): PromptResult {
return {
idlPath: 'program/idl.json',
jsPath: 'clients/js',
rustPath: 'clients/rust',
scripts: ['js', 'rust'],
};
}
type ConfigFileType = 'gill' | 'js' | 'json';
function getConfigFileType(output: string, options: Pick<InitOptions, 'gill' | 'js'>): ConfigFileType {
if (options.gill) return 'gill';
else if (options.js) return 'js';
return output.endsWith('.js') ? 'js' : 'json';
}
function getContentFromPromptResult(result: PromptResult, configFileType: ConfigFileType): string {
switch (configFileType) {
case 'gill':
return getContentForGill(result);
case 'js':
return (
`export default ` +
JSON.stringify(getConfigFromPromptResult(result), null, 4)
// Remove quotes around property names
.replace(/"([^"]+)":/g, '$1:')
// Convert double-quoted strings to single quotes
.replace(/"([^"]*)"/g, "'$1'")
);
case 'json':
default:
return JSON.stringify(getConfigFromPromptResult(result), null, 4);
}
}
function getConfigFromPromptResult(result: PromptResult): Config {
const scripts: Record<ScriptName, ScriptConfig> = {};
if (result.scripts.includes('js')) {
scripts.js = {
from: '@codama/renderers-js',
args: [result.jsPath],
};
}
if (result.scripts.includes('rust')) {
scripts.rust = {
from: '@codama/renderers-rust',
args: [result.rustPath, { formatCode: true }],
};
}
return { idl: result.idlPath, before: [], scripts };
}
function getContentForGill(result: PromptResult): string {
const attributes: string[] = [
`idl: "${result.idlPath}"`,
`clientJs: "${result.jsPath}"`,
...(result.scripts.includes('rust') ? [`clientRust: "${result.rustPath}"`] : []),
];
const attributesString = attributes.map(attr => ` ${attr},\n`).join('');
return (
`import { createCodamaConfig } from "gill";\n\n` +
`export default createCodamaConfig({\n${attributesString}});\n`
);
}
async function isAnchorIdl(idlPath: string): Promise<boolean> {
const resolvedIdlPath = resolveRelativePath(idlPath);
if (!(await canRead(resolvedIdlPath))) return false;
try {
const idlContent = await importModuleItem({ identifier: 'IDL', from: resolvedIdlPath });
return !isRootNode(idlContent);
} catch {
return false;
}
}
================================================
FILE: packages/cli/src/commands/run.ts
================================================
import type { RootNode } from '@codama/nodes';
import { visit, type Visitor } from '@codama/visitors-core';
import { Command } from 'commander';
import pico from 'picocolors';
import { ScriptName } from '../config';
import { getParsedConfigFromCommand, ParsedConfig } from '../parsedConfig';
import {
CliError,
getRootNodeVisitors,
installMissingDependencies,
isLocalModulePath,
logInfo,
logSuccess,
logWarning,
} from '../utils';
export function setRunCommand(program: Command): void {
program
.command('run')
.argument('[scripts...]', 'The scripts to execute')
.option('-a, --all', 'Run all scripts in the configuration file')
.action(doRun);
}
type RunOptions = {
all?: boolean;
};
async function doRun(explicitScripts: string[], { all }: RunOptions, cmd: Command) {
if (all && explicitScripts.length > 0) {
logWarning(`CLI arguments "${explicitScripts.join(' ')}" are ignored because the "--all" option is set.`);
}
const parsedConfig = await getParsedConfigFromCommand(cmd);
const scripts = all ? Object.keys(parsedConfig.scripts) : explicitScripts;
const plans = await getPlans(parsedConfig, scripts);
runPlans(plans, parsedConfig.rootNode);
}
type RunPlan = {
script: ScriptName | null;
visitors: Visitor<RootNode, 'rootNode'>[];
};
async function getPlans(
parsedConfig: Pick<ParsedConfig, 'before' | 'configPath' | 'scripts'>,
scripts: ScriptName[],
): Promise<RunPlan[]> {
const plans: RunPlan[] = [];
if (scripts.length === 0 && parsedConfig.before.length === 0) {
throw new CliError('There are no scripts or before visitors to run.');
}
checkMissingScripts(parsedConfig, scripts);
await checkMissingDependencies(parsedConfig, scripts);
if (parsedConfig.before.length > 0) {
plans.push({ script: null, visitors: await getRootNodeVisitors(parsedConfig.before) });
}
for (const script of scripts) {
plans.push({ script, visitors: await getRootNodeVisitors(parsedConfig.scripts[script]) });
}
return plans;
}
function runPlans(plans: RunPlan[], rootNode: RootNode): void {
for (const plan of plans) {
const result = runPlan(plan, rootNode);
if (!plan.script) {
rootNode = result;
}
}
}
function runPlan(plan: RunPlan, rootNode: RootNode): RootNode {
const visitorLength = plan.visitors.length;
const visitorPluralized = visitorLength === 1 ? 'visitor' : 'visitors';
const identifier = plan.script
? `script "${plan.script}" with ${visitorLength} ${visitorPluralized}`
: `${visitorLength} before ${visitorPluralized}`;
logInfo(`Running ${identifier}...`);
const newRoot = plan.visitors.reduce(visit, rootNode);
logSuccess(`Executed ${identifier}!`);
return newRoot;
}
function checkMissingScripts(parsedConfig: Pick<ParsedConfig, 'configPath' | 'scripts'>, scripts: ScriptName[]) {
const missingScripts = scripts.filter(script => !parsedConfig.scripts[script]);
if (missingScripts.length === 0) return;
const scriptPluralized = missingScripts.length === 1 ? 'Script' : 'Scripts';
const message = parsedConfig.configPath
? `${scriptPluralized} not found in configuration file.`
: `${scriptPluralized} not found because no configuration file was found.`;
const items = [
`${pico.bold(scriptPluralized)}: ${missingScripts.join(', ')}`,
...(parsedConfig.configPath ? [`${pico.bold('Path')}: ${parsedConfig.configPath}`] : []),
];
throw new CliError(message, items);
}
async function checkMissingDependencies(
parsedConfig: Pick<ParsedConfig, 'before' | 'configPath' | 'scripts'>,
scripts: ScriptName[],
) {
const dependencies = new Set<string>([
...parsedConfig.before.map(v => v.path),
...scripts.flatMap(script => parsedConfig.scripts[script]?.map(v => v.path) ?? []),
]);
const externalDependencies = [...dependencies].filter(dep => !isLocalModulePath(dep));
const scriptsRequirePluralized = scripts.length === 1 ? 'script requires' : 'scripts require';
const installed = await installMissingDependencies(
`Your ${scriptsRequirePluralized} additional dependencies.`,
externalDependencies,
);
if (!installed) {
throw new CliError('Cannot proceed without missing dependencies.');
}
}
================================================
FILE: packages/cli/src/config.ts
================================================
import path from 'node:path';
import pico from 'picocolors';
import { ProgramOptions } from './programOptions';
import { canRead, CliError, importModuleItem, logWarning } from './utils';
export type Config = Readonly<{
idl?: string;
scripts?: ScriptsConfig;
before?: readonly VisitorConfig[];
}>;
export type ScriptName = string;
export type ScriptConfig = VisitorConfig | readonly VisitorConfig[];
export type ScriptsConfig = Readonly<Record<ScriptName, ScriptConfig>>;
export type VisitorPath = string;
export type VisitorConfig<T extends readonly unknown[] = readonly unknown[]> = VisitorConfigObject<T> | VisitorPath;
export type VisitorConfigObject<T extends readonly unknown[] = readonly unknown[]> = Readonly<{
args?: T;
from: VisitorPath;
}>;
export async function getConfig(options: Pick<ProgramOptions, 'config'>): Promise<[Config, string | null]> {
const configPath = options.config != null ? path.resolve(options.config) : await getDefaultConfigPath();
if (!configPath) {
logWarning('No configuration file found. Using empty configs. Make sure you provide the `--idl` option.');
return [{}, configPath];
}
const configFile = await importModuleItem({ identifier: 'configuration file', from: configPath });
if (!configFile || typeof configFile !== 'object') {
throw new CliError(`Invalid configuration file.`, [`${pico.bold('Path')}: ${configPath}`]);
}
return [configFile, configPath];
}
async function getDefaultConfigPath(): Promise<string | null> {
const candidatePaths = ['codama.js', 'codama.mjs', 'codama.cjs', 'codama.json'];
for (const candidatePath of candidatePaths) {
const resolvedPath = path.resolve(process.cwd(), candidatePath);
if (await canRead(resolvedPath)) {
return resolvedPath;
}
}
return null;
}
================================================
FILE: packages/cli/src/index.ts
================================================
export * from './program';
================================================
FILE: packages/cli/src/parsedConfig.ts
================================================
import type { RootNode } from '@codama/nodes';
import { Command } from 'commander';
import { Config, getConfig, ScriptName, ScriptsConfig, VisitorConfig, VisitorPath } from './config';
import { ProgramOptions } from './programOptions';
import {
CliError,
getRootNodeFromIdl,
importModuleItem,
isLocalModulePath,
resolveConfigPath,
resolveRelativePath,
} from './utils';
export type ParsedConfig = Readonly<{
configPath: string | null;
idlContent: unknown;
idlPath: string;
rootNode: RootNode;
scripts: ParsedScriptsConfig;
before: readonly ParsedVisitorConfig[];
}>;
export type ParsedScriptsConfig = Readonly<Record<ScriptName, readonly ParsedVisitorConfig[]>>;
export type ParsedVisitorConfig<T extends readonly unknown[] = readonly unknown[]> = Readonly<{
args: T;
index: number;
item: string | undefined;
path: VisitorPath;
script: ScriptName | null;
}>;
export async function getParsedConfigFromCommand(cmd: Command): Promise<ParsedConfig> {
return await getParsedConfig(cmd.optsWithGlobals());
}
export async function getParsedConfig(options: Pick<ProgramOptions, 'config' | 'idl'>): Promise<ParsedConfig> {
const [config, configPath] = await getConfig(options);
return await parseConfig(config, configPath, options);
}
async function parseConfig(
config: Config,
configPath: string | null,
options: Pick<ProgramOptions, 'idl'>,
): Promise<ParsedConfig> {
const idlPath = parseIdlPath(config, configPath, options);
const idlContent = await importModuleItem({ identifier: 'IDL', from: idlPath });
const rootNode = await getRootNodeFromIdl(idlContent);
const scripts = parseScripts(config.scripts ?? {}, configPath);
const visitors = (config.before ?? []).map((v, i) => parseVisitorConfig(v, configPath, i, null));
return { configPath, idlContent, idlPath, rootNode, scripts, before: visitors };
}
function parseIdlPath(
config: Pick<Config, 'idl'>,
configPath: string | null,
options: Pick<ProgramOptions, 'idl'>,
): string {
if (options.idl) {
return resolveRelativePath(options.idl);
}
if (config.idl) {
return resolveConfigPath(config.idl, configPath);
}
throw new CliError('No IDL identified. Please provide the `--idl` option or set it in the configuration file.');
}
function parseScripts(scripts: ScriptsConfig, configPath: string | null): ParsedScriptsConfig {
const entryPromises = Object.entries(scripts).map(([name, scriptConfig]) => {
const visitors: readonly VisitorConfig[] = Array.isArray(scriptConfig) ? scriptConfig : [scriptConfig];
return [name, visitors.map((v, i) => parseVisitorConfig(v, configPath, i, name))] as const;
});
return Object.fromEntries(entryPromises);
}
function parseVisitorConfig<T extends readonly unknown[]>(
visitorConfig: VisitorConfig<T>,
configPath: string | null,
index: number,
script: ScriptName | null,
): ParsedVisitorConfig<T> {
const emptyArgs = [] as readonly unknown[] as T;
const visitorPath = typeof visitorConfig === 'string' ? visitorConfig : visitorConfig.from;
const visitorArgs = typeof visitorConfig === 'string' ? emptyArgs : (visitorConfig.args ?? emptyArgs);
const [path, item] = resolveVisitorPath(visitorPath, configPath);
return { args: visitorArgs, index, item, path, script };
}
function resolveVisitorPath(visitorPath: string, configPath: string | null): readonly [string, string | undefined] {
const [modulePath, itemName] = visitorPath.split('#') as [string, string | undefined];
const resolveModulePath = isLocalModulePath(modulePath) ? resolveConfigPath(modulePath, configPath) : modulePath;
return [resolveModulePath, itemName];
}
================================================
FILE: packages/cli/src/program.ts
================================================
import { Command, createCommand, ParseOptions } from 'commander';
import pico from 'picocolors';
import { setConvertCommand, setInitCommand, setRunCommand } from './commands';
import { setProgramOptions } from './programOptions';
import { logDebug, logError } from './utils';
export async function codama(args: string[], opts?: { suppressOutput?: boolean }): Promise<void> {
const program = createProgram({
exitOverride: true,
suppressOutput: opts?.suppressOutput,
});
await runProgram(program, args, { from: 'user' });
}
export async function runProgram(program: Command, argv: readonly string[], parseOptions?: ParseOptions) {
try {
await program.parseAsync(argv, parseOptions);
} catch (err) {
const error = err as { message: string; stack?: string; items?: string[] };
if (program.opts().debug) {
logDebug(`${error.stack}`);
}
logError(pico.bold(error.message), error.items ?? []);
process.exitCode = 1;
}
}
export function createProgram(internalOptions?: { exitOverride?: boolean; suppressOutput?: boolean }): Command {
const program = createCommand()
.version(__VERSION__)
.allowExcessArguments(false)
.configureHelp({ showGlobalOptions: true, sortOptions: true, sortSubcommands: true });
// Set program options and commands.
setProgramOptions(program);
setInitCommand(program);
setRunCommand(program);
setConvertCommand(program);
// Internal options.
if (internalOptions?.exitOverride) {
program.exitOverride();
}
if (internalOptions?.suppressOutput) {
program.configureOutput({
writeErr: () => {},
writeOut: () => {},
});
}
return program;
}
================================================
FILE: packages/cli/src/programOptions.ts
================================================
import { Command } from 'commander';
export type ProgramOptions = Readonly<{
config?: string;
debug?: boolean;
idl?: string;
}>;
export function setProgramOptions(program: Command): void {
program
.option('--debug', 'include debugging information, such as stack dump')
.option('-i, --idl <path>', 'The path to the IDL to use.')
.option('-c, --config <path>', 'The path to the Codama configuration file. Defaults to `codama.(js|json)`.');
}
================================================
FILE: packages/cli/src/types/global.d.ts
================================================
declare const __BROWSER__: boolean;
declare const __ESM__: boolean;
declare const __NODEJS__: boolean;
declare const __REACTNATIVE__: boolean;
declare const __TEST__: boolean;
declare const __VERSION__: string;
================================================
FILE: packages/cli/src/utils/childCommands.ts
================================================
import { ChildProcess, spawn, SpawnOptions } from 'child_process';
export type ChildCommand = {
command: string;
args: string[];
};
export function createChildCommand(command: string, args: string[] = []): ChildCommand {
return { command, args };
}
export function formatChildCommand(childCommand: ChildCommand): string {
const { command, args } = childCommand;
return [command, ...args].join(' ');
}
export type ChildProcessResult = ChildProcess & {
stdoutString: string;
stderrString: string;
};
export type ChildProcessError = Error & {
childProcess: ChildProcessResult;
};
export async function spawnChildCommand(
childCommand: ChildCommand,
options: SpawnOptions & { quiet: boolean } = { quiet: false },
): Promise<ChildProcess & { stdoutString: string; stderrString: string }> {
const { command, args } = childCommand;
const childProcess = spawn(command, args, options) as ChildProcessResult;
childProcess.stdoutString = '';
childProcess.stderrString = '';
childProcess.stdout?.on('data', (chunk: Uint8Array) => {
childProcess.stdoutString += chunk.toString();
if (!options.quiet) {
process.stdout.write(chunk);
}
});
childProcess.stderr?.on('data', (chunk: Uint8Array) => {
childProcess.stderrString += chunk.toString();
if (!options.quiet) {
process.stderr.write(chunk);
}
});
const exitCode: number = await new Promise((resolve, reject) => {
childProcess.on('error', () => reject(createChildProcessResultError(childCommand, childProcess)));
childProcess.on('close', resolve);
});
if (exitCode) {
throw createChildProcessResultError(childCommand, childProcess);
}
return childProcess;
}
function createChildProcessResultError(
childCommand: ChildCommand,
childProcess: ChildProcessResult,
): ChildProcessError {
const error = new Error(`Command [${formatChildCommand(childCommand)}] failed`) as ChildProcessError;
error.childProcess = childProcess;
return error;
}
================================================
FILE: packages/cli/src/utils/errors.ts
================================================
export class CliError extends Error {
constructor(
message: string,
public items: string[] = [],
options?: ErrorOptions,
) {
super(message, options);
this.name = 'CliError';
}
}
================================================
FILE: packages/cli/src/utils/fs.ts
================================================
import { R_OK, W_OK } from 'node:constants';
import fs, { PathLike } from 'node:fs';
import path from 'node:path';
export function resolveRelativePath(childPath: string, relativeDirectory: string | null = null) {
return path.resolve(relativeDirectory ?? process.cwd(), childPath);
}
export function resolveConfigPath(childPath: string, configPath: string | null) {
const configDir = configPath ? path.dirname(configPath) : null;
return resolveRelativePath(childPath, configDir);
}
export function isLocalModulePath(modulePath: string) {
return modulePath.startsWith('.') || modulePath.startsWith('/');
}
export async function readJson<T>(filePath: string): Promise<T> {
return JSON.parse(await readFile(filePath)) as T;
}
export async function readFile(filePath: string): Promise<string> {
return await fs.promises.readFile(filePath, 'utf8');
}
export async function writeFile(filePath: string, content: string) {
const directory = path.dirname(filePath);
if (!(await canWrite(directory))) {
await fs.promises.mkdir(directory, { recursive: true });
}
await fs.promises.writeFile(filePath, content);
}
export async function canRead(p: PathLike) {
try {
await fs.promises.access(p, R_OK);
return true;
} catch {
return false;
}
}
export async function canWrite(p: PathLike) {
try {
await fs.promises.access(p, W_OK);
return true;
} catch {
return false;
}
}
================================================
FILE: packages/cli/src/utils/import.ts
================================================
import { createRequire } from 'node:module';
import pico from 'picocolors';
import { CliError } from './errors';
import { canRead, isLocalModulePath, resolveRelativePath } from './fs';
type ImportModuleItemOptions = {
from: string;
identifier?: string;
item?: string;
};
export async function importModuleItem<T = unknown>(options: ImportModuleItemOptions): Promise<T> {
const module = await importModule(options);
const moduleItem = pickModuleItem(module, options.item) as T | undefined;
if (moduleItem === undefined) {
const items = getErrorItems(options);
throw new CliError(`Failed to load ${options.identifier ?? 'module'}.`, items);
}
return moduleItem;
}
type ModuleDefinition = Partial<Record<string, unknown>> & {
__esModule?: boolean;
default?: Partial<Record<string, unknown>> & { default?: Partial<Record<string, unknown>> };
};
function pickModuleItem(module: ModuleDefinition, item: string = 'default'): unknown {
if (item === 'default') {
return module.default?.default ?? module.default ?? module;
}
return module[item] ?? module.default?.[item] ?? module.default?.default?.[item];
}
async function importModule<T extends object>(options: ImportModuleItemOptions): Promise<T> {
if (isLocalModulePath(options.from)) {
return await importLocalModule(options);
}
try {
return await importExternalUserModule(options);
} catch {
return await importExternalModule(options);
}
}
async function importLocalModule<T extends object>(options: ImportModuleItemOptions): Promise<T> {
const { from, identifier } = options;
if (!(await canRead(from))) {
const items = getErrorItems(options);
throw new CliError(`Cannot access ${identifier ?? 'module'}.`, items);
}
const dotIndex = from.lastIndexOf('.');
const extension = dotIndex === -1 ? undefined : from.slice(dotIndex);
const modulePromise = extension === '.json' ? import(from, { with: { type: 'json' } }) : import(from);
return await handleImportPromise(modulePromise, options);
}
async function importExternalModule<T extends object>(options: ImportModuleItemOptions): Promise<T> {
return await handleImportPromise(import(options.from), options);
}
async function importExternalUserModule<T extends object>(options: ImportModuleItemOptions): Promise<T> {
const userPackageJsonPath = resolveRelativePath('package.json');
const userRequire = createRequire(userPackageJsonPath);
const userFrom = userRequire.resolve(options.from);
return await importExternalModule<T>({ ...options, from: userFrom });
}
async function handleImportPromise<T extends object>(
importPromise: Promise<unknown>,
options: ImportModuleItemOptions,
): Promise<T> {
try {
return (await importPromise) as T;
} catch (cause) {
const items = getErrorItems(options, cause);
throw new CliError(`Failed to load ${options.identifier ?? 'module'}.`, items, { cause });
}
}
function getErrorItems(options: ImportModuleItemOptions, cause?: unknown): string[] {
const { from, item } = options;
const items = [`${pico.bold('Module')}: ${from}`];
if (item) {
items.push(`${pico.bold('Item')}: ${item}`);
}
const hasCause = !!cause && typeof cause === 'object' && 'message' in cause && typeof cause.message === 'string';
if (hasCause) {
items.push(`${pico.bold('Caused by')}: ${(cause as { message: string }).message}`);
}
return items;
}
================================================
FILE: packages/cli/src/utils/index.ts
================================================
export * from './childCommands';
export * from './errors';
export * from './fs';
export * from './import';
export * from './logs';
export * from './nodes';
export * from './packageInstall';
export * from './packageJson';
export * from './packageManager';
export * from './promises';
export * from './prompts';
export * from './visitors';
================================================
FILE: packages/cli/src/utils/logs.ts
================================================
import pico from 'picocolors';
type LogLevel = 'debug' | 'error' | 'info' | 'success' | 'warning';
type LogOptions = {
level: LogLevel;
message: string;
items?: string[];
};
function getLogLevelInfo(logLevel: LogLevel) {
const identity = (text: string) => text;
const infos: Record<LogLevel, [string, (text: string) => string, (text: string) => string]> = {
success: ['✔', pico.green, pico.green],
info: ['→', pico.blueBright, identity],
warning: ['▲', pico.yellow, pico.yellow],
error: ['✖', pico.red, pico.red],
debug: ['✱', pico.magenta, pico.magenta],
};
return {
icon: infos[logLevel][0],
color: infos[logLevel][1],
messageColor: infos[logLevel][2],
};
}
const logWrapper = (level: LogLevel) => (message: string, items?: string[]) => log({ level, message, items });
export const logSuccess = logWrapper('success');
export const logError = logWrapper('error');
export const logInfo = logWrapper('info');
export const logWarning = logWrapper('warning');
export const logDebug = logWrapper('debug');
function log({ level, message, items }: LogOptions): void {
const { icon, color, messageColor } = getLogLevelInfo(level);
console.log(color(icon), messageColor(message));
if (items) {
logItems(items, color);
}
}
function logItems(items: string[], color?: (text: string) => string): void {
const colorFn = color ?? (text => text);
items.forEach((item, index) => {
const prefix = index === items.length - 1 ? '└─' : '├─';
console.log(' ' + colorFn(prefix), item);
});
}
export function logBanner(): void {
console.log(pico.bold(codamaColor('Welcome to Codama!')));
}
function codamaColor(text: string): string {
if (!pico.isColorSupported) return text;
return `\x1b[38;2;231;171;97m${text}\x1b[0m`;
}
================================================
FILE: packages/cli/src/utils/nodes.ts
================================================
import type { RootNode } from '@codama/nodes';
import { CliError } from './errors';
import { importModuleItem } from './import';
import { installMissingDependencies } from './packageInstall';
export async function getRootNodeFromIdl(idl: unknown): Promise<RootNode> {
if (typeof idl !== 'object' || idl === null) {
throw new CliError('Unexpected IDL content. Expected an object, got ' + typeof idl);
}
if (isRootNode(idl)) {
return idl;
}
const hasNodesFromAnchor = await installMissingDependencies(
'Anchor IDL detected. Additional dependencies are required to process Anchor IDLs.',
['@codama/nodes-from-anchor'],
);
if (!hasNodesFromAnchor) {
throw new CliError('Cannot proceed without Anchor IDL support.');
}
const rootNodeFromAnchor = await importModuleItem<(idl: unknown) => RootNode>({
from: '@codama/nodes-from-anchor',
item: 'rootNodeFromAnchor',
});
return rootNodeFromAnchor(idl);
}
export function isRootNode(value: unknown): value is RootNode {
return (
typeof value === 'object' &&
value !== null &&
(value as { standard?: string }).standard === 'codama' &&
(value as { kind?: string }).kind === 'rootNode'
);
}
================================================
FILE: packages/cli/src/utils/packageInstall.ts
================================================
import pico from 'picocolors';
import prompts from 'prompts';
import { ChildCommand, createChildCommand, formatChildCommand, spawnChildCommand } from './childCommands';
import { logError, logInfo, logSuccess, logWarning } from './logs';
import { getPackageJsonDependencies } from './packageJson';
import { getPackageManager } from './packageManager';
import { PROMPT_OPTIONS } from './prompts';
export async function getPackageManagerInstallCommand(
packages: string[],
options: string[] = [],
): Promise<ChildCommand> {
const packageManager = await getPackageManager();
const args = [packageManager === 'yarn' ? 'add' : 'install', ...packages, ...options];
return createChildCommand(packageManager, args);
}
export async function installMissingDependencies(message: string, requiredDependencies: string[]): Promise<boolean> {
if (requiredDependencies.length === 0) return true;
const installedDependencies = await getPackageJsonDependencies({ includeDev: true });
const missingDependencies = requiredDependencies.filter(dep => !installedDependencies.includes(dep));
if (missingDependencies.length === 0) return true;
return await installDependencies(message, missingDependencies);
}
export async function installDependencies(message: string, dependencies: string[]): Promise<boolean> {
if (dependencies.length === 0) return true;
const installCommand = await getPackageManagerInstallCommand(dependencies);
const formattedInstallCommand = pico.yellow(formatChildCommand(installCommand));
if (process.env.CI) {
logWarning(message);
logWarning(`Skipping installation in CI environment. Please install manually:`);
logWarning(formattedInstallCommand);
return false;
}
logWarning(message);
logWarning(`Install command: ${formattedInstallCommand}`);
const dependencyResult: { installDependencies: boolean } = await prompts(
{ initial: true, message: 'Install dependencies?', name: 'installDependencies', type: 'confirm' },
PROMPT_OPTIONS,
);
if (!dependencyResult.installDependencies) {
logWarning('Skipping installation.');
return false;
}
try {
logInfo(`Installing`, dependencies);
await spawnChildCommand(installCommand, { quiet: true });
logSuccess(`Dependencies installed successfully.`);
return true;
} catch {
logError(`Failed to install dependencies. Please try manually:`);
logError(formattedInstallCommand);
return false;
}
}
================================================
FILE: packages/cli/src/utils/packageJson.ts
================================================
import pico from 'picocolors';
import { CliError } from './errors';
import { canRead, readJson, resolveRelativePath } from './fs';
type PackageJson = {
name: string;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
scripts?: Record<string, string>;
packageManager?: string;
[key: string]: unknown;
};
let packageJson: PackageJson | undefined;
export async function getPackageJson(): Promise<PackageJson> {
if (!packageJson) {
const packageJsonPath = resolveRelativePath('package.json');
if (!(await canRead(packageJsonPath))) {
throw new CliError('Cannot read package.json.', [`${pico.bold('Path')}: ${packageJsonPath}`]);
}
packageJson = await readJson<PackageJson>(packageJsonPath);
}
return packageJson;
}
export async function getPackageJsonDependencies(options: { includeDev?: boolean } = {}): Promise<string[]> {
const packageJson = await getPackageJson();
return [
...(packageJson.dependencies ? Object.keys(packageJson.dependencies) : []),
...(options.includeDev && packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : []),
];
}
================================================
FILE: packages/cli/src/utils/packageManager.ts
================================================
import { createChildCommand, spawnChildCommand } from './childCommands';
import { canRead, resolveRelativePath } from './fs';
import { getPackageJson } from './packageJson';
type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
const FALLBACK_PACKAGE_MANAGER: PackageManager = 'npm';
let packageManager: PackageManager | undefined;
export async function getPackageManager(): Promise<PackageManager> {
if (!packageManager) {
packageManager = await detectPackageManager();
}
return packageManager;
}
async function detectPackageManager(): Promise<PackageManager> {
const fromPackageJson = await detectPackageManagerFromPackageJson();
if (fromPackageJson) return fromPackageJson;
const fromLockfile = await detectPackageManagerFromLockfile();
if (fromLockfile) return fromLockfile;
const fromInstalledCli = await detectPackageManagerFromInstalledCli();
if (fromInstalledCli) return fromInstalledCli;
return FALLBACK_PACKAGE_MANAGER;
}
async function detectPackageManagerFromPackageJson(): Promise<PackageManager | undefined> {
const packageJson = await getPackageJson();
if (!packageJson.packageManager) return undefined;
if (packageJson.packageManager.startsWith('npm@')) return 'npm';
if (packageJson.packageManager.startsWith('pnpm@')) return 'pnpm';
if (packageJson.packageManager.startsWith('yarn@')) return 'yarn';
if (packageJson.packageManager.startsWith('bun@')) return 'bun';
return undefined;
}
async function detectPackageManagerFromLockfile(): Promise<PackageManager | undefined> {
const [isYarn, isPnpm, isBun, isNpm] = await Promise.all([
canRead(resolveRelativePath('yarn.lock')),
canRead(resolveRelativePath('pnpm-lock.yaml')),
canRead(resolveRelativePath('bun.lockb')),
canRead(resolveRelativePath('package-lock.json')),
]);
if (isYarn) return 'yarn';
if (isPnpm) return 'pnpm';
if (isBun) return 'bun';
if (isNpm) return 'npm';
return undefined;
}
async function detectPackageManagerFromInstalledCli(): Promise<PackageManager | undefined> {
const [isPnpm, isYarn, isBun] = await Promise.all([
hasPackageManagerCli('pnpm'),
hasPackageManagerCli('yarn'),
hasPackageManagerCli('bun'),
]);
if (isPnpm) return 'pnpm';
if (isYarn) return 'yarn';
if (isBun) return 'bun';
return undefined;
}
async function hasPackageManagerCli(packageManager: PackageManager): Promise<boolean> {
return await spawnChildCommand(createChildCommand(packageManager, ['--version']), { quiet: true })
.then(() => true)
.catch(() => false);
}
================================================
FILE: packages/cli/src/utils/promises.ts
================================================
export function promisify<T>(value: Promise<T> | T): Promise<T> {
return Promise.resolve(value);
}
================================================
FILE: packages/cli/src/utils/prompts.ts
================================================
import prompts from 'prompts';
import { CliError } from './errors';
export const PROMPT_OPTIONS: prompts.Options = {
onCancel: () => {
throw new CliError('Operation cancelled.');
},
};
================================================
FILE: packages/cli/src/utils/visitors.ts
================================================
import type { RootNode } from '@codama/nodes';
import { rootNodeVisitor, visit, type Visitor } from '@codama/visitors-core';
import pico from 'picocolors';
import { ParsedVisitorConfig } from '../parsedConfig';
import { CliError } from './errors';
import { importModuleItem } from './import';
import { isRootNode } from './nodes';
import { promisify } from './promises';
export async function getRootNodeVisitors(
visitors: readonly ParsedVisitorConfig[],
): Promise<Visitor<RootNode, 'rootNode'>[]> {
return await Promise.all(visitors.map(getRootNodeVisitor));
}
async function getRootNodeVisitor(visitorConfig: ParsedVisitorConfig): Promise<Visitor<RootNode, 'rootNode'>> {
const { item, path } = visitorConfig;
const identifier = getVisitorIdentifier(visitorConfig);
const moduleItem = await importModuleItem({ identifier, from: path, item });
const visitor = await getVisitorFromModuleItem(identifier, moduleItem, visitorConfig);
return rootNodeVisitor(root => {
const result = visit(root, visitor);
return isRootNode(result) ? result : root;
});
}
type UnknownFunction = (...args: readonly unknown[]) => unknown;
async function getVisitorFromModuleItem(
identifier: string,
moduleItem: unknown,
visitorConfig: ParsedVisitorConfig,
): Promise<Visitor<unknown, 'rootNode'>> {
const { args, item, path } = visitorConfig;
if (isRootNodeVisitor(moduleItem)) {
return moduleItem;
}
if (typeof moduleItem === 'function') {
const result = await promisify((moduleItem as UnknownFunction)(...args));
if (isRootNodeVisitor(result)) {
return result;
}
}
throw new CliError(`Invalid visitor. Expected a visitor or a function returning a visitor.`, [
`${pico.bold('Visitor')}: ${identifier}`,
`${pico.bold('Path')}: ${path}`,
...(item ? [`${pico.bold('Item')}: ${item}`] : []),
]);
}
function isRootNodeVisitor(value: unknown): value is Visitor<unknown, 'rootNode'> {
return !!value && typeof value === 'object' && 'visitRoot' in value;
}
function getVisitorIdentifier(visitorConfig: ParsedVisitorConfig): string {
const { index, script } = visitorConfig;
let identifier = `visitor #${index}`;
identifier += script ? ` in script "${script}"` : '';
return identifier;
}
================================================
FILE: packages/cli/test/exports/commonjs.cjs
================================================
const path = require('path');
const { codama } = require('../../dist/index.node.cjs');
const configPath = path.join('test', 'exports', 'mock-config.json');
codama(['run', '-c', configPath]);
================================================
FILE: packages/cli/test/exports/mock-config.json
================================================
{
"idl": "mock-idl.json",
"before": ["@codama/visitors#identityVisitor"],
"scripts": {}
}
================================================
FILE: packages/cli/test/exports/mock-idl.json
================================================
{
"kind": "rootNode",
"standard": "codama",
"version": "1.0.0",
"program": {
"kind": "programNode",
"name": "myProgram",
"accounts": [],
"instructions": [],
"definedTypes": [],
"errors": [],
"pdas": []
},
"additionalPrograms": []
}
================================================
FILE: packages/cli/test/exports/module.mjs
================================================
import path from 'path';
import { codama } from '../../dist/index.node.mjs';
const configPath = path.join('test', 'exports', 'mock-config.json');
codama(['run', '-c', configPath]);
================================================
FILE: packages/cli/test/index.test.ts
================================================
import { expect, test } from 'vitest';
import { createProgram } from '../src';
test('it exports a function to create a CLI program', () => {
expect(typeof createProgram).toBe('function');
});
================================================
FILE: packages/cli/tsconfig.declarations.json
================================================
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
},
"extends": "./tsconfig.json",
"include": ["src/index.ts", "src/types"]
}
================================================
FILE: packages/cli/tsconfig.json
================================================
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"module": "ESNext"
},
"display": "codama",
"extends": "../../tsconfig.json",
"include": ["src", "test"]
}
================================================
FILE: packages/cli/tsup.config.ts
================================================
import { defineConfig, Options as TsupConfig } from 'tsup';
import { getBuildConfig, getCliBuildConfig } from '../../tsup.config.base';
export default defineConfig([
removeAdditionalTreeShaking(getBuildConfig({ format: 'cjs', platform: 'node' })),
removeAdditionalTreeShaking(getBuildConfig({ format: 'esm', platform: 'node' })),
removeAdditionalTreeShaking(getCliBuildConfig()),
]);
function removeAdditionalTreeShaking(config: TsupConfig): TsupConfig {
return {
...config,
// Treeshaking already happens with esbuild but tsup offers this options
// for "better" treeshaking strategies using Rollup as an additional step.
// The issue is Rollup now uses the deprecated "assert" import keyword by default
// And tsup doesn't offer a way to change this behavior. Since the CLI package
// relies on using the "with" keyword to dynamically import JSON files,
// we can't use Rollup for treeshaking.
treeshake: false,
};
}
================================================
FILE: packages/cli/vitest.config.mts
================================================
import { defineConfig } from 'vitest/config';
import { getVitestConfig } from '../../vitest.config.base.mjs';
export default defineConfig({
test: {
projects: [getVitestConfig('node')],
},
});
================================================
FILE: packages/dynamic-client/.gitignore
================================================
dist/
test/programs/anchor/.anchor/
test/programs/anchor/target/
test/programs/generated/
================================================
FILE: packages/dynamic-client/.prettierignore
================================================
dist/
test/e2e/
test-ledger/
target/
CHANGELOG.md
generated/
idls/
================================================
FILE: packages/dynamic-client/LICENSE
================================================
MIT License
Copyright (c) 2025 Codama
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: packages/dynamic-client/README.md
================================================
# Codama ➤ Dynamic Client
[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
[npm-downloads-image]: https://img.shields.io/npm/dm/@codama/dynamic-client.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@codama/dynamic-client.svg?style=flat&label=%40codama%2Fdynamic-client
[npm-url]: https://www.npmjs.com/package/@codama/dynamic-client
This package provides a runtime Solana instruction builder that dynamically constructs `Instruction` (`@solana/instructions`) from Codama IDL and provides type generation for full TypeScript type safety.
## Installation
```sh
pnpm install @codama/dynamic-client
```
> [!NOTE]
> This package is **not** included in the main [`codama`](../library) package.
## Quick Start
### Untyped
```ts
import { createProgramClient } from '@codama/dynamic-client';
import idl from './my-program-idl.json';
const client = createProgramClient(idl);
const instruction = await client.methods
.transferSol({ amount: 1_000_000_000 })
.accounts({ source: senderAddress, destination: receiverAddress })
.instruction();
```
### Typed with generated types
```ts
import { createProgramClient } from '@codama/dynamic-client';
import type { MyProgramClient } from './generated/my-program-types';
import idl from './my-program-idl.json';
const client = createProgramClient<MyProgramClient>(idl);
// client.methods, .accounts(), args are now fully typed
```
## API Reference
### `createProgramClient<T>(idl, options?)`
Creates a program client from a Codama IDL.
| Parameter | Type | Description |
| ------------------- | ------------------ | ----------------------------------------- |
| `idl` | `object \| string` | Codama IDL object or JSON string |
| `options.programId` | `AddressInput` | Override the program address from the IDL |
Returns a `ProgramClient` (or `T` when a type parameter is provided).
### `ProgramClient`
```ts
type InstructionName = CamelCaseString;
type AccountName = CamelCaseString;
type ProgramClient = {
methods: Record<InstructionName, (args?) => ProgramMethodBuilder>;
pdas?: Record<AccountName, (seeds?) => Promise<ProgramDerivedAddress>>;
programAddress: Address;
instructions: Map<InstructionName, InstructionNode>;
root: RootNode;
};
```
### `ProgramMethodBuilder` (fluent API)
```ts
client.methods
.myInstruction(args) // provide instruction arguments
.accounts(accounts) // provide account addresses
.signers(['accountName']) // optionally mark ambiguous accounts as signers
.resolvers({ customResolver: async (argumentsInput, accountsInput) => {} }) // optionally provide custom resolver according to resolverValueNode in IDL
.instruction(); // Promise<Instruction>
```
### `AddressInput`
Accepts any of:
- `Address` (from `@solana/addresses`)
- Legacy `PublicKey` (any object with `.toBase58()`)
- Base58 string
## Accounts
### Automatic resolution rules
Accounts (pda, program ids) with `defaultValue` are resolved automatically, hence can be omitted.
| Account scenario | Type in `.accounts()` | Auto resolution |
| --------------------------------------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------- |
| Required account without `defaultValue` | `{ system: Address }` | No |
| Required account with `defaultValue`<br>(PDA, programId, etc.) | `{ system?: Address }` | Auto-resolved to `defaultValue` if omitted |
| Optional account (`isOptional: true`)<br>without `defaultValue` | `{ system: Address \| null }` | Resolved via `optionalAccountStrategy`,<br>if provided as `null` |
| Optional account (`isOptional: true`)<br>with `defaultValue` | `{ system?: Address \| null }` | - `null` resolves via `optionalAccountStrategy`<br>- `undefined` resolves via `defaultValue` |
### Auto-resolved account addresses
Accounts with `defaultValue` in the IDL are automatically resolved when omitted from `.accounts()`. This includes:
- **PDA accounts** — derived from seeds defined in the IDL
- **Program IDs** — resolved to known program addresses (e.g., System Program, Token Program)
- **Constants** — resolved from constant value nodes
You can always override auto-derived accounts by providing an explicit address.
### Optional accounts
Pass `null` for optional accounts to be resolved according to `optionalAccountStrategy` (either will be `omitted` or replaced on `programId`):
```ts
.accounts({
authority,
program: programAddress,
programData: null, // optional - resolved via optionalAccountStrategy
})
```
### Ambiguous signers
When an account has `isSigner: 'either'` in the IDL, use `.signers()` to explicitly mark it:
```ts
.accounts({ owner: ownerAddress })
.signers(['owner'])
```
### Custom resolvers
When an account or argument is `resolverValueNode` in the IDL, provide a custom resolver function `.resolvers({ [resolverName]: async fn })` to help with account/arguments resolution:
```ts
client.methods
.create({ tokenStandard: 'NonFungible' })
.accounts({ owner: ownerAddress })
.resolvers({
resolveIsNonFungible: async (argumentsInput, accountsInput) => {
return argumentsInput.tokenStandard === 'NonFungible';
},
});
```
## PDA Derivation
### Standalone
```ts
const [address, bump] = await client.pdas.canonical({
program: programAddress,
seed: 'idl',
});
```
### Auto-derived in instructions
Accounts with `pdaValueNode` defaults are resolved automatically. Seeds are pulled from other accounts and arguments in the instruction:
```ts
// metadata PDA is auto-derived from program + seed
const ix = await client.methods
.initialize({ seed: 'idl', data: myData /* ... */ })
.accounts({ authority, program: programAddress, programData })
.instruction();
```
Nested/dependent PDAs (where one PDA seed references another PDA) are resolved recursively.
## Arguments
Arguments with `defaultValueStrategy: 'omitted'` (e.g., discriminators) are auto-encoded and should not be provided.
## Error Handling
All errors are instances of `CodamaError` from `@codama/errors`:
```ts
import { CodamaError, isCodamaError, CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING } from '@codama/dynamic-client';
try {
const ix = await client.methods.transferSol({ amount: 100 }).accounts({}).instruction();
} catch (err) {
if (isCodamaError(err, CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING)) {
console.error(`Missing account: ${err.context.accountName}`);
}
}
```
## CLI
The package includes a CLI for generating TypeScript types from Codama IDL files.
```sh
npx @codama/dynamic-client generate-client-types <codama-idl.json> <output-dir>
```
Example:
```sh
npx @codama/dynamic-client generate-client-types ./idl/codama.json ./generated
```
This reads the IDL file and writes a `*-types.ts` file to the output directory containing strongly-typed interfaces for all instructions, accounts, arguments, PDAs, and the program client.
### `generateClientTypes(idl)`
The same is available as a TypeScript function:
```ts
import { generateClientTypes } from '@codama/dynamic-client';
import type { RootNode } from 'codama';
import { readFileSync, writeFileSync } from 'node:fs';
const idl: RootNode = JSON.parse(readFileSync('./my-program-idl.json', 'utf-8'));
const typesSource = generateClientTypes(idl);
writeFileSync('./generated/my-program-idl-types.ts', typesSource);
```
## Utilities
```ts
import { toAddress, isPublicKeyLike } from '@codama/dynamic-client';
// Convert any AddressInput to Address
const addr = toAddress('11111111111111111111111111111111');
const addr2 = toAddress(new PublicKey('...'));
// Type guard for legacy PublicKey objects
if (isPublicKeyLike(value)) {
const addr = toAddress(value);
}
```
================================================
FILE: packages/dynamic-client/bin/cli.cjs
================================================
#!/usr/bin/env node
const run = require('../dist/cli.cjs').run;
run(process.argv);
================================================
FILE: packages/dynamic-client/package.json
================================================
{
"name": "@codama/dynamic-client",
"version": "0.1.0",
"description": "Tool to dynamically build instructions based on Codama IDLs",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/codama-idl/codama",
"directory": "packages/dynamic-client"
},
"bugs": {
"url": "http://github.com/codama-idl/codama/issues"
},
"bin": {
"dynamic-client": "./bin/cli.cjs"
},
"exports": {
"types": "./dist/types/index.d.ts",
"react-native": "./dist/index.react-native.mjs",
"browser": {
"import": "./dist/index.browser.mjs",
"require": "./dist/index.browser.cjs"
},
"node": {
"import": "./dist/index.node.mjs",
"require": "./dist/index.node.cjs"
}
},
"browser": {
"./dist/index.node.cjs": "./dist/index.browser.cjs",
"./dist/index.node.mjs": "./dist/index.browser.mjs"
},
"main": "./dist/index.node.cjs",
"module": "./dist/index.node.mjs",
"react-native": "./dist/index.react-native.mjs",
"types": "./dist/types/index.d.ts",
"type": "commonjs",
"files": [
"./dist/types",
"./dist/index.*",
"./dist/cli.*",
"./bin/*"
],
"sideEffects": false,
"keywords": [
"solana",
"framework",
"standard",
"specifications",
"dynamic client"
],
"scripts": {
"build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",
"dev": "vitest --project node",
"lint": "pnpm generate-program-types && eslint . && prettier --check .",
"lint:fix": "pnpm generate-program-types && eslint --fix . && prettier --write .",
"test": "pnpm test:setup && pnpm test:types && pnpm test:treeshakability && pnpm test:unit",
"test:setup": "pnpm test:anchor:build && ( [ -n \"$CI\" ] || pnpm generate-idl-from-anchor ) && pnpm generate-program-types",
"test:anchor:build": "cd test/programs/anchor && anchor build",
"test:treeshakability": "for file in dist/index.*.mjs; do agadoo $file; done",
"test:types": "tsc --noEmit",
"test:unit": "vitest run",
"generate-idl-from-anchor": "node ./scripts/generate-idl-from-anchor.mjs",
"generate-program-types": "for f in test/programs/idls/*.json; do node ./bin/cli.cjs generate-client-types \"$f\" ./test/programs/generated; done"
},
"dependencies": {
"@codama/dynamic-codecs": "workspace:*",
"@codama/errors": "workspace:*",
"@solana/addresses": "^5.3.0",
"@solana/codecs": "^5.3.0",
"@solana/instructions": "^5.3.0",
"codama": "workspace:*",
"commander": "^14.0.2",
"superstruct": "^2.0.2"
},
"devDependencies": {
"@codama/nodes-from-anchor": "workspace:*",
"@codama/renderers-core": "workspace:*",
"@metaplex-foundation/mpl-token-metadata-kit": "^0.0.2",
"@solana-program/program-metadata": "^0.5.1",
"@solana-program/token": "0.10.0",
"@solana-program/token-2022": "^0.9.0",
"@solana/kit": "6.5.0",
"litesvm": "1.0.0",
"sas-lib": "^1.0.10"
},
"browserslist": [
"supports bigint and not dead",
"maintained node versions"
]
}
================================================
FILE: packages/dynamic-client/scripts/generate-idl-from-anchor.mjs
================================================
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { rootNodeFromAnchor } from '@codama/nodes-from-anchor';
import { writeFile } from '@codama/renderers-core';
import { createFromRoot } from 'codama';
// This script generates Codama IDL from Anchor programs for tests.
const packageRoot = process.cwd();
const programs = ['example', 'blog'];
for (const program of programs) {
const idlPath = path.join(packageRoot, 'test', 'programs', 'anchor', 'target', 'idl', `${program}.json`);
console.log(`Start generation from IDL: ${idlPath}`);
const idl = JSON.parse(readFileSync(idlPath, 'utf-8'));
console.log('Creating codama client..');
const codama = createFromRoot(rootNodeFromAnchor(idl));
const pathToIdl = path.join(packageRoot, 'test', 'programs', 'idls', `${program}-idl.json`);
console.log(`Writing Codama IDL to: ${pathToIdl}`);
const codamaJson = JSON.parse(codama.getJson());
const json = JSON.stringify(codamaJson, null, 4) + '\n';
writeFile(pathToIdl, json);
console.log(`Done: ${program}`);
}
================================================
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types-from-file.ts
================================================
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { createFromJson, type RootNode } from 'codama';
import { generateClientTypes } from './generate-client-types';
export function generateClientTypesFromFile(codamaIdlPath: string, outputDirPath: string) {
const idlPath = path.resolve(codamaIdlPath);
const outputDir = path.resolve(outputDirPath);
if (!existsSync(idlPath)) {
console.error(`Error: IDL file not found: ${idlPath}`);
process.exit(1);
}
console.log(`Reading IDL from: ${idlPath}`);
let idlJson: string;
try {
idlJson = readFileSync(idlPath, 'utf-8');
} catch (err) {
console.error(`Error reading IDL file: ${err instanceof Error ? err.message : String(err)}`);
process.exit(1);
}
let idl: RootNode;
try {
idl = createFromJson(idlJson).getRoot();
} catch (err) {
console.error(
`Error: ${idlPath} is not valid Codama JSON: ${err instanceof Error ? err.message : String(err)}`,
);
process.exit(1);
}
let types: string = '';
try {
console.log(`Generating types for program: ${idl.program.name}`);
types = generateClientTypes(idl);
} catch (err) {
console.error(`Error generating client types: ${err instanceof Error ? err.message : String(err)}`);
process.exit(1);
}
try {
mkdirSync(outputDir, { recursive: true });
const fileName = path.basename(idlPath);
const outputFile = fileName.replace(/\.json$/, '-types.ts');
const outputPath = path.join(outputDir, outputFile);
console.log(`Writing types to: ${outputPath}`);
writeFileSync(outputPath, types, 'utf-8');
console.log('Done!');
} catch (err) {
console.error(`Error writing generated types: ${err instanceof Error ? err.message : String(err)}`);
process.exit(1);
}
}
================================================
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types.ts
================================================
import type {
DefinedTypeNode,
InstructionAccountNode,
InstructionInputValueNode,
InstructionNode,
PdaNode,
RootNode,
TypeNode,
} from 'codama';
import { OPTIONAL_NODE_KINDS } from '../../../shared/nodes';
/**
* Generate TypeScript type for program client.
*/
export function generateClientTypes(idl: RootNode): string {
const programName = toPascalCase(idl.program.name);
const definedTypes = idl.program.definedTypes ?? [];
const pdaMap = collectPdaNodesFromIdl(idl);
const hasPdas = pdaMap.size > 0;
const addressImports = hasPdas ? 'Address, ProgramDerivedAddress' : 'Address';
let output = `/**
* Auto-generated types for strongly-typed ProgramClient
* DO NOT EDIT - Generated by @codama/dynamic-client generate-client-types
*
* Note: When the IDL contains types that cannot be resolved (e.g. unsupported
* kind, missing definition), argument types fall back to \`unknown\` instead of
* \`any\`. Consumers should narrow these values before use.
*/
import type { InstructionNode, RootNode } from 'codama';
import type { ${addressImports} } from '@solana/addresses';
import type { Instruction } from '@solana/instructions';
export type ResolverFn<
TArgumentsInput = Record<string, unknown>,
TAccountsInput = Record<string, unknown>
> = (argumentsInput: TArgumentsInput, accountsInput: TAccountsInput) => Promise<unknown>;
/**
* Method builder interface.
*/
export type MethodBuilder<TAccounts, TSigners extends string[], TResolvers = Record<string, never>> = {
accounts(accounts: TAccounts): MethodBuilder<TAccounts, TSigners, TResolvers>;
resolvers(resolvers: Partial<TResolvers>): MethodBuilder<TAccounts, TSigners, TResolvers>;
signers(signers: TSigners): MethodBuilder<TAccounts, TSigners, TResolvers>;
instruction(): Promise<Instruction>;
};
`;
for (const ix of idl.program.instructions) {
const typeName = toPascalCase(ix.name);
// Build args interface
const args = ix.arguments.filter(arg => arg.defaultValueStrategy !== 'omitted');
const remainingAccountArgs = (ix.remainingAccounts ?? []).filter(ra => ra.value.kind === 'argumentValueNode');
let argsRef = 'void';
if (args.length > 0 || remainingAccountArgs.length > 0) {
const argsInterfaceName = `${typeName}Args`;
output += `export type ${argsInterfaceName} = {\n`;
for (const arg of args) {
const tsType = codamaTypeToTS(arg.type, definedTypes);
const isOptional = OPTIONAL_NODE_KINDS.includes(arg.type.kind);
const sep = isOptional ? '?:' : ':';
output += ` ${arg.name}${sep} ${tsType};\n`;
}
for (const ra of remainingAccountArgs) {
const sep = ra.isOptional ? '?:' : ':';
output += ` ${ra.value.name}${sep} Address[];\n`;
}
output += '};\n\n';
argsRef = argsInterfaceName;
}
// Build accounts interface
// these ValueNodes don't have default value and must be provided if required.
const nonResolvableValueNodes = ['payerValueNode', 'identityValueNode'];
function isAccAutoResolvable(acc: InstructionAccountNode): boolean {
if (acc.defaultValue == null) return false;
return !nonResolvableValueNodes.includes(acc.defaultValue.kind);
}
const accountsInterfaceName = `${typeName}Accounts`;
if (ix.accounts.length > 0) {
output += `export type ${accountsInterfaceName} = {\n`;
for (const acc of ix.accounts) {
// Omittable accounts have a defaultValue that can be auto-resolved, so they can be omitted from .accounts().
// When null: resolved via optionalAccountStrategy.
// When undefined: resolved via defaultValue.
const omittable = isAccAutoResolvable(acc) ? '?' : '';
const type = acc.isOptional ? 'Address | null' : 'Address';
output += ` ${acc.name}${omittable}: ${type};\n`;
}
output += '} & Record<string, Address | null | undefined>;\n\n';
} else {
output += `export type ${accountsInterfaceName} = Record<string, Address | null | undefined>;\n\n`;
}
// Collect all ambiguous isSigner: "either" account names
const eitherSignerAccounts = ix.accounts.filter(acc => acc.isSigner === 'either').map(acc => `'${acc.name}'`);
if (eitherSignerAccounts.length > 0) {
output += `export type ${typeName}Signers = (${eitherSignerAccounts.join(' | ')})[];\n\n`;
}
// Collect resolver names for this instruction
const resolverNames = collectResolverNames(ix);
let resolversRef = '';
if (resolverNames.size > 0) {
const resolversTypeName = `${typeName}Resolvers`;
output += `export type ${resolversTypeName} = {\n`;
for (const name of resolverNames) {
output += ` ${name}: ResolverFn<${argsRef === 'void' ? 'Record<string, unknown>' : argsRef}, ${accountsInterfaceName}>;\n`;
}
output += '};\n\n';
resolversRef = resolversTypeName;
}
// Generate method type
const hasRequiredArgs = args.some(arg => !OPTIONAL_NODE_KINDS.includes(arg.type.kind));
const hasRequiredRemainingAccounts = remainingAccountArgs.some(ra => !ra.isOptional);
const allArgsOptional = !hasRequiredArgs && !hasRequiredRemainingAccounts;
const argsParam = argsRef === 'void' ? '' : allArgsOptional ? `args?: ${argsRef}` : `args: ${argsRef}`;
const signersGeneric = eitherSignerAccounts.length > 0 ? `${typeName}Signers` : 'string[]';
const resolversGeneric = resolversRef ? `, ${resolversRef}` : '';
const methodSignature = `(${argsParam}) => MethodBuilder<${accountsInterfaceName}, ${signersGeneric}${resolversGeneric}>`;
output += `export type ${typeName}Method = ${methodSignature};\n\n`;
}
output += `/**
* Strongly-typed methods for ${programName}.
*/
export type ${programName}Methods = {\n`;
for (const ix of idl.program.instructions) {
const typeName = toPascalCase(ix.name);
output += ` ${ix.name}: ${typeName}Method;\n`;
}
output += '};\n\n';
// Generate PDA seed types and pdas namespace
if (pdaMap.size > 0) {
for (const [pdaName, pdaNode] of pdaMap) {
const typeName = toPascalCase(pdaName);
const variableSeeds = (pdaNode.seeds ?? []).filter(s => s.kind === 'variablePdaSeedNode');
if (variableSeeds.length > 0) {
output += `export type ${typeName}PdaSeeds = {\n`;
for (const seed of variableSeeds) {
const tsType = seed.type ? codamaTypeToTS(seed.type, definedTypes) : 'unknown';
output += ` ${seed.name}: ${tsType};\n`;
}
output += '};\n\n';
}
}
output += `/**\n * Strongly-typed PDAs for ${programName}.\n */\n`;
output += `export type ${programName}Pdas = {\n`;
for (const [pdaName, pdaNode] of pdaMap) {
const typeName = toPascalCase(pdaName);
const variableSeeds = (pdaNode.seeds ?? []).filter(s => s.kind === 'variablePdaSeedNode');
const seedsParam =
variableSeeds.length > 0 ? `seeds: ${typeName}PdaSeeds` : `seeds?: Record<string, unknown>`;
output += ` ${pdaName}: (${seedsParam}) => Promise<ProgramDerivedAddress>;\n`;
}
output += '};\n\n';
}
const pdasProp = pdaMap.size > 0 ? ` pdas: ${programName}Pdas;\n` : '';
output += `/**
* Strongly-typed program client for ${programName}.
*/
export type ${programName}ProgramClient = {
methods: ${programName}Methods;
${pdasProp} programAddress: Address;
root: RootNode;
instructions: Map<string, InstructionNode>;
};
`;
return output;
}
/**
* Convert Codama type to TypeScript type string.
*/
function codamaTypeToTS(type: TypeNode | undefined, definedTypes: DefinedTypeNode[]): string {
if (!type || typeof type !== 'object') return 'unknown';
switch (type.kind) {
case 'numberTypeNode':
return ['u64', 'u128', 'i64', 'i128'].includes(type.format ?? '') ? 'number | bigint' : 'number';
case 'publicKeyTypeNode':
return 'Address';
case 'stringTypeNode':
return 'string';
case 'booleanTypeNode':
return 'boolean';
case 'optionTypeNode':
return `${codamaTypeToTS(type.item, definedTypes)} | null`;
case 'remainderOptionTypeNode':
case 'zeroableOptionTypeNode':
return `${codamaTypeToTS(type.item, definedTypes)} | null`;
case 'bytesTypeNode':
return 'Uint8Array';
case 'fixedSizeTypeNode':
case 'sizePrefixTypeNode':
case 'hiddenPrefixTypeNode':
case 'preOffsetTypeNode':
case 'postOffsetTypeNode':
case 'hiddenSuffixTypeNode':
case 'sentinelTypeNode':
return codamaTypeToTS(type.type, definedTypes);
case 'amountTypeNode':
case 'solAmountTypeNode':
return 'number | bigint';
case 'structTypeNode': {
if (!type.fields || type.fields.length === 0) return '{}';
const fields = type.fields
.filter(f => f.defaultValueStrategy !== 'omitted')
.map(f => `${f.name}: ${codamaTypeToTS(f.type, definedTypes)}`);
if (fields.length === 0) return '{}';
return `{ ${fields.join('; ')} }`;
}
case 'enumTypeNode': {
if (!type.variants || type.variants.length === 0) return 'unknown';
const allEmpty = type.variants.every(v => v.kind === 'enumEmptyVariantTypeNode');
if (allEmpty) {
return type.variants.map(v => `'${v.name}'`).join(' | ');
}
// Enum with struct/tuple variants — discriminated union
const variantTypes = type.variants.map(v => {
if (v.kind === 'enumEmptyVariantTypeNode') {
return `{ __kind: '${v.name}' }`;
}
if (v.kind === 'enumStructVariantTypeNode' && v.struct) {
const inner = codamaTypeToTS(v.struct, definedTypes);
return `{ __kind: '${v.name}' } & ${inner}`;
}
if (v.kind === 'enumTupleVariantTypeNode' && v.tuple) {
const inner = codamaTypeToTS(v.tuple, definedTypes);
return `{ __kind: '${v.name}'; fields: ${inner} }`;
}
return `{ __kind: '${v.name}' }`;
});
return variantTypes.join(' | ');
}
case 'tupleTypeNode': {
if (!type.items || type.items.length === 0) return '[]';
const items = type.items.map(i => codamaTypeToTS(i, definedTypes));
return `[${items.join(', ')}]`;
}
case 'arrayTypeNode':
case 'setTypeNode': {
const itemType = codamaTypeToTS(type.item, definedTypes);
const needsParens = itemType.includes(' | ') || itemType.includes(' & ');
return needsParens ? `(${itemType})[]` : `${itemType}[]`;
}
case 'mapTypeNode': {
const v = codamaTypeToTS(type.value, definedTypes);
return `Record<string, ${v}>`;
}
case 'definedTypeLinkNode': {
if (!type.name) return 'unknown';
const def = definedTypes.find(d => d.name === type.name);
if (!def) return 'unknown';
return codamaTypeToTS(def.type, definedTypes);
}
case 'dateTimeTypeNode': {
return codamaTypeToTS(type.number, definedTypes);
}
default:
type['kind'] satisfies never;
return 'unknown';
}
}
function collectPdaNodesFromIdl(idl: RootNode): Map<string, PdaNode> {
const pdas = new Map<string, PdaNode>();
for (const pda of idl.program.pdas ?? []) {
pdas.set(pda.name, pda);
}
for (const ix of idl.program.instructions) {
for (const acc of ix.accounts) {
if (!acc.defaultValue || acc.defaultValue.kind !== 'pdaValueNode') continue;
const pdaDef = acc.defaultValue.pda;
if (!pdaDef || pdaDef.kind !== 'pdaNode') continue;
if (!pdas.has(pdaDef.name)) {
pdas.set(pdaDef.name, pdaDef);
}
}
}
return pdas;
}
/**
* Collects all unique resolverValueNode names from an instruction's accounts and arguments.
*/
function collectResolverNames(ix: InstructionNode): Set<string> {
const names = new Set<string>();
function extractResolverNodeName(node: InstructionInputValueNode | undefined): void {
if (!node) return;
if (node.kind === 'resolverValueNode' && node.name) {
names.add(node.name);
} else if (node.kind === 'conditionalValueNode') {
extractResolverNodeName(node.condition);
extractResolverNodeName(node.ifTrue);
extractResolverNodeName(node.ifFalse);
}
}
for (const acc of ix.accounts) {
extractResolverNodeName(acc.defaultValue);
}
for (const arg of ix.arguments) {
extractResolverNodeName(arg.defaultValue);
}
return names;
}
function toPascalCase(str: string): string {
return str
.split(/[-_]/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join('');
}
================================================
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/register-command.ts
================================================
import type { Command } from 'commander';
import { generateClientTypesFromFile } from './generate-client-types-from-file';
export function registerGenerateClientTypesCommand(program: Command): void {
program
.command('generate-client-types')
.description('Generate TypeScript types from a Codama IDL JSON file')
.argument('<codama-idl>', 'Path to a Codama IDL JSON file (e.g., ./idl/codama.json)')
.argument('<output-dir>', 'Path to the output directory for the generated .ts file, e.g., ./generated')
.action((idlArg: string, outputDirArg: string) => {
generateClientTypesFromFile(idlArg, outputDirArg);
});
}
================================================
FILE: packages/dynamic-client/src/cli/commands/index.ts
================================================
import type { Command } from 'commander';
import { registerGenerateClientTypesCommand } from './generate-client-types/register-command';
export function registerCommands(program: Command): void {
registerGenerateClientTypesCommand(program);
}
================================================
FILE: packages/dynamic-client/src/cli/index.ts
================================================
import { createProgram } from './program';
const program = createProgram();
export function run(argv: string[]): void {
// Show help when invoked with no arguments.
if (argv.length <= 2) {
program.outputHelp();
return;
}
program.parse(argv);
}
================================================
FILE: packages/dynamic-client/src/cli/program.ts
================================================
import { Command } from 'commander';
import { registerCommands } from './commands';
export function createProgram(): Command {
const program = new Command();
program.name('dynamic-client').description('CLI for @codama/dynamic-client').showHelpAfterError(true);
registerCommands(program);
return program;
}
================================================
FILE: packages/dynamic-client/src/index.ts
================================================
export type { ProgramDerivedAddress } from '@solana/addresses';
export { isPublicKeyLike, toAddress } from './shared/address';
export type { AddressInput, PublicKeyLike } from './shared/address';
export { CodamaError, isCodamaError } from '@codama/errors';
export {
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__CANNOT_CONVERT_TO_ADDRESS,
CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY,
CODAMA_ERROR__DYNAMIC_CLIENT__DEFAULT_VALUE_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_DERIVE_PDA,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER,
CODAMA_ERROR__DYNAMIC_CLIENT__INSTRUCTION_NOT_FOUND,
CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS,
CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ARGUMENT_INPUT,
CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,
CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND,
CODAMA_ERROR__DYNAMIC_CLIENT__PDA_NOT_FOUND,
CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE,
CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ARGUMENT_TYPE,
CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_NODE,
CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_OPTIONAL_ACCOUNT_STRATEGY,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT,
} from '@codama/errors';
export type { AccountsInput, ArgumentsInput } from './shared/types';
export { createProgramClient } from './program-client/create-program-client';
export type {
CreateProgramClientOptions,
IdlInput,
ProgramClient,
ProgramMethodBuilder,
} from './program-client/create-program-client';
export { generateClientTypes } from './cli/commands/generate-client-types/generate-client-types';
================================================
FILE: packages/dynamic-client/src/instruction-encoding/accounts/create-account-meta.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ARGUMENT_INPUT,
CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import type { Address } from '@solana/addresses';
import type { AccountMeta } from '@solana/instructions';
import { AccountRole } from '@solana/instructions';
import { type InstructionAccountNode, type InstructionNode, isNode, type RootNode } from 'codama';
import { isConvertibleAddress, toAddress } from '../../shared/address';
import type { AccountsInput, ArgumentsInput, EitherSigners, ResolversInput } from '../../shared/types';
import { formatValueType, safeStringify } from '../../shared/util';
import { resolveAccountAddress } from '../resolvers/resolve-account-address';
type ResolvedAccount = {
address: Address | null;
optional: boolean;
role: AccountRole;
};
type ResolvedAccountWithAddress = ResolvedAccount & { address: Address };
/**
* Resolves account addresses and creates AccountMeta for each account in the instruction by evaluating their default values.
* Handles optional accounts based on the instruction's optionalAccountStrategy.
* Throws errors if required accounts are missing or cannot be resolved.
*/
export async function createAccountMeta(
root: RootNode,
ixNode: InstructionNode,
argumentsInput: ArgumentsInput = {},
accountsInput: AccountsInput = {},
signers: EitherSigners = [],
resolversInput: ResolversInput = {},
): Promise<AccountMeta[]> {
const programAddress = toAddress(root.program.publicKey);
const resolvedAccounts = await Promise.all(
ixNode.accounts.map<Promise<ResolvedAccount>>(async ixAccountNode => {
const accountAddressInput = accountsInput?.[ixAccountNode.name];
const isAccountProvided = accountAddressInput !== undefined && accountAddressInput !== null;
// Accounts with default values can be omitted, as they can be resolved from default value
if (!isAccountProvided && !ixAccountNode.isOptional && !ixAccountNode.defaultValue) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
});
}
let resolvedAccountAddress: Address | null = null;
if (!isAccountProvided) {
resolvedAccountAddress = await resolveAccountAddress({
accountAddressInput,
accountsInput,
argumentsInput,
ixAccountNode,
ixNode,
resolutionPath: [],
resolversInput,
root,
});
}
const finalAddress = isAccountProvided ? toAddress(accountAddressInput) : resolvedAccountAddress;
// Optional accounts resolved via "programId" optionalAccountStrategy get the program address,
// which cannot be writable on-chain — downgrade to readonly.
// E.g. PMP's setData instruction `buffer` account. (isWritable, isOptional and "programId" strategy).
// But when buffer is null it resolves to the program address which cannot be writable, hence must be downgraded to readonly.
const role =
ixAccountNode.isOptional &&
!isAccountProvided &&
ixNode.optionalAccountStrategy === 'programId' &&
finalAddress === programAddress
? getReadonlyAccountRole(ixAccountNode, signers)
: getAccountRole(ixAccountNode, signers);
return {
address: finalAddress,
optional: Boolean(ixAccountNode.isOptional),
role,
};
}),
);
const accountMetas: AccountMeta[] = resolvedAccounts
// Filter out optional accounts with "omitted" strategy (nulls).
.filter((acc): acc is ResolvedAccountWithAddress => acc.address !== null)
.map(acc => ({
address: acc.address,
role: acc.role,
}));
// Resolve remaining accounts from argument values
// https://github.com/codama-idl/codama/blob/main/packages/nodes/docs/InstructionRemainingAccountsNode.md
for (const remainingNode of ixNode.remainingAccounts ?? []) {
if (!isNode(remainingNode.value, 'argumentValueNode')) {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['argumentValueNode'],
kind: remainingNode.value.kind,
node: remainingNode.value,
});
}
const addresses = argumentsInput[remainingNode.value.name];
if (addresses === undefined) {
// Required remaining accounts must be provided.
if (!remainingNode.isOptional) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING, {
argumentName: remainingNode.value.name,
instructionName: ixNode.name,
});
}
// Optional remaining accounts can be safely omitted.
continue;
}
if (!Array.isArray(addresses)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ARGUMENT_INPUT, {
argumentName: remainingNode.value.name,
expectedType: 'Address[]',
value: safeStringify(addresses),
});
}
const role = getRemainingAccountRole(remainingNode.isSigner, remainingNode.isWritable);
for (let i = 0; i < addresses.length; i++) {
const addr: unknown = addresses[i];
if (!isConvertibleAddress(addr)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE, {
accountName: `${remainingNode.value.name}[${i}]`,
actualType: formatValueType(addr),
expectedType: 'Address | PublicKey',
});
}
accountMetas.push({ address: toAddress(addr), role });
}
}
return accountMetas;
}
// TODO: 'either' is treated as signer — this works for Token Program multisig signers,
// but may need refinement for programs where 'either' accounts are sometimes non-signers.
function getRemainingAccountRole(isSigner?: boolean | 'either', isWritable?: boolean): AccountRole {
const signer = isSigner === true || isSigner === 'either';
const writable = isWritable === true;
if (writable && signer) return AccountRole.WRITABLE_SIGNER;
if (writable) return AccountRole.WRITABLE;
if (signer) return AccountRole.READONLY_SIGNER;
return AccountRole.READONLY;
}
function getAccountRole(acc: InstructionAccountNode, signers: string[] | undefined): AccountRole {
const isSigner = isSignerAccount(acc, signers ?? []);
if (acc.isWritable && isSigner) {
return AccountRole.WRITABLE_SIGNER;
}
if (acc.isWritable) {
return AccountRole.WRITABLE;
}
if (isSigner) {
return AccountRole.READONLY_SIGNER;
}
return AccountRole.READONLY;
}
function getReadonlyAccountRole(acc: InstructionAccountNode, signers: string[] | undefined): AccountRole {
const isSigner = isSignerAccount(acc, signers ?? []);
return isSigner ? AccountRole.READONLY_SIGNER : AccountRole.READONLY;
}
function isSignerAccount(acc: InstructionAccountNode, signers: string[]) {
if (acc.isSigner === 'either') {
return signers.includes(acc.name);
}
return acc.isSigner === true;
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/accounts/index.ts
================================================
export { createAccountMeta } from './create-account-meta';
export { createAccountsInputValidator } from './validate-accounts-input';
================================================
FILE: packages/dynamic-client/src/instruction-encoding/accounts/validate-accounts-input.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT,
CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS,
CodamaError,
} from '@codama/errors';
import { camelCase, type InstructionNode } from 'codama';
import { assert, StructError } from 'superstruct';
import type { AccountsInput } from '../../shared/types';
import { safeStringify } from '../../shared/util';
import { createIxAccountsValidator } from '../validators';
/**
* Creates a validation function for InstructionAccountNodes.
* Pre-built superstruct validator ensures all required accounts are provided and have valid addresses.
* Skips validation for instructions without accounts.
*/
export function createAccountsInputValidator(ixNode: InstructionNode) {
const validator = ixNode.accounts.length ? createIxAccountsValidator(ixNode.accounts) : null;
return (accountsInput: AccountsInput = {}) => {
if (!validator) return;
try {
assert(accountsInput, validator);
} catch (error) {
if (error instanceof StructError) {
const key = error.key as string;
const value = error.value as unknown;
if (value == null) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: camelCase(key),
instructionName: ixNode.name,
});
} else {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS, {
accountName: camelCase(key),
value: safeStringify(value),
});
}
}
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, {
cause: error,
message: 'Unexpected validation error',
});
}
};
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/arguments/encode-instruction-arguments.ts
================================================
import { getNodeCodec, type ReadonlyUint8Array } from '@codama/dynamic-codecs';
import {
CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__DEFAULT_VALUE_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import { type Codec, mergeBytes } from '@solana/codecs';
import type { InstructionNode, RootNode } from 'codama';
import { visitOrElse } from 'codama';
import type { ArgumentsInput } from '../../shared/types';
import {
createDefaultValueEncoderVisitor,
createInputValueTransformer,
DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS,
} from '../visitors';
import { isOmittedArgument, isOptionalArgument } from './shared';
/**
* Encodes all instruction arguments into a single byte array.
* Iterates over each InstructionArgumentNode and encodes based on its category:
*
* Omitted arguments use their default value.
* Optional arguments are encoded as null.
* Required arguments are transformed from user input and then encoded.
*/
export function encodeInstructionArguments(
root: RootNode,
ix: InstructionNode,
argumentsInput: ArgumentsInput = {},
): ReadonlyUint8Array {
const chunks = ix.arguments.map(ixArgumentNode => {
const input = argumentsInput?.[ixArgumentNode.name];
const nodeCodec = getNodeCodec([root, root.program, ix, ixArgumentNode]);
if (isOmittedArgument(ixArgumentNode)) {
return encodeOmittedArgument(ix, ixArgumentNode, nodeCodec);
} else if (isOptionalArgument(ixArgumentNode, input)) {
return encodeOptionalArgument(ix, ixArgumentNode, nodeCodec);
} else {
return encodeRequiredArgument(root, ix, ixArgumentNode, input, nodeCodec);
}
});
return mergeBytes(chunks as Uint8Array[]);
}
function encodeOmittedArgument(
ix: InstructionNode,
ixArgumentNode: InstructionNode['arguments'][number],
nodeCodec: Codec<unknown>,
): ReadonlyUint8Array {
const defaultValue = ixArgumentNode.defaultValue;
if (defaultValue === undefined) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__DEFAULT_VALUE_MISSING, {
argumentName: ixArgumentNode.name,
instructionName: ix.name,
});
}
const visitor = createDefaultValueEncoderVisitor(nodeCodec);
return visitOrElse(defaultValue, visitor, node => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS],
kind: node.kind,
node,
});
});
}
function encodeOptionalArgument(
ix: InstructionNode,
ixArgumentNode: InstructionNode['arguments'][number],
nodeCodec: Codec<unknown>,
): ReadonlyUint8Array {
try {
return nodeCodec.encode(null);
} catch (error) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT, {
argumentName: ixArgumentNode.name,
cause: error,
instructionName: ix.name,
});
}
}
function encodeRequiredArgument(
root: RootNode,
ix: InstructionNode,
ixArgumentNode: InstructionNode['arguments'][number],
input: ArgumentsInput[string],
nodeCodec: Codec<unknown>,
): ReadonlyUint8Array {
if (input === undefined) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING, {
argumentName: ixArgumentNode.name,
instructionName: ix.name,
});
}
const transformer = createInputValueTransformer(ixArgumentNode.type, root, {
bytesEncoding: 'base16',
});
const transformedInput = transformer(input);
try {
return nodeCodec.encode(transformedInput);
} catch (error) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT, {
argumentName: ixArgumentNode.name,
cause: error,
instructionName: ix.name,
});
}
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/arguments/index.ts
================================================
export { encodeInstructionArguments } from './encode-instruction-arguments';
export { createArgumentsInputValidator } from './validate-arguments-input';
export { resolveArgumentDefaultsFromCustomResolvers } from './resolve-argument-from-custom-resolvers';
================================================
FILE: packages/dynamic-client/src/instruction-encoding/arguments/resolve-argument-from-custom-resolvers.ts
================================================
import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, CodamaError } from '@codama/errors';
import type { InstructionNode } from 'codama';
import { isNode } from 'codama';
import type { AccountsInput, ArgumentsInput, ResolversInput } from '../../shared/types';
import { isOmittedArgument } from './shared';
/**
* Resolves argument defaults from user-provided resolvers.
* For each argument that has a ResolverValueNode and is not provided by argumentsInput,
* try to invoke the corresponding resolver function and fill ArgumentsInput with the resolved values.
*/
export async function resolveArgumentDefaultsFromCustomResolvers(
ixNode: InstructionNode,
argumentsInput: ArgumentsInput = {},
accountsInput: AccountsInput = {},
resolversInput: ResolversInput = {},
): Promise<ArgumentsInput> {
const resolvedArgumentsInput = { ...argumentsInput };
const allArguments = [...ixNode.arguments, ...(ixNode.extraArguments ?? [])];
for (const argumentNode of allArguments) {
if (resolvedArgumentsInput[argumentNode.name] !== undefined) continue;
if (isOmittedArgument(argumentNode)) continue;
if (!isNode(argumentNode.defaultValue, 'resolverValueNode')) continue;
const resolverFn = resolversInput[argumentNode.defaultValue.name];
// If no resolver provided — skip and let the encoding step handle it:
// Optional arguments will be encoded as none
// Required arguments will emit error
if (!resolverFn) continue;
try {
resolvedArgumentsInput[argumentNode.name] = await resolverFn(resolvedArgumentsInput, accountsInput);
} catch (error) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, {
cause: error,
resolverName: argumentNode.defaultValue.name,
targetKind: 'instructionArgumentNode',
targetName: argumentNode.name,
});
}
}
return resolvedArgumentsInput;
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/arguments/shared.ts
================================================
import type { InstructionArgumentNode } from 'codama';
import { OPTIONAL_NODE_KINDS } from '../../shared/nodes';
export function isOmittedArgument(node: InstructionArgumentNode) {
return node.defaultValueStrategy === 'omitted';
}
export function isOptionalArgument(ixArgumentNode: InstructionArgumentNode, input: unknown) {
return OPTIONAL_NODE_KINDS.includes(ixArgumentNode.type.kind) && (input === null || input === undefined);
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/arguments/validate-arguments-input.ts
================================================
import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, CodamaError } from '@codama/errors';
import type { InstructionNode, RootNode } from 'codama';
import type { Failure } from 'superstruct';
import { assert, StructError } from 'superstruct';
import type { ArgumentsInput } from '../../shared/types';
import { safeStringify } from '../../shared/util';
import { createIxArgumentsValidator } from '../validators';
import { isOmittedArgument } from './shared';
/**
* Creates a cached validation function for InstructionArgumentNodes.
*
* Skips "omitted" arguments.
* Arguments with resolverValueNode defaults are expected to use optionTypeNode and NOT filtered out here.
* Optional validation allows undefined so custom resolvers will fill default values after validation.
*/
export function createArgumentsInputValidator(root: RootNode, ixNode: InstructionNode) {
const requiredArguments = ixNode.arguments.filter(arg => arg?.defaultValueStrategy !== 'omitted');
const validator = requiredArguments.length
? createIxArgumentsValidator(ixNode.name, requiredArguments, root.program.definedTypes)
: null;
return (argumentsInput: ArgumentsInput = {}) => {
// Ensure arguments with "omitted" defaultValueStrategy are not provided in argumentsInput.
validateOmittedArguments(ixNode, argumentsInput);
if (!validator) return;
const filteredInput = filterRemainingAccountArguments(ixNode, argumentsInput);
try {
assert(filteredInput, validator);
} catch (error) {
if (!(error instanceof StructError)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, {
cause: error,
message: 'Unexpected validation error',
});
}
const formattedMessage = error.failures().map(failure => {
const fieldPath = formatFailurePath(failure);
const value = formatFailureValue(failure.value);
return `Invalid argument "${fieldPath}", value: ${value}. ${failure.message}\n`;
});
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, {
cause: error,
message: formattedMessage.join(''),
});
}
};
}
/**
* Formats a full dotted path from failure, e.g. "command", "innerStruct.pubkey", "enumsArray[1]"
*/
function formatFailurePath(failure: Failure): string {
const path = failure.path;
if (!path || path.length === 0) return String(failure.key ?? '');
return path
.map((segment, i) => {
if (typeof segment === 'number') {
return `[${segment}]`;
}
return `${i === 0 ? '' : '.'}${String(segment)}`;
})
.join('');
}
/**
* Formats failure values for error messages, truncating long values and stringifying objects.
*/
const MAX_VALUE_LENGTH = 120;
function formatFailureValue(value: unknown): string {
const raw = typeof value === 'object' ? safeStringify(value) : String(value as unknown);
return raw.length > MAX_VALUE_LENGTH ? `${raw.slice(0, MAX_VALUE_LENGTH)}...` : raw;
}
/**
* Ensures that arguments with "omitted" defaultValueStrategy are not provided by the user (e.g. discriminator).
*/
function validateOmittedArguments(ixNode: InstructionNode, argumentsInput: ArgumentsInput = {}) {
ixNode.arguments.filter(isOmittedArgument).forEach(ixArgumentNode => {
if (Object.hasOwn(argumentsInput, ixArgumentNode.name)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, {
message: 'Omitted argument must not be provided',
});
}
});
}
function getRemainingAccountArgNames(ixNode: InstructionNode): string[] {
return (ixNode.remainingAccounts ?? [])
.filter(node => node.value.kind === 'argumentValueNode')
.map(node => node.value.name);
}
/**
* Filters out remaining account argument names from the arguments input.
* So superstruct's object() doesn't reject them as extra keys.
*/
function filterRemainingAccountArguments(ixNode: InstructionNode, argumentsInput: ArgumentsInput): ArgumentsInput {
const remainingAccountArgNames = getRemainingAccountArgNames(ixNode);
if (!remainingAccountArgNames.length) {
return argumentsInput;
}
const remainingAccountArgNamesSet = new Set(remainingAccountArgNames);
return Object.fromEntries(Object.entries(argumentsInput).filter(([key]) => !remainingAccountArgNamesSet.has(key)));
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/index.ts
================================================
// accounts
export { createAccountMeta } from './accounts/create-account-meta';
export { createAccountsInputValidator } from './accounts/validate-accounts-input';
// arguments
export { encodeInstructionArguments } from './arguments/encode-instruction-arguments';
export { createArgumentsInputValidator } from './arguments/validate-arguments-input';
export { resolveArgumentDefaultsFromCustomResolvers } from './arguments/resolve-argument-from-custom-resolvers';
// visitors
export {
ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS,
createAccountDefaultValueVisitor,
} from './visitors/account-default-value';
export { createConditionNodeValueVisitor } from './visitors/condition-node-value';
export {
createDefaultValueEncoderVisitor,
DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS,
} from './visitors/default-value-encoder';
export { createInputValueTransformer, createInputValueTransformerVisitor } from './visitors/input-value-transformer';
export { createPdaSeedValueVisitor, PDA_SEED_VALUE_SUPPORTED_NODE_KINDS } from './visitors/pda-seed-value';
export { createValueNodeVisitor, VALUE_NODE_SUPPORTED_NODE_KINDS } from './visitors/value-node-value';
================================================
FILE: packages/dynamic-client/src/instruction-encoding/instructions.ts
================================================
import { address } from '@solana/addresses';
import type { InstructionNode, RootNode } from 'codama';
import type { BuildIxFn } from '../shared/types';
import { createAccountMeta, createAccountsInputValidator } from './accounts';
import {
createArgumentsInputValidator,
encodeInstructionArguments,
resolveArgumentDefaultsFromCustomResolvers,
} from './arguments';
/**
* Creates an instruction builder for a given InstructionNode.
*/
export function createIxBuilder(root: RootNode, ixNode: InstructionNode): BuildIxFn {
const programAddress = address(root.program.publicKey);
const validateArguments = createArgumentsInputValidator(root, ixNode);
const validateAccounts = createAccountsInputValidator(ixNode);
return async (argumentsInput, accountsInput, signers, resolversInput) => {
// Validate arguments according to Codama schema.
validateArguments(argumentsInput);
// Ensure required accounts are present and validate provided pubkey addresses.
validateAccounts(accountsInput);
// Resolve arguments that depend on custom resolvers.
const enrichedArgumentsInput = await resolveArgumentDefaultsFromCustomResolvers(
ixNode,
argumentsInput,
accountsInput,
resolversInput,
);
// Encode arguments into buffer.
const argumentsData = encodeInstructionArguments(root, ixNode, enrichedArgumentsInput);
const accountsData = await createAccountMeta(
root,
ixNode,
enrichedArgumentsInput,
accountsInput,
signers,
resolversInput,
);
return {
accounts: accountsData,
data: argumentsData,
programAddress,
};
};
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/index.ts
================================================
export { resolveAccountAddress } from './resolve-account-address';
export { resolveAccountValueNodeAddress } from './resolve-account-value-node-address';
export { resolveConditionalValueNodeCondition } from './resolve-conditional';
export { resolvePDAAddress } from './resolve-pda-address';
export type { BaseResolutionContext, ResolutionPath } from './types';
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-address.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,
CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_OPTIONAL_ACCOUNT_STRATEGY,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import type { Address } from '@solana/addresses';
import type { InstructionAccountNode, InstructionNode, RootNode } from 'codama';
import { visitOrElse } from 'codama';
import { type AddressInput, toAddress } from '../../shared/address';
import { safeStringify } from '../../shared/util';
import {
ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS,
createAccountDefaultValueVisitor,
} from '../visitors/account-default-value';
import type { BaseResolutionContext } from './types';
type ResolveAccountAddressContext = BaseResolutionContext & {
accountAddressInput?: AddressInput | null | undefined;
ixAccountNode: InstructionAccountNode;
};
/**
* Resolves the address of an instruction account node via either defaultValue or optionalAccountStrategy.
*/
export async function resolveAccountAddress({
root,
ixNode,
ixAccountNode,
argumentsInput,
accountsInput,
resolutionPath,
resolversInput,
accountAddressInput,
}: ResolveAccountAddressContext): Promise<Address | null> {
// Optional accounts explicitly provided as null should be resolved based on optionalAccountStrategy
if (accountAddressInput === null && ixAccountNode.isOptional) {
return resolveOptionalAccountWithStrategy(root, ixNode, ixAccountNode);
}
if (ixAccountNode.defaultValue) {
const visitor = createAccountDefaultValueVisitor({
accountAddressInput,
accountsInput,
argumentsInput,
ixAccountNode,
ixNode,
resolutionPath,
resolversInput,
root,
});
const addressValue = await visitOrElse(ixAccountNode.defaultValue, visitor, node => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS],
kind: node.kind,
node,
});
});
// conditionalValueNode with ifFalse branch returns null.
// This should be resolved via optionalAccountStrategy for optional accounts.
if (addressValue === null && ixAccountNode.isOptional) {
return resolveOptionalAccountWithStrategy(root, ixNode, ixAccountNode);
}
return addressValue;
}
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
});
}
/**
* Optional account resolution via instruction strategy.
* With "programId" strategy, optional accounts are resolved to programId.
* With "omitted" strategy, optional accounts must be excluded from accounts list.
*/
function resolveOptionalAccountWithStrategy(
root: RootNode,
ixNode: InstructionNode,
ixAccountNode: InstructionAccountNode,
) {
if (!ixAccountNode.isOptional) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION, {
message: `resolveOptionalAccountWithStrategy called for non-optional account: ${ixAccountNode.name}`,
});
}
switch (ixNode.optionalAccountStrategy) {
case 'omitted':
return null;
case 'programId':
return toAddress(root.program.publicKey);
default:
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_OPTIONAL_ACCOUNT_STRATEGY, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
strategy: safeStringify(ixNode.optionalAccountStrategy),
});
}
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-value-node-address.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY,
CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND,
CodamaError,
} from '@codama/errors';
import type { Address } from '@solana/addresses';
import type { AccountValueNode } from 'codama';
import { toAddress } from '../../shared/address';
import { resolveAccountAddress } from './resolve-account-address';
import type { BaseResolutionContext, ResolutionPath } from './types';
/**
* Resolves an AccountValueNode reference to an Address.
*
* Shared logic for resolving account references across visitors:
* Checks if the user provided the account address in accountsInput.
* Finds the referenced InstructionAccountNode.
* Delegates to resolveAccountAddress for default value resolution.
*/
export async function resolveAccountValueNodeAddress(
node: AccountValueNode,
ctx: BaseResolutionContext,
): Promise<Address | null> {
const { accountsInput, ixNode, resolutionPath } = ctx;
// Check if user provided the account address.
const providedAddress = accountsInput?.[node.name];
if (providedAddress !== undefined && providedAddress !== null) {
return toAddress(providedAddress);
}
// Find the referenced account in the instruction.
const referencedIxAccountNode = ixNode.accounts.find(acc => acc.name === node.name);
if (!referencedIxAccountNode) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND, {
instructionName: ixNode.name,
referencedName: node.name,
});
}
// Detect circular dependencies before recursing.
detectCircularDependency(node.name, resolutionPath);
return await resolveAccountAddress({
accountAddressInput: providedAddress,
accountsInput: ctx.accountsInput,
argumentsInput: ctx.argumentsInput,
ixAccountNode: referencedIxAccountNode,
ixNode,
resolutionPath: [...resolutionPath, node.name],
resolversInput: ctx.resolversInput,
root: ctx.root,
});
}
export function detectCircularDependency(nodeName: string, resolutionPath: ResolutionPath) {
if (resolutionPath.includes(nodeName)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY, {
chain: [...resolutionPath, nodeName].join(' -> '),
});
}
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-conditional.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import type { ConditionalValueNode, InstructionAccountNode, InstructionInputValueNode } from 'codama';
import { isNode, visitOrElse } from 'codama';
import { getMaybeNodeKind } from '../../shared/util';
import { CONDITION_NODE_SUPPORTED_NODE_KINDS, createConditionNodeValueVisitor } from '../visitors/condition-node-value';
import { createValueNodeVisitor, VALUE_NODE_SUPPORTED_NODE_KINDS } from '../visitors/value-node-value';
import type { BaseResolutionContext } from './types';
export type ResolveConditionalContext = BaseResolutionContext & {
conditionalValueNode: ConditionalValueNode;
ixAccountNode: InstructionAccountNode;
};
/**
* Evaluates a ConditionalValueNode's condition.
* Returns the matching branch (ifTrue or ifFalse) as an InstructionInputValueNode or undefined if no branch matches.
*/
export async function resolveConditionalValueNodeCondition({
root,
ixNode,
ixAccountNode,
conditionalValueNode,
argumentsInput,
accountsInput,
resolutionPath,
resolversInput,
}: ResolveConditionalContext): Promise<InstructionInputValueNode | undefined> {
if (!isNode(conditionalValueNode, 'conditionalValueNode')) {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['conditionalValueNode'],
kind: getMaybeNodeKind(conditionalValueNode),
node: conditionalValueNode,
});
}
const { condition, value: expectedValueNode, ifTrue, ifFalse } = conditionalValueNode;
if (!expectedValueNode && !ifTrue && !ifFalse) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION, {
message: `Invalid conditionalValueNode: missing value and branches for account ${ixAccountNode.name} in ${ixNode.name}`,
});
}
// Resolve the condition value of ConditionalValueNode.
const conditionVisitor = createConditionNodeValueVisitor({
accountsInput,
argumentsInput,
ixNode,
resolutionPath,
resolversInput,
root,
});
const actualProvidedValue = await visitOrElse(condition, conditionVisitor, condNode => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...CONDITION_NODE_SUPPORTED_NODE_KINDS],
kind: condNode.kind,
node: condNode,
});
});
if (!expectedValueNode) {
return actualProvidedValue ? ifTrue : ifFalse;
}
// If expectedValueNode exists, the condition must be equal to expected value.
const valueVisitor = createValueNodeVisitor();
const expectedValue = visitOrElse(expectedValueNode, valueVisitor, valueNode => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...VALUE_NODE_SUPPORTED_NODE_KINDS],
kind: valueNode.kind,
node: valueNode,
});
});
if (typeof expectedValue.value === 'object' || typeof actualProvidedValue === 'object') {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION, {
message: 'Deep equality comparison not yet supported for conditional value',
});
}
return actualProvidedValue === expectedValue.value ? ifTrue : ifFalse;
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-pda-address.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,
CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND,
CODAMA_ERROR__LINKED_NODE_NOT_FOUND,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CODAMA_ERROR__UNRECOGNIZED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import type { Address, ProgramDerivedAddress } from '@solana/addresses';
import { address, getProgramDerivedAddress } from '@solana/addresses';
import type { ReadonlyUint8Array } from '@solana/codecs';
import type { Node, PdaNode, PdaSeedValueNode, PdaValueNode, RegisteredPdaSeedNode, VariablePdaSeedNode } from 'codama';
import { isNode, visitOrElse } from 'codama';
import { getMaybeNodeKind } from '../../shared/util';
import { createPdaSeedValueVisitor, PDA_SEED_VALUE_SUPPORTED_NODE_KINDS } from '../visitors/pda-seed-value';
import type { BaseResolutionContext } from './types';
export type ResolvePDAAddressContext = BaseResolutionContext & {
pdaValueNode: PdaValueNode;
};
/**
* Derives a PDA from a PdaValueNode.
* Encodes each seed (ConstantPdaSeedNode and VariablePdaSeedNode) into bytes and computes the address.
*/
export async function resolvePDAAddress({
root,
ixNode,
argumentsInput = {},
accountsInput = {},
pdaValueNode,
resolutionPath,
resolversInput,
}: ResolvePDAAddressContext): Promise<ProgramDerivedAddress | null> {
if (!isNode(pdaValueNode, 'pdaValueNode')) {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['pdaValueNode'],
kind: getMaybeNodeKind(pdaValueNode),
node: pdaValueNode,
});
}
const pdaNode = resolvePdaNode(pdaValueNode, root.program.pdas);
const programId = address(pdaNode.programId || root.program.publicKey);
const seedValues = await Promise.all(
pdaNode.seeds.map(async seedNode => {
if (seedNode.kind === 'constantPdaSeedNode') {
return await resolveConstantPdaSeed({
accountsInput,
argumentsInput,
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedNode,
});
}
if (seedNode.kind === 'variablePdaSeedNode') {
const variableSeedValueNodes = pdaValueNode.seeds;
const seedName = seedNode.name;
const variableSeedValueNode = variableSeedValueNodes.find(node => node.name === seedName);
if (!variableSeedValueNode) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND, {
instructionName: ixNode.name,
referencedName: seedName,
});
}
return await resolveVariablePdaSeed({
accountsInput,
argumentsInput,
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedNode,
variableSeedValueNode,
});
}
throw new CodamaError(CODAMA_ERROR__UNRECOGNIZED_NODE_KIND, {
kind: getMaybeNodeKind(seedNode) ?? 'unknown',
});
}),
);
return await getProgramDerivedAddress({
programAddress: programId,
seeds: seedValues,
});
}
function resolvePdaNode(pdaDefaultValue: PdaValueNode, pdas: PdaNode[]): PdaNode {
if (isNode(pdaDefaultValue.pda, 'pdaLinkNode')) {
const linkedPda = pdas.find(p => p.name === pdaDefaultValue.pda.name);
if (!linkedPda) {
throw new CodamaError(CODAMA_ERROR__LINKED_NODE_NOT_FOUND, {
kind: 'pdaLinkNode',
linkNode: pdaDefaultValue.pda,
name: pdaDefaultValue.pda.name,
path: [],
});
}
return linkedPda;
}
if (isNode(pdaDefaultValue.pda, 'pdaNode')) {
return pdaDefaultValue.pda;
}
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['pdaLinkNode', 'pdaNode'],
kind: getMaybeNodeKind(pdaDefaultValue.pda),
node: pdaDefaultValue.pda,
});
}
type ResolvePdaSeedContext = BaseResolutionContext & {
programId: Address;
seedNode: VariablePdaSeedNode;
variableSeedValueNode: PdaSeedValueNode;
};
function resolveVariablePdaSeed({
accountsInput = {},
argumentsInput = {},
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedNode,
variableSeedValueNode,
}: ResolvePdaSeedContext): Promise<ReadonlyUint8Array> {
if (!isNode(variableSeedValueNode, 'pdaSeedValueNode')) {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['pdaSeedValueNode'],
kind: getMaybeNodeKind(variableSeedValueNode),
node: variableSeedValueNode as Node,
});
}
if (seedNode.name !== variableSeedValueNode.name) {
// Sanity check: this should not happen.
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION, {
message: `Mismatched PDA seed names: expected [${seedNode.name}], got [${variableSeedValueNode.name}]`,
});
}
const visitor = createPdaSeedValueVisitor({
accountsInput,
argumentsInput,
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedTypeNode: seedNode.type,
});
return visitOrElse(variableSeedValueNode.value, visitor, node => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...PDA_SEED_VALUE_SUPPORTED_NODE_KINDS],
kind: node.kind,
node,
});
});
}
type ResolveConstantPdaSeedContext = BaseResolutionContext & {
programId: Address;
seedNode: RegisteredPdaSeedNode;
};
function resolveConstantPdaSeed({
accountsInput,
argumentsInput,
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedNode,
}: ResolveConstantPdaSeedContext): Promise<ReadonlyUint8Array> {
if (!isNode(seedNode, 'constantPdaSeedNode')) {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: ['constantPdaSeedNode'],
kind: seedNode.kind,
node: seedNode,
});
}
const visitor = createPdaSeedValueVisitor({
accountsInput,
argumentsInput,
ixNode,
programId,
resolutionPath,
resolversInput,
root,
seedTypeNode: seedNode.type,
});
return visitOrElse(seedNode.value, visitor, node => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...PDA_SEED_VALUE_SUPPORTED_NODE_KINDS],
kind: node.kind,
node,
});
});
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/types.ts
================================================
import type { InstructionNode, RootNode } from 'codama';
import type { AccountsInput, ArgumentsInput, ResolversInput } from '../../shared/types';
// Array of node names being resolved to detect circular dependencies.
export type ResolutionPath = readonly string[];
/**
* Shared context threaded through the account/PDA resolution pipeline.
* Individual resolvers/visitors extend this with domain-specific fields.
*/
export type BaseResolutionContext = {
accountsInput: AccountsInput | undefined;
argumentsInput: ArgumentsInput | undefined;
ixNode: InstructionNode;
resolutionPath: ResolutionPath;
resolversInput: ResolversInput | undefined;
root: RootNode;
};
================================================
FILE: packages/dynamic-client/src/instruction-encoding/validators.ts
================================================
import { isAddress } from '@solana/addresses';
import type {
ArrayTypeNode,
CountNode,
DefinedTypeNode,
EnumVariantTypeNode,
InstructionAccountNode,
InstructionArgumentNode,
SetTypeNode,
TypeNode,
} from 'codama';
import {
array,
boolean,
define,
intersection,
number,
object,
size,
string,
Struct,
StructError,
tuple,
} from 'superstruct';
import { isPublicKeyLike } from '../shared/address';
import { getMemoizedUtf8Encoder } from '../shared/codecs';
import { formatValueType, getMaybeNodeKind, safeStringify } from '../shared/util';
type StructUnknown = Struct<unknown, unknown>;
/**
* Creates a superstruct validator for InstructionAccountNodes.
*
* if node is optional, then validate only if it's provided.
* if node has defaultValue, then consider it as optional and validate only if it's provided because it will be resolved from defaultValue.
*/
export function createIxAccountsValidator(ixAccountNodes: InstructionAccountNode[]): StructUnknown {
const shape = ixAccountNodes.reduce<Record<string, StructUnknown>>((acc, node) => {
acc[node.name] = node.isOptional || node.defaultValue ? OptionalSolanaAddressValidator : SolanaAddressValidator;
return acc;
}, {});
return object(shape) as StructUnknown;
}
/**
* Creates a superstruct validator for instruction InstructionArgumentNodes.
*/
export function createIxArgumentsValidator(
ixNodeName: string,
ixArgumentNodes: InstructionArgumentNode[],
definedTypes: DefinedTypeNode[],
): StructUnknown {
const shape = ixArgumentNodes.reduce<Record<string, StructUnknown>>((acc, argumentNode, index) => {
if (!argumentNode.type) {
throw new Error(`Argument ${argumentNode.name} of instruction ${ixNodeName} does not have a type`);
}
acc[argumentNode.name] = createValidatorForTypeNode(
`${ixNodeName}_${argumentNode.name}_${index}`,
argumentNode.type,
definedTypes,
);
return acc;
}, {});
return object(shape) as StructUnknown;
}
function createValidatorForTypeNode(nodeName: string, node: TypeNode, definedTypes: DefinedTypeNode[]): StructUnknown {
if (!node) {
throw new Error(
`Node ${nodeName} is not defined. ${definedTypes.length} defined types were provided: ${definedTypes.map(t => t.name).join(', ')}`,
);
}
switch (node.kind) {
case 'arrayTypeNode': {
return ArrayValidator(`${nodeName}_array`, node, definedTypes);
}
case 'booleanTypeNode': {
return boolean() as StructUnknown;
}
case 'numberTypeNode': {
const format = node.format;
if (format === 'u64' || format === 'u128' || format === 'i64' || format === 'i128') {
return NumberOrBigintValidator;
}
return number() as StructUnknown;
}
case 'publicKeyTypeNode': {
return SolanaAddressValidator;
}
case 'setTypeNode': {
// array of unique items
return intersection([
UniqueItemsValidator,
ArrayValidator(`${nodeName}_set`, node, definedTypes),
]) as StructUnknown;
}
case 'stringTypeNode': {
return string() as StructUnknown;
}
case 'fixedSizeTypeNode': {
// fixedSizeTypeNode wraps an inner type and constrains its byte size
if (node.type.kind === 'stringTypeNode') {
// For fixed-size strings, validate that UTF-8 bytes fit within the size
return StringValidatorForFixedSize(node.size);
}
if (node.type.kind === 'bytesTypeNode') {
// For fixed-size bytes, validate exact byte length
return BytesWithSizeValidator(node.size);
}
// For other types, delegate to the inner type validator
// The size constraint is handled during encoding
return createValidatorForTypeNode(`${nodeName}_fixed_size`, node.type, definedTypes);
}
case 'bytesTypeNode': {
return BytesLikeValidator;
}
case 'dateTimeTypeNode': {
return createValidatorForTypeNode(`${nodeName}_date_time`, node.number, definedTypes);
}
case 'definedTypeLinkNode': {
const definedType = definedTypes.find(d => d.name === node.name);
if (!definedType) {
throw new Error(`Undefined type: ${node.name} ${node.kind}`);
}
return createValidatorForTypeNode(`${nodeName}_defined_type`, definedType.type, definedTypes);
}
case 'mapTypeNode': {
const keyValidator = createValidatorForTypeNode(
`${nodeName}_map_key_${node.key.kind}`,
node.key,
definedTypes,
);
const valueValidator = createValidatorForTypeNode(
`${nodeName}_map_value_${node.value.kind}`,
node.value,
definedTypes,
);
const sizeValidator = MapCountValidator(node.count);
const keyValueValidator = KeyValueValidator(nodeName, keyValidator, valueValidator);
if (sizeValidator) {
return intersection([keyValueValidator, sizeValidator]) as StructUnknown;
}
return keyValueValidator;
}
case 'structTypeNode': {
const structShape = node.fields.reduce<Record<string, StructUnknown>>((acc, field) => {
acc[field.name] = createValidatorForTypeNode(
`${nodeName}_struct_${field.name}`,
field.type,
definedTypes,
);
return acc;
}, {});
return object(structShape) as StructUnknown;
}
case 'tupleTypeNode': {
const validators = node.items.map((typeNode, index) =>
createValidatorForTypeNode(`${nodeName}_tuple${typeNode.kind}_${index}`, typeNode, definedTypes),
);
return tuple(validators as [StructUnknown, ...StructUnknown[]]) as StructUnknown;
}
case 'zeroableOptionTypeNode': {
const innerValidator = createValidatorForTypeNode(
`${nodeName}_zeroable_option_item`,
node.item,
definedTypes,
);
return ZeroableOptionValidator(`${nodeName}_zeroable_option`, innerValidator);
}
case 'optionTypeNode': {
// TODO: Do we need to validate node.fixed and node.prefix of OptionTypeNode?
const SomeValueValidator = createValidatorForTypeNode(`${nodeName}_option_item`, node.item, definedTypes);
return OptionValueValidator(`${nodeName}_option`, SomeValueValidator);
}
case 'remainderOptionTypeNode': {
const innerValidator = RemainderOptionTypeItemValidator(
`${nodeName}_remainder_option_item`,
node.item,
definedTypes,
);
return OptionValueValidator(`${nodeName}_remainder_option`, innerValidator);
}
case 'hiddenPrefixTypeNode':
case 'hiddenSuffixTypeNode':
case 'sentinelTypeNode':
case 'postOffsetTypeNode':
case 'preOffsetTypeNode':
case 'sizePrefixTypeNode': {
return createValidatorForTypeNode(`${nodeName}_size_prefix`, node.type, definedTypes);
}
case 'enumTypeNode': {
return EnumVariantValidator(nodeName, node.variants, definedTypes);
}
case 'amountTypeNode': {
return AmountTypeValidator(nodeName);
}
case 'solAmountTypeNode': {
return AmountTypeValidator(nodeName);
}
default: {
node['kind'] satisfies never;
throw new Error(`Validator for TypeNode "${nodeName}" kind: ${getMaybeNodeKind(node)} is not implemented!`);
}
}
}
function RemainderOptionTypeItemValidator(
nodeName: string,
itemNode: TypeNode,
definedTypes: DefinedTypeNode[],
): StructUnknown {
if (itemNode.kind === 'fixedSizeTypeNode' && itemNode.type.kind === 'stringTypeNode') {
// For fixed-size strings in remainder options, accept any string
return StringValidatorForFixedSize(itemNode.size);
}
if (itemNode.kind === 'definedTypeLinkNode') {
const definedType = definedTypes.find(d => d.name === itemNode.name);
if (definedType?.type.kind === 'fixedSizeTypeNode' && definedType.type.type.kind === 'stringTypeNode') {
return StringValidatorForFixedSize(definedType.type.size);
}
}
return createValidatorForTypeNode(nodeName, itemNode, definedTypes);
}
function StringValidatorForFixedSize(maxSize: number): StructUnknown {
return define(`StringForFixedSize_max_${maxSize}`, (value: unknown) => {
if (typeof value !== 'string') {
return `Expected a string, received: ${formatValueType(value)}`;
}
const encoder = getMemoizedUtf8Encoder();
const bytes = encoder.encode(value);
return (
bytes.length <= maxSize ||
`String exceeds max size: ${bytes.length} bytes (UTF-8), limit is ${maxSize} bytes`
);
}) as StructUnknown;
}
/**
* Validator for enum variants.
* Handles both scalar enums and enums with data.
*/
function EnumVariantValidator(
nodeName: string,
variants: EnumVariantTypeNode[],
definedTypes: DefinedTypeNode[],
): StructUnknown {
const variantMap = new Map<string, EnumVariantTypeNode>(variants.map(v => [v.name, v]));
const variantNames = Array.from(variantMap.keys());
// Eagerly build per-variant payload validators for struct and tuple variants
const variantValidators = new Map<string, StructUnknown>();
for (const variant of variants) {
if (variant.kind === 'enumStructVariantTypeNode') {
variantValidators.set(
variant.name,
createValidatorForTypeNode(`${nodeName}_${variant.name}`, variant.struct, definedTypes),
);
} else if (variant.kind === 'enumTupleVariantTypeNode') {
variantValidators.set(
variant.name,
createValidatorForTypeNode(`${nodeName}_${variant.name}`, variant.tuple, definedTypes),
);
}
}
return define(`${nodeName}_EnumVariant`, (value: unknown) => {
// Scalar enum: plain string variant name (e.g. 'foo', 'bar')
if (typeof value === 'string')
return (
variantMap.has(value) || `Invalid enum value "${value}". Expected one of: ${variantNames.join(', ')}`
);
// Data enum variant: object with __kind (e.g. { __kind: 'tokenTransfer', amount: 1000 })
if (typeof value === 'object' && value !== null && '__kind' in value) {
const kind = (value as Record<string, unknown>)['__kind'];
if (typeof kind !== 'string') {
return `Expected __kind to be a string, received: ${formatValueType(kind)}`;
}
const variant = variantMap.get(kind);
if (!variant) {
return `Invalid enum variant "${kind}". Expected one of: ${variantNames.join(', ')}`;
}
if (variant.kind === 'enumEmptyVariantTypeNode') {
return true;
}
// Validations of enum payloads
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { __kind: _, ...rest } = value as Record<string, unknown>;
const payloadValidator = variantValidators.get(kind);
if (!payloadValidator) {
return true;
}
if (variant.kind === 'enumStructVariantTypeNode') {
const [structError] = payloadValidator.validate(rest);
return structError ? formatErrorForEnumTypeNode(kind, structError) : true;
}
if (variant.kind === 'enumTupleVariantTypeNode') {
const fields = (rest as { fields?: unknown }).fields;
const [structError] = payloadValidator.validate(fields);
return structError ? formatErrorForEnumTypeNode(kind, structError) : true;
}
}
return `Expected an enum variant (string or object with __kind), received: ${formatValueType(value)}`;
}) as StructUnknown;
}
function formatErrorForEnumTypeNode(enumVariantKind: string, error: StructError) {
const failures = error.failures();
const first = failures?.[0];
if (first) {
return `Enum variant "${enumVariantKind}" has invalid "${String(first.key)}"`;
}
return `Enum variant "${enumVariantKind}" has invalid payload`;
}
const SolanaAddressValidator: StructUnknown = /* @__PURE__ */ define('SolanaAddress', (value: unknown) => {
if (typeof value === 'string') {
return isAddress(value) || `Expected a valid Solana address (base58), received string: "${value}"`;
}
if (isPublicKeyLike(value)) {
return isAddress(value.toBase58()) || 'Expected a valid Solana address, received an invalid PublicKey';
}
return `Expected a Solana address (base58 string or PublicKey), received: ${formatValueType(value)}`;
});
const OptionalSolanaAddressValidator: StructUnknown = /* @__PURE__ */ define(
'OptionalSolanaAddress',
(value: unknown) => {
if (value === undefined || value === null) return true;
const [error] = SolanaAddressValidator.validate(value);
if (!error) return true;
return error.failures()[0]?.message ?? 'Expected a valid Solana address or null/undefined';
},
);
const NumberOrBigintValidator: StructUnknown = /* @__PURE__ */ define('NumberOrBigint', (value: unknown) => {
if (typeof value === 'number') {
return Number.isSafeInteger(value) || `Expected a safe integer, received unsafe number: ${value}`;
}
if (typeof value === 'bigint') return true;
return `Expected a number or bigint, received: ${formatValueType(value)}`;
});
const BytesLikeValidator: StructUnknown = /* @__PURE__ */ define('BytesLike', (value: unknown) => {
if (value instanceof Uint8Array) return true;
if (!Array.isArray(value)) {
return `Expected a Uint8Array or number[] (bytes 0-255), received: ${formatValueType(value)}`;
}
const invalidIndex = value.findIndex(n => typeof n !== 'number' || !Number.isInteger(n) || n < 0 || n > 255);
if (invalidIndex !== -1) {
return `Expected byte values (integers 0-255), invalid element at index ${invalidIndex}: ${String(value[invalidIndex])}`;
}
return true;
});
/**
* Validator for bytes that must be exactly a specific size.
* Used for fixedSizeTypeNode wrapping bytesTypeNode.
*/
function BytesWithSizeValidator(exactSize: number): StructUnknown {
return define(`BytesWithSize_${exactSize}`, (value: unknown) => {
if (value instanceof Uint8Array) {
return value.length === exactSize || `Expected exactly ${exactSize} bytes, received ${value.length} bytes`;
}
if (!Array.isArray(value)) {
return `Expected a Uint8Array or number[] of exactly ${exactSize} bytes, received: ${formatValueType(value)}`;
}
if (value.length !== exactSize) {
return `Expected exactly ${exactSize} bytes, received ${value.length} elements`;
}
const invalidIndex = value.findIndex(n => typeof n !== 'number' || !Number.isInteger(n) || n < 0 || n > 255);
if (invalidIndex !== -1) {
return `Expected byte values (integers 0-255), invalid element at index ${invalidIndex}: ${String(value[invalidIndex])}`;
}
return true;
}) as StructUnknown;
}
// Validates value only if it is not null or undefined (i.e. if it's provided).
// SomeValueValidator validates the provided value (i.e. Some(value)).
function OptionValueValidator(name: string, SomeValueValidator: StructUnknown): StructUnknown {
return define(`${name}_OptionValueValidator`, (value: unknown) => {
if (value === null || value === undefined) return true;
const [error] = SomeValueValidator.validate(value);
if (!error) return true;
return error.failures()[0]?.message ?? 'Invalid value for optional field';
}) as StructUnknown;
}
// Validates zeroable option: null is valid, otherwise validates the inner validator.
function ZeroableOptionValidator(name: string, innerValidator: StructUnknown): StructUnknown {
return define(name, (value: unknown) => {
if (value == null) return true;
const [error] = innerValidator.validate(value);
if (!error) return true;
return error.failures()[0]?.message ?? 'Expected a valid value or null for zeroable option';
}) as StructUnknown;
}
// Checks that all items in the array are unique.
const UniqueItemsValidator: StructUnknown = /* @__PURE__ */ define('UniqueItems', (value: unknown) => {
if (!Array.isArray(value)) {
return `Expected an array with unique items, received: ${formatValueType(value)}`;
}
const unique = new Map<string, number>();
for (let i = 0; i < value.length; i++) {
const key = safeStringify(value[i]);
const index = unique.get(key);
if (index !== undefined) {
return `Expected all items to be unique, found duplicate at indices ${index} and ${i}`;
}
unique.set(key, i);
}
return true;
}) as StructUnknown;
// Validates every key of an object according to KeyValidator.
// Validates every value of an object according to ValueValidator.
// Used in MapTypeNode, where the keys and values are of the same type.
function KeyValueValidator(name: string, KeyValidator: StructUnknown, ValueValidator: StructUnknown): StructUnknown {
return define(`${name}_KeyValueValidator`, (value: unknown) => {
if (typeof value !== 'object' || value === null) {
return `Expected a map (object), received: ${formatValueType(value)}`;
}
const record = value as Record<string, unknown>;
const invalidKeys: string[] = [];
const invalidValues: string[] = [];
for (const key of Object.keys(record)) {
if (KeyValidator.validate(key)[0]) invalidKeys.push(key);
if (ValueValidator.validate(record[key])[0]) invalidValues.push(key);
}
if (!invalidKeys.length && !invalidValues.length) return true;
const parts: string[] = [];
if (invalidKeys.length) parts.push(`invalid keys: ${invalidKeys.join(', ')}`);
if (invalidValues.length) parts.push(`invalid values: ${invalidValues.join(', ')}`);
return `Map validation failed: ${parts.join('; ')}`;
}) as StructUnknown;
}
function MapCountValidator(node: CountNode): StructUnknown | null {
switch (node.kind) {
case 'fixedCountNode':
return KeysLengthValidator(node.value);
case 'remainderCountNode':
case 'prefixedCountNode':
return null; // the number of items is unknown or arbitrary, like vec![]
default:
throw new Error(`Unsupported map count type: ${getMaybeNodeKind(node)}`);
}
}
// Validates the number of keys in an object
// Can be used in MapTypeNode with "fixed" CountNode type
function KeysLengthValidator(count: number): StructUnknown {
return define(`KeysLengthValidator_len_${count}`, (value: unknown) => {
if (typeof value !== 'object' || value === null) {
return `Expected a map with exactly ${count} entries, received: ${formatValueType(value)}`;
}
const actual = Object.keys(value).length;
return actual === count || `Expected exactly ${count} map entries, received ${actual}`;
}) as StructUnknown;
}
// Handles both fixed-size and variable-size arrays
function ArrayValidator(
nodeName: string,
node: ArrayTypeNode | SetTypeNode,
definedTypes: DefinedTypeNode[],
): StructUnknown {
// First define a validator for every array item
const itemValidator = createValidatorForTypeNode(nodeName, node.item, definedTypes);
// Then validate CountNode representing array size:
// https://github.com/codama-idl/codama/blob/main/packages/nodes/docs/typeNodes/ArrayTypeNode.md
switch (node.count.kind) {
case 'fixedCountNode': {
return size(array(itemValidator), node.count.value) as StructUnknown;
}
case 'remainderCountNode':
case 'prefixedCountNode': {
return array(itemValidator) as StructUnknown;
}
default: {
// This should be unreachable with the current `CountNode` union but helps
// guard against future Codama expansions.
throw new Error(`Node: ${nodeName}. Unsupported array count type`);
}
}
}
/**
* Validator for amountTypeNode and solAmountTypeNode.
* Accepts number, bigint.
*/
function AmountTypeValidator(nodeName: string): StructUnknown {
return define(`AmountType_${nodeName}`, (value: unknown) => {
if (typeof value === 'number') {
return Number.isSafeInteger(value) || `Expected a safe integer, received unsafe number: ${value}`;
}
if (typeof value === 'bigint') {
return true;
}
return `Expected a number or bigint, received: ${formatValueType(value)}`;
}) as StructUnknown;
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/visitors/account-default-value.ts
================================================
import {
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_DERIVE_PDA,
CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER,
CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS,
CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE,
CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_NODE,
CODAMA_ERROR__UNEXPECTED_NODE_KIND,
CodamaError,
} from '@codama/errors';
import type { Address } from '@solana/addresses';
import { address } from '@solana/addresses';
import type { Visitor } from 'codama';
import type {
AccountBumpValueNode,
AccountValueNode,
ArgumentValueNode,
ConditionalValueNode,
IdentityValueNode,
InstructionAccountNode,
PayerValueNode,
PdaValueNode,
ProgramIdValueNode,
PublicKeyValueNode,
ResolverValueNode,
} from 'codama';
import { visitOrElse } from 'codama';
import type { AddressInput } from '../../shared/address';
import { isConvertibleAddress, toAddress } from '../../shared/address';
import { formatValueType, safeStringify } from '../../shared/util';
import { resolveAccountValueNodeAddress } from '../resolvers/resolve-account-value-node-address';
import { resolveConditionalValueNodeCondition } from '../resolvers/resolve-conditional';
import { resolvePDAAddress } from '../resolvers/resolve-pda-address';
import type { BaseResolutionContext } from '../resolvers/types';
type AccountDefaultValueVisitorContext = BaseResolutionContext & {
accountAddressInput: AddressInput | null | undefined;
ixAccountNode: InstructionAccountNode;
};
export const ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS = [
'accountBumpValueNode',
'accountValueNode',
'argumentValueNode',
'conditionalValueNode',
'identityValueNode',
'payerValueNode',
'pdaValueNode',
'programIdValueNode',
'publicKeyValueNode',
'resolverValueNode',
] as const;
type AccountDefaultValueSupportedNodeKind = (typeof ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS)[number];
/**
* Visitor for resolving InstructionInputValueNode types to Address values for account resolution.
*/
export function createAccountDefaultValueVisitor(
ctx: AccountDefaultValueVisitorContext,
): Visitor<Promise<Address | null>, AccountDefaultValueSupportedNodeKind> {
const {
root,
ixNode,
ixAccountNode,
accountAddressInput,
argumentsInput,
accountsInput,
resolversInput,
resolutionPath,
} = ctx;
return {
visitAccountBumpValue: async (_node: AccountBumpValueNode) => {
return await Promise.reject(
new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_NODE, {
nodeKind: 'accountBumpValueNode',
}),
);
},
visitAccountValue: async (node: AccountValueNode) => {
return await resolveAccountValueNodeAddress(node, {
accountsInput,
argumentsInput,
ixNode,
resolutionPath,
resolversInput,
root,
});
},
visitArgumentValue: async (node: ArgumentValueNode) => {
const argValue = argumentsInput?.[node.name];
if (argValue === undefined || argValue === null) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING, {
argumentName: node.name,
instructionName: ixNode.name,
});
}
if (!isConvertibleAddress(argValue)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE, {
accountName: ixAccountNode.name,
actualType: formatValueType(argValue),
expectedType: 'Address | PublicKey',
});
}
return await Promise.resolve(toAddress(argValue));
},
visitConditionalValue: async (conditionalValueNode: ConditionalValueNode) => {
// ifTrue or ifFalse branch of ConditionalValueNode.
const resolvedInputValueNode = await resolveConditionalValueNodeCondition({
accountsInput,
argumentsInput,
conditionalValueNode,
ixAccountNode,
ixNode,
resolutionPath,
resolversInput,
root,
});
if (resolvedInputValueNode === undefined) {
// No matching branch (e.g. conditional with no ifFalse and falsy condition).
// Return null to signal "unresolved" to apply optionalAccountStrategy.
if (ixAccountNode.isOptional) {
return null;
}
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
});
}
// Recursively resolve the chosen branch.
const visitor = createAccountDefaultValueVisitor(ctx);
const addressValue = await visitOrElse(resolvedInputValueNode, visitor, innerNode => {
throw new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
expectedKinds: [...ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS],
kind: innerNode.kind,
node: innerNode,
});
});
return addressValue;
},
visitIdentityValue: async (_node: IdentityValueNode) => {
if (accountAddressInput === undefined || accountAddressInput === null) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
});
}
return await Promise.resolve(toAddress(accountAddressInput));
},
visitPayerValue: async (_node: PayerValueNode) => {
if (accountAddressInput === undefined || accountAddressInput === null) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING, {
accountName: ixAccountNode.name,
instructionName: ixNode.name,
});
}
return await Promise.resolve(toAddress(accountAddressInput));
},
visitPdaValue: async (node: PdaValueNode) => {
const pda = await resolvePDAAddress({
accountsInput,
argumentsInput,
ixNode,
pdaValueNode: node,
resolutionPath,
resolversInput,
root,
});
if (pda === null) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_DERIVE_PDA, {
accountName: ixAccountNode.name,
});
}
return pda[0];
},
visitProgramIdValue: async (_node: ProgramIdValueNode) => {
return await Promise.resolve(address(root.program.publicKey));
},
visitPublicKeyValue: async (node: PublicKeyValueNode) => {
return await Promise.resolve(address(node.publicKey));
},
visitResolverValue: async (node: ResolverValueNode) => {
const resolverFn = resolversInput?.[node.name];
if (!resolverFn) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING, {
accountName: ixAccountNode.name,
resolverName: node.name,
});
}
let result: unknown;
try {
result = await resolverFn(argumentsInput ?? {}, accountsInput ?? {});
} catch (error) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, {
cause: error,
resolverName: node.name,
targetKind: 'instructionAccountNode',
targetName: ixAccountNode.name,
});
}
if (!isConvertibleAddress(result)) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS, {
accountName: ixAccountNode.name,
value: safeStringify(result),
});
}
return toAddress(result);
},
};
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/visitors/condition-node-value.ts
================================================
import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, CodamaError } from '@codama/errors';
import type { Visitor } from 'codama';
import type { AccountValueNode, ArgumentValueNode, ResolverValueNode } from 'codama';
import { resolveAccountValueNodeAddress } from '../resolvers/resolve-account-value-node-address';
import type { BaseResolutionContext } from '../resolvers/types';
export const CONDITION_NODE_SUPPORTED_NODE_KINDS = [
'accountValueNode',
'argumentValueNode',
'resolverValueNode',
] as const;
type ConditionNodeSupportedNodeKind = (typeof CONDITION_NODE_SUPPORTED_NODE_KINDS)[number];
/**
* Visitor for resolving condition nodes in ConditionalValueNode.
* Returns the runtime value of the condition (from accounts or arguments).
*/
export function createConditionNodeValueVisitor(
ctx: BaseResolutionContext,
): Visitor<Promise<unknown>, ConditionNodeSupportedNodeKind> {
const { root, ixNode, argumentsInput, accountsInput, resolutionPath, resolversInput } = ctx;
return {
visitAccountValue: async (node: AccountValueNode) => {
// If the user explicitly provides null for a conditional account,
// return it for the conditionalValueNode ifFalse branch.
const accountAddressInput = accountsInput?.[node.name];
if (accountAddressInput === null) {
return null;
}
return await resolveAccountValueNodeAddress(node, {
accountsInput,
argumentsInput,
ixNode,
resolutionPath,
resolversInput,
root,
});
},
visitArgumentValue: async (node: ArgumentValueNode) => {
const argInput = argumentsInput?.[node.name];
return await Promise.resolve(argInput);
},
visitResolverValue: async (node: ResolverValueNode) => {
const resolverFn = resolversInput?.[node.name];
if (!resolverFn) {
// ConditionalValueNode evaluates condition and based on result it chooses to take either ifTrue or ifFalse branch.
// If resolver is not provided, we assume condition is false and return undefined instead of throwing an error to take ifFalse branch.
return undefined;
}
try {
return await resolverFn(argumentsInput ?? {}, accountsInput ?? {});
} catch (error) {
throw new CodamaError(CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, {
cause: error,
resolverName: node.name,
targetKind: 'conditionalValueNode',
targetName: node.name,
});
}
},
};
}
================================================
FILE: packages/dynamic-client/src/instruction-encoding/visitors/default-value-encoder.ts
================================================
import type { ReadonlyUint8Array } from '@solana/codecs';
import type { Visitor } from 'codama';
import type {
BooleanValueNode,
BytesValueNode,
EnumValueNode,
NumberValueNode,
PublicKeyValueNode,
StringValueNode,
} from 'codama';
export const DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS = [
'booleanValueNode',
'bytesValueNode',
'enumValueNode',
'noneValueNode',
'numberValueNode',
'publicKeyValueNode',
'stringValueNode',
] as const;
type DefaultValueEncoderSupportedNodeKind = (typeof DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS)[number];
/**
* Visitor for encoding default (omitted) values for instruction arguments.
*
* Today, Anchor/Codama primarily uses omitted defaults for discriminators
* (`bytesValueNode`), but
gitextract_ki3ckuuc/ ├── .changeset/ │ ├── README.md │ └── config.json ├── .github/ │ ├── actions/ │ │ └── setup-anchor/ │ │ └── action.yml │ ├── dependabot.yml │ └── workflows/ │ └── main.yml ├── .gitignore ├── .prettierignore ├── LICENSE ├── README.md ├── eslint.config.mjs ├── package.json ├── packages/ │ ├── cli/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin/ │ │ │ └── cli.cjs │ │ ├── package.json │ │ ├── src/ │ │ │ ├── cli/ │ │ │ │ └── index.ts │ │ │ ├── commands/ │ │ │ │ ├── convert.ts │ │ │ │ ├── index.ts │ │ │ │ ├── init.ts │ │ │ │ └── run.ts │ │ │ ├── config.ts │ │ │ ├── index.ts │ │ │ ├── parsedConfig.ts │ │ │ ├── program.ts │ │ │ ├── programOptions.ts │ │ │ ├── types/ │ │ │ │ └── global.d.ts │ │ │ └── utils/ │ │ │ ├── childCommands.ts │ │ │ ├── errors.ts │ │ │ ├── fs.ts │ │ │ ├── import.ts │ │ │ ├── index.ts │ │ │ ├── logs.ts │ │ │ ├── nodes.ts │ │ │ ├── packageInstall.ts │ │ │ ├── packageJson.ts │ │ │ ├── packageManager.ts │ │ │ ├── promises.ts │ │ │ ├── prompts.ts │ │ │ └── visitors.ts │ │ ├── test/ │ │ │ ├── exports/ │ │ │ │ ├── commonjs.cjs │ │ │ │ ├── mock-config.json │ │ │ │ ├── mock-idl.json │ │ │ │ └── module.mjs │ │ │ └── index.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── dynamic-client/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin/ │ │ │ └── cli.cjs │ │ ├── package.json │ │ ├── scripts/ │ │ │ └── generate-idl-from-anchor.mjs │ │ ├── src/ │ │ │ ├── cli/ │ │ │ │ ├── commands/ │ │ │ │ │ ├── generate-client-types/ │ │ │ │ │ │ ├── generate-client-types-from-file.ts │ │ │ │ │ │ ├── generate-client-types.ts │ │ │ │ │ │ └── register-command.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ └── program.ts │ │ │ ├── index.ts │ │ │ ├── instruction-encoding/ │ │ │ │ ├── accounts/ │ │ │ │ │ ├── create-account-meta.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── validate-accounts-input.ts │ │ │ │ ├── arguments/ │ │ │ │ │ ├── encode-instruction-arguments.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── resolve-argument-from-custom-resolvers.ts │ │ │ │ │ ├── shared.ts │ │ │ │ │ └── validate-arguments-input.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instructions.ts │ │ │ │ ├── resolvers/ │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── resolve-account-address.ts │ │ │ │ │ ├── resolve-account-value-node-address.ts │ │ │ │ │ ├── resolve-conditional.ts │ │ │ │ │ ├── resolve-pda-address.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── validators.ts │ │ │ │ └── visitors/ │ │ │ │ ├── account-default-value.ts │ │ │ │ ├── condition-node-value.ts │ │ │ │ ├── default-value-encoder.ts │ │ │ │ ├── index.ts │ │ │ │ ├── input-value-transformer.ts │ │ │ │ ├── pda-seed-value.ts │ │ │ │ └── value-node-value.ts │ │ │ ├── program-client/ │ │ │ │ ├── collect-pdas.ts │ │ │ │ ├── create-program-client.ts │ │ │ │ ├── derive-standalone-pda.ts │ │ │ │ └── methods-builder.ts │ │ │ ├── shared/ │ │ │ │ ├── address.ts │ │ │ │ ├── bytes-encoding.ts │ │ │ │ ├── codecs.ts │ │ │ │ ├── nodes.ts │ │ │ │ ├── types.ts │ │ │ │ └── util.ts │ │ │ └── types/ │ │ │ └── index.ts │ │ ├── test/ │ │ │ ├── programs/ │ │ │ │ ├── anchor/ │ │ │ │ │ ├── Anchor.toml │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ ├── programs/ │ │ │ │ │ │ ├── blog/ │ │ │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ │ │ ├── Xargo.toml │ │ │ │ │ │ │ └── src/ │ │ │ │ │ │ │ └── lib.rs │ │ │ │ │ │ └── example/ │ │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ │ ├── Xargo.toml │ │ │ │ │ │ └── src/ │ │ │ │ │ │ ├── lib.rs │ │ │ │ │ │ └── nested_example.rs │ │ │ │ │ ├── rust-toolchain.toml │ │ │ │ │ └── tests/ │ │ │ │ │ ├── blog.test.ts │ │ │ │ │ ├── example.test.ts │ │ │ │ │ ├── helpers.ts │ │ │ │ │ └── nested-example-ix.test.ts │ │ │ │ ├── associated-token-account/ │ │ │ │ │ ├── ata-test-utils.ts │ │ │ │ │ ├── create-idempotent.test.ts │ │ │ │ │ ├── create.test.ts │ │ │ │ │ └── recover-nested.test.ts │ │ │ │ ├── circular-account-refs/ │ │ │ │ │ └── circular-account-refs.test.ts │ │ │ │ ├── collection-types/ │ │ │ │ │ └── collection-types.test.ts │ │ │ │ ├── custom-resolvers/ │ │ │ │ │ ├── account-resolver.test.ts │ │ │ │ │ ├── argument-resolvers.test.ts │ │ │ │ │ └── custom-resolvers-test-utils.ts │ │ │ │ ├── idls/ │ │ │ │ │ ├── associated-token-account-idl.json │ │ │ │ │ ├── blog-idl.json │ │ │ │ │ ├── circular-account-refs-idl.json │ │ │ │ │ ├── collection-types-idl.json │ │ │ │ │ ├── custom-resolvers-test-idl.json │ │ │ │ │ ├── example-idl.json │ │ │ │ │ ├── mpl-token-metadata-idl.json │ │ │ │ │ ├── pmp-idl.json │ │ │ │ │ ├── sas-idl.json │ │ │ │ │ ├── system-program-idl.json │ │ │ │ │ ├── token-2022-idl.json │ │ │ │ │ └── token-idl.json │ │ │ │ ├── mpl-token-metadata/ │ │ │ │ │ ├── create-with-resolvers.test.ts │ │ │ │ │ ├── create.test.ts │ │ │ │ │ └── helpers.ts │ │ │ │ ├── pmp/ │ │ │ │ │ ├── allocate.test.ts │ │ │ │ │ ├── close.test.ts │ │ │ │ │ ├── extend.test.ts │ │ │ │ │ ├── helpers.ts │ │ │ │ │ ├── initialize.test.ts │ │ │ │ │ ├── pdas.test.ts │ │ │ │ │ ├── set-authority.test.ts │ │ │ │ │ ├── set-data.test.ts │ │ │ │ │ ├── set-immutable.test.ts │ │ │ │ │ ├── trim.test.ts │ │ │ │ │ └── write.test.ts │ │ │ │ ├── sas/ │ │ │ │ │ ├── change-authorized-signers.test.ts │ │ │ │ │ ├── change-schema-description.test.ts │ │ │ │ │ ├── change-schema-status.test.ts │ │ │ │ │ ├── change-schema-version.test.ts │ │ │ │ │ ├── close-attestation.test.ts │ │ │ │ │ ├── close-tokenized-attestation.test.ts │ │ │ │ │ ├── create-attestation.test.ts │ │ │ │ │ ├── create-credential.test.ts │ │ │ │ │ ├── create-schema.test.ts │ │ │ │ │ ├── create-tokenized-attestation.test.ts │ │ │ │ │ ├── sas-test-utils.ts │ │ │ │ │ └── tokenize-schema.test.ts │ │ │ │ ├── system-program/ │ │ │ │ │ ├── advance-nonce-account.test.ts │ │ │ │ │ ├── allocate-with-seed.test.ts │ │ │ │ │ ├── allocate.test.ts │ │ │ │ │ ├── assign-with-seed.test.ts │ │ │ │ │ ├── assign.test.ts │ │ │ │ │ ├── authorize-nonce-account.test.ts │ │ │ │ │ ├── create-account-with-seed.test.ts │ │ │ │ │ ├── create-account.test.ts │ │ │ │ │ ├── initialize-nonce-account.test.ts │ │ │ │ │ ├── transfer-sol-with-seed.test.ts │ │ │ │ │ ├── transfer-sol.test.ts │ │ │ │ │ ├── upgrade-nonce-account.test.ts │ │ │ │ │ └── withdraw-nonce-account.test.ts │ │ │ │ ├── test-utils.ts │ │ │ │ ├── token/ │ │ │ │ │ ├── amount-to-ui-amount.test.ts │ │ │ │ │ ├── approve-checked.test.ts │ │ │ │ │ ├── approve.test.ts │ │ │ │ │ ├── burn-checked.test.ts │ │ │ │ │ ├── burn.test.ts │ │ │ │ │ ├── close-account.test.ts │ │ │ │ │ ├── freeze-account.test.ts │ │ │ │ │ ├── get-account-data-size.test.ts │ │ │ │ │ ├── initialize-account.test.ts │ │ │ │ │ ├── initialize-account2.test.ts │ │ │ │ │ ├── initialize-account3.test.ts │ │ │ │ │ ├── initialize-immutable-owner.test.ts │ │ │ │ │ ├── initialize-mint.test.ts │ │ │ │ │ ├── initialize-mint2.test.ts │ │ │ │ │ ├── initialize-multisig.test.ts │ │ │ │ │ ├── initialize-multisig2.test.ts │ │ │ │ │ ├── mint-to-checked.test.ts │ │ │ │ │ ├── mint-to.test.ts │ │ │ │ │ ├── revoke.test.ts │ │ │ │ │ ├── set-authority.test.ts │ │ │ │ │ ├── sync-native.test.ts │ │ │ │ │ ├── thaw-account.test.ts │ │ │ │ │ ├── token-test-utils.ts │ │ │ │ │ ├── transfer-checked.test.ts │ │ │ │ │ ├── transfer.test.ts │ │ │ │ │ └── ui-amount-to-amount.test.ts │ │ │ │ └── token-2022/ │ │ │ │ ├── amount-to-ui-amount.test.ts │ │ │ │ ├── approve-checked.test.ts │ │ │ │ ├── approve.test.ts │ │ │ │ ├── burn-checked.test.ts │ │ │ │ ├── burn.test.ts │ │ │ │ ├── close-account.test.ts │ │ │ │ ├── confidential-transfer-fee.test.ts │ │ │ │ ├── confidential-transfer.test.ts │ │ │ │ ├── create-native-mint.test.ts │ │ │ │ ├── disable-cpi-guard.test.ts │ │ │ │ ├── disable-memo-transfers.test.ts │ │ │ │ ├── freeze-account.test.ts │ │ │ │ ├── get-account-data-size.test.ts │ │ │ │ ├── group-member-pointer.test.ts │ │ │ │ ├── group-pointer.test.ts │ │ │ │ ├── harvest-withheld-tokens-to-mint.test.ts │ │ │ │ ├── initialize-account.test.ts │ │ │ │ ├── initialize-account2.test.ts │ │ │ │ ├── initialize-account3.test.ts │ │ │ │ ├── initialize-default-account-state.test.ts │ │ │ │ ├── initialize-immutable-owner.test.ts │ │ │ │ ├── initialize-interest-bearing-mint.test.ts │ │ │ │ ├── initialize-mint-close-authority.test.ts │ │ │ │ ├── initialize-mint.test.ts │ │ │ │ ├── initialize-mint2.test.ts │ │ │ │ ├── initialize-multisig.test.ts │ │ │ │ ├── initialize-multisig2.test.ts │ │ │ │ ├── initialize-non-transferable-mint.test.ts │ │ │ │ ├── initialize-permanent-delegate.test.ts │ │ │ │ ├── metadata-pointer.test.ts │ │ │ │ ├── mint-to-checked.test.ts │ │ │ │ ├── mint-to.test.ts │ │ │ │ ├── pausable.test.ts │ │ │ │ ├── reallocate.test.ts │ │ │ │ ├── revoke.test.ts │ │ │ │ ├── scaled-ui-amount.test.ts │ │ │ │ ├── set-authority.test.ts │ │ │ │ ├── sync-native.test.ts │ │ │ │ ├── thaw-account.test.ts │ │ │ │ ├── token-2022-test-utils.ts │ │ │ │ ├── token-group.test.ts │ │ │ │ ├── token-metadata.test.ts │ │ │ │ ├── transfer-checked.test.ts │ │ │ │ ├── transfer-fee.test.ts │ │ │ │ ├── transfer-hook.test.ts │ │ │ │ ├── transfer.test.ts │ │ │ │ ├── ui-amount-to-amount.test.ts │ │ │ │ ├── update-default-account-state.test.ts │ │ │ │ ├── update-rate-interest-bearing-mint.test.ts │ │ │ │ ├── withdraw-excess-lamports.test.ts │ │ │ │ └── withdraw-withheld-tokens.test.ts │ │ │ ├── svm-test-context.ts │ │ │ └── unit/ │ │ │ ├── cli/ │ │ │ │ ├── generate-program-client-types.test.ts │ │ │ │ └── program-client-types.test.ts │ │ │ ├── instruction-encoding/ │ │ │ │ ├── arguments.test.ts │ │ │ │ ├── create-account-meta.test.ts │ │ │ │ └── validators.test.ts │ │ │ ├── program-client/ │ │ │ │ └── create-program-client.test.ts │ │ │ ├── resolvers/ │ │ │ │ ├── resolve-account-value-node-address/ │ │ │ │ │ ├── resolve-account-value-node-address.test.ts │ │ │ │ │ └── types.test.ts │ │ │ │ └── resolve-conditional.test.ts │ │ │ ├── shared/ │ │ │ │ ├── address.test.ts │ │ │ │ ├── bytes-encoding.test.ts │ │ │ │ ├── codecs.test.ts │ │ │ │ ├── types.test.ts │ │ │ │ └── util.test.ts │ │ │ └── visitors/ │ │ │ ├── account-default-value/ │ │ │ │ ├── account-default-value-test-utils.ts │ │ │ │ ├── accountBumpValueNode.test.ts │ │ │ │ ├── accountValueNode.test.ts │ │ │ │ ├── argumentValueNode.test.ts │ │ │ │ ├── conditionalValueNode.test.ts │ │ │ │ ├── identityValueNode.test.ts │ │ │ │ ├── payerValueNode.test.ts │ │ │ │ ├── pdaValueNode.test.ts │ │ │ │ ├── programIdValueNode.test.ts │ │ │ │ ├── publicKeyValueNode.test.ts │ │ │ │ └── resolverValueNode.test.ts │ │ │ ├── condition-node-value/ │ │ │ │ ├── accountValueNode.test.ts │ │ │ │ ├── argumentValueNode.test.ts │ │ │ │ ├── condition-node-value-test-utils.ts │ │ │ │ └── resolverValueNode.test.ts │ │ │ ├── default-value-encoder/ │ │ │ │ ├── booleanValueNode.test.ts │ │ │ │ ├── bytesValueNode.test.ts │ │ │ │ ├── default-value-encoder-test-utils.ts │ │ │ │ ├── enumValueNode.test.ts │ │ │ │ ├── noneValueNode.test.ts │ │ │ │ ├── numberValueNode.test.ts │ │ │ │ ├── publicKeyValueNode.test.ts │ │ │ │ └── stringValueNode.test.ts │ │ │ ├── input-value-transformer/ │ │ │ │ ├── amountTypeNode.test.ts │ │ │ │ ├── arrayTypeNode.test.ts │ │ │ │ ├── booleanTypeNode.test.ts │ │ │ │ ├── bytesTypeNode.test.ts │ │ │ │ ├── dateTimeTypeNode.test.ts │ │ │ │ ├── definedTypeLinkNode.test.ts │ │ │ │ ├── enumTypeNode.test.ts │ │ │ │ ├── fixedSizeTypeNode.test.ts │ │ │ │ ├── hiddenPrefixTypeNode.test.ts │ │ │ │ ├── hiddenSuffixTypeNode.test.ts │ │ │ │ ├── input-value-transformer-test-utils.ts │ │ │ │ ├── mapTypeNode.test.ts │ │ │ │ ├── numberTypeNode.test.ts │ │ │ │ ├── optionTypeNode.test.ts │ │ │ │ ├── postOffsetTypeNode.test.ts │ │ │ │ ├── preOffsetTypeNode.test.ts │ │ │ │ ├── publicKeyTypeNode.test.ts │ │ │ │ ├── remainderOptionTypeNode.test.ts │ │ │ │ ├── sentinelTypeNode.test.ts │ │ │ │ ├── setTypeNode.test.ts │ │ │ │ ├── sizePrefixTypeNode.test.ts │ │ │ │ ├── solAmountTypeNode.test.ts │ │ │ │ ├── stringTypeNode.test.ts │ │ │ │ ├── structTypeNode.test.ts │ │ │ │ ├── tupleTypeNode.test.ts │ │ │ │ └── zeroableOptionTypeNode.test.ts │ │ │ ├── pda-seed-value/ │ │ │ │ ├── accountValueNode.test.ts │ │ │ │ ├── argumentValueNode.test.ts │ │ │ │ ├── booleanValueNode.test.ts │ │ │ │ ├── bytesValueNode.test.ts │ │ │ │ ├── constantValueNode.test.ts │ │ │ │ ├── noneValueNode.test.ts │ │ │ │ ├── numberValueNode.test.ts │ │ │ │ ├── pda-seed-value-test-utils.ts │ │ │ │ ├── programIdValueNode.test.ts │ │ │ │ ├── publicKeyValueNode.test.ts │ │ │ │ ├── someValueNode.test.ts │ │ │ │ └── stringValueNode.test.ts │ │ │ └── value-node-value/ │ │ │ ├── arrayValueNode.test.ts │ │ │ ├── booleanValueNode.test.ts │ │ │ ├── bytesValueNode.test.ts │ │ │ ├── constantValueNode.test.ts │ │ │ ├── enumValueNode.test.ts │ │ │ ├── mapValueNode.test.ts │ │ │ ├── noneValueNode.test.ts │ │ │ ├── numberValueNode.test.ts │ │ │ ├── publicKeyValueNode.test.ts │ │ │ ├── setValueNode.test.ts │ │ │ ├── someValueNode.test.ts │ │ │ ├── stringValueNode.test.ts │ │ │ ├── structValueNode.test.ts │ │ │ ├── tupleValueNode.test.ts │ │ │ └── value-node-value-test-utils.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.cli.config.ts │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── dynamic-codecs/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── codecs.ts │ │ │ ├── index.ts │ │ │ ├── types/ │ │ │ │ └── global.d.ts │ │ │ └── values.ts │ │ ├── test/ │ │ │ ├── _setup.ts │ │ │ ├── codecs/ │ │ │ │ ├── AccountNode.test.ts │ │ │ │ ├── ArrayTypeNode.test.ts │ │ │ │ ├── BooleanTypeNode.test.ts │ │ │ │ ├── BytesTypeNode.test.ts │ │ │ │ ├── DefinedTypeLinkNode.test.ts │ │ │ │ ├── DefinedTypeNode.test.ts │ │ │ │ ├── EnumTypeNode.test.ts │ │ │ │ ├── EventNode.test.ts │ │ │ │ ├── FixedSizeTypeNode.test.ts │ │ │ │ ├── HiddenPrefixTypeNode.test.ts │ │ │ │ ├── HiddenSuffixTypeNode.test.ts │ │ │ │ ├── InstructionArgumentNode.test.ts │ │ │ │ ├── InstructionNode.test.ts │ │ │ │ ├── MapTypeNode.test.ts │ │ │ │ ├── NumberTypeNode.test.ts │ │ │ │ ├── OptionTypeNode.test.ts │ │ │ │ ├── PostOffsetTypeNode.test.ts │ │ │ │ ├── PreOffsetTypeNode.test.ts │ │ │ │ ├── PublicKeyTypeNode.test.ts │ │ │ │ ├── RemainderOptionTypeNode.test.ts │ │ │ │ ├── SentinelTypeNode.test.ts │ │ │ │ ├── SetTypeNode.test.ts │ │ │ │ ├── SizePrefixTypeNode.test.ts │ │ │ │ ├── StringTypeNode.test.ts │ │ │ │ ├── StructFieldTypeNode.test.ts │ │ │ │ ├── StructTypeNode.test.ts │ │ │ │ ├── TupleTypeNode.test.ts │ │ │ │ └── ZeroableOptionTypeNode.test.ts │ │ │ ├── types/ │ │ │ │ └── global.d.ts │ │ │ └── values/ │ │ │ ├── ArrayValueNode.test.ts │ │ │ ├── BytesValueNode.test.ts │ │ │ ├── ConstantValueNode.test.ts │ │ │ ├── EnumValueNode.test.ts │ │ │ ├── MapValueNode.test.ts │ │ │ ├── NoneValueNode.test.ts │ │ │ ├── NumberValueNode.test.ts │ │ │ ├── PublicKeyValueNode.test.ts │ │ │ ├── SetValueNode.test.ts │ │ │ ├── SomeValueNode.test.ts │ │ │ ├── StringValueNode.test.ts │ │ │ ├── StructValueNode.test.ts │ │ │ └── TupleValueNode.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── dynamic-parsers/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── discriminators.ts │ │ │ ├── identify.ts │ │ │ ├── index.ts │ │ │ ├── parsers.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── test/ │ │ │ ├── _setup.ts │ │ │ ├── discriminators.test.ts │ │ │ ├── identify.test.ts │ │ │ ├── parsers.test.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── errors/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin/ │ │ │ └── cli.cjs │ │ ├── package.json │ │ ├── src/ │ │ │ ├── cli/ │ │ │ │ └── index.ts │ │ │ ├── codes.ts │ │ │ ├── context.ts │ │ │ ├── error.ts │ │ │ ├── index.ts │ │ │ ├── logs.ts │ │ │ ├── message-formatter.ts │ │ │ ├── messages.ts │ │ │ ├── stack-trace.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── test/ │ │ │ ├── error.test.ts │ │ │ ├── error.typetest.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── library/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin/ │ │ │ └── cli.cjs │ │ ├── package.json │ │ ├── src/ │ │ │ ├── cli/ │ │ │ │ └── index.ts │ │ │ ├── codama.ts │ │ │ ├── index.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── test/ │ │ │ └── index.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── node-types/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── AccountNode.ts │ │ │ ├── DefinedTypeNode.ts │ │ │ ├── ErrorNode.ts │ │ │ ├── EventNode.ts │ │ │ ├── InstructionAccountNode.ts │ │ │ ├── InstructionArgumentNode.ts │ │ │ ├── InstructionByteDeltaNode.ts │ │ │ ├── InstructionNode.ts │ │ │ ├── InstructionRemainingAccountsNode.ts │ │ │ ├── InstructionStatusNode.ts │ │ │ ├── Node.ts │ │ │ ├── PdaNode.ts │ │ │ ├── ProgramNode.ts │ │ │ ├── RootNode.ts │ │ │ ├── contextualValueNodes/ │ │ │ │ ├── AccountBumpValueNode.ts │ │ │ │ ├── AccountValueNode.ts │ │ │ │ ├── ArgumentValueNode.ts │ │ │ │ ├── ConditionalValueNode.ts │ │ │ │ ├── ContextualValueNode.ts │ │ │ │ ├── IdentityValueNode.ts │ │ │ │ ├── PayerValueNode.ts │ │ │ │ ├── PdaSeedValueNode.ts │ │ │ │ ├── PdaValueNode.ts │ │ │ │ ├── ProgramIdValueNode.ts │ │ │ │ ├── ResolverValueNode.ts │ │ │ │ └── index.ts │ │ │ ├── countNodes/ │ │ │ │ ├── CountNode.ts │ │ │ │ ├── FixedCountNode.ts │ │ │ │ ├── PrefixedCountNode.ts │ │ │ │ ├── RemainderCountNode.ts │ │ │ │ └── index.ts │ │ │ ├── discriminatorNodes/ │ │ │ │ ├── ConstantDiscriminatorNode.ts │ │ │ │ ├── DiscriminatorNode.ts │ │ │ │ ├── FieldDiscriminatorNode.ts │ │ │ │ ├── SizeDiscriminatorNode.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── linkNodes/ │ │ │ │ ├── AccountLinkNode.ts │ │ │ │ ├── DefinedTypeLinkNode.ts │ │ │ │ ├── InstructionAccountLinkNode.ts │ │ │ │ ├── InstructionArgumentLinkNode.ts │ │ │ │ ├── InstructionLinkNode.ts │ │ │ │ ├── LinkNode.ts │ │ │ │ ├── PdaLinkNode.ts │ │ │ │ ├── ProgramLinkNode.ts │ │ │ │ └── index.ts │ │ │ ├── pdaSeedNodes/ │ │ │ │ ├── ConstantPdaSeedNode.ts │ │ │ │ ├── PdaSeedNode.ts │ │ │ │ ├── VariablePdaSeedNode.ts │ │ │ │ └── index.ts │ │ │ ├── shared/ │ │ │ │ ├── bytesEncoding.ts │ │ │ │ ├── docs.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instructionLifecycle.ts │ │ │ │ ├── stringCases.ts │ │ │ │ └── version.ts │ │ │ ├── typeNodes/ │ │ │ │ ├── AmountTypeNode.ts │ │ │ │ ├── ArrayTypeNode.ts │ │ │ │ ├── BooleanTypeNode.ts │ │ │ │ ├── BytesTypeNode.ts │ │ │ │ ├── DateTimeTypeNode.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.ts │ │ │ │ ├── EnumStructVariantTypeNode.ts │ │ │ │ ├── EnumTupleVariantTypeNode.ts │ │ │ │ ├── EnumTypeNode.ts │ │ │ │ ├── EnumVariantTypeNode.ts │ │ │ │ ├── FixedSizeTypeNode.ts │ │ │ │ ├── HiddenPrefixTypeNode.ts │ │ │ │ ├── HiddenSuffixTypeNode.ts │ │ │ │ ├── MapTypeNode.ts │ │ │ │ ├── NestedTypeNode.ts │ │ │ │ ├── NumberTypeNode.ts │ │ │ │ ├── OptionTypeNode.ts │ │ │ │ ├── PostOffsetTypeNode.ts │ │ │ │ ├── PreOffsetTypeNode.ts │ │ │ │ ├── PublicKeyTypeNode.ts │ │ │ │ ├── RemainderOptionTypeNode.ts │ │ │ │ ├── SentinelTypeNode.ts │ │ │ │ ├── SetTypeNode.ts │ │ │ │ ├── SizePrefixTypeNode.ts │ │ │ │ ├── SolAmountTypeNode.ts │ │ │ │ ├── StringTypeNode.ts │ │ │ │ ├── StructFieldTypeNode.ts │ │ │ │ ├── StructTypeNode.ts │ │ │ │ ├── TupleTypeNode.ts │ │ │ │ ├── TypeNode.ts │ │ │ │ ├── ZeroableOptionTypeNode.ts │ │ │ │ └── index.ts │ │ │ └── valueNodes/ │ │ │ ├── ArrayValueNode.ts │ │ │ ├── BooleanValueNode.ts │ │ │ ├── BytesValueNode.ts │ │ │ ├── ConstantValueNode.ts │ │ │ ├── EnumValueNode.ts │ │ │ ├── MapEntryValueNode.ts │ │ │ ├── MapValueNode.ts │ │ │ ├── NoneValueNode.ts │ │ │ ├── NumberValueNode.ts │ │ │ ├── PublicKeyValueNode.ts │ │ │ ├── SetValueNode.ts │ │ │ ├── SomeValueNode.ts │ │ │ ├── StringValueNode.ts │ │ │ ├── StructFieldValueNode.ts │ │ │ ├── StructValueNode.ts │ │ │ ├── TupleValueNode.ts │ │ │ ├── ValueNode.ts │ │ │ └── index.ts │ │ ├── test/ │ │ │ └── GetNodeFromKind.typetest.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── nodes/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── docs/ │ │ │ ├── AccountNode.md │ │ │ ├── DefinedTypeNode.md │ │ │ ├── ErrorNode.md │ │ │ ├── EventNode.md │ │ │ ├── InstructionAccountNode.md │ │ │ ├── InstructionArgumentNode.md │ │ │ ├── InstructionByteDeltaNode.md │ │ │ ├── InstructionNode.md │ │ │ ├── InstructionRemainingAccountsNode.md │ │ │ ├── InstructionStatusNode.md │ │ │ ├── PdaNode.md │ │ │ ├── ProgramNode.md │ │ │ ├── README.md │ │ │ ├── RootNode.md │ │ │ ├── _template.md │ │ │ ├── contextualValueNodes/ │ │ │ │ ├── AccountBumpValueNode.md │ │ │ │ ├── AccountValueNode.md │ │ │ │ ├── ArgumentValueNode.md │ │ │ │ ├── ConditionalValueNode.md │ │ │ │ ├── IdentityValueNode.md │ │ │ │ ├── InstructionInputValueNode.md │ │ │ │ ├── PayerValueNode.md │ │ │ │ ├── PdaSeedValueNode.md │ │ │ │ ├── PdaValueNode.md │ │ │ │ ├── ProgramIdValueNode.md │ │ │ │ ├── README.md │ │ │ │ └── ResolverValueNode.md │ │ │ ├── countNodes/ │ │ │ │ ├── FixedCountNode.md │ │ │ │ ├── PrefixedCountNode.md │ │ │ │ ├── README.md │ │ │ │ └── RemainderCountNode.md │ │ │ ├── discriminatorNodes/ │ │ │ │ ├── ConstantDiscriminatorNode.md │ │ │ │ ├── FieldDiscriminatorNode.md │ │ │ │ ├── README.md │ │ │ │ └── SizeDiscriminatorNode.md │ │ │ ├── linkNodes/ │ │ │ │ ├── AccountLinkNode.md │ │ │ │ ├── DefinedTypeLinkNode.md │ │ │ │ ├── InstructionAccountLinkNode.md │ │ │ │ ├── InstructionArgumentLinkNode.md │ │ │ │ ├── InstructionLinkNode.md │ │ │ │ ├── PdaLinkNode.md │ │ │ │ ├── ProgramLinkNode.md │ │ │ │ └── README.md │ │ │ ├── pdaSeedNodes/ │ │ │ │ ├── ConstantPdaSeedNode.md │ │ │ │ ├── README.md │ │ │ │ └── VariablePdaSeedNode.md │ │ │ ├── typeNodes/ │ │ │ │ ├── AmountTypeNode.md │ │ │ │ ├── ArrayTypeNode.md │ │ │ │ ├── BooleanTypeNode.md │ │ │ │ ├── BytesTypeNode.md │ │ │ │ ├── DateTimeTypeNode.md │ │ │ │ ├── EnumEmptyVariantTypeNode.md │ │ │ │ ├── EnumStructVariantTypeNode.md │ │ │ │ ├── EnumTupleVariantTypeNode.md │ │ │ │ ├── EnumTypeNode.md │ │ │ │ ├── EnumVariantTypeNode.md │ │ │ │ ├── FixedSizeTypeNode.md │ │ │ │ ├── HiddenPrefixTypeNode.md │ │ │ │ ├── HiddenSuffixTypeNode.md │ │ │ │ ├── MapTypeNode.md │ │ │ │ ├── NestedTypeNode.md │ │ │ │ ├── NumberTypeNode.md │ │ │ │ ├── OptionTypeNode.md │ │ │ │ ├── PostOffsetTypeNode.md │ │ │ │ ├── PreOffsetTypeNode.md │ │ │ │ ├── PublicKeyTypeNode.md │ │ │ │ ├── README.md │ │ │ │ ├── RemainderOptionTypeNode.md │ │ │ │ ├── SentinelTypeNode.md │ │ │ │ ├── SetTypeNode.md │ │ │ │ ├── SizePrefixTypeNode.md │ │ │ │ ├── SolAmountTypeNode.md │ │ │ │ ├── StringTypeNode.md │ │ │ │ ├── StructFieldTypeNode.md │ │ │ │ ├── StructTypeNode.md │ │ │ │ ├── TupleTypeNode.md │ │ │ │ └── ZeroableOptionTypeNode.md │ │ │ └── valueNodes/ │ │ │ ├── ArrayValueNode.md │ │ │ ├── BooleanValueNode.md │ │ │ ├── BytesValueNode.md │ │ │ ├── ConstantValueNode.md │ │ │ ├── EnumValueNode.md │ │ │ ├── MapEntryValueNode.md │ │ │ ├── MapValueNode.md │ │ │ ├── NoneValueNode.md │ │ │ ├── NumberValueNode.md │ │ │ ├── PublicKeyValueNode.md │ │ │ ├── README.md │ │ │ ├── SetValueNode.md │ │ │ ├── SomeValueNode.md │ │ │ ├── StringValueNode.md │ │ │ ├── StructFieldValueNode.md │ │ │ ├── StructValueNode.md │ │ │ └── TupleValueNode.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── AccountNode.ts │ │ │ ├── DefinedTypeNode.ts │ │ │ ├── ErrorNode.ts │ │ │ ├── EventNode.ts │ │ │ ├── InstructionAccountNode.ts │ │ │ ├── InstructionArgumentNode.ts │ │ │ ├── InstructionByteDeltaNode.ts │ │ │ ├── InstructionNode.ts │ │ │ ├── InstructionRemainingAccountsNode.ts │ │ │ ├── InstructionStatusNode.ts │ │ │ ├── Node.ts │ │ │ ├── PdaNode.ts │ │ │ ├── ProgramNode.ts │ │ │ ├── RootNode.ts │ │ │ ├── contextualValueNodes/ │ │ │ │ ├── AccountBumpValueNode.ts │ │ │ │ ├── AccountValueNode.ts │ │ │ │ ├── ArgumentValueNode.ts │ │ │ │ ├── ConditionalValueNode.ts │ │ │ │ ├── ContextualValueNode.ts │ │ │ │ ├── IdentityValueNode.ts │ │ │ │ ├── PayerValueNode.ts │ │ │ │ ├── PdaSeedValueNode.ts │ │ │ │ ├── PdaValueNode.ts │ │ │ │ ├── ProgramIdValueNode.ts │ │ │ │ ├── ResolverValueNode.ts │ │ │ │ └── index.ts │ │ │ ├── countNodes/ │ │ │ │ ├── CountNode.ts │ │ │ │ ├── FixedCountNode.ts │ │ │ │ ├── PrefixedCountNode.ts │ │ │ │ ├── RemainderCountNode.ts │ │ │ │ └── index.ts │ │ │ ├── discriminatorNodes/ │ │ │ │ ├── ConstantDiscriminatorNode.ts │ │ │ │ ├── DiscriminatorNode.ts │ │ │ │ ├── FieldDiscriminatorNode.ts │ │ │ │ ├── SizeDiscriminatorNode.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── linkNodes/ │ │ │ │ ├── AccountLinkNode.ts │ │ │ │ ├── DefinedTypeLinkNode.ts │ │ │ │ ├── InstructionAccountLinkNode.ts │ │ │ │ ├── InstructionArgumentLinkNode.ts │ │ │ │ ├── InstructionLinkNode.ts │ │ │ │ ├── LinkNode.ts │ │ │ │ ├── PdaLinkNode.ts │ │ │ │ ├── ProgramLinkNode.ts │ │ │ │ └── index.ts │ │ │ ├── pdaSeedNodes/ │ │ │ │ ├── ConstantPdaSeedNode.ts │ │ │ │ ├── PdaSeedNode.ts │ │ │ │ ├── VariablePdaSeedNode.ts │ │ │ │ └── index.ts │ │ │ ├── shared/ │ │ │ │ ├── docs.ts │ │ │ │ ├── index.ts │ │ │ │ └── stringCases.ts │ │ │ ├── typeNodes/ │ │ │ │ ├── AmountTypeNode.ts │ │ │ │ ├── ArrayTypeNode.ts │ │ │ │ ├── BooleanTypeNode.ts │ │ │ │ ├── BytesTypeNode.ts │ │ │ │ ├── DateTimeTypeNode.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.ts │ │ │ │ ├── EnumStructVariantTypeNode.ts │ │ │ │ ├── EnumTupleVariantTypeNode.ts │ │ │ │ ├── EnumTypeNode.ts │ │ │ │ ├── EnumVariantTypeNode.ts │ │ │ │ ├── FixedSizeTypeNode.ts │ │ │ │ ├── HiddenPrefixTypeNode.ts │ │ │ │ ├── HiddenSuffixTypeNode.ts │ │ │ │ ├── MapTypeNode.ts │ │ │ │ ├── NestedTypeNode.ts │ │ │ │ ├── NumberTypeNode.ts │ │ │ │ ├── OptionTypeNode.ts │ │ │ │ ├── PostOffsetTypeNode.ts │ │ │ │ ├── PreOffsetTypeNode.ts │ │ │ │ ├── PublicKeyTypeNode.ts │ │ │ │ ├── RemainderOptionTypeNode.ts │ │ │ │ ├── SentinelTypeNode.ts │ │ │ │ ├── SetTypeNode.ts │ │ │ │ ├── SizePrefixTypeNode.ts │ │ │ │ ├── SolAmountTypeNode.ts │ │ │ │ ├── StringTypeNode.ts │ │ │ │ ├── StructFieldTypeNode.ts │ │ │ │ ├── StructTypeNode.ts │ │ │ │ ├── TupleTypeNode.ts │ │ │ │ ├── TypeNode.ts │ │ │ │ ├── ZeroableOptionTypeNode.ts │ │ │ │ └── index.ts │ │ │ ├── types/ │ │ │ │ └── global.d.ts │ │ │ └── valueNodes/ │ │ │ ├── ArrayValueNode.ts │ │ │ ├── BooleanValueNode.ts │ │ │ ├── BytesValueNode.ts │ │ │ ├── ConstantValueNode.ts │ │ │ ├── EnumValueNode.ts │ │ │ ├── MapEntryValueNode.ts │ │ │ ├── MapValueNode.ts │ │ │ ├── NoneValueNode.ts │ │ │ ├── NumberValueNode.ts │ │ │ ├── PublicKeyValueNode.ts │ │ │ ├── SetValueNode.ts │ │ │ ├── SomeValueNode.ts │ │ │ ├── StringValueNode.ts │ │ │ ├── StructFieldValueNode.ts │ │ │ ├── StructValueNode.ts │ │ │ ├── TupleValueNode.ts │ │ │ ├── ValueNode.ts │ │ │ └── index.ts │ │ ├── test/ │ │ │ ├── AccountNode.test.ts │ │ │ ├── DefinedTypeNode.test.ts │ │ │ ├── ErrorNode.test.ts │ │ │ ├── EventNode.test.ts │ │ │ ├── InstructionAccountNode.test.ts │ │ │ ├── InstructionArgumentNode.test.ts │ │ │ ├── InstructionByteDeltaNode.test.ts │ │ │ ├── InstructionNode.test.ts │ │ │ ├── InstructionRemainingAccountsNode.test.ts │ │ │ ├── InstructionStatusNode.test.ts │ │ │ ├── Node.test.ts │ │ │ ├── Node.typetest.ts │ │ │ ├── PdaNode.test.ts │ │ │ ├── ProgramNode.test.ts │ │ │ ├── RootNode.test.ts │ │ │ ├── contextualValueNodes/ │ │ │ │ ├── AccountBumpValueNode.test.ts │ │ │ │ ├── AccountValueNode.test.ts │ │ │ │ ├── ArgumentValueNode.test.ts │ │ │ │ ├── ConditionalValueNode.test.ts │ │ │ │ ├── ContextualValueNode.typetest.ts │ │ │ │ ├── IdentityValueNode.test.ts │ │ │ │ ├── PayerValueNode.test.ts │ │ │ │ ├── PdaSeedValueNode.test.ts │ │ │ │ ├── PdaValueNode.test.ts │ │ │ │ ├── ProgramIdValueNode.test.ts │ │ │ │ └── ResolverValueNode.test.ts │ │ │ ├── countNodes/ │ │ │ │ ├── CountNode.typetest.ts │ │ │ │ ├── FixedCountNode.test.ts │ │ │ │ ├── PrefixedCountNode.test.ts │ │ │ │ └── RemainderCountNode.test.ts │ │ │ ├── discriminatorNodes/ │ │ │ │ ├── ConstantDiscriminatorNode.test.ts │ │ │ │ ├── DiscriminatorNode.typetest.ts │ │ │ │ ├── FieldDiscriminatorNode.test.ts │ │ │ │ └── SizeDiscriminatorNode.test.ts │ │ │ ├── linkNodes/ │ │ │ │ ├── AccountLinkNode.test.ts │ │ │ │ ├── DefinedTypeLinkNode.test.ts │ │ │ │ ├── InstructionAccountLinkNode.test.ts │ │ │ │ ├── InstructionArgumentLinkNode.test.ts │ │ │ │ ├── InstructionLinkNode.test.ts │ │ │ │ ├── LinkNode.typetest.ts │ │ │ │ ├── PdaLinkNode.test.ts │ │ │ │ └── ProgramLinkNode.test.ts │ │ │ ├── pdaSeedNodes/ │ │ │ │ ├── ConstantPdaSeedNode.test.ts │ │ │ │ ├── PdaSeedNode.typetest.ts │ │ │ │ └── VariablePdaSeedNode.test.ts │ │ │ ├── shared/ │ │ │ │ └── stringCases.test.ts │ │ │ ├── typeNodes/ │ │ │ │ ├── AmountTypeNode.test.ts │ │ │ │ ├── ArrayTypeNode.test.ts │ │ │ │ ├── BooleanTypeNode.test.ts │ │ │ │ ├── BytesTypeNode.test.ts │ │ │ │ ├── DateTimeTypeNode.test.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.test.ts │ │ │ │ ├── EnumStructVariantTypeNode.test.ts │ │ │ │ ├── EnumTupleVariantTypeNode.test.ts │ │ │ │ ├── EnumTypeNode.test.ts │ │ │ │ ├── FixedSizeTypeNode.test.ts │ │ │ │ ├── HiddenPrefixTypeNode.test.ts │ │ │ │ ├── HiddenSuffixTypeNode.test.ts │ │ │ │ ├── MapTypeNode.test.ts │ │ │ │ ├── NestedTypeNode.test.ts │ │ │ │ ├── NestedTypeNode.typetest.ts │ │ │ │ ├── NumberTypeNode.test.ts │ │ │ │ ├── OptionTypeNode.test.ts │ │ │ │ ├── PostOffsetTypeNode.test.ts │ │ │ │ ├── PreOffsetTypeNode.test.ts │ │ │ │ ├── PublicKeyTypeNode.test.ts │ │ │ │ ├── RemainderOptionTypeNode.test.ts │ │ │ │ ├── SentinelTypeNode.test.ts │ │ │ │ ├── SetTypeNode.test.ts │ │ │ │ ├── SizePrefixTypeNode.test.ts │ │ │ │ ├── SolAmountTypeNode.test.ts │ │ │ │ ├── StringTypeNode.test.ts │ │ │ │ ├── StructFieldTypeNode.test.ts │ │ │ │ ├── StructTypeNode.test.ts │ │ │ │ ├── TupleTypeNode.test.ts │ │ │ │ ├── TypeNode.typetest.ts │ │ │ │ └── ZeroableOptionTypeNode.test.ts │ │ │ ├── types/ │ │ │ │ └── global.d.ts │ │ │ └── valueNodes/ │ │ │ ├── ArrayValueNode.test.ts │ │ │ ├── BooleanValueNode.test.ts │ │ │ ├── BytesValueNode.test.ts │ │ │ ├── ConstantValueNode.test.ts │ │ │ ├── EnumValueNode.test.ts │ │ │ ├── MapEntryValueNode.test.ts │ │ │ ├── MapValueNode.test.ts │ │ │ ├── NoneValueNode.test.ts │ │ │ ├── NumberValueNode.test.ts │ │ │ ├── PublicKeyValueNode.test.ts │ │ │ ├── SetValueNode.test.ts │ │ │ ├── SomeValueNode.test.ts │ │ │ ├── StringValueNode.test.ts │ │ │ ├── StructFieldValueNode.test.ts │ │ │ ├── StructValueNode.test.ts │ │ │ ├── TupleValueNode.test.ts │ │ │ └── ValueNode.typetest.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── nodes-from-anchor/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── defaultVisitor.ts │ │ │ ├── discriminators.ts │ │ │ ├── extractPdasVisitor.ts │ │ │ ├── index.ts │ │ │ ├── utils.ts │ │ │ ├── v00/ │ │ │ │ ├── AccountNode.ts │ │ │ │ ├── DefinedTypeNode.ts │ │ │ │ ├── ErrorNode.ts │ │ │ │ ├── InstructionAccountNode.ts │ │ │ │ ├── InstructionArgumentNode.ts │ │ │ │ ├── InstructionNode.ts │ │ │ │ ├── PdaNode.ts │ │ │ │ ├── ProgramNode.ts │ │ │ │ ├── RootNode.ts │ │ │ │ ├── idl.ts │ │ │ │ ├── index.ts │ │ │ │ └── typeNodes/ │ │ │ │ ├── ArrayTypeNode.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.ts │ │ │ │ ├── EnumStructVariantTypeNode.ts │ │ │ │ ├── EnumTupleVariantTypeNode.ts │ │ │ │ ├── EnumTypeNode.ts │ │ │ │ ├── MapTypeNode.ts │ │ │ │ ├── OptionTypeNode.ts │ │ │ │ ├── SetTypeNode.ts │ │ │ │ ├── StructFieldTypeNode.ts │ │ │ │ ├── StructTypeNode.ts │ │ │ │ ├── TupleTypeNode.ts │ │ │ │ ├── TypeNode.ts │ │ │ │ └── index.ts │ │ │ └── v01/ │ │ │ ├── AccountNode.ts │ │ │ ├── DefinedTypeNode.ts │ │ │ ├── ErrorNode.ts │ │ │ ├── EventNode.ts │ │ │ ├── InstructionAccountNode.ts │ │ │ ├── InstructionArgumentNode.ts │ │ │ ├── InstructionNode.ts │ │ │ ├── PdaSeedNode.ts │ │ │ ├── ProgramNode.ts │ │ │ ├── RootNode.ts │ │ │ ├── idl.ts │ │ │ ├── index.ts │ │ │ ├── typeNodes/ │ │ │ │ ├── ArrayTypeNode.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.ts │ │ │ │ ├── EnumStructVariantTypeNode.ts │ │ │ │ ├── EnumTupleVariantTypeNode.ts │ │ │ │ ├── EnumTypeNode.ts │ │ │ │ ├── OptionTypeNode.ts │ │ │ │ ├── StructFieldTypeNode.ts │ │ │ │ ├── StructTypeNode.ts │ │ │ │ ├── TupleTypeNode.ts │ │ │ │ ├── TypeNode.ts │ │ │ │ └── index.ts │ │ │ └── unwrapGenerics.ts │ │ ├── test/ │ │ │ ├── discriminator.test.ts │ │ │ ├── rootNodeFromAnchor.test.ts │ │ │ ├── v00/ │ │ │ │ ├── AccountNode.test.ts │ │ │ │ ├── DefinedTypeNode.test.ts │ │ │ │ ├── ErrorNode.test.ts │ │ │ │ ├── InstructionAccountNode.test.ts │ │ │ │ ├── InstructionArgumentNode.test.ts │ │ │ │ ├── InstructionNode.test.ts │ │ │ │ ├── PdaNode.test.ts │ │ │ │ ├── ProgramNode.test.ts │ │ │ │ ├── RootNode.test.ts │ │ │ │ └── typeNodes/ │ │ │ │ ├── ArrayTypeNode.test.ts │ │ │ │ ├── BooleanTypeNode.test.ts │ │ │ │ ├── BytesTypeNode.test.ts │ │ │ │ ├── EnumTypeNode.test.ts │ │ │ │ ├── MapTypeNode.test.ts │ │ │ │ ├── NumberTypeNode.test.ts │ │ │ │ ├── OptionTypeNode.test.ts │ │ │ │ ├── PublicKeyTypeNode.test.ts │ │ │ │ ├── SetTypeNode.test.ts │ │ │ │ ├── StringTypeNode.test.ts │ │ │ │ ├── StructTypeNode.test.ts │ │ │ │ └── TupleTypeNode.test.ts │ │ │ └── v01/ │ │ │ ├── AccountNode.test.ts │ │ │ ├── DefinedTypeNode.test.ts │ │ │ ├── ErrorNode.test.ts │ │ │ ├── EventNode.test.ts │ │ │ ├── InstructionAccountNode.test.ts │ │ │ ├── InstructionArgumentNode.test.ts │ │ │ ├── InstructionNode.test.ts │ │ │ ├── ProgramNode.test.ts │ │ │ ├── RootNode.test.ts │ │ │ ├── extractPdasVisitor.test.ts │ │ │ ├── pdaSeedNode.test.ts │ │ │ └── typeNodes/ │ │ │ ├── ArrayTypeNode.test.ts │ │ │ ├── BooleanTypeNode.test.ts │ │ │ ├── BytesTypeNode.test.ts │ │ │ ├── EnumTypeNode.test.ts │ │ │ ├── NumberTypeNode.test.ts │ │ │ ├── OptionTypeNode.test.ts │ │ │ ├── PublicKeyTypeNode.test.ts │ │ │ ├── StringTypeNode.test.ts │ │ │ ├── StructTypeNode.test.ts │ │ │ └── TupleTypeNode.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── renderers-core/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── fragment.ts │ │ │ ├── fs.ts │ │ │ ├── index.ts │ │ │ ├── path.ts │ │ │ ├── renderMap.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── test/ │ │ │ ├── fs.test.json │ │ │ ├── fs.test.ts │ │ │ ├── path.test.ts │ │ │ ├── renderMap.test.ts │ │ │ └── types/ │ │ │ └── global.d.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── validators/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── ValidationItem.ts │ │ │ ├── getValidationItemsVisitor.ts │ │ │ ├── index.ts │ │ │ └── throwValidatorItemsVisitor.ts │ │ ├── test/ │ │ │ └── getValidationItemsVisitor.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ ├── visitors/ │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── addPdasVisitor.ts │ │ │ ├── createSubInstructionsFromEnumArgsVisitor.ts │ │ │ ├── deduplicateIdenticalDefinedTypesVisitor.ts │ │ │ ├── fillDefaultPdaSeedValuesVisitor.ts │ │ │ ├── flattenInstructionDataArgumentsVisitor.ts │ │ │ ├── flattenStructVisitor.ts │ │ │ ├── getDefinedTypeHistogramVisitor.ts │ │ │ ├── index.ts │ │ │ ├── renameHelpers.ts │ │ │ ├── setAccountDiscriminatorFromFieldVisitor.ts │ │ │ ├── setFixedAccountSizesVisitor.ts │ │ │ ├── setInstructionAccountDefaultValuesVisitor.ts │ │ │ ├── setInstructionDiscriminatorsVisitor.ts │ │ │ ├── setNumberWrappersVisitor.ts │ │ │ ├── setStructDefaultValuesVisitor.ts │ │ │ ├── transformDefinedTypesIntoAccountsVisitor.ts │ │ │ ├── transformU8ArraysToBytesVisitor.ts │ │ │ ├── unwrapDefinedTypesVisitor.ts │ │ │ ├── unwrapInstructionArgsDefinedTypesVisitor.ts │ │ │ ├── unwrapTupleEnumWithSingleStructVisitor.ts │ │ │ ├── unwrapTypeDefinedLinksVisitor.ts │ │ │ ├── updateAccountsVisitor.ts │ │ │ ├── updateDefinedTypesVisitor.ts │ │ │ ├── updateErrorsVisitor.ts │ │ │ ├── updateInstructionsVisitor.ts │ │ │ └── updateProgramsVisitor.ts │ │ ├── test/ │ │ │ ├── addPdasVisitor.test.ts │ │ │ ├── fillDefaultPdaSeedValuesVisitor.test.ts │ │ │ ├── getDefinedTypeHistogramVisitor.test.ts │ │ │ ├── setStructDefaultValuesVisitor.test.ts │ │ │ ├── unwrapDefinedTypesVisitor.test.ts │ │ │ ├── unwrapInstructionArgsDefinedTypesVisitor.test.ts │ │ │ ├── updateAccountsVisitor.test.ts │ │ │ └── updateInstructionsVisitor.test.ts │ │ ├── tsconfig.declarations.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.config.mts │ └── visitors-core/ │ ├── .gitignore │ ├── .prettierignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── LinkableDictionary.ts │ │ ├── NodePath.ts │ │ ├── NodeSelector.ts │ │ ├── NodeStack.ts │ │ ├── bottomUpTransformerVisitor.ts │ │ ├── consoleLogVisitor.ts │ │ ├── deleteNodesVisitor.ts │ │ ├── extendVisitor.ts │ │ ├── getByteSizeVisitor.ts │ │ ├── getDebugStringVisitor.ts │ │ ├── getMaxByteSizeVisitor.ts │ │ ├── getResolvedInstructionInputsVisitor.ts │ │ ├── getUniqueHashStringVisitor.ts │ │ ├── identityVisitor.ts │ │ ├── index.ts │ │ ├── interceptFirstVisitVisitor.ts │ │ ├── interceptVisitor.ts │ │ ├── mapVisitor.ts │ │ ├── mergeVisitor.ts │ │ ├── nonNullableIdentityVisitor.ts │ │ ├── pipe.ts │ │ ├── recordLinkablesVisitor.ts │ │ ├── recordNodeStackVisitor.ts │ │ ├── removeDocsVisitor.ts │ │ ├── singleNodeVisitor.ts │ │ ├── staticVisitor.ts │ │ ├── tapVisitor.ts │ │ ├── topDownTransformerVisitor.ts │ │ ├── visitor.ts │ │ └── voidVisitor.ts │ ├── test/ │ │ ├── NodeSelector.test.ts │ │ ├── bottomUpTransformerVisitor.test.ts │ │ ├── deleteNodesVisitor.test.ts │ │ ├── extendVisitor.test.ts │ │ ├── getByteSizeVisitor.test.ts │ │ ├── getDebugStringVisitor.test.ts │ │ ├── getMaxByteSizeVisitor.test.ts │ │ ├── getResolvedInstructionInputsVisitor.test.ts │ │ ├── getUniqueHashStringVisitor.test.ts │ │ ├── identityVisitor.test.ts │ │ ├── interceptFirstVisitVisitor.test.ts │ │ ├── interceptVisitor.test.ts │ │ ├── mapVisitor.test.ts │ │ ├── mergeVisitor.test.ts │ │ ├── nodes/ │ │ │ ├── AccountNode.test.ts │ │ │ ├── DefinedTypeNode.test.ts │ │ │ ├── ErrorNode.test.ts │ │ │ ├── EventNode.test.ts │ │ │ ├── InstructionAccountNode.test.ts │ │ │ ├── InstructionArgumentNode.test.ts │ │ │ ├── InstructionByteDeltaNode.test.ts │ │ │ ├── InstructionNode.test.ts │ │ │ ├── InstructionRemainingAccountsNode.test.ts │ │ │ ├── PdaNode.test.ts │ │ │ ├── ProgramNode.test.ts │ │ │ ├── RootNode.test.ts │ │ │ ├── _setup.ts │ │ │ ├── contextualValueNodes/ │ │ │ │ ├── AccountBumpValueNode.test.ts │ │ │ │ ├── AccountValueNode.test.ts │ │ │ │ ├── ArgumentValueNode.test.ts │ │ │ │ ├── ConditionalValueNode.test.ts │ │ │ │ ├── IdentityValueNode.test.ts │ │ │ │ ├── PayerValueNode.test.ts │ │ │ │ ├── PdaSeedValueNode.test.ts │ │ │ │ ├── PdaValueNode.test.ts │ │ │ │ ├── ProgramIdValueNode.test.ts │ │ │ │ └── ResolverValueNode.test.ts │ │ │ ├── discriminatorNodes/ │ │ │ │ ├── ConstantDiscriminatorNode.test.ts │ │ │ │ ├── FieldDiscriminatorNode.test.ts │ │ │ │ └── SizeDiscriminatorNode.test.ts │ │ │ ├── linkNodes/ │ │ │ │ ├── AccountLinkNode.test.ts │ │ │ │ ├── DefinedTypeLinkNode.test.ts │ │ │ │ ├── InstructionAccountLinkNode.test.ts │ │ │ │ ├── InstructionArgumentLinkNode.test.ts │ │ │ │ ├── InstructionLinkNode.test.ts │ │ │ │ ├── PdaLinkNode.test.ts │ │ │ │ └── ProgramLinkNode.test.ts │ │ │ ├── pdaSeedNodes/ │ │ │ │ ├── ConstantPdaSeedNode.test.ts │ │ │ │ └── VariablePdaSeedNode.test.ts │ │ │ ├── sizeNodes/ │ │ │ │ ├── FixedSizeNode.test.ts │ │ │ │ ├── PrefixedSizeNode.test.ts │ │ │ │ └── RemainderSizeNode.test.ts │ │ │ ├── typeNodes/ │ │ │ │ ├── AmountTypeNode.test.ts │ │ │ │ ├── ArrayTypeNode.test.ts │ │ │ │ ├── BooleanTypeNode.test.ts │ │ │ │ ├── BytesTypeNode.test.ts │ │ │ │ ├── DateTimeTypeNode.test.ts │ │ │ │ ├── EnumEmptyVariantTypeNode.test.ts │ │ │ │ ├── EnumStructVariantTypeNode.test.ts │ │ │ │ ├── EnumTupleVariantTypeNode.test.ts │ │ │ │ ├── EnumTypeNode.test.ts │ │ │ │ ├── FixedSizeTypeNode.test.ts │ │ │ │ ├── HiddenPrefixTypeNode.test.ts │ │ │ │ ├── HiddenSuffixTypeNode.test.ts │ │ │ │ ├── MapTypeNode.test.ts │ │ │ │ ├── NumberTypeNode.test.ts │ │ │ │ ├── OptionTypeNode.test.ts │ │ │ │ ├── PostOffsetTypeNode.test.ts │ │ │ │ ├── PreOffsetTypeNode.test.ts │ │ │ │ ├── PublicKeyTypeNode.test.ts │ │ │ │ ├── RemainderOptionTypeNode.test.ts │ │ │ │ ├── SentinelTypeNode.test.ts │ │ │ │ ├── SetTypeNode.test.ts │ │ │ │ ├── SizePrefixTypeNode.test.ts │ │ │ │ ├── SolAmountTypeNode.test.ts │ │ │ │ ├── StringTypeNode.test.ts │ │ │ │ ├── StructFieldTypeNode.test.ts │ │ │ │ ├── StructTypeNode.test.ts │ │ │ │ ├── TupleTypeNode.test.ts │ │ │ │ └── ZeroableOptionTypeNode.test.ts │ │ │ └── valueNodes/ │ │ │ ├── ArrayValueNode.test.ts │ │ │ ├── BooleanValueNode.test.ts │ │ │ ├── BytesValueNode.test.ts │ │ │ ├── ConstantValueNode.test.ts │ │ │ ├── EnumValueNode.test.ts │ │ │ ├── MapEntryValueNode.test.ts │ │ │ ├── MapValueNode.test.ts │ │ │ ├── NoneValueNode.test.ts │ │ │ ├── NumberValueNode.test.ts │ │ │ ├── PublicKeyValueNode.test.ts │ │ │ ├── SetValueNode.test.ts │ │ │ ├── SomeValueNode.test.ts │ │ │ ├── StringValueNode.test.ts │ │ │ ├── StructFieldValueNode.test.ts │ │ │ ├── StructValueNode.test.ts │ │ │ └── TupleValueNode.test.ts │ │ ├── nonNullableIdentityVisitor.test.ts │ │ ├── recordLinkablesVisitor.test.ts │ │ ├── recordNodeStackVisitor.test.ts │ │ ├── removeDocsVisitor.test.ts │ │ ├── singleNodeVisitor.test.ts │ │ ├── staticVisitor.test.ts │ │ ├── tapVisitor.test.ts │ │ ├── topDownTransformerVisitor.test.ts │ │ ├── visitor.test.ts │ │ └── voidVisitor.test.ts │ ├── tsconfig.declarations.json │ ├── tsconfig.json │ ├── tsup.config.ts │ └── vitest.config.mts ├── pnpm-workspace.yaml ├── tsconfig.json ├── tsup.config.base.ts ├── turbo.json ├── vitest.config.base.mts └── vitest.config.mts
SYMBOL INDEX (1166 symbols across 414 files)
FILE: packages/cli/src/cli/index.ts
function run (line 5) | async function run(argv: readonly string[]) {
FILE: packages/cli/src/commands/convert.ts
function setConvertCommand (line 5) | function setConvertCommand(program: Command): void {
function doConvert (line 14) | async function doConvert(idlPath: string, outPath: string) {
FILE: packages/cli/src/commands/init.ts
function setInitCommand (line 19) | function setInitCommand(program: Command): void {
type InitOptions (line 30) | type InitOptions = {
function doInit (line 37) | async function doInit(explicitOutput: string | undefined, options: InitO...
function getOutputPath (line 64) | function getOutputPath(explicitOutput: string | undefined, options: Pick...
type PromptResult (line 71) | type PromptResult = {
function getPromptResult (line 78) | async function getPromptResult(
function getDefaultPromptResult (line 134) | function getDefaultPromptResult(): PromptResult {
type ConfigFileType (line 143) | type ConfigFileType = 'gill' | 'js' | 'json';
function getConfigFileType (line 144) | function getConfigFileType(output: string, options: Pick<InitOptions, 'g...
function getContentFromPromptResult (line 150) | function getContentFromPromptResult(result: PromptResult, configFileType...
function getConfigFromPromptResult (line 169) | function getConfigFromPromptResult(result: PromptResult): Config {
function getContentForGill (line 186) | function getContentForGill(result: PromptResult): string {
function isAnchorIdl (line 200) | async function isAnchorIdl(idlPath: string): Promise<boolean> {
FILE: packages/cli/src/commands/run.ts
function setRunCommand (line 18) | function setRunCommand(program: Command): void {
type RunOptions (line 26) | type RunOptions = {
function doRun (line 30) | async function doRun(explicitScripts: string[], { all }: RunOptions, cmd...
type RunPlan (line 40) | type RunPlan = {
function getPlans (line 45) | async function getPlans(
function runPlans (line 68) | function runPlans(plans: RunPlan[], rootNode: RootNode): void {
function runPlan (line 77) | function runPlan(plan: RunPlan, rootNode: RootNode): RootNode {
function checkMissingScripts (line 89) | function checkMissingScripts(parsedConfig: Pick<ParsedConfig, 'configPat...
function checkMissingDependencies (line 104) | async function checkMissingDependencies(
FILE: packages/cli/src/config.ts
type Config (line 8) | type Config = Readonly<{
type ScriptName (line 14) | type ScriptName = string;
type ScriptConfig (line 15) | type ScriptConfig = VisitorConfig | readonly VisitorConfig[];
type ScriptsConfig (line 16) | type ScriptsConfig = Readonly<Record<ScriptName, ScriptConfig>>;
type VisitorPath (line 18) | type VisitorPath = string;
type VisitorConfig (line 19) | type VisitorConfig<T extends readonly unknown[] = readonly unknown[]> = ...
type VisitorConfigObject (line 20) | type VisitorConfigObject<T extends readonly unknown[] = readonly unknown...
function getConfig (line 25) | async function getConfig(options: Pick<ProgramOptions, 'config'>): Promi...
function getDefaultConfigPath (line 41) | async function getDefaultConfigPath(): Promise<string | null> {
FILE: packages/cli/src/parsedConfig.ts
type ParsedConfig (line 15) | type ParsedConfig = Readonly<{
type ParsedScriptsConfig (line 24) | type ParsedScriptsConfig = Readonly<Record<ScriptName, readonly ParsedVi...
type ParsedVisitorConfig (line 25) | type ParsedVisitorConfig<T extends readonly unknown[] = readonly unknown...
function getParsedConfigFromCommand (line 33) | async function getParsedConfigFromCommand(cmd: Command): Promise<ParsedC...
function getParsedConfig (line 37) | async function getParsedConfig(options: Pick<ProgramOptions, 'config' | ...
function parseConfig (line 42) | async function parseConfig(
function parseIdlPath (line 56) | function parseIdlPath(
function parseScripts (line 70) | function parseScripts(scripts: ScriptsConfig, configPath: string | null)...
function parseVisitorConfig (line 78) | function parseVisitorConfig<T extends readonly unknown[]>(
function resolveVisitorPath (line 91) | function resolveVisitorPath(visitorPath: string, configPath: string | nu...
FILE: packages/cli/src/program.ts
function codama (line 8) | async function codama(args: string[], opts?: { suppressOutput?: boolean ...
function runProgram (line 16) | async function runProgram(program: Command, argv: readonly string[], par...
function createProgram (line 29) | function createProgram(internalOptions?: { exitOverride?: boolean; suppr...
FILE: packages/cli/src/programOptions.ts
type ProgramOptions (line 3) | type ProgramOptions = Readonly<{
function setProgramOptions (line 9) | function setProgramOptions(program: Command): void {
FILE: packages/cli/src/utils/childCommands.ts
type ChildCommand (line 3) | type ChildCommand = {
function createChildCommand (line 8) | function createChildCommand(command: string, args: string[] = []): Child...
function formatChildCommand (line 12) | function formatChildCommand(childCommand: ChildCommand): string {
type ChildProcessResult (line 17) | type ChildProcessResult = ChildProcess & {
type ChildProcessError (line 22) | type ChildProcessError = Error & {
function spawnChildCommand (line 26) | async function spawnChildCommand(
function createChildProcessResultError (line 59) | function createChildProcessResultError(
FILE: packages/cli/src/utils/errors.ts
class CliError (line 1) | class CliError extends Error {
method constructor (line 2) | constructor(
FILE: packages/cli/src/utils/fs.ts
function resolveRelativePath (line 5) | function resolveRelativePath(childPath: string, relativeDirectory: strin...
function resolveConfigPath (line 9) | function resolveConfigPath(childPath: string, configPath: string | null) {
function isLocalModulePath (line 14) | function isLocalModulePath(modulePath: string) {
function readJson (line 18) | async function readJson<T>(filePath: string): Promise<T> {
function readFile (line 22) | async function readFile(filePath: string): Promise<string> {
function writeFile (line 26) | async function writeFile(filePath: string, content: string) {
function canRead (line 34) | async function canRead(p: PathLike) {
function canWrite (line 43) | async function canWrite(p: PathLike) {
FILE: packages/cli/src/utils/import.ts
type ImportModuleItemOptions (line 8) | type ImportModuleItemOptions = {
function importModuleItem (line 14) | async function importModuleItem<T = unknown>(options: ImportModuleItemOp...
type ModuleDefinition (line 24) | type ModuleDefinition = Partial<Record<string, unknown>> & {
function pickModuleItem (line 29) | function pickModuleItem(module: ModuleDefinition, item: string = 'defaul...
function importModule (line 36) | async function importModule<T extends object>(options: ImportModuleItemO...
function importLocalModule (line 48) | async function importLocalModule<T extends object>(options: ImportModule...
function importExternalModule (line 61) | async function importExternalModule<T extends object>(options: ImportMod...
function importExternalUserModule (line 65) | async function importExternalUserModule<T extends object>(options: Impor...
function handleImportPromise (line 72) | async function handleImportPromise<T extends object>(
function getErrorItems (line 84) | function getErrorItems(options: ImportModuleItemOptions, cause?: unknown...
FILE: packages/cli/src/utils/logs.ts
type LogLevel (line 3) | type LogLevel = 'debug' | 'error' | 'info' | 'success' | 'warning';
type LogOptions (line 5) | type LogOptions = {
function getLogLevelInfo (line 11) | function getLogLevelInfo(logLevel: LogLevel) {
function log (line 35) | function log({ level, message, items }: LogOptions): void {
function logItems (line 43) | function logItems(items: string[], color?: (text: string) => string): vo...
function logBanner (line 51) | function logBanner(): void {
function codamaColor (line 55) | function codamaColor(text: string): string {
FILE: packages/cli/src/utils/nodes.ts
function getRootNodeFromIdl (line 7) | async function getRootNodeFromIdl(idl: unknown): Promise<RootNode> {
function isRootNode (line 30) | function isRootNode(value: unknown): value is RootNode {
FILE: packages/cli/src/utils/packageInstall.ts
function getPackageManagerInstallCommand (line 10) | async function getPackageManagerInstallCommand(
function installMissingDependencies (line 19) | async function installMissingDependencies(message: string, requiredDepen...
function installDependencies (line 29) | async function installDependencies(message: string, dependencies: string...
FILE: packages/cli/src/utils/packageJson.ts
type PackageJson (line 6) | type PackageJson = {
function getPackageJson (line 16) | async function getPackageJson(): Promise<PackageJson> {
function getPackageJsonDependencies (line 27) | async function getPackageJsonDependencies(options: { includeDev?: boolea...
FILE: packages/cli/src/utils/packageManager.ts
type PackageManager (line 5) | type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
constant FALLBACK_PACKAGE_MANAGER (line 7) | const FALLBACK_PACKAGE_MANAGER: PackageManager = 'npm';
function getPackageManager (line 10) | async function getPackageManager(): Promise<PackageManager> {
function detectPackageManager (line 17) | async function detectPackageManager(): Promise<PackageManager> {
function detectPackageManagerFromPackageJson (line 30) | async function detectPackageManagerFromPackageJson(): Promise<PackageMan...
function detectPackageManagerFromLockfile (line 40) | async function detectPackageManagerFromLockfile(): Promise<PackageManage...
function detectPackageManagerFromInstalledCli (line 55) | async function detectPackageManagerFromInstalledCli(): Promise<PackageMa...
function hasPackageManagerCli (line 68) | async function hasPackageManagerCli(packageManager: PackageManager): Pro...
FILE: packages/cli/src/utils/promises.ts
function promisify (line 1) | function promisify<T>(value: Promise<T> | T): Promise<T> {
FILE: packages/cli/src/utils/prompts.ts
constant PROMPT_OPTIONS (line 5) | const PROMPT_OPTIONS: prompts.Options = {
FILE: packages/cli/src/utils/visitors.ts
function getRootNodeVisitors (line 11) | async function getRootNodeVisitors(
function getRootNodeVisitor (line 17) | async function getRootNodeVisitor(visitorConfig: ParsedVisitorConfig): P...
type UnknownFunction (line 28) | type UnknownFunction = (...args: readonly unknown[]) => unknown;
function getVisitorFromModuleItem (line 29) | async function getVisitorFromModuleItem(
function isRootNodeVisitor (line 51) | function isRootNodeVisitor(value: unknown): value is Visitor<unknown, 'r...
function getVisitorIdentifier (line 55) | function getVisitorIdentifier(visitorConfig: ParsedVisitorConfig): string {
FILE: packages/cli/tsup.config.ts
function removeAdditionalTreeShaking (line 11) | function removeAdditionalTreeShaking(config: TsupConfig): TsupConfig {
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types-from-file.ts
function generateClientTypesFromFile (line 8) | function generateClientTypesFromFile(codamaIdlPath: string, outputDirPat...
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types.ts
function generateClientTypes (line 16) | function generateClientTypes(idl: RootNode): string {
function codamaTypeToTS (line 189) | function codamaTypeToTS(type: TypeNode | undefined, definedTypes: Define...
function collectPdaNodesFromIdl (line 280) | function collectPdaNodesFromIdl(idl: RootNode): Map<string, PdaNode> {
function collectResolverNames (line 304) | function collectResolverNames(ix: InstructionNode): Set<string> {
function toPascalCase (line 328) | function toPascalCase(str: string): string {
FILE: packages/dynamic-client/src/cli/commands/generate-client-types/register-command.ts
function registerGenerateClientTypesCommand (line 5) | function registerGenerateClientTypesCommand(program: Command): void {
FILE: packages/dynamic-client/src/cli/commands/index.ts
function registerCommands (line 5) | function registerCommands(program: Command): void {
FILE: packages/dynamic-client/src/cli/index.ts
function run (line 5) | function run(argv: string[]): void {
FILE: packages/dynamic-client/src/cli/program.ts
function createProgram (line 5) | function createProgram(): Command {
FILE: packages/dynamic-client/src/instruction-encoding/accounts/create-account-meta.ts
type ResolvedAccount (line 19) | type ResolvedAccount = {
type ResolvedAccountWithAddress (line 25) | type ResolvedAccountWithAddress = ResolvedAccount & { address: Address };
function createAccountMeta (line 32) | async function createAccountMeta(
function getRemainingAccountRole (line 148) | function getRemainingAccountRole(isSigner?: boolean | 'either', isWritab...
function getAccountRole (line 157) | function getAccountRole(acc: InstructionAccountNode, signers: string[] |...
function getReadonlyAccountRole (line 171) | function getReadonlyAccountRole(acc: InstructionAccountNode, signers: st...
function isSignerAccount (line 176) | function isSignerAccount(acc: InstructionAccountNode, signers: string[]) {
FILE: packages/dynamic-client/src/instruction-encoding/accounts/validate-accounts-input.ts
function createAccountsInputValidator (line 19) | function createAccountsInputValidator(ixNode: InstructionNode) {
FILE: packages/dynamic-client/src/instruction-encoding/arguments/encode-instruction-arguments.ts
function encodeInstructionArguments (line 29) | function encodeInstructionArguments(
function encodeOmittedArgument (line 49) | function encodeOmittedArgument(
function encodeOptionalArgument (line 72) | function encodeOptionalArgument(
function encodeRequiredArgument (line 88) | function encodeRequiredArgument(
FILE: packages/dynamic-client/src/instruction-encoding/arguments/resolve-argument-from-custom-resolvers.ts
function resolveArgumentDefaultsFromCustomResolvers (line 13) | async function resolveArgumentDefaultsFromCustomResolvers(
FILE: packages/dynamic-client/src/instruction-encoding/arguments/shared.ts
function isOmittedArgument (line 5) | function isOmittedArgument(node: InstructionArgumentNode) {
function isOptionalArgument (line 9) | function isOptionalArgument(ixArgumentNode: InstructionArgumentNode, inp...
FILE: packages/dynamic-client/src/instruction-encoding/arguments/validate-arguments-input.ts
function createArgumentsInputValidator (line 18) | function createArgumentsInputValidator(root: RootNode, ixNode: Instructi...
function formatFailurePath (line 57) | function formatFailurePath(failure: Failure): string {
constant MAX_VALUE_LENGTH (line 73) | const MAX_VALUE_LENGTH = 120;
function formatFailureValue (line 74) | function formatFailureValue(value: unknown): string {
function validateOmittedArguments (line 82) | function validateOmittedArguments(ixNode: InstructionNode, argumentsInpu...
function getRemainingAccountArgNames (line 92) | function getRemainingAccountArgNames(ixNode: InstructionNode): string[] {
function filterRemainingAccountArguments (line 102) | function filterRemainingAccountArguments(ixNode: InstructionNode, argume...
FILE: packages/dynamic-client/src/instruction-encoding/instructions.ts
function createIxBuilder (line 15) | function createIxBuilder(root: RootNode, ixNode: InstructionNode): Build...
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-address.ts
type ResolveAccountAddressContext (line 20) | type ResolveAccountAddressContext = BaseResolutionContext & {
function resolveAccountAddress (line 28) | async function resolveAccountAddress({
function resolveOptionalAccountWithStrategy (line 83) | function resolveOptionalAccountWithStrategy(
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-value-node-address.ts
function resolveAccountValueNodeAddress (line 21) | async function resolveAccountValueNodeAddress(
function detectCircularDependency (line 57) | function detectCircularDependency(nodeName: string, resolutionPath: Reso...
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-conditional.ts
type ResolveConditionalContext (line 14) | type ResolveConditionalContext = BaseResolutionContext & {
function resolveConditionalValueNodeCondition (line 23) | async function resolveConditionalValueNodeCondition({
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/resolve-pda-address.ts
type ResolvePDAAddressContext (line 19) | type ResolvePDAAddressContext = BaseResolutionContext & {
function resolvePDAAddress (line 27) | async function resolvePDAAddress({
function resolvePdaNode (line 99) | function resolvePdaNode(pdaDefaultValue: PdaValueNode, pdas: PdaNode[]):...
type ResolvePdaSeedContext (line 124) | type ResolvePdaSeedContext = BaseResolutionContext & {
function resolveVariablePdaSeed (line 129) | function resolveVariablePdaSeed({
type ResolveConstantPdaSeedContext (line 175) | type ResolveConstantPdaSeedContext = BaseResolutionContext & {
function resolveConstantPdaSeed (line 179) | function resolveConstantPdaSeed({
FILE: packages/dynamic-client/src/instruction-encoding/resolvers/types.ts
type ResolutionPath (line 6) | type ResolutionPath = readonly string[];
type BaseResolutionContext (line 12) | type BaseResolutionContext = {
FILE: packages/dynamic-client/src/instruction-encoding/validators.ts
type StructUnknown (line 30) | type StructUnknown = Struct<unknown, unknown>;
function createIxAccountsValidator (line 38) | function createIxAccountsValidator(ixAccountNodes: InstructionAccountNod...
function createIxArgumentsValidator (line 49) | function createIxArgumentsValidator(
function createValidatorForTypeNode (line 68) | function createValidatorForTypeNode(nodeName: string, node: TypeNode, de...
function RemainderOptionTypeItemValidator (line 208) | function RemainderOptionTypeItemValidator(
function StringValidatorForFixedSize (line 228) | function StringValidatorForFixedSize(maxSize: number): StructUnknown {
function EnumVariantValidator (line 246) | function EnumVariantValidator(
function formatErrorForEnumTypeNode (line 316) | function formatErrorForEnumTypeNode(enumVariantKind: string, error: Stru...
function BytesWithSizeValidator (line 369) | function BytesWithSizeValidator(exactSize: number): StructUnknown {
function OptionValueValidator (line 390) | function OptionValueValidator(name: string, SomeValueValidator: StructUn...
function ZeroableOptionValidator (line 400) | function ZeroableOptionValidator(name: string, innerValidator: StructUnk...
function KeyValueValidator (line 430) | function KeyValueValidator(name: string, KeyValidator: StructUnknown, Va...
function MapCountValidator (line 450) | function MapCountValidator(node: CountNode): StructUnknown | null {
function KeysLengthValidator (line 464) | function KeysLengthValidator(count: number): StructUnknown {
function ArrayValidator (line 475) | function ArrayValidator(
function AmountTypeValidator (line 504) | function AmountTypeValidator(nodeName: string): StructUnknown {
FILE: packages/dynamic-client/src/instruction-encoding/visitors/account-default-value.ts
type AccountDefaultValueVisitorContext (line 39) | type AccountDefaultValueVisitorContext = BaseResolutionContext & {
constant ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS (line 44) | const ACCOUNT_DEFAULT_VALUE_SUPPORTED_NODE_KINDS = [
type AccountDefaultValueSupportedNodeKind (line 57) | type AccountDefaultValueSupportedNodeKind = (typeof ACCOUNT_DEFAULT_VALU...
function createAccountDefaultValueVisitor (line 62) | function createAccountDefaultValueVisitor(
FILE: packages/dynamic-client/src/instruction-encoding/visitors/condition-node-value.ts
constant CONDITION_NODE_SUPPORTED_NODE_KINDS (line 8) | const CONDITION_NODE_SUPPORTED_NODE_KINDS = [
type ConditionNodeSupportedNodeKind (line 14) | type ConditionNodeSupportedNodeKind = (typeof CONDITION_NODE_SUPPORTED_N...
function createConditionNodeValueVisitor (line 20) | function createConditionNodeValueVisitor(
FILE: packages/dynamic-client/src/instruction-encoding/visitors/default-value-encoder.ts
constant DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS (line 12) | const DEFAULT_VALUE_ENCODER_SUPPORTED_NODE_KINDS = [
type DefaultValueEncoderSupportedNodeKind (line 22) | type DefaultValueEncoderSupportedNodeKind = (typeof DEFAULT_VALUE_ENCODE...
function createDefaultValueEncoderVisitor (line 31) | function createDefaultValueEncoderVisitor(codec: {
FILE: packages/dynamic-client/src/instruction-encoding/visitors/input-value-transformer.ts
constant INPUT_VALUE_TRANSFORMER_SUPPORTED_NODE_KINDS (line 17) | const INPUT_VALUE_TRANSFORMER_SUPPORTED_NODE_KINDS = [
type TransformableTypeNodeKind (line 46) | type TransformableTypeNodeKind = (typeof INPUT_VALUE_TRANSFORMER_SUPPORT...
type InputValueTransformerOptions (line 48) | type InputValueTransformerOptions = {
type InputTransformer (line 55) | type InputTransformer = (input: unknown) => unknown;
function unexpectedNodeFallback (line 57) | function unexpectedNodeFallback(node: Node): never {
function createInputValueTransformerVisitor (line 65) | function createInputValueTransformerVisitor(
function createInputValueTransformer (line 367) | function createInputValueTransformer(
FILE: packages/dynamic-client/src/instruction-encoding/visitors/pda-seed-value.ts
constant PDA_SEED_VALUE_SUPPORTED_NODE_KINDS (line 36) | const PDA_SEED_VALUE_SUPPORTED_NODE_KINDS = [
type PdaSeedValueSupportedNodeKind (line 50) | type PdaSeedValueSupportedNodeKind = (typeof PDA_SEED_VALUE_SUPPORTED_NO...
type PdaSeedValueVisitorContext (line 52) | type PdaSeedValueVisitorContext = BaseResolutionContext & {
function createPdaSeedValueVisitor (line 64) | function createPdaSeedValueVisitor(
FILE: packages/dynamic-client/src/instruction-encoding/visitors/value-node-value.ts
type ResolvedValue (line 22) | type ResolvedValue = {
constant VALUE_NODE_SUPPORTED_NODE_KINDS (line 28) | const VALUE_NODE_SUPPORTED_NODE_KINDS = [
type ValueNodeSupportedNodeKind (line 45) | type ValueNodeSupportedNodeKind = (typeof VALUE_NODE_SUPPORTED_NODE_KIND...
function createValueNodeVisitor (line 50) | function createValueNodeVisitor(): Visitor<ResolvedValue, ValueNodeSuppo...
FILE: packages/dynamic-client/src/program-client/collect-pdas.ts
function collectPdaNodes (line 10) | function collectPdaNodes(root: RootNode): Map<string, PdaNode> {
FILE: packages/dynamic-client/src/program-client/create-program-client.ts
type IdlInput (line 18) | type IdlInput = object | string;
type CreateProgramClientOptions (line 20) | type CreateProgramClientOptions = {
type ProgramClient (line 28) | type ProgramClient = {
type ProgramMethodBuilder (line 41) | type ProgramMethodBuilder = {
function createProgramClient (line 53) | function createProgramClient<TClient = ProgramClient>(
constant PASSTHROUGH_PROPS (line 139) | const PASSTHROUGH_PROPS = new Set<string>(['then', 'toJSON', 'valueOf', ...
FILE: packages/dynamic-client/src/program-client/derive-standalone-pda.ts
constant STANDALONE_IX_NODE (line 28) | const STANDALONE_IX_NODE: InstructionNode = {
function deriveStandalonePDA (line 39) | async function deriveStandalonePDA(
function resolveStandaloneConstantSeed (line 62) | function resolveStandaloneConstantSeed(
function resolveStandaloneVariableSeed (line 92) | function resolveStandaloneVariableSeed(
function createSyntheticArgNode (line 132) | function createSyntheticArgNode(seedNode: VariablePdaSeedNode) {
FILE: packages/dynamic-client/src/program-client/methods-builder.ts
class MethodsBuilder (line 7) | class MethodsBuilder {
method constructor (line 14) | constructor(
method accounts (line 20) | accounts(accounts: AccountsInput) {
method signers (line 27) | signers(signers: EitherSigners) {
method resolvers (line 32) | resolvers(resolvers: ResolversInput) {
method instruction (line 37) | async instruction(): Promise<Instruction> {
FILE: packages/dynamic-client/src/shared/address.ts
type PublicKeyLike (line 11) | type PublicKeyLike = { toBase58(): string };
type AddressInput (line 13) | type AddressInput = Address | PublicKeyLike | string;
function isPublicKeyLike (line 15) | function isPublicKeyLike(value: unknown): value is PublicKeyLike {
function toAddress (line 20) | function toAddress(input: AddressInput): Address {
function isConvertibleAddress (line 29) | function isConvertibleAddress(value: unknown): value is AddressInput {
FILE: packages/dynamic-client/src/shared/bytes-encoding.ts
function uint8ArrayToEncodedString (line 11) | function uint8ArrayToEncodedString(bytes: Uint8Array, encoding: BytesEnc...
function getCodecFromBytesEncoding (line 19) | function getCodecFromBytesEncoding(encoding: BytesEncoding) {
function isUint8Array (line 38) | function isUint8Array(value: unknown): value is Uint8Array {
FILE: packages/dynamic-client/src/shared/codecs.ts
function getMemoizedAddressEncoder (line 15) | function getMemoizedAddressEncoder() {
function getMemoizedUtf8Encoder (line 21) | function getMemoizedUtf8Encoder() {
function getMemoizedBooleanEncoder (line 27) | function getMemoizedBooleanEncoder() {
function getMemoizedUtf8Codec (line 33) | function getMemoizedUtf8Codec() {
function getMemoizedBase16Codec (line 39) | function getMemoizedBase16Codec() {
function getMemoizedBase58Codec (line 45) | function getMemoizedBase58Codec() {
function getMemoizedBase64Codec (line 51) | function getMemoizedBase64Codec() {
FILE: packages/dynamic-client/src/shared/nodes.ts
constant OPTIONAL_NODE_KINDS (line 1) | const OPTIONAL_NODE_KINDS = ['optionTypeNode', 'zeroableOptionTypeNode',...
FILE: packages/dynamic-client/src/shared/types.ts
type AccountsInput (line 6) | type AccountsInput = Partial<Record<string, AddressInput | null>>;
type ArgumentsInput (line 7) | type ArgumentsInput = Partial<Record<string, unknown>>;
type AccountName (line 8) | type AccountName = string;
type EitherSigners (line 9) | type EitherSigners = AccountName[];
type ResolverFn (line 11) | type ResolverFn = (argumentsInput: ArgumentsInput, accountsInput: Accoun...
type ResolversInput (line 12) | type ResolversInput = Record<string, ResolverFn>;
type TBuildIxFn (line 14) | type TBuildIxFn<TInstruction> = (
type BuildIxFn (line 20) | type BuildIxFn = TBuildIxFn<Instruction>;
FILE: packages/dynamic-client/src/shared/util.ts
function isObjectRecord (line 6) | function isObjectRecord(value: unknown): value is Record<string, unknown> {
function getMaybeNodeKind (line 11) | function getMaybeNodeKind(node: unknown): NodeKind | null {
function formatValueType (line 16) | function formatValueType(value: unknown): string {
function safeStringify (line 28) | function safeStringify(value: unknown): string {
FILE: packages/dynamic-client/test/programs/anchor/programs/blog/src/lib.rs
function create_profile (line 10) | pub fn create_profile(ctx: Context<CreateProfile>, username: String) -> ...
function create_post (line 19) | pub fn create_post(
function update_post (line 37) | pub fn update_post(
function create_category (line 49) | pub fn create_category(ctx: Context<CreateCategory>, name: String) -> Re...
function subscribe (line 57) | pub fn subscribe(ctx: Context<Subscribe>) -> Result<()> {
function react (line 65) | pub fn react(ctx: Context<React>, kind: u8) -> Result<()> {
function create_daily_digest (line 74) | pub fn create_daily_digest(
function create_access_grant (line 90) | pub fn create_access_grant(
function create_bookmark_list (line 101) | pub fn create_bookmark_list(
type CreateProfile (line 115) | pub struct CreateProfile<'info> {
type CreatePost (line 131) | pub struct CreatePost<'info> {
type UpdatePost (line 154) | pub struct UpdatePost<'info> {
type CreateCategory (line 175) | pub struct CreateCategory<'info> {
type Subscribe (line 190) | pub struct Subscribe<'info> {
type React (line 208) | pub struct React<'info> {
type CreateDailyDigest (line 226) | pub struct CreateDailyDigest<'info> {
type Profile (line 248) | pub struct Profile {
type Post (line 258) | pub struct Post {
type Category (line 270) | pub struct Category {
type Subscription (line 279) | pub struct Subscription {
type Reaction (line 287) | pub struct Reaction {
type CreateAccessGrant (line 296) | pub struct CreateAccessGrant<'info> {
type CreateBookmarkList (line 318) | pub struct CreateBookmarkList<'info> {
type DailyDigest (line 334) | pub struct DailyDigest {
type AccessGrant (line 345) | pub struct AccessGrant {
type BookmarkList (line 353) | pub struct BookmarkList {
FILE: packages/dynamic-client/test/programs/anchor/programs/example/src/lib.rs
function pubkey_seed_ix (line 14) | pub fn pubkey_seed_ix(ctx: Context<PubkeySeedIx>, input: u64) -> Result<...
function update_optional_input (line 20) | pub fn update_optional_input(
function update_optional_account (line 30) | pub fn update_optional_account(ctx: Context<UpdateOptionalAccount>, _id:...
function no_arguments (line 36) | pub fn no_arguments(_ctx: Context<NoArguments>) -> Result<()> {
function external_programs_with_pda (line 40) | pub fn external_programs_with_pda(_ctx: Context<ExternalProgramsWithPdaI...
function four_level_pda (line 44) | pub fn four_level_pda(_ctx: Context<FourLevelPda>) -> Result<()> {
function self_reference_pda (line 48) | pub fn self_reference_pda(_ctx: Context<SelfReferencePda>) -> Result<()> {
function two_node_cycle_pda (line 52) | pub fn two_node_cycle_pda(_ctx: Context<TwoNodeCyclePda>) -> Result<()> {
function nested_example (line 56) | pub fn nested_example(ctx: Context<NestedStructsAndEnums>, input: Struct...
function string_seed_pda (line 60) | pub fn string_seed_pda(ctx: Context<StringSeedPda>, _name: String, id: u...
type PubkeySeedIx (line 68) | pub struct PubkeySeedIx<'info> {
type DataAccount1 (line 84) | pub struct DataAccount1 {
type UpdateOptionalInput (line 91) | pub struct UpdateOptionalInput<'info> {
type UpdateOptionalAccount (line 103) | pub struct UpdateOptionalAccount<'info> {
type NoArguments (line 119) | pub struct NoArguments<'info> {
type StoreOptionalAccount (line 133) | pub struct StoreOptionalAccount {
type ExternalProgramsWithPdaIx (line 138) | pub struct ExternalProgramsWithPdaIx<'info> {
type FourLevelPda (line 176) | pub struct FourLevelPda<'info> {
type SelfReferencePda (line 220) | pub struct SelfReferencePda<'info> {
type TwoNodeCyclePda (line 237) | pub struct TwoNodeCyclePda<'info> {
type StringSeedPda (line 270) | pub struct StringSeedPda<'info> {
FILE: packages/dynamic-client/test/programs/anchor/programs/example/src/nested_example.rs
type StructAndEnumsInput (line 7) | pub struct StructAndEnumsInput {
type NestedExampleAccount (line 17) | pub struct NestedExampleAccount {
constant INIT_SPACE (line 23) | const INIT_SPACE: usize =
type InnerHeader (line 33) | pub struct InnerHeader {
constant INIT_SPACE (line 38) | const INIT_SPACE: usize = 4 + Command::INIT_SPACE;
type Command (line 42) | pub enum Command {
constant INIT_SPACE (line 48) | const INIT_SPACE: usize = 1 + 8 + 4 + 64;
type InnerStruct (line 53) | pub struct InnerStruct {
constant INIT_SPACE (line 62) | const INIT_SPACE: usize =
type InnerEnum (line 73) | pub enum InnerEnum {
constant INIT_SPACE (line 79) | const INIT_SPACE: usize = 1 + 8 + TokenType::INIT_SPACE;
type TokenType (line 82) | pub enum TokenType {
constant INIT_SPACE (line 87) | const INIT_SPACE: usize = 1 + 4 + 64;
type SeedEnum (line 92) | pub enum SeedEnum {
method as_seed (line 98) | pub fn as_seed(&self) -> [u8; 1] {
constant INIT_SPACE (line 103) | const INIT_SPACE: usize = 1;
type NestedStructsAndEnums (line 108) | pub struct NestedStructsAndEnums<'info> {
function handler (line 129) | pub fn handler(
FILE: packages/dynamic-client/test/programs/anchor/tests/blog.test.ts
function decodeAccount (line 364) | function decodeAccount(name: string, pda: Address) {
function decodeBytes (line 374) | function decodeBytes(value: unknown): number[] {
FILE: packages/dynamic-client/test/programs/anchor/tests/example.test.ts
function decodeDataAccount1 (line 306) | function decodeDataAccount1(
FILE: packages/dynamic-client/test/programs/anchor/tests/helpers.ts
function createTestContext (line 11) | async function createTestContext() {
function bytesToBase16CodecFormat (line 23) | function bytesToBase16CodecFormat(bytes: Uint8Array) {
FILE: packages/dynamic-client/test/programs/anchor/tests/nested-example-ix.test.ts
function decodeNestedExampleAccount (line 607) | function decodeNestedExampleAccount(root: RootNode, data: Uint8Array) {
function deriveNestedExamplePda (line 620) | async function deriveNestedExamplePda(
function seedEnumToNumber (line 640) | function seedEnumToNumber(enumValue: string) {
FILE: packages/dynamic-client/test/programs/associated-token-account/ata-test-utils.ts
constant SPL_TOKEN_MINT_SIZE (line 14) | const SPL_TOKEN_MINT_SIZE = 82n;
function createMint (line 16) | async function createMint(
FILE: packages/dynamic-client/test/programs/collection-types/collection-types.test.ts
function decodeInstructionData (line 10) | function decodeInstructionData(instructionName: string, data: ReadonlyUi...
FILE: packages/dynamic-client/test/programs/custom-resolvers/argument-resolvers.test.ts
function expectedData (line 25) | function expectedData({
FILE: packages/dynamic-client/test/programs/mpl-token-metadata/create-with-resolvers.test.ts
function buildFungibleArgs (line 16) | function buildFungibleArgs(): CreateArgs {
FILE: packages/dynamic-client/test/programs/mpl-token-metadata/helpers.ts
function loadMplProgram (line 13) | function loadMplProgram(ctx: SvmTestContext, programAddress: Address): v...
FILE: packages/dynamic-client/test/programs/pmp/helpers.ts
constant PMP_PROGRAM_ID (line 18) | const PMP_PROGRAM_ID = programClient.programAddress;
function encodeSeedForPda (line 30) | function encodeSeedForPda(seed: string): Uint8Array {
function decodeBufferAccount (line 37) | function decodeBufferAccount(data: Uint8Array): PmpBuffer {
function decodeMetadataAccount (line 42) | function decodeMetadataAccount(data: Uint8Array): PmpMetadata {
function loadPmpProgram (line 50) | function loadPmpProgram(ctx: SvmTestContext, programAddress: Address): v...
function initializeCanonicalMetadata (line 56) | async function initializeCanonicalMetadata(ctx: SvmTestContext, options?...
function initializeNonCanonicalMetadata (line 82) | async function initializeNonCanonicalMetadata(
function setupCanonicalPda (line 115) | async function setupCanonicalPda(ctx: SvmTestContext, seed = 'idl') {
function setupNonCanonicalPda (line 137) | async function setupNonCanonicalPda(ctx: SvmTestContext, seed = 'idl') {
function setUpgradeableProgramAccounts (line 176) | async function setUpgradeableProgramAccounts(
function encodeProgramDataAccount (line 212) | function encodeProgramDataAccount(authority: Address | null) {
function encodeProgramAccount (line 227) | function encodeProgramAccount(programDataAddress: Address) {
function allocateBufferAccount (line 240) | async function allocateBufferAccount(ctx: SvmTestContext) {
function deriveCanonicalPda (line 258) | async function deriveCanonicalPda(programAddress: Address, seed: string) {
function deriveNonCanonicalPda (line 270) | async function deriveNonCanonicalPda(programAddress: Address, authority:...
FILE: packages/dynamic-client/test/programs/sas/close-tokenized-attestation.test.ts
constant NFT_NAME (line 21) | const NFT_NAME = 'Test NFT';
constant NFT_SYMBOL (line 22) | const NFT_SYMBOL = 'TEST';
constant NFT_URI (line 23) | const NFT_URI = 'https://example.com/metadata.json';
function createTokenizedAttestationSetup (line 25) | async function createTokenizedAttestationSetup(ctx: SvmTestContext) {
FILE: packages/dynamic-client/test/programs/sas/create-tokenized-attestation.test.ts
constant NFT_NAME (line 21) | const NFT_NAME = 'Test NFT';
constant NFT_SYMBOL (line 22) | const NFT_SYMBOL = 'TEST';
constant NFT_URI (line 23) | const NFT_URI = 'https://example.com/metadata.json';
FILE: packages/dynamic-client/test/programs/sas/sas-test-utils.ts
function loadSasProgram (line 20) | function loadSasProgram(ctx: SvmTestContext) {
function getSchemaMintSize (line 28) | function getSchemaMintSize(sasPda: Address, schemaMint: Address) {
function getAttestationMintSize (line 35) | function getAttestationMintSize({
function createCredential (line 76) | async function createCredential(ctx: SvmTestContext, opts?: { name?: str...
constant SCHEMA_DATA_STRING_TYPE (line 94) | const SCHEMA_DATA_STRING_TYPE = 12;
constant SCHEMA_DATA_U8_TYPE (line 95) | const SCHEMA_DATA_U8_TYPE = 0;
function createSchema (line 103) | async function createSchema(
function createAttestation (line 128) | async function createAttestation(
function tokenizeSchema (line 157) | async function tokenizeSchema(
FILE: packages/dynamic-client/test/programs/test-utils.ts
function loadIdl (line 9) | function loadIdl(idlFileName: string, baseDir?: string): IdlInput {
function createTestProgramClient (line 27) | function createTestProgramClient<T = ProgramClient>(idlFileName: string)...
function loadRoot (line 32) | function loadRoot(idlFileName: string): RootNode {
FILE: packages/dynamic-client/test/programs/token-2022/harvest-withheld-tokens-to-mint.test.ts
constant TRANSFER_FEE_AMOUNT_EXT (line 13) | const TRANSFER_FEE_AMOUNT_EXT = [{ __kind: 'TransferFeeAmount' as const,...
FILE: packages/dynamic-client/test/programs/token-2022/sync-native.test.ts
constant TOKEN_2022_NATIVE_MINT (line 8) | const TOKEN_2022_NATIVE_MINT = address('9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8...
FILE: packages/dynamic-client/test/programs/token-2022/token-2022-test-utils.ts
constant TOKEN_2022_MINT_SIZE (line 11) | const TOKEN_2022_MINT_SIZE = getMintSize();
constant TOKEN_2022_ACCOUNT_SIZE (line 12) | const TOKEN_2022_ACCOUNT_SIZE = getTokenSize();
constant TOKEN_2022_MULTISIG_SIZE (line 13) | const TOKEN_2022_MULTISIG_SIZE = 355;
function createMint (line 16) | async function createMint(
function createTokenAccount (line 39) | async function createTokenAccount(
function createTransferFeeMint (line 62) | async function createTransferFeeMint(
function createTokenAccountWithExtensions (line 111) | async function createTokenAccountWithExtensions(
function mintTokens (line 136) | async function mintTokens(
FILE: packages/dynamic-client/test/programs/token-2022/token-group.test.ts
function createGroupMint (line 10) | async function createGroupMint(ctx: SvmTestContext, payer: Address, grou...
FILE: packages/dynamic-client/test/programs/token-2022/token-metadata.test.ts
function createMintWithMetadata (line 10) | async function createMintWithMetadata(
FILE: packages/dynamic-client/test/programs/token-2022/transfer-fee.test.ts
constant TRANSFER_FEE_AMOUNT_EXT (line 14) | const TRANSFER_FEE_AMOUNT_EXT = [{ __kind: 'TransferFeeAmount' as const,...
FILE: packages/dynamic-client/test/programs/token-2022/withdraw-withheld-tokens.test.ts
constant TRANSFER_FEE_AMOUNT_EXT (line 12) | const TRANSFER_FEE_AMOUNT_EXT = [{ __kind: 'TransferFeeAmount' as const,...
FILE: packages/dynamic-client/test/programs/token/sync-native.test.ts
constant NATIVE_MINT (line 8) | const NATIVE_MINT = address('So11111111111111111111111111111111111111112');
FILE: packages/dynamic-client/test/programs/token/token-test-utils.ts
constant SPL_TOKEN_MINT_SIZE (line 10) | const SPL_TOKEN_MINT_SIZE = 82;
constant SPL_TOKEN_ACCOUNT_SIZE (line 11) | const SPL_TOKEN_ACCOUNT_SIZE = 165;
constant SPL_TOKEN_MULTISIG_SIZE (line 12) | const SPL_TOKEN_MULTISIG_SIZE = 355;
function createMint (line 14) | async function createMint(
function createTokenAccount (line 35) | async function createTokenAccount(
FILE: packages/dynamic-client/test/svm-test-context.ts
type EncodedAccount (line 26) | type EncodedAccount = {
type SvmTestContextConfig (line 37) | type SvmTestContextConfig = {
class SvmTestContext (line 60) | class SvmTestContext {
method constructor (line 74) | constructor(config: SvmTestContextConfig = {}) {
method generateKeypair (line 94) | static generateKeypair(): Promise<KeyPairSigner> {
method generateAddress (line 99) | static async generateAddress(): Promise<Address> {
method createAccount (line 105) | async createAccount(): Promise<Address> {
method createFundedAccount (line 112) | async createFundedAccount(amount: bigint = BigInt(10e9)): Promise<Addr...
method createAccountWithSeed (line 119) | async createAccountWithSeed(base: Address, seed: string, programId: Ad...
method airdrop (line 124) | airdrop(account: Address, amount: bigint = BigInt(1e9)): void {
method airdropToAddress (line 129) | airdropToAddress(account: Address, amount: bigint = BigInt(1e9)): void {
method setAccount (line 138) | setAccount(
method getBalance (line 158) | getBalance(account: Address): bigint | null {
method getBalanceOrZero (line 164) | getBalanceOrZero(account: Address): bigint {
method fetchEncodedAccount (line 169) | fetchEncodedAccount(account: Address): EncodedAccount | null {
method requireEncodedAccount (line 185) | requireEncodedAccount(account: Address): EncodedAccount {
method sendInstruction (line 194) | async sendInstruction(instruction: Instruction, signers: Address[]): P...
method sendInstructions (line 199) | async sendInstructions(instructions: Instruction[], signers: Address[]...
method warpToSlot (line 204) | warpToSlot(slot: bigint): void {
method advanceSlots (line 210) | advanceSlots(count: bigint = BigInt(1)): void {
method loadProgram (line 217) | loadProgram(programAddress: Address, programPath: string): void {
method getMinimumBalanceForRentExemption (line 222) | getMinimumBalanceForRentExemption(dataLen: bigint): bigint {
method getSvm (line 227) | getSvm(): LiteSVM {
method buildAndSend (line 231) | private async buildAndSend(instructions: Instruction[], signers: Addre...
FILE: packages/dynamic-client/test/unit/cli/generate-program-client-types.test.ts
constant CLI_PATH (line 11) | const CLI_PATH = path.resolve('bin/cli.cjs');
function execCli (line 13) | function execCli(args: string[]) {
FILE: packages/dynamic-client/test/unit/cli/program-client-types.test.ts
type ExpectedKeys (line 45) | type ExpectedKeys =
type MethodsBuilder (line 63) | type MethodsBuilder = ReturnType<CreateAccountMethod>;
type ExpectedPdaKeys (line 104) | type ExpectedPdaKeys = 'canonical' | 'metadata' | 'nonCanonical';
type PdaFn (line 106) | type PdaFn = ProgramMetadataPdas[keyof ProgramMetadataPdas];
FILE: packages/dynamic-client/test/unit/instruction-encoding/arguments.test.ts
function getInstruction (line 12) | function getInstruction(root: RootNode, name: string): InstructionNode {
FILE: packages/dynamic-client/test/unit/instruction-encoding/create-account-meta.test.ts
constant ADDR_1 (line 9) | const ADDR_1 = address('11111111111111111111111111111111');
constant ADDR_2 (line 10) | const ADDR_2 = address('22222222222222222222222222222222222222222222');
constant ADDR_3 (line 11) | const ADDR_3 = address('33333333333333333333333333333333333333333333');
constant MULTISIG_ADDR (line 12) | const MULTISIG_ADDR = address('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5...
function getInstruction (line 173) | function getInstruction(root: RootNode, name: string): InstructionNode {
FILE: packages/dynamic-client/test/unit/resolvers/resolve-conditional.test.ts
function getInstruction (line 13) | function getInstruction(root: RootNode, name: string): InstructionNode {
FILE: packages/dynamic-client/test/unit/visitors/account-default-value/account-default-value-test-utils.ts
function makeVisitor (line 19) | function makeVisitor(overrides?: Partial<Parameters<typeof createAccount...
FILE: packages/dynamic-client/test/unit/visitors/condition-node-value/condition-node-value-test-utils.ts
function makeVisitor (line 8) | function makeVisitor(overrides?: Partial<Parameters<typeof createConditi...
FILE: packages/dynamic-client/test/unit/visitors/default-value-encoder/default-value-encoder-test-utils.ts
function makeVisitor (line 9) | function makeVisitor(argType: TypeNode) {
FILE: packages/dynamic-client/test/unit/visitors/pda-seed-value/pda-seed-value-test-utils.ts
constant PROGRAM_PUBLIC_KEY (line 6) | const PROGRAM_PUBLIC_KEY = '11111111111111111111111111111111';
function makeVisitor (line 12) | function makeVisitor(overrides?: Partial<Parameters<typeof createPdaSeed...
FILE: packages/dynamic-client/test/unit/visitors/value-node-value/value-node-value-test-utils.ts
function makeVisitor (line 3) | function makeVisitor() {
FILE: packages/dynamic-codecs/src/codecs.ts
type EncodableNodes (line 84) | type EncodableNodes =
type CodecVisitorOptions (line 96) | type CodecVisitorOptions = {
function getNodeCodec (line 100) | function getNodeCodec(path: NodePath<EncodableNodes>, options: CodecVisi...
function getNodeCodecVisitor (line 113) | function getNodeCodecVisitor(
function getCodecFromBytesEncoding (line 361) | function getCodecFromBytesEncoding(encoding: BytesEncoding) {
function getCodecFromNumberFormat (line 378) | function getCodecFromNumberFormat(format: NumberFormat) {
function getSizeFromCountNode (line 413) | function getSizeFromCountNode(
FILE: packages/dynamic-codecs/src/index.ts
type CodecAndValueVisitors (line 13) | type CodecAndValueVisitors = {
function getCodecAndValueVisitors (line 18) | function getCodecAndValueVisitors(linkables: LinkableDictionary, options...
FILE: packages/dynamic-codecs/src/values.ts
function getValueNodeVisitor (line 7) | function getValueNodeVisitor(
FILE: packages/dynamic-codecs/test/_setup.ts
function hex (line 3) | function hex(hexadecimal: string): ReadonlyUint8Array {
FILE: packages/dynamic-parsers/src/discriminators.ts
function matchDiscriminators (line 21) | function matchDiscriminators(
function matchDiscriminator (line 33) | function matchDiscriminator(
function matchConstantDiscriminator (line 49) | function matchConstantDiscriminator(
function matchFieldDiscriminator (line 60) | function matchFieldDiscriminator(
function matchSizeDiscriminator (line 88) | function matchSizeDiscriminator(bytes: ReadonlyUint8Array, discriminator...
FILE: packages/dynamic-parsers/src/identify.ts
function identifyAccountData (line 25) | function identifyAccountData(
function identifyEventData (line 32) | function identifyEventData(
function identifyInstructionData (line 39) | function identifyInstructionData(
function identifyData (line 46) | function identifyData<TKind extends 'accountNode' | 'eventNode' | 'instr...
function getByteIdentificationVisitor (line 66) | function getByteIdentificationVisitor<TKind extends 'accountNode' | 'eve...
FILE: packages/dynamic-parsers/src/parsers.ts
type ParsableNode (line 14) | type ParsableNode = AccountNode | EventNode | InstructionNode;
type ParsableNodeKind (line 15) | type ParsableNodeKind = ParsableNode['kind'];
type ParsedData (line 17) | type ParsedData<TNode extends ParsableNode> = {
function parseAccountData (line 22) | function parseAccountData(
function parseEventData (line 29) | function parseEventData(
function parseInstructionData (line 36) | function parseInstructionData(
function parseData (line 43) | function parseData<TKind extends ParsableNodeKind>(
type ParsedInstructionAccounts (line 55) | type ParsedInstructionAccounts = ReadonlyArray<AccountMeta & { name: Cam...
type ParsedInstruction (line 56) | type ParsedInstruction = ParsedData<InstructionNode> & { accounts: Parse...
function parseInstruction (line 58) | function parseInstruction(
FILE: packages/dynamic-parsers/test/_setup.ts
function hex (line 3) | function hex(hexadecimal: string): ReadonlyUint8Array {
FILE: packages/errors/src/cli/index.ts
function run (line 50) | function run(argv: readonly string[]) {
function codamaColor (line 54) | function codamaColor(text: string): string {
FILE: packages/errors/src/codes.ts
constant CODAMA_ERROR__UNRECOGNIZED_NODE_KIND (line 28) | const CODAMA_ERROR__UNRECOGNIZED_NODE_KIND = 1;
constant CODAMA_ERROR__UNEXPECTED_NODE_KIND (line 29) | const CODAMA_ERROR__UNEXPECTED_NODE_KIND = 2;
constant CODAMA_ERROR__UNEXPECTED_NESTED_NODE_KIND (line 30) | const CODAMA_ERROR__UNEXPECTED_NESTED_NODE_KIND = 3;
constant CODAMA_ERROR__LINKED_NODE_NOT_FOUND (line 31) | const CODAMA_ERROR__LINKED_NODE_NOT_FOUND = 4;
constant CODAMA_ERROR__NODE_FILESYSTEM_FUNCTION_UNAVAILABLE (line 32) | const CODAMA_ERROR__NODE_FILESYSTEM_FUNCTION_UNAVAILABLE = 5;
constant CODAMA_ERROR__VERSION_MISMATCH (line 33) | const CODAMA_ERROR__VERSION_MISMATCH = 6;
constant CODAMA_ERROR__UNRECOGNIZED_NUMBER_FORMAT (line 34) | const CODAMA_ERROR__UNRECOGNIZED_NUMBER_FORMAT = 7;
constant CODAMA_ERROR__UNRECOGNIZED_BYTES_ENCODING (line 35) | const CODAMA_ERROR__UNRECOGNIZED_BYTES_ENCODING = 8;
constant CODAMA_ERROR__ENUM_VARIANT_NOT_FOUND (line 36) | const CODAMA_ERROR__ENUM_VARIANT_NOT_FOUND = 9;
constant CODAMA_ERROR__DISCRIMINATOR_FIELD_NOT_FOUND (line 37) | const CODAMA_ERROR__DISCRIMINATOR_FIELD_NOT_FOUND = 10;
constant CODAMA_ERROR__DISCRIMINATOR_FIELD_HAS_NO_DEFAULT_VALUE (line 38) | const CODAMA_ERROR__DISCRIMINATOR_FIELD_HAS_NO_DEFAULT_VALUE = 11;
constant CODAMA_ERROR__VISITORS__CANNOT_ADD_DUPLICATED_PDA_NAMES (line 42) | const CODAMA_ERROR__VISITORS__CANNOT_ADD_DUPLICATED_PDA_NAMES = 1200000;
constant CODAMA_ERROR__VISITORS__INVALID_PDA_SEED_VALUES (line 43) | const CODAMA_ERROR__VISITORS__INVALID_PDA_SEED_VALUES = 1200001;
constant CODAMA_ERROR__VISITORS__CYCLIC_DEPENDENCY_DETECTED_WHEN_RESOLVING_INSTRUCTION_DEFAULT_VALUES (line 44) | const CODAMA_ERROR__VISITORS__CYCLIC_DEPENDENCY_DETECTED_WHEN_RESOLVING_...
constant CODAMA_ERROR__VISITORS__CANNOT_USE_OPTIONAL_ACCOUNT_AS_PDA_SEED_VALUE (line 45) | const CODAMA_ERROR__VISITORS__CANNOT_USE_OPTIONAL_ACCOUNT_AS_PDA_SEED_VA...
constant CODAMA_ERROR__VISITORS__INVALID_INSTRUCTION_DEFAULT_VALUE_DEPENDENCY (line 46) | const CODAMA_ERROR__VISITORS__INVALID_INSTRUCTION_DEFAULT_VALUE_DEPENDEN...
constant CODAMA_ERROR__VISITORS__ACCOUNT_FIELD_NOT_FOUND (line 47) | const CODAMA_ERROR__VISITORS__ACCOUNT_FIELD_NOT_FOUND = 1200005;
constant CODAMA_ERROR__VISITORS__INVALID_NUMBER_WRAPPER (line 48) | const CODAMA_ERROR__VISITORS__INVALID_NUMBER_WRAPPER = 1200006;
constant CODAMA_ERROR__VISITORS__CANNOT_EXTEND_MISSING_VISIT_FUNCTION (line 49) | const CODAMA_ERROR__VISITORS__CANNOT_EXTEND_MISSING_VISIT_FUNCTION = 120...
constant CODAMA_ERROR__VISITORS__FAILED_TO_VALIDATE_NODE (line 50) | const CODAMA_ERROR__VISITORS__FAILED_TO_VALIDATE_NODE = 1200008;
constant CODAMA_ERROR__VISITORS__INSTRUCTION_ENUM_ARGUMENT_NOT_FOUND (line 51) | const CODAMA_ERROR__VISITORS__INSTRUCTION_ENUM_ARGUMENT_NOT_FOUND = 1200...
constant CODAMA_ERROR__VISITORS__CANNOT_FLATTEN_STRUCT_WITH_CONFLICTING_ATTRIBUTES (line 52) | const CODAMA_ERROR__VISITORS__CANNOT_FLATTEN_STRUCT_WITH_CONFLICTING_ATT...
constant CODAMA_ERROR__VISITORS__RENDER_MAP_KEY_NOT_FOUND (line 53) | const CODAMA_ERROR__VISITORS__RENDER_MAP_KEY_NOT_FOUND = 1200011;
constant CODAMA_ERROR__VISITORS__CANNOT_REMOVE_LAST_PATH_IN_NODE_STACK (line 54) | const CODAMA_ERROR__VISITORS__CANNOT_REMOVE_LAST_PATH_IN_NODE_STACK = 12...
constant CODAMA_ERROR__ANCHOR__UNRECOGNIZED_IDL_TYPE (line 58) | const CODAMA_ERROR__ANCHOR__UNRECOGNIZED_IDL_TYPE = 2100000;
constant CODAMA_ERROR__ANCHOR__ACCOUNT_TYPE_MISSING (line 59) | const CODAMA_ERROR__ANCHOR__ACCOUNT_TYPE_MISSING = 2100001;
constant CODAMA_ERROR__ANCHOR__ARGUMENT_TYPE_MISSING (line 60) | const CODAMA_ERROR__ANCHOR__ARGUMENT_TYPE_MISSING = 2100002;
constant CODAMA_ERROR__ANCHOR__TYPE_PATH_MISSING (line 61) | const CODAMA_ERROR__ANCHOR__TYPE_PATH_MISSING = 2100003;
constant CODAMA_ERROR__ANCHOR__SEED_KIND_UNIMPLEMENTED (line 62) | const CODAMA_ERROR__ANCHOR__SEED_KIND_UNIMPLEMENTED = 2100004;
constant CODAMA_ERROR__ANCHOR__PROGRAM_ID_KIND_UNIMPLEMENTED (line 63) | const CODAMA_ERROR__ANCHOR__PROGRAM_ID_KIND_UNIMPLEMENTED = 2100005;
constant CODAMA_ERROR__ANCHOR__GENERIC_TYPE_MISSING (line 64) | const CODAMA_ERROR__ANCHOR__GENERIC_TYPE_MISSING = 2100006;
constant CODAMA_ERROR__ANCHOR__EVENT_TYPE_MISSING (line 65) | const CODAMA_ERROR__ANCHOR__EVENT_TYPE_MISSING = 2100007;
constant CODAMA_ERROR__DYNAMIC_CLIENT__INSTRUCTION_NOT_FOUND (line 69) | const CODAMA_ERROR__DYNAMIC_CLIENT__INSTRUCTION_NOT_FOUND = 2500000;
constant CODAMA_ERROR__DYNAMIC_CLIENT__PDA_NOT_FOUND (line 70) | const CODAMA_ERROR__DYNAMIC_CLIENT__PDA_NOT_FOUND = 2500001;
constant CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND (line 71) | const CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOUND = 2500002;
constant CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING (line 72) | const CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING = 2500003;
constant CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS (line 73) | const CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ACCOUNT_ADDRESS = 2500004;
constant CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE (line 74) | const CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ADDRESS_TYPE = 2500005;
constant CODAMA_ERROR__DYNAMIC_CLIENT__CANNOT_CONVERT_TO_ADDRESS (line 75) | const CODAMA_ERROR__DYNAMIC_CLIENT__CANNOT_CONVERT_TO_ADDRESS = 2500006;
constant CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING (line 76) | const CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING = 2500007;
constant CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY (line 77) | const CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY = 2500008;
constant CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_OPTIONAL_ACCOUNT_STRATEGY (line 78) | const CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_OPTIONAL_ACCOUNT_STRATEG...
constant CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_DERIVE_PDA (line 79) | const CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_DERIVE_PDA = 2500010;
constant CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING (line 80) | const CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING = 2500011;
constant CODAMA_ERROR__DYNAMIC_CLIENT__DEFAULT_VALUE_MISSING (line 81) | const CODAMA_ERROR__DYNAMIC_CLIENT__DEFAULT_VALUE_MISSING = 2500012;
constant CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ARGUMENT_INPUT (line 82) | const CODAMA_ERROR__DYNAMIC_CLIENT__INVALID_ARGUMENT_INPUT = 2500013;
constant CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ARGUMENT_TYPE (line 83) | const CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ARGUMENT_TYPE = 2500014;
constant CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT (line 84) | const CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_ENCODE_ARGUMENT = 2500015;
constant CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER (line 85) | const CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER = 2500016;
constant CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT (line 86) | const CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT = 2500017;
constant CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_NODE (line 87) | const CODAMA_ERROR__DYNAMIC_CLIENT__UNSUPPORTED_NODE = 2500018;
constant CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION (line 88) | const CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION = 2500019;
constant CODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE (line 92) | const CODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE = 2800000;
constant CODAMA_ERROR__RENDERERS__MISSING_DEPENDENCY_VERSIONS (line 93) | const CODAMA_ERROR__RENDERERS__MISSING_DEPENDENCY_VERSIONS = 2800001;
type CodamaErrorCode (line 110) | type CodamaErrorCode =
FILE: packages/errors/src/context.ts
type DefaultUnspecifiedErrorContextToUndefined (line 80) | type DefaultUnspecifiedErrorContextToUndefined<T> = {
type CodamaErrorContext (line 88) | type CodamaErrorContext = DefaultUnspecifiedErrorContextToUndefined<{
type ValidationItem (line 312) | type ValidationItem = {
function decodeEncodedContext (line 319) | function decodeEncodedContext(encodedContext: string): object {
function encodeValue (line 324) | function encodeValue(value: unknown): string {
function encodeObjectContextEntry (line 343) | function encodeObjectContextEntry([key, value]: [string, unknown]): `${t...
function encodeContextObject (line 347) | function encodeContextObject(context: object): string {
FILE: packages/errors/src/error.ts
function isCodamaError (line 10) | function isCodamaError<TErrorCode extends CodamaErrorCode>(
type CodamaErrorCodedContext (line 24) | type CodamaErrorCodedContext = Readonly<{
class CodamaError (line 30) | class CodamaError<TErrorCode extends CodamaErrorCode = CodamaErrorCode> ...
method constructor (line 32) | constructor(
FILE: packages/errors/src/logs.ts
function logError (line 1) | function logError(message: string) {
function logWarn (line 5) | function logWarn(message: string) {
function logInfo (line 9) | function logInfo(message: string) {
FILE: packages/errors/src/message-formatter.ts
function getHumanReadableErrorMessage (line 10) | function getHumanReadableErrorMessage<TErrorCode extends CodamaErrorCode>(
function getErrorMessage (line 21) | function getErrorMessage<TErrorCode extends CodamaErrorCode>(code: TErro...
FILE: packages/errors/src/stack-trace.ts
function safeCaptureStackTrace (line 6) | function safeCaptureStackTrace(...args: Parameters<typeof Error.captureS...
FILE: packages/library/src/cli/index.ts
function run (line 5) | async function run(argv: readonly string[]) {
FILE: packages/library/src/codama.ts
type Codama (line 6) | interface Codama {
function createFromRoot (line 14) | function createFromRoot(root: RootNode): Codama {
function createFromJson (line 38) | function createFromJson(json: string): Codama {
function validateCodamaVersion (line 42) | function validateCodamaVersion(rootVersion: CodamaVersion): void {
FILE: packages/node-types/src/AccountNode.ts
type AccountNode (line 6) | interface AccountNode<
FILE: packages/node-types/src/DefinedTypeNode.ts
type DefinedTypeNode (line 4) | interface DefinedTypeNode<TType extends TypeNode = TypeNode> {
FILE: packages/node-types/src/ErrorNode.ts
type ErrorNode (line 3) | interface ErrorNode {
FILE: packages/node-types/src/EventNode.ts
type EventNode (line 5) | interface EventNode<
FILE: packages/node-types/src/InstructionAccountNode.ts
type InstructionAccountNode (line 4) | interface InstructionAccountNode<
FILE: packages/node-types/src/InstructionArgumentNode.ts
type InstructionArgumentNode (line 5) | interface InstructionArgumentNode<
FILE: packages/node-types/src/InstructionByteDeltaNode.ts
type InstructionByteDeltaNodeValue (line 5) | type InstructionByteDeltaNodeValue = AccountLinkNode | ArgumentValueNode...
type InstructionByteDeltaNode (line 7) | interface InstructionByteDeltaNode<
FILE: packages/node-types/src/InstructionNode.ts
type SubInstructionNode (line 9) | type SubInstructionNode = InstructionNode;
type OptionalAccountStrategy (line 11) | type OptionalAccountStrategy = 'omitted' | 'programId';
type InstructionNode (line 13) | interface InstructionNode<
FILE: packages/node-types/src/InstructionRemainingAccountsNode.ts
type InstructionRemainingAccountsNode (line 4) | interface InstructionRemainingAccountsNode<
FILE: packages/node-types/src/InstructionStatusNode.ts
type InstructionStatusNode (line 3) | interface InstructionStatusNode {
FILE: packages/node-types/src/Node.ts
type NodeKind (line 23) | type NodeKind = Node['kind'];
type Node (line 24) | type Node =
type GetNodeFromKind (line 47) | type GetNodeFromKind<TKind extends NodeKind> = Extract<Node, { kind: TKi...
FILE: packages/node-types/src/PdaNode.ts
type PdaNode (line 4) | interface PdaNode<TSeeds extends PdaSeedNode[] = PdaSeedNode[]> {
FILE: packages/node-types/src/ProgramNode.ts
type ProgramNode (line 9) | interface ProgramNode<
FILE: packages/node-types/src/RootNode.ts
type RootNode (line 4) | interface RootNode<
FILE: packages/node-types/src/contextualValueNodes/AccountBumpValueNode.ts
type AccountBumpValueNode (line 3) | interface AccountBumpValueNode {
FILE: packages/node-types/src/contextualValueNodes/AccountValueNode.ts
type AccountValueNode (line 3) | interface AccountValueNode {
FILE: packages/node-types/src/contextualValueNodes/ArgumentValueNode.ts
type ArgumentValueNode (line 3) | interface ArgumentValueNode {
FILE: packages/node-types/src/contextualValueNodes/ConditionalValueNode.ts
type ConditionNode (line 7) | type ConditionNode = AccountValueNode | ArgumentValueNode | ResolverValu...
type ConditionalValueNode (line 9) | interface ConditionalValueNode<
FILE: packages/node-types/src/contextualValueNodes/ContextualValueNode.ts
type StandaloneContextualValueNode (line 15) | type StandaloneContextualValueNode =
type RegisteredContextualValueNode (line 27) | type RegisteredContextualValueNode = PdaSeedValueNode | StandaloneContex...
type ContextualValueNode (line 30) | type ContextualValueNode = StandaloneContextualValueNode;
type InstructionInputValueNode (line 31) | type InstructionInputValueNode = ContextualValueNode | ProgramLinkNode |...
FILE: packages/node-types/src/contextualValueNodes/IdentityValueNode.ts
type IdentityValueNode (line 1) | interface IdentityValueNode {
FILE: packages/node-types/src/contextualValueNodes/PayerValueNode.ts
type PayerValueNode (line 1) | interface PayerValueNode {
FILE: packages/node-types/src/contextualValueNodes/PdaSeedValueNode.ts
type PdaSeedValueNode (line 6) | interface PdaSeedValueNode<
FILE: packages/node-types/src/contextualValueNodes/PdaValueNode.ts
type PdaValueNode (line 7) | interface PdaValueNode<
FILE: packages/node-types/src/contextualValueNodes/ProgramIdValueNode.ts
type ProgramIdValueNode (line 1) | interface ProgramIdValueNode {
FILE: packages/node-types/src/contextualValueNodes/ResolverValueNode.ts
type ResolverValueNode (line 5) | interface ResolverValueNode<
FILE: packages/node-types/src/countNodes/CountNode.ts
type RegisteredCountNode (line 6) | type RegisteredCountNode = FixedCountNode | PrefixedCountNode | Remainde...
type CountNode (line 9) | type CountNode = RegisteredCountNode;
FILE: packages/node-types/src/countNodes/FixedCountNode.ts
type FixedCountNode (line 1) | interface FixedCountNode {
FILE: packages/node-types/src/countNodes/PrefixedCountNode.ts
type PrefixedCountNode (line 3) | interface PrefixedCountNode<TPrefix extends NestedTypeNode<NumberTypeNod...
FILE: packages/node-types/src/countNodes/RemainderCountNode.ts
type RemainderCountNode (line 1) | interface RemainderCountNode {
FILE: packages/node-types/src/discriminatorNodes/ConstantDiscriminatorNode.ts
type ConstantDiscriminatorNode (line 3) | interface ConstantDiscriminatorNode<TConstant extends ConstantValueNode ...
FILE: packages/node-types/src/discriminatorNodes/DiscriminatorNode.ts
type RegisteredDiscriminatorNode (line 6) | type RegisteredDiscriminatorNode = ConstantDiscriminatorNode | FieldDisc...
type DiscriminatorNode (line 9) | type DiscriminatorNode = RegisteredDiscriminatorNode;
FILE: packages/node-types/src/discriminatorNodes/FieldDiscriminatorNode.ts
type FieldDiscriminatorNode (line 3) | interface FieldDiscriminatorNode {
FILE: packages/node-types/src/discriminatorNodes/SizeDiscriminatorNode.ts
type SizeDiscriminatorNode (line 1) | interface SizeDiscriminatorNode {
FILE: packages/node-types/src/linkNodes/AccountLinkNode.ts
type AccountLinkNode (line 4) | interface AccountLinkNode<TProgram extends ProgramLinkNode | undefined =...
FILE: packages/node-types/src/linkNodes/DefinedTypeLinkNode.ts
type DefinedTypeLinkNode (line 4) | interface DefinedTypeLinkNode<TProgram extends ProgramLinkNode | undefin...
FILE: packages/node-types/src/linkNodes/InstructionAccountLinkNode.ts
type InstructionAccountLinkNode (line 4) | interface InstructionAccountLinkNode<
FILE: packages/node-types/src/linkNodes/InstructionArgumentLinkNode.ts
type InstructionArgumentLinkNode (line 4) | interface InstructionArgumentLinkNode<
FILE: packages/node-types/src/linkNodes/InstructionLinkNode.ts
type InstructionLinkNode (line 4) | interface InstructionLinkNode<TProgram extends ProgramLinkNode | undefin...
FILE: packages/node-types/src/linkNodes/LinkNode.ts
type RegisteredLinkNode (line 10) | type RegisteredLinkNode =
type LinkNode (line 20) | type LinkNode = RegisteredLinkNode;
FILE: packages/node-types/src/linkNodes/PdaLinkNode.ts
type PdaLinkNode (line 4) | interface PdaLinkNode<TProgram extends ProgramLinkNode | undefined = Pro...
FILE: packages/node-types/src/linkNodes/ProgramLinkNode.ts
type ProgramLinkNode (line 3) | interface ProgramLinkNode {
FILE: packages/node-types/src/pdaSeedNodes/ConstantPdaSeedNode.ts
type ConstantPdaSeedNode (line 5) | interface ConstantPdaSeedNode<
FILE: packages/node-types/src/pdaSeedNodes/PdaSeedNode.ts
type RegisteredPdaSeedNode (line 5) | type RegisteredPdaSeedNode = ConstantPdaSeedNode | VariablePdaSeedNode;
type PdaSeedNode (line 8) | type PdaSeedNode = RegisteredPdaSeedNode;
FILE: packages/node-types/src/pdaSeedNodes/VariablePdaSeedNode.ts
type VariablePdaSeedNode (line 4) | interface VariablePdaSeedNode<TType extends TypeNode = TypeNode> {
FILE: packages/node-types/src/shared/bytesEncoding.ts
type BytesEncoding (line 1) | type BytesEncoding = 'base16' | 'base58' | 'base64' | 'utf8';
FILE: packages/node-types/src/shared/docs.ts
type Docs (line 1) | type Docs = string[];
FILE: packages/node-types/src/shared/instructionLifecycle.ts
type InstructionLifecycle (line 1) | type InstructionLifecycle = 'archived' | 'deprecated' | 'draft' | 'live';
FILE: packages/node-types/src/shared/stringCases.ts
type TitleCaseString (line 1) | type TitleCaseString = string & {
type PascalCaseString (line 5) | type PascalCaseString = string & {
type CamelCaseString (line 9) | type CamelCaseString = string & {
type KebabCaseString (line 13) | type KebabCaseString = string & {
type SnakeCaseString (line 17) | type SnakeCaseString = string & {
FILE: packages/node-types/src/shared/version.ts
type SemanticVersion (line 1) | type SemanticVersion = `${number}.${number}.${number}`;
type CodamaVersion (line 3) | type CodamaVersion = SemanticVersion;
type ProgramVersion (line 4) | type ProgramVersion = SemanticVersion;
FILE: packages/node-types/src/typeNodes/AmountTypeNode.ts
type AmountTypeNode (line 4) | interface AmountTypeNode<TNumber extends NestedTypeNode<NumberTypeNode> ...
FILE: packages/node-types/src/typeNodes/ArrayTypeNode.ts
type ArrayTypeNode (line 4) | interface ArrayTypeNode<TItem extends TypeNode = TypeNode, TCount extend...
FILE: packages/node-types/src/typeNodes/BooleanTypeNode.ts
type BooleanTypeNode (line 4) | interface BooleanTypeNode<TSize extends NestedTypeNode<NumberTypeNode> =...
FILE: packages/node-types/src/typeNodes/BytesTypeNode.ts
type BytesTypeNode (line 1) | interface BytesTypeNode {
FILE: packages/node-types/src/typeNodes/DateTimeTypeNode.ts
type DateTimeTypeNode (line 4) | interface DateTimeTypeNode<TNumber extends NestedTypeNode<NumberTypeNode...
FILE: packages/node-types/src/typeNodes/EnumEmptyVariantTypeNode.ts
type EnumEmptyVariantTypeNode (line 3) | interface EnumEmptyVariantTypeNode {
FILE: packages/node-types/src/typeNodes/EnumStructVariantTypeNode.ts
type EnumStructVariantTypeNode (line 5) | interface EnumStructVariantTypeNode<
FILE: packages/node-types/src/typeNodes/EnumTupleVariantTypeNode.ts
type EnumTupleVariantTypeNode (line 5) | interface EnumTupleVariantTypeNode<
FILE: packages/node-types/src/typeNodes/EnumTypeNode.ts
type EnumTypeNode (line 5) | interface EnumTypeNode<
FILE: packages/node-types/src/typeNodes/EnumVariantTypeNode.ts
type EnumVariantTypeNode (line 5) | type EnumVariantTypeNode = EnumEmptyVariantTypeNode | EnumStructVariantT...
FILE: packages/node-types/src/typeNodes/FixedSizeTypeNode.ts
type FixedSizeTypeNode (line 3) | interface FixedSizeTypeNode<TType extends TypeNode = TypeNode> {
FILE: packages/node-types/src/typeNodes/HiddenPrefixTypeNode.ts
type HiddenPrefixTypeNode (line 4) | interface HiddenPrefixTypeNode<
FILE: packages/node-types/src/typeNodes/HiddenSuffixTypeNode.ts
type HiddenSuffixTypeNode (line 4) | interface HiddenSuffixTypeNode<
FILE: packages/node-types/src/typeNodes/MapTypeNode.ts
type MapTypeNode (line 4) | interface MapTypeNode<
FILE: packages/node-types/src/typeNodes/NestedTypeNode.ts
type NestedTypeNode (line 10) | type NestedTypeNode<TType extends TypeNode> =
FILE: packages/node-types/src/typeNodes/NumberTypeNode.ts
type NumberFormat (line 1) | type NumberFormat =
type NumberTypeNode (line 16) | interface NumberTypeNode<TFormat extends NumberFormat = NumberFormat> {
FILE: packages/node-types/src/typeNodes/OptionTypeNode.ts
type OptionTypeNode (line 5) | interface OptionTypeNode<
FILE: packages/node-types/src/typeNodes/PostOffsetTypeNode.ts
type PostOffsetTypeNode (line 3) | interface PostOffsetTypeNode<TType extends TypeNode = TypeNode> {
FILE: packages/node-types/src/typeNodes/PreOffsetTypeNode.ts
type PreOffsetTypeNode (line 3) | interface PreOffsetTypeNode<TType extends TypeNode = TypeNode> {
FILE: packages/node-types/src/typeNodes/PublicKeyTypeNode.ts
type PublicKeyTypeNode (line 1) | interface PublicKeyTypeNode {
FILE: packages/node-types/src/typeNodes/RemainderOptionTypeNode.ts
type RemainderOptionTypeNode (line 3) | interface RemainderOptionTypeNode<TItem extends TypeNode = TypeNode> {
FILE: packages/node-types/src/typeNodes/SentinelTypeNode.ts
type SentinelTypeNode (line 4) | interface SentinelTypeNode<
FILE: packages/node-types/src/typeNodes/SetTypeNode.ts
type SetTypeNode (line 4) | interface SetTypeNode<TItem extends TypeNode = TypeNode, TCount extends ...
FILE: packages/node-types/src/typeNodes/SizePrefixTypeNode.ts
type SizePrefixTypeNode (line 5) | interface SizePrefixTypeNode<
FILE: packages/node-types/src/typeNodes/SolAmountTypeNode.ts
type SolAmountTypeNode (line 4) | interface SolAmountTypeNode<TNumber extends NestedTypeNode<NumberTypeNod...
FILE: packages/node-types/src/typeNodes/StringTypeNode.ts
type StringTypeNode (line 3) | interface StringTypeNode<TEncoding extends BytesEncoding = BytesEncoding> {
FILE: packages/node-types/src/typeNodes/StructFieldTypeNode.ts
type StructFieldTypeNode (line 5) | interface StructFieldTypeNode<
FILE: packages/node-types/src/typeNodes/StructTypeNode.ts
type StructTypeNode (line 3) | interface StructTypeNode<TFields extends StructFieldTypeNode[] = StructF...
FILE: packages/node-types/src/typeNodes/TupleTypeNode.ts
type TupleTypeNode (line 3) | interface TupleTypeNode<TItems extends TypeNode[] = TypeNode[]> {
FILE: packages/node-types/src/typeNodes/TypeNode.ts
type StandaloneTypeNode (line 32) | type StandaloneTypeNode =
type RegisteredTypeNode (line 59) | type RegisteredTypeNode =
type TypeNode (line 72) | type TypeNode = DefinedTypeLinkNode | StandaloneTypeNode;
FILE: packages/node-types/src/typeNodes/ZeroableOptionTypeNode.ts
type ZeroableOptionTypeNode (line 4) | interface ZeroableOptionTypeNode<
FILE: packages/node-types/src/valueNodes/ArrayValueNode.ts
type ArrayValueNode (line 3) | interface ArrayValueNode<TItems extends ValueNode[] = ValueNode[]> {
FILE: packages/node-types/src/valueNodes/BooleanValueNode.ts
type BooleanValueNode (line 1) | interface BooleanValueNode {
FILE: packages/node-types/src/valueNodes/BytesValueNode.ts
type BytesValueNode (line 3) | interface BytesValueNode {
FILE: packages/node-types/src/valueNodes/ConstantValueNode.ts
type ConstantValueNode (line 4) | interface ConstantValueNode<TType extends TypeNode = TypeNode, TValue ex...
FILE: packages/node-types/src/valueNodes/EnumValueNode.ts
type EnumValueNode (line 6) | interface EnumValueNode<
FILE: packages/node-types/src/valueNodes/MapEntryValueNode.ts
type MapEntryValueNode (line 3) | interface MapEntryValueNode<TKey extends ValueNode = ValueNode, TValue e...
FILE: packages/node-types/src/valueNodes/MapValueNode.ts
type MapValueNode (line 3) | interface MapValueNode<TEntries extends MapEntryValueNode[] = MapEntryVa...
FILE: packages/node-types/src/valueNodes/NoneValueNode.ts
type NoneValueNode (line 1) | interface NoneValueNode {
FILE: packages/node-types/src/valueNodes/NumberValueNode.ts
type NumberValueNode (line 1) | interface NumberValueNode {
FILE: packages/node-types/src/valueNodes/PublicKeyValueNode.ts
type PublicKeyValueNode (line 3) | interface PublicKeyValueNode {
FILE: packages/node-types/src/valueNodes/SetValueNode.ts
type SetValueNode (line 3) | interface SetValueNode<TItems extends ValueNode[] = ValueNode[]> {
FILE: packages/node-types/src/valueNodes/SomeValueNode.ts
type SomeValueNode (line 3) | interface SomeValueNode<TValue extends ValueNode = ValueNode> {
FILE: packages/node-types/src/valueNodes/StringValueNode.ts
type StringValueNode (line 1) | interface StringValueNode {
FILE: packages/node-types/src/valueNodes/StructFieldValueNode.ts
type StructFieldValueNode (line 4) | interface StructFieldValueNode<TValue extends ValueNode = ValueNode> {
FILE: packages/node-types/src/valueNodes/StructValueNode.ts
type StructValueNode (line 3) | interface StructValueNode<TFields extends StructFieldValueNode[] = Struc...
FILE: packages/node-types/src/valueNodes/TupleValueNode.ts
type TupleValueNode (line 3) | interface TupleValueNode<TItems extends ValueNode[] = ValueNode[]> {
FILE: packages/node-types/src/valueNodes/ValueNode.ts
type StandaloneValueNode (line 19) | type StandaloneValueNode =
type RegisteredValueNode (line 36) | type RegisteredValueNode = MapEntryValueNode | StandaloneValueNode | Str...
type ValueNode (line 39) | type ValueNode = StandaloneValueNode;
FILE: packages/nodes-from-anchor/src/defaultVisitor.ts
function defaultVisitor (line 17) | function defaultVisitor() {
FILE: packages/nodes-from-anchor/src/extractPdasVisitor.ts
type Fingerprint (line 18) | type Fingerprint = string;
function pdaFingerprint (line 20) | function pdaFingerprint(pda: PdaNode, hashVisitor: Visitor<string>): Fin...
function getUniquePdaName (line 24) | function getUniquePdaName(name: CamelCaseString, usedNames: Set<CamelCas...
function extractPdasVisitor (line 35) | function extractPdasVisitor() {
function extractPdasFromProgram (line 47) | function extractPdasFromProgram(program: ProgramNode): ProgramNode {
FILE: packages/nodes-from-anchor/src/index.ts
type AnchorIdl (line 14) | type AnchorIdl = IdlV00 | IdlV01;
function rootNodeFromAnchor (line 16) | function rootNodeFromAnchor(idl: AnchorIdl): RootNode {
function rootNodeFromAnchorWithoutDefaultVisitor (line 20) | function rootNodeFromAnchorWithoutDefaultVisitor(idl: AnchorIdl): RootNo...
FILE: packages/nodes-from-anchor/src/utils.ts
function hex (line 1) | function hex(bytes: number[] | Uint8Array): string {
FILE: packages/nodes-from-anchor/src/v00/AccountNode.ts
function accountNodeFromAnchorV00 (line 20) | function accountNodeFromAnchorV00(
FILE: packages/nodes-from-anchor/src/v00/DefinedTypeNode.ts
function definedTypeNodeFromAnchorV00 (line 6) | function definedTypeNodeFromAnchorV00(idl: Partial<IdlV00TypeDef>): Defi...
FILE: packages/nodes-from-anchor/src/v00/ErrorNode.ts
function errorNodeFromAnchorV00 (line 5) | function errorNodeFromAnchorV00(idl: Partial<IdlV00ErrorCode>): ErrorNode {
FILE: packages/nodes-from-anchor/src/v00/InstructionAccountNode.ts
function hasDuplicateAccountNames (line 5) | function hasDuplicateAccountNames(idl: IdlV00AccountItem[]): boolean {
function instructionAccountNodesFromAnchorV00 (line 28) | function instructionAccountNodesFromAnchorV00(
function instructionAccountNodeFromAnchorV00 (line 44) | function instructionAccountNodeFromAnchorV00(idl: IdlV00Account, prefix?...
FILE: packages/nodes-from-anchor/src/v00/InstructionArgumentNode.ts
function instructionArgumentNodeFromAnchorV00 (line 6) | function instructionArgumentNodeFromAnchorV00(idl: IdlV00Field): Instruc...
FILE: packages/nodes-from-anchor/src/v00/InstructionNode.ts
function instructionNodeFromAnchorV00 (line 20) | function instructionNodeFromAnchorV00(
FILE: packages/nodes-from-anchor/src/v00/PdaNode.ts
function pdaNodeFromAnchorV00 (line 19) | function pdaNodeFromAnchorV00(idl: IdlV00PdaDef): PdaNode {
FILE: packages/nodes-from-anchor/src/v00/ProgramNode.ts
function programNodeFromAnchorV00 (line 10) | function programNodeFromAnchorV00(idl: IdlV00): ProgramNode {
FILE: packages/nodes-from-anchor/src/v00/RootNode.ts
function rootNodeFromAnchorV00 (line 6) | function rootNodeFromAnchorV00(program: IdlV00, additionalPrograms: IdlV...
FILE: packages/nodes-from-anchor/src/v00/idl.ts
type IdlV00 (line 1) | type IdlV00 = {
type IdlV00Metadata (line 14) | type IdlV00Metadata = object;
type IdlV00Constant (line 16) | type IdlV00Constant = {
type IdlV00Event (line 22) | type IdlV00Event = {
type IdlV00EventField (line 27) | type IdlV00EventField = {
type IdlV00Instruction (line 33) | type IdlV00Instruction = {
type IdlV00InstructionDiscriminant (line 43) | type IdlV00InstructionDiscriminant = {
type IdlV00StateMethod (line 48) | type IdlV00StateMethod = IdlV00Instruction;
type IdlV00AccountItem (line 50) | type IdlV00AccountItem = IdlV00Account | IdlV00Accounts;
type IdlV00Account (line 52) | type IdlV00Account = {
type IdlV00Pda (line 65) | type IdlV00Pda = {
type IdlV00Seed (line 70) | type IdlV00Seed = IdlV00SeedAccount | IdlV00SeedArg | IdlV00SeedConst;
type IdlV00SeedConst (line 72) | type IdlV00SeedConst = {
type IdlV00SeedArg (line 79) | type IdlV00SeedArg = {
type IdlV00SeedAccount (line 85) | type IdlV00SeedAccount = {
type IdlV00Accounts (line 93) | type IdlV00Accounts = {
type IdlV00Field (line 99) | type IdlV00Field = {
type IdlV00TypeDef (line 105) | type IdlV00TypeDef = {
type IdlV00AccountDef (line 111) | type IdlV00AccountDef = {
type IdlV00PdaDef (line 119) | type IdlV00PdaDef = {
type IdlV00PdaSeedDef (line 125) | type IdlV00PdaSeedDef =
type IdlV00TypeDefTyStruct (line 130) | type IdlV00TypeDefTyStruct = {
type IdlV00TypeDefTyEnum (line 135) | type IdlV00TypeDefTyEnum = {
type IdlV00TypeDefTyAlias (line 141) | type IdlV00TypeDefTyAlias = {
type IdlV00TypeDefTy (line 146) | type IdlV00TypeDefTy = IdlV00TypeDefTyAlias | IdlV00TypeDefTyEnum | IdlV...
type IdlV00Type (line 148) | type IdlV00Type =
type IdlV00TypeUnsignedInteger (line 162) | type IdlV00TypeUnsignedInteger = 'shortU16' | 'u8' | 'u16' | 'u32' | 'u6...
type IdlV00TypeSignedInteger (line 163) | type IdlV00TypeSignedInteger = 'i8' | 'i16' | 'i32' | 'i64' | 'i128';
type IdlV00TypeInteger (line 164) | type IdlV00TypeInteger = IdlV00TypeSignedInteger | IdlV00TypeUnsignedInt...
type IdlV00TypeDecimals (line 165) | type IdlV00TypeDecimals = 'f32' | 'f64';
type IdlV00TypeNumber (line 166) | type IdlV00TypeNumber = IdlV00TypeDecimals | IdlV00TypeInteger;
type IdlV00TypeDefined (line 169) | type IdlV00TypeDefined = {
type IdlV00TypeOption (line 173) | type IdlV00TypeOption = {
type IdlV00TypeVec (line 178) | type IdlV00TypeVec = {
type IdlV00TypeTuple (line 182) | type IdlV00TypeTuple = { tuple: IdlV00Type[] };
type IdlV00TypeArray (line 184) | type IdlV00TypeArray = {
type IdlV00TypeHashMap (line 188) | type IdlV00TypeHashMap = { hashMap: [IdlV00Type, IdlV00Type] };
type IdlV00TypeBTreeMap (line 189) | type IdlV00TypeBTreeMap = { bTreeMap: [IdlV00Type, IdlV00Type] };
type IdlV00TypeMap (line 190) | type IdlV00TypeMap = {
type IdlV00TypeHashSet (line 194) | type IdlV00TypeHashSet = { hashSet: IdlV00Type };
type IdlV00TypeBTreeSet (line 195) | type IdlV00TypeBTreeSet = { bTreeSet: IdlV00Type };
type IdlV00TypeSet (line 196) | type IdlV00TypeSet = {
type IdlV00EnumVariant (line 200) | type IdlV00EnumVariant = {
type IdlV00EnumFields (line 205) | type IdlV00EnumFields = IdlV00EnumFieldsNamed | IdlV00EnumFieldsTuple;
type IdlV00EnumFieldsNamed (line 207) | type IdlV00EnumFieldsNamed = IdlV00Field[];
type IdlV00EnumFieldsTuple (line 209) | type IdlV00EnumFieldsTuple = IdlV00Type[];
type IdlV00ErrorCode (line 211) | type IdlV00ErrorCode = {
FILE: packages/nodes-from-anchor/src/v00/typeNodes/ArrayTypeNode.ts
function arrayTypeNodeFromAnchorV00 (line 13) | function arrayTypeNodeFromAnchorV00(idl: IdlV00TypeArray | IdlV00TypeVec...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/EnumEmptyVariantTypeNode.ts
function enumEmptyVariantTypeNodeFromAnchorV00 (line 5) | function enumEmptyVariantTypeNodeFromAnchorV00(idl: IdlV00EnumVariant): ...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/EnumStructVariantTypeNode.ts
function enumStructVariantTypeNodeFromAnchorV00 (line 6) | function enumStructVariantTypeNodeFromAnchorV00(
FILE: packages/nodes-from-anchor/src/v00/typeNodes/EnumTupleVariantTypeNode.ts
function enumTupleVariantTypeNodeFromAnchorV00 (line 6) | function enumTupleVariantTypeNodeFromAnchorV00(
FILE: packages/nodes-from-anchor/src/v00/typeNodes/EnumTypeNode.ts
function enumTypeNodeFromAnchorV00 (line 8) | function enumTypeNodeFromAnchorV00(
function isStructVariant (line 25) | function isStructVariant(variant: IdlV00EnumVariant): variant is IdlV00E...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/MapTypeNode.ts
function mapTypeNodeFromAnchorV00 (line 14) | function mapTypeNodeFromAnchorV00(idl: IdlV00TypeMap): MapTypeNode {
FILE: packages/nodes-from-anchor/src/v00/typeNodes/OptionTypeNode.ts
function optionTypeNodeFromAnchorV00 (line 6) | function optionTypeNodeFromAnchorV00(idl: IdlV00TypeOption): OptionTypeN...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/SetTypeNode.ts
function setTypeNodeFromAnchorV00 (line 13) | function setTypeNodeFromAnchorV00(idl: IdlV00TypeSet): SetTypeNode {
FILE: packages/nodes-from-anchor/src/v00/typeNodes/StructFieldTypeNode.ts
function structFieldTypeNodeFromAnchorV00 (line 6) | function structFieldTypeNodeFromAnchorV00(idl: IdlV00Field): StructField...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/StructTypeNode.ts
function structTypeNodeFromAnchorV00 (line 6) | function structTypeNodeFromAnchorV00(idl: IdlV00TypeDefTyStruct): Struct...
FILE: packages/nodes-from-anchor/src/v00/typeNodes/TupleTypeNode.ts
function tupleTypeNodeFromAnchorV00 (line 6) | function tupleTypeNodeFromAnchorV00(idl: IdlV00TypeTuple): TupleTypeNode {
FILE: packages/nodes-from-anchor/src/v00/typeNodes/TypeNode.ts
constant IDL_V00_TYPE_LEAVES (line 22) | const IDL_V00_TYPE_LEAVES = [
function isArrayOfSize (line 118) | function isArrayOfSize(array: any, size: number): boolean {
FILE: packages/nodes-from-anchor/src/v01/AccountNode.ts
function accountNodeFromAnchorV01 (line 19) | function accountNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/DefinedTypeNode.ts
function definedTypeNodeFromAnchorV01 (line 7) | function definedTypeNodeFromAnchorV01(idl: Partial<IdlV01TypeDef>, gener...
FILE: packages/nodes-from-anchor/src/v01/ErrorNode.ts
function errorNodeFromAnchorV01 (line 5) | function errorNodeFromAnchorV01(idl: Partial<IdlV01ErrorCode>): ErrorNode {
FILE: packages/nodes-from-anchor/src/v01/EventNode.ts
function eventNodeFromAnchorV01 (line 18) | function eventNodeFromAnchorV01(idl: IdlV01Event, types: IdlV01TypeDef[]...
FILE: packages/nodes-from-anchor/src/v01/InstructionAccountNode.ts
function hasDuplicateAccountNames (line 21) | function hasDuplicateAccountNames(idl: IdlV01InstructionAccountItem[]): ...
function instructionAccountNodesFromAnchorV01 (line 44) | function instructionAccountNodesFromAnchorV01(
function instructionAccountNodeFromAnchorV01 (line 62) | function instructionAccountNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/InstructionArgumentNode.ts
function instructionArgumentNodeFromAnchorV01 (line 7) | function instructionArgumentNodeFromAnchorV01(idl: IdlV01Field, generics...
FILE: packages/nodes-from-anchor/src/v01/InstructionNode.ts
function instructionNodeFromAnchorV01 (line 17) | function instructionNodeFromAnchorV01(idl: IdlV01Instruction, generics: ...
FILE: packages/nodes-from-anchor/src/v01/PdaSeedNode.ts
function pdaSeedNodeFromAnchorV01 (line 24) | function pdaSeedNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/ProgramNode.ts
function programNodeFromAnchorV01 (line 11) | function programNodeFromAnchorV01(idl: IdlV01): ProgramNode {
FILE: packages/nodes-from-anchor/src/v01/RootNode.ts
function rootNodeFromAnchorV01 (line 6) | function rootNodeFromAnchorV01(program: IdlV01, additionalPrograms: IdlV...
FILE: packages/nodes-from-anchor/src/v01/idl.ts
type IdlV01 (line 1) | type IdlV01 = {
type IdlV01Metadata (line 13) | type IdlV01Metadata = {
type IdlV01Dependency (line 24) | type IdlV01Dependency = {
type IdlV01Deployments (line 29) | type IdlV01Deployments = {
type IdlV01Instruction (line 36) | type IdlV01Instruction = {
type IdlV01InstructionAccountItem (line 45) | type IdlV01InstructionAccountItem = IdlV01InstructionAccount | IdlV01Ins...
type IdlV01InstructionAccount (line 47) | type IdlV01InstructionAccount = {
type IdlV01InstructionAccounts (line 58) | type IdlV01InstructionAccounts = {
type IdlV01Pda (line 63) | type IdlV01Pda = {
type IdlV01Seed (line 68) | type IdlV01Seed = IdlV01SeedAccount | IdlV01SeedArg | IdlV01SeedConst;
type IdlV01SeedConst (line 70) | type IdlV01SeedConst = {
type IdlV01SeedArg (line 75) | type IdlV01SeedArg = {
type IdlV01SeedAccount (line 80) | type IdlV01SeedAccount = {
type IdlV01Account (line 86) | type IdlV01Account = {
type IdlV01Event (line 91) | type IdlV01Event = {
type IdlV01Const (line 96) | type IdlV01Const = {
type IdlV01ErrorCode (line 102) | type IdlV01ErrorCode = {
type IdlV01Field (line 108) | type IdlV01Field = {
type IdlV01TypeDef (line 114) | type IdlV01TypeDef = {
type IdlV01Serialization (line 123) | type IdlV01Serialization = 'borsh' | 'bytemuck' | 'bytemuckunsafe' | { c...
type IdlV01Repr (line 125) | type IdlV01Repr = IdlV01ReprC | IdlV01ReprRust | IdlV01ReprTransparent;
type IdlV01ReprRust (line 127) | type IdlV01ReprRust = IdlV01ReprModifier & {
type IdlV01ReprC (line 131) | type IdlV01ReprC = IdlV01ReprModifier & {
type IdlV01ReprTransparent (line 135) | type IdlV01ReprTransparent = {
type IdlV01ReprModifier (line 139) | type IdlV01ReprModifier = {
type IdlV01TypeDefGeneric (line 144) | type IdlV01TypeDefGeneric = IdlV01TypeDefGenericConst | IdlV01TypeDefGen...
type IdlV01TypeDefGenericType (line 146) | type IdlV01TypeDefGenericType = {
type IdlV01TypeDefGenericConst (line 151) | type IdlV01TypeDefGenericConst = {
type IdlV01TypeDefTy (line 157) | type IdlV01TypeDefTy = IdlV01TypeDefTyAlias | IdlV01TypeDefTyEnum | IdlV...
type IdlV01TypeDefTyStruct (line 159) | type IdlV01TypeDefTyStruct = {
type IdlV01TypeDefTyEnum (line 164) | type IdlV01TypeDefTyEnum = {
type IdlV01TypeDefTyAlias (line 169) | type IdlV01TypeDefTyAlias = {
type IdlV01TypeDefTyType (line 174) | type IdlV01TypeDefTyType = {
type IdlV01EnumVariant (line 179) | type IdlV01EnumVariant = {
type IdlV01DefinedFields (line 184) | type IdlV01DefinedFields = IdlV01DefinedFieldsNamed | IdlV01DefinedField...
type IdlV01DefinedFieldsNamed (line 186) | type IdlV01DefinedFieldsNamed = IdlV01Field[];
type IdlV01DefinedFieldsTuple (line 188) | type IdlV01DefinedFieldsTuple = IdlV01Type[];
type IdlV01ArrayLen (line 190) | type IdlV01ArrayLen = IdlV01ArrayLenGeneric | IdlV01ArrayLenValue;
type IdlV01ArrayLenGeneric (line 192) | type IdlV01ArrayLenGeneric = {
type IdlV01ArrayLenValue (line 196) | type IdlV01ArrayLenValue = number;
type IdlV01GenericArg (line 198) | type IdlV01GenericArg = IdlV01GenericArgConst | IdlV01GenericArgType;
type IdlV01GenericArgType (line 200) | type IdlV01GenericArgType = { kind: 'type'; type: IdlV01Type };
type IdlV01GenericArgConst (line 202) | type IdlV01GenericArgConst = { kind: 'const'; value: string };
type IdlV01Type (line 204) | type IdlV01Type =
type IdlV01TypeUnsignedInteger (line 217) | type IdlV01TypeUnsignedInteger = 'shortU16' | 'u8' | 'u16' | 'u32' | 'u6...
type IdlV01TypeSignedInteger (line 218) | type IdlV01TypeSignedInteger = 'i8' | 'i16' | 'i32' | 'i64' | 'i128';
type IdlV01TypeInteger (line 219) | type IdlV01TypeInteger = IdlV01TypeSignedInteger | IdlV01TypeUnsignedInt...
type IdlV01TypeDecimals (line 220) | type IdlV01TypeDecimals = 'f32' | 'f64';
type IdlV01TypeNumber (line 221) | type IdlV01TypeNumber = IdlV01TypeDecimals | IdlV01TypeInteger;
type IdlV01TypeOption (line 223) | type IdlV01TypeOption = {
type IdlV01TypeCOption (line 227) | type IdlV01TypeCOption = {
type IdlV01TypeVec (line 231) | type IdlV01TypeVec = {
type IdlV01TypeArray (line 235) | type IdlV01TypeArray = {
type IdlV01TypeDefined (line 239) | type IdlV01TypeDefined = {
type IdlV01TypeGeneric (line 246) | type IdlV01TypeGeneric = {
type IdlV01Discriminator (line 250) | type IdlV01Discriminator = number[];
FILE: packages/nodes-from-anchor/src/v01/typeNodes/ArrayTypeNode.ts
function arrayTypeNodeFromAnchorV01 (line 7) | function arrayTypeNodeFromAnchorV01(idl: IdlV01TypeArray | IdlV01TypeVec...
FILE: packages/nodes-from-anchor/src/v01/typeNodes/EnumEmptyVariantTypeNode.ts
function enumEmptyVariantTypeNodeFromAnchorV01 (line 5) | function enumEmptyVariantTypeNodeFromAnchorV01(idl: IdlV01EnumVariant): ...
FILE: packages/nodes-from-anchor/src/v01/typeNodes/EnumStructVariantTypeNode.ts
function enumStructVariantTypeNodeFromAnchorV01 (line 7) | function enumStructVariantTypeNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/typeNodes/EnumTupleVariantTypeNode.ts
function enumTupleVariantTypeNodeFromAnchorV01 (line 7) | function enumTupleVariantTypeNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/typeNodes/EnumTypeNode.ts
function enumTypeNodeFromAnchorV01 (line 14) | function enumTypeNodeFromAnchorV01(
function isStructVariant (line 33) | function isStructVariant(
FILE: packages/nodes-from-anchor/src/v01/typeNodes/OptionTypeNode.ts
function optionTypeNodeFromAnchorV01 (line 7) | function optionTypeNodeFromAnchorV01(
FILE: packages/nodes-from-anchor/src/v01/typeNodes/StructFieldTypeNode.ts
function structFieldTypeNodeFromAnchorV01 (line 8) | function structFieldTypeNodeFromAnchorV01(
function isStructField (line 25) | function isStructField(field: IdlV01Field | IdlV01Type): field is IdlV01...
FILE: packages/nodes-from-anchor/src/v01/typeNodes/StructTypeNode.ts
function structTypeNodeFromAnchorV01 (line 7) | function structTypeNodeFromAnchorV01(idl: IdlV01TypeDefTyStruct, generic...
FILE: packages/nodes-from-anchor/src/v01/typeNodes/TupleTypeNode.ts
function tupleTypeNodeFromAnchorV01 (line 7) | function tupleTypeNodeFromAnchorV01(idl: IdlV01DefinedFieldsTuple, gener...
FILE: packages/nodes-from-anchor/src/v01/typeNodes/TypeNode.ts
constant IDL_V01_TYPE_LEAVES (line 28) | const IDL_V01_TYPE_LEAVES = [
function isArrayOfSize (line 123) | function isArrayOfSize(array: any, size: number): boolean {
function isStructFieldArray (line 127) | function isStructFieldArray(field: IdlV01DefinedFields): field is IdlV01...
function isTupleFieldArray (line 131) | function isTupleFieldArray(field: IdlV01DefinedFields): field is IdlV01D...
function isStructField (line 135) | function isStructField(field: IdlV01Field | IdlV01Type): field is IdlV01...
FILE: packages/nodes-from-anchor/src/v01/unwrapGenerics.ts
type GenericsV01 (line 14) | type GenericsV01 = {
function extractGenerics (line 20) | function extractGenerics(types: IdlV01TypeDef[]): [IdlV01TypeDef[], Gene...
function unwrapGenericTypeFromAnchorV01 (line 38) | function unwrapGenericTypeFromAnchorV01(type: IdlV01TypeDefined, generic...
FILE: packages/nodes-from-anchor/test/v01/extractPdasVisitor.test.ts
function makeProgram (line 18) | function makeProgram(instructions: ReturnType<typeof instructionNode>[]) {
FILE: packages/nodes/src/AccountNode.ts
type AccountNodeInput (line 6) | type AccountNodeInput<
function accountNode (line 16) | function accountNode<
FILE: packages/nodes/src/DefinedTypeNode.ts
type DefinedTypeNodeInput (line 5) | type DefinedTypeNodeInput<TType extends TypeNode = TypeNode> = Omit<
function definedTypeNode (line 13) | function definedTypeNode<TType extends TypeNode>(input: DefinedTypeNodeI...
FILE: packages/nodes/src/ErrorNode.ts
type ErrorNodeInput (line 5) | type ErrorNodeInput = Omit<ErrorNode, 'docs' | 'kind' | 'name'> & {
function errorNode (line 10) | function errorNode(input: ErrorNodeInput): ErrorNode {
FILE: packages/nodes/src/EventNode.ts
type EventNodeInput (line 6) | type EventNodeInput<
function eventNode (line 14) | function eventNode<
FILE: packages/nodes/src/InstructionAccountNode.ts
type InstructionAccountNodeInput (line 5) | type InstructionAccountNodeInput<
function instructionAccountNode (line 13) | function instructionAccountNode<TDefaultValue extends InstructionInputVa...
FILE: packages/nodes/src/InstructionArgumentNode.ts
type InstructionArgumentNodeInput (line 9) | type InstructionArgumentNodeInput<
function instructionArgumentNode (line 16) | function instructionArgumentNode<TDefaultValue extends InstructionInputV...
function structTypeNodeFromInstructionArgumentNodes (line 33) | function structTypeNodeFromInstructionArgumentNodes(nodes: InstructionAr...
function structFieldTypeNodeFromInstructionArgumentNode (line 37) | function structFieldTypeNodeFromInstructionArgumentNode(node: Instructio...
FILE: packages/nodes/src/InstructionByteDeltaNode.ts
function instructionByteDeltaNode (line 5) | function instructionByteDeltaNode<TValue extends InstructionByteDeltaNod...
FILE: packages/nodes/src/InstructionNode.ts
type SubInstructionNode (line 17) | type SubInstructionNode = InstructionNode;
type InstructionNodeInput (line 19) | type InstructionNodeInput<
function instructionNode (line 47) | function instructionNode<
function parseOptionalAccountStrategy (line 94) | function parseOptionalAccountStrategy(
function getAllInstructionArguments (line 100) | function getAllInstructionArguments(node: InstructionNode): InstructionA...
function getAllInstructionsWithSubs (line 104) | function getAllInstructionsWithSubs(
FILE: packages/nodes/src/InstructionRemainingAccountsNode.ts
function instructionRemainingAccountsNode (line 5) | function instructionRemainingAccountsNode<TValue extends ArgumentValueNo...
FILE: packages/nodes/src/InstructionStatusNode.ts
function instructionStatusNode (line 3) | function instructionStatusNode(lifecycle: InstructionLifecycle, message?...
FILE: packages/nodes/src/Node.ts
constant REGISTERED_NODE_KINDS (line 13) | const REGISTERED_NODE_KINDS = [
function isNode (line 38) | function isNode<TKind extends NodeKind>(
function assertIsNode (line 46) | function assertIsNode<TKind extends NodeKind>(
function isNodeFilter (line 60) | function isNodeFilter<TKind extends NodeKind>(
function assertIsNodeFilter (line 66) | function assertIsNodeFilter<TKind extends NodeKind>(
function removeNullAndAssertIsNodeFilter (line 75) | function removeNullAndAssertIsNodeFilter<TKind extends NodeKind>(
FILE: packages/nodes/src/PdaNode.ts
type PdaNodeInput (line 5) | type PdaNodeInput<TSeeds extends PdaSeedNode[] = PdaSeedNode[]> = Omit<
function pdaNode (line 13) | function pdaNode<const TSeeds extends PdaSeedNode[]>(input: PdaNodeInput...
FILE: packages/nodes/src/ProgramNode.ts
type ProgramNodeInput (line 14) | type ProgramNodeInput<
function programNode (line 30) | function programNode<
function getAllPrograms (line 60) | function getAllPrograms(node: ProgramNode | ProgramNode[] | RootNode): P...
function getAllPdas (line 66) | function getAllPdas(node: ProgramNode | ProgramNode[] | RootNode): PdaNo...
function getAllAccounts (line 70) | function getAllAccounts(node: ProgramNode | ProgramNode[] | RootNode): A...
function getAllEvents (line 74) | function getAllEvents(node: ProgramNode | ProgramNode[] | RootNode): Eve...
function getAllDefinedTypes (line 78) | function getAllDefinedTypes(node: ProgramNode | ProgramNode[] | RootNode...
function getAllInstructions (line 82) | function getAllInstructions(node: ProgramNode | ProgramNode[] | RootNode...
function getAllErrors (line 86) | function getAllErrors(node: ProgramNode | ProgramNode[] | RootNode): Err...
FILE: packages/nodes/src/RootNode.ts
function rootNode (line 3) | function rootNode<TProgram extends ProgramNode, const TAdditionalProgram...
FILE: packages/nodes/src/contextualValueNodes/AccountBumpValueNode.ts
function accountBumpValueNode (line 5) | function accountBumpValueNode(name: string): AccountBumpValueNode {
FILE: packages/nodes/src/contextualValueNodes/AccountValueNode.ts
function accountValueNode (line 5) | function accountValueNode(name: string): AccountValueNode {
FILE: packages/nodes/src/contextualValueNodes/ArgumentValueNode.ts
function argumentValueNode (line 5) | function argumentValueNode(name: string): ArgumentValueNode {
FILE: packages/nodes/src/contextualValueNodes/ConditionalValueNode.ts
type ConditionNode (line 10) | type ConditionNode = AccountValueNode | ArgumentValueNode | ResolverValu...
function conditionalValueNode (line 12) | function conditionalValueNode<
FILE: packages/nodes/src/contextualValueNodes/ContextualValueNode.ts
constant STANDALONE_CONTEXTUAL_VALUE_NODE_KINDS (line 4) | const STANDALONE_CONTEXTUAL_VALUE_NODE_KINDS = [
constant REGISTERED_CONTEXTUAL_VALUE_NODE_KINDS (line 17) | const REGISTERED_CONTEXTUAL_VALUE_NODE_KINDS = [
constant CONTEXTUAL_VALUE_NODES (line 23) | const CONTEXTUAL_VALUE_NODES = STANDALONE_CONTEXTUAL_VALUE_NODE_KINDS;
constant INSTRUCTION_INPUT_VALUE_NODES (line 24) | const INSTRUCTION_INPUT_VALUE_NODES = [...VALUE_NODES, ...CONTEXTUAL_VAL...
FILE: packages/nodes/src/contextualValueNodes/IdentityValueNode.ts
function identityValueNode (line 3) | function identityValueNode(): IdentityValueNode {
FILE: packages/nodes/src/contextualValueNodes/PayerValueNode.ts
function payerValueNode (line 3) | function payerValueNode(): PayerValueNode {
FILE: packages/nodes/src/contextualValueNodes/PdaSeedValueNode.ts
function pdaSeedValueNode (line 5) | function pdaSeedValueNode<
FILE: packages/nodes/src/contextualValueNodes/PdaValueNode.ts
function pdaValueNode (line 12) | function pdaValueNode<
FILE: packages/nodes/src/contextualValueNodes/ProgramIdValueNode.ts
function programIdValueNode (line 3) | function programIdValueNode(): ProgramIdValueNode {
FILE: packages/nodes/src/contextualValueNodes/ResolverValueNode.ts
function resolverValueNode (line 5) | function resolverValueNode<const TDependsOn extends (AccountValueNode | ...
FILE: packages/nodes/src/countNodes/CountNode.ts
constant REGISTERED_COUNT_NODE_KINDS (line 2) | const REGISTERED_COUNT_NODE_KINDS = [
constant COUNT_NODES (line 9) | const COUNT_NODES = REGISTERED_COUNT_NODE_KINDS;
FILE: packages/nodes/src/countNodes/FixedCountNode.ts
function fixedCountNode (line 3) | function fixedCountNode(value: number): FixedCountNode {
FILE: packages/nodes/src/countNodes/PrefixedCountNode.ts
function prefixedCountNode (line 3) | function prefixedCountNode<TPrefix extends NestedTypeNode<NumberTypeNode>>(
FILE: packages/nodes/src/countNodes/RemainderCountNode.ts
function remainderCountNode (line 3) | function remainderCountNode(): RemainderCountNode {
FILE: packages/nodes/src/discriminatorNodes/ConstantDiscriminatorNode.ts
function constantDiscriminatorNode (line 3) | function constantDiscriminatorNode<TConstant extends ConstantValueNode>(
FILE: packages/nodes/src/discriminatorNodes/DiscriminatorNode.ts
constant REGISTERED_DISCRIMINATOR_NODE_KINDS (line 2) | const REGISTERED_DISCRIMINATOR_NODE_KINDS = [
constant DISCRIMINATOR_NODES (line 9) | const DISCRIMINATOR_NODES = REGISTERED_DISCRIMINATOR_NODE_KINDS;
FILE: packages/nodes/src/discriminatorNodes/FieldDiscriminatorNode.ts
function fieldDiscriminatorNode (line 5) | function fieldDiscriminatorNode(name: string, offset: number = 0): Field...
FILE: packages/nodes/src/discriminatorNodes/SizeDiscriminatorNode.ts
function sizeDiscriminatorNode (line 3) | function sizeDiscriminatorNode(size: number): SizeDiscriminatorNode {
FILE: packages/nodes/src/linkNodes/AccountLinkNode.ts
function accountLinkNode (line 6) | function accountLinkNode(name: string, program?: ProgramLinkNode | strin...
FILE: packages/nodes/src/linkNodes/DefinedTypeLinkNode.ts
function definedTypeLinkNode (line 6) | function definedTypeLinkNode(name: string, program?: ProgramLinkNode | s...
FILE: packages/nodes/src/linkNodes/InstructionAccountLinkNode.ts
function instructionAccountLinkNode (line 6) | function instructionAccountLinkNode(
FILE: packages/nodes/src/linkNodes/InstructionArgumentLinkNode.ts
function instructionArgumentLinkNode (line 6) | function instructionArgumentLinkNode(
FILE: packages/nodes/src/linkNodes/InstructionLinkNode.ts
function instructionLinkNode (line 6) | function instructionLinkNode(name: string, program?: ProgramLinkNode | s...
FILE: packages/nodes/src/linkNodes/LinkNode.ts
constant REGISTERED_LINK_NODE_KINDS (line 2) | const REGISTERED_LINK_NODE_KINDS = [
constant LINK_NODES (line 13) | const LINK_NODES = REGISTERED_LINK_NODE_KINDS;
FILE: packages/nodes/src/linkNodes/PdaLinkNode.ts
function pdaLinkNode (line 6) | function pdaLinkNode(name: string, program?: ProgramLinkNode | string): ...
FILE: packages/nodes/src/linkNodes/ProgramLinkNode.ts
function programLinkNode (line 5) | function programLinkNode(name: string): ProgramLinkNode {
FILE: packages/nodes/src/pdaSeedNodes/ConstantPdaSeedNode.ts
function constantPdaSeedNode (line 10) | function constantPdaSeedNode<TType extends TypeNode, TValue extends Prog...
function constantPdaSeedNodeFromProgramId (line 23) | function constantPdaSeedNodeFromProgramId() {
function constantPdaSeedNodeFromString (line 27) | function constantPdaSeedNodeFromString<TEncoding extends BytesEncoding>(...
function constantPdaSeedNodeFromBytes (line 31) | function constantPdaSeedNodeFromBytes<TEncoding extends BytesEncoding>(e...
FILE: packages/nodes/src/pdaSeedNodes/PdaSeedNode.ts
constant REGISTERED_PDA_SEED_NODE_KINDS (line 2) | const REGISTERED_PDA_SEED_NODE_KINDS = ['constantPdaSeedNode' as const, ...
constant PDA_SEED_NODES (line 5) | const PDA_SEED_NODES = REGISTERED_PDA_SEED_NODE_KINDS;
FILE: packages/nodes/src/pdaSeedNodes/VariablePdaSeedNode.ts
function variablePdaSeedNode (line 5) | function variablePdaSeedNode<TType extends TypeNode>(
FILE: packages/nodes/src/shared/docs.ts
type DocsInput (line 3) | type DocsInput = string[] | string;
function parseDocs (line 5) | function parseDocs(docs: DocsInput | null | undefined): Docs {
FILE: packages/nodes/src/shared/stringCases.ts
function capitalize (line 9) | function capitalize(str: string): string {
function titleCase (line 14) | function titleCase(str: string): TitleCaseString {
function pascalCase (line 23) | function pascalCase(str: string): PascalCaseString {
function camelCase (line 27) | function camelCase(str: string): CamelCaseString {
function kebabCase (line 33) | function kebabCase(str: string): KebabCaseString {
function snakeCase (line 37) | function snakeCase(str: string): SnakeCaseString {
FILE: packages/nodes/src/typeNodes/AmountTypeNode.ts
function amountTypeNode (line 3) | function amountTypeNode<TNumber extends NestedTypeNode<NumberTypeNode>>(
FILE: packages/nodes/src/typeNodes/ArrayTypeNode.ts
function arrayTypeNode (line 3) | function arrayTypeNode<TItem extends TypeNode, TCount extends CountNode>(
FILE: packages/nodes/src/typeNodes/BooleanTypeNode.ts
function booleanTypeNode (line 5) | function booleanTypeNode<TSize extends NestedTypeNode<NumberTypeNode> = ...
FILE: packages/nodes/src/typeNodes/BytesTypeNode.ts
function bytesTypeNode (line 3) | function bytesTypeNode(): BytesTypeNode {
FILE: packages/nodes/src/typeNodes/DateTimeTypeNode.ts
function dateTimeTypeNode (line 3) | function dateTimeTypeNode<TNumber extends NestedTypeNode<NumberTypeNode>...
FILE: packages/nodes/src/typeNodes/EnumEmptyVariantTypeNode.ts
function enumEmptyVariantTypeNode (line 5) | function enumEmptyVariantTypeNode(name: string, discriminator?: number):...
FILE: packages/nodes/src/typeNodes/EnumStructVariantTypeNode.ts
function enumStructVariantTypeNode (line 5) | function enumStructVariantTypeNode<TStruct extends NestedTypeNode<Struct...
FILE: packages/nodes/src/typeNodes/EnumTupleVariantTypeNode.ts
function enumTupleVariantTypeNode (line 5) | function enumTupleVariantTypeNode<TTuple extends NestedTypeNode<TupleTyp...
FILE: packages/nodes/src/typeNodes/EnumTypeNode.ts
function enumTypeNode (line 5) | function enumTypeNode<
function isScalarEnum (line 18) | function isScalarEnum(node: EnumTypeNode): boolean {
function isDataEnum (line 22) | function isDataEnum(node: EnumTypeNode): boolean {
FILE: packages/nodes/src/typeNodes/EnumVariantTypeNode.ts
constant ENUM_VARIANT_TYPE_NODES (line 1) | const ENUM_VARIANT_TYPE_NODES = [
FILE: packages/nodes/src/typeNodes/FixedSizeTypeNode.ts
function fixedSizeTypeNode (line 3) | function fixedSizeTypeNode<TType extends TypeNode>(type: TType, size: nu...
FILE: packages/nodes/src/typeNodes/HiddenPrefixTypeNode.ts
function hiddenPrefixTypeNode (line 3) | function hiddenPrefixTypeNode<TType extends TypeNode, const TPrefix exte...
FILE: packages/nodes/src/typeNodes/HiddenSuffixTypeNode.ts
function hiddenSuffixTypeNode (line 3) | function hiddenSuffixTypeNode<TType extends TypeNode, const TSuffix exte...
FILE: packages/nodes/src/typeNodes/MapTypeNode.ts
function mapTypeNode (line 3) | function mapTypeNode<TKey extends TypeNode, TValue extends TypeNode, TCo...
FILE: packages/nodes/src/typeNodes/NestedTypeNode.ts
function resolveNestedTypeNode (line 7) | function resolveNestedTypeNode<TType extends TypeNode>(typeNode: NestedT...
function transformNestedTypeNode (line 22) | function transformNestedTypeNode<TFrom extends TypeNode, TTo extends Typ...
function isNestedTypeNode (line 43) | function isNestedTypeNode<TKind extends TypeNode['kind']>(
function assertIsNestedTypeNode (line 53) | function assertIsNestedTypeNode<TKind extends TypeNode['kind']>(
FILE: packages/nodes/src/typeNodes/NumberTypeNode.ts
function numberTypeNode (line 3) | function numberTypeNode<TFormat extends NumberFormat = NumberFormat>(
function isSignedInteger (line 16) | function isSignedInteger(node: NumberTypeNode): boolean {
function isUnsignedInteger (line 20) | function isUnsignedInteger(node: NumberTypeNode): boolean {
function isInteger (line 24) | function isInteger(node: NumberTypeNode): boolean {
function isDecimal (line 28) | function isDecimal(node: NumberTypeNode): boolean {
FILE: packages/nodes/src/typeNodes/OptionTypeNode.ts
function optionTypeNode (line 5) | function optionTypeNode<
FILE: packages/nodes/src/typeNodes/PostOffsetTypeNode.ts
function postOffsetTypeNode (line 3) | function postOffsetTypeNode<TType extends TypeNode>(
FILE: packages/nodes/src/typeNodes/PreOffsetTypeNode.ts
function preOffsetTypeNode (line 3) | function preOffsetTypeNode<TType extends TypeNode>(
FILE: packages/nodes/src/typeNodes/PublicKeyTypeNode.ts
function publicKeyTypeNode (line 3) | function publicKeyTypeNode(): PublicKeyTypeNode {
FILE: packages/nodes/src/typeNodes/RemainderOptionTypeNode.ts
function remainderOptionTypeNode (line 3) | function remainderOptionTypeNode<TItem extends TypeNode>(item: TItem): R...
FILE: packages/nodes/src/typeNodes/SentinelTypeNode.ts
function sentinelTypeNode (line 3) | function sentinelTypeNode<TType extends TypeNode, TSentinel extends Cons...
FILE: packages/nodes/src/typeNodes/SetTypeNode.ts
function setTypeNode (line 3) | function setTypeNode<TItem extends TypeNode, TCount extends CountNode>(
FILE: packages/nodes/src/typeNodes/SizePrefixTypeNode.ts
function sizePrefixTypeNode (line 3) | function sizePrefixTypeNode<
FILE: packages/nodes/src/typeNodes/SolAmountTypeNode.ts
function solAmountTypeNode (line 3) | function solAmountTypeNode<TNumber extends NestedTypeNode<NumberTypeNode>>(
FILE: packages/nodes/src/typeNodes/StringTypeNode.ts
function stringTypeNode (line 3) | function stringTypeNode<TEncoding extends BytesEncoding>(encoding: TEnco...
FILE: packages/nodes/src/typeNodes/StructFieldTypeNode.ts
type StructFieldTypeNodeInput (line 5) | type StructFieldTypeNodeInput<
function structFieldTypeNode (line 13) | function structFieldTypeNode<TType extends TypeNode, TDefaultValue exten...
FILE: packages/nodes/src/typeNodes/StructTypeNode.ts
function structTypeNode (line 3) | function structTypeNode<const TFields extends StructFieldTypeNode[] = St...
FILE: packages/nodes/src/typeNodes/TupleTypeNode.ts
function tupleTypeNode (line 3) | function tupleTypeNode<const TItems extends TypeNode[] = TypeNode[]>(ite...
FILE: packages/nodes/src/typeNodes/TypeNode.ts
constant STANDALONE_TYPE_NODE_KINDS (line 2) | const STANDALONE_TYPE_NODE_KINDS = [
constant REGISTERED_TYPE_NODE_KINDS (line 30) | const REGISTERED_TYPE_NODE_KINDS = [
constant TYPE_NODES (line 44) | const TYPE_NODES = [...STANDALONE_TYPE_NODE_KINDS, 'definedTypeLinkNode'...
FILE: packages/nodes/src/typeNodes/ZeroableOptionTypeNode.ts
function zeroableOptionTypeNode (line 3) | function zeroableOptionTypeNode<TItem extends TypeNode, TZeroValue exten...
FILE: packages/nodes/src/valueNodes/ArrayValueNode.ts
function arrayValueNode (line 3) | function arrayValueNode<const TItems extends ValueNode[]>(items: TItems)...
FILE: packages/nodes/src/valueNodes/BooleanValueNode.ts
function booleanValueNode (line 3) | function booleanValueNode(boolean: boolean): BooleanValueNode {
FILE: packages/nodes/src/valueNodes/BytesValueNode.ts
function bytesValueNode (line 3) | function bytesValueNode(encoding: BytesEncoding, data: string): BytesVal...
FILE: packages/nodes/src/valueNodes/ConstantValueNode.ts
function constantValueNode (line 7) | function constantValueNode<TType extends TypeNode, TValue extends ValueN...
function constantValueNodeFromString (line 20) | function constantValueNodeFromString<TEncoding extends BytesEncoding>(en...
function constantValueNodeFromBytes (line 24) | function constantValueNodeFromBytes<TEncoding extends BytesEncoding>(enc...
FILE: packages/nodes/src/valueNodes/EnumValueNode.ts
function enumValueNode (line 6) | function enumValueNode<
FILE: packages/nodes/src/valueNodes/MapEntryValueNode.ts
function mapEntryValueNode (line 3) | function mapEntryValueNode<TKey extends ValueNode, TValue extends ValueN...
FILE: packages/nodes/src/valueNodes/MapValueNode.ts
function mapValueNode (line 3) | function mapValueNode<const TEntries extends MapEntryValueNode[]>(entrie...
FILE: packages/nodes/src/valueNodes/NoneValueNode.ts
function noneValueNode (line 3) | function noneValueNode(): NoneValueNode {
FILE: packages/nodes/src/valueNodes/NumberValueNode.ts
function numberValueNode (line 3) | function numberValueNode(number: number): NumberValueNode {
FILE: packages/nodes/src/valueNodes/PublicKeyValueNode.ts
function publicKeyValueNode (line 5) | function publicKeyValueNode(publicKey: string, identifier?: string): Pub...
FILE: packages/nodes/src/valueNodes/SetValueNode.ts
function setValueNode (line 3) | function setValueNode<const TItems extends ValueNode[]>(items: TItems): ...
FILE: packages/nodes/src/valueNodes/SomeValueNode.ts
function someValueNode (line 3) | function someValueNode<TValue extends ValueNode>(value: TValue): SomeVal...
FILE: packages/nodes/src/valueNodes/StringValueNode.ts
function stringValueNode (line 3) | function stringValueNode(string: string): StringValueNode {
FILE: packages/nodes/src/valueNodes/StructFieldValueNode.ts
function structFieldValueNode (line 5) | function structFieldValueNode<TValue extends ValueNode>(
FILE: packages/nodes/src/valueNodes/StructValueNode.ts
function structValueNode (line 3) | function structValueNode<const TFields extends StructFieldValueNode[]>(
FILE: packages/nodes/src/valueNodes/TupleValueNode.ts
function tupleValueNode (line 3) | function tupleValueNode<const TItems extends ValueNode[]>(items: TItems)...
FILE: packages/nodes/src/valueNodes/ValueNode.ts
constant STANDALONE_VALUE_NODE_KINDS (line 2) | const STANDALONE_VALUE_NODE_KINDS = [
constant REGISTERED_VALUE_NODE_KINDS (line 20) | const REGISTERED_VALUE_NODE_KINDS = [
constant VALUE_NODES (line 27) | const VALUE_NODES = STANDALONE_VALUE_NODE_KINDS;
FILE: packages/renderers-core/src/fragment.ts
type BaseFragment (line 1) | type BaseFragment = Readonly<{ content: string }>;
function mapFragmentContent (line 3) | function mapFragmentContent<TFragment extends BaseFragment>(
function mapFragmentContentAsync (line 10) | async function mapFragmentContentAsync<TFragment extends BaseFragment>(
function setFragmentContent (line 17) | function setFragmentContent<TFragment extends BaseFragment>(fragment: TF...
function createFragmentTemplate (line 21) | function createFragmentTemplate<TFragment extends BaseFragment>(
FILE: packages/renderers-core/src/fs.ts
function createDirectory (line 7) | function createDirectory(path: Path): void {
function deleteDirectory (line 15) | function deleteDirectory(path: Path): void {
function writeFile (line 25) | function writeFile(path: Path, content: string): void {
function fileExists (line 37) | function fileExists(path: Path): boolean {
function readFile (line 45) | function readFile(path: Path): string {
function readJson (line 53) | function readJson<T>(path: Path): T {
FILE: packages/renderers-core/src/path.ts
type Path (line 3) | type Path = string;
function joinPath (line 5) | function joinPath(...paths: Path[]): string {
function pathDirectory (line 13) | function pathDirectory(path: Path): Path {
FILE: packages/renderers-core/src/renderMap.ts
type RenderMap (line 9) | type RenderMap<TFragment extends BaseFragment> = ReadonlyMap<Path, TFrag...
function createRenderMap (line 16) | function createRenderMap<TFragment extends BaseFragment>(
function addToRenderMap (line 31) | function addToRenderMap<TFragment extends BaseFragment>(
function removeFromRenderMap (line 39) | function removeFromRenderMap<TFragment extends BaseFragment>(
function mergeRenderMaps (line 48) | function mergeRenderMaps<TFragment extends BaseFragment>(
function mapRenderMapFragment (line 62) | function mapRenderMapFragment<TFragment extends BaseFragment>(
function mapRenderMapFragmentAsync (line 69) | async function mapRenderMapFragmentAsync<TFragment extends BaseFragment>(
function mapRenderMapContent (line 82) | function mapRenderMapContent<TFragment extends BaseFragment>(
function mapRenderMapContentAsync (line 91) | async function mapRenderMapContentAsync<TFragment extends BaseFragment>(
function getFromRenderMap (line 100) | function getFromRenderMap<TFragment extends BaseFragment>(
function renderMapContains (line 111) | function renderMapContains<TFragment extends BaseFragment>(
function writeRenderMap (line 120) | function writeRenderMap<TFragment extends BaseFragment>(renderMap: Rende...
function writeRenderMapVisitor (line 126) | function writeRenderMapVisitor<
FILE: packages/renderers-core/test/renderMap.test.ts
type CustomFragment (line 21) | type CustomFragment = BaseFragment & { customProperty: number };
FILE: packages/validators/src/ValidationItem.ts
constant LOG_LEVELS (line 4) | const LOG_LEVELS = ['debug', 'trace', 'info', 'warn', 'error'] as const;
type LogLevel (line 5) | type LogLevel = (typeof LOG_LEVELS)[number];
type ValidationItem (line 7) | type ValidationItem = {
function validationItem (line 14) | function validationItem(
FILE: packages/validators/src/getValidationItemsVisitor.ts
function getValidationItemsVisitor (line 17) | function getValidationItemsVisitor(): Visitor<readonly ValidationItem[]> {
FILE: packages/validators/src/throwValidatorItemsVisitor.ts
function throwValidatorItemsVisitor (line 7) | function throwValidatorItemsVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/LinkableDictionary.ts
type LinkableNode (line 24) | type LinkableNode =
constant LINKABLE_NODES (line 33) | const LINKABLE_NODES: LinkableNode['kind'][] = [
type GetLinkableFromLinkNode (line 43) | type GetLinkableFromLinkNode<TLinkNode extends LinkNode> = {
type ProgramDictionary (line 53) | type ProgramDictionary = {
type InstructionDictionary (line 61) | type InstructionDictionary = {
class LinkableDictionary (line 67) | class LinkableDictionary {
method recordPath (line 70) | recordPath(linkablePath: NodePath<LinkableNode>): this {
method getPathOrThrow (line 91) | getPathOrThrow<TLinkNode extends LinkNode>(
method getPath (line 109) | getPath<TLinkNode extends LinkNode>(
method getOrThrow (line 137) | getOrThrow<TLinkNode extends LinkNode>(linkPath: NodePath<TLinkNode>):...
method get (line 141) | get<TLinkNode extends LinkNode>(linkPath: NodePath<TLinkNode>): GetLin...
method has (line 146) | has(linkPath: NodePath<LinkNode>): boolean {
method getOrCreateProgramDictionary (line 171) | private getOrCreateProgramDictionary(linkablePath: NodePath<LinkableNo...
method getOrCreateInstructionDictionary (line 191) | private getOrCreateInstructionDictionary(
method getProgramDictionary (line 214) | private getProgramDictionary(linkPath: NodePath<LinkNode>): ProgramDic...
method getInstructionDictionary (line 229) | private getInstructionDictionary(
FILE: packages/visitors-core/src/NodePath.ts
type NodePath (line 3) | type NodePath<TNode extends Node | undefined = undefined> = TNode extend...
function getLastNodeFromPath (line 7) | function getLastNodeFromPath<TNode extends Node>(path: NodePath<TNode>):...
function findFirstNodeFromPath (line 11) | function findFirstNodeFromPath<TKind extends NodeKind>(
function findLastNodeFromPath (line 18) | function findLastNodeFromPath<TKind extends NodeKind>(
function findProgramNodeFromPath (line 29) | function findProgramNodeFromPath(path: NodePath): ProgramNode | undefined {
function findInstructionNodeFromPath (line 33) | function findInstructionNodeFromPath(path: NodePath): InstructionNode | ...
function getNodePathUntilLastNode (line 37) | function getNodePathUntilLastNode<TKind extends NodeKind>(
function isFilledNodePath (line 52) | function isFilledNodePath(path: NodePath | null | undefined): path is No...
function isNodePath (line 56) | function isNodePath<TKind extends NodeKind>(
function assertIsNodePath (line 63) | function assertIsNodePath<TKind extends NodeKind>(
function nodePathToStringArray (line 70) | function nodePathToStringArray(path: NodePath): string[] {
function nodePathToString (line 76) | function nodePathToString(path: NodePath): string {
FILE: packages/visitors-core/src/NodeSelector.ts
type NodeSelector (line 5) | type NodeSelector = NodeSelectorFunction | NodeSelectorPath;
type NodeSelectorPath (line 16) | type NodeSelectorPath = string;
type NodeSelectorFunction (line 18) | type NodeSelectorFunction = (path: NodePath<Node>) => boolean;
FILE: packages/visitors-core/src/NodeStack.ts
type MutableNodePath (line 6) | type MutableNodePath = Node[];
class NodeStack (line 8) | class NodeStack {
method constructor (line 21) | constructor(...stack: readonly [...(readonly NodePath[]), NodePath] | ...
method currentPath (line 28) | private get currentPath(): MutableNodePath {
method push (line 32) | public push(node: Node): void {
method pop (line 36) | public pop(): Node | undefined {
method peek (line 40) | public peek(): Node | undefined {
method pushPath (line 44) | public pushPath(newPath: NodePath = []): void {
method popPath (line 48) | public popPath(): NodePath {
method getPath (line 59) | public getPath<TKind extends NodeKind>(kind?: TKind | TKind[]): NodePa...
method isEmpty (line 67) | public isEmpty(): boolean {
method clone (line 71) | public clone(): NodeStack {
method toString (line 75) | public toString(): string {
FILE: packages/visitors-core/src/bottomUpTransformerVisitor.ts
type BottomUpNodeTransformer (line 11) | type BottomUpNodeTransformer = (node: Node, stack: NodeStack) => Node | ...
type BottomUpNodeTransformerWithSelector (line 13) | type BottomUpNodeTransformerWithSelector = {
function bottomUpTransformerVisitor (line 18) | function bottomUpTransformerVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/consoleLogVisitor.ts
function consoleLogVisitor (line 6) | function consoleLogVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/deleteNodesVisitor.ts
function deleteNodesVisitor (line 6) | function deleteNodesVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/extendVisitor.ts
type DontInfer (line 7) | type DontInfer<T> = T extends any ? T : never;
type VisitorOverrideFunction (line 9) | type VisitorOverrideFunction<TReturn, TNodeKind extends NodeKind, TNode ...
type VisitorOverrides (line 17) | type VisitorOverrides<TReturn, TNodeKind extends NodeKind> = {
function extendVisitor (line 21) | function extendVisitor<TReturn, TNodeKind extends NodeKind>(
FILE: packages/visitors-core/src/getByteSizeVisitor.ts
type ByteSizeVisitorKeys (line 12) | type ByteSizeVisitorKeys =
function getByteSizeVisitor (line 21) | function getByteSizeVisitor(
function getArrayLikeSize (line 181) | function getArrayLikeSize(
FILE: packages/visitors-core/src/getDebugStringVisitor.ts
function getDebugStringVisitor (line 8) | function getDebugStringVisitor(options: { indent?: boolean; indentSepara...
function getNodeDetails (line 43) | function getNodeDetails(node: Node): string[] {
FILE: packages/visitors-core/src/getMaxByteSizeVisitor.ts
function getMaxByteSizeVisitor (line 13) | function getMaxByteSizeVisitor(
function getArrayLikeSize (line 172) | function getArrayLikeSize(
FILE: packages/visitors-core/src/getResolvedInstructionInputsVisitor.ts
type ResolvedInstructionInput (line 26) | type ResolvedInstructionInput = ResolvedInstructionAccount | ResolvedIns...
type ResolvedInstructionAccount (line 27) | type ResolvedInstructionAccount = InstructionAccountNode & {
type ResolvedInstructionArgument (line 33) | type ResolvedInstructionArgument = InstructionArgumentNode & {
type InstructionInput (line 36) | type InstructionInput = InstructionAccountNode | InstructionArgumentNode;
type InstructionDependency (line 37) | type InstructionDependency = AccountValueNode | ArgumentValueNode;
function getResolvedInstructionInputsVisitor (line 39) | function getResolvedInstructionInputsVisitor(
function deduplicateInstructionDependencies (line 238) | function deduplicateInstructionDependencies(dependencies: InstructionDep...
function getInstructionDependencies (line 251) | function getInstructionDependencies(input: InstructionInput | Instructio...
FILE: packages/visitors-core/src/getUniqueHashStringVisitor.ts
function getUniqueHashStringVisitor (line 8) | function getUniqueHashStringVisitor(options: { removeDocs?: boolean } = ...
FILE: packages/visitors-core/src/identityVisitor.ts
function identityVisitor (line 80) | function identityVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/interceptFirstVisitVisitor.ts
function interceptFirstVisitVisitor (line 6) | function interceptFirstVisitVisitor<TReturn, TNodeKind extends NodeKind>(
FILE: packages/visitors-core/src/interceptVisitor.ts
type VisitorInterceptor (line 5) | type VisitorInterceptor<TReturn> = <TNode extends Node>(node: TNode, nex...
function interceptVisitor (line 7) | function interceptVisitor<TReturn, TNodeKind extends NodeKind>(
FILE: packages/visitors-core/src/mapVisitor.ts
function mapVisitor (line 5) | function mapVisitor<TReturnFrom, TReturnTo, TNodeKind extends NodeKind>(
FILE: packages/visitors-core/src/mergeVisitor.ts
function mergeVisitor (line 6) | function mergeVisitor<TReturn, TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/nonNullableIdentityVisitor.ts
function nonNullableIdentityVisitor (line 6) | function nonNullableIdentityVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/pipe.ts
function pipe (line 111) | function pipe<TInitial>(init: TInitial, ...fns: CallableFunction[]) {
FILE: packages/visitors-core/src/recordLinkablesVisitor.ts
function getRecordLinkablesVisitor (line 12) | function getRecordLinkablesVisitor<TNodeKind extends NodeKind>(
function recordLinkablesOnFirstVisitVisitor (line 29) | function recordLinkablesOnFirstVisitVisitor<TReturn, TNodeKind extends N...
FILE: packages/visitors-core/src/recordNodeStackVisitor.ts
function recordNodeStackVisitor (line 7) | function recordNodeStackVisitor<TReturn, TNodeKind extends NodeKind>(
FILE: packages/visitors-core/src/removeDocsVisitor.ts
function removeDocsVisitor (line 6) | function removeDocsVisitor<TNodeKind extends NodeKind = NodeKind>(option...
FILE: packages/visitors-core/src/singleNodeVisitor.ts
function singleNodeVisitor (line 5) | function singleNodeVisitor<TReturn, TNodeKey extends NodeKind = NodeKind>(
function rootNodeVisitor (line 15) | function rootNodeVisitor<TReturn = RootNode>(fn: (node: RootNode) => TRe...
FILE: packages/visitors-core/src/staticVisitor.ts
function staticVisitor (line 5) | function staticVisitor<TReturn, TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/tapVisitor.ts
function tapVisitor (line 5) | function tapVisitor<TReturn, TNodeKey extends NodeKind, TVisitor extends...
FILE: packages/visitors-core/src/topDownTransformerVisitor.ts
type TopDownNodeTransformer (line 11) | type TopDownNodeTransformer = <TNode extends Node>(node: TNode, stack: N...
type TopDownNodeTransformerWithSelector (line 13) | type TopDownNodeTransformerWithSelector = {
function topDownTransformerVisitor (line 18) | function topDownTransformerVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/src/visitor.ts
type Visitor (line 4) | type Visitor<TReturn, TNodeKind extends NodeKind = NodeKind> = {
type GetVisitorFunctionName (line 8) | type GetVisitorFunctionName<T extends Node['kind']> = T extends `${infer...
function visit (line 12) | function visit<TReturn, TNode extends Node>(node: TNode, visitor: Visito...
function visitOrElse (line 17) | function visitOrElse<TReturn, TNode extends Node, TNodeKind extends Node...
function getVisitFunctionName (line 26) | function getVisitFunctionName<TNodeKind extends NodeKind>(nodeKind: TNod...
FILE: packages/visitors-core/src/voidVisitor.ts
function voidVisitor (line 6) | function voidVisitor<TNodeKind extends NodeKind = NodeKind>(
FILE: packages/visitors-core/test/visitor.test.ts
method visitNumberType (line 19) | visitNumberType() {
method visitPublicKeyType (line 22) | visitPublicKeyType() {
method visitTupleType (line 25) | visitTupleType(node) {
method visitNumberType (line 45) | visitNumberType() {
method visitTupleType (line 48) | visitTupleType(node) {
FILE: packages/visitors/src/addPdasVisitor.ts
function addPdasVisitor (line 5) | function addPdasVisitor(pdas: Record<string, Omit<PdaNodeInput, 'program...
FILE: packages/visitors/src/createSubInstructionsFromEnumArgsVisitor.ts
function createSubInstructionsFromEnumArgsVisitor (line 23) | function createSubInstructionsFromEnumArgsVisitor(map: Record<string, st...
FILE: packages/visitors/src/deduplicateIdenticalDefinedTypesVisitor.ts
type DefinedTypeWithProgram (line 10) | type DefinedTypeWithProgram = {
function deduplicateIdenticalDefinedTypesVisitor (line 15) | function deduplicateIdenticalDefinedTypesVisitor() {
FILE: packages/visitors/src/fillDefaultPdaSeedValuesVisitor.ts
function fillDefaultPdaSeedValuesVisitor (line 39) | function fillDefaultPdaSeedValuesVisitor(
function addDefaultSeedValuesFromPdaWhenMissing (line 69) | function addDefaultSeedValuesFromPdaWhenMissing(
function getDefaultSeedValuesFromPda (line 81) | function getDefaultSeedValuesFromPda(instruction: InstructionNode, pda: ...
function allSeedsAreValid (line 99) | function allSeedsAreValid(instruction: InstructionNode, foundPda: PdaNod...
FILE: packages/visitors/src/flattenInstructionDataArgumentsVisitor.ts
function flattenInstructionDataArgumentsVisitor (line 12) | function flattenInstructionDataArgumentsVisitor() {
type FlattenInstructionArgumentsConfig (line 27) | type FlattenInstructionArgumentsConfig = string[] | '*';
FILE: packages/visitors/src/flattenStructVisitor.ts
type FlattenStructOptions (line 13) | type FlattenStructOptions = string[] | '*';
function flattenStructVisitor (line 15) | function flattenStructVisitor(map: Record<string, FlattenStructOptions>) {
FILE: packages/visitors/src/getDefinedTypeHistogramVisitor.ts
type DefinedTypeHistogramKey (line 14) | type DefinedTypeHistogramKey = CamelCaseString | `${CamelCaseString}.${C...
type DefinedTypeHistogram (line 16) | type DefinedTypeHistogram = {
function mergeHistograms (line 27) | function mergeHistograms(histograms: DefinedTypeHistogram[]): DefinedTyp...
function getDefinedTypeHistogramVisitor (line 49) | function getDefinedTypeHistogramVisitor(): Visitor<DefinedTypeHistogram> {
FILE: packages/visitors/src/renameHelpers.ts
function renameStructNode (line 14) | function renameStructNode(node: StructTypeNode, map: Record<string, stri...
function renameEnumNode (line 20) | function renameEnumNode(node: EnumTypeNode, map: Record<string, string>)...
function renameEnumVariant (line 27) | function renameEnumVariant(variant: EnumVariantTypeNode, newName: string) {
FILE: packages/visitors/src/setAccountDiscriminatorFromFieldVisitor.ts
function setAccountDiscriminatorFromFieldVisitor (line 14) | function setAccountDiscriminatorFromFieldVisitor(
FILE: packages/visitors/src/setFixedAccountSizesVisitor.ts
function setFixedAccountSizesVisitor (line 13) | function setFixedAccountSizesVisitor() {
FILE: packages/visitors/src/setInstructionAccountDefaultValuesVisitor.ts
type InstructionAccountDefaultRule (line 25) | type InstructionAccountDefaultRule = {
function setInstructionAccountDefaultValuesVisitor (line 139) | function setInstructionAccountDefaultValuesVisitor(rules: InstructionAcc...
FILE: packages/visitors/src/setInstructionDiscriminatorsVisitor.ts
type Discriminator (line 12) | type Discriminator = {
function setInstructionDiscriminatorsVisitor (line 24) | function setInstructionDiscriminatorsVisitor(map: Record<string, Discrim...
FILE: packages/visitors/src/setNumberWrappersVisitor.ts
type NumberWrapper (line 5) | type NumberWrapper =
type NumberWrapperMap (line 10) | type NumberWrapperMap = Record<string, NumberWrapper>;
function setNumberWrappersVisitor (line 12) | function setNumberWrappersVisitor(map: NumberWrapperMap) {
FILE: packages/visitors/src/setStructDefaultValuesVisitor.ts
type StructDefaultValueMap (line 14) | type StructDefaultValueMap = Record<string, Record<string, StructDefault...
type StructDefaultValue (line 15) | type StructDefaultValue = ValueNode | { strategy?: 'omitted' | 'optional...
function setStructDefaultValuesVisitor (line 17) | function setStructDefaultValuesVisitor(map: StructDefaultValueMap) {
FILE: packages/visitors/src/transformDefinedTypesIntoAccountsVisitor.ts
function transformDefinedTypesIntoAccountsVisitor (line 4) | function transformDefinedTypesIntoAccountsVisitor(definedTypes: string[]) {
FILE: packages/visitors/src/transformU8ArraysToBytesVisitor.ts
function transformU8ArraysToBytesVisitor (line 12) | function transformU8ArraysToBytesVisitor(sizes: number[] | '*' = '*') {
FILE: packages/visitors/src/unwrapDefinedTypesVisitor.ts
function unwrapDefinedTypesVisitor (line 15) | function unwrapDefinedTypesVisitor(typesToInline: string[] | '*' = '*') {
FILE: packages/visitors/src/unwrapInstructionArgsDefinedTypesVisitor.ts
function unwrapInstructionArgsDefinedTypesVisitor (line 7) | function unwrapInstructionArgsDefinedTypesVisitor() {
FILE: packages/visitors/src/unwrapTupleEnumWithSingleStructVisitor.ts
function unwrapTupleEnumWithSingleStructVisitor (line 25) | function unwrapTupleEnumWithSingleStructVisitor(enumsOrVariantsToUnwrap:...
FILE: packages/visitors/src/unwrapTypeDefinedLinksVisitor.ts
function unwrapTypeDefinedLinksVisitor (line 9) | function unwrapTypeDefinedLinksVisitor(definedLinksType: string[]) {
FILE: packages/visitors/src/updateAccountsVisitor.ts
type AccountUpdates (line 23) | type AccountUpdates =
function updateAccountsVisitor (line 30) | function updateAccountsVisitor(map: Record<string, AccountUpdates>) {
FILE: packages/visitors/src/updateDefinedTypesVisitor.ts
type DefinedTypeUpdates (line 13) | type DefinedTypeUpdates =
function updateDefinedTypesVisitor (line 19) | function updateDefinedTypesVisitor(map: Record<string, DefinedTypeUpdate...
FILE: packages/visitors/src/updateErrorsVisitor.ts
type ErrorUpdates (line 4) | type ErrorUpdates = Partial<ErrorNodeInput> | { delete: true };
function updateErrorsVisitor (line 6) | function updateErrorsVisitor(map: Record<string, ErrorUpdates>) {
FILE: packages/visitors/src/updateInstructionsVisitor.ts
type InstructionUpdates (line 29) | type InstructionUpdates =
type InstructionAccountUpdates (line 38) | type InstructionAccountUpdates = Record<
type InstructionArgumentUpdates (line 45) | type InstructionArgumentUpdates = Record<
function updateInstructionsVisitor (line 52) | function updateInstructionsVisitor(map: Record<string, InstructionUpdate...
function handleInstructionAccount (line 89) | function handleInstructionAccount(
function handleInstructionArguments (line 112) | function handleInstructionArguments(
FILE: packages/visitors/src/updateProgramsVisitor.ts
type ProgramUpdates (line 4) | type ProgramUpdates =
function updateProgramsVisitor (line 8) | function updateProgramsVisitor(map: Record<string, ProgramUpdates>) {
FILE: tsup.config.base.ts
type Platform (line 6) | type Platform = 'browser' | 'node' | 'react-native';
type BuildOptions (line 8) | type BuildOptions = {
constant BROWSERSLIST_TARGETS (line 13) | const BROWSERSLIST_TARGETS = browsersListToEsBuild();
function getBuildConfig (line 15) | function getBuildConfig(options: BuildOptions): TsupConfig {
function getPackageBuildConfigs (line 61) | function getPackageBuildConfigs(): TsupConfig[] {
function getCliBuildConfig (line 71) | function getCliBuildConfig(): TsupConfig {
Condensed preview — 1211 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,952K chars).
[
{
"path": ".changeset/README.md",
"chars": 510,
"preview": "# Changesets\n\nHello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that wo"
},
{
"path": ".changeset/config.json",
"chars": 586,
"preview": "{\n \"$schema\": \"https://unpkg.com/@changesets/config@3.0.0/schema.json\",\n \"changelog\": [\n \"@changesets/changelog-git"
},
{
"path": ".github/actions/setup-anchor/action.yml",
"chars": 2133,
"preview": "name: Setup Anchor CLI\ndescription: Install Rust toolchain and a pinned Anchor CLI version via AVM with caching for CI.\n"
},
{
"path": ".github/dependabot.yml",
"chars": 193,
"preview": "version: 2\nupdates:\n - package-ecosystem: 'npm'\n directory: '/'\n schedule:\n interval: daily\n time: '01:"
},
{
"path": ".github/workflows/main.yml",
"chars": 3539,
"preview": "name: Main\n\non:\n push:\n branches: [main]\n pull_request:\n\nenv:\n # Among other things, opts out of Turborepo telemet"
},
{
"path": ".gitignore",
"chars": 311,
"preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\nnode_modules\n.pnp\n"
},
{
"path": ".prettierignore",
"chars": 156,
"preview": ".changeset/\n.github/workflows/PULL_REQUEST_TEMPLATE.md\n\ndeclarations/\ndist/\ndoc/\nlib/\ntest-ledger/\ntarget/\nCHANGELOG.md\n"
},
{
"path": "LICENSE",
"chars": 1102,
"preview": "MIT License\n\nCopyright (c) 2025 Codama\nCopyright (c) 2024 Metaplex Foundation\n\nPermission is hereby granted, free of cha"
},
{
"path": "README.md",
"chars": 11821,
"preview": "# Codama\n\n[![npm][npm-image]][npm-url]\n[![npm-downloads][npm-downloads-image]][npm-url]\n[![ci][ci-image]][ci-url]\n\n[npm-"
},
{
"path": "eslint.config.mjs",
"chars": 550,
"preview": "import solanaConfig from '@solana/eslint-config-solana';\nimport { defineConfig } from 'eslint/config';\n\nexport default d"
},
{
"path": "package.json",
"chars": 1118,
"preview": "{\n \"name\": \"codama-monorepo\",\n \"private\": true,\n \"scripts\": {\n \"build\": \"turbo run build --log-order gro"
},
{
"path": "packages/cli/.gitignore",
"chars": 6,
"preview": "dist/\n"
},
{
"path": "packages/cli/.prettierignore",
"chars": 50,
"preview": "dist/\ntest/e2e/\ntest-ledger/\ntarget/\nCHANGELOG.md\n"
},
{
"path": "packages/cli/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2025 Codama\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of "
},
{
"path": "packages/cli/README.md",
"chars": 9857,
"preview": "# Codama ➤ CLI\n\n[![npm][npm-image]][npm-url]\n[![npm-downloads][npm-downloads-image]][npm-url]\n\n[npm-downloads-image]: ht"
},
{
"path": "packages/cli/bin/cli.cjs",
"chars": 88,
"preview": "#!/usr/bin/env -S node\n\nconst run = require('../dist/cli.cjs').run;\n\nrun(process.argv);\n"
},
{
"path": "packages/cli/package.json",
"chars": 1956,
"preview": "{\n \"name\": \"@codama/cli\",\n \"version\": \"1.5.1\",\n \"description\": \"A CLI for setting up and managing Codama IDLs\","
},
{
"path": "packages/cli/src/cli/index.ts",
"chars": 183,
"preview": "import { createProgram, runProgram } from '../program';\n\nconst program = createProgram();\n\nexport async function run(arg"
},
{
"path": "packages/cli/src/commands/convert.ts",
"chars": 752,
"preview": "import { Command } from 'commander';\n\nimport { getRootNodeFromIdl, readJson, writeFile } from '../utils';\n\nexport functi"
},
{
"path": "packages/cli/src/commands/index.ts",
"chars": 74,
"preview": "export * from './init';\nexport * from './run';\nexport * from './convert';\n"
},
{
"path": "packages/cli/src/commands/init.ts",
"chars": 7285,
"preview": "import { Command } from 'commander';\nimport pico from 'picocolors';\nimport prompts, { PromptType } from 'prompts';\n\nimpo"
},
{
"path": "packages/cli/src/commands/run.ts",
"chars": 4411,
"preview": "import type { RootNode } from '@codama/nodes';\nimport { visit, type Visitor } from '@codama/visitors-core';\nimport { Com"
},
{
"path": "packages/cli/src/config.ts",
"chars": 1864,
"preview": "import path from 'node:path';\n\nimport pico from 'picocolors';\n\nimport { ProgramOptions } from './programOptions';\nimport"
},
{
"path": "packages/cli/src/index.ts",
"chars": 27,
"preview": "export * from './program';\n"
},
{
"path": "packages/cli/src/parsedConfig.ts",
"chars": 3763,
"preview": "import type { RootNode } from '@codama/nodes';\nimport { Command } from 'commander';\n\nimport { Config, getConfig, ScriptN"
},
{
"path": "packages/cli/src/program.ts",
"chars": 1777,
"preview": "import { Command, createCommand, ParseOptions } from 'commander';\nimport pico from 'picocolors';\n\nimport { setConvertCom"
},
{
"path": "packages/cli/src/programOptions.ts",
"chars": 482,
"preview": "import { Command } from 'commander';\n\nexport type ProgramOptions = Readonly<{\n config?: string;\n debug?: boolean;\n"
},
{
"path": "packages/cli/src/types/global.d.ts",
"chars": 211,
"preview": "declare const __BROWSER__: boolean;\ndeclare const __ESM__: boolean;\ndeclare const __NODEJS__: boolean;\ndeclare const __R"
},
{
"path": "packages/cli/src/utils/childCommands.ts",
"chars": 2091,
"preview": "import { ChildProcess, spawn, SpawnOptions } from 'child_process';\n\nexport type ChildCommand = {\n command: string;\n "
},
{
"path": "packages/cli/src/utils/errors.ts",
"chars": 230,
"preview": "export class CliError extends Error {\n constructor(\n message: string,\n public items: string[] = [],\n "
},
{
"path": "packages/cli/src/utils/fs.ts",
"chars": 1484,
"preview": "import { R_OK, W_OK } from 'node:constants';\nimport fs, { PathLike } from 'node:fs';\nimport path from 'node:path';\n\nexpo"
},
{
"path": "packages/cli/src/utils/import.ts",
"chars": 3547,
"preview": "import { createRequire } from 'node:module';\n\nimport pico from 'picocolors';\n\nimport { CliError } from './errors';\nimpor"
},
{
"path": "packages/cli/src/utils/index.ts",
"chars": 338,
"preview": "export * from './childCommands';\nexport * from './errors';\nexport * from './fs';\nexport * from './import';\nexport * from"
},
{
"path": "packages/cli/src/utils/logs.ts",
"chars": 1871,
"preview": "import pico from 'picocolors';\n\ntype LogLevel = 'debug' | 'error' | 'info' | 'success' | 'warning';\n\ntype LogOptions = {"
},
{
"path": "packages/cli/src/utils/nodes.ts",
"chars": 1272,
"preview": "import type { RootNode } from '@codama/nodes';\n\nimport { CliError } from './errors';\nimport { importModuleItem } from '."
},
{
"path": "packages/cli/src/utils/packageInstall.ts",
"chars": 2557,
"preview": "import pico from 'picocolors';\nimport prompts from 'prompts';\n\nimport { ChildCommand, createChildCommand, formatChildCom"
},
{
"path": "packages/cli/src/utils/packageJson.ts",
"chars": 1201,
"preview": "import pico from 'picocolors';\n\nimport { CliError } from './errors';\nimport { canRead, readJson, resolveRelativePath } f"
},
{
"path": "packages/cli/src/utils/packageManager.ts",
"chars": 2647,
"preview": "import { createChildCommand, spawnChildCommand } from './childCommands';\nimport { canRead, resolveRelativePath } from '."
},
{
"path": "packages/cli/src/utils/promises.ts",
"chars": 103,
"preview": "export function promisify<T>(value: Promise<T> | T): Promise<T> {\n return Promise.resolve(value);\n}\n"
},
{
"path": "packages/cli/src/utils/prompts.ts",
"chars": 203,
"preview": "import prompts from 'prompts';\n\nimport { CliError } from './errors';\n\nexport const PROMPT_OPTIONS: prompts.Options = {\n "
},
{
"path": "packages/cli/src/utils/visitors.ts",
"chars": 2342,
"preview": "import type { RootNode } from '@codama/nodes';\nimport { rootNodeVisitor, visit, type Visitor } from '@codama/visitors-co"
},
{
"path": "packages/cli/test/exports/commonjs.cjs",
"chars": 192,
"preview": "const path = require('path');\nconst { codama } = require('../../dist/index.node.cjs');\n\nconst configPath = path.join('te"
},
{
"path": "packages/cli/test/exports/mock-config.json",
"chars": 102,
"preview": "{\n \"idl\": \"mock-idl.json\",\n \"before\": [\"@codama/visitors#identityVisitor\"],\n \"scripts\": {}\n}\n"
},
{
"path": "packages/cli/test/exports/mock-idl.json",
"chars": 312,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.0.0\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/cli/test/exports/module.mjs",
"chars": 182,
"preview": "import path from 'path';\nimport { codama } from '../../dist/index.node.mjs';\n\nconst configPath = path.join('test', 'expo"
},
{
"path": "packages/cli/test/index.test.ts",
"chars": 198,
"preview": "import { expect, test } from 'vitest';\n\nimport { createProgram } from '../src';\n\ntest('it exports a function to create a"
},
{
"path": "packages/cli/tsconfig.declarations.json",
"chars": 246,
"preview": "{\n \"compilerOptions\": {\n \"declaration\": true,\n \"declarationMap\": true,\n \"emitDeclarationOnly\": t"
},
{
"path": "packages/cli/tsconfig.json",
"chars": 213,
"preview": "{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"compilerOptions\": {\n \"module\": \"ESNext\"\n },\n "
},
{
"path": "packages/cli/tsup.config.ts",
"chars": 1007,
"preview": "import { defineConfig, Options as TsupConfig } from 'tsup';\n\nimport { getBuildConfig, getCliBuildConfig } from '../../ts"
},
{
"path": "packages/cli/vitest.config.mts",
"chars": 209,
"preview": "import { defineConfig } from 'vitest/config';\nimport { getVitestConfig } from '../../vitest.config.base.mjs';\n\nexport de"
},
{
"path": "packages/dynamic-client/.gitignore",
"chars": 90,
"preview": "dist/\ntest/programs/anchor/.anchor/\ntest/programs/anchor/target/\ntest/programs/generated/\n"
},
{
"path": "packages/dynamic-client/.prettierignore",
"chars": 66,
"preview": "dist/\ntest/e2e/\ntest-ledger/\ntarget/\nCHANGELOG.md\ngenerated/\nidls/"
},
{
"path": "packages/dynamic-client/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2025 Codama\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of "
},
{
"path": "packages/dynamic-client/README.md",
"chars": 8242,
"preview": "# Codama ➤ Dynamic Client\n\n[![npm][npm-image]][npm-url]\n[![npm-downloads][npm-downloads-image]][npm-url]\n\n[npm-downloads"
},
{
"path": "packages/dynamic-client/bin/cli.cjs",
"chars": 85,
"preview": "#!/usr/bin/env node\n\nconst run = require('../dist/cli.cjs').run;\n\nrun(process.argv);\n"
},
{
"path": "packages/dynamic-client/package.json",
"chars": 3345,
"preview": "{\n \"name\": \"@codama/dynamic-client\",\n \"version\": \"0.1.0\",\n \"description\": \"Tool to dynamically build instructio"
},
{
"path": "packages/dynamic-client/scripts/generate-idl-from-anchor.mjs",
"chars": 1080,
"preview": "import { readFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { rootNodeFromAnchor } from '@codama/nodes"
},
{
"path": "packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types-from-file.ts",
"chars": 1974,
"preview": "import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { cr"
},
{
"path": "packages/dynamic-client/src/cli/commands/generate-client-types/generate-client-types.ts",
"chars": 13742,
"preview": "import type {\n DefinedTypeNode,\n InstructionAccountNode,\n InstructionInputValueNode,\n InstructionNode,\n P"
},
{
"path": "packages/dynamic-client/src/cli/commands/generate-client-types/register-command.ts",
"chars": 677,
"preview": "import type { Command } from 'commander';\n\nimport { generateClientTypesFromFile } from './generate-client-types-from-fil"
},
{
"path": "packages/dynamic-client/src/cli/commands/index.ts",
"chars": 249,
"preview": "import type { Command } from 'commander';\n\nimport { registerGenerateClientTypesCommand } from './generate-client-types/r"
},
{
"path": "packages/dynamic-client/src/cli/index.ts",
"chars": 279,
"preview": "import { createProgram } from './program';\n\nconst program = createProgram();\n\nexport function run(argv: string[]): void "
},
{
"path": "packages/dynamic-client/src/cli/program.ts",
"chars": 326,
"preview": "import { Command } from 'commander';\n\nimport { registerCommands } from './commands';\n\nexport function createProgram(): C"
},
{
"path": "packages/dynamic-client/src/index.ts",
"chars": 1860,
"preview": "export type { ProgramDerivedAddress } from '@solana/addresses';\n\nexport { isPublicKeyLike, toAddress } from './shared/ad"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/accounts/create-account-meta.ts",
"chars": 7800,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,\n CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,\n CODA"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/accounts/index.ts",
"chars": 133,
"preview": "export { createAccountMeta } from './create-account-meta';\nexport { createAccountsInputValidator } from './validate-acco"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/accounts/validate-accounts-input.ts",
"chars": 1979,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,\n CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT,\n"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/arguments/encode-instruction-arguments.ts",
"chars": 4035,
"preview": "import { getNodeCodec, type ReadonlyUint8Array } from '@codama/dynamic-codecs';\nimport {\n CODAMA_ERROR__DYNAMIC_CLIEN"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/arguments/index.ts",
"chars": 256,
"preview": "export { encodeInstructionArguments } from './encode-instruction-arguments';\nexport { createArgumentsInputValidator } fr"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/arguments/resolve-argument-from-custom-resolvers.ts",
"chars": 2029,
"preview": "import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, CodamaError } from '@codama/errors';\nimport type { In"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/arguments/shared.ts",
"chars": 443,
"preview": "import type { InstructionArgumentNode } from 'codama';\n\nimport { OPTIONAL_NODE_KINDS } from '../../shared/nodes';\n\nexpor"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/arguments/validate-arguments-input.ts",
"chars": 4631,
"preview": "import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_VALIDATE_INPUT, CodamaError } from '@codama/errors';\nimport type { Inst"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/index.ts",
"chars": 1164,
"preview": "// accounts\nexport { createAccountMeta } from './accounts/create-account-meta';\nexport { createAccountsInputValidator } "
},
{
"path": "packages/dynamic-client/src/instruction-encoding/instructions.ts",
"chars": 1803,
"preview": "import { address } from '@solana/addresses';\nimport type { InstructionNode, RootNode } from 'codama';\n\nimport type { Bui"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/index.ts",
"chars": 361,
"preview": "export { resolveAccountAddress } from './resolve-account-address';\nexport { resolveAccountValueNodeAddress } from './res"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-address.ts",
"chars": 3815,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,\n CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,\n C"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/resolve-account-value-node-address.ts",
"chars": 2373,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__CIRCULAR_ACCOUNT_DEPENDENCY,\n CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/resolve-conditional.ts",
"chars": 3394,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,\n CODAMA_ERROR__UNEXPECTED_NODE_KIND,\n CodamaError,"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/resolve-pda-address.ts",
"chars": 7040,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__INVARIANT_VIOLATION,\n CODAMA_ERROR__DYNAMIC_CLIENT__NODE_REFERENCE_NOT_FOU"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/resolvers/types.ts",
"chars": 690,
"preview": "import type { InstructionNode, RootNode } from 'codama';\n\nimport type { AccountsInput, ArgumentsInput, ResolversInput } "
},
{
"path": "packages/dynamic-client/src/instruction-encoding/validators.ts",
"chars": 21631,
"preview": "import { isAddress } from '@solana/addresses';\nimport type {\n ArrayTypeNode,\n CountNode,\n DefinedTypeNode,\n "
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/account-default-value.ts",
"chars": 8680,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_MISSING,\n CODAMA_ERROR__DYNAMIC_CLIENT__ACCOUNT_RESOLVER_MISSING,\n"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/condition-node-value.ts",
"chars": 2805,
"preview": "import { CODAMA_ERROR__DYNAMIC_CLIENT__FAILED_TO_EXECUTE_RESOLVER, CodamaError } from '@codama/errors';\nimport type { Vi"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/default-value-encoder.ts",
"chars": 1622,
"preview": "import type { ReadonlyUint8Array } from '@solana/codecs';\nimport type { Visitor } from 'codama';\nimport type {\n Boole"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/index.ts",
"chars": 502,
"preview": "export { createAccountDefaultValueVisitor } from './account-default-value';\nexport { createConditionNodeValueVisitor } f"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/input-value-transformer.ts",
"chars": 14634,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__UNEXPECTED_ARGUMENT_TYPE,\n CODAMA_ERROR__LINKED_NODE_NOT_FOUND,\n CODAMA"
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/pda-seed-value.ts",
"chars": 7352,
"preview": "import { getNodeCodec } from '@codama/dynamic-codecs';\nimport {\n CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,\n "
},
{
"path": "packages/dynamic-client/src/instruction-encoding/visitors/value-node-value.ts",
"chars": 5943,
"preview": "import { CODAMA_ERROR__UNEXPECTED_NODE_KIND, CodamaError } from '@codama/errors';\nimport { address } from '@solana/addre"
},
{
"path": "packages/dynamic-client/src/program-client/collect-pdas.ts",
"chars": 946,
"preview": "import { isNode, type PdaNode, type RootNode } from 'codama';\n\n/**\n * Collects unique PDA definitions from the IDL.\n *\n "
},
{
"path": "packages/dynamic-client/src/program-client/create-program-client.ts",
"chars": 5146,
"preview": "import {\n CODAMA_ERROR__DYNAMIC_CLIENT__INSTRUCTION_NOT_FOUND,\n CODAMA_ERROR__DYNAMIC_CLIENT__PDA_NOT_FOUND,\n C"
},
{
"path": "packages/dynamic-client/src/program-client/derive-standalone-pda.ts",
"chars": 5352,
"preview": "import { getNodeCodec } from '@codama/dynamic-codecs';\nimport {\n CODAMA_ERROR__DYNAMIC_CLIENT__ARGUMENT_MISSING,\n "
},
{
"path": "packages/dynamic-client/src/program-client/methods-builder.ts",
"chars": 1404,
"preview": "import type { Instruction } from '@solana/instructions';\nimport type { InstructionNode, RootNode } from 'codama';\n\nimpor"
},
{
"path": "packages/dynamic-client/src/shared/address.ts",
"chars": 1315,
"preview": "import { CODAMA_ERROR__DYNAMIC_CLIENT__CANNOT_CONVERT_TO_ADDRESS, CodamaError } from '@codama/errors';\nimport type { Add"
},
{
"path": "packages/dynamic-client/src/shared/bytes-encoding.ts",
"chars": 1418,
"preview": "import { CODAMA_ERROR__UNRECOGNIZED_BYTES_ENCODING, CodamaError } from '@codama/errors';\nimport type { BytesEncoding } f"
},
{
"path": "packages/dynamic-client/src/shared/codecs.ts",
"chars": 1653,
"preview": "import { getAddressEncoder } from '@solana/addresses';\nimport type { Encoder } from '@solana/codecs';\nimport {\n getBa"
},
{
"path": "packages/dynamic-client/src/shared/nodes.ts",
"chars": 108,
"preview": "export const OPTIONAL_NODE_KINDS = ['optionTypeNode', 'zeroableOptionTypeNode', 'remainderOptionTypeNode'];\n"
},
{
"path": "packages/dynamic-client/src/shared/types.ts",
"chars": 788,
"preview": "import type { Instruction } from '@solana/instructions';\n\nimport type { AddressInput } from './address';\n\n// Note: optio"
},
{
"path": "packages/dynamic-client/src/shared/util.ts",
"chars": 1257,
"preview": "import type { NodeKind } from 'codama';\n\n/**\n * Checks if a value is a plain object record (struct-like).\n */\nexport fun"
},
{
"path": "packages/dynamic-client/src/types/index.ts",
"chars": 295,
"preview": "export type { AddressInput, PublicKeyLike } from '../shared/address';\nexport type { AccountsInput, ArgumentsInput } from"
},
{
"path": "packages/dynamic-client/test/programs/anchor/Anchor.toml",
"chars": 389,
"preview": "[toolchain]\n\n[features]\nresolution = true\nskip-lint = false\n\n[programs.localnet]\nanchor-codama = \"5xjPsgMHuoj4MrAPJVBrTo"
},
{
"path": "packages/dynamic-client/test/programs/anchor/Cargo.toml",
"chars": 209,
"preview": "[workspace]\nmembers = [\"programs/*\"]\nresolver = \"2\"\n\n[profile.release]\noverflow-checks = true\nlto = \"fat\"\ncodegen-units "
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/blog/Cargo.toml",
"chars": 327,
"preview": "[package]\nname = \"blog\"\nversion = \"0.1.0\"\ndescription = \"Created with Anchor\"\nedition = \"2021\"\n\n[lib]\ncrate-type = [\"cdy"
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/blog/Xargo.toml",
"chars": 62,
"preview": "[target.bpfel-unknown-unknown.dependencies.std]\nfeatures = []\n"
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/blog/src/lib.rs",
"chars": 9207,
"preview": "#![allow(unexpected_cfgs)]\nuse anchor_lang::prelude::*;\n\ndeclare_id!(\"1rAs9KgDjEnMVrU1nJPWVhN4b6W4VEBxzcNJoeJpbVR\");\n\n#["
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/example/Cargo.toml",
"chars": 379,
"preview": "[package]\nname = \"example\"\nversion = \"0.1.0\"\ndescription = \"Created with Anchor\"\nedition = \"2021\"\n\n[lib]\ncrate-type = [\""
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/example/Xargo.toml",
"chars": 62,
"preview": "[target.bpfel-unknown-unknown.dependencies.std]\nfeatures = []\n"
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/example/src/lib.rs",
"chars": 7692,
"preview": "#![allow(unexpected_cfgs)]\nuse anchor_lang::prelude::*;\n\nuse anchor_spl::{token::{Token, Mint, TokenAccount}, associated"
},
{
"path": "packages/dynamic-client/test/programs/anchor/programs/example/src/nested_example.rs",
"chars": 3559,
"preview": "\nuse anchor_lang::prelude::*;\nuse anchor_lang::Space;\n\n// All arguments are stored in the NestedExampleAccount.input fie"
},
{
"path": "packages/dynamic-client/test/programs/anchor/rust-toolchain.toml",
"chars": 31,
"preview": "[toolchain]\nchannel = \"1.93.0\"\n"
},
{
"path": "packages/dynamic-client/test/programs/anchor/tests/blog.test.ts",
"chars": 17331,
"preview": "import path from 'node:path';\n\nimport { getNodeCodec } from '@codama/dynamic-codecs';\nimport { type Address, getProgramD"
},
{
"path": "packages/dynamic-client/test/programs/anchor/tests/example.test.ts",
"chars": 12824,
"preview": "import { getNodeCodec } from '@codama/dynamic-codecs';\nimport { type Address, getAddressEncoder, getProgramDerivedAddres"
},
{
"path": "packages/dynamic-client/test/programs/anchor/tests/helpers.ts",
"chars": 955,
"preview": "import path from 'node:path';\n\nimport { createProgramClient } from '../../../../src';\nimport type { ExampleProgramClient"
},
{
"path": "packages/dynamic-client/test/programs/anchor/tests/nested-example-ix.test.ts",
"chars": 25914,
"preview": "import { getNodeCodec } from '@codama/dynamic-codecs';\nimport { type Address, getAddressEncoder, getProgramDerivedAddres"
},
{
"path": "packages/dynamic-client/test/programs/associated-token-account/ata-test-utils.ts",
"chars": 1529,
"preview": "import type { Address } from '@solana/addresses';\n\nimport type { SplAssociatedTokenAccountProgramClient } from '../gener"
},
{
"path": "packages/dynamic-client/test/programs/associated-token-account/create-idempotent.test.ts",
"chars": 2104,
"preview": "import { findAssociatedTokenPda, getTokenDecoder } from '@solana-program/token';\nimport { beforeEach, describe, expect, "
},
{
"path": "packages/dynamic-client/test/programs/associated-token-account/create.test.ts",
"chars": 1619,
"preview": "import { findAssociatedTokenPda, getTokenDecoder } from '@solana-program/token';\nimport { beforeEach, describe, expect, "
},
{
"path": "packages/dynamic-client/test/programs/associated-token-account/recover-nested.test.ts",
"chars": 4089,
"preview": "import { findAssociatedTokenPda, getTokenDecoder } from '@solana-program/token';\nimport { beforeEach, describe, expect, "
},
{
"path": "packages/dynamic-client/test/programs/circular-account-refs/circular-account-refs.test.ts",
"chars": 3287,
"preview": "import { address } from '@solana/addresses';\nimport { describe, expect, test } from 'vitest';\n\nimport type { CircularAcc"
},
{
"path": "packages/dynamic-client/test/programs/collection-types/collection-types.test.ts",
"chars": 9276,
"preview": "import { getNodeCodec, type ReadonlyUint8Array } from '@codama/dynamic-codecs';\nimport { type Address } from '@solana/ad"
},
{
"path": "packages/dynamic-client/test/programs/custom-resolvers/account-resolver.test.ts",
"chars": 6252,
"preview": "import type { Address } from '@solana/addresses';\nimport { beforeEach, describe, expect, test } from 'vitest';\n\nimport {"
},
{
"path": "packages/dynamic-client/test/programs/custom-resolvers/argument-resolvers.test.ts",
"chars": 6106,
"preview": "import type { Address } from '@solana/addresses';\nimport {\n addEncoderSizePrefix,\n getOptionEncoder,\n getU8Enco"
},
{
"path": "packages/dynamic-client/test/programs/custom-resolvers/custom-resolvers-test-utils.ts",
"chars": 289,
"preview": "import { type CustomResolversTestProgramClient } from '../generated/custom-resolvers-test-idl-types';\nimport { createTes"
},
{
"path": "packages/dynamic-client/test/programs/idls/associated-token-account-idl.json",
"chars": 11725,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.3.7\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/blog-idl.json",
"chars": 79903,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.5.1\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/circular-account-refs-idl.json",
"chars": 4482,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.3.7\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/collection-types-idl.json",
"chars": 17767,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.5.1\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/custom-resolvers-test-idl.json",
"chars": 10977,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.5.1\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/example-idl.json",
"chars": 77669,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.5.1\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/mpl-token-metadata-idl.json",
"chars": 1475722,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.5.0\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/pmp-idl.json",
"chars": 51089,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.0.0\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/sas-idl.json",
"chars": 70225,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.3.7\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/system-program-idl.json",
"chars": 41194,
"preview": "{\n \"kind\": \"rootNode\",\n \"program\": {\n \"kind\": \"programNode\",\n \"pdas\": [],\n \"accounts\": [\n "
},
{
"path": "packages/dynamic-client/test/programs/idls/token-2022-idl.json",
"chars": 486938,
"preview": "{\n \"kind\": \"rootNode\",\n \"standard\": \"codama\",\n \"version\": \"1.0.0\",\n \"program\": {\n \"kind\": \"programNod"
},
{
"path": "packages/dynamic-client/test/programs/idls/token-idl.json",
"chars": 117567,
"preview": "{\n \"kind\": \"rootNode\",\n \"program\": {\n \"kind\": \"programNode\",\n \"pdas\": [],\n \"accounts\": [\n "
},
{
"path": "packages/dynamic-client/test/programs/mpl-token-metadata/create-with-resolvers.test.ts",
"chars": 9629,
"preview": "import {\n findMasterEditionPda,\n findMetadataPda,\n getMetadataDecoder,\n TokenStandard,\n} from '@metaplex-fou"
},
{
"path": "packages/dynamic-client/test/programs/mpl-token-metadata/create.test.ts",
"chars": 8453,
"preview": "import {\n findMasterEditionPda,\n findMetadataPda,\n getMetadataDecoder,\n TokenStandard,\n} from '@metaplex-fou"
},
{
"path": "packages/dynamic-client/test/programs/mpl-token-metadata/helpers.ts",
"chars": 740,
"preview": "import path from 'node:path';\n\nimport { type Address } from '@solana/addresses';\n\nimport type { MplTokenMetadataProgramC"
},
{
"path": "packages/dynamic-client/test/programs/pmp/allocate.test.ts",
"chars": 3765,
"preview": "import { type Address } from '@solana/addresses';\nimport type { Some } from '@solana/codecs';\nimport { AccountDiscrimina"
},
{
"path": "packages/dynamic-client/test/programs/pmp/close.test.ts",
"chars": 4778,
"preview": "import { type Address } from '@solana/addresses';\nimport { beforeEach, describe, expect, test } from 'vitest';\n\nimport {"
},
{
"path": "packages/dynamic-client/test/programs/pmp/extend.test.ts",
"chars": 3550,
"preview": "import { type Address } from '@solana/addresses';\nimport { beforeEach, describe, expect, test } from 'vitest';\n\nimport {"
},
{
"path": "packages/dynamic-client/test/programs/pmp/helpers.ts",
"chars": 10143,
"preview": "import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { type Address, getAddressEncoder, getProgramDerivedAddr"
},
{
"path": "packages/dynamic-client/test/programs/pmp/initialize.test.ts",
"chars": 12412,
"preview": "import { type Address } from '@solana/addresses';\nimport type { Some } from '@solana/codecs';\nimport { AccountDiscrimina"
},
{
"path": "packages/dynamic-client/test/programs/pmp/pdas.test.ts",
"chars": 6250,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport { SvmTestContext } from '../test-utils';\nimport {\n "
},
{
"path": "packages/dynamic-client/test/programs/pmp/set-authority.test.ts",
"chars": 4062,
"preview": "import type { Address } from '@solana/addresses';\nimport type { Some } from '@solana/codecs';\nimport { beforeEach, descr"
},
{
"path": "packages/dynamic-client/test/programs/pmp/set-data.test.ts",
"chars": 7606,
"preview": "import type { Address } from '@solana/addresses';\nimport type { Some } from '@solana/codecs';\nimport { Compression, Data"
},
{
"path": "packages/dynamic-client/test/programs/pmp/set-immutable.test.ts",
"chars": 3589,
"preview": "import type { Address } from '@solana/addresses';\nimport type { Some } from '@solana/codecs';\nimport { beforeEach, descr"
},
{
"path": "packages/dynamic-client/test/programs/pmp/trim.test.ts",
"chars": 2680,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport { SvmTestContext } from '../test-utils';\nimport { d"
},
{
"path": "packages/dynamic-client/test/programs/pmp/write.test.ts",
"chars": 4607,
"preview": "import { AccountDiscriminator } from '@solana-program/program-metadata';\nimport { beforeEach, describe, expect, test } f"
},
{
"path": "packages/dynamic-client/test/programs/sas/change-authorized-signers.test.ts",
"chars": 2467,
"preview": "import { type Address } from '@solana/addresses';\nimport { getCredentialDecoder } from 'sas-lib';\nimport { beforeEach, d"
},
{
"path": "packages/dynamic-client/test/programs/sas/change-schema-description.test.ts",
"chars": 2806,
"preview": "import { type Address } from '@solana/addresses';\nimport { getSchemaDecoder } from 'sas-lib';\nimport { beforeEach, descr"
},
{
"path": "packages/dynamic-client/test/programs/sas/change-schema-status.test.ts",
"chars": 3908,
"preview": "import { type Address } from '@solana/addresses';\nimport { getSchemaDecoder } from 'sas-lib';\nimport { beforeEach, descr"
},
{
"path": "packages/dynamic-client/test/programs/sas/change-schema-version.test.ts",
"chars": 5141,
"preview": "import { type Address } from '@solana/addresses';\nimport { deriveSchemaPda, getSchemaDecoder } from 'sas-lib';\nimport { "
},
{
"path": "packages/dynamic-client/test/programs/sas/close-attestation.test.ts",
"chars": 3896,
"preview": "import { type Address } from '@solana/addresses';\nimport { deriveEventAuthorityAddress } from 'sas-lib';\nimport { before"
},
{
"path": "packages/dynamic-client/test/programs/sas/close-tokenized-attestation.test.ts",
"chars": 6478,
"preview": "import { type Address } from '@solana/addresses';\nimport { findAssociatedTokenPda } from '@solana-program/token';\nimport"
},
{
"path": "packages/dynamic-client/test/programs/sas/create-attestation.test.ts",
"chars": 4574,
"preview": "import { type Address } from '@solana/addresses';\nimport { deriveAttestationPda, getAttestationDecoder, serializeAttesta"
},
{
"path": "packages/dynamic-client/test/programs/sas/create-credential.test.ts",
"chars": 2765,
"preview": "import { type Address } from '@solana/addresses';\nimport { deriveCredentialPda, getCredentialDecoder } from 'sas-lib';\ni"
},
{
"path": "packages/dynamic-client/test/programs/sas/create-schema.test.ts",
"chars": 5194,
"preview": "import { type Address } from '@solana/addresses';\nimport { getU32Encoder } from '@solana/codecs';\nimport { deriveSchemaP"
},
{
"path": "packages/dynamic-client/test/programs/sas/create-tokenized-attestation.test.ts",
"chars": 8003,
"preview": "import { type Address } from '@solana/addresses';\nimport { findAssociatedTokenPda } from '@solana-program/token';\nimport"
},
{
"path": "packages/dynamic-client/test/programs/sas/sas-test-utils.ts",
"chars": 6051,
"preview": "import path from 'node:path';\n\nimport { type Address } from '@solana/addresses';\nimport { getMintSize } from '@solana-pr"
},
{
"path": "packages/dynamic-client/test/programs/sas/tokenize-schema.test.ts",
"chars": 4168,
"preview": "import { type Address } from '@solana/addresses';\nimport { deriveSasAuthorityAddress, deriveSchemaMintPda } from 'sas-li"
},
{
"path": "packages/dynamic-client/test/programs/system-program/advance-nonce-account.test.ts",
"chars": 3914,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/allocate-with-seed.test.ts",
"chars": 2066,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/allocate.test.ts",
"chars": 1337,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/assign-with-seed.test.ts",
"chars": 1879,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/assign.test.ts",
"chars": 2002,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/authorize-nonce-account.test.ts",
"chars": 6932,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/create-account-with-seed.test.ts",
"chars": 1798,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/create-account.test.ts",
"chars": 1584,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/initialize-nonce-account.test.ts",
"chars": 3701,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/transfer-sol-with-seed.test.ts",
"chars": 2417,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/transfer-sol.test.ts",
"chars": 1547,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/upgrade-nonce-account.test.ts",
"chars": 1804,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/system-program/withdraw-nonce-account.test.ts",
"chars": 2579,
"preview": "import { beforeEach, describe, expect, test } from 'vitest';\n\nimport type { SystemProgramClient } from '../generated/sys"
},
{
"path": "packages/dynamic-client/test/programs/test-utils.ts",
"chars": 1468,
"preview": "import { readFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { createFromJson, type RootNode } from 'co"
},
{
"path": "packages/dynamic-client/test/programs/token/amount-to-ui-amount.test.ts",
"chars": 932,
"preview": "import { describe, expect, test } from 'vitest';\n\nimport { SvmTestContext } from '../test-utils';\nimport { createMint, t"
},
{
"path": "packages/dynamic-client/test/programs/token/approve-checked.test.ts",
"chars": 1635,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/approve.test.ts",
"chars": 4085,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/burn-checked.test.ts",
"chars": 1450,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/burn.test.ts",
"chars": 1698,
"preview": "import { getMintDecoder, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest'"
},
{
"path": "packages/dynamic-client/test/programs/token/close-account.test.ts",
"chars": 1197,
"preview": "import { describe, expect, test } from 'vitest';\n\nimport { SvmTestContext } from '../test-utils';\nimport { createMint, c"
},
{
"path": "packages/dynamic-client/test/programs/token/freeze-account.test.ts",
"chars": 1280,
"preview": "import { AccountState, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n"
},
{
"path": "packages/dynamic-client/test/programs/token/get-account-data-size.test.ts",
"chars": 924,
"preview": "import { getU64Decoder } from '@solana/codecs';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmTestContex"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-account.test.ts",
"chars": 1086,
"preview": "import { AccountState, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-account2.test.ts",
"chars": 1776,
"preview": "import { AccountState, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-account3.test.ts",
"chars": 1772,
"preview": "import { AccountState, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-immutable-owner.test.ts",
"chars": 1871,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-mint.test.ts",
"chars": 1657,
"preview": "import { getMintDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmTe"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-mint2.test.ts",
"chars": 1756,
"preview": "import { getMintDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmTe"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-multisig.test.ts",
"chars": 1843,
"preview": "import { getMultisigDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { S"
},
{
"path": "packages/dynamic-client/test/programs/token/initialize-multisig2.test.ts",
"chars": 1859,
"preview": "import { getMultisigDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { S"
},
{
"path": "packages/dynamic-client/test/programs/token/mint-to-checked.test.ts",
"chars": 1199,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/mint-to.test.ts",
"chars": 1165,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/revoke.test.ts",
"chars": 1731,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/set-authority.test.ts",
"chars": 1126,
"preview": "import { getMintDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmTe"
},
{
"path": "packages/dynamic-client/test/programs/token/sync-native.test.ts",
"chars": 2481,
"preview": "import { address } from '@solana/addresses';\nimport { getTokenDecoder } from '@solana-program/token';\nimport { describe,"
},
{
"path": "packages/dynamic-client/test/programs/token/thaw-account.test.ts",
"chars": 1542,
"preview": "import { AccountState, getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n"
},
{
"path": "packages/dynamic-client/test/programs/token/token-test-utils.ts",
"chars": 2173,
"preview": "import type { Address } from '@solana/addresses';\n\nimport type { SystemProgramClient } from '../generated/system-program"
},
{
"path": "packages/dynamic-client/test/programs/token/transfer-checked.test.ts",
"chars": 1798,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/transfer.test.ts",
"chars": 1734,
"preview": "import { getTokenDecoder } from '@solana-program/token';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmT"
},
{
"path": "packages/dynamic-client/test/programs/token/ui-amount-to-amount.test.ts",
"chars": 945,
"preview": "import { getU64Decoder } from '@solana/codecs';\nimport { describe, expect, test } from 'vitest';\n\nimport { SvmTestContex"
}
]
// ... and 1011 more files (download for full content)
About this extraction
This page contains the full source code of the codama-idl/codama GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1211 files (4.4 MB), approximately 1.2M tokens, and a symbol index with 1166 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.