@nktkas/hyperliquid 0.30.2 → 0.30.3
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 +83 -19
- package/esm/bin/cli.js +10 -0
- package/esm/bin/cli.js.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.16 → 1.1.0}/unstable_semaphore.d.ts +1 -0
- package/esm/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/async/{1.0.16 → 1.1.0}/unstable_semaphore.js +4 -3
- package/esm/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.js.map +1 -0
- package/esm/src/api/exchange/_methods/_base/_semaphore.js +1 -1
- package/esm/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
- package/esm/src/api/exchange/_methods/approveAgent.d.ts +20 -9
- package/esm/src/api/exchange/_methods/approveAgent.d.ts.map +1 -1
- package/esm/src/api/exchange/_methods/approveAgent.js +21 -3
- package/esm/src/api/exchange/_methods/approveAgent.js.map +1 -1
- package/esm/src/api/exchange/_methods/batchModify.d.ts +2 -2
- package/esm/src/api/exchange/_methods/borrowLend.d.ts +173 -0
- package/esm/src/api/exchange/_methods/borrowLend.d.ts.map +1 -0
- package/esm/src/api/exchange/_methods/borrowLend.js +75 -0
- package/esm/src/api/exchange/_methods/borrowLend.js.map +1 -0
- package/esm/src/api/exchange/_methods/modify.d.ts +2 -2
- package/esm/src/api/exchange/_methods/order.d.ts +2 -2
- package/esm/src/api/exchange/_methods/sendAsset.d.ts +10 -10
- package/esm/src/api/exchange/_methods/spotSend.d.ts +5 -5
- package/esm/src/api/exchange/_methods/usdSend.d.ts +5 -5
- package/esm/src/api/exchange/_methods/userPortfolioMargin.d.ts +193 -0
- package/esm/src/api/exchange/_methods/userPortfolioMargin.d.ts.map +1 -0
- package/esm/src/api/exchange/_methods/userPortfolioMargin.js +92 -0
- package/esm/src/api/exchange/_methods/userPortfolioMargin.js.map +1 -0
- package/esm/src/api/exchange/_methods/withdraw3.d.ts +5 -5
- package/esm/src/api/exchange/client.d.ts +8 -0
- package/esm/src/api/exchange/client.d.ts.map +1 -1
- package/esm/src/api/exchange/client.js +10 -0
- package/esm/src/api/exchange/client.js.map +1 -1
- package/esm/src/api/exchange/mod.d.ts +2 -0
- package/esm/src/api/exchange/mod.d.ts.map +1 -1
- package/esm/src/api/exchange/mod.js +2 -0
- package/esm/src/api/exchange/mod.js.map +1 -1
- package/esm/src/api/info/_methods/activeAssetData.js +2 -2
- package/esm/src/api/info/_methods/activeAssetData.js.map +1 -1
- package/esm/src/api/info/_methods/allBorrowLendReserveStates.d.ts +71 -0
- package/esm/src/api/info/_methods/allBorrowLendReserveStates.d.ts.map +1 -0
- package/esm/src/api/info/_methods/allBorrowLendReserveStates.js +56 -0
- package/esm/src/api/info/_methods/allBorrowLendReserveStates.js.map +1 -0
- package/esm/src/api/info/_methods/borrowLendReserveState.d.ts +79 -0
- package/esm/src/api/info/_methods/borrowLendReserveState.d.ts.map +1 -0
- package/esm/src/api/info/_methods/borrowLendReserveState.js +76 -0
- package/esm/src/api/info/_methods/borrowLendReserveState.js.map +1 -0
- package/esm/src/api/info/_methods/borrowLendUserState.d.ts +103 -0
- package/esm/src/api/info/_methods/borrowLendUserState.d.ts.map +1 -0
- package/esm/src/api/info/_methods/borrowLendUserState.js +85 -0
- package/esm/src/api/info/_methods/borrowLendUserState.js.map +1 -0
- package/esm/src/api/info/_methods/clearinghouseState.js +3 -3
- package/esm/src/api/info/_methods/clearinghouseState.js.map +1 -1
- package/esm/src/api/info/_methods/perpDexs.d.ts +5 -1
- package/esm/src/api/info/_methods/perpDexs.d.ts.map +1 -1
- package/esm/src/api/info/_methods/perpDexs.js +3 -1
- package/esm/src/api/info/_methods/perpDexs.js.map +1 -1
- package/esm/src/api/info/_methods/spotMeta.d.ts +36 -0
- package/esm/src/api/info/_methods/spotMeta.d.ts.map +1 -1
- package/esm/src/api/info/_methods/spotMeta.js +16 -0
- package/esm/src/api/info/_methods/spotMeta.js.map +1 -1
- package/esm/src/api/info/_methods/spotMetaAndAssetCtxs.d.ts +38 -0
- package/esm/src/api/info/_methods/spotMetaAndAssetCtxs.d.ts.map +1 -1
- package/esm/src/api/info/_methods/userBorrowLendInterest.d.ts +73 -0
- package/esm/src/api/info/_methods/userBorrowLendInterest.d.ts.map +1 -0
- package/esm/src/api/info/_methods/userBorrowLendInterest.js +72 -0
- package/esm/src/api/info/_methods/userBorrowLendInterest.js.map +1 -0
- package/esm/src/api/info/_methods/userNonFundingLedgerUpdates.d.ts +57 -0
- package/esm/src/api/info/_methods/userNonFundingLedgerUpdates.d.ts.map +1 -1
- package/esm/src/api/info/_methods/userNonFundingLedgerUpdates.js +33 -0
- package/esm/src/api/info/_methods/userNonFundingLedgerUpdates.js.map +1 -1
- package/esm/src/api/info/client.d.ts +16 -0
- package/esm/src/api/info/client.d.ts.map +1 -1
- package/esm/src/api/info/client.js +20 -0
- package/esm/src/api/info/client.js.map +1 -1
- package/esm/src/api/info/mod.d.ts +4 -0
- package/esm/src/api/info/mod.d.ts.map +1 -1
- package/esm/src/api/info/mod.js +4 -0
- package/esm/src/api/info/mod.js.map +1 -1
- package/esm/src/api/subscription/_methods/userNonFundingLedgerUpdates.d.ts +75 -0
- package/esm/src/api/subscription/_methods/userNonFundingLedgerUpdates.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/bin/cli.js +10 -0
- package/script/bin/cli.js.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.16 → 1.1.0}/unstable_semaphore.d.ts +1 -0
- package/script/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/async/{1.0.16 → 1.1.0}/unstable_semaphore.js +4 -3
- package/script/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.js.map +1 -0
- package/script/src/api/exchange/_methods/_base/_semaphore.js +1 -1
- package/script/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
- package/script/src/api/exchange/_methods/approveAgent.d.ts +20 -9
- package/script/src/api/exchange/_methods/approveAgent.d.ts.map +1 -1
- package/script/src/api/exchange/_methods/approveAgent.js +21 -3
- package/script/src/api/exchange/_methods/approveAgent.js.map +1 -1
- package/script/src/api/exchange/_methods/batchModify.d.ts +2 -2
- package/script/src/api/exchange/_methods/borrowLend.d.ts +173 -0
- package/script/src/api/exchange/_methods/borrowLend.d.ts.map +1 -0
- package/script/src/api/exchange/_methods/borrowLend.js +112 -0
- package/script/src/api/exchange/_methods/borrowLend.js.map +1 -0
- package/script/src/api/exchange/_methods/modify.d.ts +2 -2
- package/script/src/api/exchange/_methods/order.d.ts +2 -2
- package/script/src/api/exchange/_methods/sendAsset.d.ts +10 -10
- package/script/src/api/exchange/_methods/spotSend.d.ts +5 -5
- package/script/src/api/exchange/_methods/usdSend.d.ts +5 -5
- package/script/src/api/exchange/_methods/userPortfolioMargin.d.ts +193 -0
- package/script/src/api/exchange/_methods/userPortfolioMargin.d.ts.map +1 -0
- package/script/src/api/exchange/_methods/userPortfolioMargin.js +129 -0
- package/script/src/api/exchange/_methods/userPortfolioMargin.js.map +1 -0
- package/script/src/api/exchange/_methods/withdraw3.d.ts +5 -5
- package/script/src/api/exchange/client.d.ts +8 -0
- package/script/src/api/exchange/client.d.ts.map +1 -1
- package/script/src/api/exchange/client.js +10 -0
- package/script/src/api/exchange/client.js.map +1 -1
- package/script/src/api/exchange/mod.d.ts +2 -0
- package/script/src/api/exchange/mod.d.ts.map +1 -1
- package/script/src/api/exchange/mod.js +2 -0
- package/script/src/api/exchange/mod.js.map +1 -1
- package/script/src/api/info/_methods/activeAssetData.js +1 -1
- package/script/src/api/info/_methods/activeAssetData.js.map +1 -1
- package/script/src/api/info/_methods/allBorrowLendReserveStates.d.ts +71 -0
- package/script/src/api/info/_methods/allBorrowLendReserveStates.d.ts.map +1 -0
- package/script/src/api/info/_methods/allBorrowLendReserveStates.js +93 -0
- package/script/src/api/info/_methods/allBorrowLendReserveStates.js.map +1 -0
- package/script/src/api/info/_methods/borrowLendReserveState.d.ts +79 -0
- package/script/src/api/info/_methods/borrowLendReserveState.d.ts.map +1 -0
- package/script/src/api/info/_methods/borrowLendReserveState.js +113 -0
- package/script/src/api/info/_methods/borrowLendReserveState.js.map +1 -0
- package/script/src/api/info/_methods/borrowLendUserState.d.ts +103 -0
- package/script/src/api/info/_methods/borrowLendUserState.d.ts.map +1 -0
- package/script/src/api/info/_methods/borrowLendUserState.js +122 -0
- package/script/src/api/info/_methods/borrowLendUserState.js.map +1 -0
- package/script/src/api/info/_methods/clearinghouseState.js +3 -3
- package/script/src/api/info/_methods/clearinghouseState.js.map +1 -1
- package/script/src/api/info/_methods/perpDexs.d.ts +5 -1
- package/script/src/api/info/_methods/perpDexs.d.ts.map +1 -1
- package/script/src/api/info/_methods/perpDexs.js +3 -1
- package/script/src/api/info/_methods/perpDexs.js.map +1 -1
- package/script/src/api/info/_methods/spotMeta.d.ts +36 -0
- package/script/src/api/info/_methods/spotMeta.d.ts.map +1 -1
- package/script/src/api/info/_methods/spotMeta.js +16 -0
- package/script/src/api/info/_methods/spotMeta.js.map +1 -1
- package/script/src/api/info/_methods/spotMetaAndAssetCtxs.d.ts +38 -0
- package/script/src/api/info/_methods/spotMetaAndAssetCtxs.d.ts.map +1 -1
- package/script/src/api/info/_methods/userBorrowLendInterest.d.ts +73 -0
- package/script/src/api/info/_methods/userBorrowLendInterest.d.ts.map +1 -0
- package/script/src/api/info/_methods/userBorrowLendInterest.js +109 -0
- package/script/src/api/info/_methods/userBorrowLendInterest.js.map +1 -0
- package/script/src/api/info/_methods/userNonFundingLedgerUpdates.d.ts +57 -0
- package/script/src/api/info/_methods/userNonFundingLedgerUpdates.d.ts.map +1 -1
- package/script/src/api/info/_methods/userNonFundingLedgerUpdates.js +33 -0
- package/script/src/api/info/_methods/userNonFundingLedgerUpdates.js.map +1 -1
- package/script/src/api/info/client.d.ts +16 -0
- package/script/src/api/info/client.d.ts.map +1 -1
- package/script/src/api/info/client.js +20 -0
- package/script/src/api/info/client.js.map +1 -1
- package/script/src/api/info/mod.d.ts +4 -0
- package/script/src/api/info/mod.d.ts.map +1 -1
- package/script/src/api/info/mod.js +4 -0
- package/script/src/api/info/mod.js.map +1 -1
- package/script/src/api/subscription/_methods/userNonFundingLedgerUpdates.d.ts +75 -0
- package/script/src/api/subscription/_methods/userNonFundingLedgerUpdates.d.ts.map +1 -1
- package/src/bin/cli.ts +10 -0
- package/src/deps/jsr.io/@std/async/{1.0.16 → 1.1.0}/unstable_semaphore.ts +4 -3
- package/src/src/api/exchange/_methods/_base/_semaphore.ts +1 -1
- package/src/src/api/exchange/_methods/approveAgent.ts +25 -5
- package/src/src/api/exchange/_methods/borrowLend.ts +133 -0
- package/src/src/api/exchange/_methods/userPortfolioMargin.ts +156 -0
- package/src/src/api/exchange/client.ts +34 -0
- package/src/src/api/exchange/mod.ts +2 -0
- package/src/src/api/info/_methods/activeAssetData.ts +2 -2
- package/src/src/api/info/_methods/allBorrowLendReserveStates.ts +82 -0
- package/src/src/api/info/_methods/borrowLendReserveState.ts +131 -0
- package/src/src/api/info/_methods/borrowLendUserState.ts +144 -0
- package/src/src/api/info/_methods/clearinghouseState.ts +3 -3
- package/src/src/api/info/_methods/perpDexs.ts +6 -1
- package/src/src/api/info/_methods/spotMeta.ts +41 -0
- package/src/src/api/info/_methods/userBorrowLendInterest.ts +122 -0
- package/src/src/api/info/_methods/userNonFundingLedgerUpdates.ts +69 -0
- package/src/src/api/info/client.ts +60 -0
- package/src/src/api/info/mod.ts +4 -0
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +0 -1
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
[](https://coveralls.io/github/nktkas/hyperliquid)
|
|
7
7
|
[](https://bundlephobia.com/package/@nktkas/hyperliquid)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
A community-supported [Hyperliquid API](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) SDK for all
|
|
10
|
+
major JS runtimes, written in TypeScript.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -18,45 +18,109 @@
|
|
|
18
18
|
- 🔧 **Integratable**: Easy to use with wallet providers ([viem](https://github.com/wevm/viem) or
|
|
19
19
|
[ethers](https://github.com/ethers-io/ethers.js)).
|
|
20
20
|
|
|
21
|
-
## Installation
|
|
21
|
+
## Installation (choose your package manager)
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
npm i @nktkas/hyperliquid
|
|
25
|
+
|
|
26
|
+
pnpm add @nktkas/hyperliquid
|
|
27
|
+
|
|
28
|
+
yarn add @nktkas/hyperliquid
|
|
29
|
+
|
|
30
|
+
deno add jsr:@nktkas/hyperliquid
|
|
25
31
|
```
|
|
26
32
|
|
|
27
33
|
## Quick Example
|
|
28
34
|
|
|
35
|
+
### Info endpoint
|
|
36
|
+
|
|
29
37
|
```ts
|
|
30
|
-
|
|
31
|
-
import {
|
|
38
|
+
// 1. Import module
|
|
39
|
+
import { HttpTransport, InfoClient } from "@nktkas/hyperliquid";
|
|
40
|
+
|
|
41
|
+
// 2. Set up client with transport
|
|
42
|
+
const transport = new HttpTransport();
|
|
43
|
+
const info = new InfoClient({ transport });
|
|
32
44
|
|
|
33
|
-
//
|
|
34
|
-
|
|
45
|
+
// 3. Query data
|
|
46
|
+
|
|
47
|
+
// Retrieve mids for all coins
|
|
35
48
|
const mids = await info.allMids();
|
|
36
|
-
console.log(mids); // { "BTC": "97000.5", "ETH": "3500.25", ... }
|
|
37
49
|
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
50
|
+
// Retrieve a user's open orders
|
|
51
|
+
const openOrders = await info.openOrders({ user: "0x..." });
|
|
52
|
+
|
|
53
|
+
// L2 book snapshot
|
|
54
|
+
const book = await info.l2Book({ coin: "BTC" });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Exchange endpoint
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// 1. Import modules
|
|
61
|
+
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
|
|
62
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
63
|
+
|
|
64
|
+
// 2. Set up client with wallet and transport
|
|
65
|
+
const wallet = privateKeyToAccount("0x...");
|
|
66
|
+
|
|
67
|
+
const transport = new HttpTransport();
|
|
68
|
+
const exchange = new ExchangeClient({ transport, wallet });
|
|
43
69
|
|
|
70
|
+
// 3. Execute an action
|
|
71
|
+
|
|
72
|
+
// Place an order
|
|
44
73
|
const result = await exchange.order({
|
|
45
74
|
orders: [{
|
|
46
|
-
a: 0,
|
|
47
|
-
b: true,
|
|
48
|
-
p: "95000",
|
|
49
|
-
s: "0.01",
|
|
50
|
-
r: false,
|
|
75
|
+
a: 0,
|
|
76
|
+
b: true,
|
|
77
|
+
p: "95000",
|
|
78
|
+
s: "0.01",
|
|
79
|
+
r: false,
|
|
51
80
|
t: { limit: { tif: "Gtc" } },
|
|
52
81
|
}],
|
|
53
82
|
grouping: "na",
|
|
54
83
|
});
|
|
84
|
+
|
|
85
|
+
// Update leverage
|
|
86
|
+
await exchange.updateLeverage({ asset: 0, isCross: true, leverage: 5 });
|
|
87
|
+
|
|
88
|
+
// Initiate a withdrawal request
|
|
89
|
+
await exchange.withdraw3({ destination: "0x...", amount: "1" });
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Subscription
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// 1. Import module
|
|
96
|
+
import { SubscriptionClient, WebSocketTransport } from "@nktkas/hyperliquid";
|
|
97
|
+
|
|
98
|
+
// 2. Set up client with transport
|
|
99
|
+
const transport = new WebSocketTransport();
|
|
100
|
+
const subs = new SubscriptionClient({ transport });
|
|
101
|
+
|
|
102
|
+
// 3. Subscribe to events
|
|
103
|
+
|
|
104
|
+
// Subscribe to mids for all coins
|
|
105
|
+
await subs.allMids((data) => {
|
|
106
|
+
console.log(data);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Subscribe to user's open orders
|
|
110
|
+
await subs.openOrders({ user: "0x..." }, (data) => {
|
|
111
|
+
console.log(data);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Subscribe to L2 book snapshot
|
|
115
|
+
await subs.l2Book({ coin: "ETH" }, (data) => {
|
|
116
|
+
console.log(data);
|
|
117
|
+
});
|
|
55
118
|
```
|
|
56
119
|
|
|
57
120
|
## Documentation
|
|
58
121
|
|
|
59
|
-
|
|
122
|
+
- [SDK documentation](https://nktkas.gitbook.io/hyperliquid)
|
|
123
|
+
- [Hyperliquid Documentation](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api)
|
|
60
124
|
|
|
61
125
|
## Star History
|
|
62
126
|
|
package/esm/bin/cli.js
CHANGED
|
@@ -186,6 +186,12 @@ Deploy Market:
|
|
|
186
186
|
spotDeployState --user <address>
|
|
187
187
|
spotPairDeployAuctionStatus (no params)
|
|
188
188
|
|
|
189
|
+
Earn:
|
|
190
|
+
allBorrowLendReserveStates (no params)
|
|
191
|
+
borrowLendReserveState --token <number>
|
|
192
|
+
borrowLendUserState --user <address>
|
|
193
|
+
userBorrowLendInterest --user <address> --startTime <number> [--endTime <number>]
|
|
194
|
+
|
|
189
195
|
Other:
|
|
190
196
|
exchangeStatus (no params)
|
|
191
197
|
|
|
@@ -221,6 +227,7 @@ Account:
|
|
|
221
227
|
setDisplayName --displayName <string>
|
|
222
228
|
spotUser --optOut <bool>
|
|
223
229
|
userDexAbstraction --user <address> --enabled <bool>
|
|
230
|
+
userPortfolioMargin --user <address> --enabled <bool>
|
|
224
231
|
|
|
225
232
|
Fund Transfers:
|
|
226
233
|
sendAsset --destination <address> --token <name:address> --amount <number>
|
|
@@ -264,6 +271,9 @@ Validator Actions:
|
|
|
264
271
|
cValidatorAction --<action> <json>
|
|
265
272
|
validatorL1Stream --riskFreeRate <number>
|
|
266
273
|
|
|
274
|
+
Earn:
|
|
275
|
+
borrowLend --operation <supply|withdraw> --token <number> --amount <number|null>
|
|
276
|
+
|
|
267
277
|
Other:
|
|
268
278
|
convertToMultiSigUser --authorizedUsers <json> --threshold <number>
|
|
269
279
|
|
package/esm/bin/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AAEH,wDAAwD;AACxD,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAa,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,SAAS,eAAe,CAAC,MAAc,EAAE,MAAmB;IAC1D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,OAAO,EAAE,iBAAiB,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,aAAc,SAAQ,aAAa;IACvC,YAAY,SAAkB;QAC5B,KAAK,CAAC,EAAE,SA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E,GAAG,EAAE,SAAS,CAAC;IAC1C,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AACH,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1D,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAClC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;IAChD,SAAS,EAAE,CAAC;AACd,CAAC;KAAM,CAAC;IACN,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC;SAC1C,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;SACrD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -20,6 +20,7 @@ export declare class Semaphore {
|
|
|
20
20
|
* Creates a new semaphore with the specified number of permits.
|
|
21
21
|
*
|
|
22
22
|
* @param max Maximum concurrent permits. Defaults to 1 (mutex).
|
|
23
|
+
* @throws {TypeError} If `max` is not a positive integer.
|
|
23
24
|
*/
|
|
24
25
|
constructor(max?: number);
|
|
25
26
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unstable_semaphore.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAS;;IASpB;;;;;OAKG;gBACS,GAAG,GAAE,MAAU;IAS3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IAgB9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,IAAI,UAAU,GAAG,SAAS;IAQpC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,IAAI,IAAI;CAShB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2018-
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
2
|
// This module is browser compatible.
|
|
3
3
|
/**
|
|
4
4
|
* A counting semaphore for limiting concurrent access to a resource.
|
|
@@ -28,10 +28,11 @@ export class Semaphore {
|
|
|
28
28
|
* Creates a new semaphore with the specified number of permits.
|
|
29
29
|
*
|
|
30
30
|
* @param max Maximum concurrent permits. Defaults to 1 (mutex).
|
|
31
|
+
* @throws {TypeError} If `max` is not a positive integer.
|
|
31
32
|
*/
|
|
32
33
|
constructor(max = 1) {
|
|
33
|
-
if (max < 1) {
|
|
34
|
-
throw new TypeError(`Cannot create semaphore as 'max' must be
|
|
34
|
+
if (!Number.isInteger(max) || max < 1) {
|
|
35
|
+
throw new TypeError(`Cannot create semaphore as 'max' must be a positive integer: received ${max}`);
|
|
35
36
|
}
|
|
36
37
|
this.#count = this.#max = max;
|
|
37
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unstable_semaphore.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/1.1.0/unstable_semaphore.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,qCAAqC;AAQrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,SAAS;IACpB,IAAI,CAAS;IACb,2CAA2C;IAC3C,MAAM,CAAS;IACf,iCAAiC;IACjC,KAAK,CAAmB;IACxB,iCAAiC;IACjC,KAAK,CAAmB;IAExB;;;;;OAKG;IACH,YAAY,MAAc,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,SAAS,CACjB,y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AAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,KAAK;gBAAE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QAC1C,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Semaphore } from "../../../../../deps/jsr.io/@std/async/1.0
|
|
1
|
+
import { Semaphore } from "../../../../../deps/jsr.io/@std/async/1.1.0/unstable_semaphore.js";
|
|
2
2
|
/**
|
|
3
3
|
* A reference-counted registry for lazily creating and reusing per-key values.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_semaphore.js","sourceRoot":"","sources":["../../../../../../src/src/api/exchange/_methods/_base/_semaphore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"_semaphore.js","sourceRoot":"","sources":["../../../../../../src/src/api/exchange/_methods/_base/_semaphore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mEAAmE,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,kBAAkB;IACtB,IAAI,GAAG,IAAI,GAAG,EAAiC,CAAC;IAChD,QAAQ,CAAU;IAElB;;;;OAIG;IACH,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,GAAM;QACR,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;QACD,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,GAAM;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAO,GAAM,EAAE,EAAoB;IAC/D,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC;IAC1B,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -14,8 +14,8 @@ export declare const ApproveAgentRequest: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
14
14
|
readonly hyperliquidChain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["Mainnet", "Testnet"], undefined>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>;
|
|
15
15
|
/** Agent address. */
|
|
16
16
|
readonly agentAddress: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "Agent address.">]>;
|
|
17
|
-
/** Agent name or null for unnamed agent. */
|
|
18
|
-
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
17
|
+
/** Agent name (min 1 and max 16 characters) or null for unnamed agent. */
|
|
18
|
+
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>, null>, v.DescriptionAction<string | null, "Agent name (min 1 and max 16 characters) or null for unnamed agent.">]>;
|
|
19
19
|
/** Nonce (timestamp in ms) used to prevent replay attacks. */
|
|
20
20
|
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Nonce (timestamp in ms) used to prevent replay attacks.">]>;
|
|
21
21
|
}, undefined>, v.DescriptionAction<{
|
|
@@ -103,8 +103,8 @@ declare const ApproveAgentParameters: Omit<v.ObjectSchema<{
|
|
|
103
103
|
readonly hyperliquidChain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["Mainnet", "Testnet"], undefined>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>;
|
|
104
104
|
/** Agent address. */
|
|
105
105
|
readonly agentAddress: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "Agent address.">]>;
|
|
106
|
-
/** Agent name or null for unnamed agent. */
|
|
107
|
-
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
106
|
+
/** Agent name (min 1 and max 16 characters) or null for unnamed agent. */
|
|
107
|
+
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>, null>, v.DescriptionAction<string | null, "Agent name (min 1 and max 16 characters) or null for unnamed agent.">]>;
|
|
108
108
|
/** Nonce (timestamp in ms) used to prevent replay attacks. */
|
|
109
109
|
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Nonce (timestamp in ms) used to prevent replay attacks.">]>;
|
|
110
110
|
}, undefined>, "entries" | "~types" | "~run" | "~standard"> & {
|
|
@@ -117,8 +117,8 @@ declare const ApproveAgentParameters: Omit<v.ObjectSchema<{
|
|
|
117
117
|
readonly hyperliquidChain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["Mainnet", "Testnet"], undefined>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network type.">]>;
|
|
118
118
|
/** Agent address. */
|
|
119
119
|
readonly agentAddress: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "Agent address.">]>;
|
|
120
|
-
/** Agent name or null for unnamed agent. */
|
|
121
|
-
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
120
|
+
/** Agent name (min 1 and max 16 characters) or null for unnamed agent. */
|
|
121
|
+
readonly agentName: v.SchemaWithPipe<readonly [v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>, null>, v.DescriptionAction<string | null, "Agent name (min 1 and max 16 characters) or null for unnamed agent.">]>;
|
|
122
122
|
/** Nonce (timestamp in ms) used to prevent replay attacks. */
|
|
123
123
|
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Nonce (timestamp in ms) used to prevent replay attacks.">]>;
|
|
124
124
|
}, "type" | "nonce" | "signatureChainId" | "hyperliquidChain">;
|
|
@@ -132,7 +132,7 @@ declare const ApproveAgentParameters: Omit<v.ObjectSchema<{
|
|
|
132
132
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
133
133
|
agentName: string | null;
|
|
134
134
|
agentAddress: `0x${string}`;
|
|
135
|
-
}, v.StringIssue | v.ObjectIssue | v.RegexIssue<string> | v.LengthIssue<`0x${string}`, 42> | v.
|
|
135
|
+
}, v.StringIssue | v.ObjectIssue | v.RegexIssue<string> | v.LengthIssue<`0x${string}`, 42> | v.CheckIssue<string>>;
|
|
136
136
|
readonly "~types"?: {
|
|
137
137
|
readonly input: {
|
|
138
138
|
agentName?: string | null | undefined;
|
|
@@ -142,7 +142,7 @@ declare const ApproveAgentParameters: Omit<v.ObjectSchema<{
|
|
|
142
142
|
agentName: string | null;
|
|
143
143
|
agentAddress: `0x${string}`;
|
|
144
144
|
};
|
|
145
|
-
readonly issue: v.StringIssue | v.ObjectIssue | v.RegexIssue<string> | v.LengthIssue<`0x${string}`, 42> | v.
|
|
145
|
+
readonly issue: v.StringIssue | v.ObjectIssue | v.RegexIssue<string> | v.LengthIssue<`0x${string}`, 42> | v.CheckIssue<string>;
|
|
146
146
|
} | undefined;
|
|
147
147
|
};
|
|
148
148
|
/** Action parameters for the {@linkcode approveAgent} function. */
|
|
@@ -180,9 +180,20 @@ export declare const ApproveAgentTypes: {
|
|
|
180
180
|
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
181
181
|
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
182
182
|
*
|
|
183
|
+
* // Basic usage
|
|
183
184
|
* await approveAgent(
|
|
184
185
|
* { transport, wallet },
|
|
185
|
-
* { agentAddress: "0x...", agentName: "
|
|
186
|
+
* { agentAddress: "0x...", agentName: "myAgent" },
|
|
187
|
+
* );
|
|
188
|
+
*
|
|
189
|
+
* // With expiration timestamp
|
|
190
|
+
* const expirationTimestamp = Date.now() + 24 * 60 * 60 * 1000;
|
|
191
|
+
* await approveAgent(
|
|
192
|
+
* { transport, wallet },
|
|
193
|
+
* {
|
|
194
|
+
* agentAddress: "0x...",
|
|
195
|
+
* agentName: `myAgent valid_until ${expirationTimestamp}`,
|
|
196
|
+
* },
|
|
186
197
|
* );
|
|
187
198
|
* ```
|
|
188
199
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approveAgent.d.ts","sourceRoot":"","sources":["../../../../../src/src/api/exchange/_methods/approveAgent.ts"],"names":[],"mappings":"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;;;;CAiDpE,CAAC;AACL,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEjF,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;AAElG,6EAA6E;AAC7E,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AAErF,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;;CAO7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,sBAAsB,EAC9B,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CAQtC"}
|
|
@@ -20,8 +20,15 @@ export const ApproveAgentRequest = /* @__PURE__ */ (() => {
|
|
|
20
20
|
hyperliquidChain: v.pipe(HyperliquidChainSchema, v.description("HyperLiquid network type.")),
|
|
21
21
|
/** Agent address. */
|
|
22
22
|
agentAddress: v.pipe(Address, v.description("Agent address.")),
|
|
23
|
-
/** Agent name or null for unnamed agent. */
|
|
24
|
-
agentName: v.pipe(v.nullish(v.pipe(v.string(), v.
|
|
23
|
+
/** Agent name (min 1 and max 16 characters) or null for unnamed agent. */
|
|
24
|
+
agentName: v.pipe(v.nullish(v.pipe(v.string(), v.check((input) => {
|
|
25
|
+
// Ignore trailing ` valid_until <timestamp>` when checking length
|
|
26
|
+
const baseName = input.replace(/ valid_until \d+$/, "");
|
|
27
|
+
return baseName.length >= 1 && baseName.length <= 16;
|
|
28
|
+
}, (issue) => {
|
|
29
|
+
const baseName = issue.input.replace(/ valid_until \d+$/, "");
|
|
30
|
+
return `Invalid length: Expected >= 1 and <= 16 but received ${baseName.length}`;
|
|
31
|
+
})), null), v.description("Agent name (min 1 and max 16 characters) or null for unnamed agent.")),
|
|
25
32
|
/** Nonce (timestamp in ms) used to prevent replay attacks. */
|
|
26
33
|
nonce: v.pipe(UnsignedInteger, v.description("Nonce (timestamp in ms) used to prevent replay attacks.")),
|
|
27
34
|
}), v.description("Action to perform.")),
|
|
@@ -77,9 +84,20 @@ export const ApproveAgentTypes = {
|
|
|
77
84
|
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
78
85
|
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
79
86
|
*
|
|
87
|
+
* // Basic usage
|
|
80
88
|
* await approveAgent(
|
|
81
89
|
* { transport, wallet },
|
|
82
|
-
* { agentAddress: "0x...", agentName: "
|
|
90
|
+
* { agentAddress: "0x...", agentName: "myAgent" },
|
|
91
|
+
* );
|
|
92
|
+
*
|
|
93
|
+
* // With expiration timestamp
|
|
94
|
+
* const expirationTimestamp = Date.now() + 24 * 60 * 60 * 1000;
|
|
95
|
+
* await approveAgent(
|
|
96
|
+
* { transport, wallet },
|
|
97
|
+
* {
|
|
98
|
+
* agentAddress: "0x...",
|
|
99
|
+
* agentName: `myAgent valid_until ${expirationTimestamp}`,
|
|
100
|
+
* },
|
|
83
101
|
* );
|
|
84
102
|
* ```
|
|
85
103
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approveAgent.js","sourceRoot":"","sources":["../../../../../src/src/api/exchange/_methods/approveAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,+DAA+D;AAC/D,cAAc;AACd,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACvD,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CACZ,CAAC,CAAC,MAAM,CAAC;YACP,sBAAsB;YACtB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EACzB,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CACjC;YACD,kDAAkD;YAClD,gBAAgB,EAAE,CAAC,CAAC,IAAI,CACtB,GAAG,EACH,CAAC,CAAC,WAAW,CAAC,6CAA6C,CAAC,CAC7D;YACD,gCAAgC;YAChC,gBAAgB,EAAE,CAAC,CAAC,IAAI,CACtB,sBAAsB,EACtB,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAC3C;YACD,qBAAqB;YACrB,YAAY,EAAE,CAAC,CAAC,IAAI,CAClB,OAAO,EACP,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAChC;YACD,
|
|
1
|
+
{"version":3,"file":"approveAgent.js","sourceRoot":"","sources":["../../../../../src/src/api/exchange/_methods/approveAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,+DAA+D;AAC/D,cAAc;AACd,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACvD,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CACZ,CAAC,CAAC,MAAM,CAAC;YACP,sBAAsB;YACtB,IAAI,EA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E,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;KAClC;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAsB,EACtB,MAA8B,EAC9B,IAA0B;IAE1B,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IACvD,OAAO,uBAAuB,CAC5B,MAAM,EACN,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,EACnC,iBAAiB,EACjB,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -600,7 +600,7 @@ declare const BatchModifyParameters: Omit<v.ObjectSchema<{
|
|
|
600
600
|
c?: `0x${string}` | undefined;
|
|
601
601
|
};
|
|
602
602
|
}[];
|
|
603
|
-
}, v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34> | v.PicklistIssue | v.
|
|
603
|
+
}, v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34> | v.PicklistIssue | v.CheckIssue<string> | v.BooleanIssue | v.UnionIssue<v.StringIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.PicklistIssue | v.CheckIssue<string> | v.BooleanIssue> | v.UnionIssue<v.StringIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34>>>;
|
|
604
604
|
readonly "~types"?: {
|
|
605
605
|
readonly input: {
|
|
606
606
|
modifies: {
|
|
@@ -650,7 +650,7 @@ declare const BatchModifyParameters: Omit<v.ObjectSchema<{
|
|
|
650
650
|
};
|
|
651
651
|
}[];
|
|
652
652
|
};
|
|
653
|
-
readonly issue: v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34> | v.PicklistIssue | v.
|
|
653
|
+
readonly issue: v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34> | v.PicklistIssue | v.CheckIssue<string> | v.BooleanIssue | v.UnionIssue<v.StringIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.PicklistIssue | v.CheckIssue<string> | v.BooleanIssue> | v.UnionIssue<v.StringIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.LengthIssue<`0x${string}`, 34>>;
|
|
654
654
|
} | undefined;
|
|
655
655
|
};
|
|
656
656
|
/** Action parameters for the {@linkcode batchModify} function. */
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** Borrow or lend assets. */
|
|
3
|
+
export declare const BorrowLendRequest: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
4
|
+
/** Action to perform. */
|
|
5
|
+
readonly action: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
6
|
+
/** Type of action. */
|
|
7
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"borrowLend", undefined>, v.DescriptionAction<"borrowLend", "Type of action.">]>;
|
|
8
|
+
/** Operation type. */
|
|
9
|
+
readonly operation: v.SchemaWithPipe<readonly [v.PicklistSchema<["supply", "withdraw", "repay", "borrow"], undefined>, v.DescriptionAction<"supply" | "withdraw" | "repay" | "borrow", "Operation type.">]>;
|
|
10
|
+
/** Token ID. */
|
|
11
|
+
readonly token: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Token ID.">]>;
|
|
12
|
+
/** Amount to supply/withdraw (null = full). */
|
|
13
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToStringAction<string | number, undefined>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Amount to supply/withdraw (null = full).">]>;
|
|
14
|
+
}, undefined>, v.DescriptionAction<{
|
|
15
|
+
type: "borrowLend";
|
|
16
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
17
|
+
token: number;
|
|
18
|
+
amount: string | null;
|
|
19
|
+
}, "Action to perform.">]>;
|
|
20
|
+
/** Nonce (timestamp in ms) used to prevent replay attacks. */
|
|
21
|
+
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Nonce (timestamp in ms) used to prevent replay attacks.">]>;
|
|
22
|
+
/** ECDSA signature components. */
|
|
23
|
+
readonly signature: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
24
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.DescriptionAction<`0x${string}`, "First 32-byte component.">]>;
|
|
25
|
+
readonly s: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.DescriptionAction<`0x${string}`, "Second 32-byte component.">]>;
|
|
26
|
+
readonly v: v.SchemaWithPipe<readonly [v.PicklistSchema<[27, 28], undefined>, v.DescriptionAction<27 | 28, "Recovery identifier.">]>;
|
|
27
|
+
}, undefined>, v.DescriptionAction<{
|
|
28
|
+
r: `0x${string}`;
|
|
29
|
+
s: `0x${string}`;
|
|
30
|
+
v: 27 | 28;
|
|
31
|
+
}, "ECDSA signature components.">]>, v.DescriptionAction<{
|
|
32
|
+
r: `0x${string}`;
|
|
33
|
+
s: `0x${string}`;
|
|
34
|
+
v: 27 | 28;
|
|
35
|
+
}, "ECDSA signature components.">]>;
|
|
36
|
+
/** Vault address (for vault trading). */
|
|
37
|
+
readonly vaultAddress: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, undefined>, v.DescriptionAction<`0x${string}` | undefined, "Vault address (for vault trading).">]>;
|
|
38
|
+
/** Expiration time of the action. */
|
|
39
|
+
readonly expiresAfter: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Expiration time of the action.">]>;
|
|
40
|
+
}, undefined>, v.DescriptionAction<{
|
|
41
|
+
action: {
|
|
42
|
+
type: "borrowLend";
|
|
43
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
44
|
+
token: number;
|
|
45
|
+
amount: string | null;
|
|
46
|
+
};
|
|
47
|
+
nonce: number;
|
|
48
|
+
signature: {
|
|
49
|
+
r: `0x${string}`;
|
|
50
|
+
s: `0x${string}`;
|
|
51
|
+
v: 27 | 28;
|
|
52
|
+
};
|
|
53
|
+
vaultAddress?: `0x${string}` | undefined;
|
|
54
|
+
expiresAfter?: number | undefined;
|
|
55
|
+
}, "Borrow or lend assets.">]>;
|
|
56
|
+
export type BorrowLendRequest = v.InferOutput<typeof BorrowLendRequest>;
|
|
57
|
+
/** Successful response without specific data or error response. */
|
|
58
|
+
export declare const BorrowLendResponse: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
59
|
+
readonly status: v.SchemaWithPipe<readonly [v.LiteralSchema<"ok", undefined>, v.DescriptionAction<"ok", "Successful status.">]>;
|
|
60
|
+
readonly response: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
61
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"default", undefined>, v.DescriptionAction<"default", "Type of response.">]>;
|
|
62
|
+
}, undefined>, v.DescriptionAction<{
|
|
63
|
+
type: "default";
|
|
64
|
+
}, "Response details.">]>;
|
|
65
|
+
}, undefined>, v.DescriptionAction<{
|
|
66
|
+
status: "ok";
|
|
67
|
+
response: {
|
|
68
|
+
type: "default";
|
|
69
|
+
};
|
|
70
|
+
}, "Successful response without specific data.">]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
71
|
+
readonly status: v.SchemaWithPipe<readonly [v.LiteralSchema<"err", undefined>, v.DescriptionAction<"err", "Error status.">]>;
|
|
72
|
+
readonly response: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Error message.">]>;
|
|
73
|
+
}, undefined>, v.DescriptionAction<{
|
|
74
|
+
status: "err";
|
|
75
|
+
response: string;
|
|
76
|
+
}, "Error response for failed operations.">]>], undefined>, v.DescriptionAction<{
|
|
77
|
+
status: "err";
|
|
78
|
+
response: string;
|
|
79
|
+
} | {
|
|
80
|
+
status: "ok";
|
|
81
|
+
response: {
|
|
82
|
+
type: "default";
|
|
83
|
+
};
|
|
84
|
+
}, "Successful response without specific data or error response.">]>;
|
|
85
|
+
export type BorrowLendResponse = v.InferOutput<typeof BorrowLendResponse>;
|
|
86
|
+
import { type ExchangeConfig, type ExtractRequestOptions } from "./_base/execute.js";
|
|
87
|
+
import type { ExcludeErrorResponse } from "./_base/errors.js";
|
|
88
|
+
/** Schema for user-provided action parameters (excludes system fields). */
|
|
89
|
+
declare const BorrowLendParameters: Omit<v.ObjectSchema<{
|
|
90
|
+
/** Type of action. */
|
|
91
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"borrowLend", undefined>, v.DescriptionAction<"borrowLend", "Type of action.">]>;
|
|
92
|
+
/** Operation type. */
|
|
93
|
+
readonly operation: v.SchemaWithPipe<readonly [v.PicklistSchema<["supply", "withdraw", "repay", "borrow"], undefined>, v.DescriptionAction<"supply" | "withdraw" | "repay" | "borrow", "Operation type.">]>;
|
|
94
|
+
/** Token ID. */
|
|
95
|
+
readonly token: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Token ID.">]>;
|
|
96
|
+
/** Amount to supply/withdraw (null = full). */
|
|
97
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToStringAction<string | number, undefined>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Amount to supply/withdraw (null = full).">]>;
|
|
98
|
+
}, undefined>, "entries" | "~types" | "~run" | "~standard"> & {
|
|
99
|
+
readonly entries: Omit<{
|
|
100
|
+
/** Type of action. */
|
|
101
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"borrowLend", undefined>, v.DescriptionAction<"borrowLend", "Type of action.">]>;
|
|
102
|
+
/** Operation type. */
|
|
103
|
+
readonly operation: v.SchemaWithPipe<readonly [v.PicklistSchema<["supply", "withdraw", "repay", "borrow"], undefined>, v.DescriptionAction<"supply" | "withdraw" | "repay" | "borrow", "Operation type.">]>;
|
|
104
|
+
/** Token ID. */
|
|
105
|
+
readonly token: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Token ID.">]>;
|
|
106
|
+
/** Amount to supply/withdraw (null = full). */
|
|
107
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToStringAction<string | number, undefined>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Amount to supply/withdraw (null = full).">]>;
|
|
108
|
+
}, "type">;
|
|
109
|
+
readonly "~standard": v.StandardProps<{
|
|
110
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
111
|
+
token: string | number;
|
|
112
|
+
amount: string | number | null;
|
|
113
|
+
}, {
|
|
114
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
115
|
+
token: number;
|
|
116
|
+
amount: string | null;
|
|
117
|
+
}>;
|
|
118
|
+
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
119
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
120
|
+
token: number;
|
|
121
|
+
amount: string | null;
|
|
122
|
+
}, v.StringIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.PicklistIssue>;
|
|
123
|
+
readonly "~types"?: {
|
|
124
|
+
readonly input: {
|
|
125
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
126
|
+
token: string | number;
|
|
127
|
+
amount: string | number | null;
|
|
128
|
+
};
|
|
129
|
+
readonly output: {
|
|
130
|
+
operation: "supply" | "withdraw" | "repay" | "borrow";
|
|
131
|
+
token: number;
|
|
132
|
+
amount: string | null;
|
|
133
|
+
};
|
|
134
|
+
readonly issue: v.StringIssue | v.ObjectIssue | v.NumberIssue | v.UnionIssue<v.StringIssue | v.NumberIssue> | v.ToStringIssue<string | number> | v.RegexIssue<string> | v.ToNumberIssue<string | number> | v.SafeIntegerIssue<number> | v.MinValueIssue<number, 0> | v.PicklistIssue;
|
|
135
|
+
} | undefined;
|
|
136
|
+
};
|
|
137
|
+
/** Action parameters for the {@linkcode borrowLend} function. */
|
|
138
|
+
export type BorrowLendParameters = v.InferInput<typeof BorrowLendParameters>;
|
|
139
|
+
/** Request options for the {@linkcode borrowLend} function. */
|
|
140
|
+
export type BorrowLendOptions = ExtractRequestOptions<v.InferInput<typeof BorrowLendRequest>>;
|
|
141
|
+
/** Successful variant of {@linkcode BorrowLendResponse} without errors. */
|
|
142
|
+
export type BorrowLendSuccessResponse = ExcludeErrorResponse<BorrowLendResponse>;
|
|
143
|
+
/**
|
|
144
|
+
* Borrow or lend assets.
|
|
145
|
+
*
|
|
146
|
+
* @param config - General configuration for Exchange API requests.
|
|
147
|
+
* @param params - Parameters specific to the API request.
|
|
148
|
+
* @param opts - Request execution options.
|
|
149
|
+
*
|
|
150
|
+
* @returns Successful response without specific data.
|
|
151
|
+
*
|
|
152
|
+
* @throws {ValiError} When the request parameters fail validation (before sending).
|
|
153
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
154
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
159
|
+
* import { borrowLend } from "@nktkas/hyperliquid/api/exchange";
|
|
160
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
161
|
+
*
|
|
162
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
163
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
164
|
+
*
|
|
165
|
+
* const data = await borrowLend(
|
|
166
|
+
* { transport, wallet },
|
|
167
|
+
* { operation: "supply", token: 0, amount: "20" },
|
|
168
|
+
* );
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function borrowLend(config: ExchangeConfig, params: BorrowLendParameters, opts?: BorrowLendOptions): Promise<BorrowLendSuccessResponse>;
|
|
172
|
+
export {};
|
|
173
|
+
//# sourceMappingURL=borrowLend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowLend.d.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