@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 =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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://
|
|
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
|
|
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 =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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://
|
|
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
|
|
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
|
@@ -12,26 +12,23 @@ export {
|
|
|
12
12
|
morphoVaultsOptions,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const vaultDataQuery =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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://
|
|
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
|
|
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;
|