diff --git a/.github/workflows/build-examples.yml b/.github/workflows/build-examples.yml index 6d3f1289d..0eb51b763 100644 --- a/.github/workflows/build-examples.yml +++ b/.github/workflows/build-examples.yml @@ -2,8 +2,13 @@ name: Build examples #description: Build all examples on: + push: + branches: + - main + - staging pull_request: - branches: [ main, staging ] + branches: + - "*" workflow_dispatch: inputs: negotiatorBranch: @@ -23,41 +28,56 @@ jobs: strategy: matrix: node-version: [16.x] - + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + cache-dependency-path: "**/package-lock.json" + registry-url: "https://npm.pkg.github.com" + + - name: Build + run: | + echo "Github base ref: $GITHUB_BASE_REF" + echo "Requested branch: $NEGOTIATOR_BRANCH" + + npm install + + if [[ $GITHUB_BASE_REF == "staging" ]]; then + echo "This is a staging branch PR, updating package.json files to use negotiator staging branch" + scripts/use_negotiator_branch.js staging + fi + if [[ ! -z $NEGOTIATOR_BRANCH && $NEGOTIATOR_BRANCH != "none" ]]; then + echo "Negotiator branch $NEGOTIATOR_BRANCH requested, updating package.json files" + scripts/use_negotiator_branch.js $NEGOTIATOR_BRANCH + fi + + export BASE_PATH=/token-negotiator-examples/ecommerce-store-website + export MAX_PROCESSES=5 + + npm run install-examples + npm run clean + npm run build + npm run copy-artifacts + env: + NEGOTIATOR_BRANCH: ${{ inputs.negotiatorBranch }} + NODE_AUTH_TOKEN: ${{ github.token }} + + sonarcloud: + needs: + - build + name: SonarCloud + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - registry-url: 'https://npm.pkg.github.com' - - - name: Build - run: | - echo "Github base ref: $GITHUB_BASE_REF" - echo "Requested branch: $NEGOTIATOR_BRANCH" - - npm install - - if [[ $GITHUB_BASE_REF == "staging" ]]; then - echo "This is a staging branch PR, updating package.json files to use negotiator staging branch" - scripts/use_negotiator_branch.js staging - fi - if [[ ! -z $NEGOTIATOR_BRANCH && $NEGOTIATOR_BRANCH != "none" ]]; then - echo "Negotiator branch $NEGOTIATOR_BRANCH requested, updating package.json files" - scripts/use_negotiator_branch.js $NEGOTIATOR_BRANCH - fi - - export BASE_PATH=/token-negotiator-examples/ecommerce-store-website - export MAX_PROCESSES=5 - - npm run install-examples - npm run clean - npm run build - npm run copy-artifacts - env: - NEGOTIATOR_BRANCH: ${{ inputs.negotiatorBranch }} - NODE_AUTH_TOKEN: ${{ github.token }} + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/angular-bare-bones-demo/package-lock.json b/angular-bare-bones-demo/package-lock.json index 12314b5ef..25caf4225 100644 --- a/angular-bare-bones-demo/package-lock.json +++ b/angular-bare-bones-demo/package-lock.json @@ -16,7 +16,7 @@ "@angular/platform-browser": "~13.3.0", "@angular/platform-browser-dynamic": "~13.3.0", "@angular/router": "~13.3.0", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "assert": "^2.0.0", "crypto-browserify": "^3.12.0", "https-browserify": "^1.0.0", @@ -4018,16 +4018,16 @@ } }, "node_modules/@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "dependencies": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", @@ -21438,16 +21438,16 @@ } }, "@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "requires": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", diff --git a/angular-bare-bones-demo/package.json b/angular-bare-bones-demo/package.json index ea4124e4e..17c8b1f6f 100644 --- a/angular-bare-bones-demo/package.json +++ b/angular-bare-bones-demo/package.json @@ -18,7 +18,7 @@ "@angular/platform-browser": "~13.3.0", "@angular/platform-browser-dynamic": "~13.3.0", "@angular/router": "~13.3.0", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "assert": "^2.0.0", "crypto-browserify": "^3.12.0", "https-browserify": "^1.0.0", diff --git a/angular-bare-bones-demo/src/test.ts b/angular-bare-bones-demo/src/test.ts index 00025daf1..c04c87607 100644 --- a/angular-bare-bones-demo/src/test.ts +++ b/angular-bare-bones-demo/src/test.ts @@ -23,4 +23,4 @@ getTestBed().initTestEnvironment( // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. -context.keys().map(context); +context.keys().forEach(context); diff --git a/art-gallery-medium-article-website/config-overrides.js b/art-gallery-medium-article-website/config-overrides.js index 253164f0c..59d84ee44 100644 --- a/art-gallery-medium-article-website/config-overrides.js +++ b/art-gallery-medium-article-website/config-overrides.js @@ -13,7 +13,7 @@ module.exports = function override(config) { config.resolve.fallback = fallback; config.plugins = (config.plugins || []).concat([ new webpack.ProvidePlugin({ - process: "process/browser", + process: "process/browser.js", Buffer: ["buffer", "Buffer"], }), ]); diff --git a/art-gallery-medium-article-website/package-lock.json b/art-gallery-medium-article-website/package-lock.json index 75464b7e9..925552c81 100644 --- a/art-gallery-medium-article-website/package-lock.json +++ b/art-gallery-medium-article-website/package-lock.json @@ -8,7 +8,7 @@ "name": "my-app", "version": "0.1.0", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "react": "^18.1.0", "react-dom": "^18.1.0", "react-scripts": "5.0.1", @@ -4770,16 +4770,16 @@ } }, "node_modules/@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "dependencies": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", @@ -26415,16 +26415,16 @@ } }, "@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "requires": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", diff --git a/art-gallery-medium-article-website/package.json b/art-gallery-medium-article-website/package.json index 9649319cd..e8b3db072 100644 --- a/art-gallery-medium-article-website/package.json +++ b/art-gallery-medium-article-website/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "react": "^18.1.0", "react-dom": "^18.1.0", "react-scripts": "5.0.1", diff --git a/ecommerce-store-website/package-lock.json b/ecommerce-store-website/package-lock.json index 19113c5e6..a280661be 100644 --- a/ecommerce-store-website/package-lock.json +++ b/ecommerce-store-website/package-lock.json @@ -7,7 +7,7 @@ "name": "stl-token-negotiator-web", "dependencies": { "@react-spring/web": "^9.3.1", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "@use-gesture/react": "^10.1.6", "body-scroll-lock": "^4.0.0-beta.0", "clsx": "^1.1.1", @@ -2118,16 +2118,16 @@ } }, "node_modules/@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "dependencies": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", @@ -13241,16 +13241,16 @@ } }, "@tokenscript/token-negotiator": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.3.0.tgz", - "integrity": "sha512-wBpBQ1EOpPE4ZQYUW2nmr8mpihGvasfTUXKfpKCyaGJbhxsc8k/xhqm135RNneKo5U9gnmkm+70FKCSkoMUWUA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator/-/token-negotiator-2.4.0.tgz", + "integrity": "sha512-/Z+g3lIN9n2QoMFvmqio8NIYxH9qGo7kBZnf5e+MYbam/1ub8n7j1StycnynHBS7SPIDD8KwK/y2Sx1fUHdY0g==", "requires": { "@onflow/fcl": "^1.3.2", "@peculiar/asn1-schema": "^2.2.0", "@tokenscript/attestation": "0.4.1-mw", "@toruslabs/torus-embed": "^1.25.0", "@walletconnect/types": "^2.1.5", - "@walletconnect/universal-provider": "^2.1.5", + "@walletconnect/universal-provider": "^2.4.5", "@walletconnect/web3-provider": "^1.7.1", "ethers": "^5.4.0", "pvutils": "^1.0.17", diff --git a/ecommerce-store-website/package.json b/ecommerce-store-website/package.json index e23505945..cede95d54 100644 --- a/ecommerce-store-website/package.json +++ b/ecommerce-store-website/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@react-spring/web": "^9.3.1", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "@use-gesture/react": "^10.1.6", "body-scroll-lock": "^4.0.0-beta.0", "clsx": "^1.1.1", diff --git a/ecommerce-store-website/src/base/utils/interact.js b/ecommerce-store-website/src/base/utils/interact.js index 88316cbcf..a7c0b1c3d 100644 --- a/ecommerce-store-website/src/base/utils/interact.js +++ b/ecommerce-store-website/src/base/utils/interact.js @@ -20,18 +20,27 @@ export const safeMint = async ({ try { window.contract = new _ethers.Contract(contract, abi, connectedWallet.provider.getSigner()); - const txHash = await window.contract.safeMint(sendTo, tokenUri); - + const tx = await window.contract.safeMint(sendTo, tokenUri); + window.negotiator.ui.showLoaderDelayed([ "
{ description }