#solana pda data account

1 messages · Page 1 of 1 (latest)

eager salmon
#

when i intilize a data account using general keypair
i can initilize data account again and again when i run test(no issues)

it("Is initialized!", async () => {
// Add your test here.
const tx = await program.methods
.new()
.accounts({ dataAccount: dataAccount.publicKey })
.signers([dataAccount])
.rpc();
console.log("Your transaction signature", tx);
});

But when data account is pda i am not able initilize data account again and again when i run test

here this gives me error
when i run anchor test second time
it("Is initialized!", async () => {
// Add your test here.
const tx = await program.methods
.new([bump], new anchor.BN(fundLamports))
.accounts({ dataAccount: dataAccountPDA })
.rpc();
console.log("Your transaction signature", tx);
});

#

@tepid falcon @frosty light

frosty light
#

It is very difficult to come up with an explanation without seeing your entire Typescript code.