Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: separate PDA handling for multiple token programs in escrow tests #3269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions tests/escrow/tests/escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ describe("escrow", () => {
});

it("Initialize escrow", async () => {
const [escrowPda, _nonce] = await PublicKey.findProgramAddress(
[
Buffer.from(anchor.utils.bytes.utf8.encode("escrow")),
tokenProgramIdA.toBuffer(),
],
program.programId
);

pda = escrowPda;

await program.rpc.initializeEscrow(
new BN(initializerAmount),
new BN(takerAmount),
Expand All @@ -132,14 +142,6 @@ describe("escrow", () => {
}
);

// Get the PDA that is assigned authority to token account.
const [_pda, _nonce] = await PublicKey.findProgramAddress(
[Buffer.from(anchor.utils.bytes.utf8.encode("escrow"))],
program.programId
);

pda = _pda;

let _initializerTokenAccountA = await mintA.getAccountInfo(
initializerTokenAccountA
);
Expand Down Expand Up @@ -230,6 +232,16 @@ describe("escrow", () => {
initializerAmount
);

const [escrowPda, _nonce] = await PublicKey.findProgramAddress(
[
Buffer.from(anchor.utils.bytes.utf8.encode("escrow")),
tokenProgramIdA.toBuffer(),
],
program.programId
);

pda = escrowPda;

await program.rpc.initializeEscrow(
new BN(initializerAmount),
new BN(takerAmount),
Expand Down