@prosopo/procaptcha 0.1.6 → 0.1.7

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 (94) hide show
  1. package/package.json +2 -2
  2. package/dist/api/AccountCreator.d.ts +0 -16
  3. package/dist/api/AccountCreator.d.ts.map +0 -1
  4. package/dist/api/AccountCreator.js +0 -58
  5. package/dist/api/AccountCreator.js.map +0 -1
  6. package/dist/api/AsyncFactory.d.ts +0 -7
  7. package/dist/api/AsyncFactory.d.ts.map +0 -1
  8. package/dist/api/AsyncFactory.js +0 -30
  9. package/dist/api/AsyncFactory.js.map +0 -1
  10. package/dist/api/ExtensionWeb2.d.ts +0 -24
  11. package/dist/api/ExtensionWeb2.d.ts.map +0 -1
  12. package/dist/api/ExtensionWeb2.js +0 -102
  13. package/dist/api/ExtensionWeb2.js.map +0 -1
  14. package/dist/api/ExtensionWeb3.d.ts +0 -23
  15. package/dist/api/ExtensionWeb3.d.ts.map +0 -1
  16. package/dist/api/ExtensionWeb3.js +0 -107
  17. package/dist/api/ExtensionWeb3.js.map +0 -1
  18. package/dist/api/HttpClientBase.d.ts +0 -9
  19. package/dist/api/HttpClientBase.d.ts.map +0 -1
  20. package/dist/api/HttpClientBase.js +0 -36
  21. package/dist/api/HttpClientBase.js.map +0 -1
  22. package/dist/api/ProsopoContract.d.ts +0 -13
  23. package/dist/api/ProsopoContract.d.ts.map +0 -1
  24. package/dist/api/ProsopoContract.js +0 -38
  25. package/dist/api/ProsopoContract.js.map +0 -1
  26. package/dist/api/ProsopoContractBase.d.ts +0 -32
  27. package/dist/api/ProsopoContractBase.d.ts.map +0 -1
  28. package/dist/api/ProsopoContractBase.js +0 -132
  29. package/dist/api/ProsopoContractBase.js.map +0 -1
  30. package/dist/api/ProviderApi.d.ts +0 -17
  31. package/dist/api/ProviderApi.d.ts.map +0 -1
  32. package/dist/api/ProviderApi.js +0 -56
  33. package/dist/api/ProviderApi.js.map +0 -1
  34. package/dist/api/handlers.d.ts +0 -5
  35. package/dist/api/handlers.d.ts.map +0 -1
  36. package/dist/api/handlers.js +0 -13
  37. package/dist/api/handlers.js.map +0 -1
  38. package/dist/api/index.d.ts +0 -8
  39. package/dist/api/index.d.ts.map +0 -1
  40. package/dist/api/index.js +0 -26
  41. package/dist/api/index.js.map +0 -1
  42. package/dist/index.d.ts +0 -4
  43. package/dist/index.d.ts.map +0 -1
  44. package/dist/index.js +0 -22
  45. package/dist/index.js.map +0 -1
  46. package/dist/modules/ProsopoCaptchaApi.d.ts +0 -20
  47. package/dist/modules/ProsopoCaptchaApi.d.ts.map +0 -1
  48. package/dist/modules/ProsopoCaptchaApi.js +0 -108
  49. package/dist/modules/ProsopoCaptchaApi.js.map +0 -1
  50. package/dist/modules/ProsopoCaptchaClient.d.ts +0 -26
  51. package/dist/modules/ProsopoCaptchaClient.d.ts.map +0 -1
  52. package/dist/modules/ProsopoCaptchaClient.js +0 -112
  53. package/dist/modules/ProsopoCaptchaClient.js.map +0 -1
  54. package/dist/modules/ProsopoCaptchaStateClient.d.ts +0 -18
  55. package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +0 -1
  56. package/dist/modules/ProsopoCaptchaStateClient.js +0 -107
  57. package/dist/modules/ProsopoCaptchaStateClient.js.map +0 -1
  58. package/dist/modules/client.d.ts +0 -9
  59. package/dist/modules/client.d.ts.map +0 -1
  60. package/dist/modules/client.js +0 -40
  61. package/dist/modules/client.js.map +0 -1
  62. package/dist/modules/contract.d.ts +0 -7
  63. package/dist/modules/contract.d.ts.map +0 -1
  64. package/dist/modules/contract.js +0 -42
  65. package/dist/modules/contract.js.map +0 -1
  66. package/dist/modules/extension.d.ts +0 -3
  67. package/dist/modules/extension.d.ts.map +0 -1
  68. package/dist/modules/extension.js +0 -31
  69. package/dist/modules/extension.js.map +0 -1
  70. package/dist/modules/index.d.ts +0 -8
  71. package/dist/modules/index.d.ts.map +0 -1
  72. package/dist/modules/index.js +0 -26
  73. package/dist/modules/index.js.map +0 -1
  74. package/dist/modules/storage.d.ts +0 -14
  75. package/dist/modules/storage.d.ts.map +0 -1
  76. package/dist/modules/storage.js +0 -35
  77. package/dist/modules/storage.js.map +0 -1
  78. package/dist/types/api.d.ts +0 -38
  79. package/dist/types/api.d.ts.map +0 -1
  80. package/dist/types/api.js +0 -22
  81. package/dist/types/api.js.map +0 -1
  82. package/dist/types/client.d.ts +0 -61
  83. package/dist/types/client.d.ts.map +0 -1
  84. package/dist/types/client.js +0 -3
  85. package/dist/types/client.js.map +0 -1
  86. package/dist/types/contract.d.ts +0 -5
  87. package/dist/types/contract.d.ts.map +0 -1
  88. package/dist/types/contract.js +0 -3
  89. package/dist/types/contract.js.map +0 -1
  90. package/dist/types/index.d.ts +0 -4
  91. package/dist/types/index.d.ts.map +0 -1
  92. package/dist/types/index.js +0 -22
  93. package/dist/types/index.js.map +0 -1
  94. package/tsconfig.tsbuildinfo +0 -1
@@ -1,18 +0,0 @@
1
- import { ICaptchaStateReducer, TCaptchaSubmitResult } from "../types/client";
2
- import { GetCaptchaResponse } from "../types/api";
3
- import { ProsopoCaptchaClient } from "./ProsopoCaptchaClient";
4
- import { CaptchaSolution } from "@prosopo/contract";
5
- export declare class ProsopoCaptchaStateClient {
6
- context: ProsopoCaptchaClient;
7
- manager: ICaptchaStateReducer;
8
- constructor(context: ProsopoCaptchaClient, manager: ICaptchaStateReducer);
9
- onLoadCaptcha(): Promise<void>;
10
- onCancel(): void;
11
- onSubmit(): Promise<void>;
12
- onSolved(submitResult: TCaptchaSubmitResult): Promise<void>;
13
- onChange(hash: string): void;
14
- dismissCaptcha(): void;
15
- parseSolution(captchaChallenge: GetCaptchaResponse, captchaSolution: string[][]): CaptchaSolution[];
16
- }
17
- export default ProsopoCaptchaStateClient;
18
- //# sourceMappingURL=ProsopoCaptchaStateClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProsopoCaptchaStateClient.d.ts","sourceRoot":"","sources":["../../src/modules/ProsopoCaptchaStateClient.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACH,eAAe,EAGlB,MAAM,mBAAmB,CAAC;AAG3B,qBAAa,yBAAyB;IAE3B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,oBAAoB,CAAC;gBAEzB,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,oBAAoB;IAK3D,aAAa;IAqBnB,QAAQ;IAOF,QAAQ;IAsDR,QAAQ,CAAC,YAAY,EAAE,oBAAoB;IAajD,QAAQ,CAAC,IAAI,EAAE,MAAM;IAerB,cAAc;IAKd,aAAa,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,GAAG,eAAe,EAAE;CAc7G;AAED,eAAe,yBAAyB,CAAC"}
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProsopoCaptchaStateClient = void 0;
4
- const contract_1 = require("@prosopo/contract");
5
- class ProsopoCaptchaStateClient {
6
- context;
7
- manager;
8
- constructor(context, manager) {
9
- this.context = context;
10
- this.manager = manager;
11
- }
12
- async onLoadCaptcha() {
13
- let captchaChallenge;
14
- try {
15
- captchaChallenge = await this.context.getCaptchaApi()?.getCaptchaChallenge();
16
- }
17
- catch (err) {
18
- captchaChallenge = err;
19
- throw new contract_1.ProsopoEnvError(captchaChallenge);
20
- }
21
- if (this.context.callbacks?.onLoadCaptcha && captchaChallenge) {
22
- this.context.callbacks.onLoadCaptcha(captchaChallenge);
23
- }
24
- if (captchaChallenge instanceof Error) {
25
- captchaChallenge = undefined;
26
- }
27
- this.manager.update({ captchaChallenge, captchaIndex: 0 });
28
- }
29
- onCancel() {
30
- if (this.context.callbacks?.onCancel) {
31
- this.context.callbacks.onCancel();
32
- }
33
- this.dismissCaptcha();
34
- }
35
- async onSubmit() {
36
- const { captchaChallenge, captchaIndex, captchaSolution } = this.manager.state;
37
- const nextCaptchaIndex = captchaIndex + 1;
38
- if (nextCaptchaIndex < captchaChallenge.captchas.length) {
39
- captchaSolution[nextCaptchaIndex] = [];
40
- this.manager.update({ captchaIndex: nextCaptchaIndex, captchaSolution });
41
- return;
42
- }
43
- const signer = this.context.getExtension().getExtension()?.signer;
44
- const currentCaptcha = captchaChallenge.captchas[captchaIndex];
45
- const { datasetId } = currentCaptcha.captcha;
46
- const solutions = this.parseSolution(captchaChallenge, captchaSolution);
47
- let submitResult;
48
- if (signer) {
49
- try {
50
- submitResult = await this.context
51
- .getCaptchaApi()
52
- .submitCaptchaSolution(signer, captchaChallenge.requestHash, datasetId, solutions);
53
- }
54
- catch (err) {
55
- submitResult = err;
56
- }
57
- if (this.context.callbacks?.onSubmit) {
58
- this.context.callbacks.onSubmit(submitResult, this.manager.state);
59
- }
60
- this.manager.update({ captchaSolution: [] });
61
- if (submitResult instanceof Error) {
62
- return;
63
- }
64
- await this.onSolved(submitResult);
65
- }
66
- this.manager.update({ captchaSolution: [] });
67
- }
68
- async onSolved(submitResult) {
69
- let isHuman;
70
- try {
71
- isHuman = await this.context.getContract()?.dappOperatorIsHumanUser(this.context.manager.state.config['solutionThreshold']);
72
- }
73
- catch (err) {
74
- console.log("Error determining whether user is human");
75
- }
76
- this.dismissCaptcha();
77
- if (this.context.callbacks?.onSolved) {
78
- this.context.callbacks.onSolved(submitResult, isHuman);
79
- }
80
- }
81
- onChange(hash) {
82
- const { captchaIndex, captchaSolution } = this.manager.state;
83
- let currentSolution = captchaSolution[captchaIndex] || [];
84
- currentSolution = currentSolution.includes(hash) ? currentSolution.filter(item => item !== hash) : [...currentSolution, hash];
85
- captchaSolution[captchaIndex] = currentSolution;
86
- if (this.context.callbacks?.onChange) {
87
- this.context.callbacks.onChange(captchaSolution, captchaIndex);
88
- }
89
- this.manager.update({ captchaSolution });
90
- }
91
- dismissCaptcha() {
92
- this.manager.update({ captchaChallenge: undefined });
93
- }
94
- parseSolution(captchaChallenge, captchaSolution) {
95
- const parsedSolution = [];
96
- for (const [index, challenge] of captchaChallenge.captchas.entries()) {
97
- const solution = captchaSolution[index] || [];
98
- // challenge.captcha.solution = solution;
99
- parsedSolution[index] = (0, contract_1.convertCaptchaToCaptchaSolution)({ ...challenge.captcha, solution });
100
- }
101
- console.log("CAPTCHA SOLUTIONS", parsedSolution);
102
- return parsedSolution;
103
- }
104
- }
105
- exports.ProsopoCaptchaStateClient = ProsopoCaptchaStateClient;
106
- exports.default = ProsopoCaptchaStateClient;
107
- //# sourceMappingURL=ProsopoCaptchaStateClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProsopoCaptchaStateClient.js","sourceRoot":"","sources":["../../src/modules/ProsopoCaptchaStateClient.ts"],"names":[],"mappings":";;;AAmBA,gDAI2B;AAG3B,MAAa,yBAAyB;IAE3B,OAAO,CAAuB;IAC9B,OAAO,CAAuB;IAErC,YAAY,OAA6B,EAAE,OAA6B;QACpE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,aAAa;QACtB,IAAI,gBAAwD,CAAC;QAE7D,IAAI;YACA,gBAAgB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,mBAAmB,EAAE,CAAC;SAChF;QAAC,OAAO,GAAG,EAAE;YACV,gBAAgB,GAAG,GAAY,CAAC;YAChC,MAAM,IAAI,0BAAe,CAAC,gBAAgB,CAAC,CAAA;SAC9C;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,IAAI,gBAAgB,EAAE;YAC3D,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;SAC1D;QAED,IAAI,g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0 @@
1
- import { ICaptchaContextState, ICaptchaState, ICaptchaStatusState, ICaptchaStatusReducerAction } from '../types';
2
- export declare const captchaContextReducer: (state: ICaptchaContextState, action: Partial<ICaptchaContextState>) => {
3
- config: import("../types").ProsopoCaptchaConfig;
4
- contractAddress?: string | undefined;
5
- account?: import("@polkadot/extension-inject/types").InjectedAccountWithMeta | undefined;
6
- };
7
- export declare const captchaStateReducer: (state: ICaptchaState, action: Partial<ICaptchaState>) => ICaptchaState;
8
- export declare const captchaStatusReducer: (state: ICaptchaStatusState, action: ICaptchaStatusReducerAction) => ICaptchaStatusState;
9
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/modules/client.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGjH,eAAO,MAAM,qBAAqB,UAAW,oBAAoB,UAAU,QAAQ,oBAAoB,CAAC;;;;CAEvG,CAAA;AAED,eAAO,MAAM,mBAAmB,UAAW,aAAa,UAAU,QAAQ,aAAa,CAAC,KAAG,aAE1F,CAAA;AAED,eAAO,MAAM,oBAAoB,UAAW,mBAAmB,UAAU,2BAA2B,KAAG,mBAWtG,CAAA"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
3
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
4
- //
5
- // procaptcha is free software: you can redistribute it and/or modify
6
- // it under the terms of the GNU General Public License as published by
7
- // the Free Software Foundation, either version 3 of the License, or
8
- // (at your option) any later version.
9
- //
10
- // procaptcha is distributed in the hope that it will be useful,
11
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- // GNU General Public License for more details.
14
- //
15
- // You should have received a copy of the GNU General Public License
16
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.captchaStatusReducer = exports.captchaStateReducer = exports.captchaContextReducer = void 0;
19
- const captchaContextReducer = (state, action) => {
20
- return { ...state, ...action };
21
- };
22
- exports.captchaContextReducer = captchaContextReducer;
23
- const captchaStateReducer = (state, action) => {
24
- return { ...state, ...action };
25
- };
26
- exports.captchaStateReducer = captchaStateReducer;
27
- const captchaStatusReducer = (state, action) => {
28
- const logger = { info: console.log, error: console.error };
29
- for (const key in action) {
30
- logger[key](action[key]);
31
- let status = Array.isArray(action[key]) ? action[key][1] : action[key];
32
- if (status instanceof Error) {
33
- status = status.message;
34
- }
35
- return { [key]: String(status) };
36
- }
37
- return state;
38
- };
39
- exports.captchaStatusReducer = captchaStatusReducer;
40
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/modules/client.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;;;AAK/D,MAAM,qBAAqB,GAAG,CAAC,KAA2B,EAAE,MAAqC,EAAE,EAAE;IACxG,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;AACnC,CAAC,CAAA;AAFY,QAAA,qBAAqB,yBAEjC;AAEM,MAAM,mBAAmB,GAAG,CAAC,KAAoB,EAAE,MAA8B,EAAiB,EAAE;IACvG,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;AACnC,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B;AAEM,MAAM,oBAAoB,GAAG,CAAC,KAA0B,EAAE,MAAmC,EAAuB,EAAE;IACzH,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;IAC3D,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvE,IAAI,MAAM,YAAY,KAAK,EAAE;YACzB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;SAC3B;QACD,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAA;AAXY,QAAA,oBAAoB,wBAWhC"}
@@ -1,7 +0,0 @@
1
- import ProsopoContract from "../api/ProsopoContract";
2
- import { WsProvider } from "@polkadot/rpc-provider";
3
- import { InjectedAccountWithMeta } from "@polkadot/extension-inject/types";
4
- import { ProviderInterface } from "@polkadot/rpc-provider/types";
5
- export declare function getWsProvider(url?: string): WsProvider;
6
- export declare function getProsopoContract(address: string, dappAddress: string, account: InjectedAccountWithMeta, providerInterface?: ProviderInterface): Promise<ProsopoContract>;
7
- //# sourceMappingURL=contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/modules/contract.ts"],"names":[],"mappings":"AAeA,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAgB,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAEhL"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProsopoContract = exports.getWsProvider = void 0;
4
- const tslib_1 = require("tslib");
5
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
6
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
7
- //
8
- // procaptcha is free software: you can redistribute it and/or modify
9
- // it under the terms of the GNU General Public License as published by
10
- // the Free Software Foundation, either version 3 of the License, or
11
- // (at your option) any later version.
12
- //
13
- // procaptcha is distributed in the hope that it will be useful,
14
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- // GNU General Public License for more details.
17
- //
18
- // You should have received a copy of the GNU General Public License
19
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
20
- const ProsopoContract_1 = tslib_1.__importDefault(require("../api/ProsopoContract"));
21
- const rpc_provider_1 = require("@polkadot/rpc-provider");
22
- function getWsProvider(url) {
23
- return new rpc_provider_1.WsProvider(url);
24
- }
25
- exports.getWsProvider = getWsProvider;
26
- async function getProsopoContract(address, dappAddress, account, providerInterface) {
27
- return await ProsopoContract_1.default.create(address, dappAddress, account, providerInterface ?? getWsProvider());
28
- }
29
- exports.getProsopoContract = getProsopoContract;
30
- // export async function getWsProvider(url?: string): Promise<WsProvider> {
31
- // const provider = new WsProvider(url, 0);
32
- // try {
33
- // await provider.connect();
34
- // } catch (err) {
35
- // throw new ProsopoEnvError(`${err.message} ${url}`);
36
- // }
37
- // return provider;
38
- // }
39
- // export async function getProsopoContract(address: string, dappAddress: string, account: InjectedAccountWithMeta, url?: string): Promise<ProsopoContract> {
40
- // return await ProsopoContract.create(address, dappAddress, account, await getWsProvider(url));
41
- // }
42
- //# sourceMappingURL=contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/modules/contract.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qFAAqD;AACrD,yDAAkE;AAIlE,SAAgB,aAAa,CAAC,GAAY;IACtC,OAAO,IAAI,yBAAU,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAFD,sCAEC;AAEM,KAAK,UAAU,kBAAkB,CAAC,OAAe,EAAE,WAAmB,EAAE,OAAgC,EAAE,iBAAqC;IAClJ,OAAO,MAAM,yBAAe,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,IAAI,aAAa,EAAE,CAAC,CAAC;AAC7G,CAAC;AAFD,gDAEC;AAED,2EAA2E;AAC3E,+CAA+C;AAC/C,YAAY;AACZ,oCAAoC;AACpC,sBAAsB;AACtB,8DAA8D;AAC9D,QAAQ;AACR,uBAAuB;AACvB,IAAI;AAEJ,6JAA6J;AAC7J,oGAAoG;AACpG,IAAI"}
@@ -1,3 +0,0 @@
1
- import { IExtensionInterface } from "../types/index";
2
- export declare function getExtension(web2: boolean): Promise<IExtensionInterface>;
3
- //# sourceMappingURL=extension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/modules/extension.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAEnD,wBAAsB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM9E"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExtension = void 0;
4
- const tslib_1 = require("tslib");
5
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
6
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
7
- //
8
- // procaptcha is free software: you can redistribute it and/or modify
9
- // it under the terms of the GNU General Public License as published by
10
- // the Free Software Foundation, either version 3 of the License, or
11
- // (at your option) any later version.
12
- //
13
- // procaptcha is distributed in the hope that it will be useful,
14
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- // GNU General Public License for more details.
17
- //
18
- // You should have received a copy of the GNU General Public License
19
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
20
- const ExtensionWeb2_1 = tslib_1.__importDefault(require("../api/ExtensionWeb2"));
21
- const ExtensionWeb3_1 = tslib_1.__importDefault(require("../api/ExtensionWeb3"));
22
- async function getExtension(web2) {
23
- if (web2) {
24
- return await ExtensionWeb2_1.default.create();
25
- }
26
- else {
27
- return await ExtensionWeb3_1.default.create();
28
- }
29
- }
30
- exports.getExtension = getExtension;
31
- //# sourceMappingURL=extension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/modules/extension.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,iFAAiD;AACjD,iFAAiD;AAG1C,KAAK,UAAU,YAAY,CAAC,IAAa;IAC5C,IAAI,IAAI,EAAE;QACN,OAAO,MAAM,uBAAa,CAAC,MAAM,EAAE,CAAC;KACvC;SAAM;QACH,OAAO,MAAM,uBAAa,CAAC,MAAM,EAAE,CAAC;KACvC;AACL,CAAC;AAND,oCAMC"}
@@ -1,8 +0,0 @@
1
- export * from './contract';
2
- export * from './extension';
3
- export * from './storage';
4
- export * from './client';
5
- export * from './ProsopoCaptchaApi';
6
- export * from './ProsopoCaptchaClient';
7
- export * from './ProsopoCaptchaStateClient';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAeA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
5
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
6
- //
7
- // procaptcha is free software: you can redistribute it and/or modify
8
- // it under the terms of the GNU General Public License as published by
9
- // the Free Software Foundation, either version 3 of the License, or
10
- // (at your option) any later version.
11
- //
12
- // procaptcha is distributed in the hope that it will be useful,
13
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- // GNU General Public License for more details.
16
- //
17
- // You should have received a copy of the GNU General Public License
18
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
19
- tslib_1.__exportStar(require("./contract"), exports);
20
- tslib_1.__exportStar(require("./extension"), exports);
21
- tslib_1.__exportStar(require("./storage"), exports);
22
- tslib_1.__exportStar(require("./client"), exports);
23
- tslib_1.__exportStar(require("./ProsopoCaptchaApi"), exports);
24
- tslib_1.__exportStar(require("./ProsopoCaptchaClient"), exports);
25
- tslib_1.__exportStar(require("./ProsopoCaptchaStateClient"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,mDAAyB;AACzB,8DAAoC;AACpC,iEAAuC;AACvC,sEAA4C"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Sets default `account`
3
- */
4
- declare function setAccount(account: string): void;
5
- /**
6
- * Gets default `account`
7
- */
8
- declare function getAccount(): string | null;
9
- declare const _default: {
10
- setAccount: typeof setAccount;
11
- getAccount: typeof getAccount;
12
- };
13
- export default _default;
14
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,QAElC;AAED;;GAEG;AACH,iBAAS,UAAU,IAAI,MAAM,GAAG,IAAI,CAEnC;;;;;AAED,wBAGC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
4
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
5
- //
6
- // procaptcha is free software: you can redistribute it and/or modify
7
- // it under the terms of the GNU General Public License as published by
8
- // the Free Software Foundation, either version 3 of the License, or
9
- // (at your option) any later version.
10
- //
11
- // procaptcha is distributed in the hope that it will be useful,
12
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- // GNU General Public License for more details.
15
- //
16
- // You should have received a copy of the GNU General Public License
17
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
18
- const CURRENT_ACCOUNT_KEY = "@prosopo/current_account";
19
- /**
20
- * Sets default `account`
21
- */
22
- function setAccount(account) {
23
- localStorage.setItem(CURRENT_ACCOUNT_KEY, account);
24
- }
25
- /**
26
- * Gets default `account`
27
- */
28
- function getAccount() {
29
- return localStorage.getItem(CURRENT_ACCOUNT_KEY);
30
- }
31
- exports.default = {
32
- setAccount,
33
- getAccount
34
- };
35
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":";;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAEvD;;GAEG;AACH,SAAS,UAAU,CAAC,OAAe;IAC/B,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,SAAS,UAAU;IACf,OAAO,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAED,kBAAe;IACX,UAAU;IACV,UAAU;CACb,CAAA"}
@@ -1,38 +0,0 @@
1
- import { Captcha } from "@prosopo/contract";
2
- export interface ProsopoRandomProviderResponse {
3
- providerId: string;
4
- blockNumber: string;
5
- provider: ProposoProvider;
6
- }
7
- export declare type ProsopoDappOperatorIsHumanUserResponse = boolean;
8
- export interface ProposoProvider {
9
- balance: string;
10
- captchaDatasetId: string;
11
- fee: string;
12
- payee: string;
13
- serviceOrigin: string;
14
- status: string;
15
- }
16
- export interface CaptchaResponseCaptcha {
17
- captcha: Omit<Captcha, 'solution'>;
18
- proof: string[][];
19
- }
20
- export interface GetCaptchaResponse {
21
- captchas: CaptchaResponseCaptcha[];
22
- requestHash: string;
23
- }
24
- export interface CaptchaSolutionResponse {
25
- captchas: CaptchaResponseCaptcha[];
26
- status: string;
27
- partialFee: string;
28
- }
29
- export interface ProsopoCaptchaConfig {
30
- "providerApi.baseURL": string;
31
- "providerApi.prefix": string;
32
- "dappAccount": string;
33
- "dappUrl": string;
34
- "solutionThreshold": number;
35
- "web2": boolean;
36
- "prosopoContractAccount": string;
37
- }
38
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,oBAAY,sCAAsC,GAAG,OAAO,CAAA;AAE5D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;CAClC"}
package/dist/types/api.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
3
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
4
- //
5
- // procaptcha is free software: you can redistribute it and/or modify
6
- // it under the terms of the GNU General Public License as published by
7
- // the Free Software Foundation, either version 3 of the License, or
8
- // (at your option) any later version.
9
- //
10
- // procaptcha is distributed in the hope that it will be useful,
11
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- // GNU General Public License for more details.
14
- //
15
- // You should have received a copy of the GNU General Public License
16
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
17
- // declare module "*.json" {
18
- // const value: any;
19
- // export default value;
20
- // }
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- //# sourceMappingURL=api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,4BAA4B;AAC5B,sBAAsB;AACtB,0BAA0B;AAC1B,IAAI"}
@@ -1,61 +0,0 @@
1
- import { InjectedAccountWithMeta, InjectedExtension } from "@polkadot/extension-inject/types";
2
- import { ProsopoCaptchaConfig, GetCaptchaResponse, CaptchaSolutionResponse } from "../types/api";
3
- import { TransactionResponse } from "../types/contract";
4
- import { CaptchaSolutionCommitment } from "@prosopo/contract";
5
- export declare type TExtensionAccount = InjectedAccountWithMeta;
6
- export declare type TCaptchaSubmitResult = [CaptchaSolutionResponse, TransactionResponse?, CaptchaSolutionCommitment?];
7
- export interface IExtensionInterface {
8
- checkExtension(): void;
9
- getExtension(): InjectedExtension | undefined;
10
- getAccounts(): InjectedAccountWithMeta[];
11
- getAccount(): InjectedAccountWithMeta | undefined;
12
- setAccount(account: string): void;
13
- unsetAccount(): void;
14
- getDefaultAccount(): InjectedAccountWithMeta | undefined;
15
- setDefaultAccount(): void;
16
- createAccount(): Promise<InjectedAccountWithMeta | undefined>;
17
- }
18
- export interface ICaptchaClientEvents {
19
- onLoad?: (extension: IExtensionInterface, contractAddress: string) => void;
20
- onAccountChange?: (account?: TExtensionAccount) => void;
21
- }
22
- export interface ICaptchaStateClientEvents {
23
- onLoadCaptcha?: (captchaChallenge: GetCaptchaResponse | Error) => void;
24
- onSubmit?: (result: TCaptchaSubmitResult | Error, captchaState: ICaptchaState) => void;
25
- onChange?: (captchaSolution: string[][], index: number) => void;
26
- onCancel?: () => void;
27
- onSolved?: (result: TCaptchaSubmitResult, isHuman?: boolean) => void;
28
- }
29
- export interface CaptchaEventCallbacks extends ICaptchaClientEvents, ICaptchaStateClientEvents {
30
- }
31
- export interface ICaptchaContextState {
32
- config: ProsopoCaptchaConfig;
33
- contractAddress?: string;
34
- account?: InjectedAccountWithMeta;
35
- }
36
- export interface ICaptchaContextReducer {
37
- state: ICaptchaContextState;
38
- update: (value: Partial<ICaptchaContextState>) => void;
39
- }
40
- export interface ICaptchaState {
41
- captchaChallenge?: GetCaptchaResponse;
42
- captchaIndex: number;
43
- captchaSolution: string[][];
44
- }
45
- export interface ICaptchaStateReducer {
46
- state: ICaptchaState;
47
- update: (value: Partial<ICaptchaState>) => void;
48
- }
49
- export interface ICaptchaStatusState {
50
- info?: string;
51
- error?: string;
52
- }
53
- export interface ICaptchaStatusReducerAction {
54
- info?: [string, any] | string;
55
- error?: [string, any] | string | Error;
56
- }
57
- export interface ICaptchaStatusReducer {
58
- state: ICaptchaStatusState;
59
- update: (value: Partial<ICaptchaStatusReducerAction>) => void;
60
- }
61
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAC,MAAM,mBAAmB,CAAC;AAE7D,oBAAY,iBAAiB,GAAG,uBAAuB,CAAC;AAExD,oBAAY,oBAAoB,GAAG,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAE/G,MAAM,WAAW,mBAAmB;IAChC,cAAc,IAAI,IAAI,CAAC;IACvB,YAAY,IAAI,iBAAiB,GAAG,SAAS,CAAC;IAC9C,WAAW,IAAI,uBAAuB,EAAE,CAAC;IACzC,UAAU,IAAI,uBAAuB,GAAG,SAAS,CAAC;IAClD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,IAAI,IAAI,CAAC;IACrB,iBAAiB,IAAI,uBAAuB,GAAG,SAAS,CAAC;IACz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AAM,EAAE,EAAE,CAAC;CAE/B;AAED,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA2B;IACxC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,2BAA2B,CAAC,KAAK,IAAI,CAAC;CACjE"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import type { SubmittableResultValue } from '@polkadot/api/types';
2
- export declare type TransactionResponse = SubmittableResultValue & {
3
- blockHash?: string;
4
- };
5
- //# sourceMappingURL=contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/types/contract.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,oBAAY,mBAAmB,GAAG,sBAAsB,GAAG;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/types/contract.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export * from './api';
2
- export * from './contract';
3
- export * from './client';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAeA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
5
- // This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
6
- //
7
- // procaptcha is free software: you can redistribute it and/or modify
8
- // it under the terms of the GNU General Public License as published by
9
- // the Free Software Foundation, either version 3 of the License, or
10
- // (at your option) any later version.
11
- //
12
- // procaptcha is distributed in the hope that it will be useful,
13
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- // GNU General Public License for more details.
16
- //
17
- // You should have received a copy of the GNU General Public License
18
- // along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
19
- tslib_1.__exportStar(require("./api"), exports);
20
- tslib_1.__exportStar(require("./contract"), exports);
21
- tslib_1.__exportStar(require("./client"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,gDAAsB;AACtB,qDAA2B;AAC3B,mDAAyB"}