@augustdigital/sdk 9.4.0 → 9.6.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 (40) hide show
  1. package/lib/adapters/evm/index.d.ts +1 -1
  2. package/lib/adapters/evm/index.js +29 -29
  3. package/lib/core/analytics/app-name.js +1 -1
  4. package/lib/core/analytics/constants.d.ts +10 -0
  5. package/lib/core/analytics/constants.js +17 -1
  6. package/lib/core/analytics/index.d.ts +7 -4
  7. package/lib/core/analytics/index.js +8 -4
  8. package/lib/core/analytics/instrumentation.js +8 -4
  9. package/lib/core/analytics/method-taxonomy.js +13 -0
  10. package/lib/core/analytics/metrics.d.ts +25 -10
  11. package/lib/core/analytics/metrics.js +41 -15
  12. package/lib/core/analytics/sentry.d.ts +24 -3
  13. package/lib/core/analytics/sentry.js +49 -18
  14. package/lib/core/analytics/types.d.ts +11 -4
  15. package/lib/core/analytics/user-identity.d.ts +19 -5
  16. package/lib/core/analytics/user-identity.js +35 -21
  17. package/lib/core/analytics/version.d.ts +1 -1
  18. package/lib/core/analytics/version.js +1 -1
  19. package/lib/core/auth/verify.js +5 -1
  20. package/lib/core/base.class.js +3 -0
  21. package/lib/core/constants/core.d.ts +3 -0
  22. package/lib/core/constants/core.js +3 -0
  23. package/lib/core/constants/swap-router.d.ts +16 -0
  24. package/lib/core/constants/swap-router.js +16 -0
  25. package/lib/core/errors/index.d.ts +36 -1
  26. package/lib/core/errors/index.js +40 -1
  27. package/lib/core/fetcher.d.ts +13 -0
  28. package/lib/core/fetcher.js +33 -0
  29. package/lib/main.d.ts +5 -0
  30. package/lib/main.js +5 -0
  31. package/lib/modules/vaults/getters.d.ts +55 -0
  32. package/lib/modules/vaults/getters.js +58 -14
  33. package/lib/modules/vaults/main.d.ts +4 -0
  34. package/lib/modules/vaults/main.js +4 -0
  35. package/lib/modules/vaults/write.actions.d.ts +57 -1
  36. package/lib/modules/vaults/write.actions.js +86 -2
  37. package/lib/sdk.d.ts +13032 -12798
  38. package/lib/services/debank/utils.js +6 -5
  39. package/lib/types/vaults.d.ts +3 -0
  40. package/package.json +2 -2
@@ -5,7 +5,7 @@ exports.getVaultExposure = getVaultExposure;
5
5
  exports.parseLoanLevelDebank = parseLoanLevelDebank;
6
6
  const core_1 = require("../../core");
7
7
  const core_2 = require("../../core/helpers/core");
8
- function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposurePerCategory, netValue, borrower) {
8
+ function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposurePerCategory, netValue, borrower, poolId) {
9
9
  const usdAmount = Number(token?.price || 0) * Number(token?.amount);
10
10
  if (exposureType === 'wallet'
11
11
  ? !(0, core_2.filterOutBySize)(usdAmount)
@@ -33,6 +33,7 @@ function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposu
33
33
  amount: usdAmount,
34
34
  protocol: protocol,
35
35
  exposureType: exposureType,
36
+ poolId: poolId,
36
37
  };
37
38
  if (exposureType === 'wallet') {
38
39
  exposurePerCategory.wallet.push(protoReturnObj);
@@ -96,7 +97,7 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
96
97
  existingArray.push(sup.symbol);
97
98
  }
98
99
  // add token to vault "token exposure"
99
- addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower);
100
+ addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
100
101
  // add token image url to token mapping for display
101
102
  if (sup?.symbol && sup?.logo_url) {
102
103
  tokenMap[sup.symbol] = sup.logo_url;
@@ -105,7 +106,7 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
105
106
  });
106
107
  item.detail.borrow_token_list.forEach((bor) => {
107
108
  // add token to vault "token exposure"
108
- addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower);
109
+ addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
109
110
  // add token image url to token mapping for display
110
111
  if (bor?.symbol && bor?.logo_url) {
111
112
  tokenMap[bor.symbol] = bor.logo_url;
@@ -149,13 +150,13 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
149
150
  }
150
151
  pos?.portfolio_item_list?.forEach((item) => {
151
152
  (item?.detail?.supply_token_list || []).forEach((sup) => {
152
- addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower);
153
+ addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
153
154
  if (sup?.symbol && sup?.logo_url) {
154
155
  tokenMap[sup.symbol] = sup.logo_url;
155
156
  }
156
157
  });
157
158
  (item?.detail?.borrow_token_list || []).forEach((bor) => {
158
- addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower);
159
+ addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
159
160
  if (bor?.symbol && bor?.logo_url) {
160
161
  tokenMap[bor.symbol] = bor.logo_url;
161
162
  }
@@ -114,6 +114,9 @@ export type IVaultExposureItem = {
114
114
  name: string;
115
115
  protocol?: string;
116
116
  symbol: string;
117
+ /** DeBank `pool.id` of the portfolio item the token belongs to — tells
118
+ * apart two positions in the same protocol holding the same token. */
119
+ poolId?: string;
117
120
  };
118
121
  export type IExposurePerCategory = {
119
122
  borrowing: IVaultExposureItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augustdigital/sdk",
3
- "version": "9.4.0",
3
+ "version": "9.6.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/sdk.d.ts",
6
6
  "keywords": [
@@ -30,7 +30,7 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@coral-xyz/anchor": "^0.31.1",
33
+ "@coral-xyz/anchor": "^0.32.1",
34
34
  "@sentry/browser": "^8.0.0",
35
35
  "@sentry/node": "^8.0.0",
36
36
  "@solana/spl-token": "^0.4.14",