@metaplex-foundation/kinobi 0.16.7 → 0.16.9

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.
@@ -39,7 +39,7 @@ export function {{ instruction.name | camelCase }}(
39
39
  // Accounts.
40
40
  const resolvedAccounts = {
41
41
  {% for account in accounts %}
42
- {{ account.name | camelCase }}: { index: {{ loop.index0 }}, isWritable: {{ 'true' if account.isWritable else 'false' }}, value: {{ accountsObj }}.{{ account.name | camelCase }} ?? null },
42
+ {{ account.name | camelCase }}: { index: {{ loop.index0 }}, isWritable: {{ 'true' if account.isWritable else 'false' }} as boolean, value: {{ accountsObj }}.{{ account.name | camelCase }} ?? null },
43
43
  {% endfor %}
44
44
  } satisfies ResolvedAccountsWithIndices;
45
45
 
@@ -1,4 +1,20 @@
1
- /// `{{ instruction.name | snakeCase }}` CPI instruction builder.
1
+ /// Instruction builder for `{{ instruction.name | pascalCase }}` via CPI.
2
+ ///
3
+ /// ### Accounts:
4
+ ///
5
+ {% for account in instruction.accounts %}
6
+ {% set modifiers = '' %}
7
+ {% if account.isWritable %}
8
+ {% set modifiers = 'writable' %}
9
+ {% endif %}
10
+ {% if account.isSigner %}
11
+ {% set modifiers = modifiers + ', signer' if modifiers.length > 0 else 'signer' %}
12
+ {% endif %}
13
+ {% if account.isOptional %}
14
+ {% set modifiers = modifiers + ', optional' if modifiers.length > 0 else 'optional' %}
15
+ {% endif %}
16
+ {{ '/// ' + loop.index0 + '. `[' + modifiers + ']` ' + account.name | snakeCase }}
17
+ {% endfor %}
2
18
  pub struct {{ instruction.name | pascalCase }}CpiBuilder<'a, 'b> {
3
19
  instruction: Box<{{ instruction.name | pascalCase }}CpiBuilderInstruction<'a, 'b>>,
4
20
  }
@@ -1,4 +1,22 @@
1
- /// Instruction builder.
1
+ /// Instruction builder for `{{ instruction.name | pascalCase }}`.
2
+ ///
3
+ /// ### Accounts:
4
+ ///
5
+ {% for account in instruction.accounts %}
6
+ {% set modifiers = '' %}
7
+ {% if account.isWritable %}
8
+ {% set modifiers = 'writable' %}
9
+ {% endif %}
10
+ {% if account.isSigner %}
11
+ {% set modifiers = modifiers + ', signer' if modifiers.length > 0 else 'signer' %}
12
+ {% endif %}
13
+ {% if account.isOptional or account.defaultsTo.kind === 'program' or account.defaultsTo.kind === 'publicKey' %}
14
+ {% set modifiers = modifiers + ', optional' if modifiers.length > 0 else 'optional' %}
15
+ {% endif %}
16
+ {{ '/// ' + loop.index0 + '. `[' + modifiers + ']` ' + account.name | snakeCase }}
17
+ {{- " (default to `" + account.defaultsTo.program.publicKey + "`)" if account.defaultsTo.kind === 'program' }}
18
+ {{- " (default to `" + account.defaultsTo.publicKey + "`)" if account.defaultsTo.kind === 'publicKey' }}
19
+ {% endfor %}
2
20
  #[derive(Default)]
3
21
  pub struct {{ instruction.name | pascalCase }}Builder {
4
22
  {% for account in instruction.accounts %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaplex-foundation/kinobi",
3
- "version": "0.16.7",
3
+ "version": "0.16.9",
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",
@@ -39,7 +39,7 @@ export function {{ instruction.name | camelCase }}(
39
39
  // Accounts.
40
40
  const resolvedAccounts = {
41
41
  {% for account in accounts %}
42
- {{ account.name | camelCase }}: { index: {{ loop.index0 }}, isWritable: {{ 'true' if account.isWritable else 'false' }}, value: {{ accountsObj }}.{{ account.name | camelCase }} ?? null },
42
+ {{ account.name | camelCase }}: { index: {{ loop.index0 }}, isWritable: {{ 'true' if account.isWritable else 'false' }} as boolean, value: {{ accountsObj }}.{{ account.name | camelCase }} ?? null },
43
43
  {% endfor %}
44
44
  } satisfies ResolvedAccountsWithIndices;
45
45
 
@@ -1,4 +1,20 @@
1
- /// `{{ instruction.name | snakeCase }}` CPI instruction builder.
1
+ /// Instruction builder for `{{ instruction.name | pascalCase }}` via CPI.
2
+ ///
3
+ /// ### Accounts:
4
+ ///
5
+ {% for account in instruction.accounts %}
6
+ {% set modifiers = '' %}
7
+ {% if account.isWritable %}
8
+ {% set modifiers = 'writable' %}
9
+ {% endif %}
10
+ {% if account.isSigner %}
11
+ {% set modifiers = modifiers + ', signer' if modifiers.length > 0 else 'signer' %}
12
+ {% endif %}
13
+ {% if account.isOptional %}
14
+ {% set modifiers = modifiers + ', optional' if modifiers.length > 0 else 'optional' %}
15
+ {% endif %}
16
+ {{ '/// ' + loop.index0 + '. `[' + modifiers + ']` ' + account.name | snakeCase }}
17
+ {% endfor %}
2
18
  pub struct {{ instruction.name | pascalCase }}CpiBuilder<'a, 'b> {
3
19
  instruction: Box<{{ instruction.name | pascalCase }}CpiBuilderInstruction<'a, 'b>>,
4
20
  }
@@ -1,4 +1,22 @@
1
- /// Instruction builder.
1
+ /// Instruction builder for `{{ instruction.name | pascalCase }}`.
2
+ ///
3
+ /// ### Accounts:
4
+ ///
5
+ {% for account in instruction.accounts %}
6
+ {% set modifiers = '' %}
7
+ {% if account.isWritable %}
8
+ {% set modifiers = 'writable' %}
9
+ {% endif %}
10
+ {% if account.isSigner %}
11
+ {% set modifiers = modifiers + ', signer' if modifiers.length > 0 else 'signer' %}
12
+ {% endif %}
13
+ {% if account.isOptional or account.defaultsTo.kind === 'program' or account.defaultsTo.kind === 'publicKey' %}
14
+ {% set modifiers = modifiers + ', optional' if modifiers.length > 0 else 'optional' %}
15
+ {% endif %}
16
+ {{ '/// ' + loop.index0 + '. `[' + modifiers + ']` ' + account.name | snakeCase }}
17
+ {{- " (default to `" + account.defaultsTo.program.publicKey + "`)" if account.defaultsTo.kind === 'program' }}
18
+ {{- " (default to `" + account.defaultsTo.publicKey + "`)" if account.defaultsTo.kind === 'publicKey' }}
19
+ {% endfor %}
2
20
  #[derive(Default)]
3
21
  pub struct {{ instruction.name | pascalCase }}Builder {
4
22
  {% for account in instruction.accounts %}