@prosopo/scripts v2.6.12
Prosopo Dev Scripts Package
This package contains the scripts and configuration for setting up a development environment for Prosopo.
Prerequisites
Dev Setup
Quickstart
git clone https://github.com/prosopo/captcha
cd captcha
npm i
npm run build:all
docker compose --file docker/docker-compose.development.yml up -d
cp demos/client-example-server/env.development demos/client-example-server/.env.development
cp demos/client-example/env.development demos/client-example/.env.development
cp dev/scripts/env.development .env.development
cp dev/scripts/env.development dev/scripts/.env.development
cp dev/scripts/env.development packages/cli/.env.development
cp dev/scripts/env.development packages/procaptcha-bundle/.env.development
npm run setup:allIn different terminals run
Terminal 1
npm run start:serverTerminal 2
npm run start:providerTerminal 3
npm run start:demoGo to http://localhost:9230 in your browser.
In-depth
Set up Containers
Setup your containers by running the following command from the root of the scripts repository.
docker compose --file ./docker/docker-compose.development.yml up -dInstall node modules
Install the node modules by running the following command from the root of the captcha workspace.
npm iBuild all packages
Build all packages by running the following command from the root of the captcha workspace.
npm run build:allDeploy contracts (Optional)
If you want to deploy the Procaptcha protocol contract, you can do so by running the following command from the root of the captcha workspace. Any .env files will be updated with the new contract addresses.
npm run deploy_protocol
npm run setupAlternatively, run npm setup:all to run both of the above commands.
Env file
You must have a valid env file in ./dev/scripts/ for these commands to work. You can use the
file ./dev/scripts/env.development as a template.
Set up a Provider and Register a Dapp
Providers are the nodes in the network that supply CAPTCHA. Run the following command from the root of the captcha workspace to register a Provider and a Dapp in the Protocol contract and start the Provider API.
npm run setup && npm run start:providerThe Protocol contract must exist on the substrate node for the setup script to run.
Testing
Run tests
Run all the tests using the following command from the root of the captcha workspace.
npm run testCLI
The development scripts package contains a CLI tool that can be used for various development tasks.
Deploy Protocol Contract
From the root of the captcha workspace run:
npm run deploy_protocolThis is shorthand for the following command:
npm run -w @prosopo/scripts cli deploy_protocol --update_envSpecify the current working directory if you are running from a different location.
npm run -w @prosopo/scripts cli deploy_protocol --update_env --cwd $(pwd)The default environment is development. To deploy to a different environment, set the NODE_ENV environment variable.
NODE_ENV=test npm run -w @prosopo/scripts cli deploy_protocol --update_envCreate env files
TODO
Setup the Protocol Contract
npm run setupImport Contracts using Typechain
...Import All Contracts
...Fund Dapps
Maintenance script to fund dapps in contract that are not Active.
npm run -w @prosopo/scripts -- cli fund_dappsTransfer Contract between networks
By default, the current .env setup will be used as the --transfer-to network.
Transfer dapps and providers from one contract to another
Options:
--help Show help [boolean]
--version Show version number [boolean]
--transfer-from The name of the network and the contract address to tran
sfer from `{ network, address }` [string] [required]
--transfer-to The name of the network and the contract address to tran
sfer to `{ network, address }` [string]
--transfer-providers Whether to transfer providers or not
[boolean] [required] [default: false]
--transfer-dapps Whether to transfer dapps or not
[boolean] [required] [default: false]From the root of the workspace run:
npm run -w @prosopo/scripts -- cli transfer_contract --transfer-from '{"network":"rococo", "address":"..."}' --transfer-dapps=true --transfer-providers=trueDisplay Version
From the root of the workspace run:
npm run -w @prosopo/scripts -- cli --version10 months ago
11 months ago
9 months ago
10 months ago
10 months ago
5 months ago
8 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
8 months ago
9 months ago
10 months ago
7 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago