@prosopo/server 0.2.11 → 0.2.14

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.
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api$1 = require("@polkadot/api");
3
+ const Api = require("@polkadot/api/promise/Api");
4
4
  const types = require("@prosopo/types");
5
5
  const keyring = require("@polkadot/keyring");
6
6
  const common = require("@prosopo/common");
7
7
  const contract = require("@prosopo/contract");
8
8
  const api = require("@prosopo/api");
9
- require("./contracts/captcha/dist/index.cjs");
10
- const rpcProvider = require("@polkadot/rpc-provider");
9
+ const ws = require("@polkadot/rpc-provider/ws");
10
+ const contractInfo = require("@prosopo/captcha-contract/contract-info");
11
11
  const util = require("@prosopo/util");
12
- const captcha = require("./contracts/captcha/dist/contract-info/captcha.cjs");
13
12
  class ProsopoServer {
14
13
  constructor(config, pair) {
15
14
  this.config = config;
@@ -17,23 +16,29 @@ class ProsopoServer {
17
16
  this.defaultEnvironment = this.config.defaultEnvironment;
18
17
  const networkName = types.NetworkNamesSchema.parse(this.config.defaultNetwork);
19
18
  this.network = util.get(this.config.networks, networkName);
20
- this.wsProvider = new rpcProvider.WsProvider(this.network.endpoint);
19
+ this.wsProvider = new ws.WsProvider(this.network.endpoint);
21
20
  this.prosopoContractAddress = this.network.contract.address;
22
- this.dappContractAddress = this.config.account.address || contract.getZeroAddress().toString();
21
+ this.dappContractAddress = this.config.account.address;
23
22
  this.contractName = this.network.contract.name;
24
23
  this.logger = common.getLogger(this.config.logLevel, "@prosopo/server");
25
24
  this.keyring = new keyring.Keyring({
26
25
  type: "sr25519"
27
26
  // TODO get this from the chain
28
27
  });
29
- this.abi = JSON.parse(captcha.ContractAbi);
28
+ this.abi = JSON.parse(contractInfo.ContractAbi);
30
29
  }
31
30
  async getProviderApi(providerUrl) {
32
- return new api.ProviderApi(this.network, providerUrl, this.dappContractAddress);
31
+ return new api.ProviderApi(this.network, providerUrl, this.getDappContractAddress());
32
+ }
33
+ getDappContractAddress() {
34
+ if (!this.dappContractAddress) {
35
+ return contract.getZeroAddress(this.getApi()).toString();
36
+ }
37
+ return this.dappContractAddress;
33
38
  }
34
39
  async isReady() {
35
40
  try {
36
- this.api = await api$1.ApiPromise.create({ provider: this.wsProvider });
41
+ this.api = await Api.ApiPromise.create({ provider: this.wsProvider, initWasm: false });
37
42
  await this.getSigner();
38
43
  await this.getContractApi();
39
44
  } catch (err) {
@@ -43,7 +48,7 @@ class ProsopoServer {
43
48
  async getSigner() {
44
49
  if (this.pair) {
45
50
  if (!this.api) {
46
- this.api = await api$1.ApiPromise.create({ provider: this.wsProvider });
51
+ this.api = await Api.ApiPromise.create({ provider: this.wsProvider, initWasm: false });
47
52
  }
48
53
  await this.api.isReadyOrError;
49
54
  try {
package/dist/server.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { ApiPromise } from '@polkadot/api';
1
+ import { ApiPromise } from '@polkadot/api/promise/Api';
2
2
  import { ContractAbi, NetworkConfig, ProcaptchaOutput, ProsopoServerConfigOutput } from '@prosopo/types';
3
3
  import { Keyring } from '@polkadot/keyring';
4
4
  import { KeyringPair } from '@polkadot/keyring/types';
5
5
  import { Logger } from '@prosopo/common';
6
6
  import { ProsopoCaptchaContract } from '@prosopo/contract';
7
7
  import { ProviderApi } from '@prosopo/api';
8
- import { WsProvider } from '@polkadot/rpc-provider';
8
+ import { WsProvider } from '@polkadot/rpc-provider/ws';
9
9
  export declare class ProsopoServer {
10
10
  config: ProsopoServerConfigOutput;
11
11
  contract: ProsopoCaptchaContract | undefined;
12
12
  prosopoContractAddress: string;
13
- dappContractAddress: string;
13
+ dappContractAddress: string | undefined;
14
14
  defaultEnvironment: string;
15
15
  contractName: string;
16
16
  abi: ContractAbi;
@@ -22,6 +22,7 @@ export declare class ProsopoServer {
22
22
  network: NetworkConfig;
23
23
  constructor(config: ProsopoServerConfigOutput, pair?: KeyringPair);
24
24
  getProviderApi(providerUrl: string): Promise<ProviderApi>;
25
+ getDappContractAddress(): string;
25
26
  isReady(): Promise<void>;
26
27
  getSigner(): Promise<void>;
27
28
  getApi(): ApiPromise;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EACH,WAAW,EACX,aAAa,EAEb,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAY,MAAM,EAA+C,MAAM,iBAAiB,CAAA;AAC/F,OAAO,EAAE,sBAAsB,EAAkB,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGnD,qBAAa,aAAa;IACtB,MAAM,EAAE,yBAAyB,CAAA;IACjC,QAAQ,EAAE,sBAAsB,GAAG,SAAS,CAAA;IAC5C,sBAAsB,EAAE,MAAM,CAAA;IAC9B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAA;IAC7B,GAAG,EAAE,UAAU,GAAG,SAAS,CAAA;IAC3B,OAAO,EAAE,aAAa,CAAA;gBAEV,MAAM,EAAE,yBAAyB,EAAE,IAAI,CAAC,EAAE,WAAW;IAiBpD,cAAc,CAAC,WAAW,EAAE,MAAM;IAIzC,OAAO;IAUP,S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B,EAAE,IAAI,CAAC,EAAE,WAAW;IAiBpD,cAAc,CAAC,WAAW,EAAE,MAAM;IAIxC,sBAAsB,IAAI,MAAM;IAOjC,OAAO;IAUP,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAchC,MAAM,IAAI,UAAU;IAOpB,WAAW,IAAI,sBAAsB;IAOxB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BvD,cAAc,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAWjE"}
package/dist/server.js CHANGED
@@ -11,14 +11,14 @@
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { ApiPromise } from '@polkadot/api';
14
+ import { ApiPromise } from '@polkadot/api/promise/Api';
15
15
  import { NetworkNamesSchema, } from '@prosopo/types';
16
16
  import { Keyring } from '@polkadot/keyring';
17
17
  import { ProsopoEnvError, getLogger, trimProviderUrl } from '@prosopo/common';
18
18
  import { ProsopoCaptchaContract, getZeroAddress } from '@prosopo/contract';
19
19
  import { ProviderApi } from '@prosopo/api';
20
- import { ContractAbi as abiJson } from '@prosopo/captcha-contract';
21
- import { WsProvider } from '@polkadot/rpc-provider';
20
+ import { WsProvider } from '@polkadot/rpc-provider/ws';
21
+ import { ContractAbi as abiJson } from '@prosopo/captcha-contract/contract-info';
22
22
  import { get } from '@prosopo/util';
23
23
  export class ProsopoServer {
24
24
  constructor(config, pair) {
@@ -29,7 +29,7 @@ export class ProsopoServer {
29
29
  this.network = get(this.config.networks, networkName);
30
30
  this.wsProvider = new WsProvider(this.network.endpoint);
31
31
  this.prosopoContractAddress = this.network.contract.address;
32
- this.dappContractAddress = this.config.account.address || getZeroAddress().toString();
32
+ this.dappContractAddress = this.config.account.address;
33
33
  this.contractName = this.network.contract.name;
34
34
  this.logger = getLogger(this.config.logLevel, '@prosopo/server');
35
35
  this.keyring = new Keyring({
@@ -38,11 +38,17 @@ export class ProsopoServer {
38
38
  this.abi = JSON.parse(abiJson);
39
39
  }
40
40
  async getProviderApi(providerUrl) {
41
- return new ProviderApi(this.network, providerUrl, this.dappContractAddress);
41
+ return new ProviderApi(this.network, providerUrl, this.getDappContractAddress());
42
+ }
43
+ getDappContractAddress() {
44
+ if (!this.dappContractAddress) {
45
+ return getZeroAddress(this.getApi()).toString();
46
+ }
47
+ return this.dappContractAddress;
42
48
  }
43
49
  async isReady() {
44
50
  try {
45
- this.api = await ApiPromise.create({ provider: this.wsProvider });
51
+ this.api = await ApiPromise.create({ provider: this.wsProvider, initWasm: false });
46
52
  await this.getSigner();
47
53
  await this.getContractApi();
48
54
  }
@@ -53,7 +59,7 @@ export class ProsopoServer {
53
59
  async getSigner() {
54
60
  if (this.pair) {
55
61
  if (!this.api) {
56
- this.api = await ApiPromise.create({ provider: this.wsProvider });
62
+ this.api = await ApiPromise.create({ provider: this.wsProvider, initWasm: false });
57
63
  }
58
64
  await this.api.isReadyOrError;
59
65
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAGH,kBAAkB,GAGrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAoB,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC/F,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAA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MAAM,EAAE;iBACR,MAAM,EAAE,CAAA;SAChB;IACL,CAAC;IAEM,KAAK,CAAC,cAAc;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAsB,CACtC,IAAI,CAAC,MAAM,EAAE,EACb,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,sBAAsB,EAC3B,IAAI,CAAC,YAAY,EACjB,CAAC,EACD,IAAI,CAAC,IAAI,CACZ,CAAA;QACD,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/server",
3
- "version": "0.2.11",
3
+ "version": "0.2.14",
4
4
  "description": "NodeJS package for server side communication with the prosopo captcha client",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -33,15 +33,15 @@
33
33
  "homepage": "https://github.com/prosopo/captcha#readme",
34
34
  "sideEffects": false,
35
35
  "dependencies": {
36
- "@polkadot/api": "10.9.1",
37
- "@polkadot/keyring": "12.3.2",
38
- "@polkadot/rpc-provider": "10.9.1",
39
- "@polkadot/types": "10.9.1",
40
- "@prosopo/api": "0.2.11",
41
- "@prosopo/contract": "0.2.11",
42
- "@prosopo/procaptcha": "0.2.11",
43
- "@prosopo/captcha-contract": "0.2.11",
44
- "@prosopo/types": "0.2.11"
36
+ "@polkadot/api": "10.10.1",
37
+ "@polkadot/keyring": "12.5.1",
38
+ "@polkadot/rpc-provider": "10.10.1",
39
+ "@polkadot/types": "10.10.1",
40
+ "@prosopo/api": "0.2.14",
41
+ "@prosopo/contract": "0.2.14",
42
+ "@prosopo/procaptcha": "0.2.14",
43
+ "@prosopo/captcha-contract": "0.2.14",
44
+ "@prosopo/types": "0.2.14"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tslib": "2.6.2",
@@ -1,339 +0,0 @@
1
- "use strict";
2
- const typechainTypes = require("@727-ventures/typechain-types");
3
- class Methods {
4
- constructor(nativeContract, apiPromise) {
5
- this.__nativeContract = nativeContract;
6
- this.__apiPromise = apiPromise;
7
- }
8
- /**
9
- * getGitCommitId
10
- *
11
- */
12
- getGitCommitId(__options) {
13
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getGitCommitId", [], __options);
14
- }
15
- /**
16
- * getAdmin
17
- *
18
- */
19
- getAdmin(__options) {
20
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getAdmin", [], __options);
21
- }
22
- /**
23
- * getPayees
24
- *
25
- */
26
- getPayees(__options) {
27
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getPayees", [], __options);
28
- }
29
- /**
30
- * getDappPayees
31
- *
32
- */
33
- getDappPayees(__options) {
34
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getDappPayees", [], __options);
35
- }
36
- /**
37
- * getStatuses
38
- *
39
- */
40
- getStatuses(__options) {
41
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getStatuses", [], __options);
42
- }
43
- /**
44
- * getProviderStakeThreshold
45
- *
46
- */
47
- getProviderStakeThreshold(__options) {
48
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getProviderStakeThreshold", [], __options);
49
- }
50
- /**
51
- * getDappStakeThreshold
52
- *
53
- */
54
- getDappStakeThreshold(__options) {
55
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getDappStakeThreshold", [], __options);
56
- }
57
- /**
58
- * getMaxProviderFee
59
- *
60
- */
61
- getMaxProviderFee(__options) {
62
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getMaxProviderFee", [], __options);
63
- }
64
- /**
65
- * getMinNumActiveProviders
66
- *
67
- */
68
- getMinNumActiveProviders(__options) {
69
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getMinNumActiveProviders", [], __options);
70
- }
71
- /**
72
- * getBlockTime
73
- *
74
- */
75
- getBlockTime(__options) {
76
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getBlockTime", [], __options);
77
- }
78
- /**
79
- * getMaxUserHistoryAgeSeconds
80
- *
81
- */
82
- getMaxUserHistoryAgeSeconds(__options) {
83
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getMaxUserHistoryAgeSeconds", [], __options);
84
- }
85
- /**
86
- * getMaxUserHistoryLen
87
- *
88
- */
89
- getMaxUserHistoryLen(__options) {
90
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getMaxUserHistoryLen", [], __options);
91
- }
92
- /**
93
- * getMaxUserHistoryAgeBlocks
94
- *
95
- */
96
- getMaxUserHistoryAgeBlocks(__options) {
97
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getMaxUserHistoryAgeBlocks", [], __options);
98
- }
99
- /**
100
- * providerRegister
101
- *
102
- * @param { Array<(number | string | BN)> } url,
103
- * @param { (number | string | BN) } fee,
104
- * @param { ArgumentTypes.Payee } payee,
105
- */
106
- providerRegister(url, fee, payee, __options) {
107
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerRegister", [url, fee, payee], __options);
108
- }
109
- /**
110
- * providerUpdate
111
- *
112
- * @param { Array<(number | string | BN)> } url,
113
- * @param { (number | string | BN) } fee,
114
- * @param { ArgumentTypes.Payee } payee,
115
- */
116
- providerUpdate(url, fee, payee, __options) {
117
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerUpdate", [url, fee, payee], __options);
118
- }
119
- /**
120
- * providerDeactivate
121
- *
122
- */
123
- providerDeactivate(__options) {
124
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerDeactivate", [], __options);
125
- }
126
- /**
127
- * providerDeregister
128
- *
129
- */
130
- providerDeregister(__options) {
131
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerDeregister", [], __options);
132
- }
133
- /**
134
- * getProvider
135
- *
136
- * @param { ArgumentTypes.AccountId } account,
137
- */
138
- getProvider(account, __options) {
139
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getProvider", [account], __options);
140
- }
141
- /**
142
- * providerFund
143
- *
144
- */
145
- providerFund(__options) {
146
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerFund", [], __options);
147
- }
148
- /**
149
- * providerSetDataset
150
- *
151
- * @param { ArgumentTypes.Hash } datasetId,
152
- * @param { ArgumentTypes.Hash } datasetIdContent,
153
- */
154
- providerSetDataset(datasetId, datasetIdContent, __options) {
155
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerSetDataset", [datasetId, datasetIdContent], __options);
156
- }
157
- /**
158
- * getDapp
159
- *
160
- * @param { ArgumentTypes.AccountId } contract,
161
- */
162
- getDapp(contract, __options) {
163
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getDapp", [contract], __options);
164
- }
165
- /**
166
- * dappRegister
167
- *
168
- * @param { ArgumentTypes.AccountId } contract,
169
- * @param { ArgumentTypes.DappPayee } payee,
170
- */
171
- dappRegister(contract, payee, __options) {
172
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappRegister", [contract, payee], __options);
173
- }
174
- /**
175
- * dappUpdate
176
- *
177
- * @param { ArgumentTypes.AccountId } contract,
178
- * @param { ArgumentTypes.DappPayee } payee,
179
- * @param { ArgumentTypes.AccountId } owner,
180
- */
181
- dappUpdate(contract, payee, owner, __options) {
182
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappUpdate", [contract, payee, owner], __options);
183
- }
184
- /**
185
- * dappFund
186
- *
187
- * @param { ArgumentTypes.AccountId } contract,
188
- */
189
- dappFund(contract, __options) {
190
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappFund", [contract], __options);
191
- }
192
- /**
193
- * dappDeregister
194
- *
195
- * @param { ArgumentTypes.AccountId } contract,
196
- */
197
- dappDeregister(contract, __options) {
198
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappDeregister", [contract], __options);
199
- }
200
- /**
201
- * dappDeactivate
202
- *
203
- * @param { ArgumentTypes.AccountId } contract,
204
- */
205
- dappDeactivate(contract, __options) {
206
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappDeactivate", [contract], __options);
207
- }
208
- /**
209
- * getUserHistorySummary
210
- *
211
- * @param { ArgumentTypes.AccountId } userAccount,
212
- */
213
- getUserHistorySummary(userAccount, __options) {
214
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getUserHistorySummary", [userAccount], __options);
215
- }
216
- /**
217
- * providerCommit
218
- *
219
- * @param { ArgumentTypes.Commit } commit,
220
- */
221
- providerCommit(commit, __options) {
222
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerCommit", [commit], __options);
223
- }
224
- /**
225
- * providerCommitMany
226
- *
227
- * @param { Array<ArgumentTypes.Commit> } commits,
228
- */
229
- providerCommitMany(commits, __options) {
230
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "providerCommitMany", [commits], __options);
231
- }
232
- /**
233
- * dappOperatorIsHumanUser
234
- *
235
- * @param { ArgumentTypes.AccountId } userAccount,
236
- * @param { (number | string | BN) } threshold,
237
- */
238
- dappOperatorIsHumanUser(userAccount, threshold, __options) {
239
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappOperatorIsHumanUser", [userAccount, threshold], __options);
240
- }
241
- /**
242
- * dappOperatorLastCorrectCaptcha
243
- *
244
- * @param { ArgumentTypes.AccountId } userAccount,
245
- */
246
- dappOperatorLastCorrectCaptcha(userAccount, __options) {
247
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "dappOperatorLastCorrectCaptcha", [userAccount], __options);
248
- }
249
- /**
250
- * getCaptchaData
251
- *
252
- * @param { ArgumentTypes.Hash } datasetId,
253
- */
254
- getCaptchaData(datasetId, __options) {
255
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getCaptchaData", [datasetId], __options);
256
- }
257
- /**
258
- * getUser
259
- *
260
- * @param { ArgumentTypes.AccountId } userAccount,
261
- */
262
- getUser(userAccount, __options) {
263
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getUser", [userAccount], __options);
264
- }
265
- /**
266
- * getCommit
267
- *
268
- * @param { ArgumentTypes.Hash } commitId,
269
- */
270
- getCommit(commitId, __options) {
271
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getCommit", [commitId], __options);
272
- }
273
- /**
274
- * listProvidersByAccounts
275
- *
276
- * @param { Array<ArgumentTypes.AccountId> } providerAccounts,
277
- */
278
- listProvidersByAccounts(providerAccounts, __options) {
279
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "listProvidersByAccounts", [providerAccounts], __options);
280
- }
281
- /**
282
- * listProvidersByStatus
283
- *
284
- * @param { Array<ArgumentTypes.GovernanceStatus> } statuses,
285
- */
286
- listProvidersByStatus(statuses, __options) {
287
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "listProvidersByStatus", [statuses], __options);
288
- }
289
- /**
290
- * getRandomActiveProvider
291
- *
292
- * @param { ArgumentTypes.AccountId } userAccount,
293
- * @param { ArgumentTypes.AccountId } dappContract,
294
- */
295
- getRandomActiveProvider(userAccount, dappContract, __options) {
296
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getRandomActiveProvider", [userAccount, dappContract], __options);
297
- }
298
- /**
299
- * getAllProviderAccounts
300
- *
301
- */
302
- getAllProviderAccounts(__options) {
303
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getAllProviderAccounts", [], __options);
304
- }
305
- /**
306
- * getRandomNumber
307
- *
308
- * @param { (string | number | BN) } len,
309
- * @param { ArgumentTypes.AccountId } userAccount,
310
- * @param { ArgumentTypes.AccountId } dappContract,
311
- */
312
- getRandomNumber(len, userAccount, dappContract, __options) {
313
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "getRandomNumber", [len, userAccount, dappContract], __options);
314
- }
315
- /**
316
- * terminate
317
- *
318
- */
319
- terminate(__options) {
320
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "terminate", [], __options);
321
- }
322
- /**
323
- * withdraw
324
- *
325
- * @param { (string | number | BN) } amount,
326
- */
327
- withdraw(amount, __options) {
328
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "withdraw", [amount], __options);
329
- }
330
- /**
331
- * setCodeHash
332
- *
333
- * @param { Array<(number | string | BN)> } codeHash,
334
- */
335
- setCodeHash(codeHash, __options) {
336
- return typechainTypes.buildSubmittableExtrinsic(this.__apiPromise, this.__nativeContract, "setCodeHash", [codeHash], __options);
337
- }
338
- }
339
- module.exports = Methods;