@defisaver/positions-sdk 2.1.102 → 2.1.103

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.
@@ -54,25 +54,22 @@ const morphoVaultsOptions = __importStar(require("./options"));
54
54
  exports.morphoVaultsOptions = morphoVaultsOptions;
55
55
  const viem_1 = require("../../services/viem");
56
56
  const contracts_1 = require("../../contracts");
57
- const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
58
- vaultByAddress(chainId: 1, address: "${vaultAddress}") {
59
- id,
60
- dailyApy,
61
- dailyApys {
62
- apy, netApy
63
- },
64
- monthlyApys {
65
- apy, netApy
66
- },
67
- liquidity {
68
- underlying, usd,
69
- },
70
- asset {
71
- priceUsd
57
+ const vaultDataQuery = `
58
+ query VaultByAddress($address: String!, $chainId: Int!) {
59
+ vaultByAddress(address: $address, chainId: $chainId) {
60
+ address
61
+ state {
62
+ totalAssets
63
+ totalAssetsUsd
64
+ totalSupply
65
+ }
66
+ liquidity {
67
+ underlying
68
+ usd
69
+ }
72
70
  }
73
- }
74
71
  }`;
75
- const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
72
+ const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
76
73
  const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
77
74
  const morphoVaultContract = (0, contracts_1.getMorphoVaultContractViem)(provider, morphoVault.address);
78
75
  const shares = {};
@@ -81,7 +78,7 @@ const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awai
81
78
  morphoVaultContract.read.totalSupply(),
82
79
  morphoVaultContract.read.decimals(),
83
80
  morphoVaultContract.read.DECIMALS_OFFSET(),
84
- (0, graphql_request_1.request)(MORPHO_BLUE_API, vaultDataQuery(morphoVault.address)),
81
+ (0, graphql_request_1.request)(MORPHO_BLUE_API, vaultDataQuery, { address: morphoVault.address, chainId: network }),
85
82
  ...accounts.map((account) => __awaiter(void 0, void 0, void 0, function* () {
86
83
  const share = yield morphoVaultContract.read.balanceOf([account]);
87
84
  shares[account] = share;
@@ -14,25 +14,22 @@ import * as morphoVaultsOptions from './options';
14
14
  import { getViemProvider } from '../../services/viem';
15
15
  import { getMorphoVaultContractViem } from '../../contracts';
16
16
  export { morphoVaultsOptions, };
17
- const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
18
- vaultByAddress(chainId: 1, address: "${vaultAddress}") {
19
- id,
20
- dailyApy,
21
- dailyApys {
22
- apy, netApy
23
- },
24
- monthlyApys {
25
- apy, netApy
26
- },
27
- liquidity {
28
- underlying, usd,
29
- },
30
- asset {
31
- priceUsd
17
+ const vaultDataQuery = `
18
+ query VaultByAddress($address: String!, $chainId: Int!) {
19
+ vaultByAddress(address: $address, chainId: $chainId) {
20
+ address
21
+ state {
22
+ totalAssets
23
+ totalAssetsUsd
24
+ totalSupply
25
+ }
26
+ liquidity {
27
+ underlying
28
+ usd
29
+ }
32
30
  }
33
- }
34
31
  }`;
35
- const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
32
+ const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
36
33
  export const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
37
34
  const morphoVaultContract = getMorphoVaultContractViem(provider, morphoVault.address);
38
35
  const shares = {};
@@ -41,7 +38,7 @@ export const _getMorphoVaultData = (provider, network, morphoVault, accounts) =>
41
38
  morphoVaultContract.read.totalSupply(),
42
39
  morphoVaultContract.read.decimals(),
43
40
  morphoVaultContract.read.DECIMALS_OFFSET(),
44
- graphqlRequest(MORPHO_BLUE_API, vaultDataQuery(morphoVault.address)),
41
+ graphqlRequest(MORPHO_BLUE_API, vaultDataQuery, { address: morphoVault.address, chainId: network }),
45
42
  ...accounts.map((account) => __awaiter(void 0, void 0, void 0, function* () {
46
43
  const share = yield morphoVaultContract.read.balanceOf([account]);
47
44
  shares[account] = share;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.102",
3
+ "version": "2.1.103",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -12,26 +12,23 @@ export {
12
12
  morphoVaultsOptions,
13
13
  };
14
14
 
15
- const vaultDataQuery = (vaultAddress: EthAddress) => `query vaultByAddress {
16
- vaultByAddress(chainId: 1, address: "${vaultAddress}") {
17
- id,
18
- dailyApy,
19
- dailyApys {
20
- apy, netApy
21
- },
22
- monthlyApys {
23
- apy, netApy
24
- },
25
- liquidity {
26
- underlying, usd,
27
- },
28
- asset {
29
- priceUsd
15
+ const vaultDataQuery = `
16
+ query VaultByAddress($address: String!, $chainId: Int!) {
17
+ vaultByAddress(address: $address, chainId: $chainId) {
18
+ address
19
+ state {
20
+ totalAssets
21
+ totalAssetsUsd
22
+ totalSupply
23
+ }
24
+ liquidity {
25
+ underlying
26
+ usd
27
+ }
30
28
  }
31
- }
32
29
  }`;
33
30
 
34
- const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
31
+ const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
35
32
 
36
33
  export const _getMorphoVaultData = async (provider: Client, network: NetworkNumber, morphoVault: MorphoVault, accounts: EthAddress[]): Promise<SavingsVaultData> => {
37
34
  const morphoVaultContract = getMorphoVaultContractViem(provider, morphoVault.address);
@@ -43,7 +40,7 @@ export const _getMorphoVaultData = async (provider: Client, network: NetworkNumb
43
40
  morphoVaultContract.read.totalSupply(),
44
41
  morphoVaultContract.read.decimals(),
45
42
  morphoVaultContract.read.DECIMALS_OFFSET(),
46
- graphqlRequest(MORPHO_BLUE_API, vaultDataQuery(morphoVault.address)),
43
+ graphqlRequest(MORPHO_BLUE_API, vaultDataQuery, { address: morphoVault.address, chainId: network }),
47
44
  ...accounts.map(async (account) => {
48
45
  const share = await morphoVaultContract.read.balanceOf([account]);
49
46
  shares[account] = share;