Skip to content

Commit

Permalink
Fixed test cases and updated poseidon
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCipherCoder committed Nov 25, 2024
1 parent 79979cd commit 6bdf7f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions basics/account-data/poseidon/programs/account_data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ pub mod address_info_program {
}
#[derive(Accounts)]
pub struct InitializeContext<'info> {
#[account(mut)]
pub owner: Signer<'info>,
#[account(
init,
payer = owner,
Expand All @@ -45,6 +43,8 @@ pub struct InitializeContext<'info> {
bump,
)]
pub state: Account<'info, AddressInfoState>,
#[account(mut)]
pub owner: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
Expand Down
9 changes: 4 additions & 5 deletions basics/account-data/poseidon/tests/account_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { startAnchor } from 'solana-bankrun';
import { AddressInfoProgram } from '../target/types/address_info_program';

describe('Address Info Program', () => {

const IDL = require('../target/idl/address_info_program.json');

const PROGRAM_ID = new PublicKey(IDL.address);

// Test setup
Expand All @@ -23,15 +22,15 @@ describe('Address Info Program', () => {
// Initialize program test environment
const context = await startAnchor(
'.', // Path to Anchor.toml
[], // No extra programs needed
[], // No
[],
[],
);

// Set up provider and program
provider = new BankrunProvider(context);

// Get program from workspace
program = new Program(IDL, provider);
program = new Program<AddressInfoProgram>(IDL, provider);

owner = provider.wallet as Wallet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface AddressInfoState extends Account {
*/
export default class AddressInfoProgram {
// Following Poseidon example pattern of static PROGRAM_ID
static PROGRAM_ID = new Pubkey("ChA1o71vBEwkYNs6FnkmG4cxyZWtWkbXSEJ6xP2zaJAq");
static PROGRAM_ID = new Pubkey('ChA1o71vBEwkYNs6FnkmG4cxyZWtWkbXSEJ6xP2zaJAq');

initialize(owner: Signer, state: AddressInfoState, houseNumber: u8, streetNumber: u16, zipCode: u32, countryCode: u16): Result {
// Use derive() for PDA creation and init() for initialization
Expand Down

0 comments on commit 6bdf7f3

Please sign in to comment.