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