@human-protocol/sdk 1.1.10 → 1.1.12

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 (61) hide show
  1. package/README.md +2 -0
  2. package/dist/constants.js +8 -8
  3. package/dist/error.d.ts +4 -0
  4. package/dist/error.d.ts.map +1 -1
  5. package/dist/error.js +6 -2
  6. package/dist/escrow.d.ts +38 -18
  7. package/dist/escrow.d.ts.map +1 -1
  8. package/dist/escrow.js +138 -51
  9. package/dist/graphql/queries/escrow.d.ts +3 -2
  10. package/dist/graphql/queries/escrow.d.ts.map +1 -1
  11. package/dist/graphql/queries/escrow.js +42 -22
  12. package/dist/graphql/queries/hmtoken.d.ts +2 -0
  13. package/dist/graphql/queries/hmtoken.d.ts.map +1 -0
  14. package/dist/graphql/queries/hmtoken.js +21 -0
  15. package/dist/graphql/queries/index.d.ts +3 -0
  16. package/dist/graphql/queries/index.d.ts.map +1 -1
  17. package/dist/graphql/queries/index.js +3 -0
  18. package/dist/graphql/queries/payout.d.ts +3 -0
  19. package/dist/graphql/queries/payout.d.ts.map +1 -0
  20. package/dist/graphql/queries/payout.js +43 -0
  21. package/dist/graphql/queries/staking.d.ts +4 -0
  22. package/dist/graphql/queries/staking.d.ts.map +1 -0
  23. package/dist/graphql/queries/staking.js +58 -0
  24. package/dist/graphql/queries/statistics.d.ts +5 -0
  25. package/dist/graphql/queries/statistics.d.ts.map +1 -0
  26. package/dist/graphql/queries/statistics.js +95 -0
  27. package/dist/graphql/types.d.ts +114 -0
  28. package/dist/graphql/types.d.ts.map +1 -1
  29. package/dist/index.d.ts +3 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +4 -1
  32. package/dist/interfaces.d.ts +40 -9
  33. package/dist/interfaces.d.ts.map +1 -1
  34. package/dist/staking.d.ts +8 -8
  35. package/dist/staking.d.ts.map +1 -1
  36. package/dist/staking.js +16 -38
  37. package/dist/statistics.d.ts +62 -0
  38. package/dist/statistics.d.ts.map +1 -0
  39. package/dist/statistics.js +224 -0
  40. package/dist/storage.d.ts +5 -2
  41. package/dist/storage.d.ts.map +1 -1
  42. package/dist/storage.js +7 -4
  43. package/dist/types.d.ts +4 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/src/constants.ts +8 -8
  47. package/src/error.ts +7 -0
  48. package/src/escrow.ts +184 -58
  49. package/src/graphql/queries/escrow.ts +51 -21
  50. package/src/graphql/queries/hmtoken.ts +17 -0
  51. package/src/graphql/queries/index.ts +3 -0
  52. package/src/graphql/queries/payout.ts +41 -0
  53. package/src/graphql/queries/staking.ts +57 -0
  54. package/src/graphql/queries/statistics.ts +96 -0
  55. package/src/graphql/types.ts +133 -0
  56. package/src/index.ts +10 -2
  57. package/src/interfaces.ts +43 -9
  58. package/src/staking.ts +23 -53
  59. package/src/statistics.ts +312 -0
  60. package/src/storage.ts +7 -4
  61. package/src/types.ts +4 -0
package/src/storage.ts CHANGED
@@ -13,6 +13,9 @@ import { UploadFile, StorageCredentials, StorageParams } from './types';
13
13
  import { isValidUrl } from './utils';
14
14
  import { HttpStatus } from './constants';
15
15
 
16
+ /**
17
+ * @deprecated StorageClient is deprecated. Use Minio.Client directly.
18
+ */
16
19
  export class StorageClient {
17
20
  private client: Minio.Client;
18
21
  private clientParams: StorageParams;
@@ -20,17 +23,17 @@ export class StorageClient {
20
23
  /**
21
24
  * **Storage client constructor**
22
25
  *
23
- * @param {StorageCredentials} credentials - Cloud storage access data
24
26
  * @param {StorageParams} params - Cloud storage params
27
+ * @param {StorageCredentials} credentials - Optional. Cloud storage access data. If credentials is not provided - use an anonymous access to the bucket
25
28
  */
26
- constructor(credentials: StorageCredentials, params: StorageParams) {
29
+ constructor(params: StorageParams, credentials?: StorageCredentials) {
27
30
  try {
28
31
  this.clientParams = params;
29
32
 
30
33
  this.client = new Minio.Client({
31
34
  ...params,
32
- accessKey: credentials.accessKey,
33
- secretKey: credentials.secretKey,
35
+ accessKey: credentials?.accessKey ?? '',
36
+ secretKey: credentials?.secretKey ?? '',
34
37
  });
35
38
  } catch (e) {
36
39
  throw ErrorStorageClientNotInitialized;
package/src/types.ts CHANGED
@@ -33,6 +33,7 @@ export enum EscrowStatus {
33
33
  /**
34
34
  * AWS/GCP cloud storage access data
35
35
  * @readonly
36
+ * @deprecated StorageClient is deprecated. Use Minio.Client directly.
36
37
  */
37
38
  export type StorageCredentials = {
38
39
  /**
@@ -45,6 +46,9 @@ export type StorageCredentials = {
45
46
  secretKey: string;
46
47
  };
47
48
 
49
+ /**
50
+ * @deprecated StorageClient is deprecated. Use Minio.Client directly.
51
+ */
48
52
  export type StorageParams = {
49
53
  /**
50
54
  * Request endPoint