@kasufinance/kasu-sdk 2.12.0 → 2.13.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 (53) hide show
  1. package/README.md +26 -1
  2. package/dist/bundle.cjs.js +871 -41
  3. package/dist/bundle.esm.js +868 -43
  4. package/dist/domain/index.d.ts +2 -0
  5. package/dist/domain/index.js +1 -0
  6. package/dist/domain/index.js.map +1 -1
  7. package/dist/domain/pool-tvl.d.ts +62 -0
  8. package/dist/domain/pool-tvl.js +22 -0
  9. package/dist/domain/pool-tvl.js.map +1 -0
  10. package/dist/facade/chain-configs.js +24 -0
  11. package/dist/facade/chain-configs.js.map +1 -1
  12. package/dist/facade/kasu.d.ts +2 -0
  13. package/dist/facade/kasu.js +13 -5
  14. package/dist/facade/kasu.js.map +1 -1
  15. package/dist/facade/strategies.d.ts +20 -0
  16. package/dist/facade/strategies.js +22 -0
  17. package/dist/facade/strategies.js.map +1 -1
  18. package/dist/facade/types.d.ts +20 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/kasu-sdk.d.ts +9 -1
  23. package/dist/kasu-sdk.js +2 -2
  24. package/dist/kasu-sdk.js.map +1 -1
  25. package/dist/sdk-config.d.ts +20 -0
  26. package/dist/sdk-config.js +3 -1
  27. package/dist/sdk-config.js.map +1 -1
  28. package/dist/services/DataService/data-service.d.ts +81 -1
  29. package/dist/services/DataService/data-service.js +211 -6
  30. package/dist/services/DataService/data-service.js.map +1 -1
  31. package/dist/services/DataService/tvl-history.d.ts +296 -0
  32. package/dist/services/DataService/tvl-history.js +558 -0
  33. package/dist/services/DataService/tvl-history.js.map +1 -0
  34. package/dist/services/Portfolio/yield-history.d.ts +1 -16
  35. package/dist/services/Portfolio/yield-history.js +2 -29
  36. package/dist/services/Portfolio/yield-history.js.map +1 -1
  37. package/dist/services/shared.d.ts +16 -0
  38. package/dist/services/shared.js +30 -0
  39. package/dist/services/shared.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/domain/index.ts +3 -0
  42. package/src/domain/pool-tvl.ts +66 -0
  43. package/src/facade/chain-configs.ts +26 -0
  44. package/src/facade/kasu.ts +20 -2
  45. package/src/facade/strategies.ts +26 -0
  46. package/src/facade/types.ts +20 -0
  47. package/src/index.ts +9 -0
  48. package/src/kasu-sdk.ts +19 -2
  49. package/src/sdk-config.ts +22 -0
  50. package/src/services/DataService/data-service.ts +296 -6
  51. package/src/services/DataService/tvl-history.ts +853 -0
  52. package/src/services/Portfolio/yield-history.ts +2 -35
  53. package/src/services/shared.ts +38 -1
@@ -537,38 +537,5 @@ export function buildYieldHistory(
537
537
  );
538
538
  }
539
539
 
540
- /**
541
- * A GraphQL VALIDATION error naming an entity, field or argument this
542
- * deployment's subgraph does not have. A network error, a timeout or an
543
- * indexing error is not one.
544
- */
545
- export function isMissingEntityError(error: unknown): boolean {
546
- if (typeof error !== 'object' || error === null) return false;
547
- const response = (error as { response?: { errors?: unknown } }).response;
548
- const errors = response?.errors;
549
- if (!Array.isArray(errors) || errors.length === 0) return false;
550
- return errors.every((e: unknown) => {
551
- const message = (e as { message?: unknown } | null)?.message;
552
- return (
553
- typeof message === 'string' &&
554
- /has no field|cannot query field|unknown (type|field|argument)|no such (type|field)/i.test(
555
- message,
556
- )
557
- );
558
- });
559
- }
560
-
561
- /**
562
- * The only failure `getYieldHistory` turns into `[]`: a missing-schema error
563
- * on a LITE deployment, whose subgraph may predate the entities. On a full
564
- * deployment the entities are part of the schema, so the same error means a
565
- * broken query or subgraph and THROWS — an empty chart there would hide it.
566
- * Everything else (network, timeout, indexing) throws on every deployment, so
567
- * a consumer can tell "no history here" from "history unavailable".
568
- */
569
- export function isEmptyHistoryError(
570
- error: unknown,
571
- liteDeployment: boolean,
572
- ): boolean {
573
- return liteDeployment && isMissingEntityError(error);
574
- }
540
+ // Shared with `getPoolTvlHistory`: one Lite-vs-full rule for every history.
541
+ export { isEmptyHistoryError, isMissingEntityError } from '../shared';
@@ -8,4 +8,41 @@ export function filterArray<T>(array: T[], id_in?: string[]): T[] {
8
8
  return id_in.includes(id);
9
9
  });
10
10
  }
11
- }
11
+ }
12
+
13
+ /**
14
+ * A GraphQL VALIDATION error naming an entity, field or argument this
15
+ * deployment's subgraph does not have. A network error, a timeout or an
16
+ * indexing error is not one.
17
+ */
18
+ export function isMissingEntityError(error: unknown): boolean {
19
+ if (typeof error !== 'object' || error === null) return false;
20
+ const response = (error as { response?: { errors?: unknown } }).response;
21
+ const errors = response?.errors;
22
+ if (!Array.isArray(errors) || errors.length === 0) return false;
23
+ return errors.every((e: unknown) => {
24
+ const message = (e as { message?: unknown } | null)?.message;
25
+ return (
26
+ typeof message === 'string' &&
27
+ /has no field|cannot query field|unknown (type|field|argument)|no such (type|field)/i.test(
28
+ message,
29
+ )
30
+ );
31
+ });
32
+ }
33
+
34
+ /**
35
+ * The only failure a history read (`getYieldHistory`, `getPoolTvlHistory`)
36
+ * turns into `[]`: a missing-schema error
37
+ * on a LITE deployment, whose subgraph may predate the entities. On a full
38
+ * deployment the entities are part of the schema, so the same error means a
39
+ * broken query or subgraph and THROWS — an empty chart there would hide it.
40
+ * Everything else (network, timeout, indexing) throws on every deployment, so
41
+ * a consumer can tell "no history here" from "history unavailable".
42
+ */
43
+ export function isEmptyHistoryError(
44
+ error: unknown,
45
+ liteDeployment: boolean,
46
+ ): boolean {
47
+ return liteDeployment && isMissingEntityError(error);
48
+ }