UNPKG

@honeycomb-protocol/solita

Version:

Generates SDK API from solana contract IDL.

42 lines (41 loc) 1.72 kB
import { RustbinConfig } from '@metaplex-foundation/rustbin'; import { Idl, IdlDefinedTypeDefinition, IdlType, Serializers, TypeAliases } from '../types'; export { RustbinConfig }; export type SolitaConfigBase = { programName: string; idlDir: string; sdkDir: string; binaryInstallDir: string; programDir: string; idlHook?: (idl: Idl) => Idl; idlHookPostAdaption?: (idl: Idl) => Idl; customTypeMappers?: CustomTypeMapper[]; idlTypeFallback?: IdlTypeFallback; externalImports?: Record<string, string>; rustbin?: RustbinConfig; typeAliases?: TypeAliases; serializers?: Serializers; removeExistingIdl?: boolean; binaryArgs?: string; skipIdlBuildIfExists?: boolean; }; export type CustomTypeMapper = (strType: string, resolveType: (strType: string) => IdlType, registerGeneratedType: (def: IdlDefinedTypeDefinition) => void) => IdlType | null; export type IdlTypeFallback = (strType: string, resolveType: (strType: string) => IdlType) => IdlType | null; export type SolitaConfigAnchor = SolitaConfigBase & { idlGenerator: 'anchor'; programId: string; anchorRemainingAccounts?: boolean; }; export type SolitaConfigShank = SolitaConfigBase & { idlGenerator: 'shank'; }; export type SolitaConfig = SolitaConfigAnchor | SolitaConfigShank; export type SolitaHandlerResult = { exitCode: number; errorMsg?: string; }; export declare function isSolitaConfigAnchor(config: SolitaConfig): config is SolitaConfigAnchor; export declare function isSolitaConfigShank(config: SolitaConfig): config is SolitaConfigShank; export declare function isErrorResult(result: SolitaHandlerResult): result is SolitaHandlerResult & { errorMsg: string; };