@lifi/perps-sdk-provider-hyperliquid 0.0.0-preview-02f114ef → 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 +34 -3
- 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/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/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/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/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/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/mapPosition.d.ts +0 -4
- package/dist/types/utils/mapPosition.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/HyperliquidProvider.ts +16 -59
- package/src/accountConfig.ts +3 -7
- package/src/context.ts +3 -40
- package/src/signers/HyperliquidAgentStore.ts +12 -171
- package/src/signers/signActions.ts +9 -43
- package/src/utils/infoClient.ts +2 -18
- package/src/utils/mapPosition.ts +2 -36
- package/src/websocket/HyperliquidWsProvider.ts +13 -13
package/README.md
CHANGED
|
@@ -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`,
|
|
@@ -231,6 +247,9 @@ the original upper time bound, preventing subsequent pages from regrouping an
|
|
|
231
247
|
order using newly arriving fills. Funding/ledger-only activity and ordinary fill
|
|
232
248
|
pages use bounded newest-first windows instead of repeatedly downloading full history.
|
|
233
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
|
+
|
|
234
253
|
### TWAP slice fills
|
|
235
254
|
|
|
236
255
|
Hyperliquid reports the executions of a TWAP on separate feeds. The regular
|
|
@@ -292,8 +311,7 @@ venue status code. An unknown status that ends with `Canceled` gives
|
|
|
292
311
|
`Rejected by the venue.`. All other unknown status strings throw `PerpsError`.
|
|
293
312
|
|
|
294
313
|
```ts
|
|
295
|
-
import { getOrders } from '@lifi/perps-sdk'
|
|
296
|
-
import { OrderStatus } from '@lifi/perps-types'
|
|
314
|
+
import { getOrders, OrderStatus } from '@lifi/perps-sdk'
|
|
297
315
|
|
|
298
316
|
const { orders } = await getOrders(client, {
|
|
299
317
|
provider: 'hyperliquid',
|
|
@@ -302,6 +320,11 @@ const { orders } = await getOrders(client, {
|
|
|
302
320
|
})
|
|
303
321
|
```
|
|
304
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
|
+
|
|
305
328
|
The default filter is `ACTIVE_ORDER_STATUSES`: PENDING, OPEN,
|
|
306
329
|
PARTIALLY_FILLED, and TRIGGERED. Active filters read `frontendOpenOrders`.
|
|
307
330
|
Terminal filters read `historicalOrders`. Mixed filters read both.
|
|
@@ -356,6 +379,14 @@ with a backstop takeover.
|
|
|
356
379
|
- A fill of the liquidated account has no `type`. A backstop takeover fills
|
|
357
380
|
that account as the maker, but no resting limit order exists.
|
|
358
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
|
+
|
|
359
390
|
## Documentation
|
|
360
391
|
|
|
361
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,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EAAE,CACtE,IAAA,mCAAc,EACZ,KAAK,EACL,MAAM,CAAC,UAAU,EACjB,IAAA,0BAAc,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CACvD;QAEH,aAAa,EAAE,CAAC,MAAc,EAAE,IAAmB,EAAiB,EAAE,CACpE,IAAA,kCAAa,EAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC;QAExC,YAAY,EAAE,gCAAoB;QAElC,cAAc,EAAE,6BAAiB;QAEjC,eAAe,EAAE,oCAAwB;QAEzC,aAAa,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE;QAE5C,wBAAwB,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,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,wBAAU,CAAC,aAAa,CAAC;QAC9B,KAAK,wBAAU,CAAC,YAAY,CAAC;QAC7B,KAAK,wBAAU,CAAC,mBAAmB,CAAC;QACpC,KAAK,wBAAU,CAAC,YAAY;YAC1B,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;QAE9C,KAAK,wBAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAA;YACnC,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1D,IAAA,4BAAgB,EAAC,MAAM,EAAE,wBAAU,CAAC,YAAY,CAAC;gBAC/C,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACtB,CAAC,CAAC,EAAE,CACP,CAAA;YAGD,MAAM,OAAO,GACX,IAAI,KAAK,IAAI,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;gBAC/C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,C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AAiB,CAAC;QAClC,KAAK,wBAAU,CAAC,YAAY,CAAC;QAC7B,KAAK,wBAAU,CAAC,yBAAyB,CAAC;QAC1C,KAAK,wBAAU,CAAC,oBAAoB,CAAC;QACrC,KAAK,wBAAU,CAAC,cAAc,CAAC;QAC/B,KAAK,wBAAU,CAAC,cAAc,CAAC;QAC/B,KAAK,wBAAU,CAAC,kBAAkB,CAAC;QACnC,KAAK,wBAAU,CAAC,oBAAoB,CAAC;QACrC,KAAK,wBAAU,CAAC,iBAAiB;YAC/B,MAAM,IAAI,sBAAU,CAClB,4BAAc,CAAC,QAAQ,EACvB,0DAA0D;gBACxD,oBAAoB,UAAU,CAAC,IAAI,6BAA6B;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,19 +1,6 @@
|
|
|
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"}
|
|
@@ -2,108 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HyperliquidAgentStore = void 0;
|
|
4
4
|
const perps_sdk_1 = require("@lifi/perps-sdk");
|
|
5
|
-
const perps_types_1 = require("@lifi/perps-types");
|
|
6
|
-
const viem_1 = require("viem");
|
|
7
|
-
const accounts_1 = require("viem/accounts");
|
|
8
5
|
const constants_js_1 = require("../constants.js");
|
|
9
|
-
|
|
10
|
-
const isParsablePrivateKey = (value) => {
|
|
11
|
-
if (!(0, viem_1.isHex)(value)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
(0, accounts_1.privateKeyToAccount)(value);
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const isHyperliquidAgent = (value) => {
|
|
23
|
-
if (typeof value !== 'object' || value === null) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
const { address, privateKey } = value;
|
|
27
|
-
return (typeof address === 'string' &&
|
|
28
|
-
(0, viem_1.isAddress)(address) &&
|
|
29
|
-
isParsablePrivateKey(privateKey));
|
|
30
|
-
};
|
|
31
|
-
class HyperliquidAgentStore {
|
|
32
|
-
storage;
|
|
33
|
-
cache = new Map();
|
|
6
|
+
class HyperliquidAgentStore extends perps_sdk_1.AgentKeyStore {
|
|
34
7
|
constructor(storage) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
async get(address) {
|
|
41
|
-
const key = this.storageKey(address);
|
|
42
|
-
const cached = this.cache.get(key);
|
|
43
|
-
if (cached) {
|
|
44
|
-
return cached;
|
|
45
|
-
}
|
|
46
|
-
const stored = await this.storage.get(key);
|
|
47
|
-
const agent = (0, perps_sdk_1.parseStoredRecord)(stored, isHyperliquidAgent);
|
|
48
|
-
if (agent) {
|
|
49
|
-
this.cache.set(key, agent);
|
|
50
|
-
return agent;
|
|
51
|
-
}
|
|
52
|
-
const corrupt = stored !== null;
|
|
53
|
-
const error = new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.SDKError, corrupt
|
|
54
|
-
? perps_sdk_1.PerpsErrorMessage.AgentStorageCorrupt
|
|
55
|
-
: perps_sdk_1.PerpsErrorMessage.AgentNotFound);
|
|
56
|
-
error.tool = '@lifi/perps-sdk-provider-hyperliquid';
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
async getOrCreate(address) {
|
|
60
|
-
try {
|
|
61
|
-
return await this.get(address);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
if (!(error instanceof perps_sdk_1.PerpsError) ||
|
|
65
|
-
error.message !== perps_sdk_1.PerpsErrorMessage.AgentNotFound) {
|
|
66
|
-
throw error;
|
|
67
|
-
}
|
|
68
|
-
const privateKey = (0, accounts_1.generatePrivateKey)();
|
|
69
|
-
const account = (0, accounts_1.privateKeyToAccount)(privateKey);
|
|
70
|
-
const agent = {
|
|
71
|
-
address: account.address,
|
|
72
|
-
privateKey,
|
|
73
|
-
};
|
|
74
|
-
const key = this.storageKey(address);
|
|
75
|
-
await this.storage.set(key, JSON.stringify(agent));
|
|
76
|
-
this.cache.set(key, agent);
|
|
77
|
-
return agent;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async has(address) {
|
|
81
|
-
try {
|
|
82
|
-
await this.get(address);
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async remove(address) {
|
|
90
|
-
const key = this.storageKey(address);
|
|
91
|
-
this.cache.delete(key);
|
|
92
|
-
await this.storage.remove(key);
|
|
93
|
-
}
|
|
94
|
-
async import(address, privateKey) {
|
|
95
|
-
const account = (0, accounts_1.privateKeyToAccount)(privateKey);
|
|
96
|
-
const agent = {
|
|
97
|
-
address: account.address,
|
|
98
|
-
privateKey,
|
|
99
|
-
};
|
|
100
|
-
const key = this.storageKey(address);
|
|
101
|
-
await this.storage.set(key, JSON.stringify(agent));
|
|
102
|
-
this.cache.set(key, agent);
|
|
103
|
-
return agent;
|
|
104
|
-
}
|
|
105
|
-
clearCache() {
|
|
106
|
-
this.cache.clear();
|
|
8
|
+
super({
|
|
9
|
+
prefix: 'lifi-perps-agent',
|
|
10
|
+
providerKey: constants_js_1.PROVIDER_KEY,
|
|
11
|
+
tool: '@lifi/perps-sdk-provider-hyperliquid',
|
|
12
|
+
}, storage);
|
|
107
13
|
}
|
|
108
14
|
}
|
|
109
15
|
exports.HyperliquidAgentStore = HyperliquidAgentStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperliquidAgentStore.js","sourceRoot":"","sources":["../../../src/signers/HyperliquidAgentStore.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"HyperliquidAgentStore.js","sourceRoot":"","sources":["../../../src/signers/HyperliquidAgentStore.ts"],"names":[],"mappings":";;;AAAA,+CAAoE;AACpE,kDAA8C;AAY9C,MAAa,qBAAsB,SAAQ,yBAAa;IACtD,YAAY,OAAwB;QAClC,KAAK,CACH;YACE,MAAM,EAAE,kBAAkB;YAC1B,WAAW,EAAE,2BAAY;YACzB,IAAI,EAAE,sCAAsC;SAC7C,EACD,OAAO,CACR,CAAA;IACH,CAAC;CACF;AAXD,sDAWC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signActions.d.ts","sourceRoot":"","sources":["../../../src/signers/signActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"signActions.d.ts","sourceRoot":"","sources":["../../../src/signers/signActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,UAAU,EAEV,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAkB,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAYvE,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,kBAAkB,GAAG,SAAS,GAClC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAgB7B"}
|
|
@@ -8,26 +8,6 @@ async function hyperliquidSignActions(agentStore, method, steps, address, ctx) {
|
|
|
8
8
|
throw new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.SDKError, `hyperliquidProvider.signActions: unsupported SigningMethod '${method}'. ` +
|
|
9
9
|
'Hyperliquid only signs EIP712 actions.');
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
? await userWalletSigner(ctx)
|
|
13
|
-
: await agentSigner(agentStore, address);
|
|
14
|
-
return Promise.all(steps.map(async (step) => ({
|
|
15
|
-
action: step.action,
|
|
16
|
-
typedData: step.typedData,
|
|
17
|
-
signature: await sign(step),
|
|
18
|
-
})));
|
|
19
|
-
}
|
|
20
|
-
async function agentSigner(agentStore, address) {
|
|
21
|
-
const agent = await agentStore.get(address);
|
|
22
|
-
return (step) => (0, perps_sdk_1.signTypedData)(agent.privateKey, step.typedData);
|
|
23
|
-
}
|
|
24
|
-
function userWalletSigner(ctx) {
|
|
25
|
-
const wallet = ctx.userWallet;
|
|
26
|
-
if (!wallet) {
|
|
27
|
-
throw new perps_sdk_1.PerpsError(perps_types_1.PerpsErrorCode.SDKError, 'hyperliquidProvider.signActions: a USER-signed action requires the ' +
|
|
28
|
-
'end-user wallet. Pass `userWallet` to createPerpsClient or call ' +
|
|
29
|
-
'setUserWallet(walletClient).');
|
|
30
|
-
}
|
|
31
|
-
return Promise.resolve((step) => (0, perps_sdk_1.signTypedDataWithSigner)(wallet, step.typedData));
|
|
11
|
+
return (0, perps_sdk_1.signEip712ActionSteps)('hyperliquidProvider.signActions', agentStore, steps, address, ctx);
|
|
32
12
|
}
|
|
33
13
|
//# sourceMappingURL=signActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signActions.js","sourceRoot":"","sources":["../../../src/signers/signActions.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"signActions.js","sourceRoot":"","sources":["../../../src/signers/signActions.ts"],"names":[],"mappings":";;AAwBA,wDAsBC;AA9CD,+CAIwB;AAMxB,mDAAiE;AAc1D,KAAK,UAAU,sBAAsB,CAC1C,UAAiC,EACjC,MAAqB,EACrB,KAAmB,EACnB,OAAgB,EAChB,GAAmC;IAEnC,IAAI,MAAM,KAAK,2BAAa,CAAC,MAAM,EAAE,CAAC;QACpC,MAAM,IAAI,sBAAU,CAClB,4BAAc,CAAC,QAAQ,EACvB,+DAA+D,MAAM,KAAK;YACxE,wCAAwC,CAC3C,CAAA;IACH,CAAC;IAED,OAAO,IAAA,iCAAqB,EAC1B,iCAAiC,EACjC,UAAU,EACV,KAA2B,EAC3B,OAAO,EACP,GAAG,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infoClient.d.ts","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"infoClient.d.ts","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAA;AA6BxB,eAAO,MAAM,0BAA0B,EAAE,mBAExC,CAAA;AAQD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAOD,eAAO,MAAM,aAAa,GACxB,QAAQ,cAAc,EACtB,UAAU,iBAAiB,KAC1B,kBAQD,CAAA;AAoBF,wBAAsB,UAAU,CAAC,CAAC,EAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,CAAC,CA8CZ;AAQD,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAEZ"}
|
|
@@ -27,22 +27,7 @@ const HYPERLIQUID_STATUS_ERROR_CODES = {
|
|
|
27
27
|
403: perps_types_1.PerpsErrorCode.AgentUnauthorized,
|
|
28
28
|
};
|
|
29
29
|
exports.HYPERLIQUID_RETRY_DEFAULTS = {
|
|
30
|
-
|
|
31
|
-
maxAttempts: 3,
|
|
32
|
-
baseDelayMs: 2_000,
|
|
33
|
-
maxDelayMs: 15_000,
|
|
34
|
-
respectRetryAfter: true,
|
|
35
|
-
classify: ({ response }) => {
|
|
36
|
-
if (response.status === 429) {
|
|
37
|
-
return 'retry-rate-limit';
|
|
38
|
-
}
|
|
39
|
-
if (response.status === 502 ||
|
|
40
|
-
response.status === 503 ||
|
|
41
|
-
response.status === 504) {
|
|
42
|
-
return 'retry-server';
|
|
43
|
-
}
|
|
44
|
-
return 'fail';
|
|
45
|
-
},
|
|
30
|
+
...perps_sdk_1.VENUE_RETRY_DEFAULTS,
|
|
46
31
|
};
|
|
47
32
|
const hlInfoOptions = (client, options) => ({
|
|
48
33
|
signal: options?.signal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infoClient.js","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"infoClient.js","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":";;;AA2FA,gCAmDC;AAQD,kCAMC;AA5JD,+CAUwB;AACxB,mDAAkD;AAClD,+BAAgC;AAChC,kDAA8C;AAE9C,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAW,EAAE;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAA,gBAAS,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IAC1E,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IACtC,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC;YAChD,GAAG;YACH,kBAAkB,CAAC,WAAW,CAAC;SAChC,CAAC,CACH,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,8BAA8B,GAAG;IACrC,GAAG,EAAE,4BAAc,CAAC,YAAY;IAChC,GAAG,EAAE,4BAAc,CAAC,iBAAiB;CAC7B,CAAA;AAGG,QAAA,0BAA0B,GAAwB;IAC7D,GAAG,gCAAoB;CACxB,CAAA;AAmBM,MAAM,aAAa,GAAG,CAC3B,MAAsB,EACtB,OAA2B,EACP,EAAE,CAAC,CAAC;IACxB,MAAM,EAAE,OAAO,EAAE,MAAM;IACvB,MAAM,EAAE,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G,IAAI,sBAAU,CACxB,4BAAc,CAAC,WAAW,EAC1B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,KAAK,SAAS,CACvE,CAAA;QACD,GAAG,CAAC,IAAI,GAAG,2BAAY,CAAA;QACvB,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAQD,SAAgB,WAAW,CACzB,MAAc,EACd,IAA6B,EAC7B,OAA4B;IAE5B,OAAO,UAAU,CAAI,GAAG,MAAM,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AACvE,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { PerpsMarketDisplay, Position } from '@lifi/perps-types';
|
|
2
2
|
import type { HlAssetPosition } from '../types/index.js';
|
|
3
|
-
export declare const calculateRoe: (position: Position) => string | undefined;
|
|
4
|
-
export declare const remarkPosition: (position: Position, markPrice: string) => Position;
|
|
5
3
|
export declare const isOpenAssetPosition: (ap: HlAssetPosition) => boolean;
|
|
6
4
|
export declare const mapPosition: (ap: HlAssetPosition, market: PerpsMarketDisplay) => Position | undefined;
|
|
7
5
|
//# sourceMappingURL=mapPosition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAoBxD,eAAO,MAAM,mBAAmB,GAAI,IAAI,eAAe,KAAG,OACP,CAAA;AAOnD,eAAO,MAAM,WAAW,GACtB,IAAI,eAAe,EACnB,QAAQ,kBAAkB,KACzB,QAAQ,GAAG,SA0Eb,CAAA"}
|