Skip to content

Commit a305a91

Browse files
authored
[renderers-rust] Export discriminator constants for accounts and instructions (#721)
1 parent a6ff153 commit a305a91

25 files changed

+186
-1
lines changed

.changeset/purple-melons-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/renderers-rust': patch
3+
---
4+
5+
Export discriminator constants for accounts and instructions

packages/renderers-rust/e2e/anchor/src/generated/accounts/guard_v1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ pub struct GuardV1 {
3232
pub additional_fields_rule: Vec<MetadataAdditionalFieldRule>,
3333
}
3434

35+
pub const GUARD_V1_DISCRIMINATOR: [u8; 8] = [185, 149, 156, 78, 245, 108, 172, 68];
36+
3537
impl GuardV1 {
3638
#[inline(always)]
3739
pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {

packages/renderers-rust/e2e/anchor/src/generated/instructions/create_guard.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use crate::generated::types::TransferAmountRule;
1111
use borsh::BorshDeserialize;
1212
use borsh::BorshSerialize;
1313

14+
pub const CREATE_GUARD_DISCRIMINATOR: [u8; 8] = [251, 254, 17, 198, 219, 218, 154, 99];
15+
1416
/// Accounts.
1517
#[derive(Debug)]
1618
pub struct CreateGuard {

packages/renderers-rust/e2e/anchor/src/generated/instructions/execute.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

11+
pub const EXECUTE_DISCRIMINATOR: [u8; 8] = [105, 37, 101, 197, 75, 251, 102, 26];
12+
1113
/// Accounts.
1214
#[derive(Debug)]
1315
pub struct Execute {

packages/renderers-rust/e2e/anchor/src/generated/instructions/initialize.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

11+
pub const INITIALIZE_DISCRIMINATOR: [u8; 8] = [43, 34, 13, 49, 167, 88, 235, 235];
12+
1113
/// Accounts.
1214
#[derive(Debug)]
1315
pub struct Initialize {

packages/renderers-rust/e2e/anchor/src/generated/instructions/update_guard.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use crate::generated::types::TransferAmountRule;
1111
use borsh::BorshDeserialize;
1212
use borsh::BorshSerialize;
1313

14+
pub const UPDATE_GUARD_DISCRIMINATOR: [u8; 8] = [51, 38, 175, 180, 25, 249, 39, 24];
15+
1416
/// Accounts.
1517
#[derive(Debug)]
1618
pub struct UpdateGuard {

packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

11+
pub const INSTRUCTION3_DISCRIMINATOR: u32 = 42;
12+
1113
/// Accounts.
1214
#[derive(Debug)]
1315
pub struct Instruction3 {}

packages/renderers-rust/e2e/system/src/generated/instructions/advance_nonce_account.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

11+
pub const ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR: u32 = 4;
12+
1113
/// Accounts.
1214
#[derive(Debug)]
1315
pub struct AdvanceNonceAccount {

packages/renderers-rust/e2e/system/src/generated/instructions/allocate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

11+
pub const ALLOCATE_DISCRIMINATOR: u32 = 8;
12+
1113
/// Accounts.
1214
#[derive(Debug)]
1315
pub struct Allocate {

packages/renderers-rust/e2e/system/src/generated/instructions/allocate_with_seed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010
use solana_pubkey::Pubkey;
1111

12+
pub const ALLOCATE_WITH_SEED_DISCRIMINATOR: u32 = 9;
13+
1214
/// Accounts.
1315
#[derive(Debug)]
1416
pub struct AllocateWithSeed {

0 commit comments

Comments
 (0)