@metaplex-foundation/kinobi 0.16.10 → 0.16.12
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/dist/cjs/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.js +2 -1
- package/dist/cjs/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.js.map +1 -1
- package/dist/cjs/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.njk +1 -1
- package/dist/cjs/renderers/js-experimental/fragments/instructionType.njk +0 -1
- package/dist/cjs/renderers/js-experimental/fragments/programErrors.njk +4 -3
- package/dist/cjs/renderers/js-experimental/templates/globalTypesPage.njk +2 -0
- package/dist/types/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.d.ts +1 -0
- package/package.json +1 -1
- package/src/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.njk +1 -1
- package/src/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.ts +2 -1
- package/src/renderers/js-experimental/fragments/instructionType.njk +0 -1
- package/src/renderers/js-experimental/fragments/programErrors.njk +4 -3
- package/src/renderers/js-experimental/templates/globalTypesPage.njk +2 -0
|
@@ -6,6 +6,7 @@ const ContextMap_1 = require("../ContextMap");
|
|
|
6
6
|
const ImportMap_1 = require("../ImportMap");
|
|
7
7
|
const common_1 = require("./common");
|
|
8
8
|
function getInstructionBytesCreatedOnChainFragment(scope) {
|
|
9
|
+
var _a;
|
|
9
10
|
const bytes = scope.instructionNode.bytesCreatedOnChain;
|
|
10
11
|
const imports = new ImportMap_1.ImportMap();
|
|
11
12
|
const interfaces = new ContextMap_1.ContextMap();
|
|
@@ -20,7 +21,7 @@ function getInstructionBytesCreatedOnChainFragment(scope) {
|
|
|
20
21
|
imports.add(bytes.importFrom, (0, shared_1.camelCase)(bytes.name));
|
|
21
22
|
interfaces.add(['getProgramAddress', 'getProgramDerivedAddress']);
|
|
22
23
|
}
|
|
23
|
-
const bytesFragment = (0, common_1.fragmentFromTemplate)('instructionBytesCreatedOnChain.njk', { bytes }).mergeImportsWith(imports);
|
|
24
|
+
const bytesFragment = (0, common_1.fragmentFromTemplate)('instructionBytesCreatedOnChain.njk', { bytes, argObject: (_a = scope.argObject) !== null && _a !== void 0 ? _a : 'args' }).mergeImportsWith(imports);
|
|
24
25
|
bytesFragment.interfaces = interfaces;
|
|
25
26
|
return bytesFragment;
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructionBytesCreatedOnChain.js","sourceRoot":"","sources":["../../../../../src/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.ts"],"names":[],"mappings":";;;AACA,4CAAwD;AACxD,8CAA2C;AAC3C,4CAAyC;AACzC,qCAA0D;AAE1D,SAAgB,yCAAyC,CAAC,
|
|
1
|
+
{"version":3,"file":"instructionBytesCreatedOnChain.js","sourceRoot":"","sources":["../../../../../src/renderers/js-experimental/fragments/instructionBytesCreatedOnChain.ts"],"names":[],"mappings":";;;AACA,4CAAwD;AACxD,8CAA2C;AAC3C,4CAAyC;AACzC,qCAA0D;AAE1D,SAAgB,yCAAyC,CAAC,KAGzD;;IACC,MAAM,KAAK,GAAG,KAAK,CAAC,eAAe,CAAC,mBAAmB,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,qBAAS,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,uBAAU,EAAE,CAAC;IAEpC,IAAI,KAAK,IAAI,eAAe,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,EAAE;QAC5D,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;KACpD;IAED,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,SAAS,EAAE;QAC7B,MAAM,UAAU,GACd,KAAK,CAAC,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,IAAA,mBAAU,EAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC7D;SAAM,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,UAAU,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,IAAA,kBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,UAAU,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CAAC;KACnE;IAED,MAAM,aAAa,GAAG,IAAA,6BAAoB,EACxC,oCAAoC,EACpC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,MAAM,EAAE,CAChD,CAAC,gBAAgB,CAAC,OAAO,CAA0C,CAAC;IACrE,aAAa,CAAC,UAAU,GAAG,UAAU,CAAC;IACtC,OAAO,aAAa,CAAC;AACvB,CAAC;AA3BD,8FA2BC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{% if bytes.kind === 'number' %}
|
|
3
3
|
const bytesCreatedOnChain = {{ bytes.value }}{% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
4
4
|
{% elif bytes.kind === 'arg' %}
|
|
5
|
-
const bytesCreatedOnChain = Number({{
|
|
5
|
+
const bytesCreatedOnChain = Number({{ argObject }}.{{ bytes.name }}){% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
6
6
|
{% elif bytes.kind === 'account' %}
|
|
7
7
|
const bytesCreatedOnChain = get{{ bytes.name | pascalCase }}Size(){% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
8
8
|
{% elif bytes.kind === 'resolver' %}
|
|
@@ -9,12 +9,13 @@ export const enum {{ programErrorName }}Code {
|
|
|
9
9
|
|
|
10
10
|
export class {{ programErrorName }} extends Error {
|
|
11
11
|
override readonly name = '{{ programErrorName }}';
|
|
12
|
+
|
|
12
13
|
readonly code: {{ programErrorName }}Code;
|
|
14
|
+
|
|
13
15
|
readonly cause: Error | undefined;
|
|
14
16
|
|
|
15
17
|
constructor(code: {{ programErrorName }}Code, name: string, message: string, cause?: Error) {
|
|
16
18
|
super(`${name} (${code}): ${message}`);
|
|
17
|
-
Error.captureStackTrace(this, this.constructor);
|
|
18
19
|
this.code = code;
|
|
19
20
|
this.cause = cause;
|
|
20
21
|
}
|
|
@@ -32,7 +33,7 @@ if (__DEV__) {
|
|
|
32
33
|
export function get{{ programErrorName }}FromCode(code: {{ programErrorName }}Code, cause?: Error): {{ programErrorName }} {
|
|
33
34
|
if (__DEV__) {
|
|
34
35
|
return new {{ programErrorName }}(code, ...({{ programErrorName | camelCase }}CodeMap as Record<{{ programErrorName }}Code, [string, string]>)[code], cause);
|
|
35
|
-
} else {
|
|
36
|
-
return new {{ programErrorName }}(code, 'Unknown', 'Error message not available in production bundles. Compile with __DEV__ set to true to see more information.', cause);
|
|
37
36
|
}
|
|
37
|
+
|
|
38
|
+
return new {{ programErrorName }}(code, 'Unknown', 'Error message not available in production bundles. Compile with __DEV__ set to true to see more information.', cause);
|
|
38
39
|
}
|
|
@@ -3,6 +3,7 @@ import { ContextMap } from '../ContextMap';
|
|
|
3
3
|
import { Fragment } from './common';
|
|
4
4
|
export declare function getInstructionBytesCreatedOnChainFragment(scope: {
|
|
5
5
|
instructionNode: nodes.InstructionNode;
|
|
6
|
+
argObject?: string;
|
|
6
7
|
}): Fragment & {
|
|
7
8
|
interfaces: ContextMap;
|
|
8
9
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{% if bytes.kind === 'number' %}
|
|
3
3
|
const bytesCreatedOnChain = {{ bytes.value }}{% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
4
4
|
{% elif bytes.kind === 'arg' %}
|
|
5
|
-
const bytesCreatedOnChain = Number({{
|
|
5
|
+
const bytesCreatedOnChain = Number({{ argObject }}.{{ bytes.name }}){% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
6
6
|
{% elif bytes.kind === 'account' %}
|
|
7
7
|
const bytesCreatedOnChain = get{{ bytes.name | pascalCase }}Size(){% if bytes.includeHeader %} + BASE_ACCOUNT_SIZE{% endif %};
|
|
8
8
|
{% elif bytes.kind === 'resolver' %}
|
|
@@ -6,6 +6,7 @@ import { Fragment, fragmentFromTemplate } from './common';
|
|
|
6
6
|
|
|
7
7
|
export function getInstructionBytesCreatedOnChainFragment(scope: {
|
|
8
8
|
instructionNode: nodes.InstructionNode;
|
|
9
|
+
argObject?: string;
|
|
9
10
|
}): Fragment & { interfaces: ContextMap } {
|
|
10
11
|
const bytes = scope.instructionNode.bytesCreatedOnChain;
|
|
11
12
|
const imports = new ImportMap();
|
|
@@ -26,7 +27,7 @@ export function getInstructionBytesCreatedOnChainFragment(scope: {
|
|
|
26
27
|
|
|
27
28
|
const bytesFragment = fragmentFromTemplate(
|
|
28
29
|
'instructionBytesCreatedOnChain.njk',
|
|
29
|
-
{ bytes }
|
|
30
|
+
{ bytes, argObject: scope.argObject ?? 'args' }
|
|
30
31
|
).mergeImportsWith(imports) as Fragment & { interfaces: ContextMap };
|
|
31
32
|
bytesFragment.interfaces = interfaces;
|
|
32
33
|
return bytesFragment;
|
|
@@ -9,12 +9,13 @@ export const enum {{ programErrorName }}Code {
|
|
|
9
9
|
|
|
10
10
|
export class {{ programErrorName }} extends Error {
|
|
11
11
|
override readonly name = '{{ programErrorName }}';
|
|
12
|
+
|
|
12
13
|
readonly code: {{ programErrorName }}Code;
|
|
14
|
+
|
|
13
15
|
readonly cause: Error | undefined;
|
|
14
16
|
|
|
15
17
|
constructor(code: {{ programErrorName }}Code, name: string, message: string, cause?: Error) {
|
|
16
18
|
super(`${name} (${code}): ${message}`);
|
|
17
|
-
Error.captureStackTrace(this, this.constructor);
|
|
18
19
|
this.code = code;
|
|
19
20
|
this.cause = cause;
|
|
20
21
|
}
|
|
@@ -32,7 +33,7 @@ if (__DEV__) {
|
|
|
32
33
|
export function get{{ programErrorName }}FromCode(code: {{ programErrorName }}Code, cause?: Error): {{ programErrorName }} {
|
|
33
34
|
if (__DEV__) {
|
|
34
35
|
return new {{ programErrorName }}(code, ...({{ programErrorName | camelCase }}CodeMap as Record<{{ programErrorName }}Code, [string, string]>)[code], cause);
|
|
35
|
-
} else {
|
|
36
|
-
return new {{ programErrorName }}(code, 'Unknown', 'Error message not available in production bundles. Compile with __DEV__ set to true to see more information.', cause);
|
|
37
36
|
}
|
|
37
|
+
|
|
38
|
+
return new {{ programErrorName }}(code, 'Unknown', 'Error message not available in production bundles. Compile with __DEV__ set to true to see more information.', cause);
|
|
38
39
|
}
|