@codama/renderers-js 1.1.2 → 1.2.1
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.
- package/README.md +1 -1
- package/dist/index.node.cjs +8 -8
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +6 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/getTypeManifestVisitor.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[npm-image]: https://img.shields.io/npm/v/@codama/renderers-js.svg?style=flat&label=%40codama%2Frenderers-js
|
|
8
8
|
[npm-url]: https://www.npmjs.com/package/@codama/renderers-js
|
|
9
9
|
|
|
10
|
-
This package generates JavaScript clients from your Codama IDLs. The generated clients are compatible with the soon-to-be-released 2.0 line of [`@solana/web3.js`](https://github.com/
|
|
10
|
+
This package generates JavaScript clients from your Codama IDLs. The generated clients are compatible with the soon-to-be-released 2.0 line of [`@solana/web3.js`](https://github.com/anza-xyz/solana-web3.js).
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
package/dist/index.node.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var visitorsCore = require('@codama/visitors-core');
|
|
4
6
|
var path = require('path');
|
|
5
7
|
var nodes = require('@codama/nodes');
|
|
@@ -455,7 +457,7 @@ function getAccountPdaHelpersFragment(scope) {
|
|
|
455
457
|
const { accountPath, nameApi, linkables, customAccountData, typeManifest: typeManifest2 } = scope;
|
|
456
458
|
const accountNode = visitorsCore.getLastNodeFromPath(accountPath);
|
|
457
459
|
const programNode = visitorsCore.findProgramNodeFromPath(accountPath);
|
|
458
|
-
const pdaNode = accountNode.pda ? linkables.get([...accountPath, accountNode.pda]) :
|
|
460
|
+
const pdaNode = accountNode.pda ? linkables.get([...accountPath, accountNode.pda]) : undefined;
|
|
459
461
|
if (!pdaNode) {
|
|
460
462
|
return fragment("");
|
|
461
463
|
}
|
|
@@ -807,7 +809,7 @@ function getInstructionInputDefaultFragment(scope) {
|
|
|
807
809
|
if (input.kind === "instructionAccountNode" && nodes.isNode(defaultValue, "resolverValueNode")) {
|
|
808
810
|
return fragment(`accounts.${inputName} = { ...accounts.${inputName}, ...${renderedValue} };`);
|
|
809
811
|
}
|
|
810
|
-
if (input.kind === "instructionAccountNode" && isWritable ===
|
|
812
|
+
if (input.kind === "instructionAccountNode" && isWritable === undefined) {
|
|
811
813
|
return fragment(`accounts.${inputName}.value = ${renderedValue};`);
|
|
812
814
|
}
|
|
813
815
|
if (input.kind === "instructionAccountNode") {
|
|
@@ -993,7 +995,7 @@ ${ifTrueRenderer ? ifTrueRenderer.render : ifFalseRenderer?.render}
|
|
|
993
995
|
}
|
|
994
996
|
function renderNestedInstructionDefault(scope) {
|
|
995
997
|
const { input, defaultValue } = scope;
|
|
996
|
-
if (!defaultValue) return
|
|
998
|
+
if (!defaultValue) return undefined;
|
|
997
999
|
return getInstructionInputDefaultFragment({
|
|
998
1000
|
...scope,
|
|
999
1001
|
input: { ...input, defaultValue }
|
|
@@ -2154,11 +2156,8 @@ function getTypeManifestVisitor(input) {
|
|
|
2154
2156
|
},
|
|
2155
2157
|
visitSolAmountType({ number }, { self }) {
|
|
2156
2158
|
const numberManifest = visitorsCore.visit(number, self);
|
|
2157
|
-
const lamportsType = "
|
|
2158
|
-
const lamportsImport = new ImportMap().add(
|
|
2159
|
-
"solanaRpcTypes",
|
|
2160
|
-
"type LamportsUnsafeBeyond2Pow53Minus1"
|
|
2161
|
-
);
|
|
2159
|
+
const lamportsType = "Lamports";
|
|
2160
|
+
const lamportsImport = new ImportMap().add("solanaRpcTypes", "type Lamports");
|
|
2162
2161
|
return {
|
|
2163
2162
|
...numberManifest,
|
|
2164
2163
|
decoder: numberManifest.decoder.mapRender((r) => `getLamportsDecoder(${r})`).addImports("solanaRpcTypes", "getLamportsDecoder"),
|
|
@@ -2737,6 +2736,7 @@ function renderVisitor(path, options = {}) {
|
|
|
2737
2736
|
|
|
2738
2737
|
exports.DEFAULT_NAME_TRANSFORMERS = DEFAULT_NAME_TRANSFORMERS;
|
|
2739
2738
|
exports.ImportMap = ImportMap;
|
|
2739
|
+
exports.default = renderVisitor;
|
|
2740
2740
|
exports.getNameApi = getNameApi;
|
|
2741
2741
|
exports.getRenderMapVisitor = getRenderMapVisitor;
|
|
2742
2742
|
exports.getTypeManifestVisitor = getTypeManifestVisitor;
|