testing: fix tests

This commit is contained in:
A5 Pickle 2022-12-13 20:42:06 +00:00 committed by kev1n-peters
parent b71181a404
commit 39f5877756
1 changed files with 13 additions and 10 deletions

View File

@ -29,6 +29,7 @@ import {
deriveCustodyKey,
deriveEndpointKey,
deriveMintAuthorityKey,
deriveRedeemerAccountKey,
deriveWrappedMintKey,
getAttestTokenAccounts,
getCompleteTransferNativeAccounts,
@ -714,7 +715,8 @@ describe("Token Bridge", () => {
it("getCompleteTransferNativeWithPayloadCpiAccounts", () => {
const mint = NATIVE_MINT;
const mintAta = getAssociatedTokenAddressSync(mint, cpiProgramId, true);
const redeemer = deriveRedeemerAccountKey(cpiProgramId);
const mintAta = getAssociatedTokenAddressSync(mint, redeemer, true);
const amountEncoded = 42069n;
@ -725,7 +727,7 @@ describe("Token Bridge", () => {
1,
amountEncoded,
1,
mintAta.toBuffer().toString("hex"),
cpiProgramId.toBuffer().toString("hex"),
Buffer.alloc(32, 0),
Buffer.from("All your base are belong to us"),
nonce,
@ -739,11 +741,11 @@ describe("Token Bridge", () => {
);
const accounts = getCompleteTransferNativeWithPayloadCpiAccounts(
cpiProgramId,
TOKEN_BRIDGE_ADDRESS,
CORE_BRIDGE_ADDRESS,
payer,
signedVaa
signedVaa,
mintAta
);
// verify accounts
@ -752,7 +754,7 @@ describe("Token Bridge", () => {
"GnQ6fGttTRnJpAJuy2XEg5TLgEMtbyU4HDJnBWmojsTv"
);
expect(accounts.vaa.toString()).to.equal(
"9jdun7HMoJp7KL1jRYF7MT9pjRLVM3RPDbDgf6qXNBR4"
"GtiCPc4mxBVsrPQVgYnuVUzhuvh24A54KaDZhcP4mhDa"
);
expect(accounts.tokenBridgeClaim.toString()).to.equal(
"HzjTihvhEx7BbKnB2KHATNBwGFCEm2nnMG6c4Pwx6pPE"
@ -787,7 +789,8 @@ describe("Token Bridge", () => {
tokenChain,
tokenAddress
);
const mintAta = getAssociatedTokenAddressSync(mint, cpiProgramId, true);
const redeemer = deriveRedeemerAccountKey(cpiProgramId);
const mintAta = getAssociatedTokenAddressSync(mint, redeemer, true);
const amount = 4206942069n;
const recipientChain = 1;
@ -798,7 +801,7 @@ describe("Token Bridge", () => {
tokenChain,
amount,
recipientChain,
mintAta.toBuffer().toString("hex"),
cpiProgramId.toBuffer().toString("hex"),
Buffer.alloc(32, 0),
Buffer.from("All your base are belong to us"),
nonce,
@ -812,11 +815,11 @@ describe("Token Bridge", () => {
);
const accounts = getCompleteTransferWrappedWithPayloadCpiAccounts(
cpiProgramId,
TOKEN_BRIDGE_ADDRESS,
CORE_BRIDGE_ADDRESS,
payer,
signedVaa
signedVaa,
mintAta
);
// verify accounts
@ -825,7 +828,7 @@ describe("Token Bridge", () => {
"GnQ6fGttTRnJpAJuy2XEg5TLgEMtbyU4HDJnBWmojsTv"
);
expect(accounts.vaa.toString()).to.equal(
"3czQYHVjwCNBAaQAAoMcmtLwXkF16UG1E1wU4RM9tje7"
"9nFMaAfuXmE4FdJe8koZ4ScvYcJ5znoJPDgT29aVZM1x"
);
expect(accounts.tokenBridgeClaim.toString()).to.equal(
"7Ae57QxvZMwCrknoDWpeaMTLbMP3LBeCJee6KaLEwxP6"