From d1b39a677b54d8a2b4f13360533de7d3eb7125a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Riquelme=20Guzm=C3=A1n?=
 <nrriquelme@gmail.com>
Date: Wed, 8 Nov 2023 14:12:14 -0300
Subject: [PATCH] chore: positioning end of the script inside the interval

---
 .../evm-to-evm-fungible-transfer/src/transfer.ts   | 14 +++++++-------
 .../src/transfer.ts                                | 12 ++++++------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/examples/evm-to-evm-fungible-transfer/src/transfer.ts b/examples/evm-to-evm-fungible-transfer/src/transfer.ts
index 8feef8a0b..487ee3636 100644
--- a/examples/evm-to-evm-fungible-transfer/src/transfer.ts
+++ b/examples/evm-to-evm-fungible-transfer/src/transfer.ts
@@ -72,20 +72,20 @@ export async function erc20Transfer(): Promise<void> {
       .then((data) => {
         if (data) {
           dataResponse = data;
-          console.log(data);
+          console.log("Status of the transfer", data.status);
         }
       })
       .catch((e) => {
         console.log(e);
         console.log("Transfer still not indexed, retrying...");
       });
-  }, 5000);
 
-  if (dataResponse && dataResponse.status === "executed") {
-    console.log("Transfer executed successfully");
-    clearInterval(id);
-    process.exit(0);
-  }
+    if (dataResponse && dataResponse.status === "executed") {
+      console.log("Transfer executed successfully");
+      clearInterval(id);
+      process.exit(0);
+    }
+  }, 5000);
 }
 
 erc20Transfer().finally(() => {});
diff --git a/examples/evm-to-substrate-fungible-transfer/src/transfer.ts b/examples/evm-to-substrate-fungible-transfer/src/transfer.ts
index fa23787a6..5c33c84fc 100644
--- a/examples/evm-to-substrate-fungible-transfer/src/transfer.ts
+++ b/examples/evm-to-substrate-fungible-transfer/src/transfer.ts
@@ -78,13 +78,13 @@ export async function erc20Transfer(): Promise<void> {
       .catch(() => {
         console.log("Transfer still not indexed, retrying...");
       });
-  }, 5000);
 
-  if (dataResponse && dataResponse.status === "executed") {
-    console.log("Transfer executed successfully");
-    clearInterval(id);
-    process.exit(0);
-  }
+    if (dataResponse && dataResponse.status === "executed") {
+      console.log("Transfer executed successfully");
+      clearInterval(id);
+      process.exit(0);
+    }
+  }, 5000);
 }
 
 erc20Transfer().finally(() => {});