Skip to content

Instantly share code, notes, and snippets.

@Jac0xb
Jac0xb / anchor_dependency_linker.ts
Last active July 12, 2023 09:45
Link external rust IDL structs into a main IDL. Created for sniper.xyz sniper market IDL linking.
/* eslint-disable no-prototype-builtins */
import { Project, SourceFile, VariableDeclarationKind } from 'ts-morph';
import prettier from 'prettier';
import * as fs from 'fs';
import colors from 'colors';
// This works if you reference the struct in the instruction parameters EX:
// pub fn buy_tensor_pool_listing_v1<'info>(
// ctx: Context<'_, '_, '_, 'info, BuyTensorPoolListingV1<'info>>,
// config: tensorswap::PoolConfig,