@prosopo/scripts 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +133 -0
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.d.ts.map +1 -0
  4. package/dist/cli/index.js +145 -0
  5. package/dist/cli/index.js.map +1 -0
  6. package/dist/contract/deploy/dapp.d.ts +3 -0
  7. package/dist/contract/deploy/dapp.d.ts.map +1 -0
  8. package/dist/contract/deploy/dapp.js +41 -0
  9. package/dist/contract/deploy/dapp.js.map +1 -0
  10. package/dist/contract/deploy/index.d.ts +3 -0
  11. package/dist/contract/deploy/index.d.ts.map +1 -0
  12. package/dist/contract/deploy/index.js +16 -0
  13. package/dist/contract/deploy/index.js.map +1 -0
  14. package/dist/contract/deploy/protocol.d.ts +3 -0
  15. package/dist/contract/deploy/protocol.d.ts.map +1 -0
  16. package/dist/contract/deploy/protocol.js +53 -0
  17. package/dist/contract/deploy/protocol.js.map +1 -0
  18. package/dist/contract/import.d.ts +4 -0
  19. package/dist/contract/import.d.ts.map +1 -0
  20. package/dist/contract/import.js +21 -0
  21. package/dist/contract/import.js.map +1 -0
  22. package/dist/contract/index.d.ts +3 -0
  23. package/dist/contract/index.d.ts.map +1 -0
  24. package/dist/contract/index.js +16 -0
  25. package/dist/contract/index.js.map +1 -0
  26. package/dist/index.d.ts +5 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +18 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/scripts/addCopyrightNotice.d.ts +2 -0
  31. package/dist/scripts/addCopyrightNotice.d.ts.map +1 -0
  32. package/dist/scripts/addCopyrightNotice.js +103 -0
  33. package/dist/scripts/addCopyrightNotice.js.map +1 -0
  34. package/dist/scripts/bytesToHex.d.ts +2 -0
  35. package/dist/scripts/bytesToHex.d.ts.map +1 -0
  36. package/dist/scripts/bytesToHex.js +22 -0
  37. package/dist/scripts/bytesToHex.js.map +1 -0
  38. package/dist/scripts/convertAccount.d.ts +2 -0
  39. package/dist/scripts/convertAccount.d.ts.map +1 -0
  40. package/dist/scripts/convertAccount.js +37 -0
  41. package/dist/scripts/convertAccount.js.map +1 -0
  42. package/dist/scripts/encodeDecode.d.ts +2 -0
  43. package/dist/scripts/encodeDecode.d.ts.map +1 -0
  44. package/dist/scripts/encodeDecode.js +64 -0
  45. package/dist/scripts/encodeDecode.js.map +1 -0
  46. package/dist/scripts/generateMnemonic.d.ts +2 -0
  47. package/dist/scripts/generateMnemonic.d.ts.map +1 -0
  48. package/dist/scripts/generateMnemonic.js +28 -0
  49. package/dist/scripts/generateMnemonic.js.map +1 -0
  50. package/dist/scripts/getBalance.d.ts +2 -0
  51. package/dist/scripts/getBalance.d.ts.map +1 -0
  52. package/dist/scripts/getBalance.js +15 -0
  53. package/dist/scripts/getBalance.js.map +1 -0
  54. package/dist/scripts/getBlock.d.ts +2 -0
  55. package/dist/scripts/getBlock.d.ts.map +1 -0
  56. package/dist/scripts/getBlock.js +31 -0
  57. package/dist/scripts/getBlock.js.map +1 -0
  58. package/dist/scripts/getContractInfoOf.d.ts +2 -0
  59. package/dist/scripts/getContractInfoOf.d.ts.map +1 -0
  60. package/dist/scripts/getContractInfoOf.js +52 -0
  61. package/dist/scripts/getContractInfoOf.js.map +1 -0
  62. package/dist/scripts/getExistentialDeposit.d.ts +2 -0
  63. package/dist/scripts/getExistentialDeposit.d.ts.map +1 -0
  64. package/dist/scripts/getExistentialDeposit.js +39 -0
  65. package/dist/scripts/getExistentialDeposit.js.map +1 -0
  66. package/dist/scripts/getRandomProvider.d.ts +2 -0
  67. package/dist/scripts/getRandomProvider.d.ts.map +1 -0
  68. package/dist/scripts/getRandomProvider.js +38 -0
  69. package/dist/scripts/getRandomProvider.js.map +1 -0
  70. package/dist/scripts/getStorage.d.ts +2 -0
  71. package/dist/scripts/getStorage.d.ts.map +1 -0
  72. package/dist/scripts/getStorage.js +33 -0
  73. package/dist/scripts/getStorage.js.map +1 -0
  74. package/dist/scripts/getValidators.d.ts +2 -0
  75. package/dist/scripts/getValidators.d.ts.map +1 -0
  76. package/dist/scripts/getValidators.js +31 -0
  77. package/dist/scripts/getValidators.js.map +1 -0
  78. package/dist/scripts/hash.d.ts +2 -0
  79. package/dist/scripts/hash.d.ts.map +1 -0
  80. package/dist/scripts/hash.js +55 -0
  81. package/dist/scripts/hash.js.map +1 -0
  82. package/dist/scripts/hexToBytes.d.ts +2 -0
  83. package/dist/scripts/hexToBytes.d.ts.map +1 -0
  84. package/dist/scripts/hexToBytes.js +18 -0
  85. package/dist/scripts/hexToBytes.js.map +1 -0
  86. package/dist/scripts/mnemonicFromSeed.d.ts +2 -0
  87. package/dist/scripts/mnemonicFromSeed.d.ts.map +1 -0
  88. package/dist/scripts/mnemonicFromSeed.js +30 -0
  89. package/dist/scripts/mnemonicFromSeed.js.map +1 -0
  90. package/dist/scripts/populateTxAndSign.d.ts +2 -0
  91. package/dist/scripts/populateTxAndSign.d.ts.map +1 -0
  92. package/dist/scripts/populateTxAndSign.js +65 -0
  93. package/dist/scripts/populateTxAndSign.js.map +1 -0
  94. package/dist/scripts/sendFunds.d.ts +2 -0
  95. package/dist/scripts/sendFunds.d.ts.map +1 -0
  96. package/dist/scripts/sendFunds.js +32 -0
  97. package/dist/scripts/sendFunds.js.map +1 -0
  98. package/dist/setup/dapp.d.ts +4 -0
  99. package/dist/setup/dapp.d.ts.map +1 -0
  100. package/dist/setup/dapp.js +35 -0
  101. package/dist/setup/dapp.js.map +1 -0
  102. package/dist/setup/funds.d.ts +23 -0
  103. package/dist/setup/funds.d.ts.map +1 -0
  104. package/dist/setup/funds.js +100 -0
  105. package/dist/setup/funds.js.map +1 -0
  106. package/dist/setup/index.d.ts +5 -0
  107. package/dist/setup/index.d.ts.map +1 -0
  108. package/dist/setup/index.js +18 -0
  109. package/dist/setup/index.js.map +1 -0
  110. package/dist/setup/provider.d.ts +5 -0
  111. package/dist/setup/provider.d.ts.map +1 -0
  112. package/dist/setup/provider.js +84 -0
  113. package/dist/setup/provider.js.map +1 -0
  114. package/dist/setup/setup.d.ts +2 -0
  115. package/dist/setup/setup.d.ts.map +1 -0
  116. package/dist/setup/setup.js +150 -0
  117. package/dist/setup/setup.js.map +1 -0
  118. package/dist/util/exec.d.ts +10 -0
  119. package/dist/util/exec.d.ts.map +1 -0
  120. package/dist/util/exec.js +58 -0
  121. package/dist/util/exec.js.map +1 -0
  122. package/dist/util/index.d.ts +4 -0
  123. package/dist/util/index.d.ts.map +1 -0
  124. package/dist/util/index.js +17 -0
  125. package/dist/util/index.js.map +1 -0
  126. package/dist/util/loadContractFiles.d.ts +4 -0
  127. package/dist/util/loadContractFiles.d.ts.map +1 -0
  128. package/dist/util/loadContractFiles.js +54 -0
  129. package/dist/util/loadContractFiles.js.map +1 -0
  130. package/dist/util/updateEnv.d.ts +4 -0
  131. package/dist/util/updateEnv.d.ts.map +1 -0
  132. package/dist/util/updateEnv.js +45 -0
  133. package/dist/util/updateEnv.js.map +1 -0
  134. package/env.rococo +4 -0
  135. package/package.json +56 -0
  136. package/vite.config.ts +7 -0
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # Prosopo Dev Package
2
+
3
+ This package contains the scripts and configuration for setting up a development environment for Prosopo.
4
+
5
+ ## Prerequisites
6
+
7
+ - A unix-style environment (Linux, MacOS, WSL2)
8
+ - [Docker](https://docs.docker.com/get-docker/)
9
+ - [Node.js](https://nodejs.org/en/download/)
10
+
11
+ ## Dev Setup
12
+
13
+ ### Quickstart
14
+
15
+ ```bash
16
+ git clone https://github.com/prosopo/captcha
17
+ cd captcha
18
+ npm i
19
+ npm run bd dev
20
+ docker compose --file docker/docker-compose.development.yml up -d
21
+ cp ./dev/env.development ./dev/.env.development
22
+ npm run setup:all
23
+ ```
24
+
25
+ In different terminals run
26
+
27
+ #### Terminal 1
28
+ ```bash
29
+ npm run start:server
30
+ ```
31
+
32
+ #### Terminal 2
33
+ ```bash
34
+ npm run start:provider
35
+ ```
36
+
37
+ #### Terminal 3
38
+ ```bash
39
+ npm run start:demo
40
+ ```
41
+
42
+ Go to [http://localhost:3001](http://localhost:3001) in your browser.
43
+
44
+ ### In-depth
45
+
46
+ #### Set up Containers
47
+
48
+ Setup your integration containers by running the following command from the root of
49
+ the [scripts](https://github.com/prosopo/scripts) repository.
50
+
51
+ ```bash
52
+ docker compose --file ./docker/docker-compose.development.yml up -d
53
+ ```
54
+
55
+ This does the following:
56
+
57
+ 1. Pulls and starts a substrate node container containing pre-deployed [protocol](https://github.com/prosopo/protocol/)
58
+ 2. Pulls and starts up a mongodb container.
59
+
60
+ ##### Substrate Container Details
61
+
62
+ | Container Name | Description |
63
+ |---------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
64
+ | prosopo/substrate:dev-aura-aadbbed50ede27817158c7517f13f6f61c9cf000 | Substrate node with pre-deployed protocol at commit aadbbed50ede27817158c7517f13f6f61c9cf000. |
65
+ | prosopo/substrate-contracts-node:v0.25 | Substrate contracts node version 0.25 with no contracts. |
66
+ | prosopo/substrate-contracts-node:v0.24 | Substrate contracts node version 0.24 with no contracts. |
67
+
68
+ #### Install node modules
69
+
70
+ Install the node modules by running the following command from the root of the captcha workspace.
71
+
72
+ ```bash
73
+ npm i
74
+ ```
75
+
76
+ #### Build all packages
77
+
78
+ Build all packages by running the following command from the root of the captcha workspace.
79
+
80
+ ```bash
81
+ npm run bd dev
82
+ ```
83
+
84
+ #### Deploy contracts (Optional)
85
+
86
+ If you want to deploy your own protocol or dapp contract, you can do so by running the following command from the root
87
+ of the captcha workspace. Any .env files will be updated with the new contract addresses.
88
+
89
+ ```bash
90
+ npm run deploy_protocol
91
+ npm run deploy_dapp
92
+ npm run setup
93
+ ```
94
+
95
+ ##### Env file
96
+
97
+ You must have a valid env file in `./packages/dev/` for these commands to work. You can use the
98
+ file `./packages/env.development` as a template.
99
+
100
+ #### Set up a Provider and Register a Dapp
101
+
102
+ Providers are the nodes in the network that supply CAPTCHA. Run the following command from the root of the captcha
103
+ workspace to register a Provider and a Dapp in the Protocol contract and start the Provider API.
104
+
105
+ ```bash
106
+ npm run setup && npm run start
107
+ ```
108
+
109
+ **Protocol** and **Dapp** contracts **must** exist on the substrate node for the setup script to run.
110
+
111
+ ## Testing
112
+
113
+ ### Run tests
114
+
115
+ Run all the tests using the following command from the root of the captcha workspace.
116
+
117
+ ```bash
118
+ npm run test
119
+ ```
120
+
121
+ ### Workflow testing
122
+
123
+ The GitHub workflow runs the tests on an aura substrate node with 6s block times. A pre-deployed protocol contract is used
124
+ with the container prosopo/substrate:dev-aura-aadbbed50ede27817158c7517f13f6f61c9cf000. To test with this container, use
125
+ the docker compose file called `docker-compose.test.yml` in the scripts repository. Copy the template env.development
126
+ file to `.env.test` in the dev package so that the correct contract addresses are used.
127
+
128
+ ```bash
129
+ docker compose --file ./docker/docker-compose.development.yml down
130
+ docker compose --file ./docker/docker-compose.test.yml up -d
131
+ cp dev/env.development dev/.env.test
132
+ NODE_ENV=test npm run test
133
+ ```
@@ -0,0 +1,2 @@
1
+ export declare function processArgs(args: any): Promise<void>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AA8BA,wBAAsB,WAAW,CAAC,IAAI,KAAA,iBAiJrC"}
@@ -0,0 +1,145 @@
1
+ // Copyright 2021-2023 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { LogLevelSchema, getLogger } from '@prosopo/common';
15
+ import { deployDapp, deployProtocol } from '../contract/deploy/index.js';
16
+ import { exec } from '../util/index.js';
17
+ import { getLogLevel } from '@prosopo/common';
18
+ import { hideBin } from 'yargs/helpers';
19
+ import { importContract } from '../contract/index.js';
20
+ import { loadEnv } from '@prosopo/cli';
21
+ import { setup } from '../setup/index.js';
22
+ import { updateEnvFiles } from '../util/index.js';
23
+ import fs from 'fs';
24
+ import path from 'path';
25
+ import yargs from 'yargs';
26
+ const rootDir = path.resolve('.');
27
+ loadEnv(rootDir);
28
+ export async function processArgs(args) {
29
+ const parsed = await yargs(hideBin(args)).option('logLevel', {
30
+ describe: 'set log level',
31
+ choices: Object.keys(LogLevelSchema.enum),
32
+ }).argv;
33
+ const log = getLogger(getLogLevel(parsed.logLevel), 'CLI');
34
+ await yargs(hideBin(args))
35
+ .usage('Usage: $0 [global options] <command> [options]')
36
+ .command('deploy_protocol', 'Deploy the prosopo protocol contract', (yargs) => yargs
37
+ .option('update_env', {
38
+ type: 'boolean',
39
+ demand: false,
40
+ desc: 'Update env files with the new contract address',
41
+ default: false,
42
+ })
43
+ .option('deployer', {
44
+ type: 'string',
45
+ demand: false,
46
+ desc: `The account prefix that will deploy the contract. Specifying PROVIDER will cause the
47
+ script to look for PROVIDER_JSON in the env file. Specifying DEPLOYER will cause the script to
48
+ look for DEPLOYER_JSON in the env file. Defaults to undefined.`,
49
+ default: undefined,
50
+ }), async (argv) => {
51
+ if (!process.env.CAPTCHA_WASM_PATH || !process.env.CAPTCHA_ABI_PATH) {
52
+ throw new Error('Missing protocol wasm or json path');
53
+ }
54
+ const protocolContractAddress = await deployProtocol(process.env.CAPTCHA_WASM_PATH, process.env.CAPTCHA_ABI_PATH, argv.deployer);
55
+ log.info('contract address', protocolContractAddress);
56
+ if (argv.update_env) {
57
+ await updateEnvFiles([
58
+ 'PROTOCOL_CONTRACT_ADDRESS',
59
+ 'REACT_APP_PROSOPO_CONTRACT_ADDRESS',
60
+ 'NEXT_PUBLIC_PROSOPO_CONTRACT_ADDRESS',
61
+ ], protocolContractAddress.toString(), log);
62
+ }
63
+ }, [])
64
+ .command('deploy_dapp', 'Deploy the prosopo dapp example contract', (yargs) => yargs.option('update_env', {
65
+ type: 'boolean',
66
+ demand: false,
67
+ desc: 'Update env files with the new contract address',
68
+ default: false,
69
+ }), async (argv) => {
70
+ const dappContractAddress = await deployDapp();
71
+ log.info('contract address', dappContractAddress);
72
+ if (argv.update_env) {
73
+ await updateEnvFiles(['DAPP_SITE_KEY', 'REACT_APP_DAPP_SITE_KEY', 'NEXT_PUBLIC_DAPP_SITE_KEY', 'PROSOPO_SITE_KEY'], dappContractAddress.toString(), log);
74
+ }
75
+ }, [])
76
+ .command({
77
+ command: 'setup',
78
+ describe: 'Setup the development environment by registering a provider, staking, loading a data set and then registering a dapp and staking.',
79
+ builder: (yargs) => yargs.option('force', {
80
+ type: 'boolean',
81
+ demand: false,
82
+ desc: 'Force provider re-registration and dataset setup',
83
+ }),
84
+ handler: async (argv) => {
85
+ log.info('Running setup scripts');
86
+ await setup(argv.force);
87
+ },
88
+ })
89
+ .command({
90
+ command: 'import_contract',
91
+ describe: 'Import a contract into the contract package.',
92
+ builder: (yargs) => yargs
93
+ .option('in', {
94
+ type: 'string',
95
+ demand: true,
96
+ desc: "The path to the contract's abi",
97
+ })
98
+ .option('out', {
99
+ type: 'string',
100
+ demand: true,
101
+ desc: 'The path to the output directory',
102
+ }),
103
+ handler: async (argv) => {
104
+ const abiPath = path.resolve(argv.in);
105
+ const cwd = path.resolve('.');
106
+ if (!fs.existsSync(abiPath)) {
107
+ throw new Error(`abiPath ${abiPath} does not exist. The command is running relative to ${cwd}`);
108
+ }
109
+ const outPath = path.resolve(argv.out);
110
+ // pass in relative path as typechain will resolve it relative to the cwd
111
+ await importContract(argv.in, argv.out);
112
+ },
113
+ })
114
+ .command({
115
+ command: 'import_all_contracts',
116
+ describe: 'Update all contracts into the contract package.',
117
+ builder: (yargs) => yargs,
118
+ handler: async (argv) => {
119
+ const contracts = ['captcha', 'proxy'];
120
+ for (const contract of contracts) {
121
+ const inDir = `../protocol/target/ink/${contract}`;
122
+ const outDir = `../packages/contract/src/typechain/${contract}`;
123
+ await exec(`mkdir -p ${outDir}`);
124
+ await exec(`mkdir -p ${inDir}`);
125
+ // console.log(`${outDir}`)
126
+ // console.log(`${inDir}`)
127
+ await exec(`node dist/cli/index.js import_contract --in=${inDir} --out=${outDir}`);
128
+ // console.log(`${path.resolve('../packages/contract/src/typechain/captcha/types-arguments')}`)
129
+ // console.log(`${path.resolve('../packages/types/src/contract/typechain/captcha/types-arguments')}`)
130
+ await exec(`mkdir -p ../packages/types/src/contract/typechain/captcha`);
131
+ await exec(`cp -rv ../packages/contract/src/typechain/captcha/types-arguments ../packages/types/src/contract/typechain/captcha`);
132
+ await exec(`cp -rv ../packages/contract/src/typechain/captcha/types-returns ../packages/types/src/contract/typechain/captcha`);
133
+ }
134
+ },
135
+ }).argv;
136
+ }
137
+ processArgs(process.argv)
138
+ .then(() => {
139
+ process.exit(0);
140
+ })
141
+ .catch((error) => {
142
+ console.error(error);
143
+ process.exit(1);
144
+ });
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,C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
+ //# sourceMappingURL=dapp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dapp.d.ts","sourceRoot":"","sources":["../../../src/contract/deploy/dapp.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAe,MAAM,4BAA4B,CAAA;AAoBnE,wBAAsB,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAU9C"}
@@ -0,0 +1,41 @@
1
+ import { AbiJSON, Wasm } from '../../util/index.js';
2
+ import { ContractDeployer } from '@prosopo/contract';
3
+ import { ProviderEnvironment } from '@prosopo/env';
4
+ import { defaultConfig, getPairType, getSs58Format } from '@prosopo/cli';
5
+ import { getPair } from '@prosopo/common';
6
+ import { loadEnv } from '@prosopo/cli';
7
+ import { randomAsHex } from '@polkadot/util-crypto';
8
+ import path from 'path';
9
+ async function deploy(wasm, abi) {
10
+ const pairType = getPairType();
11
+ const ss58Format = getSs58Format();
12
+ const pair = await getPair(pairType, ss58Format, '//Alice');
13
+ const env = new ProviderEnvironment(pair, defaultConfig());
14
+ await env.isReady();
15
+ // initialSupply, faucetAmount, prosopoAccount, humanThreshold, recencyThreshold
16
+ const params = ['1000000000000000', 1000, process.env.PROTOCOL_CONTRACT_ADDRESS, 50, 1000000];
17
+ const deployer = new ContractDeployer(env.api, abi, wasm, env.pair, params, 0, 0, randomAsHex());
18
+ return await deployer.deploy();
19
+ }
20
+ export async function run() {
21
+ const wasm = await Wasm(path.resolve(process.env.DAPP_WASM_PATH || '.'));
22
+ const abi = await AbiJSON(path.resolve(process.env.DAPP_ABI_PATH || '.'));
23
+ const deployResult = await deploy(wasm, abi);
24
+ const instantiateEvent = deployResult.events.find((event) => event.event.section === 'contracts' && event.event.method === 'Instantiated');
25
+ console.log('instantiateEvent', instantiateEvent?.toHuman());
26
+ return instantiateEvent?.event.data['contract'].toString();
27
+ }
28
+ // run the script if the main process is running this file
29
+ if (typeof require !== 'undefined' && require.main === module) {
30
+ loadEnv(path.resolve('../..'));
31
+ run()
32
+ .then((deployResult) => {
33
+ console.log('Deployed with address', deployResult);
34
+ process.exit(0);
35
+ })
36
+ .catch((e) => {
37
+ console.error(e);
38
+ process.exit(1);
39
+ });
40
+ }
41
+ //# sourceMappingURL=dapp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dapp.js","sourceRoot":"","sources":["../../../src/contract/deploy/dapp.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,KAAK,UAAU,MAAM,CAAC,IAAgB,EAAE,GAAQ;IAC5C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;IAC3D,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IAC1D,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;IACnB,gFAAgF;IAChF,MAAM,MAAM,GAAG,CAAC,kBAAkB,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;IAC7F,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,E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AA;IACnB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;CACT"}
@@ -0,0 +1,3 @@
1
+ export { run as deployProtocol } from './protocol.js';
2
+ export { run as deployDapp } from './dapp.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contract/deploy/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,GAAG,IAAI,cAAc,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,GAAG,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2021-2023 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export { run as deployProtocol } from './protocol.js';
15
+ export { run as deployDapp } from './dapp.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contract/deploy/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,GAAG,IAAI,cAAc,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,GAAG,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { AccountId } from '@polkadot/types/interfaces';
2
+ export declare function run(wasmPath: string, abiPath: string, deployer?: string): Promise<AccountId>;
3
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/contract/deploy/protocol.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAe,MAAM,4BAA4B,CAAA;AA6BnE,wBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAYlG"}
@@ -0,0 +1,53 @@
1
+ import { AbiJSON, Wasm } from '../../util/index.js';
2
+ import { ContractDeployer } from '@prosopo/contract';
3
+ import { LogLevelSchema, getLogger, reverseHexString } from '@prosopo/common';
4
+ import { ProviderEnvironment } from '@prosopo/env';
5
+ import { defaultConfig, getPairType, getSecret, getSs58Format } from '@prosopo/cli';
6
+ import { getPair } from '@prosopo/common';
7
+ import { loadEnv } from '@prosopo/cli';
8
+ import { randomAsHex } from '@polkadot/util-crypto';
9
+ import path from 'path';
10
+ const log = getLogger(LogLevelSchema.enum.Info, 'dev.deploy');
11
+ async function deploy(wasm, abi, deployerPrefix) {
12
+ const pairType = getPairType();
13
+ const ss58Format = getSs58Format();
14
+ const secret = deployerPrefix ? getSecret(deployerPrefix) : '//Alice';
15
+ const pair = await getPair(pairType, ss58Format, secret);
16
+ const config = defaultConfig();
17
+ const env = new ProviderEnvironment(pair, config);
18
+ await env.isReady();
19
+ log.debug(reverseHexString(env.api.createType('u16', 10).toHex().toString()), 'max_user_history_len');
20
+ log.debug(reverseHexString(env.api.createType('BlockNumber', 32).toHex().toString()), 'max_user_history_age');
21
+ log.debug(reverseHexString(env.api.createType('u16', 1).toHex().toString()), 'min_num_active_providers');
22
+ const params = [];
23
+ const deployer = new ContractDeployer(env.api, abi, wasm, env.pair, params, 0, 0, randomAsHex());
24
+ return await deployer.deploy();
25
+ }
26
+ export async function run(wasmPath, abiPath, deployer) {
27
+ log.info('WASM Path', wasmPath);
28
+ log.info('ABI Path', abiPath);
29
+ const wasm = await Wasm(path.resolve(wasmPath));
30
+ const abi = await AbiJSON(path.resolve(abiPath));
31
+ const deployResult = await deploy(wasm, abi, deployer);
32
+ const instantiateEvent = deployResult.events.find((event) => event.event.section === 'contracts' && event.event.method === 'Instantiated');
33
+ log.info('instantiateEvent', instantiateEvent?.toHuman());
34
+ return instantiateEvent?.event.data['contract'].toString();
35
+ }
36
+ // run the script if the main process is running this file
37
+ if (typeof require !== 'undefined' && require.main === module) {
38
+ log.info('Loading env from', path.resolve('.'));
39
+ loadEnv(path.resolve('.'));
40
+ if (!process.env.CAPTCHA_WASM_PATH || !process.env.CAPTCHA_ABI_PATH) {
41
+ throw new Error('Missing protocol wasm or abi path');
42
+ }
43
+ run(process.env.CAPTCHA_WASM_PATH, process.env.CAPTCHA_ABI_PATH)
44
+ .then((deployResult) => {
45
+ log.info('Deployed with address', deployResult);
46
+ process.exit(0);
47
+ })
48
+ .catch((e) => {
49
+ console.error(e);
50
+ process.exit(1);
51
+ });
52
+ }
53
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/contract/deploy/protocol.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,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,EAAE,CAAA;AAC9D,CAAC;AACD,0DAA0D;AAC1D,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3D,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE;QACjE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;KACvD;IACD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;SAC3D,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;QACnB,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAA;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;CACT"}
@@ -0,0 +1,4 @@
1
+ import { ExecOutput } from '../util/index.js';
2
+ declare function importContract(relPathToABIs: string, relPathToOutput: string): Promise<ExecOutput>;
3
+ export default importContract;
4
+ //# sourceMappingURL=import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/contract/import.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAQ,MAAM,kBAAkB,CAAA;AAEnD,iBAAe,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAIjG;AAED,eAAe,cAAc,CAAA"}
@@ -0,0 +1,21 @@
1
+ // Copyright 2021-2023 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { exec } from '../util/index.js';
15
+ async function importContract(relPathToABIs, relPathToOutput) {
16
+ //TODO import typechain when it's working https://github.com/Brushfam/typechain-polkadot/issues/73
17
+ const cmd = `npx @727-ventures/typechain-polkadot --in ${relPathToABIs} --out ${relPathToOutput}`;
18
+ return exec(cmd);
19
+ }
20
+ export default importContract;
21
+ //# sourceMappingURL=import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/contract/import.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAc,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEnD,KAAK,UAAU,cAAc,CAAC,aAAqB,EAAE,eAAuB;IACxE,kGAAkG;IAClG,MAAM,GAAG,GAAG,6CAA6C,aAAa,UAAU,eAAe,EAAE,CAAA;IACjG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AACpB,CAAC;AAED,eAAe,cAAc,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { default as importContract } from './import.js';
2
+ export * from './deploy/index.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACvD,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2021-2023 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export { default as importContract } from './import.js';
15
+ export * from './deploy/index.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACvD,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './setup/index.js';
2
+ export * from './util/index.js';
3
+ export * from './cli/index.js';
4
+ export * from './contract/index.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // Copyright 2021-2023 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export * from './setup/index.js';
15
+ export * from './util/index.js';
16
+ export * from './cli/index.js';
17
+ export * from './contract/index.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=addCopyrightNotice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addCopyrightNotice.d.ts","sourceRoot":"","sources":["../../src/scripts/addCopyrightNotice.ts"],"names":[],"mappings":""}