@poa-box/core 0.1.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 (220) hide show
  1. package/README.md +201 -0
  2. package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
  3. package/dist/abis/DirectDemocracyVotingNew.js +961 -0
  4. package/dist/abis/ERC20.d.ts +90 -0
  5. package/dist/abis/ERC20.js +125 -0
  6. package/dist/abis/EducationHubNew.d.ts +590 -0
  7. package/dist/abis/EducationHubNew.js +762 -0
  8. package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
  9. package/dist/abis/EligibilityModuleNew.js +2082 -0
  10. package/dist/abis/Executor.d.ts +619 -0
  11. package/dist/abis/Executor.js +796 -0
  12. package/dist/abis/HybridVotingNew.d.ts +898 -0
  13. package/dist/abis/HybridVotingNew.js +1149 -0
  14. package/dist/abis/ImplementationRegistry.d.ts +270 -0
  15. package/dist/abis/ImplementationRegistry.js +355 -0
  16. package/dist/abis/OrgDeployerNew.d.ts +1275 -0
  17. package/dist/abis/OrgDeployerNew.js +1630 -0
  18. package/dist/abis/OrgRegistry.d.ts +670 -0
  19. package/dist/abis/OrgRegistry.js +868 -0
  20. package/dist/abis/ParticipationToken.d.ts +1086 -0
  21. package/dist/abis/ParticipationToken.js +1415 -0
  22. package/dist/abis/PasskeyAccount.d.ts +788 -0
  23. package/dist/abis/PasskeyAccount.js +1019 -0
  24. package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
  25. package/dist/abis/PasskeyAccountFactory.js +449 -0
  26. package/dist/abis/PaymasterHub.d.ts +1603 -0
  27. package/dist/abis/PaymasterHub.js +2048 -0
  28. package/dist/abis/PaymentManager.d.ts +520 -0
  29. package/dist/abis/PaymentManager.js +671 -0
  30. package/dist/abis/PoaManager.d.ts +344 -0
  31. package/dist/abis/PoaManager.js +449 -0
  32. package/dist/abis/QuickJoinNew.d.ts +855 -0
  33. package/dist/abis/QuickJoinNew.js +1098 -0
  34. package/dist/abis/TaskManagerNew.d.ts +1236 -0
  35. package/dist/abis/TaskManagerNew.js +1573 -0
  36. package/dist/abis/ToggleModule.d.ts +193 -0
  37. package/dist/abis/ToggleModule.js +255 -0
  38. package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
  39. package/dist/abis/UniversalAccountRegistry.js +750 -0
  40. package/dist/abis/ZkEmailInvites.d.ts +823 -0
  41. package/dist/abis/ZkEmailInvites.js +1060 -0
  42. package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
  43. package/dist/abis/external/AaveGovernanceV2.js +177 -0
  44. package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
  45. package/dist/abis/external/AaveGovernanceV3.js +220 -0
  46. package/dist/abis/external/AragonVoting.d.ts +107 -0
  47. package/dist/abis/external/AragonVoting.js +150 -0
  48. package/dist/abis/external/CurveGaugeController.d.ts +95 -0
  49. package/dist/abis/external/CurveGaugeController.js +130 -0
  50. package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
  51. package/dist/abis/external/CurveVotingEscrow.js +116 -0
  52. package/dist/abis/external/GovernorAlpha.d.ts +172 -0
  53. package/dist/abis/external/GovernorAlpha.js +228 -0
  54. package/dist/abis/external/MakerDAOChief.d.ts +92 -0
  55. package/dist/abis/external/MakerDAOChief.js +129 -0
  56. package/dist/abis/external/OZGovernor.d.ts +227 -0
  57. package/dist/abis/external/OZGovernor.js +317 -0
  58. package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
  59. package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
  60. package/dist/abis/index.d.ts +62 -0
  61. package/dist/abis/index.js +98 -0
  62. package/dist/chains.d.ts +150 -0
  63. package/dist/chains.js +320 -0
  64. package/dist/context.d.ts +48 -0
  65. package/dist/context.js +38 -0
  66. package/dist/contracts.d.ts +24 -0
  67. package/dist/contracts.js +41 -0
  68. package/dist/encoding.d.ts +58 -0
  69. package/dist/encoding.js +243 -0
  70. package/dist/env.d.ts +10 -0
  71. package/dist/env.js +4 -0
  72. package/dist/error-catalog.d.ts +41 -0
  73. package/dist/error-catalog.js +941 -0
  74. package/dist/errors.d.ts +27 -0
  75. package/dist/errors.js +60 -0
  76. package/dist/execute/ethers.d.ts +93 -0
  77. package/dist/execute/ethers.js +323 -0
  78. package/dist/execute/index.d.ts +7 -0
  79. package/dist/execute/index.js +23 -0
  80. package/dist/execute/sponsored.d.ts +68 -0
  81. package/dist/execute/sponsored.js +277 -0
  82. package/dist/exit-codes.d.ts +18 -0
  83. package/dist/exit-codes.js +21 -0
  84. package/dist/format.d.ts +21 -0
  85. package/dist/format.js +89 -0
  86. package/dist/graph/client.d.ts +298 -0
  87. package/dist/graph/client.js +702 -0
  88. package/dist/graph/documents/activity.d.ts +9 -0
  89. package/dist/graph/documents/activity.js +164 -0
  90. package/dist/graph/documents/beacons.d.ts +172 -0
  91. package/dist/graph/documents/beacons.js +345 -0
  92. package/dist/graph/documents/index.d.ts +21 -0
  93. package/dist/graph/documents/index.js +57 -0
  94. package/dist/graph/documents/infrastructure.d.ts +30 -0
  95. package/dist/graph/documents/infrastructure.js +34 -0
  96. package/dist/graph/documents/org.d.ts +15 -0
  97. package/dist/graph/documents/org.js +249 -0
  98. package/dist/graph/documents/paymaster.d.ts +95 -0
  99. package/dist/graph/documents/paymaster.js +101 -0
  100. package/dist/graph/documents/role.d.ts +6 -0
  101. package/dist/graph/documents/role.js +41 -0
  102. package/dist/graph/documents/roles.d.ts +50 -0
  103. package/dist/graph/documents/roles.js +112 -0
  104. package/dist/graph/documents/task.d.ts +84 -0
  105. package/dist/graph/documents/task.js +236 -0
  106. package/dist/graph/documents/token.d.ts +13 -0
  107. package/dist/graph/documents/token.js +126 -0
  108. package/dist/graph/documents/treasury.d.ts +39 -0
  109. package/dist/graph/documents/treasury.js +136 -0
  110. package/dist/graph/documents/user.d.ts +120 -0
  111. package/dist/graph/documents/user.js +302 -0
  112. package/dist/graph/documents/voting-classes.d.ts +69 -0
  113. package/dist/graph/documents/voting-classes.js +149 -0
  114. package/dist/graph/documents/voting.d.ts +28 -0
  115. package/dist/graph/documents/voting.js +163 -0
  116. package/dist/graph/documents/vouch.d.ts +79 -0
  117. package/dist/graph/documents/vouch.js +171 -0
  118. package/dist/graph/documents/zkemail.d.ts +63 -0
  119. package/dist/graph/documents/zkemail.js +188 -0
  120. package/dist/graph/index.d.ts +2 -0
  121. package/dist/graph/index.js +41 -0
  122. package/dist/index.d.ts +49 -0
  123. package/dist/index.js +92 -0
  124. package/dist/ipfs.d.ts +39 -0
  125. package/dist/ipfs.js +214 -0
  126. package/dist/label-aliases.d.ts +31 -0
  127. package/dist/label-aliases.js +70 -0
  128. package/dist/metadata/education.d.ts +30 -0
  129. package/dist/metadata/education.js +31 -0
  130. package/dist/metadata/index.d.ts +12 -0
  131. package/dist/metadata/index.js +48 -0
  132. package/dist/metadata/org.d.ts +92 -0
  133. package/dist/metadata/org.js +93 -0
  134. package/dist/metadata/proposal.d.ts +44 -0
  135. package/dist/metadata/proposal.js +45 -0
  136. package/dist/metadata/role.d.ts +38 -0
  137. package/dist/metadata/role.js +35 -0
  138. package/dist/metadata/task.d.ts +108 -0
  139. package/dist/metadata/task.js +81 -0
  140. package/dist/metadata/token.d.ts +32 -0
  141. package/dist/metadata/token.js +36 -0
  142. package/dist/metadata/user.d.ts +63 -0
  143. package/dist/metadata/user.js +70 -0
  144. package/dist/multicall.d.ts +32 -0
  145. package/dist/multicall.js +96 -0
  146. package/dist/payout.d.ts +59 -0
  147. package/dist/payout.js +96 -0
  148. package/dist/perms.d.ts +47 -0
  149. package/dist/perms.js +120 -0
  150. package/dist/preflight.d.ts +72 -0
  151. package/dist/preflight.js +269 -0
  152. package/dist/reads/education.d.ts +79 -0
  153. package/dist/reads/education.js +122 -0
  154. package/dist/reads/eligibility.d.ts +377 -0
  155. package/dist/reads/eligibility.js +687 -0
  156. package/dist/reads/index.d.ts +16 -0
  157. package/dist/reads/index.js +55 -0
  158. package/dist/reads/org.d.ts +258 -0
  159. package/dist/reads/org.js +220 -0
  160. package/dist/reads/paymaster.d.ts +147 -0
  161. package/dist/reads/paymaster.js +235 -0
  162. package/dist/reads/project.d.ts +33 -0
  163. package/dist/reads/project.js +62 -0
  164. package/dist/reads/resolve.d.ts +34 -0
  165. package/dist/reads/resolve.js +64 -0
  166. package/dist/reads/task.d.ts +286 -0
  167. package/dist/reads/task.js +280 -0
  168. package/dist/reads/token.d.ts +94 -0
  169. package/dist/reads/token.js +75 -0
  170. package/dist/reads/treasury.d.ts +222 -0
  171. package/dist/reads/treasury.js +241 -0
  172. package/dist/reads/user.d.ts +229 -0
  173. package/dist/reads/user.js +155 -0
  174. package/dist/reads/vote.d.ts +296 -0
  175. package/dist/reads/vote.js +392 -0
  176. package/dist/reads/zkemail.d.ts +117 -0
  177. package/dist/reads/zkemail.js +217 -0
  178. package/dist/similarity.d.ts +36 -0
  179. package/dist/similarity.js +67 -0
  180. package/dist/sponsorship-config.d.ts +47 -0
  181. package/dist/sponsorship-config.js +41 -0
  182. package/dist/stats.d.ts +11 -0
  183. package/dist/stats.js +27 -0
  184. package/dist/task-lens.d.ts +113 -0
  185. package/dist/task-lens.js +210 -0
  186. package/dist/tx/education.d.ts +169 -0
  187. package/dist/tx/education.js +344 -0
  188. package/dist/tx/eligibility.d.ts +511 -0
  189. package/dist/tx/eligibility.js +818 -0
  190. package/dist/tx/governance.d.ts +85 -0
  191. package/dist/tx/governance.js +87 -0
  192. package/dist/tx/index.d.ts +17 -0
  193. package/dist/tx/index.js +56 -0
  194. package/dist/tx/intent.d.ts +67 -0
  195. package/dist/tx/intent.js +48 -0
  196. package/dist/tx/org.d.ts +321 -0
  197. package/dist/tx/org.js +544 -0
  198. package/dist/tx/paymaster.d.ts +140 -0
  199. package/dist/tx/paymaster.js +251 -0
  200. package/dist/tx/project.d.ts +146 -0
  201. package/dist/tx/project.js +217 -0
  202. package/dist/tx/task.d.ts +480 -0
  203. package/dist/tx/task.js +1149 -0
  204. package/dist/tx/token.d.ts +96 -0
  205. package/dist/tx/token.js +165 -0
  206. package/dist/tx/treasury.d.ts +474 -0
  207. package/dist/tx/treasury.js +911 -0
  208. package/dist/tx/user.d.ts +177 -0
  209. package/dist/tx/user.js +292 -0
  210. package/dist/tx/vote.d.ts +332 -0
  211. package/dist/tx/vote.js +762 -0
  212. package/dist/tx/zkemail.d.ts +90 -0
  213. package/dist/tx/zkemail.js +210 -0
  214. package/dist/validation.d.ts +8 -0
  215. package/dist/validation.js +39 -0
  216. package/dist/version.d.ts +142 -0
  217. package/dist/version.js +257 -0
  218. package/dist/zkemail.d.ts +161 -0
  219. package/dist/zkemail.js +299 -0
  220. package/package.json +130 -0
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Subgraph Client — tiered transport (browser-pure port of src/lib/subgraph.ts)
3
+ *
4
+ * Two transports can serve the same subgraph:
5
+ *
6
+ * FREE ("Studio") `api.studio.thegraph.com/...` — no key, capped at
7
+ * 3K queries/day (rolling window, see x-ratelimit-reset).
8
+ * PAID ("gateway") `gateway.thegraph.com/api/subgraphs/id/<ID>` — billed
9
+ * against GRAPH_API_KEY, sent as an Authorization header.
10
+ *
11
+ * Routing is by AVAILABILITY, controlled by POP_SUBGRAPH_TIER=free|paid|auto
12
+ * (default `auto`):
13
+ *
14
+ * both free first, switch to paid when free is exhausted, and REMEMBER
15
+ * the switch via the injected TierStateStore so the next process
16
+ * does not repeat the doomed free round-trip
17
+ * paid only straight to the gateway, never probe Studio
18
+ * free only Studio; on exhaustion, fail with an actionable error naming
19
+ * GRAPH_API_KEY and the gateway URL to set
20
+ * neither PRECONDITION error (this chain has no POP subgraph)
21
+ *
22
+ * ## Injection seams (what differs from the CLI original)
23
+ *
24
+ * The logic is identical to the CLI's src/lib/subgraph.ts; only the
25
+ * environment touchpoints are injected:
26
+ *
27
+ * env EnvSource instead of process.env (POP_SUBGRAPH_TIER,
28
+ * GRAPH_API_KEY, POP_<NET>_* endpoint overrides)
29
+ * stateStore TierStateStore instead of ~/.pop/subgraph-tier-state.json —
30
+ * in-memory by default; the CLI injects a file-backed store,
31
+ * a browser host can inject localStorage
32
+ * fetch transport (defaults to globalThis.fetch)
33
+ * onWarn per-chain sweep failures (the CLI injects process.stderr)
34
+ * now clock, for tests
35
+ *
36
+ * The transport is plain fetch rather than graphql-request, but thrown errors
37
+ * carry the same observable shape (`.response.{status,headers,errors,error}`,
38
+ * `GraphQL Error (Code: NNN)` messages for non-JSON bodies) so the error
39
+ * classifiers below behave identically.
40
+ *
41
+ * ## Why exhaustion is persisted
42
+ *
43
+ * The CLI is a fresh process per command. A per-process flag meant that once
44
+ * Studio's daily quota was gone EVERY command burned a doomed Studio
45
+ * round-trip first, and queryWithFieldFallback repeated that once per tier.
46
+ *
47
+ * ## Why the pin is SHORT
48
+ *
49
+ * A burst limit and a spent daily quota look identical from a single 429, so
50
+ * exhaustion is pinned for FREE_BACKOFF_SECONDS (15 min) and no longer — never
51
+ * "until UTC midnight". Worst case we re-probe Studio ~96 times a day instead
52
+ * of thousands of times; best case a transient burst limit does not push a
53
+ * whole day of traffic onto the paid key. A `x-ratelimit-reset` sooner than the
54
+ * backoff shortens the pin but never extends it.
55
+ *
56
+ * The state store is advisory: a corrupt or unreadable one is ignored, never
57
+ * fatal.
58
+ */
59
+ import type { EnvSource } from '../env';
60
+ /** How long a free-tier quota/rate error suppresses the free transport. */
61
+ export declare const FREE_BACKOFF_SECONDS: number;
62
+ export type SubgraphTierName = 'free' | 'paid';
63
+ export type SubgraphTierMode = 'auto' | 'free' | 'paid';
64
+ export type TransportAvailability = 'both' | 'paid-only' | 'free-only' | 'none';
65
+ export interface TransportAttempt {
66
+ tier: SubgraphTierName;
67
+ url: string;
68
+ }
69
+ export interface TransportPlan {
70
+ chainId: number;
71
+ /** Human network name, for error messages. */
72
+ networkName: string;
73
+ /** Effective POP_SUBGRAPH_TIER. */
74
+ mode: SubgraphTierMode;
75
+ /** Set when POP_SUBGRAPH_TIER held an unrecognised value (we fell back to auto). */
76
+ modeOverrideIgnored?: string;
77
+ availability: TransportAvailability;
78
+ hasApiKey: boolean;
79
+ /** A gateway URL is configured but GRAPH_API_KEY is missing, so it is unusable. */
80
+ paidKeyMissing: boolean;
81
+ freeUrl?: string;
82
+ paidUrl?: string;
83
+ /** Transports to try, in order. Empty means "nothing usable" — see planError(). */
84
+ attempts: TransportAttempt[];
85
+ /** unix-seconds; while in the future the free transport is skipped. */
86
+ freeExhaustedUntil?: number;
87
+ }
88
+ export interface TierState {
89
+ version: 1;
90
+ chains: Record<string, {
91
+ freeExhaustedUntil: number;
92
+ recordedAt: number;
93
+ reason?: string;
94
+ }>;
95
+ }
96
+ /**
97
+ * Where the free-tier exhaustion pin lives between queries. Implementations
98
+ * must never throw from load() or save(): a broken store degrades routing to
99
+ * per-call behaviour, it must not fail a read command.
100
+ */
101
+ export interface TierStateStore {
102
+ load(): TierState | undefined;
103
+ save(state: TierState): void;
104
+ }
105
+ export declare function emptyTierState(): TierState;
106
+ /** Default store: per-client-instance memory. */
107
+ export declare class InMemoryTierStateStore implements TierStateStore {
108
+ private state;
109
+ load(): TierState | undefined;
110
+ save(state: TierState): void;
111
+ clear(): void;
112
+ }
113
+ export interface GraphErrorResponse {
114
+ status?: number;
115
+ headers?: any;
116
+ errors?: Array<{
117
+ message?: string;
118
+ extensions?: {
119
+ code?: string;
120
+ };
121
+ }>;
122
+ error?: any;
123
+ data?: any;
124
+ }
125
+ export declare class GraphRequestError extends Error {
126
+ response: GraphErrorResponse;
127
+ status?: number;
128
+ constructor(message: string, response: GraphErrorResponse);
129
+ }
130
+ export declare function redactSubgraphUrl(url: string | undefined): string | undefined;
131
+ /**
132
+ * Quota/rate exhaustion, in whatever shape the host actually uses.
133
+ *
134
+ * Confirmed live (2026-07): Studio answers a healthy query HTTP 200 with
135
+ * `x-ratelimit-limit: 3000` / `-remaining` / `-reset`, and the gateway answers
136
+ * an unauthenticated query HTTP **200** with `{"errors":[{"message":"auth
137
+ * error: ..."}]}` — i.e. HTTP status alone is not sufficient in either
138
+ * direction. So: match the status when it is one of the unambiguous
139
+ * exhaustion codes, otherwise match only the SERVER's message text.
140
+ */
141
+ export declare function isQuotaError(error: any): boolean;
142
+ /** Missing/invalid/unauthorised API key on the paid transport. */
143
+ export declare function isAuthError(error: any): boolean;
144
+ /**
145
+ * Detect a GraphQL validation error caused by querying a field the
146
+ * deployed schema doesn't have (older subgraph version). Network/HTTP
147
+ * failures deliberately do NOT match — those should propagate.
148
+ */
149
+ export declare function isUnknownFieldError(error: any): boolean;
150
+ /**
151
+ * One tier of a field-fallback query. Tier 0 is the richest query
152
+ * (newest schema fields); later tiers progressively drop fields for
153
+ * older subgraph deployments.
154
+ */
155
+ export interface FieldFallbackTier {
156
+ query: string;
157
+ variables?: Record<string, any>;
158
+ }
159
+ export interface ChainQueryResult<T> {
160
+ chainId: number;
161
+ name: string;
162
+ /** null when the chain returned nothing OR when the query failed — check `error`. */
163
+ data: T | null;
164
+ /**
165
+ * Present only when the query FAILED. `data: null` with no `error` means the
166
+ * chain answered and simply had no matching rows. Without this a
167
+ * rate-limited sweep looked identical to an empty ecosystem.
168
+ */
169
+ error?: string;
170
+ }
171
+ export interface TransportStatus {
172
+ mode: SubgraphTierMode;
173
+ availability: TransportAvailability;
174
+ /** Transport that WILL serve the next query, or null if none is usable. */
175
+ activeTier: SubgraphTierName | null;
176
+ hasApiKey: boolean;
177
+ paidKeyMissing: boolean;
178
+ freeUrl?: string;
179
+ paidUrl?: string;
180
+ freeExhaustedUntil?: number;
181
+ /** One-line human summary, safe to print. Never contains the API key. */
182
+ summary: string;
183
+ }
184
+ export interface GraphClientOptions {
185
+ /** POP_SUBGRAPH_TIER, GRAPH_API_KEY, POP_<NET>_* endpoint overrides. */
186
+ env?: EnvSource;
187
+ /**
188
+ * Chain served when a call passes no chainId. Without it, per-call chainId
189
+ * (or env POP_DEFAULT_CHAIN) is required — createPopContext({ chainId })
190
+ * sets this so documented reads work with zero further configuration.
191
+ */
192
+ defaultChainId?: number;
193
+ /** Free-tier exhaustion memory. Default: in-memory (per client instance). */
194
+ stateStore?: TierStateStore;
195
+ /** Transport. Default: globalThis.fetch. */
196
+ fetch?: typeof fetch;
197
+ /** Per-chain sweep failure reporter (CLI: stderr). Default: silent. */
198
+ onWarn?: (message: string) => void;
199
+ /** Clock (unix ms), for tests. */
200
+ now?: () => number;
201
+ }
202
+ export declare class GraphClient {
203
+ private env;
204
+ private defaultChainId?;
205
+ private store;
206
+ private providedFetch?;
207
+ private onWarn;
208
+ private nowMs;
209
+ constructor(options?: GraphClientOptions);
210
+ /**
211
+ * Resolve the transport LAZILY, per request. Capturing globalThis.fetch at
212
+ * construction would freeze whatever implementation existed then — test
213
+ * stubs and framework fetch-patchers (Next.js, MSW) replace it later.
214
+ * Bind: a bare `fetch` reference loses `this` in browsers ("Illegal
215
+ * invocation").
216
+ */
217
+ private resolveFetch;
218
+ private nowSeconds;
219
+ /**
220
+ * Never throws. A missing or hand-mangled state entry is treated as "no
221
+ * knowledge" — the cost is one wasted free-tier probe, which is strictly
222
+ * better than failing a read command over advisory cache state.
223
+ */
224
+ private loadState;
225
+ private saveState;
226
+ /** unix-seconds until which the free transport is considered spent, or undefined. */
227
+ getFreeExhaustedUntil(chainId: number): number | undefined;
228
+ /**
229
+ * Record that the free transport is spent. `resetAtSeconds` (from
230
+ * x-ratelimit-reset) may SHORTEN the pin but never extend it past
231
+ * FREE_BACKOFF_SECONDS — see the module header on why the pin stays short.
232
+ */
233
+ private markFreeExhausted;
234
+ private clearFreeExhausted;
235
+ /**
236
+ * Proactive exhaustion: Studio tells us how much of the free quota is left on
237
+ * every response, so record "spent" at remaining === 0 rather than waiting for
238
+ * the next command to eat a 429.
239
+ */
240
+ private observeRateLimit;
241
+ private getApiKey;
242
+ /**
243
+ * One GraphQL POST. Errors carry `.response.{status,headers,errors,error}`
244
+ * and graphql-request-style messages so the classifiers above keep working.
245
+ */
246
+ private request;
247
+ private resolveMode;
248
+ /**
249
+ * Work out which transports exist for a chain and in what order to try them.
250
+ * Pure w.r.t. the network: reads env + config + the injected state store only.
251
+ */
252
+ resolveTransportPlan(chainId?: number): TransportPlan;
253
+ private gatewayEnvHint;
254
+ /** The error to raise when a plan has no usable transport at all. */
255
+ private planError;
256
+ /** Free quota gone and there is no paid transport to fall back to. */
257
+ private freeExhaustedError;
258
+ private paidAuthError;
259
+ private paidQuotaError;
260
+ private executePlan;
261
+ /**
262
+ * Query a subgraph on the specified chain, routed through the tier plan
263
+ * (see the module header).
264
+ */
265
+ query<T = any>(gqlQuery: string, variables?: Record<string, any>, chainId?: number): Promise<T>;
266
+ /**
267
+ * Try query tiers in order, falling through to the next tier when the
268
+ * deployed schema rejects a field (validation error). Any other error
269
+ * (network, HTTP, rate limit without fallback) is rethrown immediately.
270
+ * Returns the first successful result plus the tier index that served it.
271
+ *
272
+ * Each tier re-plans, so once tier 0 has recorded free-tier exhaustion the
273
+ * remaining tiers go straight to the gateway instead of repeating the probe.
274
+ */
275
+ queryWithFieldFallback<T = any>(tiers: Array<FieldFallbackTier>, opts?: {
276
+ chainId?: number;
277
+ }): Promise<{
278
+ data: T;
279
+ tierIndex: number;
280
+ }>;
281
+ /**
282
+ * Query a specific subgraph URL directly, still tier-aware: if `url` is a free
283
+ * (Studio) endpoint belonging to a known chain and it rate-limits, the request
284
+ * is retried against that chain's gateway rather than simply failing.
285
+ */
286
+ queryUrl<T = any>(url: string, gqlQuery: string, variables?: Record<string, any>): Promise<T>;
287
+ /**
288
+ * Query all non-testnet subgraphs in parallel, each through its own tier plan.
289
+ * Returns results keyed by chainId. Failures are reported per-chain rather
290
+ * than swallowed: see ChainQueryResult.error.
291
+ */
292
+ queryAllChains<T = any>(gqlQuery: string, variables?: Record<string, any>): Promise<Array<ChainQueryResult<T>>>;
293
+ /**
294
+ * Describe the transport that will serve the next query on `chainId`.
295
+ * Purely local — issues no network request. URLs are redacted.
296
+ */
297
+ getTransportStatus(chainId?: number): TransportStatus;
298
+ }