diff --git a/.github/workflows/deploy-prod-subgraph.yaml b/.github/workflows/deploy-prod-subgraph.yaml index 0ff14cca6..2c74ebb70 100644 --- a/.github/workflows/deploy-prod-subgraph.yaml +++ b/.github/workflows/deploy-prod-subgraph.yaml @@ -22,7 +22,17 @@ jobs: with: node-version: "16" cache: "npm" + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v3 + with: + path: .turbo + key: turbo-${{ runner.os }}-${{ github.sha }} + restore-keys: | + turbo-${{ runner.os }} - run: npm ci + - id: build + run: npm run build -- --cache-dir=".turbo" - name: Authenticate The Graph CLI run: npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN_PRODUCTION }} - name: Deploy subgraph diff --git a/.github/workflows/deploy-staging-subgraph.yaml b/.github/workflows/deploy-staging-subgraph.yaml index e8db08daf..b7c1f0f01 100644 --- a/.github/workflows/deploy-staging-subgraph.yaml +++ b/.github/workflows/deploy-staging-subgraph.yaml @@ -15,7 +15,17 @@ jobs: with: node-version: "16" cache: "npm" + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v3 + with: + path: .turbo + key: turbo-${{ runner.os }}-${{ github.sha }} + restore-keys: | + turbo-${{ runner.os }} - run: npm ci + - id: build + run: npm run build -- --cache-dir=".turbo" - name: Authenticate The Graph CLI run: npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN_STAGING }} - name: Deploy subgraph diff --git a/.github/workflows/pin-to-pinata.yaml b/.github/workflows/pin-to-pinata.yaml index f40a841d2..adec3df99 100644 --- a/.github/workflows/pin-to-pinata.yaml +++ b/.github/workflows/pin-to-pinata.yaml @@ -3,6 +3,7 @@ name: CI on: schedule: - cron: "0 * * * *" # run every hour + workflow_dispatch: jobs: pin-to-pinata: @@ -35,13 +36,6 @@ jobs: INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} INFURA_PROJECT_SECRET: ${{ secrets.INFURA_PROJECT_SECRET }} run: | - echo "Pin for testing env..." - npm run pin-to-pinata -- \ - -e testing \ - -fd ${{ env.FROM_DATE }} \ - -p ${{ env.PINATA_JWT }} \ - -i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }} - echo "Pin for staging env..." npm run pin-to-pinata -- \ -e staging \ diff --git a/package.json b/package.json index f5d1ff596..4395a5ed5 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "ipfs-upload": "ts-node -P tsconfig.base.json ./scripts/upload-to-ipfs.ts", "explore-offer": "ts-node -P tsconfig.base.json ./scripts/explore-offer.ts", "create-offer": "ts-node -P tsconfig.base.json ./scripts/create-offer.ts", + "create-offer-batch": "ts-node -P tsconfig.base.json ./scripts/create-offer-batch.ts", "create-seller": "ts-node -P tsconfig.base.json ./scripts/create-seller.ts", "update-seller": "ts-node -P tsconfig.base.json ./scripts/update-seller.ts", "abi-signatures": "ts-node -P tsconfig.base.json ./scripts/abi-signatures.ts", diff --git a/packages/core-sdk/package.json b/packages/core-sdk/package.json index 85e7873d9..214df4025 100644 --- a/packages/core-sdk/package.json +++ b/packages/core-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@bosonprotocol/core-sdk", - "version": "1.25.0-alpha.10", + "version": "1.25.0-mvfw23.1", "description": "Facilitates interaction with the contracts and subgraphs of the Boson Protocol", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", diff --git a/packages/core-sdk/src/native-meta-tx/handler.ts b/packages/core-sdk/src/native-meta-tx/handler.ts index e3e55acc6..960d402dc 100644 --- a/packages/core-sdk/src/native-meta-tx/handler.ts +++ b/packages/core-sdk/src/native-meta-tx/handler.ts @@ -36,24 +36,19 @@ export async function getNonce(args: { ); return String(nonce); } catch (e) { - // Check if the error means the 'getNonce()' function does not exists in the contract - if ( - (e.message as string)?.match( - /Transaction reverted without a reason string/ - ) - ) { - // If so, call 'nonces()' instead (USDC case, for instance) - const result = await args.web3Lib.call({ - to: args.contractAddress, - data: alternativeNonceIface.encodeFunctionData("nonces", [args.user]) - }); - const [nonce] = alternativeNonceIface.decodeFunctionResult( - "nonces", - result - ); - return String(nonce); - } - throw e; + console.warn( + `Calling getNonce() for contract ${args.contractAddress} has failed. Try with 'nonces' instead` + ); + // If so, call 'nonces()' instead (USDC case, for instance) + const result = await args.web3Lib.call({ + to: args.contractAddress, + data: alternativeNonceIface.encodeFunctionData("nonces", [args.user]) + }); + const [nonce] = alternativeNonceIface.decodeFunctionResult( + "nonces", + result + ); + return String(nonce); } } diff --git a/scripts/create-offer-batch.ts b/scripts/create-offer-batch.ts new file mode 100644 index 000000000..d411a3f76 --- /dev/null +++ b/scripts/create-offer-batch.ts @@ -0,0 +1,82 @@ +import fs from "fs"; +import { EnvironmentType } from "@bosonprotocol/common/src/types/configs"; +import { providers, Wallet } from "ethers"; +import { program } from "commander"; +import { getDefaultConfig } from "@bosonprotocol/common/src"; +import { CoreSDK } from "../packages/core-sdk/src"; +import { EthersAdapter } from "../packages/ethers-sdk/src"; + +program + .description("Create Offers (batch).") + .argument( + "", + "Private key of the Seller account (assistant role)." + ) + .argument("", "JSON file with the Offers specific parameters") + .option("-e, --env ", "Target environment", "testing") + .option( + "--template