From 27b1f355ab7c99938374a7e2fef19102c2686e92 Mon Sep 17 00:00:00 2001 From: Justin Kaseman Date: Tue, 11 Jun 2024 15:27:58 -0400 Subject: [PATCH 1/2] Update actions/checkout & actions/setup-node to v4 (#215) --- .github/workflows/main.yml | 8 ++++---- tasks/Functions-consumer/request.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4d4b4c3..93f44097 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,9 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: "18" cache: "npm" @@ -24,9 +24,9 @@ jobs: name: Unit Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: "18" cache: "npm" diff --git a/tasks/Functions-consumer/request.js b/tasks/Functions-consumer/request.js index af0d63b1..d44c822d 100644 --- a/tasks/Functions-consumer/request.js +++ b/tasks/Functions-consumer/request.js @@ -214,9 +214,11 @@ task("functions-request", "Initiates an on-demand request from a Functions consu ) try { + const NUM_CONFIRMATIONS = network.name === "localFunctionsTestnet" ? 1 : undefined // localFunctionsTestnet needs 0 or 1 confirmations to work correctly as it's local. + // Get response data const { requestId, totalCostInJuels, responseBytesHexstring, errorString, fulfillmentCode } = - await responseListener.listenForResponseFromTransaction(requestTx.hash) + await responseListener.listenForResponseFromTransaction(requestTx.hash, undefined, NUM_CONFIRMATIONS, undefined) switch (fulfillmentCode) { case FulfillmentCode.FULFILLED: From c268f13cfaa15572edce0b0b2917fff72a42f688 Mon Sep 17 00:00:00 2001 From: Zubin Pratap Date: Fri, 9 Aug 2024 12:40:03 +0200 Subject: [PATCH 2/2] improve comment --- tasks/Functions-consumer/request.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/Functions-consumer/request.js b/tasks/Functions-consumer/request.js index d44c822d..bdaed364 100644 --- a/tasks/Functions-consumer/request.js +++ b/tasks/Functions-consumer/request.js @@ -214,7 +214,9 @@ task("functions-request", "Initiates an on-demand request from a Functions consu ) try { - const NUM_CONFIRMATIONS = network.name === "localFunctionsTestnet" ? 1 : undefined // localFunctionsTestnet needs 0 or 1 confirmations to work correctly as it's local. + // localFunctionsTestnet needs 0 or 1 confirmations to work correctly as it's local. + // If on live testnet or mainnet, setting to undefined then uses the functions-toolkit default of 2 confirmations. + const NUM_CONFIRMATIONS = network.name === "localFunctionsTestnet" ? 1 : undefined // Get response data const { requestId, totalCostInJuels, responseBytesHexstring, errorString, fulfillmentCode } =