@augustdigital/sdk 8.7.0 → 8.7.2
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.
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/constants/web3.js +6 -0
- package/lib/core/helpers/vaults.d.ts +23 -1
- package/lib/core/helpers/vaults.js +24 -2
- package/lib/modules/vaults/main.js +17 -7
- package/lib/sdk.d.ts +23 -1
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.js +91 -42
- package/package.json +1 -1
|
@@ -117,6 +117,11 @@ exports.NETWORKS = {
|
|
|
117
117
|
chainId: 25363,
|
|
118
118
|
explorer: 'https://fluentscan.xyz',
|
|
119
119
|
},
|
|
120
|
+
4217: {
|
|
121
|
+
name: 'Tempo',
|
|
122
|
+
chainId: 4217,
|
|
123
|
+
explorer: 'https://explore.tempo.xyz',
|
|
124
|
+
},
|
|
120
125
|
};
|
|
121
126
|
exports.AVAILABLE_CHAINS = Object.keys(exports.NETWORKS).map((c) => Number(c));
|
|
122
127
|
/**
|
|
@@ -145,5 +150,6 @@ exports.FALLBACK_RPC_URLS = {
|
|
|
145
150
|
747474: ['https://rpc.katana.network'],
|
|
146
151
|
4114: ['https://rpc.mainnet.citrea.xyz'],
|
|
147
152
|
25363: ['https://rpc.fluent.xyz'],
|
|
153
|
+
4217: ['https://rpc.mainnet.tempo.xyz'],
|
|
148
154
|
};
|
|
149
155
|
//# sourceMappingURL=web3.js.map
|
|
@@ -23,4 +23,26 @@ export declare const SUBGRAPH_POOL_URLS: (apiKey: string, chainId?: number, pool
|
|
|
23
23
|
} | {
|
|
24
24
|
999: string;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Previously fabricated a Goldsky subgraph URL from the chain name and vault
|
|
28
|
+
* symbol. That guess is unreliable and produced dead endpoints:
|
|
29
|
+
* - The path segment `/v1/subgraphs/name/goldsky/` is legacy hosted-service
|
|
30
|
+
* syntax, not Goldsky's current scheme (cf. {@link SUBGRAPH_VAULT_URLS}).
|
|
31
|
+
* - The chain name isn't the subgraph slug — ethers reports Citrea's network as
|
|
32
|
+
* `unknown`, and mainnet as `mainnet` where the subgraph uses `eth`.
|
|
33
|
+
* - A vault's symbol isn't its subgraph name — e.g. on-chain `EctUSD` vs the
|
|
34
|
+
* deployed `earn-ctusd`.
|
|
35
|
+
*
|
|
36
|
+
* A fabricated URL 404s silently, so a missing subgraph reads as "no data"
|
|
37
|
+
* rather than an error (this masked the Citrea Earn ctUSD outage). Subgraph URLs
|
|
38
|
+
* must now come from backend vault metadata (`fetchVaultMetadata → subgraph`).
|
|
39
|
+
* This returns `undefined` so callers hit their existing "Missing Subgraph"
|
|
40
|
+
* branch (warn + Slack alert) instead of querying a dead endpoint.
|
|
41
|
+
*
|
|
42
|
+
* @param _network - Unused. Kept for call-site compatibility.
|
|
43
|
+
* @param _symbol - Unused. Kept for call-site compatibility.
|
|
44
|
+
* @returns `undefined` — the SDK no longer guesses subgraph URLs.
|
|
45
|
+
* @deprecated Resolve subgraph URLs from `fetchVaultMetadata`; do not rely on a
|
|
46
|
+
* generated fallback.
|
|
47
|
+
*/
|
|
48
|
+
export declare const getDefaultSubgraphUrl: (_network: string, _symbol: string) => string | undefined;
|
|
@@ -153,8 +153,30 @@ const SUBGRAPH_POOL_URLS = (apiKey, chainId, pool) => {
|
|
|
153
153
|
return urls;
|
|
154
154
|
};
|
|
155
155
|
exports.SUBGRAPH_POOL_URLS = SUBGRAPH_POOL_URLS;
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Previously fabricated a Goldsky subgraph URL from the chain name and vault
|
|
158
|
+
* symbol. That guess is unreliable and produced dead endpoints:
|
|
159
|
+
* - The path segment `/v1/subgraphs/name/goldsky/` is legacy hosted-service
|
|
160
|
+
* syntax, not Goldsky's current scheme (cf. {@link SUBGRAPH_VAULT_URLS}).
|
|
161
|
+
* - The chain name isn't the subgraph slug — ethers reports Citrea's network as
|
|
162
|
+
* `unknown`, and mainnet as `mainnet` where the subgraph uses `eth`.
|
|
163
|
+
* - A vault's symbol isn't its subgraph name — e.g. on-chain `EctUSD` vs the
|
|
164
|
+
* deployed `earn-ctusd`.
|
|
165
|
+
*
|
|
166
|
+
* A fabricated URL 404s silently, so a missing subgraph reads as "no data"
|
|
167
|
+
* rather than an error (this masked the Citrea Earn ctUSD outage). Subgraph URLs
|
|
168
|
+
* must now come from backend vault metadata (`fetchVaultMetadata → subgraph`).
|
|
169
|
+
* This returns `undefined` so callers hit their existing "Missing Subgraph"
|
|
170
|
+
* branch (warn + Slack alert) instead of querying a dead endpoint.
|
|
171
|
+
*
|
|
172
|
+
* @param _network - Unused. Kept for call-site compatibility.
|
|
173
|
+
* @param _symbol - Unused. Kept for call-site compatibility.
|
|
174
|
+
* @returns `undefined` — the SDK no longer guesses subgraph URLs.
|
|
175
|
+
* @deprecated Resolve subgraph URLs from `fetchVaultMetadata`; do not rely on a
|
|
176
|
+
* generated fallback.
|
|
177
|
+
*/
|
|
178
|
+
const getDefaultSubgraphUrl = (_network, _symbol) => {
|
|
179
|
+
return undefined;
|
|
158
180
|
};
|
|
159
181
|
exports.getDefaultSubgraphUrl = getDefaultSubgraphUrl;
|
|
160
182
|
//# sourceMappingURL=vaults.js.map
|
|
@@ -771,24 +771,34 @@ class AugustVaults extends core_1.AugustBase {
|
|
|
771
771
|
}
|
|
772
772
|
return formattedStandard;
|
|
773
773
|
};
|
|
774
|
-
// If vault is provided, return history for that vault
|
|
774
|
+
// If vault is provided, return history for that vault. This path is
|
|
775
|
+
// EVM-only (see fetchVaultHistory → getSubgraphUserHistory); a non-EVM
|
|
776
|
+
// vault address would drive eth_chainId against a Solana/Stellar RPC.
|
|
775
777
|
if (vault) {
|
|
776
|
-
finalArray =
|
|
778
|
+
finalArray = (0, ethers_1.isAddress)(vault)
|
|
779
|
+
? await fetchVaultHistory(vault, chainId)
|
|
780
|
+
: [];
|
|
777
781
|
}
|
|
778
782
|
else {
|
|
779
783
|
// Fetch all vaults
|
|
780
784
|
const allVaults = await (0, core_1.fetchTokenizedVaults)(undefined, this.headers, false, false);
|
|
781
|
-
// If chainId is provided, return history for all vaults on that chain
|
|
785
|
+
// If chainId is provided, return history for all vaults on that chain.
|
|
786
|
+
// EVM-only: skip non-EVM (Solana/Stellar) vault addresses.
|
|
782
787
|
if (chainId) {
|
|
783
|
-
const vaultsPerChain = allVaults.filter((v) => v.chain === chainId);
|
|
788
|
+
const vaultsPerChain = allVaults.filter((v) => v.chain === chainId && (0, ethers_1.isAddress)(v.address));
|
|
784
789
|
const vaultResponses = await Promise.all(vaultsPerChain.map((v) => fetchVaultHistory(v.address, v.chain)));
|
|
785
790
|
const flattened = vaultResponses.flat();
|
|
786
791
|
finalArray = flattened;
|
|
787
792
|
}
|
|
788
793
|
else {
|
|
789
|
-
// Else, fetch all history for all vaults across all initialized chains
|
|
790
|
-
//
|
|
791
|
-
|
|
794
|
+
// Else, fetch all history for all vaults across all initialized chains.
|
|
795
|
+
// Gate on isAddress(v.address): the Solana provider is registered under
|
|
796
|
+
// chainId -1, so without this a Solana vault passes `providers?.[v.chain]`
|
|
797
|
+
// and gets routed into the EVM subgraph path, throwing
|
|
798
|
+
// "eth_chainId is not available on SOLANA_MAINNET" on every fetch.
|
|
799
|
+
// LayerZero vaults query subgraphs directly and don't need a provider.
|
|
800
|
+
const vaultsPerAvailableProviders = allVaults.filter((v) => (0, ethers_1.isAddress)(v.address) &&
|
|
801
|
+
(this.providers?.[v?.chain] || (0, deposits_1.isLayerZeroVault)(v.address)));
|
|
792
802
|
const vaultResponses = await Promise.all(vaultsPerAvailableProviders.map((v) => fetchVaultHistory(v.address, v.chain)));
|
|
793
803
|
const flattened = vaultResponses.flat();
|
|
794
804
|
finalArray = flattened;
|
package/lib/sdk.d.ts
CHANGED
|
@@ -17474,7 +17474,29 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
|
|
|
17474
17474
|
*/
|
|
17475
17475
|
export declare const getDecimals: (provider: IContractRunner, address: IAddress, isVault?: boolean) => Promise<number>;
|
|
17476
17476
|
|
|
17477
|
-
|
|
17477
|
+
/**
|
|
17478
|
+
* Previously fabricated a Goldsky subgraph URL from the chain name and vault
|
|
17479
|
+
* symbol. That guess is unreliable and produced dead endpoints:
|
|
17480
|
+
* - The path segment `/v1/subgraphs/name/goldsky/` is legacy hosted-service
|
|
17481
|
+
* syntax, not Goldsky's current scheme (cf. {@link SUBGRAPH_VAULT_URLS}).
|
|
17482
|
+
* - The chain name isn't the subgraph slug — ethers reports Citrea's network as
|
|
17483
|
+
* `unknown`, and mainnet as `mainnet` where the subgraph uses `eth`.
|
|
17484
|
+
* - A vault's symbol isn't its subgraph name — e.g. on-chain `EctUSD` vs the
|
|
17485
|
+
* deployed `earn-ctusd`.
|
|
17486
|
+
*
|
|
17487
|
+
* A fabricated URL 404s silently, so a missing subgraph reads as "no data"
|
|
17488
|
+
* rather than an error (this masked the Citrea Earn ctUSD outage). Subgraph URLs
|
|
17489
|
+
* must now come from backend vault metadata (`fetchVaultMetadata → subgraph`).
|
|
17490
|
+
* This returns `undefined` so callers hit their existing "Missing Subgraph"
|
|
17491
|
+
* branch (warn + Slack alert) instead of querying a dead endpoint.
|
|
17492
|
+
*
|
|
17493
|
+
* @param _network - Unused. Kept for call-site compatibility.
|
|
17494
|
+
* @param _symbol - Unused. Kept for call-site compatibility.
|
|
17495
|
+
* @returns `undefined` — the SDK no longer guesses subgraph URLs.
|
|
17496
|
+
* @deprecated Resolve subgraph URLs from `fetchVaultMetadata`; do not rely on a
|
|
17497
|
+
* generated fallback.
|
|
17498
|
+
*/
|
|
17499
|
+
export declare const getDefaultSubgraphUrl: (_network: string, _symbol: string) => string | undefined;
|
|
17478
17500
|
|
|
17479
17501
|
/**
|
|
17480
17502
|
* Fetches the total amount deposited by an address on a whitelist contract
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which field-naming schema a deployed August vault subgraph uses:
|
|
3
|
+
* - `'old'` — snake_case fields (`block_number`, `timestamp_`, `transactionHash_`).
|
|
4
|
+
* - `'new'` — camelCase fields (`blockNumber`, `blockTimestamp`, `transactionHash`).
|
|
5
|
+
*
|
|
6
|
+
* The two templates are otherwise equivalent; the SDK aliases new-schema fields
|
|
7
|
+
* back to the old internal names when querying, so the rest of the code only ever
|
|
8
|
+
* sees the old (snake_case) shape.
|
|
9
|
+
*/
|
|
10
|
+
export type SubgraphSchema = 'old' | 'new';
|
|
11
|
+
/**
|
|
12
|
+
* True when a GraphQL error array reports an unknown field on the queried type
|
|
13
|
+
* (message contains "has no field") — the signature of a schema mismatch.
|
|
14
|
+
*
|
|
15
|
+
* @param errors - GraphQL `errors` array from a subgraph response (may be undefined).
|
|
16
|
+
* @returns `true` if any error message indicates an unknown field, else `false`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isSubgraphSchemaFieldError(errors: {
|
|
19
|
+
message?: string;
|
|
20
|
+
}[] | undefined): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Detects whether a deployed subgraph uses the old or new field schema by probing
|
|
23
|
+
* a single field (`blockTimestamp`) that exists only on the new template.
|
|
24
|
+
*
|
|
25
|
+
* This replaces the previous heuristic — "vault symbol present in the deprecated
|
|
26
|
+
* `SUBGRAPH_VAULT_URLS` map ⇒ old schema, else new" — which mis-guessed any
|
|
27
|
+
* newly-added vault whose subgraph shipped on the old template (e.g.
|
|
28
|
+
* `august-citrea-earn-ctusd`). A wrong guess made every subgraph read query
|
|
29
|
+
* non-existent field names, so the subgraph returned GraphQL errors with no
|
|
30
|
+
* `data` and the SDK silently returned empty sets — emptying the Pending
|
|
31
|
+
* Withdrawals and History tabs for that vault (AUGUST-6568).
|
|
32
|
+
*
|
|
33
|
+
* Because the schema is immutable for a fixed subgraph deployment, the result is
|
|
34
|
+
* cached per URL ({@link SCHEMA_TTL_MS}); across a page's positions/history/
|
|
35
|
+
* withdrawals reads this amounts to a single extra lightweight query per subgraph.
|
|
36
|
+
*
|
|
37
|
+
* Side effects: at most one HTTP POST to the subgraph per URL per TTL window.
|
|
38
|
+
*
|
|
39
|
+
* @param goldskyUrl - Fully-qualified subgraph GraphQL endpoint.
|
|
40
|
+
* @param apiKey - Optional Goldsky API key sent as a Bearer token.
|
|
41
|
+
* @returns `'old'` or `'new'`. Defaults to `'new'` when the URL is empty or the
|
|
42
|
+
* probe is inconclusive (network error / unexpected response) — the schema the
|
|
43
|
+
* majority of current vaults use.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveSubgraphSchema(goldskyUrl: string, apiKey?: string): Promise<SubgraphSchema>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSubgraphSchemaFieldError = isSubgraphSchemaFieldError;
|
|
4
|
+
exports.resolveSubgraphSchema = resolveSubgraphSchema;
|
|
5
|
+
const core_1 = require("../../core");
|
|
6
|
+
const fetcher_1 = require("./fetcher");
|
|
7
|
+
const SCHEMA_CACHE_PREFIX = 'subgraph-schema-';
|
|
8
|
+
// A subgraph's schema is fixed for a given deployment/version, so one probe can
|
|
9
|
+
// serve every subsequent read for a long time. Cache generously.
|
|
10
|
+
const SCHEMA_TTL_MS = 60 * 60 * 1000; // 1 hour
|
|
11
|
+
/**
|
|
12
|
+
* True when a GraphQL error array reports an unknown field on the queried type
|
|
13
|
+
* (message contains "has no field") — the signature of a schema mismatch.
|
|
14
|
+
*
|
|
15
|
+
* @param errors - GraphQL `errors` array from a subgraph response (may be undefined).
|
|
16
|
+
* @returns `true` if any error message indicates an unknown field, else `false`.
|
|
17
|
+
*/
|
|
18
|
+
function isSubgraphSchemaFieldError(errors) {
|
|
19
|
+
return Boolean(errors?.some((e) => e?.message?.includes('has no field')));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detects whether a deployed subgraph uses the old or new field schema by probing
|
|
23
|
+
* a single field (`blockTimestamp`) that exists only on the new template.
|
|
24
|
+
*
|
|
25
|
+
* This replaces the previous heuristic — "vault symbol present in the deprecated
|
|
26
|
+
* `SUBGRAPH_VAULT_URLS` map ⇒ old schema, else new" — which mis-guessed any
|
|
27
|
+
* newly-added vault whose subgraph shipped on the old template (e.g.
|
|
28
|
+
* `august-citrea-earn-ctusd`). A wrong guess made every subgraph read query
|
|
29
|
+
* non-existent field names, so the subgraph returned GraphQL errors with no
|
|
30
|
+
* `data` and the SDK silently returned empty sets — emptying the Pending
|
|
31
|
+
* Withdrawals and History tabs for that vault (AUGUST-6568).
|
|
32
|
+
*
|
|
33
|
+
* Because the schema is immutable for a fixed subgraph deployment, the result is
|
|
34
|
+
* cached per URL ({@link SCHEMA_TTL_MS}); across a page's positions/history/
|
|
35
|
+
* withdrawals reads this amounts to a single extra lightweight query per subgraph.
|
|
36
|
+
*
|
|
37
|
+
* Side effects: at most one HTTP POST to the subgraph per URL per TTL window.
|
|
38
|
+
*
|
|
39
|
+
* @param goldskyUrl - Fully-qualified subgraph GraphQL endpoint.
|
|
40
|
+
* @param apiKey - Optional Goldsky API key sent as a Bearer token.
|
|
41
|
+
* @returns `'old'` or `'new'`. Defaults to `'new'` when the URL is empty or the
|
|
42
|
+
* probe is inconclusive (network error / unexpected response) — the schema the
|
|
43
|
+
* majority of current vaults use.
|
|
44
|
+
*/
|
|
45
|
+
async function resolveSubgraphSchema(goldskyUrl, apiKey) {
|
|
46
|
+
if (!goldskyUrl)
|
|
47
|
+
return 'new';
|
|
48
|
+
const key = `${SCHEMA_CACHE_PREFIX}${goldskyUrl}`;
|
|
49
|
+
const cached = core_1.CACHE.get(key);
|
|
50
|
+
if (cached)
|
|
51
|
+
return cached;
|
|
52
|
+
try {
|
|
53
|
+
// `blockTimestamp` is a new-schema-only field. If the subgraph rejects it
|
|
54
|
+
// with an unknown-field error, the deployment is old-schema. Schema
|
|
55
|
+
// validation is static, so this is authoritative even when the entity has
|
|
56
|
+
// zero rows.
|
|
57
|
+
const result = await (0, fetcher_1.fetchSubgraph)(goldskyUrl, `{ withdrawalRequesteds(first: 1) { blockTimestamp } }`, apiKey);
|
|
58
|
+
let schema = 'new';
|
|
59
|
+
if (result.status === 200) {
|
|
60
|
+
const json = (await result.json());
|
|
61
|
+
if (isSubgraphSchemaFieldError(json?.errors)) {
|
|
62
|
+
schema = 'old';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
core_1.CACHE.set(key, schema, { ttl: SCHEMA_TTL_MS });
|
|
66
|
+
return schema;
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
// Don't cache an inconclusive probe — let the next call retry. Default to
|
|
70
|
+
// 'new' so freshly-deployed vaults keep working when the probe is flaky.
|
|
71
|
+
core_1.Logger.log.warn('resolveSubgraphSchema', `probe failed for ${goldskyUrl}, defaulting to new schema: ${e instanceof Error ? e.message : 'unknown error'}`);
|
|
72
|
+
return 'new';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -7,14 +7,46 @@ exports.getSubgraphAllWithdrawals = getSubgraphAllWithdrawals;
|
|
|
7
7
|
exports.getSubgraphUserHistory = getSubgraphUserHistory;
|
|
8
8
|
exports.getSubgraphVaultHistory = getSubgraphVaultHistory;
|
|
9
9
|
exports.getSubgraphUserTransfers = getSubgraphUserTransfers;
|
|
10
|
+
const ethers_1 = require("ethers");
|
|
10
11
|
const slack_1 = require("../../core/logger/slack");
|
|
11
12
|
const fetcher_1 = require("./fetcher");
|
|
13
|
+
const schema_1 = require("./schema");
|
|
12
14
|
const core_1 = require("../../core");
|
|
13
15
|
const fetcher_2 = require("../../modules/vaults/fetcher");
|
|
14
16
|
/**
|
|
15
17
|
* Utils
|
|
16
18
|
*/
|
|
17
19
|
const GOLDSKY_API_KEY = 'cmd0lz6qf35lg01ty7u20aijy';
|
|
20
|
+
// Dedupe window for "Missing Subgraph" alerts (per pool).
|
|
21
|
+
const MISSING_SUBGRAPH_ALERT_TTL_MS = 60 * 60 * 1000; // 1 hour
|
|
22
|
+
/**
|
|
23
|
+
* Emit a "Missing Subgraph" Slack alert at most once per pool per TTL.
|
|
24
|
+
*
|
|
25
|
+
* `getDefaultSubgraphUrl` now returns `undefined` for vaults with no metadata or
|
|
26
|
+
* hardcoded subgraph URL, which makes the readers' `if (!goldskyUrl)` branches
|
|
27
|
+
* reachable (previously the fabricated URL was always truthy, so they were dead
|
|
28
|
+
* code). Portfolio/history flows loop over every vault, so alerting on each read
|
|
29
|
+
* would flood the webhook for every metadata-less vault. Deduping per pool
|
|
30
|
+
* surfaces a genuinely-missing subgraph without the flood.
|
|
31
|
+
*
|
|
32
|
+
* @param args.source - Reader function name, for the alert body.
|
|
33
|
+
* @param args.pool - Vault address (used as the dedupe key, lowercased).
|
|
34
|
+
* @param args.chainId - Chain id for the alert context.
|
|
35
|
+
* @param args.slackWebookUrl - Optional override webhook URL.
|
|
36
|
+
*/
|
|
37
|
+
function alertMissingSubgraphOnce(args) {
|
|
38
|
+
const key = `missing-subgraph-alert-${args.pool.toLowerCase()}`;
|
|
39
|
+
if (core_1.CACHE.has(key))
|
|
40
|
+
return;
|
|
41
|
+
core_1.CACHE.set(key, true, { ttl: MISSING_SUBGRAPH_ALERT_TTL_MS });
|
|
42
|
+
slack_1.SLACK.error({
|
|
43
|
+
title: 'Missing Subgraph',
|
|
44
|
+
error: `#${args.source}: goldsky url is undefined`,
|
|
45
|
+
poolAddress: args.pool,
|
|
46
|
+
chainId: args.chainId,
|
|
47
|
+
slackWebookUrl: args.slackWebookUrl || '',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
18
50
|
/**
|
|
19
51
|
* earnAUSD exists on both Ethereum and Monad, so it needs a _monad suffix
|
|
20
52
|
* to distinguish its Monad subgraph from the Ethereum one.
|
|
@@ -269,18 +301,21 @@ async function getSubgraphWithdrawRequests(pool, provider, slackWebookUrl = slac
|
|
|
269
301
|
if (!goldskyUrl) {
|
|
270
302
|
const chainId = await (0, core_1.getChainId)(provider);
|
|
271
303
|
core_1.Logger.log.warn('getSubgraphWithdrawRequests', `goldsky url is undefined: ${vaultSymbol}::${pool}`);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
304
|
+
alertMissingSubgraphOnce({
|
|
305
|
+
source: 'getSubgraphWithdrawRequests',
|
|
306
|
+
pool,
|
|
307
|
+
chainId,
|
|
308
|
+
slackWebookUrl,
|
|
278
309
|
});
|
|
279
310
|
return [];
|
|
280
311
|
}
|
|
281
312
|
const tokenizedVault = (await (0, core_1.fetchTokenizedVault)(pool))?.[0];
|
|
282
313
|
const version = (0, core_1.getVaultVersionV2)(tokenizedVault);
|
|
283
|
-
|
|
314
|
+
// Probe the deployed subgraph to learn its actual field schema (cached per
|
|
315
|
+
// URL) instead of guessing from the vault symbol. See resolveSubgraphSchema —
|
|
316
|
+
// the old symbol-map heuristic silently emptied this set for vaults deployed
|
|
317
|
+
// on the old template but absent from SUBGRAPH_VAULT_URLS (AUGUST-6568).
|
|
318
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
284
319
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
285
320
|
const withdrawalRequestedProps = useOldSchema
|
|
286
321
|
? version === 'evm-2'
|
|
@@ -331,18 +366,19 @@ async function getSubgraphWithdrawProccessed(pool, provider, slackWebookUrl = sl
|
|
|
331
366
|
if (!goldskyUrl) {
|
|
332
367
|
const chainId = await (0, core_1.getChainId)(provider);
|
|
333
368
|
core_1.Logger.log.error('getSubgraphWithdrawProccessed.missing-subgraph-url', new Error('goldsky url is undefined'), { chainId, vaultSymbol, pool });
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
369
|
+
alertMissingSubgraphOnce({
|
|
370
|
+
source: 'getSubgraphWithdrawProccessed',
|
|
371
|
+
pool,
|
|
372
|
+
chainId,
|
|
373
|
+
slackWebookUrl,
|
|
340
374
|
});
|
|
341
375
|
return [];
|
|
342
376
|
}
|
|
343
377
|
const tokenizedVault = (await (0, core_1.fetchTokenizedVault)(pool))?.[0];
|
|
344
378
|
const version = (0, core_1.getVaultVersionV2)(tokenizedVault);
|
|
345
|
-
|
|
379
|
+
// Probe the deployed subgraph's actual field schema (cached per URL) rather
|
|
380
|
+
// than guessing from the vault symbol — see resolveSubgraphSchema (AUGUST-6568).
|
|
381
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
346
382
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
347
383
|
const withdrawalProcessedProps = useOldSchema
|
|
348
384
|
? version === 'evm-2'
|
|
@@ -408,18 +444,19 @@ async function getSubgraphAllWithdrawals(pool, provider, slackWebookUrl = slack_
|
|
|
408
444
|
if (!goldskyUrl) {
|
|
409
445
|
const chainId = await (0, core_1.getChainId)(provider);
|
|
410
446
|
core_1.Logger.log.error('getSubgraphAllWithdrawals', `goldsky url is undefined: ${vaultSymbol}::${pool}`);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
447
|
+
alertMissingSubgraphOnce({
|
|
448
|
+
source: 'getSubgraphAllWithdrawals',
|
|
449
|
+
pool,
|
|
450
|
+
chainId,
|
|
451
|
+
slackWebookUrl,
|
|
417
452
|
});
|
|
418
453
|
return errorReturnObj;
|
|
419
454
|
}
|
|
420
455
|
const tokenizedVault = (await (0, core_1.fetchTokenizedVault)(pool))?.[0];
|
|
421
456
|
const version = (0, core_1.getVaultVersionV2)(tokenizedVault);
|
|
422
|
-
|
|
457
|
+
// Probe the deployed subgraph's actual field schema (cached per URL) rather
|
|
458
|
+
// than guessing from the vault symbol — see resolveSubgraphSchema (AUGUST-6568).
|
|
459
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
423
460
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
424
461
|
const withdrawalRequestedProps = useOldSchema
|
|
425
462
|
? version === 'evm-2'
|
|
@@ -540,6 +577,15 @@ async function getArchivedVaultUserHistory(user, provider, pool) {
|
|
|
540
577
|
}
|
|
541
578
|
async function getSubgraphUserHistory(user, provider, pool, slackWebookUrl = slack_1.DEFAULT_SLACK_WEBHOOK_URL) {
|
|
542
579
|
try {
|
|
580
|
+
// This path is EVM-only: it reads chain id and network from an EVM
|
|
581
|
+
// JsonRpcProvider (eth_chainId / getNetwork) and queries an EVM subgraph.
|
|
582
|
+
// A non-EVM (Solana / Stellar) vault address routed here would call
|
|
583
|
+
// eth_chainId against a Solana/Stellar RPC and fail with a 400
|
|
584
|
+
// ("eth_chainId is not available on SOLANA_MAINNET"). Bail early so non-EVM
|
|
585
|
+
// vaults are simply skipped rather than throwing on every history fetch.
|
|
586
|
+
if (!(0, ethers_1.isAddress)(pool)) {
|
|
587
|
+
return [];
|
|
588
|
+
}
|
|
543
589
|
// Archived vaults: serve history from the backend Mongo snapshot instead of
|
|
544
590
|
// the (retired) subgraph. The archived set is fetched from the backend (the
|
|
545
591
|
// routing source of truth) so a vault is only rerouted once its history is
|
|
@@ -573,18 +619,19 @@ async function getSubgraphUserHistory(user, provider, pool, slackWebookUrl = sla
|
|
|
573
619
|
(0, core_1.getDefaultSubgraphUrl)(networkValue.name, vaultSymbol);
|
|
574
620
|
if (!goldskyUrl) {
|
|
575
621
|
core_1.Logger.log.error('getSubgraphUserHistory', `goldsky url is undefined: ${vaultSymbol}::${pool}`);
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
622
|
+
alertMissingSubgraphOnce({
|
|
623
|
+
source: 'getSubgraphUserHistory',
|
|
624
|
+
pool,
|
|
625
|
+
chainId,
|
|
626
|
+
slackWebookUrl,
|
|
582
627
|
});
|
|
583
628
|
return requests;
|
|
584
629
|
}
|
|
585
630
|
const tokenizedVault = (await (0, core_1.fetchTokenizedVault)(pool))?.[0];
|
|
586
631
|
const version = (0, core_1.getVaultVersionV2)(tokenizedVault);
|
|
587
|
-
|
|
632
|
+
// Probe the deployed subgraph's actual field schema (cached per URL) rather
|
|
633
|
+
// than guessing from the vault symbol — see resolveSubgraphSchema (AUGUST-6568).
|
|
634
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
588
635
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
589
636
|
const depositProps = useOldSchema
|
|
590
637
|
? version === 'evm-2'
|
|
@@ -695,18 +742,19 @@ async function getSubgraphVaultHistory(provider, pool, slackWebookUrl = slack_1.
|
|
|
695
742
|
if (!goldskyUrl) {
|
|
696
743
|
const chainId = await (0, core_1.getChainId)(provider);
|
|
697
744
|
core_1.Logger.log.error('getSubgraphVaultHistory', `goldsky url is undefined: ${vaultSymbol}::${pool}`);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
745
|
+
alertMissingSubgraphOnce({
|
|
746
|
+
source: 'getSubgraphVaultHistory',
|
|
747
|
+
pool,
|
|
748
|
+
chainId,
|
|
749
|
+
slackWebookUrl,
|
|
704
750
|
});
|
|
705
751
|
return requests;
|
|
706
752
|
}
|
|
707
753
|
const tokenizedVault = (await (0, core_1.fetchTokenizedVault)(pool))?.[0];
|
|
708
754
|
const version = (0, core_1.getVaultVersionV2)(tokenizedVault);
|
|
709
|
-
|
|
755
|
+
// Probe the deployed subgraph's actual field schema (cached per URL) rather
|
|
756
|
+
// than guessing from the vault symbol — see resolveSubgraphSchema (AUGUST-6568).
|
|
757
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
710
758
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
711
759
|
const withdrawProps = useOldSchema
|
|
712
760
|
? version === 'evm-2'
|
|
@@ -850,16 +898,17 @@ async function getSubgraphUserTransfers(user, provider, pool, slackWebookUrl = s
|
|
|
850
898
|
if (!goldskyUrl) {
|
|
851
899
|
const chainId = await (0, core_1.getChainId)(provider);
|
|
852
900
|
core_1.Logger.log.error('getSubgraphUserTransfers', `goldsky url is undefined: ${vaultSymbol}::${pool}`);
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
slackWebookUrl: slackWebookUrl || '',
|
|
901
|
+
alertMissingSubgraphOnce({
|
|
902
|
+
source: 'getSubgraphUserTransfers',
|
|
903
|
+
pool,
|
|
904
|
+
chainId,
|
|
905
|
+
slackWebookUrl,
|
|
859
906
|
});
|
|
860
907
|
return userTransfers;
|
|
861
908
|
}
|
|
862
|
-
|
|
909
|
+
// Probe the deployed subgraph's actual field schema (cached per URL) rather
|
|
910
|
+
// than guessing from the vault symbol — see resolveSubgraphSchema (AUGUST-6568).
|
|
911
|
+
const useOldSchema = (await (0, schema_1.resolveSubgraphSchema)(goldskyUrl, GOLDSKY_API_KEY)) === 'old';
|
|
863
912
|
const orderByTimestamp = useOldSchema ? 'timestamp_' : 'blockTimestamp';
|
|
864
913
|
const transferProps = useOldSchema
|
|
865
914
|
? TRANSFER_QUERY_PROPS
|