@codama/renderers-rust 1.1.3 → 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.
@@ -213,7 +213,7 @@ pub fn fetch_all_maybe_{{ account.name | snakeCase }}(
213
213
  #}
214
214
  #[cfg(feature = "anchor-idl-build")]
215
215
  impl anchor_lang::Discriminator for {{ account.name | pascalCase }} {
216
- const DISCRIMINATOR: [u8; 8] = [0; 8];
216
+ const DISCRIMINATOR: &[u8] = &[0; 8];
217
217
  }
218
218
  {% endif %}
219
219
 
@@ -14,15 +14,9 @@ pub enum {{ program.name | pascalCase }}Error {
14
14
  {% endfor %}
15
15
  }
16
16
 
17
- impl solana_program_error::PrintProgramError for {{ program.name | pascalCase }}Error {
18
- fn print<E>(&self) {
19
- solana_msg::msg!(&self.to_string());
20
- }
21
- }
22
-
23
- impl<T> solana_decode_error::DecodeError<T> for {{ program.name | pascalCase }}Error {
24
- fn type_of() -> &'static str {
25
- "{{ program.name | pascalCase }}Error"
17
+ impl From<{{ program.name | pascalCase }}Error> for solana_program_error::ProgramError {
18
+ fn from(e: {{ program.name | pascalCase }}Error) -> Self {
19
+ solana_program_error::ProgramError::Custom(e as u32)
26
20
  }
27
21
  }
28
22
 
@@ -69,15 +69,15 @@ impl<'a, 'b> {{ instruction.name | pascalCase }}Cpi<'a, 'b> {
69
69
  }
70
70
  }
71
71
  #[inline(always)]
72
- pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
72
+ pub fn invoke(&self) -> solana_program_error::ProgramResult {
73
73
  self.invoke_signed_with_remaining_accounts(&[], &[])
74
74
  }
75
75
  #[inline(always)]
76
- pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_entrypoint::ProgramResult {
76
+ pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_error::ProgramResult {
77
77
  self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
78
78
  }
79
79
  #[inline(always)]
80
- pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
80
+ pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
81
81
  self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
82
82
  }
83
83
  #[allow(clippy::arithmetic_side_effects)]
@@ -87,7 +87,7 @@ impl<'a, 'b> {{ instruction.name | pascalCase }}Cpi<'a, 'b> {
87
87
  &self,
88
88
  signers_seeds: &[&[&[u8]]],
89
89
  remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
90
- ) -> solana_program_entrypoint::ProgramResult {
90
+ ) -> solana_program_error::ProgramResult {
91
91
  let mut accounts = Vec::with_capacity({{ instruction.accounts.length + '+' if instruction.accounts.length > 0}} remaining_accounts.len());
92
92
  {% for account in instruction.accounts %}
93
93
  {% if account.isSigner === 'either' %}
@@ -89,12 +89,12 @@ impl<'a, 'b> {{ instruction.name | pascalCase }}CpiBuilder<'a, 'b> {
89
89
  self
90
90
  }
91
91
  #[inline(always)]
92
- pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
92
+ pub fn invoke(&self) -> solana_program_error::ProgramResult {
93
93
  self.invoke_signed(&[])
94
94
  }
95
95
  #[allow(clippy::clone_on_copy)]
96
96
  #[allow(clippy::vec_init_then_push)]
97
- pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
97
+ pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
98
98
  {% if hasArgs %}
99
99
  let args = {{ instruction.name | pascalCase }}InstructionArgs {
100
100
  {% for arg in instructionArgs %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codama/renderers-rust",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "description": "Renders Rust clients for your programs",
5
5
  "exports": {
6
6
  "types": "./dist/types/index.d.ts",
@@ -30,14 +30,14 @@
30
30
  "dependencies": {
31
31
  "@solana/codecs-strings": "^2.3.0",
32
32
  "nunjucks": "^3.2.4",
33
- "@codama/errors": "1.3.1",
34
- "@codama/nodes": "1.3.1",
35
- "@codama/renderers-core": "1.0.17",
36
- "@codama/visitors-core": "1.3.1"
33
+ "@codama/errors": "1.3.2",
34
+ "@codama/nodes": "1.3.2",
35
+ "@codama/renderers-core": "1.0.18",
36
+ "@codama/visitors-core": "1.3.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/nunjucks": "^3.2.6",
40
- "@codama/nodes-from-anchor": "1.2.3"
40
+ "@codama/nodes-from-anchor": "1.2.4"
41
41
  },
42
42
  "license": "MIT",
43
43
  "repository": {