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([ "

Minting...

", "Transaction in progress" ], 0, true); - setTimeout(() => { window.negotiator.ui.dismissLoader() }, 5000); - + await tx.wait(); + // ... now TX is succesfully minted + + window.negotiator.ui.dismissLoader() + + // Automatically refresh tokens after 20 seconds + window.negotiator.getTokenStore().clearCachedTokens(); + setTimeout(() => { + window.negotiator.negotiate(); + }, 20000); + return { success: true, - status: "✅ Check out your transaction: " + chain + " " + txHash?.hash + status: "✅ Check out your transaction: " + chain + " " + tx?.hash } } catch (error) { diff --git a/ecommerce-store-website/src/providers/TokenContextProvider.js b/ecommerce-store-website/src/providers/TokenContextProvider.js index 67766a44b..30a33a68a 100644 --- a/ecommerce-store-website/src/providers/TokenContextProvider.js +++ b/ecommerce-store-website/src/providers/TokenContextProvider.js @@ -1,4 +1,4 @@ -import React, { createContext, useState, useEffect } from "react"; +import React, {createContext, useState, useEffect, useMemo} from "react"; import { chainMap } from "src/base/utils/network"; const TokenContext = createContext({ @@ -7,7 +7,8 @@ const TokenContext = createContext({ proof: {}, negotiator: {}, walletStatus: '', - chainId: '' + chainId: '', + switchChain: undefined }); const mumbaiIssuers = [ @@ -81,7 +82,12 @@ const TokenContextProvider = (props) => { position: "bottom-right", }, ipfsBaseUrl: - "https://smart-token-labs-demo-server.mypinata.cloud/ipfs/" + "https://smart-token-labs-demo-server.mypinata.cloud/ipfs/", + walletOptions: { + walletConnectV2: { + chains: ["eip155:5", "eip155:80001"] + } + } }); setNegotiator(newNegotiator); @@ -114,36 +120,51 @@ const TokenContextProvider = (props) => { setWallet(walletConnection[0]); } }); - - const resetIssuers = (networkId) => { - if (!networkId) return; - - setChainId(networkId); - - const normalisedNetworkId = chainMap[networkId] - ? chainMap[networkId] - : ""; - - switch (normalisedNetworkId) { - case "Goerli": - newNegotiator.negotiate(goerliIssuers); - break; - case "Mumbai": - newNegotiator.negotiate(mumbaiIssuers); - break; - default: - break; - } - }; newNegotiator.negotiate(); }); }, []); + const resetIssuers = (networkId) => { + if (!networkId) return; + + if (typeof networkId === "string") + networkId = parseInt(networkId, 16); + + console.log("New chain ID: ", networkId); + + setChainId(networkId); + + const normalisedNetworkId = chainMap[networkId] + ? chainMap[networkId] + : ""; + + switch (normalisedNetworkId) { + case "Goerli": + window.negotiator.negotiate(goerliIssuers); + break; + case "Mumbai": + window.negotiator.negotiate(mumbaiIssuers); + break; + default: + break; + } + }; + + async function switchChain(nChainId){ + // Try automatically switching to Goerli + await wallet.provider.send("wallet_switchEthereumChain", [{chainId: "0x" + Number(nChainId).toString(16)}]); + resetIssuers(nChainId); + } + + const tokenContextProviderValue = useMemo( + () => ({ tokens, negotiator, wallet, proof, walletStatus, chainId, switchChain }), + [tokens, negotiator, wallet, proof, walletStatus, chainId, switchChain] + ); return ( - + {props.children} ); diff --git a/ecommerce-store-website/src/ui/app/context/context.js b/ecommerce-store-website/src/ui/app/context/context.js index ca3ccdc79..cbc32cb56 100644 --- a/ecommerce-store-website/src/ui/app/context/context.js +++ b/ecommerce-store-website/src/ui/app/context/context.js @@ -47,7 +47,7 @@ const Context = React.forwardRef( ( props, ref ) => { - { children && children } + { children } ); }); diff --git a/ecommerce-store-website/src/ui/app/footer/footer.module.scss b/ecommerce-store-website/src/ui/app/footer/footer.module.scss index 741033fa5..2de9b0243 100644 --- a/ecommerce-store-website/src/ui/app/footer/footer.module.scss +++ b/ecommerce-store-website/src/ui/app/footer/footer.module.scss @@ -47,7 +47,6 @@ grid-column: 2 / 4; width: 100%; padding: 0; - margin: 0; flex-direction: row; justify-content: flex-start; grid-column-gap: var(--grid-gutter-width); diff --git a/ecommerce-store-website/src/ui/app/layout/layout.js b/ecommerce-store-website/src/ui/app/layout/layout.js index 247105cc0..10494d33a 100644 --- a/ecommerce-store-website/src/ui/app/layout/layout.js +++ b/ecommerce-store-website/src/ui/app/layout/layout.js @@ -18,7 +18,7 @@ export default function Layout({ className, children }) {
- { children && children } + { children }
diff --git a/ecommerce-store-website/src/ui/components/button/button.js b/ecommerce-store-website/src/ui/components/button/button.js index 81d850a0b..4f410fdb1 100644 --- a/ecommerce-store-website/src/ui/components/button/button.js +++ b/ecommerce-store-website/src/ui/components/button/button.js @@ -46,7 +46,7 @@ export default function Button( props ) { function ButtonGroup({ children, className }) { return (
- { children && children } + { children }
); } diff --git a/ecommerce-store-website/src/ui/components/card/card.js b/ecommerce-store-website/src/ui/components/card/card.js index c486367fd..5f9ac4444 100644 --- a/ecommerce-store-website/src/ui/components/card/card.js +++ b/ecommerce-store-website/src/ui/components/card/card.js @@ -46,7 +46,7 @@ const Card = React.memo( function Card( props ) {
)}
- { children && children } + { children }
); diff --git a/ecommerce-store-website/src/ui/components/card/card.module.scss b/ecommerce-store-website/src/ui/components/card/card.module.scss index 4279fb964..9b072e314 100644 --- a/ecommerce-store-website/src/ui/components/card/card.module.scss +++ b/ecommerce-store-website/src/ui/components/card/card.module.scss @@ -34,7 +34,6 @@ $box-shadow-high: 2px 12px 24px -2px rgba( 0, 0, 0, 0.15 ); &_image { position: relative; - background-repeat: no-repeat; border-top-right-radius: grid-baseline(0.5); border-top-left-radius: grid-baseline(0.5); background-color: color-get( --text, 0.3 ); diff --git a/ecommerce-store-website/src/ui/components/form/field-input/field-input.js b/ecommerce-store-website/src/ui/components/form/field-input/field-input.js index adf39aaa3..a474bbdfe 100644 --- a/ecommerce-store-website/src/ui/components/form/field-input/field-input.js +++ b/ecommerce-store-website/src/ui/components/form/field-input/field-input.js @@ -32,7 +32,7 @@ export default function FieldInput( props ) { } else { fieldProps = { value, - ...props?.onChange && { onChange: props.onChange }, + ...props.onChange && { onChange: props.onChange }, }; fieldMeta = { error, diff --git a/ecommerce-store-website/src/ui/components/icon/icon.js b/ecommerce-store-website/src/ui/components/icon/icon.js index fb1e4707e..dad2c0f8c 100644 --- a/ecommerce-store-website/src/ui/components/icon/icon.js +++ b/ecommerce-store-website/src/ui/components/icon/icon.js @@ -63,7 +63,7 @@ export default function Icon( props ) { { tag } )} - { iconPath && iconPath } + { iconPath } ); diff --git a/ecommerce-store-website/src/ui/components/minter/minter.js b/ecommerce-store-website/src/ui/components/minter/minter.js index ddf194b40..acd21bf55 100644 --- a/ecommerce-store-website/src/ui/components/minter/minter.js +++ b/ecommerce-store-website/src/ui/components/minter/minter.js @@ -21,20 +21,25 @@ import styles from './minter.module.scss'; export default function Minter({ className }) { - const { wallet: walletInstance, walletStatus, chainId, tokens: selectedTokens } = useContext(TokenContext); + const { wallet: walletInstance, walletStatus, chainId, tokens: selectedTokens, switchChain } = useContext(TokenContext); const [submissionStatus, setSubmissionStatus] = useState(''); const [mintedNFTs, setMintedNFTs ] = useState([]); const [changeOfNetworkRequired, setChangeOfNetworkRequired] = useState(false); const [popUpMsg, setPopUpMsg] = useState('') - - const chain = chainMap[chainId] ? chainMap[chainId] : 'unsupported chain: ' + chainId; + const [chain, setChain] = useState(); const nftCollections = nftDataStore; + const [mintButonState, setMintButonState] = useState(nftDataStore.map(()=>false)); + useEffect( () => { if ( submissionStatus && !walletStatus ) setSubmissionStatus( walletStatus ); }, [ walletStatus ] ); + useEffect(() => { + setChain(chainMap[chainId] ? chainMap[chainId] : 'unsupported chain: ' + chainId); + }, [chainId]); + const onClosePopUpEvent = () => { setChangeOfNetworkRequired(false); } @@ -45,35 +50,49 @@ export default function Minter({ className }) { return; } + let curChain = chain; + if( !nft.contracts[chain] ) { - console.log("!nft.contracts[ chain ]", chainId); - console.log("!nft.contracts[ chain ]", chain, chainId); - - chainId - ? setPopUpMsg(`Please change your wallet's network to either Goerli or Mumbai.`) - : setPopUpMsg(`Please connect your wallet to continue.`) - - setChangeOfNetworkRequired(true); - } else { - setChangeOfNetworkRequired(false); - const x = await walletInstance.provider.getNetwork(); - // connectedWallet.provider.getNetwork - - const { status, success } = await safeMint({ - connectedWallet: walletInstance, - walletAddress: walletInstance.address, - sendTo: walletInstance.address, - abi: nft.contracts[chain].abi, - contract: nft.contracts[chain].contract, - chain: chain, - name: collectionItem.name, - imageURI: collectionItem.ipfs, - description: collectionItem.description, - tokenUri: collectionItem.metaUrl - }); - if ( success ) setMintedNFTs( [ ...mintedNFTs, collectionItem.id ] ); - if( status ) setSubmissionStatus( status ); + try { + // Try automatically switching to Goerli + await switchChain(5); + + if ((await walletInstance.provider.getNetwork()).chainId !== 5) + throw new Error("Chain switch failed"); + + curChain = "Goerli"; + + } catch (e) { + console.log("!nft.contracts[ chain ]", chainId); + console.log("!nft.contracts[ chain ]", curChain, chainId); + + chainId + ? setPopUpMsg(`Please change your wallet's network to either Goerli or Mumbai.`) + : setPopUpMsg(`Please connect your wallet to continue.`) + + setChangeOfNetworkRequired(true); + return; + } } + + setChangeOfNetworkRequired(false); + + // connectedWallet.provider.getNetwork + + const { status, success } = await safeMint({ + connectedWallet: walletInstance, + walletAddress: walletInstance.address, + sendTo: walletInstance.address, + abi: nft.contracts[curChain].abi, + contract: nft.contracts[curChain].contract, + chain: curChain, + name: collectionItem.name, + imageURI: collectionItem.ipfs, + description: collectionItem.description, + tokenUri: collectionItem.metaUrl + }); + if ( success ) setMintedNFTs( [ ...mintedNFTs, collectionItem.id ] ); + if( status ) setSubmissionStatus( status ); }; return ( @@ -88,14 +107,15 @@ export default function Minter({ className }) { const { title, description, list } = nft; const collectionItem = list[ 0 ]; - let tokenIsSelected = false; - if (typeof ethereum !== "undefined") { - const chain = ethereum.chainId === '0x13881' ? '-mumbai' : '-goerli'; - tokenIsSelected = ( - selectedTokens && selectedTokens[collectionItem.ref + chain] && - selectedTokens[collectionItem.ref+chain].tokens.length > 0 - ); - } + let current = i; + + const chain = chainId === 80001 ? '-mumbai' : '-goerli'; + const tokenIsSelected = ( + selectedTokens && selectedTokens[collectionItem.ref + chain] && + selectedTokens[collectionItem.ref+chain].tokens.length > 0 + ); + + let isMinted = mintedNFTs.indexOf( collectionItem.id ) > -1 || tokenIsSelected; return ( @@ -103,20 +123,44 @@ export default function Minter({ className }) { { title }

{ description }

onMintPressed( event, nft, collectionItem ) } - isMinted={ mintedNFTs.indexOf( collectionItem.id ) > -1 || tokenIsSelected } + className={ clsx( styles[ 'c-minter_button' ], '-mta' , mintButonState[i] && "is_running") } + onClick={ async event => { + if (mintButonState[current]) return; + + if (!walletInstance){ + negotiator.ui.openOverlay(); + return; + } + + let state = [...mintButonState]; + state[current] = true; + setMintButonState(state); + + await onMintPressed( event, nft, collectionItem ); + + state = [...mintButonState]; + state[current] = false; + setMintButonState(state); + + } } + isMinted={ isMinted } + mintMessage = { isMinted ? "" : (mintButonState[current] ? "Minting Your NFT" : "Mint Demo NFT") } + />
); })} + { walletInstance ? + { try { await switchChain(chainId !== 5 ? 5 : 80001); } catch (e) {/* no-op */}}}> + Switch to {chainId !== 5 ? "Goerli" : "Mumbai"} + : ''}
); }; -function MinterButton({ className, onClick, isMinted = false }) { +function MinterButton({ className, onClick, isMinted = false, mintMessage = "" }) { return ( ); } diff --git a/ecommerce-store-website/src/ui/components/minter/minter.module.scss b/ecommerce-store-website/src/ui/components/minter/minter.module.scss index 80b1b4eb4..b052d912b 100644 --- a/ecommerce-store-website/src/ui/components/minter/minter.module.scss +++ b/ecommerce-store-website/src/ui/components/minter/minter.module.scss @@ -27,6 +27,11 @@ } &_button { + &:global(.is_running) { + border-color: rgba(var(--color-text), 0.4); + background: transparent; + box-shadow: none; + } &:global(.-style-primary-light) { pointer-events: none; diff --git a/ecommerce-store-website/src/ui/components/tag/tag.js b/ecommerce-store-website/src/ui/components/tag/tag.js index 6ade0d006..223cc995d 100644 --- a/ecommerce-store-website/src/ui/components/tag/tag.js +++ b/ecommerce-store-website/src/ui/components/tag/tag.js @@ -17,7 +17,7 @@ export default function Tag({ className, children, size }) { return ( - { children && children } + { children } ); } diff --git a/ecommerce-store-website/src/ui/components/visually-hidden/visually-hidden.js b/ecommerce-store-website/src/ui/components/visually-hidden/visually-hidden.js index 822dd064f..72c9196ff 100644 --- a/ecommerce-store-website/src/ui/components/visually-hidden/visually-hidden.js +++ b/ecommerce-store-website/src/ui/components/visually-hidden/visually-hidden.js @@ -18,7 +18,7 @@ export default function VisuallyHidden({ className, children }) { return ( - { children && children } + { children } ); } diff --git a/ecommerce-store-website/src/ui/hooks/use-property-values.js b/ecommerce-store-website/src/ui/hooks/use-property-values.js index 10a2584df..35d98af45 100644 --- a/ecommerce-store-website/src/ui/hooks/use-property-values.js +++ b/ecommerce-store-website/src/ui/hooks/use-property-values.js @@ -10,7 +10,7 @@ import _ from 'lodash-es'; function formatPropertyValue( pv ) { - return pv.trim().replace( /^"|"$/g, '' ); + return pv.trim().replace("/^"|"$/g",""); } export function getPropertyValue( propertyValue ) { diff --git a/ecommerce-store-website/src/ui/sections/demo-header/demo-header.js b/ecommerce-store-website/src/ui/sections/demo-header/demo-header.js index d0a6c46fd..17b3d751a 100644 --- a/ecommerce-store-website/src/ui/sections/demo-header/demo-header.js +++ b/ecommerce-store-website/src/ui/sections/demo-header/demo-header.js @@ -21,7 +21,7 @@ export default function DemoHeader({ className, headline, children }) {

{ headline }

- { children && children } + { children }
); diff --git a/ecommerce-store-website/src/ui/sections/demo-hero/demo-hero.js b/ecommerce-store-website/src/ui/sections/demo-hero/demo-hero.js index 1ebd0f920..afc5011ab 100644 --- a/ecommerce-store-website/src/ui/sections/demo-hero/demo-hero.js +++ b/ecommerce-store-website/src/ui/sections/demo-hero/demo-hero.js @@ -19,7 +19,7 @@ import styles from "./demo-hero.module.scss"; export default function DemoHero({ children, className, ...rest }) { return ( - { children && children } + { children } ) } diff --git a/ecommerce-store-website/src/ui/views/home/home-view.js b/ecommerce-store-website/src/ui/views/home/home-view.js index 7c9830081..5ecba9aaa 100644 --- a/ecommerce-store-website/src/ui/views/home/home-view.js +++ b/ecommerce-store-website/src/ui/views/home/home-view.js @@ -19,24 +19,31 @@ import styles from "./home-view.module.scss"; export default function HomeView(props) { - const { wallet } = useContext(TokenContext); + const { wallet, switchChain, chainId } = useContext(TokenContext); + const [showNetworkNotification, setShowNetworkNotification] = useState(false); - let showNetworkNotification = false; - - const normalisedNetworkId = wallet ? chainMap[wallet.chainId] : undefined; - - if( - wallet && - normalisedNetworkId !== "Goerli" && - normalisedNetworkId !== "Mumbai" - ){ - showNetworkNotification = true; - } + useEffect(() => { + const normalisedNetworkId = wallet ? chainMap[chainId] : undefined; + + if( + wallet && + normalisedNetworkId !== "Goerli" && + normalisedNetworkId !== "Mumbai" + ){ + setShowNetworkNotification(true); + } else { + setShowNetworkNotification(false); + } + }, [wallet, chainId]); return ( - + Click to connect to  + switchChain(5)}>Goerli  + or switchChain(80001)}>Mumbai network } + />
diff --git a/hotel-bogota-active-negotiation-website/package-lock.json b/hotel-bogota-active-negotiation-website/package-lock.json index 5258a8dd3..d67b890ff 100644 --- a/hotel-bogota-active-negotiation-website/package-lock.json +++ b/hotel-bogota-active-negotiation-website/package-lock.json @@ -17,7 +17,7 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "add": "^2.0.6", "date-fns": "latest", "ethers": "^5.4.0", @@ -5086,16 +5086,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", @@ -27937,16 +27937,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/hotel-bogota-active-negotiation-website/package.json b/hotel-bogota-active-negotiation-website/package.json index 9097d870b..02a705e3b 100644 --- a/hotel-bogota-active-negotiation-website/package.json +++ b/hotel-bogota-active-negotiation-website/package.json @@ -12,7 +12,7 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "add": "^2.0.6", "date-fns": "latest", "ethers": "^5.4.0", diff --git a/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js b/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js index 06ee5ce70..42db9f8c2 100644 --- a/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js +++ b/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js @@ -30,7 +30,7 @@ const TokenContextProvider = (props) => { const { selectedTokens } = tokens; - tokenKeys.map((token) => { + tokenKeys.forEach((token) => { selectedTokensState.push(...tokens.selectedTokens[token].tokens); diff --git a/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js b/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js index 63985e5f7..2343b11d4 100644 --- a/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js +++ b/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js @@ -125,7 +125,6 @@ export default function BookingModal({room}) { disableEnforceFocus={true} open={open} onClose={handleClose} - disableEnforceFocus={true} aria-labelledby="form-dialog-title"> { bookingDone && @@ -253,7 +252,6 @@ export default function BookingModal({room}) { className="paynow" variant="contained" onClick={useToken} - color="primary" > Use Token @@ -265,7 +263,6 @@ export default function BookingModal({room}) { className="paynow" variant="contained" onClick={useToken} - color="primary" >
@@ -277,7 +274,6 @@ export default function BookingModal({room}) { className="paynow" variant="contained" onClick={handleSubmit} - color="primary" > Pay Now @@ -289,7 +285,6 @@ export default function BookingModal({room}) { className="paynow" variant="contained" onClick={handleSubmit} - color="primary" > Pay Now (no discount) diff --git a/hotel-bogota-active-negotiation-website/src/components/Header/header.css b/hotel-bogota-active-negotiation-website/src/components/Header/header.css index 5b738d26c..38b9ba0e8 100644 --- a/hotel-bogota-active-negotiation-website/src/components/Header/header.css +++ b/hotel-bogota-active-negotiation-website/src/components/Header/header.css @@ -13,7 +13,7 @@ header { margin: 0; padding-top: 21px; height: 32px; - font-family: SerifGothicStd; + font-family: SerifGothicStd, Arial, Helvetica, sans-serif; font-size: 29px; font-weight: bold; font-stretch: normal; @@ -25,12 +25,11 @@ header { .logo h2 { -webkit-font-smoothing: antialiased; - margin: 0; padding-top: 0; width: 118px; height: 12px; margin: 2px 36px 0; - font-family: SerifGothicStd; + font-family: SerifGothicStd, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; font-stretch: normal; diff --git a/hotel-bogota-passive-negotiation-website/package-lock.json b/hotel-bogota-passive-negotiation-website/package-lock.json index 64452ebbe..3333a0b27 100644 --- a/hotel-bogota-passive-negotiation-website/package-lock.json +++ b/hotel-bogota-passive-negotiation-website/package-lock.json @@ -12,7 +12,7 @@ "@material-ui/core": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.57", "@material-ui/pickers": "latest", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "add": "^2.0.6", "date-fns": "latest", "ethers": "^5.4.0", @@ -5088,16 +5088,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", @@ -28351,16 +28351,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/hotel-bogota-passive-negotiation-website/package.json b/hotel-bogota-passive-negotiation-website/package.json index 262fb95a9..b0df78b7b 100644 --- a/hotel-bogota-passive-negotiation-website/package.json +++ b/hotel-bogota-passive-negotiation-website/package.json @@ -7,7 +7,7 @@ "@material-ui/core": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.57", "@material-ui/pickers": "latest", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "add": "^2.0.6", "date-fns": "latest", "ethers": "^5.4.0", diff --git a/hotel-bogota-passive-negotiation-website/src/App.js b/hotel-bogota-passive-negotiation-website/src/App.js index 4b7eb6471..8b35ee019 100644 --- a/hotel-bogota-passive-negotiation-website/src/App.js +++ b/hotel-bogota-passive-negotiation-website/src/App.js @@ -57,7 +57,7 @@ function App() { window.negotiator.on('tokens', (issuerTokens) => { let tokens = []; - tokenIssuers.map((issuer) => { + tokenIssuers.forEach((issuer) => { tokens.push(...issuerTokens[issuer.collectionID].tokens); }); if (tokens.length > 0) { diff --git a/hotel-bogota-passive-negotiation-website/src/BookingModal/BookingModal.css b/hotel-bogota-passive-negotiation-website/src/BookingModal/BookingModal.css index e816aea6a..f6cb1cd01 100644 --- a/hotel-bogota-passive-negotiation-website/src/BookingModal/BookingModal.css +++ b/hotel-bogota-passive-negotiation-website/src/BookingModal/BookingModal.css @@ -7,8 +7,7 @@ .title { font-size: 1.2rem; margin-bottom: 0px; - padding-bottom: 0; - padding: 17px 24px 0px 24px !important + padding: 17px 24px 0px 24px !important; } .subTitle { font-size: 1rem; diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..163e375af --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=TokenScript_token-negotiator-examples +sonar.organization=tokenscript + +sonar.exclusions=e2e-test-suite/** + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=token-negotiator-examples +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 diff --git a/ticket-issuer-url-website/package-lock.json b/ticket-issuer-url-website/package-lock.json index 3fe4cd770..95f4e460d 100644 --- a/ticket-issuer-url-website/package-lock.json +++ b/ticket-issuer-url-website/package-lock.json @@ -11,7 +11,7 @@ "@babel/core": "^7.15.8", "@material-ui/core": "^4.11.2", "@tokenscript/attestation": "0.4.1-mw", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "node-polyfill-webpack-plugin": "^1.1.4", "npm-check-updates": "^11.8.5", "react": "^17.0.2", @@ -5665,16 +5665,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", @@ -32914,16 +32914,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/ticket-issuer-url-website/package.json b/ticket-issuer-url-website/package.json index 6002acb0e..b8248495d 100644 --- a/ticket-issuer-url-website/package.json +++ b/ticket-issuer-url-website/package.json @@ -6,7 +6,7 @@ "@babel/core": "^7.15.8", "@material-ui/core": "^4.11.2", "@tokenscript/attestation": "0.4.1-mw", - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "node-polyfill-webpack-plugin": "^1.1.4", "npm-check-updates": "^11.8.5", "react": "^17.0.2", diff --git a/ticket-issuer-url-website/src/App.js b/ticket-issuer-url-website/src/App.js index b67684939..ed99f04c0 100644 --- a/ticket-issuer-url-website/src/App.js +++ b/ticket-issuer-url-website/src/App.js @@ -57,7 +57,7 @@ function App() { let tokens = []; - tokenIssuers.map((issuer) => { + tokenIssuers.forEach((issuer) => { tokens.push(...issuerTokens[issuer.collectionID].tokens); diff --git a/token-outlet-website/package-lock.json b/token-outlet-website/package-lock.json index 01afecc62..e4d93080c 100644 --- a/token-outlet-website/package-lock.json +++ b/token-outlet-website/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "asn1js": "^2.0.26", "pvutils": "^1.0.17" }, @@ -2807,16 +2807,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", @@ -15845,16 +15845,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/token-outlet-website/package.json b/token-outlet-website/package.json index 002a90ed9..0b88b3ab4 100644 --- a/token-outlet-website/package.json +++ b/token-outlet-website/package.json @@ -6,7 +6,7 @@ "dependencies": { "asn1js": "^2.0.26", "pvutils": "^1.0.17", - "@tokenscript/token-negotiator": "^2.3.0" + "@tokenscript/token-negotiator": "^2.4.0" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/typescript-bare-bones-demo/package-lock.json b/typescript-bare-bones-demo/package-lock.json index ed161a33d..24cfe175a 100644 --- a/typescript-bare-bones-demo/package-lock.json +++ b/typescript-bare-bones-demo/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "source-map-loader": "^4.0.0" }, "devDependencies": { @@ -2803,16 +2803,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", @@ -15435,16 +15435,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/typescript-bare-bones-demo/package.json b/typescript-bare-bones-demo/package.json index 33e00ae9c..4d47e05af 100644 --- a/typescript-bare-bones-demo/package.json +++ b/typescript-bare-bones-demo/package.json @@ -4,7 +4,7 @@ "description": "gateway to negotiate tokens from the token outlet", "main": "index.js", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "source-map-loader": "^4.0.0" }, "devDependencies": { diff --git a/vue-boilerplate/package-lock.json b/vue-boilerplate/package-lock.json index f2a59d52c..e096a8dd7 100644 --- a/vue-boilerplate/package-lock.json +++ b/vue-boilerplate/package-lock.json @@ -8,7 +8,7 @@ "name": "vue-boilerplate", "version": "0.1.0", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "core-js": "^3.8.3", "vue": "^3.2.13", "vue-router": "^4.0.3", @@ -3147,16 +3147,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", @@ -20286,16 +20286,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/vue-boilerplate/package.json b/vue-boilerplate/package.json index 6134c5406..55ddab4b5 100644 --- a/vue-boilerplate/package.json +++ b/vue-boilerplate/package.json @@ -9,7 +9,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "core-js": "^3.8.3", "vue": "^3.2.13", "vue-router": "^4.0.3", diff --git a/vue-boilerplate/vue.config.js b/vue-boilerplate/vue.config.js index 7d1f4fc8b..3dd719684 100644 --- a/vue-boilerplate/vue.config.js +++ b/vue-boilerplate/vue.config.js @@ -3,6 +3,11 @@ const NodePolyfillPlugin = require("node-polyfill-webpack-plugin") module.exports = defineConfig({ transpileDependencies: true, configureWebpack: { + resolve: { + alias: { + process: "process/browser" + } + }, plugins: [ new NodePolyfillPlugin() ] diff --git a/vue-vite-boilerplate/package-lock.json b/vue-vite-boilerplate/package-lock.json index 167db2cc7..6d474d92d 100644 --- a/vue-vite-boilerplate/package-lock.json +++ b/vue-vite-boilerplate/package-lock.json @@ -8,7 +8,7 @@ "name": "vue-vite-boilerplate", "version": "0.0.0", "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "vue": "^3.2.37", "vue-router": "^4.1.3" }, @@ -1689,16 +1689,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", @@ -10669,16 +10669,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/vue-vite-boilerplate/package.json b/vue-vite-boilerplate/package.json index 639231987..d1e265a83 100644 --- a/vue-vite-boilerplate/package.json +++ b/vue-vite-boilerplate/package.json @@ -8,7 +8,7 @@ "preview": "vite preview --port 4173" }, "dependencies": { - "@tokenscript/token-negotiator": "^2.3.0", + "@tokenscript/token-negotiator": "^2.4.0", "vue": "^3.2.37", "vue-router": "^4.1.3" }, diff --git a/vue-vite-boilerplate/vite.config.js b/vue-vite-boilerplate/vite.config.js index 2c873c133..33f8bb84f 100644 --- a/vue-vite-boilerplate/vite.config.js +++ b/vue-vite-boilerplate/vite.config.js @@ -11,7 +11,8 @@ export default defineConfig({ ], resolve: { alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)) + '@': fileURLToPath(new URL('./src', import.meta.url)), + process: "process/browser", } }, optimizeDeps: {