diff --git a/sdk/js/src/token_bridge/__tests__/algorand-integration.ts b/sdk/js/src/token_bridge/__tests__/algorand-integration.ts index 6ad99d8429..cb23a21b42 100644 --- a/sdk/js/src/token_bridge/__tests__/algorand-integration.ts +++ b/sdk/js/src/token_bridge/__tests__/algorand-integration.ts @@ -127,7 +127,11 @@ describe("Algorand tests", () => { vaaBytes ); } catch (e) { - success = false; + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + success = true; + } else { + success = false; + } } if (!success) { try { @@ -370,7 +374,12 @@ describe("Algorand tests", () => { vaaBytes ); } catch (e) { - success = false; + //@notice + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + success = true; + } else { + success = false; + } } if (!success) { try { diff --git a/sdk/js/src/token_bridge/__tests__/aptos-integration.ts b/sdk/js/src/token_bridge/__tests__/aptos-integration.ts index 182737ae57..8adeefb237 100644 --- a/sdk/js/src/token_bridge/__tests__/aptos-integration.ts +++ b/sdk/js/src/token_bridge/__tests__/aptos-integration.ts @@ -108,6 +108,11 @@ describe("Aptos SDK tests", () => { await createWrappedOnEth(ethTokenBridge, recipient, attestVAA); } catch (e) { // this could fail because the token is already attested (in an unclean env) + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + console.log("wrapped asset already exists"); + } else { + throw e; + } } // check attestation on ethereum @@ -420,6 +425,11 @@ describe("Aptos SDK tests", () => { await createWrappedOnEth(ethTokenBridge, recipient, attestVAA); } catch (e) { // this could fail because the token is already attested (in an unclean env) + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + console.log("wrapped asset already exists"); + } else { + throw e; + } } // check attestation on ethereum diff --git a/sdk/js/src/token_bridge/__tests__/solana-integration.ts b/sdk/js/src/token_bridge/__tests__/solana-integration.ts index 194c1576a2..e10e6ad1cf 100644 --- a/sdk/js/src/token_bridge/__tests__/solana-integration.ts +++ b/sdk/js/src/token_bridge/__tests__/solana-integration.ts @@ -99,6 +99,11 @@ describe("Solana to Ethereum", () => { ); } catch (e) { // this could fail because the token is already attested (in an unclean env) + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + console.log("wrapped asset already exists"); + } else { + console.log(e); + } } provider.destroy(); done(); @@ -328,6 +333,11 @@ describe("Solana to Ethereum", () => { ); } catch (e) { // this could fail because the token is already attested (in an unclean env) + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + console.log("wrapped asset already exists"); + } else { + console.log(e); + } } provider.destroy(); done(); diff --git a/sdk/js/src/token_bridge/__tests__/sui-integration.ts b/sdk/js/src/token_bridge/__tests__/sui-integration.ts index b4579c9306..a8bc24306b 100644 --- a/sdk/js/src/token_bridge/__tests__/sui-integration.ts +++ b/sdk/js/src/token_bridge/__tests__/sui-integration.ts @@ -667,7 +667,12 @@ describe("Sui SDK tests", () => { try { await createWrappedOnEth(ETH_TOKEN_BRIDGE_ADDRESS, ethSigner, attestVAA); } catch (e) { - // this could fail because the token is already attested (in an unclean env) + // this could fail because the token is already attested (in an unclean env) + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + console.log("wrapped asset already exists"); + } else { + console.error(e); + } } const { tokenAddress } = parseAttestMetaVaa(attestVAA); expect( diff --git a/sdk/js/src/token_bridge/__tests__/terra-integration.ts b/sdk/js/src/token_bridge/__tests__/terra-integration.ts index 56e5a93862..e8c63bb751 100644 --- a/sdk/js/src/token_bridge/__tests__/terra-integration.ts +++ b/sdk/js/src/token_bridge/__tests__/terra-integration.ts @@ -528,7 +528,11 @@ describe("Terra Classic Integration Tests", () => { signedVaa ); } catch (e) { - success = false; + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + success = true; + } else { + success = false; + } } if (!success) { const cr = await updateWrappedOnEth( @@ -902,7 +906,11 @@ describe("Terra Classic Integration Tests", () => { signedVaa ); } catch (e) { - success = false; + if(e instanceof Error && e.message.includes("wrapped asset already exists")){ + success = true; + } else { + success = false; + } } if (!success) { const cr = await updateWrappedOnEth(