@lifi/perps-sdk-provider-hyperliquid 0.0.0-preview-9cee1199 → 0.0.0-preview-c6c4e650
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/README.md +57 -13
- package/dist/cjs/HyperliquidProvider.d.ts.map +1 -1
- package/dist/cjs/HyperliquidProvider.js +8 -33
- package/dist/cjs/HyperliquidProvider.js.map +1 -1
- package/dist/cjs/accountConfig.d.ts.map +1 -1
- package/dist/cjs/accountConfig.js +3 -4
- package/dist/cjs/accountConfig.js.map +1 -1
- package/dist/cjs/context.d.ts +2 -12
- package/dist/cjs/context.d.ts.map +1 -1
- package/dist/cjs/context.js +0 -21
- package/dist/cjs/context.js.map +1 -1
- package/dist/cjs/services/getActivity.d.ts.map +1 -1
- package/dist/cjs/services/getActivity.js +6 -2
- package/dist/cjs/services/getActivity.js.map +1 -1
- package/dist/cjs/signers/HyperliquidAgentStore.d.ts +3 -16
- package/dist/cjs/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/cjs/signers/HyperliquidAgentStore.js +6 -100
- package/dist/cjs/signers/HyperliquidAgentStore.js.map +1 -1
- package/dist/cjs/signers/signActions.d.ts.map +1 -1
- package/dist/cjs/signers/signActions.js +1 -21
- package/dist/cjs/signers/signActions.js.map +1 -1
- package/dist/cjs/utils/infoClient.d.ts.map +1 -1
- package/dist/cjs/utils/infoClient.js +1 -16
- package/dist/cjs/utils/infoClient.js.map +1 -1
- package/dist/cjs/utils/mapActivity.d.ts +4 -0
- package/dist/cjs/utils/mapActivity.d.ts.map +1 -1
- package/dist/cjs/utils/mapActivity.js +38 -4
- package/dist/cjs/utils/mapActivity.js.map +1 -1
- package/dist/cjs/utils/mapOrder.d.ts.map +1 -1
- package/dist/cjs/utils/mapOrder.js +6 -3
- package/dist/cjs/utils/mapOrder.js.map +1 -1
- package/dist/cjs/utils/mapPosition.d.ts +0 -2
- package/dist/cjs/utils/mapPosition.d.ts.map +1 -1
- package/dist/cjs/utils/mapPosition.js +2 -28
- package/dist/cjs/utils/mapPosition.js.map +1 -1
- package/dist/cjs/websocket/HyperliquidWsProvider.js +15 -13
- package/dist/cjs/websocket/HyperliquidWsProvider.js.map +1 -1
- package/dist/esm/HyperliquidProvider.d.ts.map +1 -1
- package/dist/esm/HyperliquidProvider.js +9 -34
- package/dist/esm/HyperliquidProvider.js.map +1 -1
- package/dist/esm/accountConfig.d.ts.map +1 -1
- package/dist/esm/accountConfig.js +3 -4
- package/dist/esm/accountConfig.js.map +1 -1
- package/dist/esm/context.d.ts +3 -25
- package/dist/esm/context.d.ts.map +1 -1
- package/dist/esm/context.js +1 -24
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/services/getActivity.d.ts.map +1 -1
- package/dist/esm/services/getActivity.js +7 -3
- package/dist/esm/services/getActivity.js.map +1 -1
- package/dist/esm/signers/HyperliquidAgentStore.d.ts +5 -53
- package/dist/esm/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/esm/signers/HyperliquidAgentStore.js +8 -135
- package/dist/esm/signers/HyperliquidAgentStore.js.map +1 -1
- package/dist/esm/signers/signActions.d.ts.map +1 -1
- package/dist/esm/signers/signActions.js +3 -23
- package/dist/esm/signers/signActions.js.map +1 -1
- package/dist/esm/utils/infoClient.d.ts.map +1 -1
- package/dist/esm/utils/infoClient.js +2 -17
- package/dist/esm/utils/infoClient.js.map +1 -1
- package/dist/esm/utils/mapActivity.d.ts +5 -0
- package/dist/esm/utils/mapActivity.d.ts.map +1 -1
- package/dist/esm/utils/mapActivity.js +38 -4
- package/dist/esm/utils/mapActivity.js.map +1 -1
- package/dist/esm/utils/mapOrder.d.ts +1 -2
- package/dist/esm/utils/mapOrder.d.ts.map +1 -1
- package/dist/esm/utils/mapOrder.js +8 -5
- package/dist/esm/utils/mapOrder.js.map +1 -1
- package/dist/esm/utils/mapPosition.d.ts +0 -4
- package/dist/esm/utils/mapPosition.d.ts.map +1 -1
- package/dist/esm/utils/mapPosition.js +2 -28
- package/dist/esm/utils/mapPosition.js.map +1 -1
- package/dist/esm/websocket/HyperliquidWsProvider.js +15 -13
- package/dist/esm/websocket/HyperliquidWsProvider.js.map +1 -1
- package/dist/types/HyperliquidProvider.d.ts.map +1 -1
- package/dist/types/accountConfig.d.ts.map +1 -1
- package/dist/types/context.d.ts +3 -25
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/services/getActivity.d.ts.map +1 -1
- package/dist/types/signers/HyperliquidAgentStore.d.ts +5 -53
- package/dist/types/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/types/signers/signActions.d.ts.map +1 -1
- package/dist/types/utils/infoClient.d.ts.map +1 -1
- package/dist/types/utils/mapActivity.d.ts +5 -0
- package/dist/types/utils/mapActivity.d.ts.map +1 -1
- package/dist/types/utils/mapOrder.d.ts +1 -2
- package/dist/types/utils/mapOrder.d.ts.map +1 -1
- package/dist/types/utils/mapPosition.d.ts +0 -4
- package/dist/types/utils/mapPosition.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/HyperliquidProvider.ts +16 -59
- package/src/accountConfig.ts +3 -7
- package/src/context.ts +3 -40
- package/src/services/getActivity.ts +9 -3
- package/src/signers/HyperliquidAgentStore.ts +12 -171
- package/src/signers/signActions.ts +9 -43
- package/src/utils/infoClient.ts +2 -18
- package/src/utils/mapActivity.ts +51 -4
- package/src/utils/mapOrder.ts +8 -5
- package/src/utils/mapPosition.ts +2 -36
- package/src/websocket/HyperliquidWsProvider.ts +13 -13
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Hyperliquid provider plugin for the [LI.FI Perps SDK](https://public-perps-docs.
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
pnpm add @lifi/perps-sdk @lifi/perps-sdk-provider-hyperliquid viem@2.
|
|
17
|
+
pnpm add @lifi/perps-sdk @lifi/perps-sdk-provider-hyperliquid viem@2.58.7
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Quick start
|
|
@@ -29,6 +29,9 @@ const client = createPerpsClient({
|
|
|
29
29
|
})
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
The [`01-market-data.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/01-market-data.ts)
|
|
33
|
+
example reads the public market data with this provider.
|
|
34
|
+
|
|
32
35
|
## Account boundary
|
|
33
36
|
|
|
34
37
|
A Hyperliquid account exists only after its first deposit. `accountExists`
|
|
@@ -44,6 +47,11 @@ Public market reads and the deposit flow remain available before account
|
|
|
44
47
|
creation. Existing accounts with no positions, orders, fills, or activity
|
|
45
48
|
return their normal empty data.
|
|
46
49
|
|
|
50
|
+
The [`03-onboarding.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/03-onboarding.ts)
|
|
51
|
+
example stops setup until the account exists. The
|
|
52
|
+
[`04-deposit.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/04-deposit.ts)
|
|
53
|
+
example makes the deposit.
|
|
54
|
+
|
|
47
55
|
## Bounded portfolio history
|
|
48
56
|
|
|
49
57
|
`getPortfolioHistory` with `bounds` reads the same one `portfolio` request
|
|
@@ -69,10 +77,15 @@ native preset total. A sample after `bounds.end` is never a point. The
|
|
|
69
77
|
|
|
70
78
|
Setup registers an agent keypair whose private key signs orders locally, so trading needs no per-order wallet popups. The agent key authorizes trading only — it cannot withdraw funds.
|
|
71
79
|
|
|
72
|
-
The keypair is persisted through a `StorageAdapter`. The default adapter encrypts values with AES-GCM before writing to browser `localStorage`, holding the master key as a non-extractable `CryptoKey` handle in IndexedDB, so key material is never stored as plaintext. Pass your own `StorageAdapter`
|
|
80
|
+
The keypair is persisted through a `StorageAdapter`. The default adapter encrypts values with AES-GCM before writing to browser `localStorage`, holding the master key as a non-extractable `CryptoKey` handle in IndexedDB, so key material is never stored as plaintext. Pass your own `StorageAdapter` as the `storage` option of `hyperliquidProvider()` to use a different backend — a custom adapter bypasses this encryption and is responsible for protecting the key at rest.
|
|
73
81
|
|
|
74
82
|
After a `REVOKE_SESSION_AGENT` result is `Submitted` or `Accepted`, the provider removes the local agent key so it is no longer used for signing. `Submitted` is an acknowledgement, not proof of venue revocation. An `Indeterminate` or `Failed` revoke keeps the key; a refused revoke does not mean the credential itself was refused.
|
|
75
83
|
|
|
84
|
+
The [`03-onboarding.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/03-onboarding.ts)
|
|
85
|
+
example approves the agent and stores its key with `LocalJSONFileAdapter`. The
|
|
86
|
+
[`13-revoke-agent.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/13-revoke-agent.ts)
|
|
87
|
+
example revokes the agent.
|
|
88
|
+
|
|
76
89
|
## Live portfolio valuation
|
|
77
90
|
|
|
78
91
|
`spotBalances` and spot-funded `accountSummary` subscriptions own their shared
|
|
@@ -85,6 +98,9 @@ for its first price rather than reporting a zero USD value. Tokens without a
|
|
|
85
98
|
listed market retain their unpriced balances. Unified and portfolio-margin
|
|
86
99
|
summaries also wait for clearinghouse state and venue-reported buying power.
|
|
87
100
|
|
|
101
|
+
The [`09-account-stream.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/09-account-stream.ts)
|
|
102
|
+
example subscribes to the `accountSummary` and the other account channels.
|
|
103
|
+
|
|
88
104
|
## Ledger asset identity
|
|
89
105
|
|
|
90
106
|
Transfers, fees, and rewards carry the backend registry `Asset`, including its logo, numeric `id`,
|
|
@@ -92,9 +108,9 @@ and optional `l1Address`. A Hyperliquid ledger row moves a spot asset, and its
|
|
|
92
108
|
`token` field holds the bare spot symbol. The mapper resolves that symbol in
|
|
93
109
|
the spot asset registry, which the HIP-1 ticker auction keeps unique. The
|
|
94
110
|
registry holds only the tokens of listed spot pairs. The mapper skips a row
|
|
95
|
-
whose symbol is not in the registry
|
|
96
|
-
|
|
97
|
-
error.
|
|
111
|
+
whose symbol is not in the registry. It warns once per provider key while the
|
|
112
|
+
warning remains in the cache. The mapper never fabricates an asset. Missing
|
|
113
|
+
collateral raises a stale or mis-keyed registry error.
|
|
98
114
|
|
|
99
115
|
The fixed-USDC `deposit` and `withdraw` deltas resolve the registry `Asset`
|
|
100
116
|
by reserved spot token index `0`. Their `usdc` field identifies the venue's
|
|
@@ -114,7 +130,7 @@ defines token indices and `tokenId`.
|
|
|
114
130
|
| Delta | Activity or explicit exclusion |
|
|
115
131
|
| --- | --- |
|
|
116
132
|
| `spotTransfer` | Transfer between distinct accounts. Resolve the bare token symbol. |
|
|
117
|
-
| `send` | Transfer between distinct accounts. Resolve the bare token symbol. |
|
|
133
|
+
| `send` | Transfer between distinct accounts. Resolve the bare token symbol. A same-account move between spot and perps is an `INTERNAL_TRANSFER`. |
|
|
118
134
|
| `internalTransfer` | USDC transfer between distinct accounts; resolve token index `0`. |
|
|
119
135
|
| `subAccountTransfer` | USDC transfer between master and subaccount addresses; resolve token index `0`. |
|
|
120
136
|
| `deposit` | Deposit with the USDC registry asset at token index `0`. |
|
|
@@ -122,7 +138,7 @@ defines token indices and `tokenId`.
|
|
|
122
138
|
| `liquidation` | Liquidation with resolved positions. |
|
|
123
139
|
| `accountClassTransfer` | `INTERNAL_TRANSFER` between spot and perps. Resolve collateral token index `0` and retain `usdc`. |
|
|
124
140
|
| `vaultCreate` | Excluded: vault creation and capital allocation require a vault activity model. |
|
|
125
|
-
| `vaultDeposit` | Outbound USDC transfer to the vault; resolve token index `0` and use `usdc`. For a query of the vault account, the mapper skips the row
|
|
141
|
+
| `vaultDeposit` | Outbound USDC transfer to the vault; resolve token index `0` and use `usdc`. For a query of the vault account, the mapper skips the row. |
|
|
126
142
|
| `vaultDistribution` | Excluded: a vault distribution requires vault identity and investment semantics. |
|
|
127
143
|
| `vaultWithdraw` | USDC transfer from the vault to the user; use `netWithdrawnUsd` and preserve accounting fields in `meta`. |
|
|
128
144
|
| `vaultLeaderCommission` | Excluded: commission income is not a transfer instruction and lacks a source counterparty. |
|
|
@@ -146,13 +162,14 @@ The mapper excludes a fee or reward row without a string `token` and a string
|
|
|
146
162
|
|
|
147
163
|
Vault withdrawal direction follows the queried account: inbound for the user,
|
|
148
164
|
outbound for the vault. The documented `vaultDeposit` payload has no depositor
|
|
149
|
-
field. For a query of the vault account, the mapper
|
|
150
|
-
|
|
151
|
-
|
|
165
|
+
field. For a query of the vault account, the mapper skips that row and retains
|
|
166
|
+
the other rows. It warns about the missing depositor once per provider key
|
|
167
|
+
while the warning remains in the cache. Depositor-account queries map normally.
|
|
152
168
|
Portfolio transfer history keeps unavailable coverage for the vault-side row.
|
|
153
169
|
|
|
154
170
|
`TRANSFER` describes movements between distinct accounts and requires a counterparty.
|
|
155
|
-
The mapper excludes same-account `
|
|
171
|
+
The mapper excludes same-account `spotTransfer` rows.
|
|
172
|
+
It also excludes a same-account `send` row unless the row moves value between spot and perps.
|
|
156
173
|
`INTERNAL_TRANSFER` describes movements between balances of the queried account, without a counterparty or `IN`/`OUT` direction.
|
|
157
174
|
Its balance identifiers are not trading-category identifiers.
|
|
158
175
|
|
|
@@ -166,6 +183,12 @@ Its balance identifiers are not trading-category identifiers.
|
|
|
166
183
|
| `borrowLend`, `operation: 'repay'` | `spot` | `borrowLend` |
|
|
167
184
|
| `accountClassTransfer`, `toPerp: true` | `spot` | `perps` |
|
|
168
185
|
| `accountClassTransfer`, `toPerp: false` | `perps` | `spot` |
|
|
186
|
+
| Same-account `send`, `sourceDex: 'spot'`, any other `destinationDex` | `spot` | `perps` |
|
|
187
|
+
| Same-account `send`, `destinationDex: 'spot'`, any other `sourceDex` | `perps` | `spot` |
|
|
188
|
+
|
|
189
|
+
A `send` names the main perp dex `""`, spot `"spot"`, and another perp dex by its name.
|
|
190
|
+
Thus, a move between two perp dexes, a move from spot to spot, and a row without a string dex produce no row.
|
|
191
|
+
A same-account `send` row keeps `meta.sourceDex` and `meta.destinationDex`.
|
|
169
192
|
|
|
170
193
|
All internal rows preserve `meta.transferType`.
|
|
171
194
|
The balance pair determines direction. The amount retains the venue decimal string, including its sign and precision.
|
|
@@ -224,6 +247,9 @@ the original upper time bound, preventing subsequent pages from regrouping an
|
|
|
224
247
|
order using newly arriving fills. Funding/ledger-only activity and ordinary fill
|
|
225
248
|
pages use bounded newest-first windows instead of repeatedly downloading full history.
|
|
226
249
|
|
|
250
|
+
The [`05-account-data.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/05-account-data.ts)
|
|
251
|
+
example reads the first page of fills and of activity.
|
|
252
|
+
|
|
227
253
|
### TWAP slice fills
|
|
228
254
|
|
|
229
255
|
Hyperliquid reports the executions of a TWAP on separate feeds. The regular
|
|
@@ -285,8 +311,7 @@ venue status code. An unknown status that ends with `Canceled` gives
|
|
|
285
311
|
`Rejected by the venue.`. All other unknown status strings throw `PerpsError`.
|
|
286
312
|
|
|
287
313
|
```ts
|
|
288
|
-
import { getOrders } from '@lifi/perps-sdk'
|
|
289
|
-
import { OrderStatus } from '@lifi/perps-types'
|
|
314
|
+
import { getOrders, OrderStatus } from '@lifi/perps-sdk'
|
|
290
315
|
|
|
291
316
|
const { orders } = await getOrders(client, {
|
|
292
317
|
provider: 'hyperliquid',
|
|
@@ -295,6 +320,11 @@ const { orders } = await getOrders(client, {
|
|
|
295
320
|
})
|
|
296
321
|
```
|
|
297
322
|
|
|
323
|
+
The [`05-account-data.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/05-account-data.ts)
|
|
324
|
+
example reads the orders. The
|
|
325
|
+
[`06-limit-order.ts`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid/06-limit-order.ts)
|
|
326
|
+
example reads one order with `getOrder`.
|
|
327
|
+
|
|
298
328
|
The default filter is `ACTIVE_ORDER_STATUSES`: PENDING, OPEN,
|
|
299
329
|
PARTIALLY_FILLED, and TRIGGERED. Active filters read `frontendOpenOrders`.
|
|
300
330
|
Terminal filters read `historicalOrders`. Mixed filters read both.
|
|
@@ -318,6 +348,12 @@ An `activated` TWAP maps to FILLED when its filled size reaches its original
|
|
|
318
348
|
size. The remaining size never falls below zero. The filled size preserves the
|
|
319
349
|
actual execution, even when it exceeds the original size.
|
|
320
350
|
|
|
351
|
+
Hyperliquid can reduce the remaining size of a reduce-only order without a
|
|
352
|
+
trade. When `sz` is below `origSz`, `getOrders`, `getOrder`, and `orderUpdates`
|
|
353
|
+
report `filledSize: null` and do not infer a partial fill from the difference.
|
|
354
|
+
They preserve `originalSize` as `origSz` and `remainingSize` as `sz`.
|
|
355
|
+
These order reads do not query the account fills to calculate this value.
|
|
356
|
+
|
|
321
357
|
The venue returns at most 2,000 historical orders. The provider returns the
|
|
322
358
|
available matching rows in one response; it does not expose older pages.
|
|
323
359
|
|
|
@@ -343,6 +379,14 @@ with a backstop takeover.
|
|
|
343
379
|
- A fill of the liquidated account has no `type`. A backstop takeover fills
|
|
344
380
|
that account as the maker, but no resting limit order exists.
|
|
345
381
|
|
|
382
|
+
## Examples
|
|
383
|
+
|
|
384
|
+
The [`examples/hyperliquid/`](https://github.com/lifinance/perps-sdk/tree/main/examples/hyperliquid)
|
|
385
|
+
folder holds type-checked examples for this provider. It has the files
|
|
386
|
+
`01-market-data.ts` to `14-error-management-troubleshooting.ts`. The
|
|
387
|
+
`@lifi/perps-sdk` README §
|
|
388
|
+
Examples describes the numbered file set.
|
|
389
|
+
|
|
346
390
|
## Documentation
|
|
347
391
|
|
|
348
392
|
- [`@lifi/perps-sdk` README](https://www.npmjs.com/package/@lifi/perps-sdk) — client setup, options, and the WebSocket API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperliquidProvider.d.ts","sourceRoot":"","sources":["../../src/HyperliquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HyperliquidProvider.d.ts","sourceRoot":"","sources":["../../src/HyperliquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,mBAAmB,EAuBxB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AA4BxB,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAa,MAAM,MAAM,CAAA;AAoBxD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,oCAAoC,CAAA;AAa3C,MAAM,WAAW,0BAA0B;IAOzC,MAAM,CAAC,EAAE,MAAM,CAAA;IAMf,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB;AAWD,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IAKnE,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEnD,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAK5C,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAK5C,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC1E;AAuBD,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,wBAAwB,CA2U1B"}
|
|
@@ -7,7 +7,6 @@ const viem_1 = require("viem");
|
|
|
7
7
|
const accountConfig_js_1 = require("./accountConfig.js");
|
|
8
8
|
const accountSummary_js_1 = require("./accountSummary.js");
|
|
9
9
|
const constants_js_1 = require("./constants.js");
|
|
10
|
-
const context_js_1 = require("./context.js");
|
|
11
10
|
const getAccount_js_1 = require("./services/getAccount.js");
|
|
12
11
|
const getAccountExists_js_1 = require("./services/getAccountExists.js");
|
|
13
12
|
const getActivity_js_1 = require("./services/getActivity.js");
|
|
@@ -24,13 +23,12 @@ const HyperliquidAgentStore_js_1 = require("./signers/HyperliquidAgentStore.js")
|
|
|
24
23
|
const signActions_js_1 = require("./signers/signActions.js");
|
|
25
24
|
const infoClient_js_1 = require("./utils/infoClient.js");
|
|
26
25
|
const liquidation_js_1 = require("./utils/liquidation.js");
|
|
27
|
-
const mapPosition_js_1 = require("./utils/mapPosition.js");
|
|
28
26
|
const orderFormatting_js_1 = require("./utils/orderFormatting.js");
|
|
29
27
|
const transferMargin_js_1 = require("./utils/transferMargin.js");
|
|
30
28
|
function hyperliquidProvider(options = {}) {
|
|
31
29
|
const apiUrl = options.apiUrl ?? constants_js_1.DEFAULT_HYPERLIQUID_API_URL;
|
|
32
30
|
const agentStore = new HyperliquidAgentStore_js_1.HyperliquidAgentStore(options.storage);
|
|
33
|
-
const contextRef = new
|
|
31
|
+
const contextRef = new perps_sdk_1.ProviderContextRef(apiUrl, 'hyperliquidProvider');
|
|
34
32
|
const toLowerAddress = (value) => typeof value === 'string' && (0, viem_1.isAddress)(value) ? value.toLowerCase() : null;
|
|
35
33
|
const toValidUntilMs = (value) => {
|
|
36
34
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
@@ -84,27 +82,15 @@ function hyperliquidProvider(options = {}) {
|
|
|
84
82
|
type: constants_js_1.PROVIDER_KEY,
|
|
85
83
|
conditionalSetupActions: [perps_types_1.ActionType.REVOKE_AGENT],
|
|
86
84
|
bind: (client) => contextRef.bind(client),
|
|
87
|
-
|
|
88
|
-
hasAgent: (address) => agentStore.has(address),
|
|
89
|
-
removeAgent: (address) => agentStore.remove(address),
|
|
90
|
-
importAgent: (address, privateKey) => agentStore.import(address, privateKey),
|
|
85
|
+
...(0, perps_sdk_1.agentKeyMethods)(agentStore),
|
|
91
86
|
resolveActionRequest: async (action, address, signer) => {
|
|
92
87
|
if (action === perps_types_1.ActionType.APPROVE_AGENT) {
|
|
93
88
|
const agentAddress = await resolveApproveAgentAddress(address);
|
|
94
89
|
return { params: { agentAddress } };
|
|
95
90
|
}
|
|
96
91
|
if (action === perps_types_1.ActionType.REVOKE_SESSION_AGENT) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return { params: { agentAddress: agent.address } };
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
if (error instanceof perps_sdk_1.PerpsError &&
|
|
103
|
-
error.message === perps_sdk_1.PerpsErrorMessage.AgentNotFound) {
|
|
104
|
-
throw new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.SDKError, `Nothing to revoke for '${action}' on '${constants_js_1.PROVIDER_KEY}': no session agent is stored for ${address}.`);
|
|
105
|
-
}
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
92
|
+
const agent = await (0, perps_sdk_1.getAgentToRevoke)(agentStore, address, constants_js_1.PROVIDER_KEY);
|
|
93
|
+
return { params: { agentAddress: agent.address } };
|
|
108
94
|
}
|
|
109
95
|
if (signer === perps_types_1.PerpsSigner.SDK) {
|
|
110
96
|
const agent = await agentStore.get(address);
|
|
@@ -116,12 +102,7 @@ function hyperliquidProvider(options = {}) {
|
|
|
116
102
|
signed: await (0, signActions_js_1.hyperliquidSignActions)(agentStore, method, steps, address, ctx),
|
|
117
103
|
executed: [],
|
|
118
104
|
}),
|
|
119
|
-
onExecuteResults:
|
|
120
|
-
if (results.some((result) => result.action === perps_types_1.ActionType.REVOKE_SESSION_AGENT &&
|
|
121
|
-
(0, perps_sdk_1.isSubmittedOrAccepted)(result))) {
|
|
122
|
-
await agentStore.remove(address);
|
|
123
|
-
}
|
|
124
|
-
},
|
|
105
|
+
onExecuteResults: (address, results) => (0, perps_sdk_1.removeAgentOnRevoke)(agentStore, address, results),
|
|
125
106
|
getAccount: (params, opts) => (0, getAccount_js_1.getAccount)(contextRef.require(), { address: params.address }, opts),
|
|
126
107
|
accountExists: (params, opts) => (0, getAccountExists_js_1.getAccountExists)(contextRef.require(), { address: params.address }, opts),
|
|
127
108
|
getDepositFlow: async () => ({
|
|
@@ -164,15 +145,9 @@ function hyperliquidProvider(options = {}) {
|
|
|
164
145
|
getAccountSummary: (account, positions) => (0, accountSummary_js_1.getAccountSummary)(account, positions),
|
|
165
146
|
snapOrderPrice: (market, price) => (0, orderFormatting_js_1.snapOrderPrice)(price, market.szDecimals, (0, perps_sdk_1.isSpotCategory)(market.categoryId) ? 'spot' : undefined),
|
|
166
147
|
snapOrderSize: (market, size) => (0, orderFormatting_js_1.snapOrderSize)(size, market.szDecimals),
|
|
167
|
-
calculateRoe:
|
|
168
|
-
remarkPosition:
|
|
169
|
-
isLeverageEqual:
|
|
170
|
-
if (!(0, perps_sdk_1.isDecimalStringGreaterThan)(requested, '0') ||
|
|
171
|
-
!(0, perps_sdk_1.isDecimalStringGreaterThan)(reported.leverage, '0')) {
|
|
172
|
-
throw new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.ValidationError, 'Leverage must be above zero');
|
|
173
|
-
}
|
|
174
|
-
return (0, perps_sdk_1.isDecimalStringEqual)(requested, reported.leverage);
|
|
175
|
-
},
|
|
148
|
+
calculateRoe: perps_sdk_1.calculatePositionRoe,
|
|
149
|
+
remarkPosition: perps_sdk_1.remarkPositionRoe,
|
|
150
|
+
isLeverageEqual: perps_sdk_1.isLeverageEqualToSetting,
|
|
176
151
|
triggerOrders: { modifyCanChangeType: true },
|
|
177
152
|
estimateLiquidationPrice: (market, params) => (0, liquidation_js_1.calculateLiquidationPrice)(params, market.maxLeverage),
|
|
178
153
|
positionRemovableMargin: transferMargin_js_1.positionRemovableMargin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperliquidProvider.js","sourceRoot":"","sources":["../../src/HyperliquidProvider.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"HyperliquidProvider.js","sourceRoot":"","sources":["../../src/HyperliquidProvider.ts"],"names":[],"mappings":";;AAsKA,kDA6UC;AAnfD,+CAoCwB;AACxB,mDA0B0B;AAC1B,+BAAwD;AACxD,yDAAqE;AACrE,2DAAuD;AACvD,iDAIuB;AACvB,4DAAqD;AACrD,wEAAiE;AACjE,8DAAuD;AACvD,8EAAuE;AACvE,wDAAiD;AACjD,sEAA+D;AAC/D,0EAAmE;AACnE,wDAAiD;AACjD,0DAAmD;AACnD,8EAAuE;AACvE,gEAAyD;AACzD,sFAA+E;AAC/E,iFAG2C;AAC3C,6DAAiE;AAEjE,yDAAkE;AAClE,2DAAkE;AAClE,mEAA0E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B,EAAE,CACxB,MAAmB,EACnB,MAAiC,EACb,EAAE,CACtB,IAAA,0CAAyB,EAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;QAEvD,uBAAuB,EAAvB,2CAAuB;QAEvB,aAAa,EAAE,CACb,MAAqB,EACrB,KAAoB,EACI,EAAE;YAC1B,IAAI,MAAM,CAAC,QAAQ,KAAK,2BAAY,EAAE,CAAC;gBACrC,MAAM,IAAI,sBAAU,CAClB,4BAAc,CAAC,QAAQ,EACvB,iEAAiE;oBAC/D,IAAI,MAAM,CAAC,QAAQ,IAAI,CAC1B,CAAA;YACH,CAAC;YACD,OAAO,IAAA,mDAAgC,EAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACxD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountConfig.d.ts","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACZ,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"accountConfig.d.ts","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AA8G1B,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,WAAW,EAAE,GACnB,oBAAoB,EAAE,CAIxB"}
|
|
@@ -8,9 +8,6 @@ const ABSTRACTION_OFF_VALUES = new Set([
|
|
|
8
8
|
account_js_1.HlAbstractionMode.DEFAULT,
|
|
9
9
|
account_js_1.HlAbstractionMode.DISABLED,
|
|
10
10
|
]);
|
|
11
|
-
function assertNever(value) {
|
|
12
|
-
throw new Error(`Unreachable: exhaustiveness check failed for value ${JSON.stringify(value)}`);
|
|
13
|
-
}
|
|
14
11
|
function projectHyperliquidDescriptor(descriptor, config) {
|
|
15
12
|
switch (descriptor.type) {
|
|
16
13
|
case perps_types_1.ActionType.APPROVE_AGENT:
|
|
@@ -58,6 +55,8 @@ function projectHyperliquidDescriptor(descriptor, config) {
|
|
|
58
55
|
case perps_types_1.ActionType.META_ONBOARD:
|
|
59
56
|
case perps_types_1.ActionType.META_CREATE_REFERRAL_CODE:
|
|
60
57
|
case perps_types_1.ActionType.SYNC_FEE_ATTRIBUTION:
|
|
58
|
+
case perps_types_1.ActionType.CREATE_ACCOUNT:
|
|
59
|
+
case perps_types_1.ActionType.REVOKE_API_KEY:
|
|
61
60
|
case perps_types_1.ActionType.REVOKE_BUILDER_FEE:
|
|
62
61
|
case perps_types_1.ActionType.REVOKE_SESSION_AGENT:
|
|
63
62
|
case perps_types_1.ActionType.REVOKE_INTEGRATOR:
|
|
@@ -65,7 +64,7 @@ function projectHyperliquidDescriptor(descriptor, config) {
|
|
|
65
64
|
`descriptor type '${descriptor.type}' — this ActionType is not ` +
|
|
66
65
|
`valid on Provider.setup for Hyperliquid.`);
|
|
67
66
|
default:
|
|
68
|
-
return assertNever(descriptor.type);
|
|
67
|
+
return (0, perps_sdk_1.assertNever)(descriptor.type);
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
function projectHyperliquidConfigSettings(config, setup) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountConfig.js","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"accountConfig.js","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":";;AAmHA,4EAOC;AA1HD,+CAA2E;AAM3E,mDAA8D;AAC9D,mDAAsD;AAItD,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IAC1D,8BAAiB,CAAC,OAAO;IACzB,8BAAiB,CAAC,QAAQ;CAC3B,CAAC,CAAA;AAoBF,SAAS,4BAA4B,CACnC,UAAuB,EACvB,MAAgC;IAEhC,QAAQ,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6B;gBAChE,0CAA0C,CAC7C,CAAA;QAEH;YACE,OAAO,IAAA,uBAAW,EAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;AACH,CAAC;AASD,SAAgB,gCAAgC,CAC9C,MAAgC,EAChC,KAAoB;IAEpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAC9B,4BAA4B,CAAC,UAAU,EAAE,MAAM,CAAC,CACjD,CAAA;AACH,CAAC"}
|
package/dist/cjs/context.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
client: PerpsSDKClient;
|
|
4
|
-
apiUrl: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class HyperliquidContextRef {
|
|
7
|
-
private readonly apiUrl;
|
|
8
|
-
private context;
|
|
9
|
-
constructor(apiUrl: string);
|
|
10
|
-
bind(client: PerpsSDKClient): void;
|
|
11
|
-
require(): HyperliquidContext;
|
|
12
|
-
}
|
|
1
|
+
import type { ProviderContext } from '@lifi/perps-sdk';
|
|
2
|
+
export type HyperliquidContext = ProviderContext;
|
|
13
3
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGtD,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAA"}
|
package/dist/cjs/context.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HyperliquidContextRef = void 0;
|
|
4
|
-
const perps_sdk_1 = require("@lifi/perps-sdk");
|
|
5
|
-
const perps_types_1 = require("@lifi/perps-types");
|
|
6
|
-
class HyperliquidContextRef {
|
|
7
|
-
apiUrl;
|
|
8
|
-
context;
|
|
9
|
-
constructor(apiUrl) {
|
|
10
|
-
this.apiUrl = apiUrl;
|
|
11
|
-
}
|
|
12
|
-
bind(client) {
|
|
13
|
-
this.context = { client, apiUrl: this.apiUrl };
|
|
14
|
-
}
|
|
15
|
-
require() {
|
|
16
|
-
if (this.context === undefined) {
|
|
17
|
-
throw new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.SDKError, 'hyperliquidProvider used before binding. Register it via ' +
|
|
18
|
-
'createPerpsClient({ providers: [hyperliquidProvider()] }).');
|
|
19
|
-
}
|
|
20
|
-
return this.context;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.HyperliquidContextRef = HyperliquidContextRef;
|
|
24
3
|
//# sourceMappingURL=context.js.map
|
package/dist/cjs/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getActivity.d.ts","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"getActivity.d.ts","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAsCvD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAA;CACtB;AA0LD,eAAO,MAAM,WAAW,GACtB,oBAAoB,kBAAkB,EACtC,QAAQ,iBAAiB,EACzB,UAAU,iBAAiB,KAC1B,OAAO,CAAC,kBAAkB,CAoD5B,CAAA"}
|
|
@@ -8,6 +8,7 @@ const index_js_1 = require("../types/index.js");
|
|
|
8
8
|
const index_js_2 = require("../utils/index.js");
|
|
9
9
|
const infoClient_js_1 = require("../utils/infoClient.js");
|
|
10
10
|
const isFillLiquidatingAccount_js_1 = require("../utils/isFillLiquidatingAccount.js");
|
|
11
|
+
const mapActivity_js_1 = require("../utils/mapActivity.js");
|
|
11
12
|
const getAccountExists_js_1 = require("./getAccountExists.js");
|
|
12
13
|
const getLedgerHistory_js_1 = require("./getLedgerHistory.js");
|
|
13
14
|
const historyPagination_js_1 = require("./historyPagination.js");
|
|
@@ -35,7 +36,7 @@ const fetchLiquidationHistory = async (apiUrl, user, startTime, endTime, resolve
|
|
|
35
36
|
retained.set(fill.tid, fill);
|
|
36
37
|
latest = Math.max(latest, fill.time);
|
|
37
38
|
}
|
|
38
|
-
if (fills.length <
|
|
39
|
+
if (fills.length < constants_js_1.FILL_ROWS_CAP || retained.size >= 10000) {
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
42
|
if (latest === startTime) {
|
|
@@ -91,9 +92,12 @@ const fetchActivityData = async (apiUrl, typeFilter, timeParams, assetRegistry,
|
|
|
91
92
|
!typeFilter.includes(perps_types_1.ActivityType.REWARD)) ||
|
|
92
93
|
(!typeFilter.includes(perps_types_1.ActivityType.TRANSFER) &&
|
|
93
94
|
((0, index_js_1.isSpotTransferDelta)(entry.delta) ||
|
|
94
|
-
(0, index_js_1.isSendAssetDelta)(entry.delta) ||
|
|
95
95
|
(0, index_js_1.isCollateralTransferDelta)(entry.delta) ||
|
|
96
96
|
(0, index_js_1.isVaultTransferDelta)(entry.delta))) ||
|
|
97
|
+
((0, index_js_1.isSendAssetDelta)(entry.delta) &&
|
|
98
|
+
!typeFilter.includes((0, mapActivity_js_1.isSameAccountTransfer)(entry.delta, timeParams.user)
|
|
99
|
+
? perps_types_1.ActivityType.INTERNAL_TRANSFER
|
|
100
|
+
: perps_types_1.ActivityType.TRANSFER)) ||
|
|
97
101
|
(!typeFilter.includes(perps_types_1.ActivityType.INTERNAL_TRANSFER) &&
|
|
98
102
|
((0, index_js_1.isCStakingTransferDelta)(entry.delta) ||
|
|
99
103
|
(0, index_js_1.isBorrowLendDelta)(entry.delta) ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getActivity.js","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":";;;AAAA,+CAMwB;AAOxB,mDAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"getActivity.js","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":";;;AAAA,+CAMwB;AAOxB,mDAAgE;AAEhE,kDAA6D;AAG7D,gDAc0B;AAC1B,gDAI0B;AAC1B,0DAI+B;AAC/B,sFAA+E;AAC/E,4DAA+D;AAC/D,+DAA4D;AAC5D,+DAAyE;AACzE,iEAAqE;AAqBrE,MAAM,oBAAoB,GAA8B,IAAI,GAAG,CAA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
1
|
-
import { type StorageAdapter } from '@lifi/perps-sdk';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
address: Address;
|
|
5
|
-
privateKey: Hex;
|
|
6
|
-
}
|
|
7
|
-
export declare class HyperliquidAgentStore {
|
|
8
|
-
private storage;
|
|
9
|
-
private cache;
|
|
1
|
+
import { AgentKeyStore, type StorageAdapter } from '@lifi/perps-sdk';
|
|
2
|
+
export type { AgentKey as HyperliquidAgent } from '@lifi/perps-sdk';
|
|
3
|
+
export declare class HyperliquidAgentStore extends AgentKeyStore {
|
|
10
4
|
constructor(storage?: StorageAdapter);
|
|
11
|
-
private storageKey;
|
|
12
|
-
get(address: Address): Promise<HyperliquidAgent>;
|
|
13
|
-
getOrCreate(address: Address): Promise<HyperliquidAgent>;
|
|
14
|
-
has(address: Address): Promise<boolean>;
|
|
15
|
-
remove(address: Address): Promise<void>;
|
|
16
|
-
import(address: Address, privateKey: Hex): Promise<HyperliquidAgent>;
|
|
17
|
-
clearCache(): void;
|
|
18
5
|
}
|
|
19
6
|
//# sourceMappingURL=HyperliquidAgentStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperliquidAgentStore.d.ts","sourceRoot":"","sources":["../../../src/signers/HyperliquidAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HyperliquidAgentStore.d.ts","sourceRoot":"","sources":["../../../src/signers/HyperliquidAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAOpE,YAAY,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAMnE,qBAAa,qBAAsB,SAAQ,aAAa;gBAC1C,OAAO,CAAC,EAAE,cAAc;CAUrC"}
|