@prosopo/types 0.2.32 → 0.2.36
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/dist/cjs/config/config.cjs +9 -7
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/networks/index.cjs +4 -4
- package/dist/cjs/procaptcha/collector.cjs +1 -0
- package/dist/cjs/procaptcha/index.cjs +1 -0
- package/dist/cjs/provider/api.cjs +19 -1
- package/dist/cjs/provider/argv.cjs +2 -2
- package/dist/cjs/provider/index.cjs +1 -0
- package/package.json +3 -3
- package/dist/cjs/contracts/captcha/dist/types-arguments/captcha.cjs +0 -62
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const common = require("@prosopo/common");
|
|
4
3
|
const network = require("./network.cjs");
|
|
5
4
|
const z = require("zod");
|
|
6
5
|
const index = require("../networks/index.cjs");
|
|
6
|
+
const LogLevel = z.enum(["trace", "debug", "info", "warn", "error", "fatal", "log"]);
|
|
7
7
|
const DatabaseTypes = z.enum(["mongo", "mongoMemory"]);
|
|
8
8
|
const EnvironmentTypesSchema = z.enum(["development", "staging", "production"]);
|
|
9
9
|
const DatabaseConfigSchema = z.record(
|
|
@@ -20,7 +20,7 @@ const BatchCommitConfigSchema = z.object({
|
|
|
20
20
|
maxBatchExtrinsicPercentage: z.number().positive().optional().default(59)
|
|
21
21
|
});
|
|
22
22
|
const ProsopoBaseConfigSchema = z.object({
|
|
23
|
-
logLevel:
|
|
23
|
+
logLevel: LogLevel.optional().default(LogLevel.enum.info),
|
|
24
24
|
defaultEnvironment: EnvironmentTypesSchema.default(EnvironmentTypesSchema.Values.production),
|
|
25
25
|
defaultNetwork: network.NetworkNamesSchema.default(network.NetworkNamesSchema.Values.rococo),
|
|
26
26
|
// The account with which to query the contract.merge sign transactions
|
|
@@ -61,8 +61,8 @@ const ProsopoClientConfigSchema = ProsopoBasicConfigSchema.merge(
|
|
|
61
61
|
dappName: z.string().optional().default("ProsopoClientDapp"),
|
|
62
62
|
serverUrl: z.string().optional()
|
|
63
63
|
})
|
|
64
|
-
)
|
|
65
|
-
const ProsopoServerConfigSchema = ProsopoClientConfigSchema.
|
|
64
|
+
);
|
|
65
|
+
const ProsopoServerConfigSchema = ProsopoClientConfigSchema.merge(
|
|
66
66
|
z.object({
|
|
67
67
|
serverUrl: z.string().url()
|
|
68
68
|
})
|
|
@@ -84,14 +84,15 @@ const ProcaptchaConfigSchema = ProsopoClientConfigSchema.and(
|
|
|
84
84
|
z.object({
|
|
85
85
|
accountCreator: AccountCreatorConfigSchema.optional(),
|
|
86
86
|
theme: ThemeType.optional(),
|
|
87
|
-
challengeValidLength: z.number().positive().optional()
|
|
87
|
+
challengeValidLength: z.number().positive().optional(),
|
|
88
|
+
devOnlyWatchEvents: z.boolean().optional()
|
|
88
89
|
})
|
|
89
90
|
);
|
|
90
91
|
const ProsopoConfigSchema = ProsopoBasicConfigSchema.merge(
|
|
91
92
|
z.object({
|
|
92
93
|
captchas: ProsopoCaptchaCountConfigSchema.optional().default({
|
|
93
94
|
solved: { count: 1 },
|
|
94
|
-
unsolved: { count:
|
|
95
|
+
unsolved: { count: 0 }
|
|
95
96
|
}),
|
|
96
97
|
captchaSolutions: ProsopoCaptchaSolutionConfigSchema.optional().default({
|
|
97
98
|
requiredNumberOfSolutions: 3,
|
|
@@ -102,7 +103,8 @@ const ProsopoConfigSchema = ProsopoBasicConfigSchema.merge(
|
|
|
102
103
|
interval: 300,
|
|
103
104
|
maxBatchExtrinsicPercentage: 59
|
|
104
105
|
}),
|
|
105
|
-
server: ProsopoImageServerConfigSchema
|
|
106
|
+
server: ProsopoImageServerConfigSchema,
|
|
107
|
+
mongoAtlasUri: z.string().optional()
|
|
106
108
|
})
|
|
107
109
|
);
|
|
108
110
|
exports.AccountCreatorConfigSchema = AccountCreatorConfigSchema;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -72,6 +72,7 @@ exports.DatasetSchema = dataset.DatasetSchema;
|
|
|
72
72
|
exports.DatasetWithIdsAndTreeSchema = dataset.DatasetWithIdsAndTreeSchema;
|
|
73
73
|
exports.DatasetWithIdsSchema = dataset.DatasetWithIdsSchema;
|
|
74
74
|
exports.DatasetWithNumericSolutionSchema = dataset.DatasetWithNumericSolutionSchema;
|
|
75
|
+
exports.AdminApiPaths = api.AdminApiPaths;
|
|
75
76
|
exports.ApiParams = api.ApiParams;
|
|
76
77
|
exports.ApiPaths = api.ApiPaths;
|
|
77
78
|
exports.CaptchaRequestBody = api.CaptchaRequestBody;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
const network = require("../config/network.cjs");
|
|
3
3
|
const pairTypeSr25519 = network.NetworkPairTypeSchema.parse("sr25519");
|
|
4
4
|
const getContractAddress = (defaultAddress) => {
|
|
5
|
-
return process.env.
|
|
5
|
+
return process.env.PROSOPO_CONTRACT_ADDRESS ? process.env.PROSOPO_CONTRACT_ADDRESS : defaultAddress || "";
|
|
6
6
|
};
|
|
7
7
|
const networks = () => {
|
|
8
8
|
return {
|
|
9
9
|
[network.NetworkNamesSchema.Values.development]: {
|
|
10
|
-
endpoint: process.env.
|
|
10
|
+
endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "ws://127.0.0.1:9944",
|
|
11
11
|
contract: {
|
|
12
12
|
name: "captcha",
|
|
13
13
|
address: getContractAddress("CONTRACT_NOT_DEPLOYED")
|
|
@@ -16,7 +16,7 @@ const networks = () => {
|
|
|
16
16
|
ss58Format: 42
|
|
17
17
|
},
|
|
18
18
|
[network.NetworkNamesSchema.Values.rococo]: {
|
|
19
|
-
endpoint: process.env.
|
|
19
|
+
endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "wss://rococo-contracts-rpc.polkadot.io:443",
|
|
20
20
|
contract: {
|
|
21
21
|
name: "captcha",
|
|
22
22
|
address: getContractAddress("5HiVWQhJrysNcFNEWf2crArKht16zrhro3FcekVWocyQjx5u")
|
|
@@ -25,7 +25,7 @@ const networks = () => {
|
|
|
25
25
|
ss58Format: 42
|
|
26
26
|
},
|
|
27
27
|
[network.NetworkNamesSchema.Values.shiden]: {
|
|
28
|
-
endpoint: process.env.
|
|
28
|
+
endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "wss://shiden.public.blastapi.io",
|
|
29
29
|
contract: {
|
|
30
30
|
address: getContractAddress("XpRox5bNg6YV8BHafsuHQ3b8i7gSq3GKPeYLA1b8EZwrDb3"),
|
|
31
31
|
name: "captcha"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const manager = require("./manager.cjs");
|
|
4
|
+
require("./collector.cjs");
|
|
4
5
|
exports.ProcaptchaOutputSchema = manager.ProcaptchaOutputSchema;
|
|
5
6
|
exports.ProcaptchaResponse = manager.ProcaptchaResponse;
|
|
@@ -9,8 +9,16 @@ var ApiPaths = /* @__PURE__ */ ((ApiPaths2) => {
|
|
|
9
9
|
ApiPaths2["VerifyCaptchaSolution"] = "/v1/prosopo/provider/verify";
|
|
10
10
|
ApiPaths2["GetProviderStatus"] = "/v1/prosopo/provider/status";
|
|
11
11
|
ApiPaths2["GetProviderDetails"] = "/v1/prosopo/provider/details";
|
|
12
|
+
ApiPaths2["SubmitUserEvents"] = "/v1/prosopo/provider/events";
|
|
12
13
|
return ApiPaths2;
|
|
13
14
|
})(ApiPaths || {});
|
|
15
|
+
var AdminApiPaths = /* @__PURE__ */ ((AdminApiPaths2) => {
|
|
16
|
+
AdminApiPaths2["BatchCommit"] = "/v1/prosopo/provider/admin/batch";
|
|
17
|
+
AdminApiPaths2["UpdateDataset"] = "/v1/prosopo/provider/admin/dataset";
|
|
18
|
+
AdminApiPaths2["ProviderDeregister"] = "/v1/prosopo/provider/admin/deregister";
|
|
19
|
+
AdminApiPaths2["ProviderUpdate"] = "/v1/prosopo/provider/admin/update";
|
|
20
|
+
return AdminApiPaths2;
|
|
21
|
+
})(AdminApiPaths || {});
|
|
14
22
|
var ApiParams = /* @__PURE__ */ ((ApiParams2) => {
|
|
15
23
|
ApiParams2["datasetId"] = "datasetId";
|
|
16
24
|
ApiParams2["user"] = "user";
|
|
@@ -23,6 +31,7 @@ var ApiParams = /* @__PURE__ */ ((ApiParams2) => {
|
|
|
23
31
|
ApiParams2["proof"] = "proof";
|
|
24
32
|
ApiParams2["providerUrl"] = "providerUrl";
|
|
25
33
|
ApiParams2["procaptchaResponse"] = "procaptcha-response";
|
|
34
|
+
ApiParams2["maxVerifiedTime"] = "maxVerifiedTime";
|
|
26
35
|
return ApiParams2;
|
|
27
36
|
})(ApiParams || {});
|
|
28
37
|
const CaptchaRequestBody = z.object({
|
|
@@ -67,6 +76,10 @@ const CaptchaSolutionBody = z.object({
|
|
|
67
76
|
// the signature to prove account ownership
|
|
68
77
|
});
|
|
69
78
|
const VerifySolutionBody = z.object({
|
|
79
|
+
[
|
|
80
|
+
"dapp"
|
|
81
|
+
/* dapp */
|
|
82
|
+
]: z.string(),
|
|
70
83
|
[
|
|
71
84
|
"user"
|
|
72
85
|
/* user */
|
|
@@ -74,8 +87,13 @@ const VerifySolutionBody = z.object({
|
|
|
74
87
|
[
|
|
75
88
|
"commitmentId"
|
|
76
89
|
/* commitmentId */
|
|
77
|
-
]: z.string().optional()
|
|
90
|
+
]: z.string().optional(),
|
|
91
|
+
[
|
|
92
|
+
"maxVerifiedTime"
|
|
93
|
+
/* maxVerifiedTime */
|
|
94
|
+
]: z.number().optional()
|
|
78
95
|
});
|
|
96
|
+
exports.AdminApiPaths = AdminApiPaths;
|
|
79
97
|
exports.ApiParams = ApiParams;
|
|
80
98
|
exports.ApiPaths = ApiPaths;
|
|
81
99
|
exports.CaptchaRequestBody = CaptchaRequestBody;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const typesArguments = require("@prosopo/captcha-contract/types-arguments");
|
|
4
4
|
const z = require("zod");
|
|
5
|
-
const PayeeSchema = z.nativeEnum(
|
|
5
|
+
const PayeeSchema = z.nativeEnum(typesArguments.Payee);
|
|
6
6
|
exports.PayeeSchema = PayeeSchema;
|
|
@@ -4,6 +4,7 @@ require("./accounts.cjs");
|
|
|
4
4
|
const api = require("./api.cjs");
|
|
5
5
|
const scheduler = require("./scheduler.cjs");
|
|
6
6
|
const argv = require("./argv.cjs");
|
|
7
|
+
exports.AdminApiPaths = api.AdminApiPaths;
|
|
7
8
|
exports.ApiParams = api.ApiParams;
|
|
8
9
|
exports.ApiPaths = api.ApiPaths;
|
|
9
10
|
exports.CaptchaRequestBody = api.CaptchaRequestBody;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/types",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "Types for prosopo TypeScript packages",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@polkadot/api-contract": "10.11.1",
|
|
41
41
|
"@polkadot/types": "10.11.1",
|
|
42
42
|
"@polkadot/types-codec": "10.11.1",
|
|
43
|
-
"@prosopo/common": "0.2.
|
|
44
|
-
"@prosopo/captcha-contract": "0.2.
|
|
43
|
+
"@prosopo/common": "0.2.36",
|
|
44
|
+
"@prosopo/captcha-contract": "0.2.36",
|
|
45
45
|
"consola": "^3.2.3",
|
|
46
46
|
"zod": "^3.22.3"
|
|
47
47
|
},
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
exports.Error = void 0;
|
|
4
|
-
(function(Error) {
|
|
5
|
-
Error["notAuthorised"] = "NotAuthorised";
|
|
6
|
-
Error["transferFailed"] = "TransferFailed";
|
|
7
|
-
Error["setCodeHashFailed"] = "SetCodeHashFailed";
|
|
8
|
-
Error["invalidDestination"] = "InvalidDestination";
|
|
9
|
-
Error["unknownMessage"] = "UnknownMessage";
|
|
10
|
-
Error["providerAccountExists"] = "ProviderAccountExists";
|
|
11
|
-
Error["providerExists"] = "ProviderExists";
|
|
12
|
-
Error["providerAccountDoesNotExist"] = "ProviderAccountDoesNotExist";
|
|
13
|
-
Error["providerDoesNotExist"] = "ProviderDoesNotExist";
|
|
14
|
-
Error["providerInsufficientFunds"] = "ProviderInsufficientFunds";
|
|
15
|
-
Error["providerInactive"] = "ProviderInactive";
|
|
16
|
-
Error["providerUrlUsed"] = "ProviderUrlUsed";
|
|
17
|
-
Error["dappExists"] = "DappExists";
|
|
18
|
-
Error["dappDoesNotExist"] = "DappDoesNotExist";
|
|
19
|
-
Error["dappInactive"] = "DappInactive";
|
|
20
|
-
Error["dappInsufficientFunds"] = "DappInsufficientFunds";
|
|
21
|
-
Error["captchaDataDoesNotExist"] = "CaptchaDataDoesNotExist";
|
|
22
|
-
Error["commitDoesNotExist"] = "CommitDoesNotExist";
|
|
23
|
-
Error["dappUserDoesNotExist"] = "DappUserDoesNotExist";
|
|
24
|
-
Error["noActiveProviders"] = "NoActiveProviders";
|
|
25
|
-
Error["datasetIdSolutionsSame"] = "DatasetIdSolutionsSame";
|
|
26
|
-
Error["codeNotFound"] = "CodeNotFound";
|
|
27
|
-
Error["unknown"] = "Unknown";
|
|
28
|
-
Error["invalidContract"] = "InvalidContract";
|
|
29
|
-
Error["invalidPayee"] = "InvalidPayee";
|
|
30
|
-
Error["invalidCaptchaStatus"] = "InvalidCaptchaStatus";
|
|
31
|
-
Error["noCorrectCaptcha"] = "NoCorrectCaptcha";
|
|
32
|
-
Error["notEnoughActiveProviders"] = "NotEnoughActiveProviders";
|
|
33
|
-
Error["providerFeeTooHigh"] = "ProviderFeeTooHigh";
|
|
34
|
-
Error["commitAlreadyExists"] = "CommitAlreadyExists";
|
|
35
|
-
Error["notAuthor"] = "NotAuthor";
|
|
36
|
-
})(exports.Error || (exports.Error = {}));
|
|
37
|
-
exports.LangError = void 0;
|
|
38
|
-
(function(LangError) {
|
|
39
|
-
LangError["couldNotReadInput"] = "CouldNotReadInput";
|
|
40
|
-
})(exports.LangError || (exports.LangError = {}));
|
|
41
|
-
exports.Payee = void 0;
|
|
42
|
-
(function(Payee) {
|
|
43
|
-
Payee["provider"] = "Provider";
|
|
44
|
-
Payee["dapp"] = "Dapp";
|
|
45
|
-
})(exports.Payee || (exports.Payee = {}));
|
|
46
|
-
exports.DappPayee = void 0;
|
|
47
|
-
(function(DappPayee) {
|
|
48
|
-
DappPayee["provider"] = "Provider";
|
|
49
|
-
DappPayee["dapp"] = "Dapp";
|
|
50
|
-
DappPayee["any"] = "Any";
|
|
51
|
-
})(exports.DappPayee || (exports.DappPayee = {}));
|
|
52
|
-
exports.GovernanceStatus = void 0;
|
|
53
|
-
(function(GovernanceStatus) {
|
|
54
|
-
GovernanceStatus["active"] = "Active";
|
|
55
|
-
GovernanceStatus["inactive"] = "Inactive";
|
|
56
|
-
})(exports.GovernanceStatus || (exports.GovernanceStatus = {}));
|
|
57
|
-
exports.CaptchaStatus = void 0;
|
|
58
|
-
(function(CaptchaStatus) {
|
|
59
|
-
CaptchaStatus["pending"] = "Pending";
|
|
60
|
-
CaptchaStatus["approved"] = "Approved";
|
|
61
|
-
CaptchaStatus["disapproved"] = "Disapproved";
|
|
62
|
-
})(exports.CaptchaStatus || (exports.CaptchaStatus = {}));
|