Skip to content

Commit 51b718a

Browse files
committed
account-data/steel - add api
1 parent 55253c4 commit 51b718a

File tree

7 files changed

+69
-23
lines changed

7 files changed

+69
-23
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[workspace]
22
members = ["program"]
33
resolver = "2"
4+
5+
[workspace.dependencies]
6+
solana-program = "1.18.17"
7+
steel = "2.0"
8+
bytemuck = "1.14"
9+
num_enum = "0.7"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "account-data-steel-api"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[lib]
7+
crate-type = ["cdylib", "lib"]
8+
9+
[dependencies]
10+
solana-program.workspace = true
11+
steel.workspace = true
12+
bytemuck.workspace = true
13+
num_enum.workspace = true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use steel::*;
2+
3+
#[repr(u8)]
4+
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
5+
pub enum SteelAccount {
6+
AddressInfo = 0,
7+
}
8+
9+
account!(SteelAccount, AddressInfo);
10+
#[repr(C, packed)]
11+
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
12+
pub struct AddressInfo {
13+
pub name: [u8; 48],
14+
pub house_number: u8,
15+
pub street: [u8; 48],
16+
pub city: [u8; 48],
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
mod instruction;
2+
mod state;
3+
4+
use steel::*;
5+
6+
declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35");
7+
8+
pub mod prelude {
9+
pub use crate::state::*;
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use steel::*;
2+
3+
#[repr(u8)]
4+
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
5+
pub enum SteelAccount {
6+
AddressInfo = 0,
7+
}
8+
9+
account!(SteelAccount, AddressInfo);
10+
#[repr(C, packed)]
11+
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
12+
pub struct AddressInfo {
13+
pub name: [u8; 48],
14+
pub house_number: u8,
15+
pub street: [u8; 48],
16+
pub city: [u8; 48],
17+
}

basics/account-data/steel/program/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ edition = "2021"
77
crate-type = ["cdylib", "lib"]
88

99
[dependencies]
10-
solana-program = "1.18.17"
11-
steel = "2.0"
12-
bytemuck = "1.14"
13-
num_enum = "0.7"
14-
borsh = "1.5.1"
10+
solana-program.workspace = true
11+
steel.workspace = true
12+
bytemuck.workspace = true
13+
num_enum.workspace = true
14+
account-data-steel-api = {path = "../api"}

basics/account-data/steel/program/src/lib.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
use account_data_steel_api::prelude::*;
12
use solana_program::rent::Rent;
23
use steel::*;
34

4-
declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35");
5-
65
entrypoint!(process_instruction);
76

87
pub fn process_instruction(
@@ -57,19 +56,3 @@ pub fn process_instruction(
5756

5857
Ok(())
5958
}
60-
61-
#[repr(u8)]
62-
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
63-
pub enum SteelAccount {
64-
AddressInfo = 0,
65-
}
66-
67-
account!(SteelAccount, AddressInfo);
68-
#[repr(C, packed)]
69-
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
70-
pub struct AddressInfo {
71-
pub name: [u8; 48],
72-
pub house_number: u8,
73-
pub street: [u8; 48],
74-
pub city: [u8; 48],
75-
}

0 commit comments

Comments
 (0)