@prosopo/procaptcha 0.1.9 → 0.1.10

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 (114) hide show
  1. package/.eslintrc.js +28 -29
  2. package/.prettierrc.js +7 -0
  3. package/dist/api/AsyncFactory.d.ts.map +1 -1
  4. package/dist/api/AsyncFactory.js +2 -2
  5. package/dist/api/AsyncFactory.js.map +1 -1
  6. package/dist/api/Extension.d.ts +15 -0
  7. package/dist/api/Extension.d.ts.map +1 -0
  8. package/dist/api/Extension.js +9 -0
  9. package/dist/api/Extension.js.map +1 -0
  10. package/dist/api/ExtensionWeb2.d.ts +10 -25
  11. package/dist/api/ExtensionWeb2.d.ts.map +1 -1
  12. package/dist/api/ExtensionWeb2.js +79 -90
  13. package/dist/api/ExtensionWeb2.js.map +1 -1
  14. package/dist/api/ExtensionWeb3.d.ts +5 -52
  15. package/dist/api/ExtensionWeb3.d.ts.map +1 -1
  16. package/dist/api/ExtensionWeb3.js +24 -142
  17. package/dist/api/ExtensionWeb3.js.map +1 -1
  18. package/dist/api/HttpClientBase.d.ts +1 -1
  19. package/dist/api/HttpClientBase.d.ts.map +1 -1
  20. package/dist/api/HttpClientBase.js +2 -2
  21. package/dist/api/HttpClientBase.js.map +1 -1
  22. package/dist/api/ProsopoContract.d.ts +3 -3
  23. package/dist/api/ProsopoContract.d.ts.map +1 -1
  24. package/dist/api/ProsopoContract.js +25 -4
  25. package/dist/api/ProsopoContract.js.map +1 -1
  26. package/dist/api/ProsopoContractBase.d.ts +18 -20
  27. package/dist/api/ProsopoContractBase.d.ts.map +1 -1
  28. package/dist/api/ProsopoContractBase.js +34 -27
  29. package/dist/api/ProsopoContractBase.js.map +1 -1
  30. package/dist/api/errors.d.ts +13 -0
  31. package/dist/api/errors.d.ts.map +1 -0
  32. package/dist/api/errors.js +28 -0
  33. package/dist/api/errors.js.map +1 -0
  34. package/dist/api/handlers.d.ts +2 -2
  35. package/dist/api/handlers.d.ts.map +1 -1
  36. package/dist/api/handlers.js +2 -10
  37. package/dist/api/handlers.js.map +1 -1
  38. package/dist/api/index.d.ts +0 -1
  39. package/dist/api/index.d.ts.map +1 -1
  40. package/dist/api/index.js +0 -1
  41. package/dist/api/index.js.map +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/modules/Manager.d.ts +13 -0
  45. package/dist/modules/Manager.d.ts.map +1 -0
  46. package/dist/modules/Manager.js +346 -0
  47. package/dist/modules/Manager.js.map +1 -0
  48. package/dist/modules/ProsopoCaptchaApi.d.ts +12 -14
  49. package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -1
  50. package/dist/modules/ProsopoCaptchaApi.js +36 -56
  51. package/dist/modules/ProsopoCaptchaApi.js.map +1 -1
  52. package/dist/modules/ProsopoCaptchaStateClient.d.ts +0 -17
  53. package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +1 -1
  54. package/dist/modules/ProsopoCaptchaStateClient.js +0 -109
  55. package/dist/modules/ProsopoCaptchaStateClient.js.map +1 -1
  56. package/dist/modules/canvas.d.ts.map +1 -1
  57. package/dist/modules/canvas.js +84 -21
  58. package/dist/modules/canvas.js.map +1 -1
  59. package/dist/modules/index.d.ts +1 -6
  60. package/dist/modules/index.d.ts.map +1 -1
  61. package/dist/modules/index.js +1 -6
  62. package/dist/modules/index.js.map +1 -1
  63. package/dist/modules/storage.d.ts +10 -0
  64. package/dist/modules/storage.d.ts.map +1 -1
  65. package/dist/modules/storage.js +17 -17
  66. package/dist/modules/storage.js.map +1 -1
  67. package/dist/types/api.d.ts +19 -21
  68. package/dist/types/api.d.ts.map +1 -1
  69. package/dist/types/client.d.ts +10 -60
  70. package/dist/types/client.d.ts.map +1 -1
  71. package/dist/types/contract.d.ts +1 -1
  72. package/dist/types/contract.d.ts.map +1 -1
  73. package/dist/types/index.d.ts +1 -0
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/types/index.js +1 -0
  76. package/dist/types/index.js.map +1 -1
  77. package/dist/types/manager.d.ts +67 -0
  78. package/dist/types/manager.d.ts.map +1 -0
  79. package/dist/types/manager.js +3 -0
  80. package/dist/types/manager.js.map +1 -0
  81. package/dist/types/utils.d.ts +2 -0
  82. package/dist/types/utils.d.ts.map +1 -0
  83. package/dist/types/utils.js +3 -0
  84. package/dist/types/utils.js.map +1 -0
  85. package/dist/utils/utils.d.ts +2 -0
  86. package/dist/utils/utils.d.ts.map +1 -0
  87. package/dist/utils/utils.js +8 -0
  88. package/dist/utils/utils.js.map +1 -0
  89. package/package.json +4 -3
  90. package/tsconfig.json +5 -2
  91. package/dist/api/AccountCreator.d.ts +0 -19
  92. package/dist/api/AccountCreator.d.ts.map +0 -1
  93. package/dist/api/AccountCreator.js +0 -88
  94. package/dist/api/AccountCreator.js.map +0 -1
  95. package/dist/api/ProviderApi.d.ts +0 -14
  96. package/dist/api/ProviderApi.d.ts.map +0 -1
  97. package/dist/api/ProviderApi.js +0 -53
  98. package/dist/api/ProviderApi.js.map +0 -1
  99. package/dist/modules/ProsopoCaptchaClient.d.ts +0 -26
  100. package/dist/modules/ProsopoCaptchaClient.d.ts.map +0 -1
  101. package/dist/modules/ProsopoCaptchaClient.js +0 -112
  102. package/dist/modules/ProsopoCaptchaClient.js.map +0 -1
  103. package/dist/modules/client.d.ts +0 -9
  104. package/dist/modules/client.d.ts.map +0 -1
  105. package/dist/modules/client.js +0 -40
  106. package/dist/modules/client.js.map +0 -1
  107. package/dist/modules/contract.d.ts +0 -7
  108. package/dist/modules/contract.d.ts.map +0 -1
  109. package/dist/modules/contract.js +0 -42
  110. package/dist/modules/contract.js.map +0 -1
  111. package/dist/modules/extension.d.ts +0 -4
  112. package/dist/modules/extension.d.ts.map +0 -1
  113. package/dist/modules/extension.js +0 -31
  114. package/dist/modules/extension.js.map +0 -1
@@ -1,9 +0,0 @@
1
- import { ICaptchaContextState, ICaptchaState, ICaptchaStatusReducerAction, ICaptchaStatusState } 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,2BAA2B,EAAE,mBAAmB,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/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,2EAA2E;AAC3E,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,EAAE,MAAM,wBAAwB,CAAC;AACpD,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/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,2EAA2E;AAC3E,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,yDAAoD;AAIpD,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,4 +0,0 @@
1
- import { AccountCreatorConfig, IExtensionInterface } from "../types/index";
2
- import { WsProvider } from "@polkadot/rpc-provider";
3
- export declare function getExtension(wsProvider: WsProvider, web2: boolean, accountCreatorConfig: AccountCreatorConfig, source: string): Promise<IExtensionInterface>;
4
- //# 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,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAElD,wBAAsB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAMlK"}
@@ -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/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(wsProvider, web2, accountCreatorConfig, source) {
23
- if (web2) {
24
- return await ExtensionWeb2_1.default.create(wsProvider, accountCreatorConfig, source);
25
- }
26
- else {
27
- return await ExtensionWeb3_1.default.create(source);
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,2EAA2E;AAC3E,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;AAI1C,KAAK,UAAU,YAAY,CAAC,UAAsB,EAAE,IAAa,EAAE,oBAA0C,EAAE,MAAc;IAChI,IAAI,IAAI,EAAE;QACN,OAAO,MAAM,uBAAa,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;KAC/E;SAAM;QACH,OAAO,MAAM,uBAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KAC7C;AACL,CAAC;AAND,oCAMC"}