Skip to content

Commit 2ca10bc

Browse files
committed
fix codama-idl generation and add meteora example
1 parent 5e06fdf commit 2ca10bc

File tree

97 files changed

+46460
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+46460
-635
lines changed

packages/nodes-from-anchor/src/v00/ProgramNode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import { instructionNodeFromAnchorV00 } from './InstructionNode';
88
import { pdaNodeFromAnchorV00 } from './PdaNode';
99

1010
export function programNodeFromAnchorV00(idl: IdlV00): ProgramNode {
11-
const origin = (idl.metadata as { origin?: 'anchor' | 'shank' }).origin ?? 'anchor';
11+
const origin = (idl?.metadata as { origin?: 'anchor' | 'shank' })?.origin ?? 'anchor';
1212
const pdas = (idl.accounts ?? []).filter(account => (account.seeds ?? []).length > 0).map(pdaNodeFromAnchorV00);
1313
const accounts = (idl.accounts ?? []).map(a => accountNodeFromAnchorV00(a, origin));
1414
const instructions = (idl.instructions ?? []).map(i => instructionNodeFromAnchorV00(i, origin));
1515
return programNode({
1616
accounts,
17-
definedTypes: (idl.types ?? []).map(definedTypeNodeFromAnchorV00),
18-
errors: (idl.errors ?? []).map(errorNodeFromAnchorV00),
17+
definedTypes: (idl?.types ?? []).map(definedTypeNodeFromAnchorV00),
18+
errors: (idl?.errors ?? []).map(errorNodeFromAnchorV00),
1919
instructions,
20-
name: idl.name ?? '',
20+
name: idl?.name ?? '',
2121
origin,
2222
pdas,
23-
publicKey: (idl.metadata as { address?: string })?.address ?? '',
23+
publicKey: (idl?.metadata as { address?: string })?.address ?? '',
2424
version: idl.version as ProgramVersion,
2525
});
2626
}

0 commit comments

Comments
 (0)