@codama/renderers-js 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,57 +1,61 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var visitorsCore = require('@codama/visitors-core');
6
- var path = require('path');
7
- var nodes = require('@codama/nodes');
8
- var codecsStrings = require('@solana/codecs-strings');
9
- var errors = require('@codama/errors');
10
- require('url');
11
- var nunjucks = require('nunjucks');
12
- var renderersCore = require('@codama/renderers-core');
13
- var estreePlugin = require('prettier/plugins/estree');
14
- var typeScriptPlugin = require('prettier/plugins/typescript');
15
- var standalone = require('prettier/standalone');
16
-
17
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
-
19
- function _interopNamespace(e) {
20
- if (e && e.__esModule) return e;
21
- var n = Object.create(null);
22
- if (e) {
23
- Object.keys(e).forEach(function (k) {
24
- if (k !== 'default') {
25
- var d = Object.getOwnPropertyDescriptor(e, k);
26
- Object.defineProperty(n, k, d.get ? d : {
27
- enumerable: true,
28
- get: function () { return e[k]; }
29
- });
30
- }
31
- });
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
17
  }
33
- n.default = e;
34
- return Object.freeze(n);
35
- }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
 
37
- var nunjucks__default = /*#__PURE__*/_interopDefault(nunjucks);
38
- var estreePlugin__namespace = /*#__PURE__*/_interopNamespace(estreePlugin);
39
- var typeScriptPlugin__namespace = /*#__PURE__*/_interopNamespace(typeScriptPlugin);
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ DEFAULT_NAME_TRANSFORMERS: () => DEFAULT_NAME_TRANSFORMERS,
34
+ ImportMap: () => ImportMap,
35
+ default: () => renderVisitor,
36
+ getNameApi: () => getNameApi,
37
+ getRenderMapVisitor: () => getRenderMapVisitor,
38
+ getTypeManifestVisitor: () => getTypeManifestVisitor,
39
+ mergeManifests: () => mergeManifests,
40
+ renderVisitor: () => renderVisitor,
41
+ typeManifest: () => typeManifest
42
+ });
43
+ module.exports = __toCommonJS(index_exports);
40
44
 
41
45
  // src/ImportMap.ts
42
46
  var DEFAULT_EXTERNAL_MODULE_MAP = {
43
- solanaAccounts: "@solana/web3.js",
44
- solanaAddresses: "@solana/web3.js",
45
- solanaCodecsCore: "@solana/web3.js",
46
- solanaCodecsDataStructures: "@solana/web3.js",
47
- solanaCodecsNumbers: "@solana/web3.js",
48
- solanaCodecsStrings: "@solana/web3.js",
49
- solanaErrors: "@solana/web3.js",
50
- solanaInstructions: "@solana/web3.js",
51
- solanaOptions: "@solana/web3.js",
52
- solanaPrograms: "@solana/web3.js",
53
- solanaRpcTypes: "@solana/web3.js",
54
- solanaSigners: "@solana/web3.js"
47
+ solanaAccounts: "@solana/kit",
48
+ solanaAddresses: "@solana/kit",
49
+ solanaCodecsCore: "@solana/kit",
50
+ solanaCodecsDataStructures: "@solana/kit",
51
+ solanaCodecsNumbers: "@solana/kit",
52
+ solanaCodecsStrings: "@solana/kit",
53
+ solanaErrors: "@solana/kit",
54
+ solanaInstructions: "@solana/kit",
55
+ solanaOptions: "@solana/kit",
56
+ solanaPrograms: "@solana/kit",
57
+ solanaRpcTypes: "@solana/kit",
58
+ solanaSigners: "@solana/kit"
55
59
  };
56
60
  var DEFAULT_GRANULAR_EXTERNAL_MODULE_MAP = {
57
61
  solanaAccounts: "@solana/accounts",
@@ -83,35 +87,35 @@ var DEFAULT_INTERNAL_MODULE_MAP = {
83
87
  var ImportMap = class {
84
88
  _imports = /* @__PURE__ */ new Map();
85
89
  _aliases = /* @__PURE__ */ new Map();
86
- add(module, imports) {
90
+ add(module2, imports) {
87
91
  const newImports = new Set(typeof imports === "string" ? [imports] : imports);
88
92
  if (newImports.size === 0) return this;
89
- const currentImports = this._imports.get(module) ?? /* @__PURE__ */ new Set();
93
+ const currentImports = this._imports.get(module2) ?? /* @__PURE__ */ new Set();
90
94
  newImports.forEach((i) => currentImports.add(i));
91
- this._imports.set(module, currentImports);
95
+ this._imports.set(module2, currentImports);
92
96
  return this;
93
97
  }
94
- remove(module, imports) {
98
+ remove(module2, imports) {
95
99
  const importsToRemove = new Set(typeof imports === "string" ? [imports] : imports);
96
100
  if (importsToRemove.size === 0) return this;
97
- const currentImports = this._imports.get(module) ?? /* @__PURE__ */ new Set();
101
+ const currentImports = this._imports.get(module2) ?? /* @__PURE__ */ new Set();
98
102
  importsToRemove.forEach((i) => currentImports.delete(i));
99
103
  if (currentImports.size === 0) {
100
- this._imports.delete(module);
104
+ this._imports.delete(module2);
101
105
  } else {
102
- this._imports.set(module, currentImports);
106
+ this._imports.set(module2, currentImports);
103
107
  }
104
108
  return this;
105
109
  }
106
110
  mergeWith(...others) {
107
111
  others.forEach((rawOther) => {
108
112
  const other = "imports" in rawOther ? rawOther.imports : rawOther;
109
- other._imports.forEach((imports, module) => {
110
- this.add(module, imports);
113
+ other._imports.forEach((imports, module2) => {
114
+ this.add(module2, imports);
111
115
  });
112
- other._aliases.forEach((aliases, module) => {
116
+ other._aliases.forEach((aliases, module2) => {
113
117
  Object.entries(aliases).forEach(([name, alias]) => {
114
- this.addAlias(module, name, alias);
118
+ this.addAlias(module2, name, alias);
115
119
  });
116
120
  });
117
121
  });
@@ -120,10 +124,10 @@ var ImportMap = class {
120
124
  mergeWithManifest(manifest) {
121
125
  return this.mergeWith(manifest.strictType, manifest.looseType, manifest.encoder, manifest.decoder);
122
126
  }
123
- addAlias(module, name, alias) {
124
- const currentAliases = this._aliases.get(module) ?? {};
127
+ addAlias(module2, name, alias) {
128
+ const currentAliases = this._aliases.get(module2) ?? {};
125
129
  currentAliases[name] = alias;
126
- this._aliases.set(module, currentAliases);
130
+ this._aliases.set(module2, currentAliases);
127
131
  return this;
128
132
  }
129
133
  isEmpty() {
@@ -131,10 +135,10 @@ var ImportMap = class {
131
135
  }
132
136
  resolve(dependencies = {}, useGranularImports = false) {
133
137
  const aliasedMap = new Map(
134
- [...this._imports.entries()].map(([module, imports]) => {
135
- const aliasMap = this._aliases.get(module) ?? {};
138
+ [...this._imports.entries()].map(([module2, imports]) => {
139
+ const aliasMap = this._aliases.get(module2) ?? {};
136
140
  const joinedImports = [...imports].map((i) => aliasMap[i] ? `${i} as ${aliasMap[i]}` : i);
137
- return [module, new Set(joinedImports)];
141
+ return [module2, new Set(joinedImports)];
138
142
  })
139
143
  );
140
144
  const dependencyMap = {
@@ -143,8 +147,8 @@ var ImportMap = class {
143
147
  ...dependencies
144
148
  };
145
149
  const resolvedMap = /* @__PURE__ */ new Map();
146
- aliasedMap.forEach((imports, module) => {
147
- const resolvedModule = dependencyMap[module] ?? module;
150
+ aliasedMap.forEach((imports, module2) => {
151
+ const resolvedModule = dependencyMap[module2] ?? module2;
148
152
  const currentImports = resolvedMap.get(resolvedModule) ?? /* @__PURE__ */ new Set();
149
153
  imports.forEach((i) => currentImports.add(i));
150
154
  resolvedMap.set(resolvedModule, currentImports);
@@ -158,7 +162,7 @@ var ImportMap = class {
158
162
  if (aIsRelative && !bIsRelative) return 1;
159
163
  if (!aIsRelative && bIsRelative) return -1;
160
164
  return a.localeCompare(b);
161
- }).map(([module, imports]) => {
165
+ }).map(([module2, imports]) => {
162
166
  const joinedImports = [...imports].sort().filter((i) => {
163
167
  const name = i.split(" ");
164
168
  if (name.length > 1) {
@@ -166,16 +170,26 @@ var ImportMap = class {
166
170
  }
167
171
  return true;
168
172
  }).join(", ");
169
- return `import { ${joinedImports} } from '${module}';`;
173
+ return `import { ${joinedImports} } from '${module2}';`;
170
174
  }).join("\n");
171
175
  }
172
176
  };
177
+
178
+ // src/fragments/accountFetchHelpers.ts
179
+ var import_visitors_core2 = require("@codama/visitors-core");
180
+
181
+ // src/fragments/common.ts
182
+ var import_node_path2 = require("path");
183
+
184
+ // src/utils/async.ts
185
+ var import_nodes = require("@codama/nodes");
186
+ var import_visitors_core = require("@codama/visitors-core");
173
187
  function hasAsyncFunction(instructionNode, resolvedInputs, asyncResolvers) {
174
188
  const hasByteDeltasAsync = (instructionNode.byteDeltas ?? []).some(
175
- ({ value }) => nodes.isNode(value, "resolverValueNode") && asyncResolvers.includes(value.name)
189
+ ({ value }) => (0, import_nodes.isNode)(value, "resolverValueNode") && asyncResolvers.includes(value.name)
176
190
  );
177
191
  const hasRemainingAccountsAsync = (instructionNode.remainingAccounts ?? []).some(
178
- ({ value }) => nodes.isNode(value, "resolverValueNode") && asyncResolvers.includes(value.name)
192
+ ({ value }) => (0, import_nodes.isNode)(value, "resolverValueNode") && asyncResolvers.includes(value.name)
179
193
  );
180
194
  return hasAsyncDefaultValues(resolvedInputs, asyncResolvers) || hasByteDeltasAsync || hasRemainingAccountsAsync;
181
195
  }
@@ -197,8 +211,8 @@ function isAsyncDefaultValue(defaultValue, asyncResolvers) {
197
211
  }
198
212
  }
199
213
  function getInstructionDependencies(input, asyncResolvers, useAsync) {
200
- if (nodes.isNode(input, "instructionNode")) {
201
- return visitorsCore.deduplicateInstructionDependencies([
214
+ if ((0, import_nodes.isNode)(input, "instructionNode")) {
215
+ return (0, import_visitors_core.deduplicateInstructionDependencies)([
202
216
  ...input.accounts.flatMap((x) => getInstructionDependencies(x, asyncResolvers, useAsync)),
203
217
  ...input.arguments.flatMap((x) => getInstructionDependencies(x, asyncResolvers, useAsync)),
204
218
  ...(input.extraArguments ?? []).flatMap((x) => getInstructionDependencies(x, asyncResolvers, useAsync))
@@ -209,29 +223,29 @@ function getInstructionDependencies(input, asyncResolvers, useAsync) {
209
223
  if (!defaultValue) return [];
210
224
  return getInstructionDependencies({ ...input, defaultValue }, asyncResolvers, useAsync);
211
225
  };
212
- if (nodes.isNode(input.defaultValue, ["accountValueNode", "accountBumpValueNode"])) {
213
- return [nodes.accountValueNode(input.defaultValue.name)];
226
+ if ((0, import_nodes.isNode)(input.defaultValue, ["accountValueNode", "accountBumpValueNode"])) {
227
+ return [(0, import_nodes.accountValueNode)(input.defaultValue.name)];
214
228
  }
215
- if (nodes.isNode(input.defaultValue, ["argumentValueNode"])) {
216
- return [nodes.argumentValueNode(input.defaultValue.name)];
229
+ if ((0, import_nodes.isNode)(input.defaultValue, ["argumentValueNode"])) {
230
+ return [(0, import_nodes.argumentValueNode)(input.defaultValue.name)];
217
231
  }
218
- if (nodes.isNode(input.defaultValue, "pdaValueNode")) {
232
+ if ((0, import_nodes.isNode)(input.defaultValue, "pdaValueNode")) {
219
233
  const dependencies = /* @__PURE__ */ new Map();
220
234
  input.defaultValue.seeds.forEach((seed) => {
221
- if (nodes.isNode(seed.value, ["accountValueNode", "argumentValueNode"])) {
235
+ if ((0, import_nodes.isNode)(seed.value, ["accountValueNode", "argumentValueNode"])) {
222
236
  dependencies.set(seed.value.name, { ...seed.value });
223
237
  }
224
238
  });
225
239
  return [...dependencies.values()];
226
240
  }
227
- if (nodes.isNode(input.defaultValue, "resolverValueNode")) {
241
+ if ((0, import_nodes.isNode)(input.defaultValue, "resolverValueNode")) {
228
242
  const isSynchronousResolver = !asyncResolvers.includes(input.defaultValue.name);
229
243
  if (useAsync || isSynchronousResolver) {
230
244
  return input.defaultValue.dependsOn ?? [];
231
245
  }
232
246
  }
233
- if (nodes.isNode(input.defaultValue, "conditionalValueNode")) {
234
- return visitorsCore.deduplicateInstructionDependencies([
247
+ if ((0, import_nodes.isNode)(input.defaultValue, "conditionalValueNode")) {
248
+ return (0, import_visitors_core.deduplicateInstructionDependencies)([
235
249
  ...getNestedDependencies(input.defaultValue.condition),
236
250
  ...getNestedDependencies(input.defaultValue.ifTrue),
237
251
  ...getNestedDependencies(input.defaultValue.ifFalse)
@@ -239,49 +253,58 @@ function getInstructionDependencies(input, asyncResolvers, useAsync) {
239
253
  }
240
254
  return [];
241
255
  }
256
+
257
+ // src/utils/codecs.ts
258
+ var import_codecs_strings = require("@solana/codecs-strings");
242
259
  function getBytesFromBytesValueNode(node) {
243
260
  switch (node.encoding) {
244
261
  case "utf8":
245
- return codecsStrings.getUtf8Encoder().encode(node.data);
262
+ return (0, import_codecs_strings.getUtf8Encoder)().encode(node.data);
246
263
  case "base16":
247
- return codecsStrings.getBase16Encoder().encode(node.data);
264
+ return (0, import_codecs_strings.getBase16Encoder)().encode(node.data);
248
265
  case "base58":
249
- return codecsStrings.getBase58Encoder().encode(node.data);
266
+ return (0, import_codecs_strings.getBase58Encoder)().encode(node.data);
250
267
  case "base64":
251
268
  default:
252
- return codecsStrings.getBase64Encoder().encode(node.data);
269
+ return (0, import_codecs_strings.getBase64Encoder)().encode(node.data);
253
270
  }
254
271
  }
272
+
273
+ // src/utils/customData.ts
274
+ var import_nodes2 = require("@codama/nodes");
255
275
  var parseCustomDataOptions = (customDataOptions, defaultSuffix) => new Map(
256
276
  customDataOptions.map((o) => {
257
277
  const options = typeof o === "string" ? { name: o } : o;
258
- const importAs = nodes.camelCase(options.importAs ?? `${options.name}${defaultSuffix}`);
278
+ const importAs = (0, import_nodes2.camelCase)(options.importAs ?? `${options.name}${defaultSuffix}`);
259
279
  const importFrom = options.importFrom ?? "hooked";
260
280
  return [
261
- nodes.camelCase(options.name),
281
+ (0, import_nodes2.camelCase)(options.name),
262
282
  {
263
283
  extract: options.extract ?? false,
264
- extractAs: options.extractAs ? nodes.camelCase(options.extractAs) : importAs,
284
+ extractAs: options.extractAs ? (0, import_nodes2.camelCase)(options.extractAs) : importAs,
265
285
  importAs,
266
286
  importFrom,
267
- linkNode: nodes.definedTypeLinkNode(importAs)
287
+ linkNode: (0, import_nodes2.definedTypeLinkNode)(importAs)
268
288
  }
269
289
  ];
270
290
  })
271
291
  );
272
- var getDefinedTypeNodesToExtract = (nodes$1, parsedCustomDataOptions) => nodes$1.flatMap((node) => {
292
+ var getDefinedTypeNodesToExtract = (nodes, parsedCustomDataOptions) => nodes.flatMap((node) => {
273
293
  const options = parsedCustomDataOptions.get(node.name);
274
294
  if (!options || !options.extract) return [];
275
- if (nodes.isNode(node, "accountNode")) {
276
- return [nodes.definedTypeNode({ name: options.extractAs, type: { ...node.data } })];
295
+ if ((0, import_nodes2.isNode)(node, "accountNode")) {
296
+ return [(0, import_nodes2.definedTypeNode)({ name: options.extractAs, type: { ...node.data } })];
277
297
  }
278
298
  return [
279
- nodes.definedTypeNode({
299
+ (0, import_nodes2.definedTypeNode)({
280
300
  name: options.extractAs,
281
- type: nodes.structTypeNodeFromInstructionArgumentNodes(node.arguments)
301
+ type: (0, import_nodes2.structTypeNodeFromInstructionArgumentNodes)(node.arguments)
282
302
  })
283
303
  ];
284
304
  });
305
+
306
+ // src/utils/linkOverrides.ts
307
+ var import_errors = require("@codama/errors");
285
308
  function getImportFromFactory(overrides, customAccountData, customInstructionData) {
286
309
  const customDataOverrides = Object.fromEntries(
287
310
  [...customAccountData.values(), ...customInstructionData.values()].map(({ importFrom, importAs }) => [
@@ -313,7 +336,7 @@ function getImportFromFactory(overrides, customAccountData, customInstructionDat
313
336
  case "resolverValueNode":
314
337
  return linkOverrides.resolvers[node.name] ?? "hooked";
315
338
  default:
316
- throw new errors.CodamaError(errors.CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
339
+ throw new import_errors.CodamaError(import_errors.CODAMA_ERROR__UNEXPECTED_NODE_KIND, {
317
340
  expectedKinds: [
318
341
  "AccountLinkNode",
319
342
  "DefinedTypeLinkNode",
@@ -328,6 +351,12 @@ function getImportFromFactory(overrides, customAccountData, customInstructionDat
328
351
  }
329
352
  };
330
353
  }
354
+
355
+ // src/utils/render.ts
356
+ var import_node_path = require("path");
357
+ var import_node_url = require("url");
358
+ var import_nodes3 = require("@codama/nodes");
359
+ var import_nunjucks = __toESM(require("nunjucks"));
331
360
  function jsDocblock(docs) {
332
361
  if (docs.length <= 0) return "";
333
362
  if (docs.length === 1) return `/** ${docs[0]} */
@@ -339,14 +368,14 @@ ${lines.join("\n")}
339
368
  `;
340
369
  }
341
370
  var render = (template, context, options) => {
342
- const dirname = __dirname;
343
- const templates = path.join(dirname, "templates");
344
- const env = nunjucks__default.default.configure(templates, { autoescape: false, trimBlocks: true, ...options });
345
- env.addFilter("pascalCase", nodes.pascalCase);
346
- env.addFilter("camelCase", nodes.camelCase);
347
- env.addFilter("snakeCase", nodes.snakeCase);
348
- env.addFilter("kebabCase", nodes.kebabCase);
349
- env.addFilter("titleCase", nodes.titleCase);
371
+ const dirname = false ? pathDirname(fileURLToPath(import_meta.url)) : __dirname;
372
+ const templates = false ? (0, import_node_path.join)(dirname, "..", "..", "public", "templates") : (0, import_node_path.join)(dirname, "templates");
373
+ const env = import_nunjucks.default.configure(templates, { autoescape: false, trimBlocks: true, ...options });
374
+ env.addFilter("pascalCase", import_nodes3.pascalCase);
375
+ env.addFilter("camelCase", import_nodes3.camelCase);
376
+ env.addFilter("snakeCase", import_nodes3.snakeCase);
377
+ env.addFilter("kebabCase", import_nodes3.kebabCase);
378
+ env.addFilter("titleCase", import_nodes3.titleCase);
350
379
  env.addFilter("jsDocblock", jsDocblock);
351
380
  return env.render(template, context);
352
381
  };
@@ -356,7 +385,7 @@ function fragment(render2, imports) {
356
385
  return new Fragment(render2, imports);
357
386
  }
358
387
  function fragmentFromTemplate(fragmentFile, context, options) {
359
- return fragment(render(path.join("fragments", fragmentFile), context, options));
388
+ return fragment(render((0, import_node_path2.join)("fragments", fragmentFile), context, options));
360
389
  }
361
390
  function mergeFragments(fragments, mergeRenders) {
362
391
  return new Fragment(
@@ -382,20 +411,20 @@ var Fragment = class _Fragment {
382
411
  this.render = fn(this.render);
383
412
  return this;
384
413
  }
385
- addImports(module, imports) {
386
- this.imports.add(module, imports);
414
+ addImports(module2, imports) {
415
+ this.imports.add(module2, imports);
387
416
  return this;
388
417
  }
389
- removeImports(module, imports) {
390
- this.imports.remove(module, imports);
418
+ removeImports(module2, imports) {
419
+ this.imports.remove(module2, imports);
391
420
  return this;
392
421
  }
393
422
  mergeImportsWith(...others) {
394
423
  this.imports.mergeWith(...others);
395
424
  return this;
396
425
  }
397
- addImportAlias(module, name, alias) {
398
- this.imports.addAlias(module, name, alias);
426
+ addImportAlias(module2, name, alias) {
427
+ this.imports.addAlias(module2, name, alias);
399
428
  return this;
400
429
  }
401
430
  addFeatures(features) {
@@ -427,7 +456,7 @@ var Fragment = class _Fragment {
427
456
  // src/fragments/accountFetchHelpers.ts
428
457
  function getAccountFetchHelpersFragment(scope) {
429
458
  const { accountPath, typeManifest: typeManifest2, nameApi, customAccountData } = scope;
430
- const accountNode = visitorsCore.getLastNodeFromPath(accountPath);
459
+ const accountNode = (0, import_visitors_core2.getLastNodeFromPath)(accountPath);
431
460
  const hasCustomData = customAccountData.has(accountNode.name);
432
461
  const accountTypeFragment = hasCustomData ? typeManifest2.strictType.clone() : fragment(nameApi.dataType(accountNode.name));
433
462
  const decoderFunctionFragment = hasCustomData ? typeManifest2.decoder.clone() : fragment(`${nameApi.decoderFunction(accountNode.name)}()`);
@@ -453,11 +482,15 @@ function getAccountFetchHelpersFragment(scope) {
453
482
  "type MaybeEncodedAccount"
454
483
  ]);
455
484
  }
485
+
486
+ // src/fragments/accountPdaHelpers.ts
487
+ var import_nodes4 = require("@codama/nodes");
488
+ var import_visitors_core3 = require("@codama/visitors-core");
456
489
  function getAccountPdaHelpersFragment(scope) {
457
490
  const { accountPath, nameApi, linkables, customAccountData, typeManifest: typeManifest2 } = scope;
458
- const accountNode = visitorsCore.getLastNodeFromPath(accountPath);
459
- const programNode = visitorsCore.findProgramNodeFromPath(accountPath);
460
- const pdaNode = accountNode.pda ? linkables.get([...accountPath, accountNode.pda]) : undefined;
491
+ const accountNode = (0, import_visitors_core3.getLastNodeFromPath)(accountPath);
492
+ const programNode = (0, import_visitors_core3.findProgramNodeFromPath)(accountPath);
493
+ const pdaNode = accountNode.pda ? linkables.get([...accountPath, accountNode.pda]) : void 0;
461
494
  if (!pdaNode) {
462
495
  return fragment("");
463
496
  }
@@ -465,7 +498,7 @@ function getAccountPdaHelpersFragment(scope) {
465
498
  const importFrom = "generatedPdas";
466
499
  const pdaSeedsType = nameApi.pdaSeedsType(pdaNode.name);
467
500
  const findPdaFunction = nameApi.pdaFindFunction(pdaNode.name);
468
- const hasVariableSeeds = pdaNode.seeds.filter(nodes.isNodeFilter("variablePdaSeedNode")).length > 0;
501
+ const hasVariableSeeds = pdaNode.seeds.filter((0, import_nodes4.isNodeFilter)("variablePdaSeedNode")).length > 0;
469
502
  return fragmentFromTemplate("accountPdaHelpers.njk", {
470
503
  accountType: accountTypeFragment.render,
471
504
  fetchFromSeedsFunction: nameApi.accountFetchFromSeedsFunction(accountNode.name),
@@ -483,9 +516,12 @@ function getAccountPdaHelpersFragment(scope) {
483
516
  "type MaybeAccount"
484
517
  ]);
485
518
  }
519
+
520
+ // src/fragments/accountSizeHelpers.ts
521
+ var import_visitors_core4 = require("@codama/visitors-core");
486
522
  function getAccountSizeHelpersFragment(scope) {
487
523
  const { accountPath, nameApi } = scope;
488
- const accountNode = visitorsCore.getLastNodeFromPath(accountPath);
524
+ const accountNode = (0, import_visitors_core4.getLastNodeFromPath)(accountPath);
489
525
  if (accountNode.size == null) {
490
526
  return fragment("");
491
527
  }
@@ -495,6 +531,9 @@ function getAccountSizeHelpersFragment(scope) {
495
531
  });
496
532
  }
497
533
 
534
+ // src/fragments/accountType.ts
535
+ var import_visitors_core5 = require("@codama/visitors-core");
536
+
498
537
  // src/fragments/type.ts
499
538
  function getTypeFragment(scope) {
500
539
  const { name, manifest, nameApi, docs = [] } = scope;
@@ -566,7 +605,7 @@ function getTypeWithCodecFragment(scope) {
566
605
  // src/fragments/accountType.ts
567
606
  function getAccountTypeFragment(scope) {
568
607
  const { accountPath, typeManifest: typeManifest2, nameApi, customAccountData } = scope;
569
- const accountNode = visitorsCore.getLastNodeFromPath(accountPath);
608
+ const accountNode = (0, import_visitors_core5.getLastNodeFromPath)(accountPath);
570
609
  if (customAccountData.has(accountNode.name)) {
571
610
  return fragment("");
572
611
  }
@@ -576,16 +615,21 @@ function getAccountTypeFragment(scope) {
576
615
  nameApi
577
616
  });
578
617
  }
618
+
619
+ // src/fragments/discriminatorCondition.ts
620
+ var import_nodes5 = require("@codama/nodes");
621
+ var import_visitors_core6 = require("@codama/visitors-core");
622
+ var import_codecs_strings2 = require("@solana/codecs-strings");
579
623
  function getDiscriminatorConditionFragment(scope) {
580
624
  return mergeFragments(
581
625
  scope.discriminators.flatMap((discriminator) => {
582
- if (nodes.isNode(discriminator, "sizeDiscriminatorNode")) {
626
+ if ((0, import_nodes5.isNode)(discriminator, "sizeDiscriminatorNode")) {
583
627
  return [getSizeConditionFragment(discriminator, scope)];
584
628
  }
585
- if (nodes.isNode(discriminator, "constantDiscriminatorNode")) {
629
+ if ((0, import_nodes5.isNode)(discriminator, "constantDiscriminatorNode")) {
586
630
  return [getByteConditionFragment(discriminator, scope)];
587
631
  }
588
- if (nodes.isNode(discriminator, "fieldDiscriminatorNode")) {
632
+ if ((0, import_nodes5.isNode)(discriminator, "fieldDiscriminatorNode")) {
589
633
  return [getFieldConditionFragment(discriminator, scope)];
590
634
  }
591
635
  return [];
@@ -599,7 +643,7 @@ function getSizeConditionFragment(discriminator, scope) {
599
643
  }
600
644
  function getByteConditionFragment(discriminator, scope) {
601
645
  const { dataName, typeManifestVisitor } = scope;
602
- const constant = visitorsCore.visit(discriminator.constant, typeManifestVisitor).value;
646
+ const constant = (0, import_visitors_core6.visit)(discriminator.constant, typeManifestVisitor).value;
603
647
  return constant.mapRender((r) => `containsBytes(${dataName}, ${r}, ${discriminator.offset})`).addImports("solanaCodecsCore", "containsBytes");
604
648
  }
605
649
  function getFieldConditionFragment(discriminator, scope) {
@@ -609,22 +653,25 @@ function getFieldConditionFragment(discriminator, scope) {
609
653
  `Field discriminator "${discriminator.name}" does not have a matching argument with default value.`
610
654
  );
611
655
  }
612
- if (nodes.isNode(field.type, "arrayTypeNode") && nodes.isNode(field.type.item, "numberTypeNode") && field.type.item.format === "u8" && nodes.isNode(field.type.count, "fixedCountNode") && nodes.isNode(field.defaultValue, "arrayValueNode") && field.defaultValue.items.every(nodes.isNodeFilter("numberValueNode"))) {
613
- const base64Bytes = codecsStrings.getBase64Decoder().decode(
656
+ if ((0, import_nodes5.isNode)(field.type, "arrayTypeNode") && (0, import_nodes5.isNode)(field.type.item, "numberTypeNode") && field.type.item.format === "u8" && (0, import_nodes5.isNode)(field.type.count, "fixedCountNode") && (0, import_nodes5.isNode)(field.defaultValue, "arrayValueNode") && field.defaultValue.items.every((0, import_nodes5.isNodeFilter)("numberValueNode"))) {
657
+ const base64Bytes = (0, import_codecs_strings2.getBase64Decoder)().decode(
614
658
  new Uint8Array(field.defaultValue.items.map((node) => node.number))
615
659
  );
616
660
  return getByteConditionFragment(
617
- nodes.constantDiscriminatorNode(nodes.constantValueNodeFromBytes("base64", base64Bytes), discriminator.offset),
661
+ (0, import_nodes5.constantDiscriminatorNode)((0, import_nodes5.constantValueNodeFromBytes)("base64", base64Bytes), discriminator.offset),
618
662
  scope
619
663
  );
620
664
  }
621
665
  return getByteConditionFragment(
622
- nodes.constantDiscriminatorNode(nodes.constantValueNode(field.type, field.defaultValue), discriminator.offset),
666
+ (0, import_nodes5.constantDiscriminatorNode)((0, import_nodes5.constantValueNode)(field.type, field.defaultValue), discriminator.offset),
623
667
  scope
624
668
  );
625
669
  }
670
+
671
+ // src/fragments/instructionAccountMeta.ts
672
+ var import_nodes6 = require("@codama/nodes");
626
673
  function getInstructionAccountMetaFragment(instructionAccountNode) {
627
- const typeParam = `TAccount${nodes.pascalCase(instructionAccountNode.name)}`;
674
+ const typeParam = `TAccount${(0, import_nodes6.pascalCase)(instructionAccountNode.name)}`;
628
675
  if (instructionAccountNode.isSigner === true && instructionAccountNode.isWritable) {
629
676
  return fragment(`WritableSignerAccount<${typeParam}> & IAccountSignerMeta<${typeParam}>`).addImports("solanaInstructions", ["type WritableSignerAccount"]).addImports("solanaSigners", ["type IAccountSignerMeta"]);
630
677
  }
@@ -636,12 +683,16 @@ function getInstructionAccountMetaFragment(instructionAccountNode) {
636
683
  }
637
684
  return fragment(`ReadonlyAccount<${typeParam}>`).addImports("solanaInstructions", "type ReadonlyAccount");
638
685
  }
686
+
687
+ // src/fragments/instructionAccountTypeParam.ts
688
+ var import_nodes7 = require("@codama/nodes");
689
+ var import_visitors_core7 = require("@codama/visitors-core");
639
690
  function getInstructionAccountTypeParamFragment(scope) {
640
691
  const { instructionAccountPath, allowAccountMeta, linkables } = scope;
641
- const instructionAccountNode = visitorsCore.getLastNodeFromPath(instructionAccountPath);
642
- const instructionNode = visitorsCore.findInstructionNodeFromPath(instructionAccountPath);
643
- const programNode = visitorsCore.findProgramNodeFromPath(instructionAccountPath);
644
- const typeParam = `TAccount${nodes.pascalCase(instructionAccountNode.name)}`;
692
+ const instructionAccountNode = (0, import_visitors_core7.getLastNodeFromPath)(instructionAccountPath);
693
+ const instructionNode = (0, import_visitors_core7.findInstructionNodeFromPath)(instructionAccountPath);
694
+ const programNode = (0, import_visitors_core7.findProgramNodeFromPath)(instructionAccountPath);
695
+ const typeParam = `TAccount${(0, import_nodes7.pascalCase)(instructionAccountNode.name)}`;
645
696
  const accountMeta = allowAccountMeta ? " | IAccountMeta<string>" : "";
646
697
  const imports = new ImportMap();
647
698
  if (allowAccountMeta) {
@@ -666,8 +717,12 @@ function getDefaultAddress(defaultValue, programId, linkables) {
666
717
  return "string";
667
718
  }
668
719
  }
720
+
721
+ // src/fragments/instructionByteDelta.ts
722
+ var import_nodes8 = require("@codama/nodes");
723
+ var import_visitors_core8 = require("@codama/visitors-core");
669
724
  function getInstructionByteDeltaFragment(scope) {
670
- const { byteDeltas } = visitorsCore.getLastNodeFromPath(scope.instructionPath);
725
+ const { byteDeltas } = (0, import_visitors_core8.getLastNodeFromPath)(scope.instructionPath);
671
726
  const fragments = (byteDeltas ?? []).flatMap((r) => getByteDeltaFragment(r, scope));
672
727
  if (fragments.length === 0) return fragment("");
673
728
  return mergeFragments(
@@ -678,16 +733,16 @@ const byteDelta: number = [${r.join(",")}].reduce((a, b) => a + b, 0);`
678
733
  }
679
734
  function getByteDeltaFragment(byteDelta, scope) {
680
735
  const bytesFragment = (() => {
681
- if (nodes.isNode(byteDelta.value, "numberValueNode")) {
736
+ if ((0, import_nodes8.isNode)(byteDelta.value, "numberValueNode")) {
682
737
  return getNumberValueNodeFragment(byteDelta);
683
738
  }
684
- if (nodes.isNode(byteDelta.value, "argumentValueNode")) {
739
+ if ((0, import_nodes8.isNode)(byteDelta.value, "argumentValueNode")) {
685
740
  return getArgumentValueNodeFragment(byteDelta);
686
741
  }
687
- if (nodes.isNode(byteDelta.value, "accountLinkNode")) {
742
+ if ((0, import_nodes8.isNode)(byteDelta.value, "accountLinkNode")) {
688
743
  return getAccountLinkNodeFragment(byteDelta, scope);
689
744
  }
690
- if (nodes.isNode(byteDelta.value, "resolverValueNode")) {
745
+ if ((0, import_nodes8.isNode)(byteDelta.value, "resolverValueNode")) {
691
746
  return getResolverValueNodeFragment(byteDelta, scope);
692
747
  }
693
748
  return null;
@@ -702,30 +757,33 @@ function getByteDeltaFragment(byteDelta, scope) {
702
757
  return [bytesFragment];
703
758
  }
704
759
  function getNumberValueNodeFragment(byteDelta) {
705
- nodes.assertIsNode(byteDelta.value, "numberValueNode");
760
+ (0, import_nodes8.assertIsNode)(byteDelta.value, "numberValueNode");
706
761
  return fragment(byteDelta.value.number.toString());
707
762
  }
708
763
  function getArgumentValueNodeFragment(byteDelta) {
709
- nodes.assertIsNode(byteDelta.value, "argumentValueNode");
710
- const argumentName = nodes.camelCase(byteDelta.value.name);
764
+ (0, import_nodes8.assertIsNode)(byteDelta.value, "argumentValueNode");
765
+ const argumentName = (0, import_nodes8.camelCase)(byteDelta.value.name);
711
766
  return fragment(`Number(args.${argumentName})`);
712
767
  }
713
768
  function getAccountLinkNodeFragment(byteDelta, scope) {
714
- nodes.assertIsNode(byteDelta.value, "accountLinkNode");
769
+ (0, import_nodes8.assertIsNode)(byteDelta.value, "accountLinkNode");
715
770
  const functionName = scope.nameApi.accountGetSizeFunction(byteDelta.value.name);
716
771
  return fragment(`${functionName}()`).addImports(scope.getImportFrom(byteDelta.value), functionName);
717
772
  }
718
773
  function getResolverValueNodeFragment(byteDelta, scope) {
719
- nodes.assertIsNode(byteDelta.value, "resolverValueNode");
774
+ (0, import_nodes8.assertIsNode)(byteDelta.value, "resolverValueNode");
720
775
  const isAsync = scope.asyncResolvers.includes(byteDelta.value.name);
721
776
  if (!scope.useAsync && isAsync) return null;
722
777
  const awaitKeyword = scope.useAsync && isAsync ? "await " : "";
723
778
  const functionName = scope.nameApi.resolverFunction(byteDelta.value.name);
724
779
  return fragment(`${awaitKeyword}${functionName}(resolverScope)`).addImports(scope.getImportFrom(byteDelta.value), functionName).addFeatures(["instruction:resolverScopeVariable"]);
725
780
  }
781
+
782
+ // src/fragments/instructionData.ts
783
+ var import_visitors_core9 = require("@codama/visitors-core");
726
784
  function getInstructionDataFragment(scope) {
727
785
  const { instructionPath, dataArgsManifest, nameApi, customInstructionData } = scope;
728
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
786
+ const instructionNode = (0, import_visitors_core9.getLastNodeFromPath)(instructionPath);
729
787
  if (instructionNode.arguments.length === 0 || customInstructionData.has(instructionNode.name)) {
730
788
  return fragment("");
731
789
  }
@@ -736,6 +794,10 @@ function getInstructionDataFragment(scope) {
736
794
  nameApi
737
795
  });
738
796
  }
797
+
798
+ // src/fragments/discriminatorConstants.ts
799
+ var import_nodes9 = require("@codama/nodes");
800
+ var import_visitors_core10 = require("@codama/visitors-core");
739
801
  function getDiscriminatorConstantsFragment(scope) {
740
802
  const fragments = scope.discriminatorNodes.map((node) => getDiscriminatorConstantFragment(node, scope)).filter(Boolean);
741
803
  return mergeFragments(fragments, (r) => r.join("\n\n"));
@@ -752,22 +814,22 @@ function getDiscriminatorConstantFragment(discriminatorNode, scope) {
752
814
  }
753
815
  function getConstantDiscriminatorConstantFragment(discriminatorNode, scope) {
754
816
  const { discriminatorNodes, typeManifestVisitor, prefix } = scope;
755
- const index = discriminatorNodes.filter(nodes.isNodeFilter("constantDiscriminatorNode")).indexOf(discriminatorNode);
817
+ const index = discriminatorNodes.filter((0, import_nodes9.isNodeFilter)("constantDiscriminatorNode")).indexOf(discriminatorNode);
756
818
  const suffix = index <= 0 ? "" : `_${index + 1}`;
757
- const name = nodes.camelCase(`${prefix}_discriminator${suffix}`);
758
- const encoder = visitorsCore.visit(discriminatorNode.constant.type, typeManifestVisitor).encoder;
759
- const value = visitorsCore.visit(discriminatorNode.constant.value, typeManifestVisitor).value;
819
+ const name = (0, import_nodes9.camelCase)(`${prefix}_discriminator${suffix}`);
820
+ const encoder = (0, import_visitors_core10.visit)(discriminatorNode.constant.type, typeManifestVisitor).encoder;
821
+ const value = (0, import_visitors_core10.visit)(discriminatorNode.constant.value, typeManifestVisitor).value;
760
822
  return getConstantFragment({ ...scope, encoder, name, value });
761
823
  }
762
824
  function getFieldDiscriminatorConstantFragment(discriminatorNode, scope) {
763
825
  const { fields, prefix, typeManifestVisitor } = scope;
764
826
  const field = fields.find((f) => f.name === discriminatorNode.name);
765
- if (!field || !field.defaultValue || !nodes.isNode(field.defaultValue, nodes.VALUE_NODES)) {
827
+ if (!field || !field.defaultValue || !(0, import_nodes9.isNode)(field.defaultValue, import_nodes9.VALUE_NODES)) {
766
828
  return null;
767
829
  }
768
- const name = nodes.camelCase(`${prefix}_${discriminatorNode.name}`);
769
- const encoder = visitorsCore.visit(field.type, typeManifestVisitor).encoder;
770
- const value = visitorsCore.visit(field.defaultValue, typeManifestVisitor).value;
830
+ const name = (0, import_nodes9.camelCase)(`${prefix}_${discriminatorNode.name}`);
831
+ const encoder = (0, import_visitors_core10.visit)(field.type, typeManifestVisitor).encoder;
832
+ const value = (0, import_visitors_core10.visit)(field.defaultValue, typeManifestVisitor).value;
771
833
  return getConstantFragment({ ...scope, encoder, name, value });
772
834
  }
773
835
  function getConstantFragment(scope) {
@@ -782,9 +844,12 @@ function getConstantFragment(scope) {
782
844
  (r) => r.join("\n\n")
783
845
  );
784
846
  }
847
+
848
+ // src/fragments/instructionExtraArgs.ts
849
+ var import_visitors_core11 = require("@codama/visitors-core");
785
850
  function getInstructionExtraArgsFragment(scope) {
786
851
  const { instructionPath, extraArgsManifest, nameApi } = scope;
787
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
852
+ const instructionNode = (0, import_visitors_core11.getLastNodeFromPath)(instructionPath);
788
853
  if ((instructionNode.extraArguments ?? []).length === 0) {
789
854
  return fragment("");
790
855
  }
@@ -795,6 +860,18 @@ function getInstructionExtraArgsFragment(scope) {
795
860
  strictName: nameApi.dataType(instructionExtraName)
796
861
  }).mergeImportsWith(extraArgsManifest.looseType);
797
862
  }
863
+
864
+ // src/fragments/instructionFunction.ts
865
+ var import_nodes14 = require("@codama/nodes");
866
+ var import_visitors_core16 = require("@codama/visitors-core");
867
+
868
+ // src/fragments/instructionInputResolved.ts
869
+ var import_nodes11 = require("@codama/nodes");
870
+ var import_visitors_core13 = require("@codama/visitors-core");
871
+
872
+ // src/fragments/instructionInputDefault.ts
873
+ var import_nodes10 = require("@codama/nodes");
874
+ var import_visitors_core12 = require("@codama/visitors-core");
798
875
  function getInstructionInputDefaultFragment(scope) {
799
876
  const { input, optionalAccountStrategy, asyncResolvers, useAsync, nameApi, typeManifestVisitor, getImportFrom } = scope;
800
877
  if (!input.defaultValue) {
@@ -805,11 +882,11 @@ function getInstructionInputDefaultFragment(scope) {
805
882
  }
806
883
  const { defaultValue } = input;
807
884
  const defaultFragment = (renderedValue, isWritable) => {
808
- const inputName = nodes.camelCase(input.name);
809
- if (input.kind === "instructionAccountNode" && nodes.isNode(defaultValue, "resolverValueNode")) {
885
+ const inputName = (0, import_nodes10.camelCase)(input.name);
886
+ if (input.kind === "instructionAccountNode" && (0, import_nodes10.isNode)(defaultValue, "resolverValueNode")) {
810
887
  return fragment(`accounts.${inputName} = { ...accounts.${inputName}, ...${renderedValue} };`);
811
888
  }
812
- if (input.kind === "instructionAccountNode" && isWritable === undefined) {
889
+ if (input.kind === "instructionAccountNode" && isWritable === void 0) {
813
890
  return fragment(`accounts.${inputName}.value = ${renderedValue};`);
814
891
  }
815
892
  if (input.kind === "instructionAccountNode") {
@@ -822,7 +899,7 @@ accounts.${inputName}.isWritable = ${isWritable ? "true" : "false"}`
822
899
  };
823
900
  switch (defaultValue.kind) {
824
901
  case "accountValueNode":
825
- const name = nodes.camelCase(defaultValue.name);
902
+ const name = (0, import_nodes10.camelCase)(defaultValue.name);
826
903
  if (input.kind === "instructionAccountNode" && input.resolvedIsSigner && !input.isSigner) {
827
904
  return defaultFragment(`expectTransactionSigner(accounts.${name}.value).address`).addImports(
828
905
  "shared",
@@ -834,44 +911,44 @@ accounts.${inputName}.isWritable = ${isWritable ? "true" : "false"}`
834
911
  }
835
912
  return defaultFragment(`expectAddress(accounts.${name}.value)`).addImports("shared", "expectAddress");
836
913
  case "pdaValueNode":
837
- if (nodes.isNode(defaultValue.pda, "pdaNode")) {
914
+ if ((0, import_nodes10.isNode)(defaultValue.pda, "pdaNode")) {
838
915
  const pdaProgram = defaultValue.pda.programId ? fragment(
839
916
  `'${defaultValue.pda.programId}' as Address<'${defaultValue.pda.programId}'>`
840
917
  ).addImports("solanaAddresses", "type Address") : fragment("programAddress");
841
918
  const pdaSeeds2 = defaultValue.pda.seeds.flatMap((seed) => {
842
- if (nodes.isNode(seed, "constantPdaSeedNode") && nodes.isNode(seed.value, "programIdValueNode")) {
919
+ if ((0, import_nodes10.isNode)(seed, "constantPdaSeedNode") && (0, import_nodes10.isNode)(seed.value, "programIdValueNode")) {
843
920
  return [
844
921
  fragment(`getAddressEncoder().encode(${pdaProgram.render})`).mergeImportsWith(pdaProgram).addImports("solanaAddresses", "getAddressEncoder")
845
922
  ];
846
923
  }
847
- if (nodes.isNode(seed, "constantPdaSeedNode") && !nodes.isNode(seed.value, "programIdValueNode")) {
848
- const typeManifest2 = visitorsCore.visit(seed.type, typeManifestVisitor);
849
- const valueManifest2 = visitorsCore.visit(seed.value, typeManifestVisitor);
924
+ if ((0, import_nodes10.isNode)(seed, "constantPdaSeedNode") && !(0, import_nodes10.isNode)(seed.value, "programIdValueNode")) {
925
+ const typeManifest2 = (0, import_visitors_core12.visit)(seed.type, typeManifestVisitor);
926
+ const valueManifest2 = (0, import_visitors_core12.visit)(seed.value, typeManifestVisitor);
850
927
  return [
851
928
  fragment(
852
929
  `${typeManifest2.encoder.render}.encode(${valueManifest2.value.render})`
853
930
  ).mergeImportsWith(typeManifest2.encoder, valueManifest2.value)
854
931
  ];
855
932
  }
856
- if (nodes.isNode(seed, "variablePdaSeedNode")) {
857
- const typeManifest2 = visitorsCore.visit(seed.type, typeManifestVisitor);
933
+ if ((0, import_nodes10.isNode)(seed, "variablePdaSeedNode")) {
934
+ const typeManifest2 = (0, import_visitors_core12.visit)(seed.type, typeManifestVisitor);
858
935
  const valueSeed = defaultValue.seeds.find((s) => s.name === seed.name)?.value;
859
936
  if (!valueSeed) return [];
860
- if (nodes.isNode(valueSeed, "accountValueNode")) {
937
+ if ((0, import_nodes10.isNode)(valueSeed, "accountValueNode")) {
861
938
  return [
862
939
  fragment(
863
- `${typeManifest2.encoder.render}.encode(expectAddress(accounts.${nodes.camelCase(valueSeed.name)}.value))`
940
+ `${typeManifest2.encoder.render}.encode(expectAddress(accounts.${(0, import_nodes10.camelCase)(valueSeed.name)}.value))`
864
941
  ).mergeImportsWith(typeManifest2.encoder).addImports("shared", "expectAddress")
865
942
  ];
866
943
  }
867
- if (nodes.isNode(valueSeed, "argumentValueNode")) {
944
+ if ((0, import_nodes10.isNode)(valueSeed, "argumentValueNode")) {
868
945
  return [
869
946
  fragment(
870
- `${typeManifest2.encoder.render}.encode(expectSome(args.${nodes.camelCase(valueSeed.name)}))`
947
+ `${typeManifest2.encoder.render}.encode(expectSome(args.${(0, import_nodes10.camelCase)(valueSeed.name)}))`
871
948
  ).mergeImportsWith(typeManifest2.encoder).addImports("shared", "expectSome")
872
949
  ];
873
950
  }
874
- const valueManifest2 = visitorsCore.visit(valueSeed, typeManifestVisitor);
951
+ const valueManifest2 = (0, import_visitors_core12.visit)(valueSeed, typeManifestVisitor);
875
952
  return [
876
953
  fragment(
877
954
  `${typeManifest2.encoder.render}.encode(${valueManifest2.value.render})`
@@ -889,18 +966,18 @@ accounts.${inputName}.isWritable = ${isWritable ? "true" : "false"}`
889
966
  const pdaFunction = nameApi.pdaFindFunction(defaultValue.pda.name);
890
967
  const pdaArgs = [];
891
968
  const pdaSeeds = defaultValue.seeds.map((seed) => {
892
- if (nodes.isNode(seed.value, "accountValueNode")) {
969
+ if ((0, import_nodes10.isNode)(seed.value, "accountValueNode")) {
893
970
  return fragment(
894
- `${seed.name}: expectAddress(accounts.${nodes.camelCase(seed.value.name)}.value)`
971
+ `${seed.name}: expectAddress(accounts.${(0, import_nodes10.camelCase)(seed.value.name)}.value)`
895
972
  ).addImports("shared", "expectAddress");
896
973
  }
897
- if (nodes.isNode(seed.value, "argumentValueNode")) {
898
- return fragment(`${seed.name}: expectSome(args.${nodes.camelCase(seed.value.name)})`).addImports(
974
+ if ((0, import_nodes10.isNode)(seed.value, "argumentValueNode")) {
975
+ return fragment(`${seed.name}: expectSome(args.${(0, import_nodes10.camelCase)(seed.value.name)})`).addImports(
899
976
  "shared",
900
977
  "expectSome"
901
978
  );
902
979
  }
903
- return visitorsCore.visit(seed.value, typeManifestVisitor).value.mapRender((r) => `${seed.name}: ${r}`);
980
+ return (0, import_visitors_core12.visit)(seed.value, typeManifestVisitor).value.mapRender((r) => `${seed.name}: ${r}`);
904
981
  });
905
982
  const pdaSeedsFragment = mergeFragments(pdaSeeds, (renders) => renders.join(", ")).mapRender((r) => `{ ${r} }`);
906
983
  if (pdaSeeds.length > 0) {
@@ -925,10 +1002,10 @@ accounts.${inputName}.isWritable = ${isWritable ? "true" : "false"}`
925
1002
  return fragment("");
926
1003
  case "accountBumpValueNode":
927
1004
  return defaultFragment(
928
- `expectProgramDerivedAddress(accounts.${nodes.camelCase(defaultValue.name)}.value)[1]`
1005
+ `expectProgramDerivedAddress(accounts.${(0, import_nodes10.camelCase)(defaultValue.name)}.value)[1]`
929
1006
  ).addImports("shared", "expectProgramDerivedAddress");
930
1007
  case "argumentValueNode":
931
- return defaultFragment(`expectSome(args.${nodes.camelCase(defaultValue.name)})`).addImports(
1008
+ return defaultFragment(`expectSome(args.${(0, import_nodes10.camelCase)(defaultValue.name)})`).addImports(
932
1009
  "shared",
933
1010
  "expectSome"
934
1011
  );
@@ -957,16 +1034,16 @@ accounts.${inputName}.isWritable = ${isWritable ? "true" : "false"}`
957
1034
  }
958
1035
  const negatedCondition = !ifTrueRenderer;
959
1036
  let condition = "true";
960
- if (nodes.isNode(defaultValue.condition, "resolverValueNode")) {
1037
+ if ((0, import_nodes10.isNode)(defaultValue.condition, "resolverValueNode")) {
961
1038
  const conditionalResolverFunction = nameApi.resolverFunction(defaultValue.condition.name);
962
1039
  conditionalFragment.addImports(getImportFrom(defaultValue.condition), conditionalResolverFunction).addFeatures(["instruction:resolverScopeVariable"]);
963
1040
  const conditionalResolverAwait = useAsync && asyncResolvers.includes(defaultValue.condition.name) ? "await " : "";
964
1041
  condition = `${conditionalResolverAwait}${conditionalResolverFunction}(resolverScope)`;
965
1042
  condition = negatedCondition ? `!${condition}` : condition;
966
1043
  } else {
967
- const comparedInputName = nodes.isNode(defaultValue.condition, "accountValueNode") ? `accounts.${nodes.camelCase(defaultValue.condition.name)}.value` : `args.${nodes.camelCase(defaultValue.condition.name)}`;
1044
+ const comparedInputName = (0, import_nodes10.isNode)(defaultValue.condition, "accountValueNode") ? `accounts.${(0, import_nodes10.camelCase)(defaultValue.condition.name)}.value` : `args.${(0, import_nodes10.camelCase)(defaultValue.condition.name)}`;
968
1045
  if (defaultValue.value) {
969
- const comparedValue = visitorsCore.visit(defaultValue.value, typeManifestVisitor).value;
1046
+ const comparedValue = (0, import_visitors_core12.visit)(defaultValue.value, typeManifestVisitor).value;
970
1047
  conditionalFragment.mergeImportsWith(comparedValue).mergeFeaturesWith(comparedValue);
971
1048
  const operator = negatedCondition ? "!==" : "===";
972
1049
  condition = `${comparedInputName} ${operator} ${comparedValue.render}`;
@@ -989,13 +1066,13 @@ ${ifTrueRenderer ? ifTrueRenderer.render : ifFalseRenderer?.render}
989
1066
  }`
990
1067
  );
991
1068
  default:
992
- const valueManifest = visitorsCore.visit(defaultValue, typeManifestVisitor).value;
1069
+ const valueManifest = (0, import_visitors_core12.visit)(defaultValue, typeManifestVisitor).value;
993
1070
  return defaultFragment(valueManifest.render).mergeImportsWith(valueManifest);
994
1071
  }
995
1072
  }
996
1073
  function renderNestedInstructionDefault(scope) {
997
1074
  const { input, defaultValue } = scope;
998
- if (!defaultValue) return undefined;
1075
+ if (!defaultValue) return void 0;
999
1076
  return getInstructionInputDefaultFragment({
1000
1077
  ...scope,
1001
1078
  input: { ...input, defaultValue }
@@ -1004,7 +1081,7 @@ function renderNestedInstructionDefault(scope) {
1004
1081
 
1005
1082
  // src/fragments/instructionInputResolved.ts
1006
1083
  function getInstructionInputResolvedFragment(scope) {
1007
- const instructionNode = visitorsCore.getLastNodeFromPath(scope.instructionPath);
1084
+ const instructionNode = (0, import_visitors_core13.getLastNodeFromPath)(scope.instructionPath);
1008
1085
  const resolvedInputFragments = scope.resolvedInputs.flatMap((input) => {
1009
1086
  const inputFragment = getInstructionInputDefaultFragment({
1010
1087
  ...scope,
@@ -1012,10 +1089,10 @@ function getInstructionInputResolvedFragment(scope) {
1012
1089
  optionalAccountStrategy: instructionNode.optionalAccountStrategy
1013
1090
  });
1014
1091
  if (!inputFragment.render) return [];
1015
- const camelName = nodes.camelCase(input.name);
1092
+ const camelName = (0, import_nodes11.camelCase)(input.name);
1016
1093
  return [
1017
1094
  inputFragment.mapRender(
1018
- (r) => nodes.isNode(input, "instructionArgumentNode") ? `if (!args.${camelName}) {
1095
+ (r) => (0, import_nodes11.isNode)(input, "instructionArgumentNode") ? `if (!args.${camelName}) {
1019
1096
  ${r}
1020
1097
  }` : `if (!accounts.${camelName}.value) {
1021
1098
  ${r}
@@ -1031,9 +1108,13 @@ ${r}
1031
1108
  (renders) => renders.join("\n")
1032
1109
  );
1033
1110
  }
1111
+
1112
+ // src/fragments/instructionInputType.ts
1113
+ var import_nodes12 = require("@codama/nodes");
1114
+ var import_visitors_core14 = require("@codama/visitors-core");
1034
1115
  function getInstructionInputTypeFragment(scope) {
1035
1116
  const { instructionPath, useAsync, nameApi } = scope;
1036
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1117
+ const instructionNode = (0, import_visitors_core14.getLastNodeFromPath)(instructionPath);
1037
1118
  const instructionInputType = useAsync ? nameApi.instructionAsyncInputType(instructionNode.name) : nameApi.instructionSyncInputType(instructionNode.name);
1038
1119
  const accountsFragment = getAccountsFragment(scope);
1039
1120
  const [dataArgumentsFragment, customDataArgumentsFragment] = getDataArgumentsFragments(scope);
@@ -1057,22 +1138,22 @@ function getInstructionInputTypeFragment(scope) {
1057
1138
  }
1058
1139
  function getAccountsFragment(scope) {
1059
1140
  const { instructionPath, resolvedInputs, useAsync, asyncResolvers } = scope;
1060
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1141
+ const instructionNode = (0, import_visitors_core14.getLastNodeFromPath)(instructionPath);
1061
1142
  const fragments = instructionNode.accounts.map((account) => {
1062
1143
  const resolvedAccount = resolvedInputs.find(
1063
1144
  (input) => input.kind === "instructionAccountNode" && input.name === account.name
1064
1145
  );
1065
- const hasDefaultValue = !!resolvedAccount.defaultValue && !nodes.isNode(resolvedAccount.defaultValue, ["identityValueNode", "payerValueNode"]) && (useAsync || !isAsyncDefaultValue(resolvedAccount.defaultValue, asyncResolvers));
1146
+ const hasDefaultValue = !!resolvedAccount.defaultValue && !(0, import_nodes12.isNode)(resolvedAccount.defaultValue, ["identityValueNode", "payerValueNode"]) && (useAsync || !isAsyncDefaultValue(resolvedAccount.defaultValue, asyncResolvers));
1066
1147
  const docblock = account.docs.length > 0 ? jsDocblock(account.docs) : "";
1067
1148
  const optionalSign = hasDefaultValue || resolvedAccount.isOptional ? "?" : "";
1068
1149
  return getAccountTypeFragment2(resolvedAccount).mapRender(
1069
- (r) => `${docblock}${nodes.camelCase(account.name)}${optionalSign}: ${r};`
1150
+ (r) => `${docblock}${(0, import_nodes12.camelCase)(account.name)}${optionalSign}: ${r};`
1070
1151
  );
1071
1152
  });
1072
1153
  return mergeFragments(fragments, (r) => r.join("\n"));
1073
1154
  }
1074
1155
  function getAccountTypeFragment2(account) {
1075
- const typeParam = `TAccount${nodes.pascalCase(account.name)}`;
1156
+ const typeParam = `TAccount${(0, import_nodes12.pascalCase)(account.name)}`;
1076
1157
  if (account.isPda && account.isSigner === false) {
1077
1158
  return fragment(`ProgramDerivedAddress<${typeParam}>`).addImports("solanaAddresses", [
1078
1159
  "type ProgramDerivedAddress"
@@ -1091,7 +1172,7 @@ function getAccountTypeFragment2(account) {
1091
1172
  }
1092
1173
  function getDataArgumentsFragments(scope) {
1093
1174
  const { instructionPath, nameApi } = scope;
1094
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1175
+ const instructionNode = (0, import_visitors_core14.getLastNodeFromPath)(instructionPath);
1095
1176
  const customData = scope.customInstructionData.get(instructionNode.name);
1096
1177
  if (customData) {
1097
1178
  return [
@@ -1109,7 +1190,7 @@ function getDataArgumentsFragments(scope) {
1109
1190
  }
1110
1191
  function getExtraArgumentsFragment(scope) {
1111
1192
  const { instructionPath, nameApi } = scope;
1112
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1193
+ const instructionNode = (0, import_visitors_core14.getLastNodeFromPath)(instructionPath);
1113
1194
  const instructionExtraName = nameApi.instructionExtraType(instructionNode.name);
1114
1195
  const extraArgsType = nameApi.dataArgsType(instructionExtraName);
1115
1196
  const fragments = (instructionNode.extraArguments ?? []).flatMap((arg) => {
@@ -1120,18 +1201,18 @@ function getExtraArgumentsFragment(scope) {
1120
1201
  }
1121
1202
  function getArgumentFragment(arg, argsType, resolvedInputs, renamedArgs) {
1122
1203
  const resolvedArg = resolvedInputs.find(
1123
- (input) => nodes.isNode(input, "instructionArgumentNode") && input.name === arg.name
1204
+ (input) => (0, import_nodes12.isNode)(input, "instructionArgumentNode") && input.name === arg.name
1124
1205
  );
1125
1206
  if (arg.defaultValue && arg.defaultValueStrategy === "omitted") return null;
1126
1207
  const renamedName = renamedArgs.get(arg.name) ?? arg.name;
1127
1208
  const optionalSign = arg.defaultValue || resolvedArg?.defaultValue ? "?" : "";
1128
- return argsType.mapRender((r) => `${nodes.camelCase(renamedName)}${optionalSign}: ${r}["${nodes.camelCase(arg.name)}"];`);
1209
+ return argsType.mapRender((r) => `${(0, import_nodes12.camelCase)(renamedName)}${optionalSign}: ${r}["${(0, import_nodes12.camelCase)(arg.name)}"];`);
1129
1210
  }
1130
1211
  function getRemainingAccountsFragment(instructionNode) {
1131
1212
  const fragments = (instructionNode.remainingAccounts ?? []).flatMap((remainingAccountsNode) => {
1132
- if (nodes.isNode(remainingAccountsNode.value, "resolverValueNode")) return [];
1213
+ if ((0, import_nodes12.isNode)(remainingAccountsNode.value, "resolverValueNode")) return [];
1133
1214
  const { name } = remainingAccountsNode.value;
1134
- const allArguments = nodes.getAllInstructionArguments(instructionNode);
1215
+ const allArguments = (0, import_nodes12.getAllInstructionArguments)(instructionNode);
1135
1216
  const argumentExists = allArguments.some((arg) => arg.name === name);
1136
1217
  if (argumentExists) return [];
1137
1218
  const isSigner = remainingAccountsNode.isSigner ?? false;
@@ -1143,12 +1224,16 @@ function getRemainingAccountsFragment(instructionNode) {
1143
1224
  return mergeFragments([signerFragment, addressFragment], (r) => r.join(" | "));
1144
1225
  }
1145
1226
  return isSigner ? signerFragment : addressFragment;
1146
- })().mapRender((r) => `${nodes.camelCase(name)}${optionalSign}: Array<${r}>;`);
1227
+ })().mapRender((r) => `${(0, import_nodes12.camelCase)(name)}${optionalSign}: Array<${r}>;`);
1147
1228
  });
1148
1229
  return mergeFragments(fragments, (r) => r.join("\n"));
1149
1230
  }
1231
+
1232
+ // src/fragments/instructionRemainingAccounts.ts
1233
+ var import_nodes13 = require("@codama/nodes");
1234
+ var import_visitors_core15 = require("@codama/visitors-core");
1150
1235
  function getInstructionRemainingAccountsFragment(scope) {
1151
- const { remainingAccounts } = visitorsCore.getLastNodeFromPath(scope.instructionPath);
1236
+ const { remainingAccounts } = (0, import_visitors_core15.getLastNodeFromPath)(scope.instructionPath);
1152
1237
  const fragments = (remainingAccounts ?? []).flatMap((r) => getRemainingAccountsFragment2(r, scope));
1153
1238
  if (fragments.length === 0) return fragment("");
1154
1239
  return mergeFragments(
@@ -1159,10 +1244,10 @@ const remainingAccounts: IAccountMeta[] = ${r.length === 1 ? r[0] : `[...${r.joi
1159
1244
  }
1160
1245
  function getRemainingAccountsFragment2(remainingAccounts, scope) {
1161
1246
  const remainingAccountsFragment = (() => {
1162
- if (nodes.isNode(remainingAccounts.value, "argumentValueNode")) {
1247
+ if ((0, import_nodes13.isNode)(remainingAccounts.value, "argumentValueNode")) {
1163
1248
  return getArgumentValueNodeFragment2(remainingAccounts, scope);
1164
1249
  }
1165
- if (nodes.isNode(remainingAccounts.value, "resolverValueNode")) {
1250
+ if ((0, import_nodes13.isNode)(remainingAccounts.value, "resolverValueNode")) {
1166
1251
  return getResolverValueNodeFragment2(remainingAccounts, scope);
1167
1252
  }
1168
1253
  return null;
@@ -1171,9 +1256,9 @@ function getRemainingAccountsFragment2(remainingAccounts, scope) {
1171
1256
  return [remainingAccountsFragment];
1172
1257
  }
1173
1258
  function getArgumentValueNodeFragment2(remainingAccounts, scope) {
1174
- const instructionNode = visitorsCore.getLastNodeFromPath(scope.instructionPath);
1175
- nodes.assertIsNode(remainingAccounts.value, "argumentValueNode");
1176
- const argumentName = nodes.camelCase(remainingAccounts.value.name);
1259
+ const instructionNode = (0, import_visitors_core15.getLastNodeFromPath)(scope.instructionPath);
1260
+ (0, import_nodes13.assertIsNode)(remainingAccounts.value, "argumentValueNode");
1261
+ const argumentName = (0, import_nodes13.camelCase)(remainingAccounts.value.name);
1177
1262
  const isOptional = remainingAccounts.isOptional ?? false;
1178
1263
  const isSigner = remainingAccounts.isSigner ?? false;
1179
1264
  const isWritable = remainingAccounts.isWritable ?? false;
@@ -1181,7 +1266,7 @@ function getArgumentValueNodeFragment2(remainingAccounts, scope) {
1181
1266
  const signerRole = isWritable ? "AccountRole.WRITABLE_SIGNER" : "AccountRole.READONLY_SIGNER";
1182
1267
  const role = isSigner === true ? signerRole : nonSignerRole;
1183
1268
  const argumentArray = isOptional ? `(args.${argumentName} ?? [])` : `args.${argumentName}`;
1184
- const allArguments = nodes.getAllInstructionArguments(instructionNode);
1269
+ const allArguments = (0, import_nodes13.getAllInstructionArguments)(instructionNode);
1185
1270
  const argumentExists = allArguments.some((arg) => arg.name === remainingAccounts.value.name);
1186
1271
  if (argumentExists || isSigner === false) {
1187
1272
  return fragment(`${argumentArray}.map((address) => ({ address, role: ${role} }))`).addImports(
@@ -1202,7 +1287,7 @@ function getArgumentValueNodeFragment2(remainingAccounts, scope) {
1202
1287
  ).addImports("solanaInstructions", ["AccountRole"]);
1203
1288
  }
1204
1289
  function getResolverValueNodeFragment2(remainingAccounts, scope) {
1205
- nodes.assertIsNode(remainingAccounts.value, "resolverValueNode");
1290
+ (0, import_nodes13.assertIsNode)(remainingAccounts.value, "resolverValueNode");
1206
1291
  const isAsync = scope.asyncResolvers.includes(remainingAccounts.value.name);
1207
1292
  if (!scope.useAsync && isAsync) return null;
1208
1293
  const awaitKeyword = scope.useAsync && isAsync ? "await " : "";
@@ -1222,8 +1307,8 @@ function getInstructionFunctionFragment(scope) {
1222
1307
  nameApi,
1223
1308
  customInstructionData
1224
1309
  } = scope;
1225
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1226
- const programNode = visitorsCore.findProgramNodeFromPath(instructionPath);
1310
+ const instructionNode = (0, import_visitors_core16.getLastNodeFromPath)(instructionPath);
1311
+ const programNode = (0, import_visitors_core16.findProgramNodeFromPath)(instructionPath);
1227
1312
  if (useAsync && !hasAsyncFunction(instructionNode, resolvedInputs, asyncResolvers)) {
1228
1313
  return fragment("");
1229
1314
  }
@@ -1231,7 +1316,7 @@ function getInstructionFunctionFragment(scope) {
1231
1316
  const hasAccounts = instructionNode.accounts.length > 0;
1232
1317
  const hasLegacyOptionalAccounts = instructionNode.optionalAccountStrategy === "omitted" && instructionNode.accounts.some((account) => account.isOptional);
1233
1318
  const instructionDependencies = getInstructionDependencies(instructionNode, asyncResolvers, useAsync);
1234
- const argDependencies = instructionDependencies.filter(nodes.isNodeFilter("argumentValueNode")).map((node) => node.name);
1319
+ const argDependencies = instructionDependencies.filter((0, import_nodes14.isNodeFilter)("argumentValueNode")).map((node) => node.name);
1235
1320
  const hasData = !!customData || instructionNode.arguments.length > 0;
1236
1321
  const argIsNotOmitted = (arg) => !(arg.defaultValue && arg.defaultValueStrategy === "omitted");
1237
1322
  const argIsDependent = (arg) => argDependencies.includes(arg.name);
@@ -1244,7 +1329,7 @@ function getInstructionFunctionFragment(scope) {
1244
1329
  const hasExtraArgs = (instructionNode.extraArguments ?? []).filter(
1245
1330
  (field) => argIsNotOmitted(field) && (argIsDependent(field) || argHasDefaultValue(field))
1246
1331
  ).length > 0;
1247
- const hasRemainingAccountArgs = (instructionNode.remainingAccounts ?? []).filter(({ value }) => nodes.isNode(value, "argumentValueNode")).length > 0;
1332
+ const hasRemainingAccountArgs = (instructionNode.remainingAccounts ?? []).filter(({ value }) => (0, import_nodes14.isNode)(value, "argumentValueNode")).length > 0;
1248
1333
  const hasAnyArgs = hasDataArgs || hasExtraArgs || hasRemainingAccountArgs;
1249
1334
  const hasInput = hasAccounts || hasAnyArgs;
1250
1335
  const instructionDataName = nameApi.instructionDataType(instructionNode.name);
@@ -1320,18 +1405,18 @@ function getInstructionFunctionFragment(scope) {
1320
1405
  return functionFragment;
1321
1406
  }
1322
1407
  function getTypeParams(instructionNode, programAddressConstant) {
1323
- const typeParams = instructionNode.accounts.map((account) => `TAccount${nodes.pascalCase(account.name)} extends string`);
1408
+ const typeParams = instructionNode.accounts.map((account) => `TAccount${(0, import_nodes14.pascalCase)(account.name)} extends string`);
1324
1409
  typeParams.push(`TProgramAddress extends Address = typeof ${programAddressConstant}`);
1325
1410
  return fragment(typeParams.filter((x) => !!x).join(", ")).mapRender((r) => `<${r}>`).addImports("generatedPrograms", [programAddressConstant]);
1326
1411
  }
1327
1412
  function getInstructionType(scope) {
1328
1413
  const { instructionPath, nameApi } = scope;
1329
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1414
+ const instructionNode = (0, import_visitors_core16.getLastNodeFromPath)(instructionPath);
1330
1415
  const instructionTypeName = nameApi.instructionType(instructionNode.name);
1331
1416
  const programAddressFragment = fragment("TProgramAddress");
1332
1417
  const accountTypeParamsFragments = instructionNode.accounts.map((account) => {
1333
- const typeParam = `TAccount${nodes.pascalCase(account.name)}`;
1334
- const camelName = nodes.camelCase(account.name);
1418
+ const typeParam = `TAccount${(0, import_nodes14.pascalCase)(account.name)}`;
1419
+ const camelName = (0, import_nodes14.camelCase)(account.name);
1335
1420
  if (account.isSigner === "either") {
1336
1421
  const signerRole = account.isWritable ? "WritableSignerAccount" : "ReadonlySignerAccount";
1337
1422
  return fragment(
@@ -1347,16 +1432,19 @@ function getInstructionType(scope) {
1347
1432
  }
1348
1433
  function getInputTypeCall(scope) {
1349
1434
  const { instructionPath, useAsync, nameApi } = scope;
1350
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1435
+ const instructionNode = (0, import_visitors_core16.getLastNodeFromPath)(instructionPath);
1351
1436
  const inputTypeName = useAsync ? nameApi.instructionAsyncInputType(instructionNode.name) : nameApi.instructionSyncInputType(instructionNode.name);
1352
1437
  if (instructionNode.accounts.length === 0) return fragment(inputTypeName);
1353
- const accountTypeParams = instructionNode.accounts.map((account) => `TAccount${nodes.pascalCase(account.name)}`).join(", ");
1438
+ const accountTypeParams = instructionNode.accounts.map((account) => `TAccount${(0, import_nodes14.pascalCase)(account.name)}`).join(", ");
1354
1439
  return fragment(`${inputTypeName}<${accountTypeParams}>`);
1355
1440
  }
1441
+
1442
+ // src/fragments/instructionParseFunction.ts
1443
+ var import_visitors_core17 = require("@codama/visitors-core");
1356
1444
  function getInstructionParseFunctionFragment(scope) {
1357
1445
  const { instructionPath, dataArgsManifest, nameApi, customInstructionData } = scope;
1358
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1359
- const programNode = visitorsCore.findProgramNodeFromPath(instructionPath);
1446
+ const instructionNode = (0, import_visitors_core17.getLastNodeFromPath)(instructionPath);
1447
+ const programNode = (0, import_visitors_core17.findProgramNodeFromPath)(instructionPath);
1360
1448
  const customData = customInstructionData.get(instructionNode.name);
1361
1449
  const hasAccounts = instructionNode.accounts.length > 0;
1362
1450
  const hasOptionalAccounts = instructionNode.accounts.some((account) => account.isOptional);
@@ -1384,16 +1472,20 @@ function getInstructionParseFunctionFragment(scope) {
1384
1472
  programAddressConstant
1385
1473
  }).mergeImportsWith(dataTypeFragment).addImports("generatedPrograms", [programAddressConstant]).addImports("solanaInstructions", ["type IInstruction"]).addImports("solanaInstructions", hasAccounts ? ["type IInstructionWithAccounts", "type IAccountMeta"] : []).addImports("solanaInstructions", hasData ? ["type IInstructionWithData"] : []);
1386
1474
  }
1475
+
1476
+ // src/fragments/instructionType.ts
1477
+ var import_nodes15 = require("@codama/nodes");
1478
+ var import_visitors_core18 = require("@codama/visitors-core");
1387
1479
  function getInstructionTypeFragment(scope) {
1388
1480
  const { instructionPath, nameApi, customInstructionData } = scope;
1389
- const instructionNode = visitorsCore.getLastNodeFromPath(instructionPath);
1390
- const programNode = visitorsCore.findProgramNodeFromPath(instructionPath);
1481
+ const instructionNode = (0, import_visitors_core18.getLastNodeFromPath)(instructionPath);
1482
+ const programNode = (0, import_visitors_core18.findProgramNodeFromPath)(instructionPath);
1391
1483
  const hasAccounts = instructionNode.accounts.length > 0;
1392
1484
  const customData = customInstructionData.get(instructionNode.name);
1393
1485
  const hasData = !!customData || instructionNode.arguments.length > 0;
1394
1486
  const instructionDataName = nameApi.instructionDataType(instructionNode.name);
1395
1487
  const programAddressConstant = nameApi.programAddressConstant(programNode.name);
1396
- const dataType = customData ? nodes.pascalCase(customData.importAs) : nodes.pascalCase(instructionDataName);
1488
+ const dataType = customData ? (0, import_nodes15.pascalCase)(customData.importAs) : (0, import_nodes15.pascalCase)(instructionDataName);
1397
1489
  const accountTypeParamsFragment = mergeFragments(
1398
1490
  instructionNode.accounts.map(
1399
1491
  (account) => getInstructionAccountTypeParamFragment({
@@ -1408,7 +1500,7 @@ function getInstructionTypeFragment(scope) {
1408
1500
  const accountMetasFragment = mergeFragments(
1409
1501
  instructionNode.accounts.map(
1410
1502
  (account) => getInstructionAccountMetaFragment(account).mapRender((r) => {
1411
- const typeParam = `TAccount${nodes.pascalCase(account.name)}`;
1503
+ const typeParam = `TAccount${(0, import_nodes15.pascalCase)(account.name)}`;
1412
1504
  const isLegacyOptional = account.isOptional && usesLegacyOptionalAccounts;
1413
1505
  const type = `${typeParam} extends string ? ${r} : ${typeParam}`;
1414
1506
  if (!isLegacyOptional) return type;
@@ -1434,28 +1526,32 @@ function getInstructionTypeFragment(scope) {
1434
1526
  ]);
1435
1527
  return fragment2;
1436
1528
  }
1529
+
1530
+ // src/fragments/pdaFunction.ts
1531
+ var import_nodes16 = require("@codama/nodes");
1532
+ var import_visitors_core19 = require("@codama/visitors-core");
1437
1533
  function getPdaFunctionFragment(scope) {
1438
1534
  const { pdaPath, typeManifestVisitor, nameApi } = scope;
1439
- const pdaNode = visitorsCore.getLastNodeFromPath(pdaPath);
1440
- const programNode = visitorsCore.findProgramNodeFromPath(pdaPath);
1535
+ const pdaNode = (0, import_visitors_core19.getLastNodeFromPath)(pdaPath);
1536
+ const programNode = (0, import_visitors_core19.findProgramNodeFromPath)(pdaPath);
1441
1537
  const imports = new ImportMap();
1442
1538
  const seeds = pdaNode.seeds.map((seed) => {
1443
- if (nodes.isNode(seed, "variablePdaSeedNode")) {
1444
- const seedManifest2 = visitorsCore.visit(seed.type, typeManifestVisitor);
1539
+ if ((0, import_nodes16.isNode)(seed, "variablePdaSeedNode")) {
1540
+ const seedManifest2 = (0, import_visitors_core19.visit)(seed.type, typeManifestVisitor);
1445
1541
  imports.mergeWith(seedManifest2.looseType, seedManifest2.encoder);
1446
1542
  return { ...seed, typeManifest: seedManifest2 };
1447
1543
  }
1448
- if (nodes.isNode(seed.value, "programIdValueNode")) {
1544
+ if ((0, import_nodes16.isNode)(seed.value, "programIdValueNode")) {
1449
1545
  imports.add("solanaAddresses", "getAddressEncoder");
1450
1546
  return seed;
1451
1547
  }
1452
- const seedManifest = visitorsCore.visit(seed.type, typeManifestVisitor);
1548
+ const seedManifest = (0, import_visitors_core19.visit)(seed.type, typeManifestVisitor);
1453
1549
  imports.mergeWith(seedManifest.encoder);
1454
- const valueManifest = visitorsCore.visit(seed.value, typeManifestVisitor).value;
1550
+ const valueManifest = (0, import_visitors_core19.visit)(seed.value, typeManifestVisitor).value;
1455
1551
  imports.mergeWith(valueManifest.imports);
1456
1552
  return { ...seed, typeManifest: seedManifest, valueManifest };
1457
1553
  });
1458
- const hasVariableSeeds = pdaNode.seeds.filter(nodes.isNodeFilter("variablePdaSeedNode")).length > 0;
1554
+ const hasVariableSeeds = pdaNode.seeds.filter((0, import_nodes16.isNodeFilter)("variablePdaSeedNode")).length > 0;
1459
1555
  return fragmentFromTemplate("pdaFunction.njk", {
1460
1556
  findPdaFunction: nameApi.pdaFindFunction(pdaNode.name),
1461
1557
  hasVariableSeeds,
@@ -1473,6 +1569,9 @@ function getProgramFragment(scope) {
1473
1569
  programAddressConstant: nameApi.programAddressConstant(programNode.name)
1474
1570
  }).addImports("solanaAddresses", ["type Address"]);
1475
1571
  }
1572
+
1573
+ // src/fragments/programAccounts.ts
1574
+ var import_nodes17 = require("@codama/nodes");
1476
1575
  function getProgramAccountsFragment(scope) {
1477
1576
  if (scope.programNode.accounts.length === 0) return fragment("");
1478
1577
  return mergeFragments(
@@ -1506,7 +1605,7 @@ function getProgramAccountsIdentifierFunctionFragment(scope) {
1506
1605
  dataName: "data",
1507
1606
  discriminators: account.discriminators ?? [],
1508
1607
  ifTrue: `return ${programAccountsEnum}.${variant};`,
1509
- struct: nodes.resolveNestedTypeNode(account.data)
1608
+ struct: (0, import_nodes17.resolveNestedTypeNode)(account.data)
1510
1609
  });
1511
1610
  }),
1512
1611
  (r) => r.join("\n")
@@ -1534,9 +1633,12 @@ function getProgramErrorsFragment(scope) {
1534
1633
  programIsErrorFunction: nameApi.programIsErrorFunction(programNode.name)
1535
1634
  }).addImports("generatedPrograms", [programAddressConstant]).addImports("solanaPrograms", ["isProgramError"]).addImports("solanaErrors", ["type SolanaError", "type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM"]).addImports("solanaAddresses", ["type Address"]);
1536
1635
  }
1636
+
1637
+ // src/fragments/programInstructions.ts
1638
+ var import_nodes18 = require("@codama/nodes");
1537
1639
  function getProgramInstructionsFragment(scope) {
1538
1640
  if (scope.programNode.instructions.length === 0) return fragment("");
1539
- const allInstructions = nodes.getAllInstructionsWithSubs(scope.programNode, {
1641
+ const allInstructions = (0, import_nodes18.getAllInstructionsWithSubs)(scope.programNode, {
1540
1642
  leavesOnly: !scope.renderParentInstructions,
1541
1643
  subInstructionsFirst: true
1542
1644
  });
@@ -1578,7 +1680,7 @@ function getProgramInstructionsIdentifierFunctionFragment(scope) {
1578
1680
  dataName: "data",
1579
1681
  discriminators: instruction.discriminators ?? [],
1580
1682
  ifTrue: `return ${programInstructionsEnum}.${variant};`,
1581
- struct: nodes.structTypeNodeFromInstructionArgumentNodes(instruction.arguments)
1683
+ struct: (0, import_nodes18.structTypeNodeFromInstructionArgumentNodes)(instruction.arguments)
1582
1684
  });
1583
1685
  }),
1584
1686
  (r) => r.join("\n")
@@ -1611,9 +1713,12 @@ function getProgramInstructionsParsedUnionTypeFragment(scope) {
1611
1713
  (r) => r.join("\n")
1612
1714
  );
1613
1715
  }
1716
+
1717
+ // src/fragments/typeDiscriminatedUnionHelpers.ts
1718
+ var import_nodes19 = require("@codama/nodes");
1614
1719
  function getTypeDiscriminatedUnionHelpersFragment(scope) {
1615
1720
  const { name, typeNode, nameApi } = scope;
1616
- const isDiscriminatedUnion = nodes.isNode(typeNode, "enumTypeNode") && nodes.isDataEnum(typeNode);
1721
+ const isDiscriminatedUnion = (0, import_nodes19.isNode)(typeNode, "enumTypeNode") && (0, import_nodes19.isDataEnum)(typeNode);
1617
1722
  if (!isDiscriminatedUnion) {
1618
1723
  return fragment("");
1619
1724
  }
@@ -1654,12 +1759,23 @@ function mergeManifests(manifests, options = {}) {
1654
1759
  value: merge((m) => m.value, mergeValues)
1655
1760
  };
1656
1761
  }
1762
+
1763
+ // src/getRenderMapVisitor.ts
1764
+ var import_node_path3 = require("path");
1765
+ var import_errors2 = require("@codama/errors");
1766
+ var import_nodes22 = require("@codama/nodes");
1767
+ var import_renderers_core = require("@codama/renderers-core");
1768
+ var import_visitors_core21 = require("@codama/visitors-core");
1769
+
1770
+ // src/getTypeManifestVisitor.ts
1771
+ var import_nodes20 = require("@codama/nodes");
1772
+ var import_visitors_core20 = require("@codama/visitors-core");
1657
1773
  function getTypeManifestVisitor(input) {
1658
1774
  const { nameApi, linkables, nonScalarEnums, customAccountData, customInstructionData, getImportFrom } = input;
1659
- const stack = input.stack ?? new visitorsCore.NodeStack();
1775
+ const stack = input.stack ?? new import_visitors_core20.NodeStack();
1660
1776
  let parentName = null;
1661
- return visitorsCore.pipe(
1662
- visitorsCore.staticVisitor(
1777
+ return (0, import_visitors_core20.pipe)(
1778
+ (0, import_visitors_core20.staticVisitor)(
1663
1779
  () => ({
1664
1780
  decoder: fragment(""),
1665
1781
  encoder: fragment(""),
@@ -1670,8 +1786,8 @@ function getTypeManifestVisitor(input) {
1670
1786
  }),
1671
1787
  {
1672
1788
  keys: [
1673
- ...nodes.REGISTERED_TYPE_NODE_KINDS,
1674
- ...nodes.REGISTERED_VALUE_NODE_KINDS,
1789
+ ...import_nodes20.REGISTERED_TYPE_NODE_KINDS,
1790
+ ...import_nodes20.REGISTERED_VALUE_NODE_KINDS,
1675
1791
  "definedTypeLinkNode",
1676
1792
  "definedTypeNode",
1677
1793
  "accountNode",
@@ -1679,22 +1795,22 @@ function getTypeManifestVisitor(input) {
1679
1795
  ]
1680
1796
  }
1681
1797
  ),
1682
- (visitor) => visitorsCore.extendVisitor(visitor, {
1798
+ (visitor) => (0, import_visitors_core20.extendVisitor)(visitor, {
1683
1799
  visitAccount(account, { self }) {
1684
1800
  parentName = {
1685
1801
  loose: nameApi.dataArgsType(account.name),
1686
1802
  strict: nameApi.dataType(account.name)
1687
1803
  };
1688
1804
  const link = customAccountData.get(account.name)?.linkNode;
1689
- const manifest = link ? visitorsCore.visit(link, self) : visitorsCore.visit(account.data, self);
1805
+ const manifest = link ? (0, import_visitors_core20.visit)(link, self) : (0, import_visitors_core20.visit)(account.data, self);
1690
1806
  parentName = null;
1691
1807
  return manifest;
1692
1808
  },
1693
1809
  visitAmountType(amountType, { self }) {
1694
- return visitorsCore.visit(amountType.number, self);
1810
+ return (0, import_visitors_core20.visit)(amountType.number, self);
1695
1811
  },
1696
1812
  visitArrayType(arrayType, { self }) {
1697
- const childManifest = visitorsCore.visit(arrayType.item, self);
1813
+ const childManifest = (0, import_visitors_core20.visit)(arrayType.item, self);
1698
1814
  childManifest.looseType.mapRender((r) => `Array<${r}>`);
1699
1815
  childManifest.strictType.mapRender((r) => `Array<${r}>`);
1700
1816
  const sizeManifest = getArrayLikeSizeOption(arrayType.count, self);
@@ -1706,7 +1822,7 @@ function getTypeManifestVisitor(input) {
1706
1822
  },
1707
1823
  visitArrayValue(node, { self }) {
1708
1824
  return mergeManifests(
1709
- node.items.map((v) => visitorsCore.visit(v, self)),
1825
+ node.items.map((v) => (0, import_visitors_core20.visit)(v, self)),
1710
1826
  { mergeValues: (renders) => `[${renders.join(", ")}]` }
1711
1827
  );
1712
1828
  },
@@ -1715,9 +1831,9 @@ function getTypeManifestVisitor(input) {
1715
1831
  const decoderImports = new ImportMap().add("solanaCodecsDataStructures", "getBooleanDecoder");
1716
1832
  let sizeEncoder = "";
1717
1833
  let sizeDecoder = "";
1718
- const resolvedSize = nodes.resolveNestedTypeNode(booleanType.size);
1834
+ const resolvedSize = (0, import_nodes20.resolveNestedTypeNode)(booleanType.size);
1719
1835
  if (resolvedSize.format !== "u8" || resolvedSize.endian !== "le") {
1720
- const size = visitorsCore.visit(booleanType.size, self);
1836
+ const size = (0, import_visitors_core20.visit)(booleanType.size, self);
1721
1837
  encoderImports.mergeWith(size.encoder);
1722
1838
  decoderImports.mergeWith(size.decoder);
1723
1839
  sizeEncoder = `{ size: ${size.encoder.render} }`;
@@ -1766,26 +1882,26 @@ function getTypeManifestVisitor(input) {
1766
1882
  return manifest;
1767
1883
  },
1768
1884
  visitConstantValue(node, { self }) {
1769
- if (nodes.isNode(node.type, "bytesTypeNode") && nodes.isNode(node.value, "bytesValueNode")) {
1770
- return visitorsCore.visit(node.value, self);
1885
+ if ((0, import_nodes20.isNode)(node.type, "bytesTypeNode") && (0, import_nodes20.isNode)(node.value, "bytesValueNode")) {
1886
+ return (0, import_visitors_core20.visit)(node.value, self);
1771
1887
  }
1772
1888
  return {
1773
1889
  ...typeManifest(),
1774
1890
  value: mergeFragments(
1775
- [visitorsCore.visit(node.type, self).encoder, visitorsCore.visit(node.value, self).value],
1891
+ [(0, import_visitors_core20.visit)(node.type, self).encoder, (0, import_visitors_core20.visit)(node.value, self).value],
1776
1892
  ([encoderFunction, value]) => `${encoderFunction}.encode(${value})`
1777
1893
  )
1778
1894
  };
1779
1895
  },
1780
1896
  visitDateTimeType(dateTimeType, { self }) {
1781
- return visitorsCore.visit(dateTimeType.number, self);
1897
+ return (0, import_visitors_core20.visit)(dateTimeType.number, self);
1782
1898
  },
1783
1899
  visitDefinedType(definedType, { self }) {
1784
1900
  parentName = {
1785
1901
  loose: nameApi.dataArgsType(definedType.name),
1786
1902
  strict: nameApi.dataType(definedType.name)
1787
1903
  };
1788
- const manifest = visitorsCore.visit(definedType.type, self);
1904
+ const manifest = (0, import_visitors_core20.visit)(definedType.type, self);
1789
1905
  parentName = null;
1790
1906
  return manifest;
1791
1907
  },
@@ -1805,7 +1921,7 @@ function getTypeManifestVisitor(input) {
1805
1921
  };
1806
1922
  },
1807
1923
  visitEnumEmptyVariantType(enumEmptyVariantType) {
1808
- const discriminator = nameApi.discriminatedUnionDiscriminator(nodes.camelCase(parentName?.strict ?? ""));
1924
+ const discriminator = nameApi.discriminatedUnionDiscriminator((0, import_nodes20.camelCase)(parentName?.strict ?? ""));
1809
1925
  const name = nameApi.discriminatedUnionVariant(enumEmptyVariantType.name);
1810
1926
  const kindAttribute = `${discriminator}: "${name}"`;
1811
1927
  return {
@@ -1826,12 +1942,12 @@ function getTypeManifestVisitor(input) {
1826
1942
  visitEnumStructVariantType(enumStructVariantType, { self }) {
1827
1943
  const currentParentName = parentName;
1828
1944
  const discriminator = nameApi.discriminatedUnionDiscriminator(
1829
- nodes.camelCase(currentParentName?.strict ?? "")
1945
+ (0, import_nodes20.camelCase)(currentParentName?.strict ?? "")
1830
1946
  );
1831
1947
  const name = nameApi.discriminatedUnionVariant(enumStructVariantType.name);
1832
1948
  const kindAttribute = `${discriminator}: "${name}"`;
1833
1949
  parentName = null;
1834
- const structManifest = visitorsCore.visit(enumStructVariantType.struct, self);
1950
+ const structManifest = (0, import_visitors_core20.visit)(enumStructVariantType.struct, self);
1835
1951
  parentName = currentParentName;
1836
1952
  structManifest.strictType.mapRender((r) => `{ ${kindAttribute},${r.slice(1, -1)}}`);
1837
1953
  structManifest.looseType.mapRender((r) => `{ ${kindAttribute},${r.slice(1, -1)}}`);
@@ -1842,18 +1958,18 @@ function getTypeManifestVisitor(input) {
1842
1958
  visitEnumTupleVariantType(enumTupleVariantType, { self }) {
1843
1959
  const currentParentName = parentName;
1844
1960
  const discriminator = nameApi.discriminatedUnionDiscriminator(
1845
- nodes.camelCase(currentParentName?.strict ?? "")
1961
+ (0, import_nodes20.camelCase)(currentParentName?.strict ?? "")
1846
1962
  );
1847
1963
  const name = nameApi.discriminatedUnionVariant(enumTupleVariantType.name);
1848
1964
  const kindAttribute = `${discriminator}: "${name}"`;
1849
- const struct = nodes.structTypeNode([
1850
- nodes.structFieldTypeNode({
1965
+ const struct = (0, import_nodes20.structTypeNode)([
1966
+ (0, import_nodes20.structFieldTypeNode)({
1851
1967
  name: "fields",
1852
1968
  type: enumTupleVariantType.tuple
1853
1969
  })
1854
1970
  ]);
1855
1971
  parentName = null;
1856
- const structManifest = visitorsCore.visit(struct, self);
1972
+ const structManifest = (0, import_visitors_core20.visit)(struct, self);
1857
1973
  parentName = currentParentName;
1858
1974
  structManifest.strictType.mapRender((r) => `{ ${kindAttribute},${r.slice(1, -1)}}`);
1859
1975
  structManifest.looseType.mapRender((r) => `{ ${kindAttribute},${r.slice(1, -1)}}`);
@@ -1867,24 +1983,24 @@ function getTypeManifestVisitor(input) {
1867
1983
  const decoderImports = new ImportMap();
1868
1984
  const encoderOptions = [];
1869
1985
  const decoderOptions = [];
1870
- const enumSize = nodes.resolveNestedTypeNode(enumType.size);
1986
+ const enumSize = (0, import_nodes20.resolveNestedTypeNode)(enumType.size);
1871
1987
  if (enumSize.format !== "u8" || enumSize.endian !== "le") {
1872
- const sizeManifest = visitorsCore.visit(enumType.size, self);
1988
+ const sizeManifest = (0, import_visitors_core20.visit)(enumType.size, self);
1873
1989
  encoderImports.mergeWith(sizeManifest.encoder);
1874
1990
  decoderImports.mergeWith(sizeManifest.decoder);
1875
1991
  encoderOptions.push(`size: ${sizeManifest.encoder.render}`);
1876
1992
  decoderOptions.push(`size: ${sizeManifest.decoder.render}`);
1877
1993
  }
1878
1994
  const discriminator = nameApi.discriminatedUnionDiscriminator(
1879
- nodes.camelCase(currentParentName?.strict ?? "")
1995
+ (0, import_nodes20.camelCase)(currentParentName?.strict ?? "")
1880
1996
  );
1881
- if (!nodes.isScalarEnum(enumType) && discriminator !== "__kind") {
1997
+ if (!(0, import_nodes20.isScalarEnum)(enumType) && discriminator !== "__kind") {
1882
1998
  encoderOptions.push(`discriminator: '${discriminator}'`);
1883
1999
  decoderOptions.push(`discriminator: '${discriminator}'`);
1884
2000
  }
1885
2001
  const encoderOptionsAsString = encoderOptions.length > 0 ? `, { ${encoderOptions.join(", ")} }` : "";
1886
2002
  const decoderOptionsAsString = decoderOptions.length > 0 ? `, { ${decoderOptions.join(", ")} }` : "";
1887
- if (nodes.isScalarEnum(enumType)) {
2003
+ if ((0, import_nodes20.isScalarEnum)(enumType)) {
1888
2004
  if (currentParentName === null) {
1889
2005
  throw new Error(
1890
2006
  "Scalar enums cannot be inlined and must be introduced via a defined type. Ensure you are not inlining a defined type that is a scalar enum through a visitor."
@@ -1907,7 +2023,7 @@ function getTypeManifestVisitor(input) {
1907
2023
  };
1908
2024
  }
1909
2025
  const mergedManifest = mergeManifests(
1910
- enumType.variants.map((variant) => visitorsCore.visit(variant, self)),
2026
+ enumType.variants.map((variant) => (0, import_visitors_core20.visit)(variant, self)),
1911
2027
  {
1912
2028
  mergeCodecs: (renders) => renders.join(", "),
1913
2029
  mergeTypes: (renders) => renders.join(" | ")
@@ -1923,7 +2039,7 @@ function getTypeManifestVisitor(input) {
1923
2039
  const enumFunction = nameApi.discriminatedUnionFunction(node.enum.name);
1924
2040
  const importFrom = getImportFrom(node.enum);
1925
2041
  const enumNode = linkables.get([...stack.getPath(), node.enum])?.type;
1926
- const isScalar = enumNode && nodes.isNode(enumNode, "enumTypeNode") ? nodes.isScalarEnum(enumNode) : !nonScalarEnums.includes(node.enum.name);
2042
+ const isScalar = enumNode && (0, import_nodes20.isNode)(enumNode, "enumTypeNode") ? (0, import_nodes20.isScalarEnum)(enumNode) : !nonScalarEnums.includes(node.enum.name);
1927
2043
  if (!node.value && isScalar) {
1928
2044
  const variantName2 = nameApi.enumVariant(node.variant);
1929
2045
  manifest.value.setRender(`${enumName}.${variantName2}`).addImports(importFrom, enumName);
@@ -1934,18 +2050,18 @@ function getTypeManifestVisitor(input) {
1934
2050
  manifest.value.setRender(`${enumFunction}('${variantName}')`).addImports(importFrom, enumFunction);
1935
2051
  return manifest;
1936
2052
  }
1937
- manifest.value = visitorsCore.visit(node.value, self).value.mapRender((r) => `${enumFunction}('${variantName}', ${r})`).addImports(importFrom, enumFunction);
2053
+ manifest.value = (0, import_visitors_core20.visit)(node.value, self).value.mapRender((r) => `${enumFunction}('${variantName}', ${r})`).addImports(importFrom, enumFunction);
1938
2054
  return manifest;
1939
2055
  },
1940
2056
  visitFixedSizeType(node, { self }) {
1941
- const manifest = visitorsCore.visit(node.type, self);
2057
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
1942
2058
  manifest.encoder.mapRender((r) => `fixEncoderSize(${r}, ${node.size})`).addImports("solanaCodecsCore", "fixEncoderSize");
1943
2059
  manifest.decoder.mapRender((r) => `fixDecoderSize(${r}, ${node.size})`).addImports("solanaCodecsCore", "fixDecoderSize");
1944
2060
  return manifest;
1945
2061
  },
1946
2062
  visitHiddenPrefixType(node, { self }) {
1947
- const manifest = visitorsCore.visit(node.type, self);
1948
- const prefixes = node.prefix.map((c) => visitorsCore.visit(c, self).value);
2063
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2064
+ const prefixes = node.prefix.map((c) => (0, import_visitors_core20.visit)(c, self).value);
1949
2065
  const prefixEncoders = fragment(prefixes.map((c) => `getConstantEncoder(${c.render})`).join(", ")).addImports("solanaCodecsCore", "getConstantEncoder").mergeImportsWith(...prefixes);
1950
2066
  const prefixDecoders = fragment(prefixes.map((c) => `getConstantDecoder(${c.render})`).join(", ")).addImports("solanaCodecsCore", "getConstantDecoder").mergeImportsWith(...prefixes);
1951
2067
  manifest.encoder.mapRender((r) => `getHiddenPrefixEncoder(${r}, [${prefixEncoders.render}])`).mergeImportsWith(prefixEncoders).addImports("solanaCodecsDataStructures", "getHiddenPrefixEncoder");
@@ -1953,8 +2069,8 @@ function getTypeManifestVisitor(input) {
1953
2069
  return manifest;
1954
2070
  },
1955
2071
  visitHiddenSuffixType(node, { self }) {
1956
- const manifest = visitorsCore.visit(node.type, self);
1957
- const suffixes = node.suffix.map((c) => visitorsCore.visit(c, self).value);
2072
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2073
+ const suffixes = node.suffix.map((c) => (0, import_visitors_core20.visit)(c, self).value);
1958
2074
  const suffixEncoders = fragment(suffixes.map((c) => `getConstantEncoder(${c.render})`).join(", ")).addImports("solanaCodecsCore", "getConstantEncoder").mergeImportsWith(...suffixes);
1959
2075
  const suffixDecoders = fragment(suffixes.map((c) => `getConstantDecoder(${c.render})`).join(", ")).addImports("solanaCodecsCore", "getConstantDecoder").mergeImportsWith(...suffixes);
1960
2076
  manifest.encoder.mapRender((r) => `getHiddenSuffixEncoder(${r}, [${suffixEncoders.render}])`).mergeImportsWith(suffixEncoders).addImports("solanaCodecsDataStructures", "getHiddenSuffixEncoder");
@@ -1968,19 +2084,19 @@ function getTypeManifestVisitor(input) {
1968
2084
  strict: nameApi.dataType(instructionDataName)
1969
2085
  };
1970
2086
  const link = customInstructionData.get(instruction.name)?.linkNode;
1971
- const struct = nodes.structTypeNodeFromInstructionArgumentNodes(instruction.arguments);
1972
- const manifest = link ? visitorsCore.visit(link, self) : visitorsCore.visit(struct, self);
2087
+ const struct = (0, import_nodes20.structTypeNodeFromInstructionArgumentNodes)(instruction.arguments);
2088
+ const manifest = link ? (0, import_visitors_core20.visit)(link, self) : (0, import_visitors_core20.visit)(struct, self);
1973
2089
  parentName = null;
1974
2090
  return manifest;
1975
2091
  },
1976
2092
  visitMapEntryValue(node, { self }) {
1977
- return mergeManifests([visitorsCore.visit(node.key, self), visitorsCore.visit(node.value, self)], {
2093
+ return mergeManifests([(0, import_visitors_core20.visit)(node.key, self), (0, import_visitors_core20.visit)(node.value, self)], {
1978
2094
  mergeValues: (renders) => `[${renders.join(", ")}]`
1979
2095
  });
1980
2096
  },
1981
2097
  visitMapType(mapType, { self }) {
1982
- const key = visitorsCore.visit(mapType.key, self);
1983
- const value = visitorsCore.visit(mapType.value, self);
2098
+ const key = (0, import_visitors_core20.visit)(mapType.key, self);
2099
+ const value = (0, import_visitors_core20.visit)(mapType.value, self);
1984
2100
  const mergedManifest = mergeManifests([key, value], {
1985
2101
  mergeCodecs: ([k, v]) => `${k}, ${v}`,
1986
2102
  mergeTypes: ([k, v]) => `Map<${k}, ${v}>`
@@ -1993,7 +2109,7 @@ function getTypeManifestVisitor(input) {
1993
2109
  return mergedManifest;
1994
2110
  },
1995
2111
  visitMapValue(node, { self }) {
1996
- const entryFragments = node.entries.map((entry) => visitorsCore.visit(entry, self));
2112
+ const entryFragments = node.entries.map((entry) => (0, import_visitors_core20.visit)(entry, self));
1997
2113
  return mergeManifests(entryFragments, {
1998
2114
  mergeValues: (renders) => `new Map([${renders.join(", ")}])`
1999
2115
  });
@@ -2030,14 +2146,14 @@ function getTypeManifestVisitor(input) {
2030
2146
  return manifest;
2031
2147
  },
2032
2148
  visitOptionType(optionType, { self }) {
2033
- const childManifest = visitorsCore.visit(optionType.item, self);
2149
+ const childManifest = (0, import_visitors_core20.visit)(optionType.item, self);
2034
2150
  childManifest.strictType.mapRender((r) => `Option<${r}>`).addImports("solanaOptions", "type Option");
2035
2151
  childManifest.looseType.mapRender((r) => `OptionOrNullable<${r}>`).addImports("solanaOptions", "type OptionOrNullable");
2036
2152
  const encoderOptions = [];
2037
2153
  const decoderOptions = [];
2038
- const optionPrefix = nodes.resolveNestedTypeNode(optionType.prefix);
2154
+ const optionPrefix = (0, import_nodes20.resolveNestedTypeNode)(optionType.prefix);
2039
2155
  if (optionPrefix.format !== "u8" || optionPrefix.endian !== "le") {
2040
- const prefixManifest = visitorsCore.visit(optionType.prefix, self);
2156
+ const prefixManifest = (0, import_visitors_core20.visit)(optionType.prefix, self);
2041
2157
  childManifest.encoder.mergeImportsWith(prefixManifest.encoder);
2042
2158
  childManifest.decoder.mergeImportsWith(prefixManifest.decoder);
2043
2159
  encoderOptions.push(`prefix: ${prefixManifest.encoder.render}`);
@@ -2054,7 +2170,7 @@ function getTypeManifestVisitor(input) {
2054
2170
  return childManifest;
2055
2171
  },
2056
2172
  visitPostOffsetType(node, { self }) {
2057
- const manifest = visitorsCore.visit(node.type, self);
2173
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2058
2174
  if (node.strategy === "padded") {
2059
2175
  manifest.encoder.mapRender((r) => `padRightEncoder(${r}, ${node.offset})`).addImports("solanaCodecsCore", "padRightEncoder");
2060
2176
  manifest.decoder.mapRender((r) => `padRightDecoder(${r}, ${node.offset})`).addImports("solanaCodecsCore", "padRightDecoder");
@@ -2076,7 +2192,7 @@ function getTypeManifestVisitor(input) {
2076
2192
  return manifest;
2077
2193
  },
2078
2194
  visitPreOffsetType(node, { self }) {
2079
- const manifest = visitorsCore.visit(node.type, self);
2195
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2080
2196
  if (node.strategy === "padded") {
2081
2197
  manifest.encoder.mapRender((r) => `padLeftEncoder(${r}, ${node.offset})`).addImports("solanaCodecsCore", "padLeftEncoder");
2082
2198
  manifest.decoder.mapRender((r) => `padLeftDecoder(${r}, ${node.offset})`).addImports("solanaCodecsCore", "padLeftDecoder");
@@ -2112,7 +2228,7 @@ function getTypeManifestVisitor(input) {
2112
2228
  return manifest;
2113
2229
  },
2114
2230
  visitRemainderOptionType(node, { self }) {
2115
- const childManifest = visitorsCore.visit(node.item, self);
2231
+ const childManifest = (0, import_visitors_core20.visit)(node.item, self);
2116
2232
  childManifest.strictType.mapRender((r) => `Option<${r}>`).addImports("solanaOptions", "type Option");
2117
2233
  childManifest.looseType.mapRender((r) => `OptionOrNullable<${r}>`).addImports("solanaOptions", "type OptionOrNullable");
2118
2234
  const encoderOptions = ["prefix: null"];
@@ -2124,14 +2240,14 @@ function getTypeManifestVisitor(input) {
2124
2240
  return childManifest;
2125
2241
  },
2126
2242
  visitSentinelType(node, { self }) {
2127
- const manifest = visitorsCore.visit(node.type, self);
2128
- const sentinel = visitorsCore.visit(node.sentinel, self).value;
2243
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2244
+ const sentinel = (0, import_visitors_core20.visit)(node.sentinel, self).value;
2129
2245
  manifest.encoder.mapRender((r) => `addEncoderSentinel(${r}, ${sentinel.render})`).mergeImportsWith(sentinel).addImports("solanaCodecsCore", "addEncoderSentinel");
2130
2246
  manifest.decoder.mapRender((r) => `addDecoderSentinel(${r}, ${sentinel.render})`).mergeImportsWith(sentinel).addImports("solanaCodecsCore", "addDecoderSentinel");
2131
2247
  return manifest;
2132
2248
  },
2133
2249
  visitSetType(setType, { self }) {
2134
- const childManifest = visitorsCore.visit(setType.item, self);
2250
+ const childManifest = (0, import_visitors_core20.visit)(setType.item, self);
2135
2251
  childManifest.strictType.mapRender((r) => `Set<${r}>`);
2136
2252
  childManifest.looseType.mapRender((r) => `Set<${r}>`);
2137
2253
  const sizeManifest = getArrayLikeSizeOption(setType.count, self);
@@ -2143,19 +2259,19 @@ function getTypeManifestVisitor(input) {
2143
2259
  },
2144
2260
  visitSetValue(node, { self }) {
2145
2261
  return mergeManifests(
2146
- node.items.map((v) => visitorsCore.visit(v, self)),
2262
+ node.items.map((v) => (0, import_visitors_core20.visit)(v, self)),
2147
2263
  { mergeValues: (renders) => `new Set([${renders.join(", ")}])` }
2148
2264
  );
2149
2265
  },
2150
2266
  visitSizePrefixType(node, { self }) {
2151
- const manifest = visitorsCore.visit(node.type, self);
2152
- const prefix = visitorsCore.visit(node.prefix, self);
2267
+ const manifest = (0, import_visitors_core20.visit)(node.type, self);
2268
+ const prefix = (0, import_visitors_core20.visit)(node.prefix, self);
2153
2269
  manifest.encoder.mapRender((r) => `addEncoderSizePrefix(${r}, ${prefix.encoder.render})`).mergeImportsWith(prefix.encoder).addImports("solanaCodecsCore", "addEncoderSizePrefix");
2154
2270
  manifest.decoder.mapRender((r) => `addDecoderSizePrefix(${r}, ${prefix.decoder.render})`).mergeImportsWith(prefix.decoder).addImports("solanaCodecsCore", "addDecoderSizePrefix");
2155
2271
  return manifest;
2156
2272
  },
2157
2273
  visitSolAmountType({ number }, { self }) {
2158
- const numberManifest = visitorsCore.visit(number, self);
2274
+ const numberManifest = (0, import_visitors_core20.visit)(number, self);
2159
2275
  const lamportsType = "Lamports";
2160
2276
  const lamportsImport = new ImportMap().add("solanaRpcTypes", "type Lamports");
2161
2277
  return {
@@ -2168,7 +2284,7 @@ function getTypeManifestVisitor(input) {
2168
2284
  },
2169
2285
  visitSomeValue(node, { self }) {
2170
2286
  const manifest = typeManifest();
2171
- manifest.value = visitorsCore.visit(node.value, self).value.mapRender((r) => `some(${r})`).addImports("solanaOptions", "some");
2287
+ manifest.value = (0, import_visitors_core20.visit)(node.value, self).value.mapRender((r) => `some(${r})`).addImports("solanaOptions", "some");
2172
2288
  return manifest;
2173
2289
  },
2174
2290
  visitStringType(stringType) {
@@ -2201,8 +2317,8 @@ function getTypeManifestVisitor(input) {
2201
2317
  return manifest;
2202
2318
  },
2203
2319
  visitStructFieldType(structFieldType, { self }) {
2204
- const name = nodes.camelCase(structFieldType.name);
2205
- const childManifest = visitorsCore.visit(structFieldType.type, self);
2320
+ const name = (0, import_nodes20.camelCase)(structFieldType.name);
2321
+ const childManifest = (0, import_visitors_core20.visit)(structFieldType.type, self);
2206
2322
  const docblock = structFieldType.docs.length > 0 ? `
2207
2323
  ${jsDocblock(structFieldType.docs)}` : "";
2208
2324
  const originalLooseType = childManifest.looseType.render;
@@ -2222,13 +2338,13 @@ ${jsDocblock(structFieldType.docs)}` : "";
2222
2338
  },
2223
2339
  visitStructFieldValue(node, { self }) {
2224
2340
  const manifest = typeManifest();
2225
- manifest.value = visitorsCore.visit(node.value, self).value.mapRender((r) => `${node.name}: ${r}`);
2341
+ manifest.value = (0, import_visitors_core20.visit)(node.value, self).value.mapRender((r) => `${node.name}: ${r}`);
2226
2342
  return manifest;
2227
2343
  },
2228
2344
  visitStructType(structType, { self }) {
2229
2345
  const optionalFields = structType.fields.filter((f) => !!f.defaultValue);
2230
2346
  const mergedManifest = mergeManifests(
2231
- structType.fields.map((field) => visitorsCore.visit(field, self)),
2347
+ structType.fields.map((field) => (0, import_visitors_core20.visit)(field, self)),
2232
2348
  {
2233
2349
  mergeCodecs: (renders) => `([${renders.join(", ")}])`,
2234
2350
  mergeTypes: (renders) => `{ ${renders.join("")} }`
@@ -2240,19 +2356,19 @@ ${jsDocblock(structFieldType.docs)}` : "";
2240
2356
  return mergedManifest;
2241
2357
  }
2242
2358
  const parentPath = stack.getPath();
2243
- const instructionNode = visitorsCore.findLastNodeFromPath(parentPath, "instructionNode");
2244
- const accountNode = visitorsCore.findLastNodeFromPath(parentPath, "accountNode");
2359
+ const instructionNode = (0, import_visitors_core20.findLastNodeFromPath)(parentPath, "instructionNode");
2360
+ const accountNode = (0, import_visitors_core20.findLastNodeFromPath)(parentPath, "accountNode");
2245
2361
  const discriminatorPrefix = instructionNode ? instructionNode.name : accountNode?.name;
2246
2362
  const discriminators = (instructionNode ? instructionNode.discriminators : accountNode?.discriminators) ?? [];
2247
- const fieldDiscriminators = discriminators.filter(nodes.isNodeFilter("fieldDiscriminatorNode"));
2363
+ const fieldDiscriminators = discriminators.filter((0, import_nodes20.isNodeFilter)("fieldDiscriminatorNode"));
2248
2364
  const defaultValues = optionalFields.map((f) => {
2249
- const key = nodes.camelCase(f.name);
2365
+ const key = (0, import_nodes20.camelCase)(f.name);
2250
2366
  if (fieldDiscriminators.some((d) => d.name === f.name)) {
2251
- const constantName = nameApi.constant(nodes.camelCase(`${discriminatorPrefix}_${f.name}`));
2367
+ const constantName = nameApi.constant((0, import_nodes20.camelCase)(`${discriminatorPrefix}_${f.name}`));
2252
2368
  return f.defaultValueStrategy === "omitted" ? `${key}: ${constantName}` : `${key}: value.${key} ?? ${constantName}`;
2253
2369
  }
2254
2370
  const defaultValue = f.defaultValue;
2255
- const { render: renderedValue, imports } = visitorsCore.visit(defaultValue, self).value;
2371
+ const { render: renderedValue, imports } = (0, import_visitors_core20.visit)(defaultValue, self).value;
2256
2372
  mergedManifest.encoder.mergeImportsWith(imports);
2257
2373
  return f.defaultValueStrategy === "omitted" ? `${key}: ${renderedValue}` : `${key}: value.${key} ?? ${renderedValue}`;
2258
2374
  }).join(", ");
@@ -2261,12 +2377,12 @@ ${jsDocblock(structFieldType.docs)}` : "";
2261
2377
  },
2262
2378
  visitStructValue(node, { self }) {
2263
2379
  return mergeManifests(
2264
- node.fields.map((field) => visitorsCore.visit(field, self)),
2380
+ node.fields.map((field) => (0, import_visitors_core20.visit)(field, self)),
2265
2381
  { mergeValues: (renders) => `{ ${renders.join(", ")} }` }
2266
2382
  );
2267
2383
  },
2268
2384
  visitTupleType(tupleType, { self }) {
2269
- const items = tupleType.items.map((item) => visitorsCore.visit(item, self));
2385
+ const items = tupleType.items.map((item) => (0, import_visitors_core20.visit)(item, self));
2270
2386
  const mergedManifest = mergeManifests(items, {
2271
2387
  mergeCodecs: (codecs) => `[${codecs.join(", ")}]`,
2272
2388
  mergeTypes: (types) => `readonly [${types.join(", ")}]`
@@ -2277,18 +2393,18 @@ ${jsDocblock(structFieldType.docs)}` : "";
2277
2393
  },
2278
2394
  visitTupleValue(node, { self }) {
2279
2395
  return mergeManifests(
2280
- node.items.map((v) => visitorsCore.visit(v, self)),
2396
+ node.items.map((v) => (0, import_visitors_core20.visit)(v, self)),
2281
2397
  { mergeValues: (renders) => `[${renders.join(", ")}]` }
2282
2398
  );
2283
2399
  },
2284
2400
  visitZeroableOptionType(node, { self }) {
2285
- const childManifest = visitorsCore.visit(node.item, self);
2401
+ const childManifest = (0, import_visitors_core20.visit)(node.item, self);
2286
2402
  childManifest.strictType.mapRender((r) => `Option<${r}>`).addImports("solanaOptions", "type Option");
2287
2403
  childManifest.looseType.mapRender((r) => `OptionOrNullable<${r}>`).addImports("solanaOptions", "type OptionOrNullable");
2288
2404
  const encoderOptions = ["prefix: null"];
2289
2405
  const decoderOptions = ["prefix: null"];
2290
2406
  if (node.zeroValue) {
2291
- const zeroValueManifest = visitorsCore.visit(node.zeroValue, self);
2407
+ const zeroValueManifest = (0, import_visitors_core20.visit)(node.zeroValue, self);
2292
2408
  childManifest.encoder.mergeImportsWith(zeroValueManifest.value);
2293
2409
  childManifest.decoder.mergeImportsWith(zeroValueManifest.value);
2294
2410
  encoderOptions.push(`noneValue: ${zeroValueManifest.value.render}`);
@@ -2304,97 +2420,100 @@ ${jsDocblock(structFieldType.docs)}` : "";
2304
2420
  return childManifest;
2305
2421
  }
2306
2422
  }),
2307
- (visitor) => visitorsCore.recordNodeStackVisitor(visitor, stack)
2423
+ (visitor) => (0, import_visitors_core20.recordNodeStackVisitor)(visitor, stack)
2308
2424
  );
2309
2425
  }
2310
2426
  function getArrayLikeSizeOption(count, visitor) {
2311
- if (nodes.isNode(count, "fixedCountNode")) {
2427
+ if ((0, import_nodes20.isNode)(count, "fixedCountNode")) {
2312
2428
  return {
2313
2429
  decoder: fragment(`size: ${count.value}`),
2314
2430
  encoder: fragment(`size: ${count.value}`)
2315
2431
  };
2316
2432
  }
2317
- if (nodes.isNode(count, "remainderCountNode")) {
2433
+ if ((0, import_nodes20.isNode)(count, "remainderCountNode")) {
2318
2434
  return {
2319
2435
  decoder: fragment(`size: 'remainder'`),
2320
2436
  encoder: fragment(`size: 'remainder'`)
2321
2437
  };
2322
2438
  }
2323
- const prefix = nodes.resolveNestedTypeNode(count.prefix);
2439
+ const prefix = (0, import_nodes20.resolveNestedTypeNode)(count.prefix);
2324
2440
  if (prefix.format === "u32" && prefix.endian === "le") {
2325
2441
  return { decoder: fragment(""), encoder: fragment("") };
2326
2442
  }
2327
- const prefixManifest = visitorsCore.visit(count.prefix, visitor);
2443
+ const prefixManifest = (0, import_visitors_core20.visit)(count.prefix, visitor);
2328
2444
  prefixManifest.encoder.mapRender((r) => `size: ${r}`);
2329
2445
  prefixManifest.decoder.mapRender((r) => `size: ${r}`);
2330
2446
  return prefixManifest;
2331
2447
  }
2448
+
2449
+ // src/nameTransformers.ts
2450
+ var import_nodes21 = require("@codama/nodes");
2332
2451
  function getNameApi(transformers) {
2333
2452
  const helpers = {
2334
- camelCase: nodes.camelCase,
2335
- capitalize: nodes.capitalize,
2336
- kebabCase: nodes.kebabCase,
2337
- pascalCase: nodes.pascalCase,
2338
- snakeCase: nodes.snakeCase,
2339
- titleCase: nodes.titleCase
2453
+ camelCase: import_nodes21.camelCase,
2454
+ capitalize: import_nodes21.capitalize,
2455
+ kebabCase: import_nodes21.kebabCase,
2456
+ pascalCase: import_nodes21.pascalCase,
2457
+ snakeCase: import_nodes21.snakeCase,
2458
+ titleCase: import_nodes21.titleCase
2340
2459
  };
2341
2460
  return Object.fromEntries(
2342
2461
  Object.entries(transformers).map(([key, transformer]) => [key, (name) => transformer(name, helpers)])
2343
2462
  );
2344
2463
  }
2345
2464
  var DEFAULT_NAME_TRANSFORMERS = {
2346
- accountDecodeFunction: (name) => `decode${nodes.pascalCase(name)}`,
2347
- accountFetchAllFunction: (name) => `fetchAll${nodes.pascalCase(name)}`,
2348
- accountFetchAllMaybeFunction: (name) => `fetchAllMaybe${nodes.pascalCase(name)}`,
2349
- accountFetchFromSeedsFunction: (name) => `fetch${nodes.pascalCase(name)}FromSeeds`,
2350
- accountFetchFunction: (name) => `fetch${nodes.pascalCase(name)}`,
2351
- accountFetchMaybeFromSeedsFunction: (name) => `fetchMaybe${nodes.pascalCase(name)}FromSeeds`,
2352
- accountFetchMaybeFunction: (name) => `fetchMaybe${nodes.pascalCase(name)}`,
2353
- accountGetSizeFunction: (name) => `get${nodes.pascalCase(name)}Size`,
2354
- codecFunction: (name) => `get${nodes.pascalCase(name)}Codec`,
2355
- constant: (name) => nodes.snakeCase(name).toUpperCase(),
2356
- constantFunction: (name) => `get${nodes.pascalCase(name)}Bytes`,
2357
- dataArgsType: (name) => `${nodes.pascalCase(name)}Args`,
2358
- dataType: (name) => `${nodes.pascalCase(name)}`,
2359
- decoderFunction: (name) => `get${nodes.pascalCase(name)}Decoder`,
2465
+ accountDecodeFunction: (name) => `decode${(0, import_nodes21.pascalCase)(name)}`,
2466
+ accountFetchAllFunction: (name) => `fetchAll${(0, import_nodes21.pascalCase)(name)}`,
2467
+ accountFetchAllMaybeFunction: (name) => `fetchAllMaybe${(0, import_nodes21.pascalCase)(name)}`,
2468
+ accountFetchFromSeedsFunction: (name) => `fetch${(0, import_nodes21.pascalCase)(name)}FromSeeds`,
2469
+ accountFetchFunction: (name) => `fetch${(0, import_nodes21.pascalCase)(name)}`,
2470
+ accountFetchMaybeFromSeedsFunction: (name) => `fetchMaybe${(0, import_nodes21.pascalCase)(name)}FromSeeds`,
2471
+ accountFetchMaybeFunction: (name) => `fetchMaybe${(0, import_nodes21.pascalCase)(name)}`,
2472
+ accountGetSizeFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Size`,
2473
+ codecFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Codec`,
2474
+ constant: (name) => (0, import_nodes21.snakeCase)(name).toUpperCase(),
2475
+ constantFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Bytes`,
2476
+ dataArgsType: (name) => `${(0, import_nodes21.pascalCase)(name)}Args`,
2477
+ dataType: (name) => `${(0, import_nodes21.pascalCase)(name)}`,
2478
+ decoderFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Decoder`,
2360
2479
  discriminatedUnionDiscriminator: () => "__kind",
2361
- discriminatedUnionFunction: (name) => `${nodes.camelCase(name)}`,
2362
- discriminatedUnionVariant: (name) => `${nodes.pascalCase(name)}`,
2363
- encoderFunction: (name) => `get${nodes.pascalCase(name)}Encoder`,
2364
- enumVariant: (name) => `${nodes.pascalCase(name)}`,
2365
- instructionAsyncFunction: (name) => `get${nodes.pascalCase(name)}InstructionAsync`,
2366
- instructionAsyncInputType: (name) => `${nodes.pascalCase(name)}AsyncInput`,
2367
- instructionDataType: (name) => `${nodes.pascalCase(name)}InstructionData`,
2368
- instructionExtraType: (name) => `${nodes.pascalCase(name)}InstructionExtra`,
2369
- instructionParseFunction: (name) => `parse${nodes.pascalCase(name)}Instruction`,
2370
- instructionParsedType: (name) => `Parsed${nodes.pascalCase(name)}Instruction`,
2371
- instructionSyncFunction: (name) => `get${nodes.pascalCase(name)}Instruction`,
2372
- instructionSyncInputType: (name) => `${nodes.pascalCase(name)}Input`,
2373
- instructionType: (name) => `${nodes.pascalCase(name)}Instruction`,
2374
- isDiscriminatedUnionFunction: (name) => `is${nodes.pascalCase(name)}`,
2375
- pdaFindFunction: (name) => `find${nodes.pascalCase(name)}Pda`,
2376
- pdaSeedsType: (name) => `${nodes.pascalCase(name)}Seeds`,
2377
- programAccountsEnum: (name) => `${nodes.pascalCase(name)}Account`,
2378
- programAccountsEnumVariant: (name) => `${nodes.pascalCase(name)}`,
2379
- programAccountsIdentifierFunction: (name) => `identify${nodes.pascalCase(name)}Account`,
2380
- programAddressConstant: (name) => `${nodes.snakeCase(name).toUpperCase()}_PROGRAM_ADDRESS`,
2381
- programErrorConstant: (name) => nodes.snakeCase(name).toUpperCase(),
2382
- programErrorConstantPrefix: (name) => `${nodes.snakeCase(name).toUpperCase()}_ERROR__`,
2383
- programErrorMessagesMap: (name) => `${nodes.camelCase(name)}ErrorMessages`,
2384
- programErrorUnion: (name) => `${nodes.pascalCase(name)}Error`,
2385
- programGetErrorMessageFunction: (name) => `get${nodes.pascalCase(name)}ErrorMessage`,
2386
- programInstructionsEnum: (name) => `${nodes.pascalCase(name)}Instruction`,
2387
- programInstructionsEnumVariant: (name) => `${nodes.pascalCase(name)}`,
2388
- programInstructionsIdentifierFunction: (name) => `identify${nodes.pascalCase(name)}Instruction`,
2389
- programInstructionsParsedUnionType: (name) => `Parsed${nodes.pascalCase(name)}Instruction`,
2390
- programIsErrorFunction: (name) => `is${nodes.pascalCase(name)}Error`,
2391
- resolverFunction: (name) => `${nodes.camelCase(name)}`
2480
+ discriminatedUnionFunction: (name) => `${(0, import_nodes21.camelCase)(name)}`,
2481
+ discriminatedUnionVariant: (name) => `${(0, import_nodes21.pascalCase)(name)}`,
2482
+ encoderFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Encoder`,
2483
+ enumVariant: (name) => `${(0, import_nodes21.pascalCase)(name)}`,
2484
+ instructionAsyncFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}InstructionAsync`,
2485
+ instructionAsyncInputType: (name) => `${(0, import_nodes21.pascalCase)(name)}AsyncInput`,
2486
+ instructionDataType: (name) => `${(0, import_nodes21.pascalCase)(name)}InstructionData`,
2487
+ instructionExtraType: (name) => `${(0, import_nodes21.pascalCase)(name)}InstructionExtra`,
2488
+ instructionParseFunction: (name) => `parse${(0, import_nodes21.pascalCase)(name)}Instruction`,
2489
+ instructionParsedType: (name) => `Parsed${(0, import_nodes21.pascalCase)(name)}Instruction`,
2490
+ instructionSyncFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}Instruction`,
2491
+ instructionSyncInputType: (name) => `${(0, import_nodes21.pascalCase)(name)}Input`,
2492
+ instructionType: (name) => `${(0, import_nodes21.pascalCase)(name)}Instruction`,
2493
+ isDiscriminatedUnionFunction: (name) => `is${(0, import_nodes21.pascalCase)(name)}`,
2494
+ pdaFindFunction: (name) => `find${(0, import_nodes21.pascalCase)(name)}Pda`,
2495
+ pdaSeedsType: (name) => `${(0, import_nodes21.pascalCase)(name)}Seeds`,
2496
+ programAccountsEnum: (name) => `${(0, import_nodes21.pascalCase)(name)}Account`,
2497
+ programAccountsEnumVariant: (name) => `${(0, import_nodes21.pascalCase)(name)}`,
2498
+ programAccountsIdentifierFunction: (name) => `identify${(0, import_nodes21.pascalCase)(name)}Account`,
2499
+ programAddressConstant: (name) => `${(0, import_nodes21.snakeCase)(name).toUpperCase()}_PROGRAM_ADDRESS`,
2500
+ programErrorConstant: (name) => (0, import_nodes21.snakeCase)(name).toUpperCase(),
2501
+ programErrorConstantPrefix: (name) => `${(0, import_nodes21.snakeCase)(name).toUpperCase()}_ERROR__`,
2502
+ programErrorMessagesMap: (name) => `${(0, import_nodes21.camelCase)(name)}ErrorMessages`,
2503
+ programErrorUnion: (name) => `${(0, import_nodes21.pascalCase)(name)}Error`,
2504
+ programGetErrorMessageFunction: (name) => `get${(0, import_nodes21.pascalCase)(name)}ErrorMessage`,
2505
+ programInstructionsEnum: (name) => `${(0, import_nodes21.pascalCase)(name)}Instruction`,
2506
+ programInstructionsEnumVariant: (name) => `${(0, import_nodes21.pascalCase)(name)}`,
2507
+ programInstructionsIdentifierFunction: (name) => `identify${(0, import_nodes21.pascalCase)(name)}Instruction`,
2508
+ programInstructionsParsedUnionType: (name) => `Parsed${(0, import_nodes21.pascalCase)(name)}Instruction`,
2509
+ programIsErrorFunction: (name) => `is${(0, import_nodes21.pascalCase)(name)}Error`,
2510
+ resolverFunction: (name) => `${(0, import_nodes21.camelCase)(name)}`
2392
2511
  };
2393
2512
 
2394
2513
  // src/getRenderMapVisitor.ts
2395
2514
  function getRenderMapVisitor(options = {}) {
2396
- const linkables = new visitorsCore.LinkableDictionary();
2397
- const stack = new visitorsCore.NodeStack();
2515
+ const linkables = new import_visitors_core21.LinkableDictionary();
2516
+ const stack = new import_visitors_core21.NodeStack();
2398
2517
  const nameTransformers = {
2399
2518
  ...DEFAULT_NAME_TRANSFORMERS,
2400
2519
  ...options.nameTransformers
@@ -2403,9 +2522,9 @@ function getRenderMapVisitor(options = {}) {
2403
2522
  const renderParentInstructions = options.renderParentInstructions ?? false;
2404
2523
  const dependencyMap = options.dependencyMap ?? {};
2405
2524
  const useGranularImports = options.useGranularImports ?? false;
2406
- const asyncResolvers = (options.asyncResolvers ?? []).map(nodes.camelCase);
2407
- const nonScalarEnums = (options.nonScalarEnums ?? []).map(nodes.camelCase);
2408
- const internalNodes = (options.internalNodes ?? []).map(nodes.camelCase);
2525
+ const asyncResolvers = (options.asyncResolvers ?? []).map(import_nodes22.camelCase);
2526
+ const nonScalarEnums = (options.nonScalarEnums ?? []).map(import_nodes22.camelCase);
2527
+ const internalNodes = (options.internalNodes ?? []).map(import_nodes22.camelCase);
2409
2528
  const customAccountData = parseCustomDataOptions(options.customAccountData ?? [], "AccountData");
2410
2529
  const customInstructionData = parseCustomDataOptions(options.customInstructionData ?? [], "InstructionData");
2411
2530
  const getImportFrom = getImportFromFactory(options.linkOverrides ?? {}, customAccountData, customInstructionData);
@@ -2418,7 +2537,7 @@ function getRenderMapVisitor(options = {}) {
2418
2537
  nonScalarEnums,
2419
2538
  stack
2420
2539
  });
2421
- const resolvedInstructionInputVisitor = visitorsCore.getResolvedInstructionInputsVisitor();
2540
+ const resolvedInstructionInputVisitor = (0, import_visitors_core21.getResolvedInstructionInputsVisitor)();
2422
2541
  const globalScope = {
2423
2542
  asyncResolvers,
2424
2543
  customAccountData,
@@ -2431,24 +2550,24 @@ function getRenderMapVisitor(options = {}) {
2431
2550
  typeManifestVisitor
2432
2551
  };
2433
2552
  const render2 = (template, context, renderOptions) => {
2434
- return render(path.join("pages", template), context, renderOptions);
2553
+ return render((0, import_node_path3.join)("pages", template), context, renderOptions);
2435
2554
  };
2436
- return visitorsCore.pipe(
2437
- visitorsCore.staticVisitor(() => new renderersCore.RenderMap(), {
2555
+ return (0, import_visitors_core21.pipe)(
2556
+ (0, import_visitors_core21.staticVisitor)(() => new import_renderers_core.RenderMap(), {
2438
2557
  keys: ["rootNode", "programNode", "pdaNode", "accountNode", "definedTypeNode", "instructionNode"]
2439
2558
  }),
2440
- (v) => visitorsCore.extendVisitor(v, {
2559
+ (v) => (0, import_visitors_core21.extendVisitor)(v, {
2441
2560
  visitAccount(node) {
2442
2561
  const accountPath = stack.getPath("accountNode");
2443
- if (!visitorsCore.findProgramNodeFromPath(accountPath)) {
2562
+ if (!(0, import_visitors_core21.findProgramNodeFromPath)(accountPath)) {
2444
2563
  throw new Error("Account must be visited inside a program.");
2445
2564
  }
2446
2565
  const scope = {
2447
2566
  ...globalScope,
2448
2567
  accountPath,
2449
- typeManifest: visitorsCore.visit(node, typeManifestVisitor)
2568
+ typeManifest: (0, import_visitors_core21.visit)(node, typeManifestVisitor)
2450
2569
  };
2451
- const fields = nodes.resolveNestedTypeNode(node.data).fields;
2570
+ const fields = (0, import_nodes22.resolveNestedTypeNode)(node.data).fields;
2452
2571
  const accountDiscriminatorConstantsFragment = getDiscriminatorConstantsFragment({
2453
2572
  ...scope,
2454
2573
  discriminatorNodes: node.discriminators ?? [],
@@ -2466,8 +2585,8 @@ function getRenderMapVisitor(options = {}) {
2466
2585
  accountSizeHelpersFragment,
2467
2586
  accountPdaHelpersFragment
2468
2587
  );
2469
- return new renderersCore.RenderMap().add(
2470
- `accounts/${nodes.camelCase(node.name)}.ts`,
2588
+ return new import_renderers_core.RenderMap().add(
2589
+ `accounts/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2471
2590
  render2("accountsPage.njk", {
2472
2591
  accountDiscriminatorConstantsFragment,
2473
2592
  accountFetchHelpersFragment,
@@ -2484,7 +2603,7 @@ function getRenderMapVisitor(options = {}) {
2484
2603
  codecDocs: [],
2485
2604
  decoderDocs: [],
2486
2605
  encoderDocs: [],
2487
- manifest: visitorsCore.visit(node, typeManifestVisitor),
2606
+ manifest: (0, import_visitors_core21.visit)(node, typeManifestVisitor),
2488
2607
  name: node.name,
2489
2608
  typeDocs: node.docs,
2490
2609
  typeNode: node.type
@@ -2498,8 +2617,8 @@ function getRenderMapVisitor(options = {}) {
2498
2617
  nameApi.decoderFunction(node.name),
2499
2618
  nameApi.codecFunction(node.name)
2500
2619
  ]);
2501
- return new renderersCore.RenderMap().add(
2502
- `types/${nodes.camelCase(node.name)}.ts`,
2620
+ return new import_renderers_core.RenderMap().add(
2621
+ `types/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2503
2622
  render2("definedTypesPage.njk", {
2504
2623
  imports: imports.toString({
2505
2624
  ...dependencyMap,
@@ -2512,23 +2631,23 @@ function getRenderMapVisitor(options = {}) {
2512
2631
  },
2513
2632
  visitInstruction(node) {
2514
2633
  const instructionPath = stack.getPath("instructionNode");
2515
- if (!visitorsCore.findProgramNodeFromPath(instructionPath)) {
2634
+ if (!(0, import_visitors_core21.findProgramNodeFromPath)(instructionPath)) {
2516
2635
  throw new Error("Instruction must be visited inside a program.");
2517
2636
  }
2518
2637
  const instructionExtraName = nameApi.instructionExtraType(node.name);
2519
2638
  const scope = {
2520
2639
  ...globalScope,
2521
- dataArgsManifest: visitorsCore.visit(node, typeManifestVisitor),
2522
- extraArgsManifest: visitorsCore.visit(
2523
- nodes.definedTypeNode({
2640
+ dataArgsManifest: (0, import_visitors_core21.visit)(node, typeManifestVisitor),
2641
+ extraArgsManifest: (0, import_visitors_core21.visit)(
2642
+ (0, import_nodes22.definedTypeNode)({
2524
2643
  name: instructionExtraName,
2525
- type: nodes.structTypeNodeFromInstructionArgumentNodes(node.extraArguments ?? [])
2644
+ type: (0, import_nodes22.structTypeNodeFromInstructionArgumentNodes)(node.extraArguments ?? [])
2526
2645
  }),
2527
2646
  typeManifestVisitor
2528
2647
  ),
2529
2648
  instructionPath,
2530
2649
  renamedArgs: getRenamedArgsMap(node),
2531
- resolvedInputs: visitorsCore.visit(node, resolvedInstructionInputVisitor)
2650
+ resolvedInputs: (0, import_visitors_core21.visit)(node, resolvedInstructionInputVisitor)
2532
2651
  };
2533
2652
  const instructionDiscriminatorConstantsFragment = getDiscriminatorConstantsFragment({
2534
2653
  ...scope,
@@ -2557,8 +2676,8 @@ function getRenderMapVisitor(options = {}) {
2557
2676
  instructionFunctionSyncFragment,
2558
2677
  instructionParseFunctionFragment
2559
2678
  );
2560
- return new renderersCore.RenderMap().add(
2561
- `instructions/${nodes.camelCase(node.name)}.ts`,
2679
+ return new import_renderers_core.RenderMap().add(
2680
+ `instructions/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2562
2681
  render2("instructionsPage.njk", {
2563
2682
  imports: imports.toString(dependencyMap, useGranularImports),
2564
2683
  instruction: node,
@@ -2574,14 +2693,14 @@ function getRenderMapVisitor(options = {}) {
2574
2693
  },
2575
2694
  visitPda(node) {
2576
2695
  const pdaPath = stack.getPath("pdaNode");
2577
- if (!visitorsCore.findProgramNodeFromPath(pdaPath)) {
2696
+ if (!(0, import_visitors_core21.findProgramNodeFromPath)(pdaPath)) {
2578
2697
  throw new Error("Account must be visited inside a program.");
2579
2698
  }
2580
2699
  const scope = { ...globalScope, pdaPath };
2581
2700
  const pdaFunctionFragment = getPdaFunctionFragment(scope);
2582
2701
  const imports = new ImportMap().mergeWith(pdaFunctionFragment);
2583
- return new renderersCore.RenderMap().add(
2584
- `pdas/${nodes.camelCase(node.name)}.ts`,
2702
+ return new import_renderers_core.RenderMap().add(
2703
+ `pdas/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2585
2704
  render2("pdasPage.njk", {
2586
2705
  imports: imports.toString(dependencyMap, useGranularImports),
2587
2706
  pdaFunctionFragment
@@ -2594,11 +2713,11 @@ function getRenderMapVisitor(options = {}) {
2594
2713
  ...getDefinedTypeNodesToExtract(node.instructions, customInstructionData)
2595
2714
  ];
2596
2715
  const scope = { ...globalScope, programNode: node };
2597
- const renderMap = new renderersCore.RenderMap().mergeWith(...node.pdas.map((p) => visitorsCore.visit(p, self))).mergeWith(...node.accounts.map((a) => visitorsCore.visit(a, self))).mergeWith(...node.definedTypes.map((t) => visitorsCore.visit(t, self))).mergeWith(...customDataDefinedType.map((t) => visitorsCore.visit(t, self)));
2716
+ const renderMap = new import_renderers_core.RenderMap().mergeWith(...node.pdas.map((p) => (0, import_visitors_core21.visit)(p, self))).mergeWith(...node.accounts.map((a) => (0, import_visitors_core21.visit)(a, self))).mergeWith(...node.definedTypes.map((t) => (0, import_visitors_core21.visit)(t, self))).mergeWith(...customDataDefinedType.map((t) => (0, import_visitors_core21.visit)(t, self)));
2598
2717
  if (node.errors.length > 0) {
2599
2718
  const programErrorsFragment = getProgramErrorsFragment(scope);
2600
2719
  renderMap.add(
2601
- `errors/${nodes.camelCase(node.name)}.ts`,
2720
+ `errors/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2602
2721
  render2("errorsPage.njk", {
2603
2722
  imports: new ImportMap().mergeWith(programErrorsFragment).toString(dependencyMap, useGranularImports),
2604
2723
  programErrorsFragment
@@ -2609,7 +2728,7 @@ function getRenderMapVisitor(options = {}) {
2609
2728
  const programAccountsFragment = getProgramAccountsFragment(scope);
2610
2729
  const programInstructionsFragment = getProgramInstructionsFragment(scope);
2611
2730
  renderMap.add(
2612
- `programs/${nodes.camelCase(node.name)}.ts`,
2731
+ `programs/${(0, import_nodes22.camelCase)(node.name)}.ts`,
2613
2732
  render2("programsPage.njk", {
2614
2733
  imports: new ImportMap().mergeWith(programFragment, programAccountsFragment, programInstructionsFragment).toString(dependencyMap, useGranularImports),
2615
2734
  programAccountsFragment,
@@ -2618,22 +2737,22 @@ function getRenderMapVisitor(options = {}) {
2618
2737
  })
2619
2738
  );
2620
2739
  renderMap.mergeWith(
2621
- ...nodes.getAllInstructionsWithSubs(node, {
2740
+ ...(0, import_nodes22.getAllInstructionsWithSubs)(node, {
2622
2741
  leavesOnly: !renderParentInstructions
2623
- }).map((ix) => visitorsCore.visit(ix, self))
2742
+ }).map((ix) => (0, import_visitors_core21.visit)(ix, self))
2624
2743
  );
2625
2744
  return renderMap;
2626
2745
  },
2627
2746
  visitRoot(node, { self }) {
2628
2747
  const isNotInternal = (n) => !internalNodes.includes(n.name);
2629
- const programsToExport = nodes.getAllPrograms(node).filter(isNotInternal);
2748
+ const programsToExport = (0, import_nodes22.getAllPrograms)(node).filter(isNotInternal);
2630
2749
  const programsWithErrorsToExport = programsToExport.filter((p) => p.errors.length > 0);
2631
- const pdasToExport = nodes.getAllPdas(node);
2632
- const accountsToExport = nodes.getAllAccounts(node).filter(isNotInternal);
2633
- const instructionsToExport = nodes.getAllInstructionsWithSubs(node, {
2750
+ const pdasToExport = (0, import_nodes22.getAllPdas)(node);
2751
+ const accountsToExport = (0, import_nodes22.getAllAccounts)(node).filter(isNotInternal);
2752
+ const instructionsToExport = (0, import_nodes22.getAllInstructionsWithSubs)(node, {
2634
2753
  leavesOnly: !renderParentInstructions
2635
2754
  }).filter(isNotInternal);
2636
- const definedTypesToExport = nodes.getAllDefinedTypes(node).filter(isNotInternal);
2755
+ const definedTypesToExport = (0, import_nodes22.getAllDefinedTypes)(node).filter(isNotInternal);
2637
2756
  const hasAnythingToExport = programsToExport.length > 0 || accountsToExport.length > 0 || instructionsToExport.length > 0 || definedTypesToExport.length > 0;
2638
2757
  const ctx = {
2639
2758
  accountsToExport,
@@ -2645,7 +2764,7 @@ function getRenderMapVisitor(options = {}) {
2645
2764
  programsWithErrorsToExport,
2646
2765
  root: node
2647
2766
  };
2648
- const map = new renderersCore.RenderMap();
2767
+ const map = new import_renderers_core.RenderMap();
2649
2768
  if (hasAnythingToExport) {
2650
2769
  map.add(
2651
2770
  "shared/index.ts",
@@ -2663,7 +2782,7 @@ function getRenderMapVisitor(options = {}) {
2663
2782
  "type IAccountSignerMeta",
2664
2783
  "isTransactionSigner",
2665
2784
  "type TransactionSigner"
2666
- ]).addAlias("solanaSigners", "isTransactionSigner", "web3JsIsTransactionSigner").toString(dependencyMap, useGranularImports)
2785
+ ]).addAlias("solanaSigners", "isTransactionSigner", "kitIsTransactionSigner").toString(dependencyMap, useGranularImports)
2667
2786
  })
2668
2787
  );
2669
2788
  }
@@ -2685,11 +2804,11 @@ function getRenderMapVisitor(options = {}) {
2685
2804
  if (definedTypesToExport.length > 0) {
2686
2805
  map.add("types/index.ts", render2("definedTypesIndex.njk", ctx));
2687
2806
  }
2688
- return map.add("index.ts", render2("rootIndex.njk", ctx)).mergeWith(...nodes.getAllPrograms(node).map((p) => visitorsCore.visit(p, self)));
2807
+ return map.add("index.ts", render2("rootIndex.njk", ctx)).mergeWith(...(0, import_nodes22.getAllPrograms)(node).map((p) => (0, import_visitors_core21.visit)(p, self)));
2689
2808
  }
2690
2809
  }),
2691
- (v) => visitorsCore.recordNodeStackVisitor(v, stack),
2692
- (v) => visitorsCore.recordLinkablesOnFirstVisitVisitor(v, linkables)
2810
+ (v) => (0, import_visitors_core21.recordNodeStackVisitor)(v, stack),
2811
+ (v) => (0, import_visitors_core21.recordLinkablesOnFirstVisitVisitor)(v, linkables)
2693
2812
  );
2694
2813
  }
2695
2814
  function getRenamedArgsMap(instruction) {
@@ -2704,15 +2823,22 @@ function getRenamedArgsMap(instruction) {
2704
2823
  const allNames = [...instruction.accounts.map((account) => account.name), ...argNames];
2705
2824
  const duplicates = allNames.filter((e, i, a) => a.indexOf(e) !== i);
2706
2825
  if (duplicates.length === 0) return /* @__PURE__ */ new Map();
2707
- errors.logWarn(
2826
+ (0, import_errors2.logWarn)(
2708
2827
  `[JavaScript] Accounts and args of instruction [${instruction.name}] have the following conflicting attributes [${duplicates.join(", ")}]. Thus, the arguments have been renamed to avoid conflicts in the input type.`
2709
2828
  );
2710
- return new Map(duplicates.map((name) => [nodes.camelCase(name), nodes.camelCase(`${name}Arg`)]));
2829
+ return new Map(duplicates.map((name) => [(0, import_nodes22.camelCase)(name), (0, import_nodes22.camelCase)(`${name}Arg`)]));
2711
2830
  }
2831
+
2832
+ // src/renderVisitor.ts
2833
+ var import_renderers_core2 = require("@codama/renderers-core");
2834
+ var import_visitors_core22 = require("@codama/visitors-core");
2835
+ var estreePlugin = __toESM(require("prettier/plugins/estree"));
2836
+ var typeScriptPlugin = __toESM(require("prettier/plugins/typescript"));
2837
+ var import_standalone = require("prettier/standalone");
2712
2838
  var DEFAULT_PRETTIER_OPTIONS = {
2713
2839
  arrowParens: "always",
2714
2840
  parser: "typescript",
2715
- plugins: [estreePlugin__namespace, typeScriptPlugin__namespace],
2841
+ plugins: [estreePlugin, typeScriptPlugin],
2716
2842
  printWidth: 80,
2717
2843
  semi: true,
2718
2844
  singleQuote: true,
@@ -2721,27 +2847,27 @@ var DEFAULT_PRETTIER_OPTIONS = {
2721
2847
  useTabs: false
2722
2848
  };
2723
2849
  function renderVisitor(path, options = {}) {
2724
- return visitorsCore.rootNodeVisitor(async (root) => {
2850
+ return (0, import_visitors_core22.rootNodeVisitor)(async (root) => {
2725
2851
  if (options.deleteFolderBeforeRendering ?? true) {
2726
- renderersCore.deleteDirectory(path);
2852
+ (0, import_renderers_core2.deleteDirectory)(path);
2727
2853
  }
2728
- const renderMap = visitorsCore.visit(root, getRenderMapVisitor(options));
2854
+ const renderMap = (0, import_visitors_core22.visit)(root, getRenderMapVisitor(options));
2729
2855
  if (options.formatCode ?? true) {
2730
2856
  const prettierOptions = { ...DEFAULT_PRETTIER_OPTIONS, ...options.prettierOptions };
2731
- await renderMap.mapContentAsync((code) => standalone.format(code, prettierOptions));
2857
+ await renderMap.mapContentAsync((code) => (0, import_standalone.format)(code, prettierOptions));
2732
2858
  }
2733
2859
  renderMap.write(path);
2734
2860
  });
2735
2861
  }
2736
-
2737
- exports.DEFAULT_NAME_TRANSFORMERS = DEFAULT_NAME_TRANSFORMERS;
2738
- exports.ImportMap = ImportMap;
2739
- exports.default = renderVisitor;
2740
- exports.getNameApi = getNameApi;
2741
- exports.getRenderMapVisitor = getRenderMapVisitor;
2742
- exports.getTypeManifestVisitor = getTypeManifestVisitor;
2743
- exports.mergeManifests = mergeManifests;
2744
- exports.renderVisitor = renderVisitor;
2745
- exports.typeManifest = typeManifest;
2746
- //# sourceMappingURL=index.node.cjs.map
2862
+ // Annotate the CommonJS export names for ESM import in node:
2863
+ 0 && (module.exports = {
2864
+ DEFAULT_NAME_TRANSFORMERS,
2865
+ ImportMap,
2866
+ getNameApi,
2867
+ getRenderMapVisitor,
2868
+ getTypeManifestVisitor,
2869
+ mergeManifests,
2870
+ renderVisitor,
2871
+ typeManifest
2872
+ });
2747
2873
  //# sourceMappingURL=index.node.cjs.map