Skip to content

Commit 4022c51

Browse files
committed
fix: merge conflict
2 parents c2ce660 + 91b9e45 commit 4022c51

70 files changed

Lines changed: 2064 additions & 2211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ node_modules/
2222

2323
/target
2424
deploy
25-
.claude
2625
.claire
26+
.claude

basics/account-data/quasar/src/instructions/create.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@ pub struct CreateAddressInfo {
1515
pub system_program: Program<System>,
1616
}
1717

18-
impl CreateAddressInfo {
19-
#[inline(always)]
20-
pub fn create_address_info(
21-
&mut self, name: &str,
22-
house_number: u8,
23-
street: &str,
24-
city: &str,
25-
) -> Result<(), ProgramError> {
26-
self.address_info.set_inner(
27-
house_number,
28-
name,
29-
street,
30-
city,
31-
self.payer.to_account_view(),
32-
None,
33-
)
34-
}
18+
#[inline(always)]
19+
pub fn handle_create_address_info(
20+
accounts: &mut CreateAddressInfo,
21+
name: &str,
22+
house_number: u8,
23+
street: &str,
24+
city: &str,
25+
) -> Result<(), ProgramError> {
26+
accounts.address_info.set_inner(
27+
house_number,
28+
name,
29+
street,
30+
city,
31+
accounts.payer.to_account_view(),
32+
None,
33+
)
3534
}

basics/checking-accounts/quasar/src/instructions/check_accounts.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ pub struct CheckAccounts {
2121
pub system_program: Program<System>,
2222
}
2323

24-
impl CheckAccounts {
25-
#[inline(always)]
26-
pub fn check_accounts(&mut self) -> Result<(), ProgramError> {
27-
// All validation happens declaratively via the account types above.
28-
// If any check fails, the runtime rejects the transaction before this runs.
29-
Ok(())
30-
}
24+
#[inline(always)]
25+
pub fn handle_check_accounts(_accounts: &mut CheckAccounts) -> Result<(), ProgramError> {
26+
// All validation happens declaratively via the account types above.
27+
// If any check fails, the runtime rejects the transaction before this runs.
28+
Ok(())
3129
}

basics/close-account/quasar/src/instructions/close_user.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ pub struct CloseUser {
1515
pub user_account: Account<UserState<'_>>,
1616
}
1717

18-
impl CloseUser {
19-
#[inline(always)]
20-
pub fn close_user(&mut self) -> Result<(), ProgramError> {
21-
self.user_account.close(self.user.to_account_view())
22-
}
18+
#[inline(always)]
19+
pub fn handle_close_user(accounts: &mut CloseUser) -> Result<(), ProgramError> {
20+
accounts.user_account.close(accounts.user.to_account_view())
2321
}

basics/close-account/quasar/src/instructions/create_user.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ pub struct CreateUser {
1313
pub system_program: Program<System>,
1414
}
1515

16-
impl CreateUser {
17-
#[inline(always)]
18-
pub fn create_user(&mut self, name: &str, bump: u8) -> Result<(), ProgramError> {
19-
let user_address = *self.user.to_account_view().address();
20-
self.user_account.set_inner(
21-
bump,
22-
user_address,
23-
name,
24-
self.user.to_account_view(),
25-
None,
26-
)
27-
}
16+
#[inline(always)]
17+
pub fn handle_create_user(accounts: &mut CreateUser, name: &str, bump: u8) -> Result<(), ProgramError> {
18+
let user_address = *accounts.user.to_account_view().address();
19+
accounts.user_account.set_inner(
20+
bump,
21+
user_address,
22+
name,
23+
accounts.user.to_account_view(),
24+
None,
25+
)
2826
}

basics/counter/quasar/src/instructions/increment.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ pub struct Increment {
1010
pub counter: Account<Counter>,
1111
}
1212

13-
impl Increment {
14-
#[inline(always)]
15-
pub fn increment(&mut self) -> Result<(), ProgramError> {
16-
let current: u64 = self.counter.count.into();
17-
self.counter.count = PodU64::from(current.checked_add(1).unwrap());
18-
Ok(())
19-
}
13+
#[inline(always)]
14+
pub fn handle_increment(accounts: &mut Increment) -> Result<(), ProgramError> {
15+
let current: u64 = accounts.counter.count.into();
16+
accounts.counter.count = PodU64::from(current.checked_add(1).unwrap());
17+
Ok(())
2018
}

basics/counter/quasar/src/instructions/initialize_counter.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ pub struct InitializeCounter {
1414
pub system_program: Program<System>,
1515
}
1616

17-
impl InitializeCounter {
18-
#[inline(always)]
19-
pub fn initialize_counter(&mut self) -> Result<(), ProgramError> {
20-
self.counter.set_inner(0u64);
21-
Ok(())
22-
}
17+
#[inline(always)]
18+
pub fn handle_initialize_counter(accounts: &mut InitializeCounter) -> Result<(), ProgramError> {
19+
accounts.counter.set_inner(0u64);
20+
Ok(())
2321
}

basics/create-account/quasar/src/instructions/create_system_account.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,18 @@ pub struct CreateSystemAccount {
1111
pub system_program: Program<System>,
1212
}
1313

14-
impl CreateSystemAccount {
15-
#[inline(always)]
16-
pub fn create_system_account(&mut self) -> Result<(), ProgramError> {
17-
// Create a zero-data account owned by the system program,
18-
// funded with the minimum rent-exempt balance.
19-
let system_program_address = Address::default();
20-
self.system_program
21-
.create_account_with_minimum_balance(
22-
&self.payer,
23-
&self.new_account,
24-
0, // space: zero bytes of data
25-
&system_program_address,
26-
None, // fetch Rent sysvar automatically
27-
)?
28-
.invoke()
29-
}
14+
#[inline(always)]
15+
pub fn handle_create_system_account(accounts: &mut CreateSystemAccount) -> Result<(), ProgramError> {
16+
// Create a zero-data account owned by the system program,
17+
// funded with the minimum rent-exempt balance.
18+
let system_program_address = Address::default();
19+
accounts.system_program
20+
.create_account_with_minimum_balance(
21+
&accounts.payer,
22+
&accounts.new_account,
23+
0, // space: zero bytes of data
24+
&system_program_address,
25+
None, // fetch Rent sysvar automatically
26+
)?
27+
.invoke()
3028
}

basics/favorites/quasar/src/instructions/set_favorites.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ pub struct SetFavorites {
1414
pub system_program: Program<System>,
1515
}
1616

17-
impl SetFavorites {
18-
#[inline(always)]
19-
pub fn set_favorites(&mut self, number: u64, color: &str) -> Result<(), ProgramError> {
20-
self.favorites.set_inner(
21-
number,
22-
color,
23-
self.user.to_account_view(),
24-
None,
25-
)
26-
}
17+
#[inline(always)]
18+
pub fn handle_set_favorites(accounts: &mut SetFavorites, number: u64, color: &str) -> Result<(), ProgramError> {
19+
accounts.favorites.set_inner(
20+
number,
21+
color,
22+
accounts.user.to_account_view(),
23+
None,
24+
)
2725
}

basics/hello-solana/quasar/src/instructions/hello.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ pub struct Hello {
99
pub payer: Signer,
1010
}
1111

12-
impl Hello {
13-
#[inline(always)]
14-
pub fn hello(&mut self) -> Result<(), ProgramError> {
15-
log("Hello, Solana!");
16-
log("Our program's Program ID: FLUH9c5oAfXb1eYbkZvdGK9r9SLQJBUi2DZQaBVj7Tzr");
17-
Ok(())
18-
}
12+
#[inline(always)]
13+
pub fn handle_hello(_accounts: &mut Hello) -> Result<(), ProgramError> {
14+
log("Hello, Solana!");
15+
log("Our program's Program ID: FLUH9c5oAfXb1eYbkZvdGK9r9SLQJBUi2DZQaBVj7Tzr");
16+
Ok(())
1917
}

0 commit comments

Comments
 (0)