@prosopo/scripts 0.1.17 → 0.1.18
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.
- package/package.json +54 -54
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -145
- package/dist/cli/index.js.map +0 -1
- package/dist/contract/deploy/dapp.d.ts +0 -3
- package/dist/contract/deploy/dapp.d.ts.map +0 -1
- package/dist/contract/deploy/dapp.js +0 -41
- package/dist/contract/deploy/dapp.js.map +0 -1
- package/dist/contract/deploy/index.d.ts +0 -3
- package/dist/contract/deploy/index.d.ts.map +0 -1
- package/dist/contract/deploy/index.js +0 -16
- package/dist/contract/deploy/index.js.map +0 -1
- package/dist/contract/deploy/protocol.d.ts +0 -3
- package/dist/contract/deploy/protocol.d.ts.map +0 -1
- package/dist/contract/deploy/protocol.js +0 -53
- package/dist/contract/deploy/protocol.js.map +0 -1
- package/dist/contract/import.d.ts +0 -4
- package/dist/contract/import.d.ts.map +0 -1
- package/dist/contract/import.js +0 -21
- package/dist/contract/import.js.map +0 -1
- package/dist/contract/index.d.ts +0 -3
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js +0 -16
- package/dist/contract/index.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/scripts/addCopyrightNotice.d.ts +0 -2
- package/dist/scripts/addCopyrightNotice.d.ts.map +0 -1
- package/dist/scripts/addCopyrightNotice.js +0 -103
- package/dist/scripts/addCopyrightNotice.js.map +0 -1
- package/dist/scripts/bytesToHex.d.ts +0 -2
- package/dist/scripts/bytesToHex.d.ts.map +0 -1
- package/dist/scripts/bytesToHex.js +0 -22
- package/dist/scripts/bytesToHex.js.map +0 -1
- package/dist/scripts/convertAccount.d.ts +0 -2
- package/dist/scripts/convertAccount.d.ts.map +0 -1
- package/dist/scripts/convertAccount.js +0 -37
- package/dist/scripts/convertAccount.js.map +0 -1
- package/dist/scripts/encodeDecode.d.ts +0 -2
- package/dist/scripts/encodeDecode.d.ts.map +0 -1
- package/dist/scripts/encodeDecode.js +0 -64
- package/dist/scripts/encodeDecode.js.map +0 -1
- package/dist/scripts/generateMnemonic.d.ts +0 -2
- package/dist/scripts/generateMnemonic.d.ts.map +0 -1
- package/dist/scripts/generateMnemonic.js +0 -28
- package/dist/scripts/generateMnemonic.js.map +0 -1
- package/dist/scripts/getBalance.d.ts +0 -2
- package/dist/scripts/getBalance.d.ts.map +0 -1
- package/dist/scripts/getBalance.js +0 -15
- package/dist/scripts/getBalance.js.map +0 -1
- package/dist/scripts/getBlock.d.ts +0 -2
- package/dist/scripts/getBlock.d.ts.map +0 -1
- package/dist/scripts/getBlock.js +0 -31
- package/dist/scripts/getBlock.js.map +0 -1
- package/dist/scripts/getContractInfoOf.d.ts +0 -2
- package/dist/scripts/getContractInfoOf.d.ts.map +0 -1
- package/dist/scripts/getContractInfoOf.js +0 -52
- package/dist/scripts/getContractInfoOf.js.map +0 -1
- package/dist/scripts/getExistentialDeposit.d.ts +0 -2
- package/dist/scripts/getExistentialDeposit.d.ts.map +0 -1
- package/dist/scripts/getExistentialDeposit.js +0 -39
- package/dist/scripts/getExistentialDeposit.js.map +0 -1
- package/dist/scripts/getRandomProvider.d.ts +0 -2
- package/dist/scripts/getRandomProvider.d.ts.map +0 -1
- package/dist/scripts/getRandomProvider.js +0 -38
- package/dist/scripts/getRandomProvider.js.map +0 -1
- package/dist/scripts/getStorage.d.ts +0 -2
- package/dist/scripts/getStorage.d.ts.map +0 -1
- package/dist/scripts/getStorage.js +0 -33
- package/dist/scripts/getStorage.js.map +0 -1
- package/dist/scripts/getValidators.d.ts +0 -2
- package/dist/scripts/getValidators.d.ts.map +0 -1
- package/dist/scripts/getValidators.js +0 -31
- package/dist/scripts/getValidators.js.map +0 -1
- package/dist/scripts/hash.d.ts +0 -2
- package/dist/scripts/hash.d.ts.map +0 -1
- package/dist/scripts/hash.js +0 -55
- package/dist/scripts/hash.js.map +0 -1
- package/dist/scripts/hexToBytes.d.ts +0 -2
- package/dist/scripts/hexToBytes.d.ts.map +0 -1
- package/dist/scripts/hexToBytes.js +0 -18
- package/dist/scripts/hexToBytes.js.map +0 -1
- package/dist/scripts/mnemonicFromSeed.d.ts +0 -2
- package/dist/scripts/mnemonicFromSeed.d.ts.map +0 -1
- package/dist/scripts/mnemonicFromSeed.js +0 -30
- package/dist/scripts/mnemonicFromSeed.js.map +0 -1
- package/dist/scripts/populateTxAndSign.d.ts +0 -2
- package/dist/scripts/populateTxAndSign.d.ts.map +0 -1
- package/dist/scripts/populateTxAndSign.js +0 -65
- package/dist/scripts/populateTxAndSign.js.map +0 -1
- package/dist/scripts/sendFunds.d.ts +0 -2
- package/dist/scripts/sendFunds.d.ts.map +0 -1
- package/dist/scripts/sendFunds.js +0 -32
- package/dist/scripts/sendFunds.js.map +0 -1
- package/dist/setup/dapp.d.ts +0 -4
- package/dist/setup/dapp.d.ts.map +0 -1
- package/dist/setup/dapp.js +0 -35
- package/dist/setup/dapp.js.map +0 -1
- package/dist/setup/funds.d.ts +0 -23
- package/dist/setup/funds.d.ts.map +0 -1
- package/dist/setup/funds.js +0 -100
- package/dist/setup/funds.js.map +0 -1
- package/dist/setup/index.d.ts +0 -5
- package/dist/setup/index.d.ts.map +0 -1
- package/dist/setup/index.js +0 -18
- package/dist/setup/index.js.map +0 -1
- package/dist/setup/provider.d.ts +0 -5
- package/dist/setup/provider.d.ts.map +0 -1
- package/dist/setup/provider.js +0 -84
- package/dist/setup/provider.js.map +0 -1
- package/dist/setup/setup.d.ts +0 -2
- package/dist/setup/setup.d.ts.map +0 -1
- package/dist/setup/setup.js +0 -150
- package/dist/setup/setup.js.map +0 -1
- package/dist/util/exec.d.ts +0 -10
- package/dist/util/exec.d.ts.map +0 -1
- package/dist/util/exec.js +0 -58
- package/dist/util/exec.js.map +0 -1
- package/dist/util/index.d.ts +0 -4
- package/dist/util/index.d.ts.map +0 -1
- package/dist/util/index.js +0 -17
- package/dist/util/index.js.map +0 -1
- package/dist/util/loadContractFiles.d.ts +0 -4
- package/dist/util/loadContractFiles.d.ts.map +0 -1
- package/dist/util/loadContractFiles.js +0 -54
- package/dist/util/loadContractFiles.js.map +0 -1
- package/dist/util/updateEnv.d.ts +0 -4
- package/dist/util/updateEnv.d.ts.map +0 -1
- package/dist/util/updateEnv.js +0 -45
- package/dist/util/updateEnv.js.map +0 -1
|
@@ -1,103 +0,0 @@
|
|
|
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 { glob } from 'glob';
|
|
15
|
-
import fs from 'fs';
|
|
16
|
-
const searchPaths = [
|
|
17
|
-
'../**/*.ts',
|
|
18
|
-
'../../**/*.ts',
|
|
19
|
-
'../../../**/*.ts',
|
|
20
|
-
'../**/*.tsx',
|
|
21
|
-
'../../**/*.tsx',
|
|
22
|
-
'../../../**/*.tsx',
|
|
23
|
-
'../**/*.rs',
|
|
24
|
-
'../../**/*.rs',
|
|
25
|
-
'../../../**/*.rs',
|
|
26
|
-
'../../../**/**/*.rs',
|
|
27
|
-
'../../../**/**/**/*.rs',
|
|
28
|
-
];
|
|
29
|
-
const files = glob.sync(searchPaths, {
|
|
30
|
-
cwd: __dirname,
|
|
31
|
-
absolute: true,
|
|
32
|
-
ignore: [
|
|
33
|
-
'node_modules/**',
|
|
34
|
-
'node_modules/**',
|
|
35
|
-
'../../**/node_modules/**',
|
|
36
|
-
'../node_modules/**',
|
|
37
|
-
'../../node_modules/**',
|
|
38
|
-
'../../../node_modules/**',
|
|
39
|
-
'**/dist/**',
|
|
40
|
-
'**/**/dist/**',
|
|
41
|
-
'../../dist/**',
|
|
42
|
-
'../../../packages/**/node_modules/**',
|
|
43
|
-
'../../../demos/**/node_modules/**',
|
|
44
|
-
'../../../packages/**/dist/**',
|
|
45
|
-
'../../../demos/**/dist/**',
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
console.log('Modding:\n', JSON.stringify(files, null, 4));
|
|
49
|
-
const header = `// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
50
|
-
//
|
|
51
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
52
|
-
// you may not use this file except in compliance with the License.
|
|
53
|
-
// You may obtain a copy of the License at
|
|
54
|
-
//
|
|
55
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
56
|
-
//
|
|
57
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
58
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
59
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
60
|
-
// See the License for the specific language governing permissions and
|
|
61
|
-
// limitations under the License.`;
|
|
62
|
-
// for each file, check if file starts with // Copyright (C) Prosopo (UK) Ltd.
|
|
63
|
-
for (const file of files) {
|
|
64
|
-
if (fs.lstatSync(file).isFile()) {
|
|
65
|
-
//check if file is a file, not a directory
|
|
66
|
-
const fileContents = fs.readFileSync(file, 'utf8');
|
|
67
|
-
const lines = fileContents.split('\n');
|
|
68
|
-
if (lines[0].startsWith('// Copyright')) {
|
|
69
|
-
//remove the old license and replace with the new one
|
|
70
|
-
// find the line containing `// along with Prosopo Procaptcha. If not, see <http://www.gnu.org/licenses/>.` and take the lines array from there
|
|
71
|
-
let count = 0;
|
|
72
|
-
let line = lines[count];
|
|
73
|
-
let lineStartsWithSlashes = line.startsWith('//');
|
|
74
|
-
while (lineStartsWithSlashes) {
|
|
75
|
-
lineStartsWithSlashes = line.startsWith('//');
|
|
76
|
-
if (lineStartsWithSlashes) {
|
|
77
|
-
line = lines[++count];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (!line.startsWith('//')) {
|
|
81
|
-
count = count - 1;
|
|
82
|
-
line = lines[count];
|
|
83
|
-
}
|
|
84
|
-
if (line.endsWith('If not, see <http://www.gnu.org/licenses/>.') ||
|
|
85
|
-
line.endsWith('// limitations under the License.')) {
|
|
86
|
-
const newFileContents = `${header}\n${lines.slice(count + 1).join('\n')}`;
|
|
87
|
-
if (newFileContents !== fileContents) {
|
|
88
|
-
//console.log(newFileContents)
|
|
89
|
-
fs.writeFileSync(file, newFileContents);
|
|
90
|
-
console.log('File Updated:', file);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// if it doesn't, add it
|
|
96
|
-
const newFileContents = `${header}\n${fileContents}`;
|
|
97
|
-
//console.log(newFileContents)
|
|
98
|
-
fs.writeFileSync(file, newFileContents);
|
|
99
|
-
console.log('File Updated:', file);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=addCopyrightNotice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addCopyrightNotice.js","sourceRoot":"","sources":["../../src/scripts/addCopyrightNotice.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,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAA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// 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
|
-
const arg = process.argv.slice(2)[0].trim();
|
|
15
|
-
console.log(`arg : ${arg}`);
|
|
16
|
-
const byteArray = arg.split(',').map((x) => parseInt(x));
|
|
17
|
-
const hex = Array.from(byteArray, function (byte) {
|
|
18
|
-
return ('0' + (byte & 0xff).toString(16)).slice(-2);
|
|
19
|
-
}).join('');
|
|
20
|
-
console.log(hex);
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=bytesToHex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bytesToHex.js","sourceRoot":"","sources":["../../src/scripts/bytesToHex.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;AAEjC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAC3C,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,CAAA;AAEpC,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AAExD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,IAAI;IAC5C,OAAO,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAEX,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertAccount.d.ts","sourceRoot":"","sources":["../../src/scripts/convertAccount.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
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 { decodeAddress, encodeAddress } from '@polkadot/keyring';
|
|
15
|
-
import { hexToU8a, isHex, u8aToHex } from '@polkadot/util';
|
|
16
|
-
import { isAddress } from '@polkadot/util-crypto';
|
|
17
|
-
const ss58Format = 42;
|
|
18
|
-
const arg = process.argv.slice(2)[0].trim();
|
|
19
|
-
let bytes = undefined;
|
|
20
|
-
let hex = undefined;
|
|
21
|
-
let ss58 = undefined;
|
|
22
|
-
if (isAddress(arg)) {
|
|
23
|
-
bytes = decodeAddress(arg);
|
|
24
|
-
}
|
|
25
|
-
else if (isHex(arg)) {
|
|
26
|
-
bytes = hexToU8a(arg);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// must be byte array in json format
|
|
30
|
-
bytes = new Uint8Array(JSON.parse(arg));
|
|
31
|
-
}
|
|
32
|
-
hex = hex || u8aToHex(bytes);
|
|
33
|
-
ss58 = ss58 || encodeAddress(hex, ss58Format);
|
|
34
|
-
console.log(`bytes: [${bytes}]`);
|
|
35
|
-
console.log(`hex: ${hex}`);
|
|
36
|
-
console.log(`ss58: ${ss58}`);
|
|
37
|
-
//# sourceMappingURL=convertAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertAccount.js","sourceRoot":"","sources":["../../src/scripts/convertAccount.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,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAE3C,IAAI,KAAK,GAA2B,SAAS,CAAA;AAC7C,IAAI,GAAG,GAAuB,SAAS,CAAA;AACvC,IAAI,IAAI,GAAuB,SAAS,CAAA;AAExC,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;IAChB,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;CAC7B;KAAM,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;IACnB,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;CACxB;KAAM;IACH,oCAAoC;IACpC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;CAC1C;AAED,GAAG,GAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC5B,IAAI,GAAG,IAAI,IAAI,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;AAE7C,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC,CAAA;AAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAA;AAC1B,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeDecode.d.ts","sourceRoot":"","sources":["../../src/scripts/encodeDecode.ts"],"names":[],"mappings":""}
|
|
@@ -1,64 +0,0 @@
|
|
|
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 { blake2AsHex, isAddress } from '@polkadot/util-crypto';
|
|
15
|
-
import { decodeAddress, encodeAddress } from '@polkadot/keyring';
|
|
16
|
-
import { hexToNumber, hexToString, hexToU8a, isHex, stringToHex, u8aToHex } from '@polkadot/util';
|
|
17
|
-
const ss58Format = 42;
|
|
18
|
-
const arg = process.argv.slice(2)[0].trim();
|
|
19
|
-
const argIsHex = isHex(arg);
|
|
20
|
-
const argIsAddress = isAddress(arg, false, ss58Format);
|
|
21
|
-
console.log(`arg : ${arg}`);
|
|
22
|
-
console.log(`arg length : ${arg.length}`);
|
|
23
|
-
console.log(`argIsAddress : ${argIsAddress}`);
|
|
24
|
-
console.log(`argIsHex : ${argIsHex}`);
|
|
25
|
-
if (argIsAddress) {
|
|
26
|
-
try {
|
|
27
|
-
const encodedAddress = encodeAddress(decodeAddress(arg, false, ss58Format), ss58Format);
|
|
28
|
-
const decodedAddress = decodeAddress(encodedAddress, false, ss58Format);
|
|
29
|
-
if (encodedAddress === arg) {
|
|
30
|
-
const hexAddress = u8aToHex(decodedAddress);
|
|
31
|
-
console.log(`Hex address ${hexAddress}`);
|
|
32
|
-
console.log(`Address bytes ${decodedAddress}`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.log(`Encoded address ${encodedAddress}`);
|
|
36
|
-
console.log(`Address as hex ${u8aToHex(decodeAddress(encodedAddress))}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
console.log(`Address encoding/decoding failed: ${e}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (argIsHex) {
|
|
44
|
-
console.log(`Decoding hex ${arg} to string`);
|
|
45
|
-
console.log(hexToString(arg));
|
|
46
|
-
console.log(`Decoding hex ${arg} to number`);
|
|
47
|
-
console.log(hexToNumber(arg));
|
|
48
|
-
console.log(`Uint8Array ${hexToU8a(stringToHex(arg))}`);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
console.log(`Hashing string ${arg} using blake2AsHex`);
|
|
52
|
-
console.log(blake2AsHex(arg));
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const u8a = new Uint8Array(JSON.parse(arg));
|
|
56
|
-
console.log(`Found uint8array ${u8a}`);
|
|
57
|
-
const hex = u8aToHex(u8a);
|
|
58
|
-
console.log(`Hex version ${hex}`);
|
|
59
|
-
console.log(`Encoded address ${encodeAddress(hex, ss58Format)}`);
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
console.log(`Not a uint8array ${e}`);
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=encodeDecode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeDecode.js","sourceRoot":"","sources":["../../src/scripts/encodeDecode.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,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEjG,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;AAC3B,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;AACtD,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,CAAA;AACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,CAAC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C,CAAA;CAC1D;KAAM;IACH,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,oBAAoB,CAAC,CAAA;IACtD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;CAChC;AAED,IAAI;IACA,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAC3C,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;IACzB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC,CAAA;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;CACnE;AAAC,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;CACvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateMnemonic.d.ts","sourceRoot":"","sources":["../../src/scripts/generateMnemonic.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +0,0 @@
|
|
|
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 { generateMnemonic } from '@prosopo/contract';
|
|
16
|
-
const logger = getLogger(LogLevelSchema.enum.Info, 'generateMnemonic');
|
|
17
|
-
async function mnemonic() {
|
|
18
|
-
const [mnemonic, address] = await generateMnemonic();
|
|
19
|
-
logger.debug(`Address: ${address}`);
|
|
20
|
-
logger.debug(`Mnemonic: ${mnemonic}`);
|
|
21
|
-
}
|
|
22
|
-
mnemonic()
|
|
23
|
-
.then(() => process.exit(0))
|
|
24
|
-
.catch((e) => {
|
|
25
|
-
console.error(e);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=generateMnemonic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateMnemonic.js","sourceRoot":"","sources":["../../src/scripts/generateMnemonic.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;AAEjC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,MAAM,GAAG,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;AAEtE,KAAK,UAAU,QAAQ;IACnB,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,MAAM,gBAAgB,EAAE,CAAA;IACpD,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,EAAE,CAAC,CAAA;IACnC,MAAM,CAAC,KAAK,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;AACzC,CAAC;AAED,QAAQ,EAAE;KACL,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3B,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../src/scripts/getBalance.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
//# sourceMappingURL=getBalance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../src/scripts/getBalance.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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBlock.d.ts","sourceRoot":"","sources":["../../src/scripts/getBlock.ts"],"names":[],"mappings":""}
|
package/dist/scripts/getBlock.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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 { ApiPromise, WsProvider } from '@polkadot/api';
|
|
15
|
-
async function run(blockNumber) {
|
|
16
|
-
// Construct
|
|
17
|
-
const provider = 'ws://localhost:9944';
|
|
18
|
-
const wsProvider = new WsProvider(provider);
|
|
19
|
-
const api = await ApiPromise.create({ provider: wsProvider });
|
|
20
|
-
// Do something
|
|
21
|
-
const blockHash = await api.rpc.chain.getBlockHash(blockNumber);
|
|
22
|
-
const block = await api.rpc.chain.getBlock(blockHash);
|
|
23
|
-
console.log(JSON.stringify(block.toJSON(), null, 2));
|
|
24
|
-
}
|
|
25
|
-
run(process.argv.slice(2)[0])
|
|
26
|
-
.then(() => process.exit(0))
|
|
27
|
-
.catch((error) => {
|
|
28
|
-
console.error(error);
|
|
29
|
-
process.exit(-1);
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=getBlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../src/scripts/getBlock.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,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//
|
|
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 { ApiPromise, WsProvider } from '@polkadot/api';
|
|
15
|
-
import { hideBin } from 'yargs/helpers';
|
|
16
|
-
import yargs from 'yargs';
|
|
17
|
-
const providers = {
|
|
18
|
-
local: { endpoint: 'ws://substrate-node:9944' },
|
|
19
|
-
polkadot: { endpoint: 'wss://rpc.polkadot.io' },
|
|
20
|
-
rococo: { endpoint: 'wss://rococo-contracts-rpc.polkadot.io:443' },
|
|
21
|
-
};
|
|
22
|
-
async function getContractInfoOf(contractAddress, provider) {
|
|
23
|
-
const wsProvider = new WsProvider(providers[provider].endpoint);
|
|
24
|
-
const api = await ApiPromise.create({ provider: wsProvider });
|
|
25
|
-
return await api.query.contracts.contractInfoOf(contractAddress);
|
|
26
|
-
}
|
|
27
|
-
async function run(argv) {
|
|
28
|
-
const parsed = await yargs(hideBin(argv))
|
|
29
|
-
.usage('Usage: [options]')
|
|
30
|
-
.option('contract', {
|
|
31
|
-
type: 'string',
|
|
32
|
-
demand: true,
|
|
33
|
-
desc: 'The contract to get the info of',
|
|
34
|
-
})
|
|
35
|
-
.option('network', {
|
|
36
|
-
type: 'string',
|
|
37
|
-
demand: false,
|
|
38
|
-
desc: 'The network to use',
|
|
39
|
-
})
|
|
40
|
-
.parse();
|
|
41
|
-
return await getContractInfoOf(parsed.contract, parsed.network ? parsed.network : 'development');
|
|
42
|
-
}
|
|
43
|
-
run(process.argv.slice(2))
|
|
44
|
-
.then((result) => {
|
|
45
|
-
console.log(result.toHuman());
|
|
46
|
-
process.exit();
|
|
47
|
-
})
|
|
48
|
-
.catch((error) => {
|
|
49
|
-
console.error(error);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=getContractInfoOf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getContractInfoOf.js","sourceRoot":"","sources":["../../src/scripts/getContractInfoOf.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,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,SAAS,GAAG;IACd,KAAK,EAAE,EAAE,QAAQ,EAAE,0BAA0B,EAAE;IAC/C,QAAQ,EAAE,EAAE,QAAQ,EAAE,uBAAuB,EAAE;IAC/C,MAAM,EAAE,EAAE,QAAQ,EAAE,4CAA4C,EAAE;CACrE,CAAA;AAED,KAAK,UAAU,iBAAiB,CAAC,eAAuB,EAAE,QAAgB;IACtE,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC/D,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAA;IAC7D,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;AACpE,CAAC;AAED,KAAK,UAAU,GAAG,CAAC,IAAI;IACnB,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACpC,KAAK,CAAC,mBAAmB,CAAC;SAC1B,MAAM,CAAC,UAAU,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,iCAAiC;KAC1C,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACf,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;KAC7B,CAAC;SACD,KAAK,EAAE,CAAA;IACZ,OAAO,MAAM,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;AACpG,CAAC;AACD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACrB,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAC7B,OAAO,CAAC,IAAI,EAAE,CAAA;AAClB,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getExistentialDeposit.d.ts","sourceRoot":"","sources":["../../src/scripts/getExistentialDeposit.ts"],"names":[],"mappings":""}
|
|
@@ -1,39 +0,0 @@
|
|
|
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 { ApiPromise, WsProvider } from '@polkadot/api';
|
|
15
|
-
import { oneUnit } from '@prosopo/contract';
|
|
16
|
-
async function run() {
|
|
17
|
-
// Construct
|
|
18
|
-
const provider = 'ws://localhost:9944';
|
|
19
|
-
// const provider = 'wss://shiden.public.blastapi.io'
|
|
20
|
-
const wsProvider = new WsProvider(provider);
|
|
21
|
-
const api = await ApiPromise.create({ provider: wsProvider });
|
|
22
|
-
// Do something
|
|
23
|
-
const existentialDeposit = await api.consts.balances.existentialDeposit;
|
|
24
|
-
const unit = await oneUnit(api);
|
|
25
|
-
const chainDecimals = api.registry.chainDecimals;
|
|
26
|
-
console.log('Chain decimal places:', chainDecimals);
|
|
27
|
-
console.log('One Unit:', unit.toString());
|
|
28
|
-
console.log('Existential Deposit:', existentialDeposit.toNumber());
|
|
29
|
-
console.log('Existential Deposit in UNITs:', existentialDeposit.div(unit).toNumber(), 'UNIT');
|
|
30
|
-
console.log('Existential Deposit Hex:', existentialDeposit.toHex?.());
|
|
31
|
-
return existentialDeposit;
|
|
32
|
-
}
|
|
33
|
-
run()
|
|
34
|
-
.then(() => process.exit(0))
|
|
35
|
-
.catch((error) => {
|
|
36
|
-
console.error(error);
|
|
37
|
-
process.exit(-1);
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=getExistentialDeposit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getExistentialDeposit.js","sourceRoot":"","sources":["../../src/scripts/getExistentialDeposit.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;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AC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AACpB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRandomProvider.d.ts","sourceRoot":"","sources":["../../src/scripts/getRandomProvider.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
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 { ProviderEnvironment } from '@prosopo/env';
|
|
15
|
-
import { Tasks } from '@prosopo/provider';
|
|
16
|
-
import { defaultConfig, getPairType, getSs58Format } from '@prosopo/cli';
|
|
17
|
-
import { generateMnemonic } from '@prosopo/contract';
|
|
18
|
-
import { getPair } from '@prosopo/common';
|
|
19
|
-
import dotenv from 'dotenv';
|
|
20
|
-
dotenv.config();
|
|
21
|
-
async function main() {
|
|
22
|
-
const pair = await getPair(getPairType(), getSs58Format(), '//Alice');
|
|
23
|
-
const env = new ProviderEnvironment(pair, defaultConfig());
|
|
24
|
-
await env.isReady();
|
|
25
|
-
const tasks = new Tasks(env);
|
|
26
|
-
const [mnemonic, address] = (await generateMnemonic(env.keyring)) || ['', ''];
|
|
27
|
-
const dappContractAccount = process.env.DAPP_SITE_KEY || '';
|
|
28
|
-
const provider = (await tasks.contract.query.getRandomActiveProvider(address, dappContractAccount)).value
|
|
29
|
-
.unwrap()
|
|
30
|
-
.unwrap();
|
|
31
|
-
console.log(provider);
|
|
32
|
-
process.exit();
|
|
33
|
-
}
|
|
34
|
-
main().catch((error) => {
|
|
35
|
-
console.error(error);
|
|
36
|
-
process.exit();
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=getRandomProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRandomProvider.js","sourceRoot":"","sources":["../../src/scripts/getRandomProvider.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,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,KAAK,UAAU,IAAI;IACf,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,EAAE,SAAS,CAAC,CAAA;IACrE,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IAC1D,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;IACnB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC7E,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAA;IAC3D,MAAM,QAAQ,GAAG,CAAC,MAAM,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK;SACpG,MAAM,EAAE;SACR,MAAM,EAAE,CAAA;IACb,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACrB,OAAO,CAAC,IAAI,EAAE,CAAA;AAClB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpB,OAAO,CAAC,IAAI,EAAE,CAAA;AAClB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStorage.d.ts","sourceRoot":"","sources":["../../src/scripts/getStorage.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
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 { ProviderEnvironment } from '@prosopo/env';
|
|
15
|
-
import { Tasks } from '@prosopo/provider';
|
|
16
|
-
import { defaultConfig, getPairType, getSs58Format } from '@prosopo/cli';
|
|
17
|
-
import { getPair } from '@prosopo/common';
|
|
18
|
-
import dotenv from 'dotenv';
|
|
19
|
-
dotenv.config();
|
|
20
|
-
async function main() {
|
|
21
|
-
const pair = await getPair(getPairType(), getSs58Format(), '//Alice');
|
|
22
|
-
const env = new ProviderEnvironment(pair, defaultConfig());
|
|
23
|
-
await env.isReady();
|
|
24
|
-
const tasks = new Tasks(env);
|
|
25
|
-
const dappAccounts = await tasks.contract['dappAccounts']();
|
|
26
|
-
console.log(dappAccounts.toHuman());
|
|
27
|
-
process.exit();
|
|
28
|
-
}
|
|
29
|
-
main().catch((error) => {
|
|
30
|
-
console.error(error);
|
|
31
|
-
process.exit();
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=getStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStorage.js","sourceRoot":"","sources":["../../src/scripts/getStorage.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,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,MAAM,CAAC,MAAM,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