Skip to content

Commit

Permalink
refactor: updated the code according to newly poseidon package
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikbhatt20 committed Oct 30, 2024
1 parent 993a2f9 commit 26911fb
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolution = true
skip-lint = false

[programs.localnet]
create_account_program = "Da8ZQ19giGFQgPmxS2vAKkNM5oxsypxWSRN61FeXWAxi"
create_account_program = "2QW7eymLrxC1TJmjTqtfnwvD8ND4dmVuHziX5p6sWzjj"

[registry]
url = "https://api.apr.dev"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1",
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "^1.95.4",
"anchor-bankrun": "^0.5.0",
"solana-bankrun": "^0.4.0"
Expand Down
194 changes: 187 additions & 7 deletions basics/create-account/poseidon/create-account-program/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anchor_lang::prelude::*;
declare_id!("Da8ZQ19giGFQgPmxS2vAKkNM5oxsypxWSRN61FeXWAxi");
declare_id!("2QW7eymLrxC1TJmjTqtfnwvD8ND4dmVuHziX5p6sWzjj");
#[program]
pub mod create_account_program {
use super::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"license": "ISC",
"description": "",
"dependencies": {
"@solanaturbine/poseidon": "^0.0.5"
"@solanaturbine/poseidon": "^0.0.10"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Account, Pubkey, Result, Signer, u8 } from '@solanaturbine/poseidon';

export default class CreateAccountProgram {
static PROGRAM_ID = new Pubkey('Da8ZQ19giGFQgPmxS2vAKkNM5oxsypxWSRN61FeXWAxi');
static PROGRAM_ID = new Pubkey('2QW7eymLrxC1TJmjTqtfnwvD8ND4dmVuHziX5p6sWzjj');

//Create a new system account
createSystemAccount(account: AccountState, owner: Signer): Result {
//We use derive to define the account and chain the `.init()` at the end for creating the account
account.derive(['account']).init();
account.derive(['account']).init(owner);
//Set owner of the account
account.owner = owner.key;

Expand Down

0 comments on commit 26911fb

Please sign in to comment.