Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into short-expiry-server-side-option
Browse files Browse the repository at this point in the history
HughParry committed Nov 23, 2023
2 parents fc48c0b + 2942e90 commit 03c098c
Showing 250 changed files with 6,161 additions and 25,235 deletions.
1 change: 1 addition & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ jobs:
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: npm install
- run: npm run removePolkadotJSWarnings

- name: Clippy
run: |
1 change: 1 addition & 0 deletions .github/workflows/contract_version.yml
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@ jobs:
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: npm install
- run: npm run removePolkadotJSWarnings

- name: Check contract version matches provider version
run: |
6 changes: 3 additions & 3 deletions .github/workflows/dockerhub_publish.yml
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ jobs:
echo "Navigating to 'packages/procaptcha-bundle' and building JS bundle..."
cd packages/procaptcha-bundle
NODE_ENV=production npm run build:prod
NODE_ENV=production npm run bundle:prod
# Rename the bundle to include the version number
NEW_BUNDLE_FILENAME="procaptcha.bundle.${{ needs.check_version.outputs.next_version }}.js"
@@ -132,9 +132,9 @@ jobs:
cp ./dev/scripts/env.rococo ./packages/cli/.env.production
# Navigate to the provider CLI directory and build
echo "Navigating to 'packages/cli' and building..."
echo "Navigating to 'packages/cli' and bundling..."
cd packages/cli
NODE_ENV=production npm run build:prod
NODE_ENV=production npm run bundle:prod
# Navigate back to the project root
echo "Navigating back to project root..."
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -48,4 +48,5 @@ jobs:
- run: npm install -g npm@8.9
- run: npm install
- run: npm run removePolkadotJSWarnings
- run: npm run lint
1 change: 1 addition & 0 deletions .github/workflows/post_pr.yml
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ jobs:
- run: ls -la node_modules || true

- run: npm install
- run: npm run removePolkadotJSWarnings

- name: Rust formatting check
run: |
3 changes: 2 additions & 1 deletion .github/workflows/provider_image.yml
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ jobs:
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: npm install
- run: npm run removePolkadotJSWarnings

# build the packages
- name: Build packages
@@ -62,7 +63,7 @@ jobs:
- name: Build cli production bundle
run: |
cp ./dev/scripts/env.rococo ./packages/cli/.env.production
NODE_ENV=production npm run -w @prosopo/cli build:prod
NODE_ENV=production npm run -w @prosopo/cli bundle:prod
# create the provider image
- name: Build provider image
1 change: 1 addition & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ jobs:
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: npm install
- run: npm run removePolkadotJSWarnings

- name: Rust formatting check
run: |
32 changes: 19 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ jobs:
- run: npm install -g npm@8.9
- run: npm install
- run: npm run removePolkadotJSWarnings

# build all packages in workspace
- run: npm run build:all
@@ -60,6 +61,7 @@ jobs:
cp demos/client-example/env.development demos/client-example/.env.test
cp dev/scripts/env.test dev/scripts/.env.test
cp dev/scripts/env.test packages/cli/.env.test
cp dev/scripts/env.test packages/procaptcha-bundle/.env.test
echo NODE_ENV: $NODE_ENV
- name: Start the docker images
@@ -68,9 +70,8 @@ jobs:
docker container ls
sleep 10s
# deploy dapp + protocol and run the unit tests
# deploy protocol and run the unit tests
- run: npm run deploy_protocol
- run: npm run deploy_dapp
- run: npm run test -- --watch=false

# restart the docker images to drop any changes made by the unit tests to the contract(s) before running cypress tests
@@ -82,17 +83,22 @@ jobs:
sleep 10s
# deploy dapp + protocol and run setup to register, stake and load a dataset for a provider
- run: npm run deploy_protocol
- run: npm run deploy_dapp
- run: npm run setup
- run: NODE_ENV=test npm run deploy_protocol
- run: NODE_ENV=test npm run setup

# Build a test version of the procaptcha bundle and run the cypress tests on it and on the React client-example
# Running bundle:dev instead of bundle:prod means the bundle will be built with selectors that can be used
# by the cypress tests to find the elements they need to interact with
- run: NODE_ENV=test npm -w @prosopo/procaptcha-bundle run bundle:dev

# Needs concurrently to avoid vite hanging forever https://github.com/vitejs/vite/discussions/8745
- name: Install concurrently and cypress
run: npm i concurrently cypress

- name: Run the cypress tests on client-example
run: |
npm run start:provider &
sleep 10s
npm run start:server &
sleep 10s
npm run start:demo &
sleep 10s
npm i cypress
npm -w @prosopo/client-example run cypress:run
npx concurrently "npm run start:server" "npm run start:provider" "npm run start:demo" "sleep 10s && npm -w @prosopo/cypress-shared run cypress:run:client-example" --success "first" --kill-others
- name: Run the cypress tests on client-bundle-example
run: |
npx concurrently "npm run start:server" "npm run start:provider" "npm run start:bundle" "sleep 10s && npm -w @prosopo/cypress-shared run cypress:run:client-bundle-example" --success "first" --kill-others
1 change: 1 addition & 0 deletions .github/workflows/tests_protocol.yml
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ jobs:
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: npm install
- run: npm run removePolkadotJSWarnings

- name: Build contracts
id: build
99 changes: 84 additions & 15 deletions contracts/captcha/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prosopo/captcha-contract",
"version": "0.2.13",
"version": "0.2.14",
"description": "The captcha contract",
"main": "dist/index.js",
"type": "module",
@@ -9,24 +9,93 @@
"import": "./dist/index.js",
"require": "./dist/cjs/index.cjs"
},
"./build-extrinsic": "./dist/build-extrinsic/captcha.js",
"./constructors": "./dist/constructors/captcha.js",
"./contract-info": "./dist/contract-info/captcha.js",
"./contracts": "./dist/contracts/captcha.js",
"./data/captcha.json": "./dist/data/captcha.json",
"./event-data/captcha.json": "./dist/event-data/captcha.json",
"./event-types": "./dist/event-types/captcha.js",
"./events": "./dist/events/captcha.js",
"./mixed-methods": "./dist/mixed-methods/captcha.js",
"./query": "./dist/query/captcha.js",
"./shared": "./dist/shared/captcha.js",
"./tx-sign-and-send": "./dist/tx-sign-and-send/captcha.js",
"./types-arguments": "./dist/types-arguments/captcha.js",
"./types-returns": "./dist/types-returns/captcha.js"
"./build-extrinsic": {
"types": "./dist/build-extrinsic/captcha.d.ts",
"import": "./dist/build-extrinsic/captcha.js",
"require": "./dist/cjs/build-extrinsic/captcha.cjs",
"default": "./dist/build-extrinsic/captcha.js"
},
"./constructors": {
"types": "./dist/constructors/captcha.d.ts",
"import": "./dist/constructors/captcha.js",
"require": "./dist/cjs/constructors/captcha.cjs",
"default": "./dist/constructors/captcha.js"
},
"./contract-info": {
"types": "./dist/contract-info/captcha.d.ts",
"import": "./dist/contract-info/captcha.js",
"require": "./dist/cjs/contract-info/captcha.cjs",
"default": "./dist/contract-info/captcha.js"
},
"./contracts": {
"types": "./dist/contracts/captcha.d.ts",
"import": "./dist/contracts/captcha.js",
"require": "./dist/cjs/contracts/captcha.cjs",
"default": "./dist/contracts/captcha.js"
},
"./data/captcha.json": {
"import": "./dist/data/captcha.json",
"require": "./dist/cjs/data/captcha.json.cjs",
"default": "./dist/data/captcha.json"
},
"./event-data/captcha.json": {
"import": "./dist/event-data/captcha.json",
"require": "./dist/cjs/event-data/captcha.json.cjs",
"default": "./dist/event-data/captcha.json"
},
"./event-types": {
"types": "./dist/event-types/captcha.d.ts",
"import": "./dist/event-types/captcha.js",
"require": "./dist/cjs/event-types/captcha.cjs",
"default": "./dist/event-types/captcha.js"
},
"./events": {
"types": "./dist/events/captcha.d.ts",
"import": "./dist/events/captcha.js",
"require": "./dist/cjs/events/captcha.cjs",
"default": "./dist/events/captcha.js"
},
"./mixed-methods": {
"types": "./dist/mixed-methods/captcha.d.ts",
"import": "./dist/mixed-methods/captcha.js",
"require": "./dist/cjs/mixed-methods/captcha.cjs",
"default": "./dist/mixed-methods/captcha.js"
},
"./query": {
"types": "./dist/query/captcha.d.ts",
"import": "./dist/query/captcha.js",
"require": "./dist/cjs/query/captcha.cjs",
"default": "./dist/query/captcha.js"
},
"./shared": {
"types": "./dist/shared/captcha.d.ts",
"import": "./dist/shared/captcha.js",
"require": "./dist/cjs/shared/captcha.cjs",
"default": "./dist/shared/captcha.js"
},
"./tx-sign-and-send": {
"types": "./dist/tx-sign-and-send/captcha.d.ts",
"import": "./dist/tx-sign-and-send/captcha.js",
"require": "./dist/cjs/tx-sign-and-send/captcha.cjs",
"default": "./dist/tx-sign-and-send/captcha.js"
},
"./types-arguments": {
"types": "./dist/types-arguments/captcha.d.ts",
"import": "./dist/types-arguments/captcha.js",
"require": "./dist/cjs/types-arguments/captcha.cjs",
"default": "./dist/types-arguments/captcha.js"
},
"./types-returns": {
"types": "./dist/types-returns/captcha.d.ts",
"import": "./dist/types-returns/captcha.js",
"require": "./dist/cjs/types-returns/captcha.cjs",
"default": "./dist/types-returns/captcha.js"
}
},
"scripts": {
"clean": "tsc --build --clean",
"build": "tsc --build --verbose",
"build:cjs": "npx vite --config vite.cjs.config.ts build",
"lint": "npx eslint .",
"lint:fix": "npx eslint . --fix --config ../../.eslintrc.js"
},
4 changes: 2 additions & 2 deletions contracts/captcha/src/captcha.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"source": {
"hash": "0xb9838a103f7f6f60fc5c2f4f4b7583b4d5b64d17e7a8b40d84101c50631467a8",
"hash": "0xec2eacf106b25b261f245b12d6f4b94de67dead5a779aa3e8f6d5eef93eb36b0",
"language": "ink! 4.3.0",
"compiler": "rustc 1.69.0",
"build_info": {
@@ -15,7 +15,7 @@
},
"contract": {
"name": "captcha",
"version": "0.2.13",
"version": "0.2.14",
"authors": [
"Chris Taylor <chris@prosopo.io>",
"George Oastler <george@prosopo.io>",
4 changes: 2 additions & 2 deletions contracts/captcha/src/contract-info/captcha.ts

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions contracts/captcha/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
},
"include": ["src", "src/**/*.json"],
"references": []
}
6 changes: 6 additions & 0 deletions contracts/captcha/vite.cjs.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ViteCommonJSConfig } from '@prosopo/config'
import path from 'path'

export default function () {
return ViteCommonJSConfig('captcha-contract', path.resolve('./tsconfig.cjs.json'))
}
2 changes: 1 addition & 1 deletion contracts/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prosopo/common-contract",
"version": "0.2.13",
"version": "0.2.14",
"description": "The common contract",
"main": "dist/index.js",
"type": "module",
4 changes: 2 additions & 2 deletions contracts/common/src/common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"source": {
"hash": "0xff9af5d896229b57a3278afb12a184fd2fc36f3c3367f86508efbc9a767e0f6d",
"hash": "0x04865a9a5b2a072738e7345f23f396b9d29215294fe02d6d588fee820e2d3314",
"language": "ink! 4.3.0",
"compiler": "rustc 1.69.0",
"build_info": {
@@ -15,7 +15,7 @@
},
"contract": {
"name": "common",
"version": "0.2.13",
"version": "0.2.14",
"authors": [
"Chris Taylor <chris@prosopo.io>",
"George Oastler <george@prosopo.io>",
4 changes: 2 additions & 2 deletions contracts/common/src/contract-info/common.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prosopo/proxy-contract",
"version": "0.2.13",
"version": "0.2.14",
"description": "The proxy contract",
"main": "dist/index.js",
"type": "module",
4 changes: 2 additions & 2 deletions contracts/proxy/src/contract-info/proxy.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions contracts/proxy/src/proxy.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"source": {
"hash": "0xc42e28d6a7c04e67b95bb8becd47a40afd69f671246841517aaa9ffa68a03cf5",
"hash": "0x872a66d12f9d14fdf484574a0a2f52c63f5c001298d59ceeead91e99118a8c1f",
"language": "ink! 4.3.0",
"compiler": "rustc 1.69.0",
"build_info": {
@@ -15,7 +15,7 @@
},
"contract": {
"name": "proxy",
"version": "0.2.13",
"version": "0.2.14",
"authors": ["Chris Taylor <chris@prosopo.io>", "George Oastler <george@prosopo.io>"]
},
"spec": {
4 changes: 2 additions & 2 deletions demos/client-bundle-example/package.json
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@
"npm": "8.9"
},
"scripts": {
"start": "light-server -s ./src -p 9231 -w \"**/*.html,**/*.css,**/*.js,**/*.gz\"",
"start": "light-server -s ./src -p 9232 -w \"**/*.html,**/*.css,**/*.js,**/*.gz\"",
"clean": "echo 'nothing to clean'"
},
"dependencies": {
"dotenv": "^16.0.1",
"light-server": "^2.9.1"
},
"version": "0.2.13",
"version": "0.2.14",
"devDependencies": {
"tslib": "2.6.2",
"typescript": "5.1.6"
4 changes: 2 additions & 2 deletions demos/client-bundle-example/src/index.html
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
<div
class="procaptcha"
data-theme="light"
data-sitekey="5HUBceb4Du6dvMA9BiwN5VzUrzUsX9Zp7z7nSR2cC1TCv5jg"
data-sitekey="5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw"
></div>
<input type="submit" class="mui-btn mui-btn--raised"/>
</form>
@@ -37,7 +37,7 @@

// Render the CAPTCHA explicitly on a container with id "procaptcha-container"
window.procaptcha.render('procaptcha-container', {
siteKey: '5HUBceb4Du6dvMA9BiwN5VzUrzUsX9Zp7z7nSR2cC1TCv5jg',
siteKey: '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
theme: 'dark',
callback: 'onCaptchaVerified',
})
2 changes: 1 addition & 1 deletion demos/client-example-server/env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
REACT_APP_API_PATH_PREFIX=/v1/prosopo
REACT_APP_DAPP_SITE_KEY=
REACT_APP_DAPP_SITE_KEY=5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw
REACT_APP_SUBSTRATE_NODE_URL=ws://localhost:9944
REACT_APP_PROSOPO_CONTRACT_ADDRESS=
REACT_APP_WEB2=true
Loading

0 comments on commit 03c098c

Please sign in to comment.