From 56f457afd3674d0e915c569503a1a679db9774c6 Mon Sep 17 00:00:00 2001 From: Chii Yuen Date: Wed, 27 Nov 2024 07:00:01 +0800 Subject: [PATCH] fix: readme typos (#587) * fix: typo filename "anchor init --template=multiple" generates "error.rs", not "errors.rs" * feat: update dependencies * fix: typo link * fix: code indent --- .../connecting-to-offchain-data/oracles.md | 6 +++--- .../verifiable-randomness-functions.md | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/content/courses/connecting-to-offchain-data/oracles.md b/content/courses/connecting-to-offchain-data/oracles.md index 53cd16797..80d79798f 100644 --- a/content/courses/connecting-to-offchain-data/oracles.md +++ b/content/courses/connecting-to-offchain-data/oracles.md @@ -717,7 +717,7 @@ within the `programs/burry-escrow` directory: ├── Xargo.toml └── src ├── constants.rs - ├── errors.rs + ├── error.rs ├── instructions │ ├── deposit.rs │ ├── mod.rs @@ -798,9 +798,9 @@ pub const SOL_USDC_FEED: &str = "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"; ### 5. Errors Next, let's define the custom errors we'll use throughout the program. Inside -the `errors.rs` file, paste the following: +the `error.rs` file, paste the following: -```rust filename="errors.rs" +```rust filename="error.rs" use anchor_lang::prelude::*; #[error_code] diff --git a/content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md b/content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md index 7f9eb3af1..70fc691af 100644 --- a/content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md +++ b/content/courses/connecting-to-offchain-data/verifiable-randomness-functions.md @@ -485,8 +485,8 @@ in our `Cargo.toml` file. ```typescript [dependencies] -anchor-lang = "0.28.0" -anchor-spl = "0.28.0" +anchor-lang = "0.30.1" +anchor-spl = "0.30.1" switchboard-v2 = "0.4.0" ``` @@ -535,7 +535,7 @@ mod burry_escrow { init_vrf_client_handler(ctx) } - pub fn get_out_of_jail(ctx: Context, params: RequestRandomnessParams) -> Result<()>{ + pub fn get_out_of_jail(ctx: Context, params: RequestRandomnessParams) -> Result<()>{ get_out_of_jail_handler(ctx, params) } @@ -592,7 +592,7 @@ about `zero_copy`, take a look at our pub struct VrfClientState { pub bump: u8, pub result_buffer: [u8; 32], - pub dice_type: u8, // 6 sided + pub dice_type: u8, // 6 sided pub die_result_1: u8, pub die_result_2: u8, pub timestamp: i64, @@ -638,10 +638,10 @@ pub struct VrfClientState { } ``` -#### 5. Errors.rs +#### 5. Error.rs Next, let's take a quick pit stop and add one last error -`InvalidVrfAuthorityError` to `errors.rs`. We'll use this when the VRF authority +`InvalidVrfAuthorityError` to `error.rs`. We'll use this when the VRF authority is incorrect. ```rust @@ -758,7 +758,7 @@ pub struct InitVrfClient<'info> { #[account( init, seeds = [ - VRF_STATE_SEED, + VRF_STATE_SEED, user.key.as_ref(), escrow_account.key().as_ref(), vrf.key().as_ref(), @@ -971,7 +971,7 @@ pub fn get_out_of_jail_handler(ctx: Context, params: RequestR let escrow_key = ctx.accounts.escrow_account.key(); let user_key = ctx.accounts.user.key(); let state_seeds: &[&[&[u8]]] = &[&[ - &VRF_STATE_SEED, + &VRF_STATE_SEED, user_key.as_ref(), escrow_key.as_ref(), vrf_key.as_ref(), @@ -1048,7 +1048,7 @@ the randomness in the account. ```rust // inside consume_randomness.rs -pub fn consume_randomness_handler(ctx: Context) -> Result <()> { +pub fn consume_randomness_handler(ctx: Context) -> Result<()> { msg!("Consuming randomness..."); let vrf = ctx.accounts.vrf.load()?; @@ -1070,7 +1070,7 @@ randomness and dice rolls within it. We also want to check that the randomness is stale. ```rust -pub fn consume_randomness_handler(ctx: Context) -> Result <()> { +pub fn consume_randomness_handler(ctx: Context) -> Result<()> { msg!("Successfully consumed randomness."); let vrf = ctx.accounts.vrf.load()?;