Skip to content

Commit 944bb7d

Browse files
committed
Fixed and updated page visit example
1 parent 75c7ab5 commit 944bb7d

File tree

6 files changed

+182
-11
lines changed

6 files changed

+182
-11
lines changed

Cargo.lock

Lines changed: 176 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

basics/program-derived-addresses/anchor/Anchor.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[features]
22
seeds = false
33
[programs.localnet]
4-
anchor_program_example = "FFKtnYFyzPj1qFjE9epkrfYHJwZMdh8CvJrB6XsKeFVz"
4+
anchor_program_example = "oCCQRZyAbVxujyd8m57MPmDzZDmy2FoKW4ULS7KofCE"
55

66
[registry]
77
url = "https://anchor.projectserum.com"

basics/program-derived-addresses/anchor/programs/anchor-program-example/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ cpi = ["no-entrypoint"]
1616
default = []
1717

1818
[dependencies]
19-
anchor-lang = "0.28.0"
19+
anchor-lang = "0.29.0"
20+
ahash = "=0.8.6"

basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct CreatePageVisits<'info> {
2323
pub fn create_page_visits(ctx: Context<CreatePageVisits>) -> Result<()> {
2424
*ctx.accounts.page_visits = PageVisits {
2525
page_visits: 0,
26-
bump: *ctx.bumps.get("page_visits").unwrap(),
26+
bump: ctx.bumps.page_visits,
2727
};
2828

2929
Ok(())

basics/program-derived-addresses/anchor/programs/anchor-program-example/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use instructions::*;
77
pub mod instructions;
88
pub mod state;
99

10-
declare_id!("FFKtnYFyzPj1qFjE9epkrfYHJwZMdh8CvJrB6XsKeFVz");
10+
declare_id!("oCCQRZyAbVxujyd8m57MPmDzZDmy2FoKW4ULS7KofCE");
1111

1212
#[program]
1313
pub mod anchor_program_example {

basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/page_visits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct PageVisits {
88
}
99

1010
impl PageVisits {
11-
pub const SEED_PREFIX: &[u8; 11] = b"page_visits";
11+
pub const SEED_PREFIX: &'static [u8; 11] = b"page_visits";
1212

1313
pub fn increment(&mut self) {
1414
self.page_visits = self.page_visits.checked_add(1).unwrap();

0 commit comments

Comments
 (0)