@human-protocol/sdk 3.0.7 → 4.0.0

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 (64) hide show
  1. package/dist/constants.d.ts +2 -25
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +25 -66
  4. package/dist/decorators.js +1 -1
  5. package/dist/encryption.d.ts +21 -29
  6. package/dist/encryption.d.ts.map +1 -1
  7. package/dist/encryption.js +34 -36
  8. package/dist/error.d.ts +31 -28
  9. package/dist/error.d.ts.map +1 -1
  10. package/dist/error.js +36 -33
  11. package/dist/escrow.d.ts +118 -112
  12. package/dist/escrow.d.ts.map +1 -1
  13. package/dist/escrow.js +254 -180
  14. package/dist/graphql/queries/operator.d.ts.map +1 -1
  15. package/dist/graphql/queries/operator.js +15 -7
  16. package/dist/graphql/queries/statistics.d.ts.map +1 -1
  17. package/dist/graphql/queries/statistics.js +0 -2
  18. package/dist/graphql/queries/transaction.d.ts.map +1 -1
  19. package/dist/graphql/queries/transaction.js +23 -10
  20. package/dist/graphql/types.d.ts +0 -2
  21. package/dist/graphql/types.d.ts.map +1 -1
  22. package/dist/interfaces.d.ts +29 -12
  23. package/dist/interfaces.d.ts.map +1 -1
  24. package/dist/kvstore.d.ts +16 -16
  25. package/dist/kvstore.d.ts.map +1 -1
  26. package/dist/kvstore.js +16 -16
  27. package/dist/operator.d.ts +11 -10
  28. package/dist/operator.d.ts.map +1 -1
  29. package/dist/operator.js +36 -11
  30. package/dist/staking.d.ts +26 -118
  31. package/dist/staking.d.ts.map +1 -1
  32. package/dist/staking.js +46 -173
  33. package/dist/statistics.d.ts +10 -29
  34. package/dist/statistics.d.ts.map +1 -1
  35. package/dist/statistics.js +13 -30
  36. package/dist/storage.d.ts +13 -18
  37. package/dist/storage.d.ts.map +1 -1
  38. package/dist/storage.js +30 -25
  39. package/dist/transaction.js +1 -1
  40. package/dist/types.d.ts +23 -6
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js +1 -1
  43. package/dist/utils.d.ts +0 -1
  44. package/dist/utils.d.ts.map +1 -1
  45. package/dist/utils.js +0 -1
  46. package/package.json +8 -4
  47. package/src/constants.ts +25 -66
  48. package/src/decorators.ts +1 -1
  49. package/src/encryption.ts +21 -29
  50. package/src/error.ts +39 -37
  51. package/src/escrow.ts +360 -216
  52. package/src/graphql/queries/operator.ts +15 -7
  53. package/src/graphql/queries/statistics.ts +0 -2
  54. package/src/graphql/queries/transaction.ts +23 -13
  55. package/src/graphql/types.ts +0 -2
  56. package/src/interfaces.ts +30 -13
  57. package/src/kvstore.ts +17 -17
  58. package/src/operator.ts +47 -12
  59. package/src/staking.ts +53 -187
  60. package/src/statistics.ts +13 -30
  61. package/src/storage.ts +13 -18
  62. package/src/transaction.ts +2 -2
  63. package/src/types.ts +24 -6
  64. package/src/utils.ts +0 -1
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { TransactionLike } from 'ethers';
2
+
1
3
  /**
2
4
  * Enum for escrow statuses.
3
5
  * @readonly
@@ -21,7 +23,7 @@ export enum EscrowStatus {
21
23
  */
22
24
  Paid,
23
25
  /**
24
- * Escrow is finished..
26
+ * Escrow is finished.
25
27
  */
26
28
  Complete,
27
29
  /**
@@ -115,10 +117,6 @@ export type NetworkData = {
115
117
  * Staking contract address
116
118
  */
117
119
  stakingAddress: string;
118
- /**
119
- * RewardPool contract address
120
- */
121
- rewardPoolAddress: string;
122
120
  /**
123
121
  * KVStore contract address
124
122
  */
@@ -128,7 +126,7 @@ export type NetworkData = {
128
126
  */
129
127
  subgraphUrl: string;
130
128
  /**
131
- * Subgraph URL
129
+ * Subgraph URL API key
132
130
  */
133
131
  subgraphUrlApiKey: string;
134
132
  /**
@@ -154,3 +152,23 @@ export type EscrowCancel = {
154
152
  */
155
153
  amountRefunded: bigint;
156
154
  };
155
+
156
+ /**
157
+ * Represents the response data for an escrow withdrawal.
158
+ */
159
+ export type EscrowWithdraw = {
160
+ /**
161
+ * The hash of the transaction associated with the escrow withdrawal.
162
+ */
163
+ txHash: string;
164
+ /**
165
+ * The address of the token used for the withdrawal.
166
+ */
167
+ tokenAddress: string;
168
+ /**
169
+ * The amount withdrawn from the escrow.
170
+ */
171
+ amountWithdrawn: bigint;
172
+ };
173
+
174
+ export type TransactionLikeWithNonce = TransactionLike & { nonce: number };
package/src/utils.ts CHANGED
@@ -57,7 +57,6 @@ export const isValidUrl = (url: string) => {
57
57
  * **Get the subgraph URL.*
58
58
  *
59
59
  * @param {NetworkData} networkData
60
- * @param {string} apiKey
61
60
  * @returns
62
61
  */
63
62
  export const getSubgraphUrl = (networkData: NetworkData) => {