Skip to content

Commit

Permalink
Fix missing args variable error in JS Experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Apr 29, 2024
1 parent 8235d31 commit 35a1546
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-swans-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@metaplex-foundation/kinobi": patch
---

Fix missing args variable error in JS Experimental
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstructionNode, ProgramNode } from '../../../nodes';
import { InstructionNode, ProgramNode, isNode } from '../../../nodes';
import { camelCase, pascalCase } from '../../../shared';
import { ResolvedInstructionInput } from '../../../visitors';
import { TypeManifest } from '../TypeManifest';
Expand Down Expand Up @@ -66,7 +66,11 @@ export function getInstructionFunctionFragment(
(instructionNode.extraArguments ?? []).filter(
(field) => !field.defaultValue || field.defaultValueStrategy !== 'omitted'
).length > 0;
const hasAnyArgs = hasDataArgs || hasExtraArgs;
const hasRemainingAccountArgs =
(instructionNode.remainingAccounts ?? []).filter(({ value }) =>
isNode(value, 'argumentValueNode')
).length > 0;
const hasAnyArgs = hasDataArgs || hasExtraArgs || hasRemainingAccountArgs;
const instructionDataName = nameApi.instructionDataType(instructionNode.name);
const programAddressConstant = nameApi.programAddressConstant(
programNode.name
Expand Down

0 comments on commit 35a1546

Please sign in to comment.