Skip to content

Commit

Permalink
Merge pull request #180 from TokenScript/staging
Browse files Browse the repository at this point in the history
Staging with TKN 2.4.0
  • Loading branch information
micwallace authored Mar 8, 2023
2 parents f14b1fc + 1c7cc15 commit 5870195
Show file tree
Hide file tree
Showing 50 changed files with 370 additions and 253 deletions.
96 changes: 58 additions & 38 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
18 changes: 9 additions & 9 deletions angular-bare-bones-demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion angular-bare-bones-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion angular-bare-bones-demo/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion art-gallery-medium-article-website/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}),
]);
Expand Down
18 changes: 9 additions & 9 deletions art-gallery-medium-article-website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion art-gallery-medium-article-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 9 additions & 9 deletions ecommerce-store-website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ecommerce-store-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 14 additions & 5 deletions ecommerce-store-website/src/base/utils/interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([
"<h4>Minting...</h4>",
"<small>Transaction in progress</small>"
], 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) {
Expand Down
Loading

0 comments on commit 5870195

Please sign in to comment.