@metaplex-foundation/kinobi 0.16.10 → 0.16.11

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,6 +1,5 @@
1
1
  {% import "templates/macros.njk" as macros %}
2
2
 
3
- // Output.
4
3
  export type {{ instruction.name | pascalCase }}Instruction{{ 'WithSigners' if withSigners }}<
5
4
  TProgram extends string = "{{ program.publicKey }}",
6
5
  {% if hasAccounts %}
@@ -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
  }
@@ -1,5 +1,7 @@
1
1
  {% extends "layout.njk" %}
2
2
 
3
3
  {% block main %}
4
+ /** Global variable provided by bundlers telling us if we are building for production or not. */
5
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
6
  declare const __DEV__: boolean;
5
7
  {% endblock %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaplex-foundation/kinobi",
3
- "version": "0.16.10",
3
+ "version": "0.16.11",
4
4
  "description": "Generate powerful clients for your Solana programs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -1,6 +1,5 @@
1
1
  {% import "templates/macros.njk" as macros %}
2
2
 
3
- // Output.
4
3
  export type {{ instruction.name | pascalCase }}Instruction{{ 'WithSigners' if withSigners }}<
5
4
  TProgram extends string = "{{ program.publicKey }}",
6
5
  {% if hasAccounts %}
@@ -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
  }
@@ -1,5 +1,7 @@
1
1
  {% extends "layout.njk" %}
2
2
 
3
3
  {% block main %}
4
+ /** Global variable provided by bundlers telling us if we are building for production or not. */
5
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
6
  declare const __DEV__: boolean;
5
7
  {% endblock %}