@prosopo/provider 0.2.13 → 0.2.15

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 (87) hide show
  1. package/dist/api/admin.js +0 -56
  2. package/dist/api/admin.js.map +1 -1
  3. package/dist/api/captcha.d.ts +0 -6
  4. package/dist/api/captcha.d.ts.map +1 -1
  5. package/dist/api/captcha.js +24 -83
  6. package/dist/api/captcha.js.map +1 -1
  7. package/dist/batch/commitments.d.ts +2 -2
  8. package/dist/batch/commitments.d.ts.map +1 -1
  9. package/dist/batch/commitments.js +2 -20
  10. package/dist/batch/commitments.js.map +1 -1
  11. package/dist/batch/index.js +0 -13
  12. package/dist/batch/index.js.map +1 -1
  13. package/dist/cjs/api/captcha.cjs +23 -31
  14. package/dist/cjs/batch/commitments.cjs +12 -12
  15. package/dist/cjs/tasks/tasks.cjs +22 -21
  16. package/dist/cjs/util.cjs +9 -8
  17. package/dist/index.js +0 -13
  18. package/dist/index.js.map +1 -1
  19. package/dist/scheduler.js +0 -15
  20. package/dist/scheduler.js.map +1 -1
  21. package/dist/tasks/calculateSolutions.d.ts +0 -3
  22. package/dist/tasks/calculateSolutions.d.ts.map +1 -1
  23. package/dist/tasks/calculateSolutions.js +0 -27
  24. package/dist/tasks/calculateSolutions.js.map +1 -1
  25. package/dist/tasks/index.js +0 -13
  26. package/dist/tasks/index.js.map +1 -1
  27. package/dist/tasks/tasks.d.ts +3 -66
  28. package/dist/tasks/tasks.d.ts.map +1 -1
  29. package/dist/tasks/tasks.js +6 -87
  30. package/dist/tasks/tasks.js.map +1 -1
  31. package/dist/tests/accounts.d.ts.map +1 -1
  32. package/dist/tests/accounts.js +2 -16
  33. package/dist/tests/accounts.js.map +1 -1
  34. package/dist/tests/batch/commitments.test.d.ts.map +1 -1
  35. package/dist/tests/batch/commitments.test.js +12 -77
  36. package/dist/tests/batch/commitments.test.js.map +1 -1
  37. package/dist/tests/contract/helpers.test.d.ts.map +1 -1
  38. package/dist/tests/contract/helpers.test.js +3 -3
  39. package/dist/tests/contract/helpers.test.js.map +1 -1
  40. package/dist/tests/dataUtils/DatabaseAccounts.js +0 -1
  41. package/dist/tests/dataUtils/DatabaseAccounts.js.map +1 -1
  42. package/dist/tests/dataUtils/DatabasePopulator.d.ts +1 -1
  43. package/dist/tests/dataUtils/DatabasePopulator.d.ts.map +1 -1
  44. package/dist/tests/dataUtils/DatabasePopulator.js +10 -16
  45. package/dist/tests/dataUtils/DatabasePopulator.js.map +1 -1
  46. package/dist/tests/dataUtils/dapp-example-contract/loadFiles.d.ts +1 -1
  47. package/dist/tests/dataUtils/dapp-example-contract/loadFiles.d.ts.map +1 -1
  48. package/dist/tests/dataUtils/dapp-example-contract/loadFiles.js +3 -17
  49. package/dist/tests/dataUtils/dapp-example-contract/loadFiles.js.map +1 -1
  50. package/dist/tests/dataUtils/funds.d.ts +1 -16
  51. package/dist/tests/dataUtils/funds.d.ts.map +1 -1
  52. package/dist/tests/dataUtils/funds.js +2 -25
  53. package/dist/tests/dataUtils/funds.js.map +1 -1
  54. package/dist/tests/dataUtils/populateDatabase.d.ts +1 -1
  55. package/dist/tests/dataUtils/populateDatabase.d.ts.map +1 -1
  56. package/dist/tests/dataUtils/populateDatabase.js +0 -1
  57. package/dist/tests/dataUtils/populateDatabase.js.map +1 -1
  58. package/dist/tests/tasks/tasks.test.d.ts.map +1 -1
  59. package/dist/tests/tasks/tasks.test.js +15 -221
  60. package/dist/tests/tasks/tasks.test.js.map +1 -1
  61. package/dist/tests/util.test.js +0 -14
  62. package/dist/tests/util.test.js.map +1 -1
  63. package/dist/util.d.ts +0 -11
  64. package/dist/util.d.ts.map +1 -1
  65. package/dist/util.js +3 -33
  66. package/dist/util.js.map +1 -1
  67. package/package.json +10 -11
  68. package/dist/cjs/contracts/captcha/dist/build-extrinsic/captcha.cjs +0 -339
  69. package/dist/cjs/contracts/captcha/dist/contract-info/captcha.cjs +0 -6
  70. package/dist/cjs/contracts/captcha/dist/contracts/captcha.cjs +0 -79
  71. package/dist/cjs/contracts/captcha/dist/data/captcha.json.cjs +0 -3374
  72. package/dist/cjs/contracts/captcha/dist/event-data/captcha.json.cjs +0 -3
  73. package/dist/cjs/contracts/captcha/dist/events/captcha.cjs +0 -23
  74. package/dist/cjs/contracts/captcha/dist/index.cjs +0 -44
  75. package/dist/cjs/contracts/captcha/dist/mixed-methods/captcha.cjs +0 -470
  76. package/dist/cjs/contracts/captcha/dist/query/captcha.cjs +0 -468
  77. package/dist/cjs/contracts/captcha/dist/shared/utils.cjs +0 -31
  78. package/dist/cjs/contracts/captcha/dist/tx-sign-and-send/captcha.cjs +0 -426
  79. package/dist/cjs/contracts/captcha/dist/types-arguments/captcha.cjs +0 -62
  80. package/dist/tests/data/captchas.d.ts +0 -37
  81. package/dist/tests/data/captchas.d.ts.map +0 -1
  82. package/dist/tests/data/captchas.js +0 -902
  83. package/dist/tests/data/captchas.js.map +0 -1
  84. package/dist/tests/data/captchas1.json +0 -53
  85. package/dist/tests/data/captchas2.json +0 -69
  86. package/dist/tests/data/captchas3.json +0 -54
  87. package/dist/tests/data/captchas4.json +0 -53
package/dist/util.js CHANGED
@@ -1,29 +1,16 @@
1
- // Copyright 2021-2023 Prosopo (UK) Ltd.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
1
  import { ScheduledTaskStatus } from '@prosopo/types';
15
2
  import { ProsopoEnvError } from '@prosopo/common';
16
3
  import { arrayJoin } from '@prosopo/common';
17
4
  import { at } from '@prosopo/util';
18
- import { decodeAddress, encodeAddress } from '@polkadot/keyring';
19
- import { hexToU8a, isHex } from '@polkadot/util';
5
+ import { decodeAddress, encodeAddress } from '@polkadot/util-crypto/address';
6
+ import { hexToU8a } from '@polkadot/util/hex';
7
+ import { isHex } from '@polkadot/util/is';
20
8
  import pl from 'nodejs-polars';
21
9
  export function encodeStringAddress(address) {
22
10
  try {
23
11
  return encodeAddress(isHex(address) ? hexToU8a(address) : decodeAddress(address));
24
12
  }
25
13
  catch (error) {
26
- // TODO fix error handling
27
14
  throw new ProsopoEnvError(error, 'CONTRACT.INVALID_ADDRESS', {}, address);
28
15
  }
29
16
  }
@@ -36,17 +23,11 @@ export function shuffleArray(array) {
36
23
  }
37
24
  return array;
38
25
  }
39
- /**
40
- * Executes promises in order
41
- * @param array - array of promises
42
- * @returns PromiseQueueRes\<T\>
43
- */
44
26
  export async function promiseQueue(array) {
45
27
  const ret = [];
46
28
  await [...array, () => Promise.resolve(undefined)].reduce((promise, curr, i) => {
47
29
  return promise
48
30
  .then((res) => {
49
- // first iteration has no res (initial reduce result)
50
31
  if (res) {
51
32
  ret.push({ data: res });
52
33
  }
@@ -73,19 +54,14 @@ export function calculateNewSolutions(solutions, winningNumberOfSolutions) {
73
54
  df = df.drop('salt');
74
55
  const group = df.groupBy(['captchaId', 'solutionKey']).agg(pl.count('captchaContentId').alias('count'));
75
56
  const filtered = group.filter(pl.col('count').gt(winningNumberOfSolutions));
76
- // TODO is below correct? 'solutionKey' does not exist in the type
77
57
  const key = filtered['solutionKey'];
78
58
  return filtered.withColumn(key.str.split(',').rename('solution'));
79
59
  }
80
60
  export function updateSolutions(solutions, captchas, logger) {
81
- // Note - loading the dataset in nodejs-polars doesn't work because of nested objects, which is why this is done in
82
- // a map instead of a join
83
61
  return captchas.map((captcha) => {
84
- // try to find the solution in the solutions dataframe
85
62
  if (!captcha.solution) {
86
63
  try {
87
64
  const captchaSolutions = [
88
- // TODO is below correct? 'solution' is not in the type
89
65
  ...solutions.filter(pl.col('captchaId').eq(pl.lit(captcha.captchaId)))['solution'].values(),
90
66
  ];
91
67
  if (captchaSolutions.length > 0) {
@@ -100,12 +76,6 @@ export function updateSolutions(solutions, captchas, logger) {
100
76
  return captcha;
101
77
  });
102
78
  }
103
- /**
104
- * Check if there is a batch running.
105
- * If the batch task is running and not completed, return true.
106
- * If the batch task is running and completed, return false.
107
- * Otherwise, the batch task is not running, return false.
108
- */
109
79
  export async function checkIfTaskIsRunning(taskName, db) {
110
80
  const runningTask = await db.getLastScheduledTaskStatus(taskName, ScheduledTaskStatus.Running);
111
81
  if (runningTask) {
package/dist/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.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,EAAgD,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAElG,OAAO,EAAU,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,MAAM,eAAe,CAAA;AAE9B,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAC/C,IAAI;QACA,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;KACpF;IAAC,OAAO,KAAK,EAAE;QACZ,0BAA0B;QAC1B,MAAM,IAAI,eAAe,CAAC,KAAc,EAA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AAS,CAC3E,UAAU,CACb,CAAC,MAAM,EAAE;iBACb,CAAA;gBACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC7B,OAAO,CAAC,QAAQ,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAA;oBACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAA;iBACxB;aACJ;YAAC,MAAM;gBACJ,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;aACrE;SACJ;QACD,OAAO,OAAO,CAAA;IAClB,CAAC,CAAC,CAAA;AACN,CAAC;AAQD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAA4B,EAAE,EAAY;IACjF,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAA;IAC9F,IAAI,WAAW,EAAE;QACb,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,sBAAsB,CAAC,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;QACxG,OAAO,CAAC,aAAa,CAAA;KACxB;IACD,OAAO,KAAK,CAAA;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/provider",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,6 @@
20
20
  "build": "tsc --build --verbose tsconfig.json",
21
21
  "build:cjs": "npx vite --config vite.cjs.config.ts build",
22
22
  "build:debug": "tsc --build --verbose",
23
- "build:test": "tsc --build --verbose tsconfig.test.json",
24
23
  "build:config": "tsc --project",
25
24
  "mnemonic": "ts-node ./scripts/generateMnemonic.ts",
26
25
  "coverage": "npx c8 npm run test",
@@ -34,15 +33,15 @@
34
33
  "@polkadot/types": "10.10.1",
35
34
  "@polkadot/util": "12.5.1",
36
35
  "@polkadot/util-crypto": "12.5.1",
37
- "@prosopo/common": "0.2.13",
38
- "@prosopo/contract": "0.2.13",
39
- "@prosopo/database": "0.2.13",
40
- "@prosopo/datasets": "0.2.13",
41
- "@prosopo/env": "0.2.13",
42
- "@prosopo/types": "0.2.13",
43
- "@prosopo/types-database": "0.2.13",
44
- "@prosopo/types-env": "0.2.13",
45
- "@prosopo/captcha-contract": "0.2.13",
36
+ "@prosopo/common": "0.2.15",
37
+ "@prosopo/contract": "0.2.15",
38
+ "@prosopo/database": "0.2.15",
39
+ "@prosopo/datasets": "0.2.15",
40
+ "@prosopo/env": "0.2.15",
41
+ "@prosopo/types": "0.2.15",
42
+ "@prosopo/types-database": "0.2.15",
43
+ "@prosopo/types-env": "0.2.15",
44
+ "@prosopo/captcha-contract": "0.2.15",
46
45
  "cron": "^2.1.0",
47
46
  "cron-parser": "^4.5.0",
48
47
  "express": "^4.18.1",
@@ -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;