@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.
- package/.eslintrc.js +28 -29
- package/.prettierrc.js +7 -0
- package/dist/api/AsyncFactory.d.ts.map +1 -1
- package/dist/api/AsyncFactory.js +2 -2
- package/dist/api/AsyncFactory.js.map +1 -1
- package/dist/api/Extension.d.ts +15 -0
- package/dist/api/Extension.d.ts.map +1 -0
- package/dist/api/Extension.js +9 -0
- package/dist/api/Extension.js.map +1 -0
- package/dist/api/ExtensionWeb2.d.ts +10 -25
- package/dist/api/ExtensionWeb2.d.ts.map +1 -1
- package/dist/api/ExtensionWeb2.js +79 -90
- package/dist/api/ExtensionWeb2.js.map +1 -1
- package/dist/api/ExtensionWeb3.d.ts +5 -52
- package/dist/api/ExtensionWeb3.d.ts.map +1 -1
- package/dist/api/ExtensionWeb3.js +24 -142
- package/dist/api/ExtensionWeb3.js.map +1 -1
- package/dist/api/HttpClientBase.d.ts +1 -1
- package/dist/api/HttpClientBase.d.ts.map +1 -1
- package/dist/api/HttpClientBase.js +2 -2
- package/dist/api/HttpClientBase.js.map +1 -1
- package/dist/api/ProsopoContract.d.ts +3 -3
- package/dist/api/ProsopoContract.d.ts.map +1 -1
- package/dist/api/ProsopoContract.js +25 -4
- package/dist/api/ProsopoContract.js.map +1 -1
- package/dist/api/ProsopoContractBase.d.ts +18 -20
- package/dist/api/ProsopoContractBase.d.ts.map +1 -1
- package/dist/api/ProsopoContractBase.js +34 -27
- package/dist/api/ProsopoContractBase.js.map +1 -1
- package/dist/api/errors.d.ts +13 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +28 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/handlers.d.ts +2 -2
- package/dist/api/handlers.d.ts.map +1 -1
- package/dist/api/handlers.js +2 -10
- package/dist/api/handlers.js.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/Manager.d.ts +13 -0
- package/dist/modules/Manager.d.ts.map +1 -0
- package/dist/modules/Manager.js +346 -0
- package/dist/modules/Manager.js.map +1 -0
- package/dist/modules/ProsopoCaptchaApi.d.ts +12 -14
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.js +36 -56
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -1
- package/dist/modules/ProsopoCaptchaStateClient.d.ts +0 -17
- package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +1 -1
- package/dist/modules/ProsopoCaptchaStateClient.js +0 -109
- package/dist/modules/ProsopoCaptchaStateClient.js.map +1 -1
- package/dist/modules/canvas.d.ts.map +1 -1
- package/dist/modules/canvas.js +84 -21
- package/dist/modules/canvas.js.map +1 -1
- package/dist/modules/index.d.ts +1 -6
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -6
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/storage.d.ts +10 -0
- package/dist/modules/storage.d.ts.map +1 -1
- package/dist/modules/storage.js +17 -17
- package/dist/modules/storage.js.map +1 -1
- package/dist/types/api.d.ts +19 -21
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/client.d.ts +10 -60
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/contract.d.ts +1 -1
- package/dist/types/contract.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/manager.d.ts +67 -0
- package/dist/types/manager.d.ts.map +1 -0
- package/dist/types/manager.js +3 -0
- package/dist/types/manager.js.map +1 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +3 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +8 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +4 -3
- package/tsconfig.json +5 -2
- package/dist/api/AccountCreator.d.ts +0 -19
- package/dist/api/AccountCreator.d.ts.map +0 -1
- package/dist/api/AccountCreator.js +0 -88
- package/dist/api/AccountCreator.js.map +0 -1
- package/dist/api/ProviderApi.d.ts +0 -14
- package/dist/api/ProviderApi.d.ts.map +0 -1
- package/dist/api/ProviderApi.js +0 -53
- package/dist/api/ProviderApi.js.map +0 -1
- package/dist/modules/ProsopoCaptchaClient.d.ts +0 -26
- package/dist/modules/ProsopoCaptchaClient.d.ts.map +0 -1
- package/dist/modules/ProsopoCaptchaClient.js +0 -112
- package/dist/modules/ProsopoCaptchaClient.js.map +0 -1
- package/dist/modules/client.d.ts +0 -9
- package/dist/modules/client.d.ts.map +0 -1
- package/dist/modules/client.js +0 -40
- package/dist/modules/client.js.map +0 -1
- package/dist/modules/contract.d.ts +0 -7
- package/dist/modules/contract.d.ts.map +0 -1
- package/dist/modules/contract.js +0 -42
- package/dist/modules/contract.js.map +0 -1
- package/dist/modules/extension.d.ts +0 -4
- package/dist/modules/extension.d.ts.map +0 -1
- package/dist/modules/extension.js +0 -31
- package/dist/modules/extension.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb3.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionWeb3.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":";;;AACA,6DAAqD;AACrD,oEAAmC;AAEnC,qCAAuE;AAEvE;;GAEG;AACH,MAAqB,OAAQ,SAAQ,mBAAS;IACnC,KAAK,CAAC,UAAU,CAAC,MAAwB;QAC5C,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;QAExD,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,6BAAoB,CAAC,6BAA6B,CAAC,CAAA;SAChE;QAED,kCAAkC;QAClC,MAAM,UAAU,GAAwB,MAAM,IAAA,2BAAU,EAAC,QAAQ,CAAC,CAAA;QAClE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,+BAAsB,EAAE,CAAA;SACrC;QAED,iEAAiE;QACjE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAChC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAA;YAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;YACvE,IAAI,OAAO,EAAE;gBACT,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;aAChC;SACJ;QAED,MAAM,IAAI,6BAAoB,CAAC,4BAA4B,GAAG,OAAO,CAAC,CAAA;IAC1E,CAAC;CACJ;AAzBD,0BAyBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.d.ts","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"AAeA,OAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"HttpClientBase.d.ts","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"AAeA,OAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE3D,qBAAa,cAAc;IACvB,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;gBAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAK;IAMxC,SAAS,CAAC,eAAe,aAAc,aAAa,SAGnD;IAED,SAAS,CAAC,YAAY,UAAW,GAAG,oBAAmC;CAC1E;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -20,13 +20,13 @@ const tslib_1 = require("tslib");
|
|
|
20
20
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
21
21
|
class HttpClientBase {
|
|
22
22
|
axios;
|
|
23
|
-
constructor(baseURL, prefix =
|
|
23
|
+
constructor(baseURL, prefix = '') {
|
|
24
24
|
baseURL = baseURL + prefix;
|
|
25
25
|
this.axios = axios_1.default.create({ baseURL });
|
|
26
26
|
this.axios.interceptors.response.use(this.responseHandler, this.errorHandler);
|
|
27
27
|
}
|
|
28
28
|
responseHandler = (response) => {
|
|
29
|
-
console.log(
|
|
29
|
+
console.log('API REQUEST', response.request);
|
|
30
30
|
return response.data;
|
|
31
31
|
};
|
|
32
32
|
errorHandler = (error) => Promise.reject(error.response);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.js","sourceRoot":"","sources":["../../src/api/HttpClientBase.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,
|
|
1
|
+
{"version":3,"file":"HttpClientBase.js","sourceRoot":"","sources":["../../src/api/HttpClientBase.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,0DAA2D;AAE3D,MAAa,cAAc;IACJ,KAAK,CAAe;IAEvC,YAAY,OAAe,EAAE,MAAM,GAAG,EAAE;QACpC,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QACtC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACjF,CAAC;IAES,eAAe,GAAG,CAAC,QAAuB,EAAE,EAAE;QACpD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC5C,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC,CAAA;IAES,YAAY,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC1E;AAfD,wCAeC;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import ProsopoContractBase from
|
|
1
|
+
import ProsopoContractBase from './ProsopoContractBase';
|
|
2
2
|
import { Signer } from '@polkadot/api/types';
|
|
3
3
|
import { ProsopoDappOperatorIsHumanUserResponse, TransactionResponse } from '../types';
|
|
4
|
-
import { ProsopoRandomProviderResponse } from
|
|
5
|
-
import { CaptchaSolutionCommitment } from
|
|
4
|
+
import { ProsopoRandomProviderResponse } from '../types';
|
|
5
|
+
import { CaptchaSolutionCommitment } from '@prosopo/datasets';
|
|
6
6
|
export declare class ProsopoContract extends ProsopoContractBase {
|
|
7
7
|
getRandomProvider(): Promise<ProsopoRandomProviderResponse>;
|
|
8
8
|
getCaptchaSolutionCommitment(commitmentId: string): Promise<CaptchaSolutionCommitment>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProsopoContract.d.ts","sourceRoot":"","sources":["../../src/api/ProsopoContract.ts"],"names":[],"mappings":"AAgBA,OAAO,mBAAmB,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ProsopoContract.d.ts","sourceRoot":"","sources":["../../src/api/ProsopoContract.ts"],"names":[],"mappings":"AAgBA,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,sCAAsC,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,qBAAa,eAAgB,SAAQ,mBAAmB;IACvC,iBAAiB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAQ3D,4BAA4B,CAAC,YAAY,EAAE,MAAM;IAIjD,cAAc,CACvB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EACxB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,MAAM,GACxB,OAAO,CAAC,mBAAmB,CAAC;IASlB,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,sCAAsC,CAAC;CAcnH;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -21,16 +21,37 @@ const tslib_1 = require("tslib");
|
|
|
21
21
|
const ProsopoContractBase_1 = tslib_1.__importDefault(require("./ProsopoContractBase"));
|
|
22
22
|
class ProsopoContract extends ProsopoContractBase_1.default {
|
|
23
23
|
async getRandomProvider() {
|
|
24
|
-
|
|
24
|
+
console.log('getRandomProvider', this.userAccountAddress, this.dappAddress);
|
|
25
|
+
return (await this.query('getRandomActiveProvider', [
|
|
26
|
+
this.userAccountAddress,
|
|
27
|
+
this.dappAddress,
|
|
28
|
+
]));
|
|
25
29
|
}
|
|
26
30
|
async getCaptchaSolutionCommitment(commitmentId) {
|
|
27
|
-
return await this.query('getCaptchaSolutionCommitment', [commitmentId]);
|
|
31
|
+
return (await this.query('getCaptchaSolutionCommitment', [commitmentId]));
|
|
28
32
|
}
|
|
29
33
|
async dappUserCommit(signer, captchaDatasetId, userMerkleTreeRoot, providerAddress) {
|
|
30
|
-
return await this.transaction(signer, 'dappUserCommit', [
|
|
34
|
+
return await this.transaction(signer, 'dappUserCommit', [
|
|
35
|
+
this.dappAddress,
|
|
36
|
+
captchaDatasetId,
|
|
37
|
+
userMerkleTreeRoot,
|
|
38
|
+
providerAddress,
|
|
39
|
+
]);
|
|
31
40
|
}
|
|
32
41
|
async dappOperatorIsHumanUser(solutionThreshold) {
|
|
33
|
-
|
|
42
|
+
let response;
|
|
43
|
+
try {
|
|
44
|
+
response = await this.query('dappOperatorIsHumanUser', [this.userAccountAddress, solutionThreshold]);
|
|
45
|
+
// TODO make the contract always return true or false
|
|
46
|
+
if (response !== true) {
|
|
47
|
+
throw new Error('dappOperatorIsHumanUser returned false');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.debug(response);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return response;
|
|
34
55
|
}
|
|
35
56
|
}
|
|
36
57
|
exports.ProsopoContract = ProsopoContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProsopoContract.js","sourceRoot":"","sources":["../../src/api/ProsopoContract.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,mDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"ProsopoContract.js","sourceRoot":"","sources":["../../src/api/ProsopoContract.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC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AAC,CAAA;YACvB,OAAO,KAAK,CAAA;SACf;QACD,OAAO,QAAkD,CAAA;IAC7D,CAAC;CACJ;AAzCD,0CAyCC;AAED,kBAAe,eAAe,CAAA"}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { ApiPromise } from
|
|
2
|
-
import { Abi, ContractPromise } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Signer } from "@polkadot/api/types";
|
|
1
|
+
import { ApiPromise } from '@polkadot/api';
|
|
2
|
+
import { Abi, ContractPromise } from '@polkadot/api-contract';
|
|
3
|
+
import { AnyJson } from '@polkadot/types/types/codec';
|
|
4
|
+
import { ProviderInterface } from '@polkadot/rpc-provider/types';
|
|
5
|
+
import { Signer } from '@polkadot/api/types';
|
|
7
6
|
import { TransactionResponse } from '../types';
|
|
8
|
-
import AsyncFactory from
|
|
7
|
+
import AsyncFactory from './AsyncFactory';
|
|
9
8
|
export declare class ProsopoContractBase extends AsyncFactory {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
api: ApiPromise;
|
|
10
|
+
abi: Abi;
|
|
11
|
+
contract: ContractPromise;
|
|
12
|
+
userAccountAddress: string;
|
|
13
|
+
dappAddress: string;
|
|
14
|
+
contractAddress: string;
|
|
16
15
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
init(
|
|
16
|
+
* @param contractAddress
|
|
17
|
+
* @param dappAddress
|
|
18
|
+
* @param userAccountAddress
|
|
19
|
+
* @param providerInterface
|
|
20
|
+
*/
|
|
21
|
+
init(contractAddress: string, dappAddress: string, userAccountAddress: string, providerInterface: ProviderInterface): Promise<this>;
|
|
23
22
|
getApi(): ApiPromise;
|
|
24
23
|
getContract(): ContractPromise;
|
|
25
|
-
getAccount(): InjectedAccountWithMeta;
|
|
26
24
|
getDappAddress(): string;
|
|
27
25
|
disconnect(): Promise<void>;
|
|
28
26
|
query<T>(method: string, args: any[]): Promise<T | AnyJson | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProsopoContractBase.d.ts","sourceRoot":"","sources":["../../src/api/ProsopoContractBase.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAqB,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"ProsopoContractBase.d.ts","sourceRoot":"","sources":["../../src/api/ProsopoContractBase.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAqB,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAGzC,qBAAa,mBAAoB,SAAQ,YAAY;IACjD,GAAG,EAAE,UAAU,CAAA;IACf,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,EAAE,eAAe,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IAEZ,eAAe,EAAE,MAAM,CAAA;IAE9B;;;;;OAKG;IACU,IAAI,CACb,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,EAC1B,iBAAiB,EAAE,iBAAiB;IAWjC,MAAM,IAAI,UAAU;IAIpB,WAAW,IAAI,eAAe;IAI9B,cAAc,IAAI,MAAM;IAIlB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IA0BlE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuEtG;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -25,22 +25,22 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
25
25
|
api;
|
|
26
26
|
abi;
|
|
27
27
|
contract;
|
|
28
|
-
|
|
28
|
+
userAccountAddress;
|
|
29
29
|
dappAddress;
|
|
30
|
-
|
|
30
|
+
contractAddress;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async init(
|
|
32
|
+
* @param contractAddress
|
|
33
|
+
* @param dappAddress
|
|
34
|
+
* @param userAccountAddress
|
|
35
|
+
* @param providerInterface
|
|
36
|
+
*/
|
|
37
|
+
async init(contractAddress, dappAddress, userAccountAddress, providerInterface) {
|
|
38
38
|
this.api = await api_1.ApiPromise.create({ provider: providerInterface });
|
|
39
39
|
this.abi = new api_contract_1.Abi(contract_1.abiJson, this.api.registry.getChainProperties());
|
|
40
|
-
this.contract = new api_contract_1.ContractPromise(this.api, this.abi,
|
|
41
|
-
this.
|
|
40
|
+
this.contract = new api_contract_1.ContractPromise(this.api, this.abi, contractAddress);
|
|
41
|
+
this.contractAddress = contractAddress;
|
|
42
42
|
this.dappAddress = dappAddress;
|
|
43
|
-
this.
|
|
43
|
+
this.userAccountAddress = userAccountAddress;
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
getApi() {
|
|
@@ -49,9 +49,6 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
49
49
|
getContract() {
|
|
50
50
|
return this.contract;
|
|
51
51
|
}
|
|
52
|
-
getAccount() {
|
|
53
|
-
return this.account;
|
|
54
|
-
}
|
|
55
52
|
getDappAddress() {
|
|
56
53
|
return this.dappAddress;
|
|
57
54
|
}
|
|
@@ -61,8 +58,8 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
61
58
|
async query(method, args) {
|
|
62
59
|
try {
|
|
63
60
|
const abiMessage = this.abi.findMessage(method);
|
|
64
|
-
const response = await this.contract.query[method](this.
|
|
65
|
-
console.log(
|
|
61
|
+
const response = await this.contract.query[method](this.userAccountAddress, {}, ...(0, contract_1.encodeStringArgs)(abiMessage, args));
|
|
62
|
+
console.log('QUERY RESPONSE', method, args, response);
|
|
66
63
|
if (response.result.isOk) {
|
|
67
64
|
if (response.output) {
|
|
68
65
|
return (0, contract_1.unwrap)(response.output.toHuman());
|
|
@@ -76,7 +73,7 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
catch (e) {
|
|
79
|
-
console.error(
|
|
76
|
+
console.error('ERROR', e);
|
|
80
77
|
return null;
|
|
81
78
|
}
|
|
82
79
|
}
|
|
@@ -84,7 +81,7 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
84
81
|
// https://polkadot.js.org/docs/api/start/api.tx.subs/
|
|
85
82
|
async transaction(signer, method, args) {
|
|
86
83
|
const queryBeforeTx = await this.query(method, args);
|
|
87
|
-
console.log(
|
|
84
|
+
console.log('QUERY BEFORE TX....................', queryBeforeTx);
|
|
88
85
|
const abiMessage = this.abi.findMessage(method);
|
|
89
86
|
const extrinsic = this.contract.tx[method]({}, ...(0, contract_1.encodeStringArgs)(abiMessage, args));
|
|
90
87
|
// this.api.setSigner(signer);
|
|
@@ -92,19 +89,20 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
92
89
|
// console.log("buildTx RESPONSE", response);
|
|
93
90
|
// return;
|
|
94
91
|
return new Promise((resolve, reject) => {
|
|
95
|
-
extrinsic
|
|
92
|
+
extrinsic
|
|
93
|
+
.signAndSend(this.userAccountAddress, { signer }, (result) => {
|
|
96
94
|
const { dispatchError, dispatchInfo, events, internalError, status, txHash, txIndex } = result;
|
|
97
|
-
console.log(
|
|
98
|
-
console.log(
|
|
99
|
-
console.log(
|
|
100
|
-
console.log(
|
|
95
|
+
console.log('TX STATUS', status.type);
|
|
96
|
+
console.log('IS FINALIZED', status?.isFinalized);
|
|
97
|
+
console.log('IN BLOCK', status?.isInBlock);
|
|
98
|
+
console.log('EVENTS', events);
|
|
101
99
|
if (internalError) {
|
|
102
|
-
console.error(
|
|
100
|
+
console.error('internalError', internalError);
|
|
103
101
|
reject(internalError);
|
|
104
102
|
return;
|
|
105
103
|
}
|
|
106
104
|
if (dispatchError) {
|
|
107
|
-
console.error(
|
|
105
|
+
console.error('dispatchError', dispatchError);
|
|
108
106
|
reject(dispatchError);
|
|
109
107
|
return;
|
|
110
108
|
}
|
|
@@ -112,7 +110,16 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
112
110
|
// Instant seal ON.
|
|
113
111
|
if (status?.isInBlock) {
|
|
114
112
|
const blockHash = status.asInBlock.toHex();
|
|
115
|
-
resolve({
|
|
113
|
+
resolve({
|
|
114
|
+
dispatchError,
|
|
115
|
+
dispatchInfo,
|
|
116
|
+
events,
|
|
117
|
+
internalError,
|
|
118
|
+
status,
|
|
119
|
+
txHash,
|
|
120
|
+
txIndex,
|
|
121
|
+
blockHash,
|
|
122
|
+
});
|
|
116
123
|
}
|
|
117
124
|
// Instant seal OFF.
|
|
118
125
|
// if (status?.isFinalized) {
|
|
@@ -121,7 +128,7 @@ class ProsopoContractBase extends AsyncFactory_1.default {
|
|
|
121
128
|
// }
|
|
122
129
|
})
|
|
123
130
|
.catch((e) => {
|
|
124
|
-
console.error(
|
|
131
|
+
console.error('signAndSend ERROR', e);
|
|
125
132
|
reject(e);
|
|
126
133
|
});
|
|
127
134
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProsopoContractBase.js","sourceRoot":"","sources":["../../src/api/ProsopoContractBase.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,
|
|
1
|
+
{"version":3,"file":"ProsopoContractBase.js","sourceRoot":"","sources":["../../src/api/ProsopoContractBase.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,uCAA6D;AAC7D,yDAA6D;AAC7D,gDAA2F;AAK3F,0EAAyC;AAGzC,MAAa,mBAAoB,SAAQ,sBAAY;IACjD,GAAG,CAAY;IACf,GAAG,CAAK;IACR,QAAQ,CAAiB;IACzB,kBAAkB,CAAQ;IAC1B,WAAW,CAAQ;IAEZ,eAAe,CAAQ;IAE9B;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CACb,eAAuB,EACvB,WAAmB,EACnB,kBAA0B,EAC1B,iBAAoC;QAEpC,IAAI,CAAC,GAAG,GAAG,MAAM,gBAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAA;QACnE,IAAI,CAAC,GAAG,GAAG,IAAI,kBAAG,CAAC,kBAAO,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAA;QACnE,IAAI,CAAC,QAAQ,GAAG,IAAI,8BAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAA;QACxE,IAAI,CAAC,eAAe,GAAG,eAAe,C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AM,CAAC,aAAa,CAAC,CAAA;oBAErB,OAAM;iBACT;gBAED,IAAI,aAAa,EAAE;oBACf,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;oBAC7C,MAAM,CAAC,aAAa,CAAC,CAAA;oBAErB,OAAM;iBACT;gBAED,iCAAiC;gBAEjC,mBAAmB;gBACnB,IAAI,MAAM,EAAE,SAAS,EAAE;oBACnB,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;oBAE1C,OAAO,CAAC;wBACJ,aAAa;wBACb,YAAY;wBACZ,MAAM;wBACN,aAAa;wBACb,MAAM;wBACN,MAAM;wBACN,OAAO;wBACP,SAAS;qBACZ,CAAC,CAAA;iBACL;gBAED,oBAAoB;gBACpB,6BAA6B;gBAE7B,kDAAkD;gBAElD,yGAAyG;gBAEzG,IAAI;YACR,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;gBACrC,MAAM,CAAC,CAAC,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;IACN,CAAC;CACJ;AA/ID,kDA+IC;AAED,kBAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class NoExtensionsFoundError extends Error {
|
|
2
|
+
constructor(msg?: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class AccountCreationUnsupportedError extends Error {
|
|
5
|
+
constructor(msg?: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class AccountNotFoundError extends Error {
|
|
8
|
+
constructor(msg?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class ExtensionNotFoundError extends Error {
|
|
11
|
+
constructor(msg?: string);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,+BAAgC,SAAQ,KAAK;gBAC1C,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBAC/B,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,CAAC,EAAE,MAAM;CAG3B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionNotFoundError = exports.AccountNotFoundError = exports.AccountCreationUnsupportedError = exports.NoExtensionsFoundError = void 0;
|
|
4
|
+
class NoExtensionsFoundError extends Error {
|
|
5
|
+
constructor(msg) {
|
|
6
|
+
super(msg || 'No extensions found');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.NoExtensionsFoundError = NoExtensionsFoundError;
|
|
10
|
+
class AccountCreationUnsupportedError extends Error {
|
|
11
|
+
constructor(msg) {
|
|
12
|
+
super(msg || 'Account creation is not supported');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AccountCreationUnsupportedError = AccountCreationUnsupportedError;
|
|
16
|
+
class AccountNotFoundError extends Error {
|
|
17
|
+
constructor(msg) {
|
|
18
|
+
super(msg || 'No account found');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.AccountNotFoundError = AccountNotFoundError;
|
|
22
|
+
class ExtensionNotFoundError extends Error {
|
|
23
|
+
constructor(msg) {
|
|
24
|
+
super(msg || 'No extensions found');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ExtensionNotFoundError = ExtensionNotFoundError;
|
|
28
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAJD,wDAIC;AAED,MAAa,+BAAgC,SAAQ,KAAK;IACtD,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,mCAAmC,CAAC,CAAA;IACrD,CAAC;CACJ;AAJD,0EAIC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAA;IACpC,CAAC;CACJ;AAJD,oDAIC;AAED,MAAa,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAJD,wDAIC"}
|
package/dist/api/handlers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
2
|
export declare class ProsopoApiError extends Error {
|
|
3
|
-
constructor(error:
|
|
3
|
+
constructor(error: AxiosError, context?: string, ...params: any[]);
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAeA,OAAO,
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE;CAQpE"}
|
package/dist/api/handlers.js
CHANGED
|
@@ -3,16 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProsopoApiError = void 0;
|
|
4
4
|
class ProsopoApiError extends Error {
|
|
5
5
|
constructor(error, context, ...params) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
else if ("statusText" in error) {
|
|
10
|
-
super(error.statusText);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
super(error.toString());
|
|
14
|
-
}
|
|
15
|
-
this.name = context && `${ProsopoApiError.name}@${context}` || ProsopoApiError.name;
|
|
6
|
+
super(error.message);
|
|
7
|
+
this.name = (context && `${ProsopoApiError.name}@${context}`) || ProsopoApiError.name;
|
|
16
8
|
console.error('\n********************* ERROR *********************\n');
|
|
17
9
|
console.error(this.cause, this.stack, ...params);
|
|
18
10
|
}
|
package/dist/api/handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":";;;AAiBA,MAAa,eAAgB,SAAQ,KAAK;IACtC,YAAY,KAAiB,EAAE,OAAgB,EAAE,GAAG,MAAa;QAC7D,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAEpB,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAA;QAErF,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;QACtE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAA;IACpD,CAAC;CACJ;AATD,0CASC"}
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAeA,cAAc,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAeA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
|
package/dist/api/index.js
CHANGED
|
@@ -22,5 +22,4 @@ tslib_1.__exportStar(require("./ExtensionWeb2"), exports);
|
|
|
22
22
|
tslib_1.__exportStar(require("./HttpClientBase"), exports);
|
|
23
23
|
tslib_1.__exportStar(require("./ProsopoContract"), exports);
|
|
24
24
|
tslib_1.__exportStar(require("./ProsopoContractBase"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./ProviderApi"), exports);
|
|
26
25
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.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,yDAA8B;AAC9B,0DAA+B;AAC/B,0DAA+B;AAC/B,2DAAgC;AAChC,4DAAiC;AACjC,gEAAqC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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,gDAAqB;AACrB,oDAAyB;AACzB,kDAAuB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProcaptchaCallbacks, ProcaptchaConfigOptional, ProcaptchaState, ProcaptchaStateUpdateFn } from '../types/manager';
|
|
2
|
+
export declare const defaultState: () => Partial<ProcaptchaState>;
|
|
3
|
+
/**
|
|
4
|
+
* The state operator. This is used to mutate the state of Procaptcha during the captcha process. State updates are published via the onStateUpdate callback. This should be used by frontends, e.g. react, to maintain the state of Procaptcha across renders.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Manager: (configOptional: ProcaptchaConfigOptional, state: ProcaptchaState, onStateUpdate: ProcaptchaStateUpdateFn, callbacks: ProcaptchaCallbacks) => {
|
|
7
|
+
start: () => Promise<void>;
|
|
8
|
+
cancel: () => Promise<void>;
|
|
9
|
+
submit: () => Promise<void>;
|
|
10
|
+
select: (hash: string) => void;
|
|
11
|
+
nextRound: () => void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/modules/Manager.ts"],"names":[],"mappings":"AAOA,OAAO,EAEH,mBAAmB,EAEnB,wBAAwB,EAExB,eAAe,EACf,uBAAuB,EAC1B,MAAM,kBAAkB,CAAA;AAOzB,eAAO,MAAM,YAAY,QAAO,QAAQ,eAAe,CAYtD,CAAA;AAkBD;;GAEG;AACH,eAAO,MAAM,OAAO,mBACA,wBAAwB,SACjC,eAAe,iBACP,uBAAuB,aAC3B,mBAAmB;;;;mBA0OR,MAAM;;CA2H/B,CAAA"}
|