cosmwasm: test update foreign asset

This commit is contained in:
Evan Gray 2022-06-22 16:52:20 +00:00 committed by Evan Gray
parent c7a9d5ca8b
commit 3d373669e5
1 changed files with 53 additions and 51 deletions

View File

@ -28,11 +28,9 @@ jest.setTimeout(60000);
const GOVERNANCE_CHAIN = 1; const GOVERNANCE_CHAIN = 1;
const GOVERNANCE_ADDRESS = const GOVERNANCE_ADDRESS =
"0000000000000000000000000000000000000000000000000000000000000004"; "0000000000000000000000000000000000000000000000000000000000000004";
const FOREIGN_CHAIN = 1; const FOREIGN_CHAIN = 2;
const FOREIGN_TOKEN_BRIDGE = const FOREIGN_TOKEN_BRIDGE =
"000000000000000000000000000000000000000000000000000000000000ffff"; "0000000000000000000000000290FB167208Af455bB137780163b7B7a9a10C16";
const FOREIGN_TOKEN =
"000000000000000000000000000000000000000000000000000000000000eeee";
const GUARDIAN_SET_INDEX = 0; const GUARDIAN_SET_INDEX = 0;
const GUARDIAN_ADDRESS = Buffer.from( const GUARDIAN_ADDRESS = Buffer.from(
"beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe", "beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe",
@ -893,58 +891,62 @@ describe("Bridge Tests", () => {
} }
})(); })();
}); });
// test("Register a Foreign Asset", (done) => { test("Register a Foreign Asset", (done) => {
// (async () => { (async () => {
// try { try {
// const [client, wallet] = await makeProviderAndWallet(); const [client, wallet] = await makeProviderAndWallet();
// const vaaPayload = makeAttestationVaaPayload( const signedVaa =
// FOREIGN_CHAIN, "01000000000100efccb8a5d54162691095c88369b873d93ed4ba9365ed0f94adcf39743bb034be56ce0a94d9b163cb0c63be24b94e31b75e1a5889e3de03db147278d9d3eb7d260100000992abb6000000020000000000000000000000000290fb167208af455bb137780163b7b7a9a10c16000000000000000d0f020000000000000000000000002d8be6bf0baa74e0a907016679cae9190e80dd0a000212544b4e0000000000000000000000000000000000000000000000000000000000457468657265756d205465737420546f6b656e00000000000000000000000000";
// FOREIGN_TOKEN,
// 18,
// hexZeroPad("0x" + Buffer.from("TEST", "utf-8").toString("hex"), 32),
// hexZeroPad(
// "0x" + Buffer.from("Testy Token", "utf-8").toString("hex"),
// 32
// )
// );
// const timestamp = 1; const tokenBridge = contracts.get("tokenBridge")!;
// const nonce = 1; const submitVaa = new MsgExecuteContract(
// const sequence = 0; wallet.key.accAddress,
tokenBridge,
{
submit_vaa: {
data: Buffer.from(signedVaa, "hex").toString("base64"),
},
}
);
// const signedVaa = signAndEncodeVaa( const receipt = await transactWithoutMemo(client, wallet, [submitVaa]);
// timestamp, console.log(receipt);
// nonce, done();
// GOVERNANCE_CHAIN, } catch (e) {
// GOVERNANCE_ADDRESS, console.error(e);
// sequence, done("Failed to Register a Foreign Asset");
// vaaPayload, }
// TEST_SIGNER_PKS, })();
// GUARDIAN_SET_INDEX, });
// CONSISTENCY_LEVEL test("Update a Foreign Asset", (done) => {
// ); (async () => {
try {
const [client, wallet] = await makeProviderAndWallet();
// const tokenBridge = contracts.get("tokenBridge")!; const signedVaa =
// const submitVaa = new MsgExecuteContract( "01000000000100d1389731568d9816267accba90abb9db37dcd09738750fae421067f2f7f33f014c2d862e288e9a3149e2d8bcd2e53ffe2ed72dfc5e8eb50c740a0df34c60103f01000011ac2076010000020000000000000000000000000290fb167208af455bb137780163b7b7a9a10c16000000000000000e0f020000000000000000000000002d8be6bf0baa74e0a907016679cae9190e80dd0a000212544b4e0000000000000000000000000000000000000000000000000000000000457468657265756d205465737420546f6b656e00000000000000000000000000";
// wallet.key.accAddress,
// tokenBridge,
// {
// submit_vaa: {
// data: Buffer.from(signedVaa, "hex").toString("base64"),
// },
// }
// );
// const receipt = await transactWithoutMemo(client, wallet, [submitVaa]); const tokenBridge = contracts.get("tokenBridge")!;
// console.log(receipt); const submitVaa = new MsgExecuteContract(
// done(); wallet.key.accAddress,
// } catch (e) { tokenBridge,
// console.error(e); {
// done("Failed to Register a Foreign Asset"); submit_vaa: {
// } data: Buffer.from(signedVaa, "hex").toString("base64"),
// })(); },
// }); }
);
const receipt = await transactWithoutMemo(client, wallet, [submitVaa]);
console.log(receipt);
done();
} catch (e) {
console.error(e);
done("Failed to Update a Foreign Asset");
}
})();
});
}); });
function nativeToHex(address: string) { function nativeToHex(address: string) {