@kinobi-so/nodes-from-anchor
TypeScript icon, indicating that this package has built-in type declarations

0.21.2 • Public • Published

Kinobi ➤ Nodes From Anchor

npm npm-downloads

This package converts Anchor IDLs from various versions into Kinobi IDLs.

Installation

pnpm install @kinobi-so/nodes-from-anchor

[!NOTE] This package is not included in the main kinobi package.

Functions

rootNodeFromAnchor(anchorIdl)

This function takes a valid Anchor IDL and returns a RootNode.

// node ./kinobi.mjs
import { rootNodeFromAnchor } from '@kinobi-so/nodes-from-anchor';
import { createFromRoot } from 'kinobi';
import { readFileSync } from 'node:fs';
import path from 'path';

// Read the content of your IDL file.
const anchorIdlPath = path.join(__dirname, 'target', 'idl', 'anchor_program.json');
const anchorIdl = JSON.parse(readFileSync(anchorIdlPath, 'utf-8'));

// Parse it into a Kinobi IDL.
const kinobi = createFromRoot(rootNodeFromAnchor(anchorIdl));

Package Sidebar

Install

npm i @kinobi-so/nodes-from-anchor

Weekly Downloads

359

Version

0.21.2

License

MIT

Unpacked Size

680 kB

Total Files

111

Last publish

Collaborators

  • lorisleiva