From 63614f29977371a3f5ebfef009074f70a67fae5d Mon Sep 17 00:00:00 2001 From: Jair Rosa Date: Thu, 31 Oct 2024 15:30:52 -0300 Subject: [PATCH] feat(CDF-3933): Fix fauced transaction wait --- .../discord_tutorial/package-lock.json | 20 +++++++++---------- .../discord_tutorial/package.json | 2 +- .../discord_tutorial/webhook-transfer.js | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/quickstart-template/discord_tutorial/package-lock.json b/quickstart-template/discord_tutorial/package-lock.json index 977b916f..0f667fdb 100644 --- a/quickstart-template/discord_tutorial/package-lock.json +++ b/quickstart-template/discord_tutorial/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@coinbase/coinbase-sdk": "^0.9.1", + "@coinbase/coinbase-sdk": "^0.10.0", "axios": "^1.7.7", "body-parser": "^1.20.3", "dotenv": "^16.4.5", @@ -23,9 +23,9 @@ "license": "MIT" }, "node_modules/@coinbase/coinbase-sdk": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@coinbase/coinbase-sdk/-/coinbase-sdk-0.9.1.tgz", - "integrity": "sha512-wz9GyIyfRnkV0GrFagKsE3621XSQYifCA7oN324QgofbqcemhbAVjQr1Pzd4aO25mBF88S2lHRKQwkUdH4GPuQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@coinbase/coinbase-sdk/-/coinbase-sdk-0.10.0.tgz", + "integrity": "sha512-sqLH7dE/0XSn5jHddjVrC1PR77sQUEytYcQAlH2d8STqRARcvddxVAByECUIL32MpbdJY7Wca3KfSa6qo811Mg==", "license": "ISC", "dependencies": { "@scure/bip32": "^1.4.0", @@ -523,9 +523,9 @@ "license": "MIT" }, "node_modules/elliptic": { - "version": "6.5.7", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", - "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.0.tgz", + "integrity": "sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==", "license": "MIT", "dependencies": { "bn.js": "^4.11.9", @@ -1537,9 +1537,9 @@ } }, "node_modules/viem": { - "version": "2.21.34", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.34.tgz", - "integrity": "sha512-IR8ucya4dkVJv1jzv/qBz1TxYbSoXZuJPuqQk1/AybU9VuGdMUayittYwr0Navs97XFNml6UWGVya07apoaBmQ==", + "version": "2.21.37", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.37.tgz", + "integrity": "sha512-JupwyttT4aJNnP9+kD7E8jorMS5VmgpC3hm3rl5zXsO8WNBTsP3JJqZUSg4AG6s2lTrmmpzS/qpmXMZu5gJw5Q==", "funding": [ { "type": "github", diff --git a/quickstart-template/discord_tutorial/package.json b/quickstart-template/discord_tutorial/package.json index 4b91c2e6..64e0e191 100644 --- a/quickstart-template/discord_tutorial/package.json +++ b/quickstart-template/discord_tutorial/package.json @@ -14,7 +14,7 @@ "description": "", "type": "module", "dependencies": { - "@coinbase/coinbase-sdk": "^0.9.1", + "@coinbase/coinbase-sdk": "^0.10.0", "axios": "^1.7.7", "body-parser": "^1.20.3", "dotenv": "^16.4.5", diff --git a/quickstart-template/discord_tutorial/webhook-transfer.js b/quickstart-template/discord_tutorial/webhook-transfer.js index 3002250b..d508d876 100644 --- a/quickstart-template/discord_tutorial/webhook-transfer.js +++ b/quickstart-template/discord_tutorial/webhook-transfer.js @@ -34,7 +34,11 @@ const webhookNotificationUri = process.env.WEBHOOK_NOTIFICATION_URL; console.log(`💰 Wallet USDC balance:`, balance); if (balance <= 0) { // If wallet doesn't have funds we need to add funds to it - await myWallet.faucet(Coinbase.assets.Usdc); + const faucetTx = await myWallet.faucet(Coinbase.assets.Usdc); + + // Wait for the faucet transaction to confirm. + await faucetTx.wait(); + console.log("✅ Funds added!"); // Sometimes funds take a few seconds to be available on the wallet, so lets wait 5 secs