zc cant be PDA

This commit is contained in:
spacemandev 2022-05-26 14:09:20 +02:00
parent 8e5c46c92d
commit 0fcadfa9f1
2 changed files with 11 additions and 4 deletions

View File

@ -28,7 +28,16 @@ pub struct CreateContributor<'info> {
pub struct InitializeSale<'info> { pub struct InitializeSale<'info> {
pub contributor: Account<'info, Contributor>, pub contributor: Account<'info, Contributor>,
#[account(zero)] #[account(
init,
seeds = [
SEED_PREFIX_SALE.as_bytes(),
&get_sale_id(&core_bridge_vaa)?,
],
payer = owner,
bump,
space = Sale::MAXIMUM_SIZE
)]
pub sale: AccountLoader<'info, Sale>, pub sale: AccountLoader<'info, Sale>,
#[account( #[account(

View File

@ -139,8 +139,6 @@ describe("anchor-contributor", () => {
program.programId program.programId
); );
const createSaleIx = await program.account.sale.createInstruction(sale_acc)
//Find the Core Bridge VAA address (uses hash of) //Find the Core Bridge VAA address (uses hash of)
//Create VAA Hash to use in core bridge key //Create VAA Hash to use in core bridge key
let buffer_array = []; let buffer_array = [];
@ -167,7 +165,7 @@ describe("anchor-contributor", () => {
owner: owner.publicKey, owner: owner.publicKey,
systemProgram: anchor.web3.SystemProgram.programId, systemProgram: anchor.web3.SystemProgram.programId,
}) })
.rpc(); .rpc({skipPreflight: false});
console.log(await program.account.sale.fetch(sale_acc)); console.log(await program.account.sale.fetch(sale_acc));
}); });