@nightlylabs/dex-sdk 0.0.52 → 0.0.54
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/dist/index.cjs +125 -37
- package/dist/index.d.cts +41 -5
- package/dist/index.d.ts +41 -5
- package/dist/index.js +125 -37
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@ var import_uuid = require("uuid");
|
|
|
65
65
|
|
|
66
66
|
// generated_types/addApiKey.ts
|
|
67
67
|
var ABI = {
|
|
68
|
-
"address": "
|
|
68
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
69
69
|
"name": "add_api_key",
|
|
70
70
|
"friends": [],
|
|
71
71
|
"exposed_functions": [
|
|
@@ -90,7 +90,7 @@ var addApiKey_default = ABI;
|
|
|
90
90
|
|
|
91
91
|
// generated_types/cancelAllPerpOrders.ts
|
|
92
92
|
var ABI2 = {
|
|
93
|
-
"address": "
|
|
93
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
94
94
|
"name": "cancel_all_perp_orders",
|
|
95
95
|
"friends": [],
|
|
96
96
|
"exposed_functions": [
|
|
@@ -113,7 +113,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
113
113
|
|
|
114
114
|
// generated_types/cancelPerpOrders.ts
|
|
115
115
|
var ABI3 = {
|
|
116
|
-
"address": "
|
|
116
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
117
117
|
"name": "cancel_perp_orders",
|
|
118
118
|
"friends": [],
|
|
119
119
|
"exposed_functions": [
|
|
@@ -138,7 +138,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
138
138
|
|
|
139
139
|
// generated_types/createUser.ts
|
|
140
140
|
var ABI4 = {
|
|
141
|
-
"address": "
|
|
141
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
142
142
|
"name": "create_user",
|
|
143
143
|
"friends": [],
|
|
144
144
|
"exposed_functions": [
|
|
@@ -163,7 +163,7 @@ var createUser_default = ABI4;
|
|
|
163
163
|
|
|
164
164
|
// generated_types/depositToVault.ts
|
|
165
165
|
var ABI5 = {
|
|
166
|
-
"address": "
|
|
166
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
167
167
|
"name": "deposit_to_vault",
|
|
168
168
|
"friends": [],
|
|
169
169
|
"exposed_functions": [
|
|
@@ -188,7 +188,7 @@ var depositToVault_default = ABI5;
|
|
|
188
188
|
|
|
189
189
|
// generated_types/depositToken.ts
|
|
190
190
|
var ABI6 = {
|
|
191
|
-
"address": "
|
|
191
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
192
192
|
"name": "deposit_token",
|
|
193
193
|
"friends": [],
|
|
194
194
|
"exposed_functions": [
|
|
@@ -213,7 +213,7 @@ var depositToken_default = ABI6;
|
|
|
213
213
|
|
|
214
214
|
// generated_types/lendToken.ts
|
|
215
215
|
var ABI7 = {
|
|
216
|
-
"address": "
|
|
216
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
217
217
|
"name": "lend_token",
|
|
218
218
|
"friends": [],
|
|
219
219
|
"exposed_functions": [
|
|
@@ -239,7 +239,7 @@ var lendToken_default = ABI7;
|
|
|
239
239
|
|
|
240
240
|
// generated_types/placePerpLimitOrder.ts
|
|
241
241
|
var ABI8 = {
|
|
242
|
-
"address": "
|
|
242
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
243
243
|
"name": "place_perp_limit_order",
|
|
244
244
|
"friends": [],
|
|
245
245
|
"exposed_functions": [
|
|
@@ -266,9 +266,36 @@ var ABI8 = {
|
|
|
266
266
|
};
|
|
267
267
|
var placePerpLimitOrder_default = ABI8;
|
|
268
268
|
|
|
269
|
-
// generated_types/
|
|
269
|
+
// generated_types/changePerpOrderPrice.ts
|
|
270
270
|
var ABI9 = {
|
|
271
|
-
"address": "
|
|
271
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
272
|
+
"name": "change_perp_order_price",
|
|
273
|
+
"friends": [],
|
|
274
|
+
"exposed_functions": [
|
|
275
|
+
{
|
|
276
|
+
"name": "change_perp_order_price",
|
|
277
|
+
"visibility": "public",
|
|
278
|
+
"is_entry": true,
|
|
279
|
+
"is_view": false,
|
|
280
|
+
"generic_type_params": [],
|
|
281
|
+
"params": [
|
|
282
|
+
"&signer",
|
|
283
|
+
"u64",
|
|
284
|
+
"vector<u8>",
|
|
285
|
+
"u64",
|
|
286
|
+
"u64",
|
|
287
|
+
"bool"
|
|
288
|
+
],
|
|
289
|
+
"return": []
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"structs": []
|
|
293
|
+
};
|
|
294
|
+
var changePerpOrderPrice_default = ABI9;
|
|
295
|
+
|
|
296
|
+
// generated_types/placePerpMarketOrder.ts
|
|
297
|
+
var ABI10 = {
|
|
298
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
272
299
|
"name": "place_perp_market_order",
|
|
273
300
|
"friends": [],
|
|
274
301
|
"exposed_functions": [
|
|
@@ -292,11 +319,11 @@ var ABI9 = {
|
|
|
292
319
|
],
|
|
293
320
|
"structs": []
|
|
294
321
|
};
|
|
295
|
-
var placePerpMarketOrder_default =
|
|
322
|
+
var placePerpMarketOrder_default = ABI10;
|
|
296
323
|
|
|
297
324
|
// generated_types/redeemToken.ts
|
|
298
|
-
var
|
|
299
|
-
"address": "
|
|
325
|
+
var ABI11 = {
|
|
326
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
300
327
|
"name": "redeem_token",
|
|
301
328
|
"friends": [],
|
|
302
329
|
"exposed_functions": [
|
|
@@ -318,11 +345,11 @@ var ABI10 = {
|
|
|
318
345
|
],
|
|
319
346
|
"structs": []
|
|
320
347
|
};
|
|
321
|
-
var redeemToken_default =
|
|
348
|
+
var redeemToken_default = ABI11;
|
|
322
349
|
|
|
323
350
|
// generated_types/removeApiKey.ts
|
|
324
|
-
var
|
|
325
|
-
"address": "
|
|
351
|
+
var ABI12 = {
|
|
352
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
326
353
|
"name": "remove_api_key",
|
|
327
354
|
"friends": [],
|
|
328
355
|
"exposed_functions": [
|
|
@@ -342,11 +369,11 @@ var ABI11 = {
|
|
|
342
369
|
],
|
|
343
370
|
"structs": []
|
|
344
371
|
};
|
|
345
|
-
var removeApiKey_default =
|
|
372
|
+
var removeApiKey_default = ABI12;
|
|
346
373
|
|
|
347
374
|
// generated_types/setAliasName.ts
|
|
348
|
-
var
|
|
349
|
-
"address": "
|
|
375
|
+
var ABI13 = {
|
|
376
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
350
377
|
"name": "set_alias_name",
|
|
351
378
|
"friends": [],
|
|
352
379
|
"exposed_functions": [
|
|
@@ -366,11 +393,11 @@ var ABI12 = {
|
|
|
366
393
|
],
|
|
367
394
|
"structs": []
|
|
368
395
|
};
|
|
369
|
-
var setAliasName_default =
|
|
396
|
+
var setAliasName_default = ABI13;
|
|
370
397
|
|
|
371
398
|
// generated_types/setAutolend.ts
|
|
372
|
-
var
|
|
373
|
-
"address": "
|
|
399
|
+
var ABI14 = {
|
|
400
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
374
401
|
"name": "set_autolend",
|
|
375
402
|
"friends": [],
|
|
376
403
|
"exposed_functions": [
|
|
@@ -390,7 +417,7 @@ var ABI13 = {
|
|
|
390
417
|
],
|
|
391
418
|
"structs": []
|
|
392
419
|
};
|
|
393
|
-
var setAutolend_default =
|
|
420
|
+
var setAutolend_default = ABI14;
|
|
394
421
|
|
|
395
422
|
// generated_types/typeshareTypes.ts
|
|
396
423
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
@@ -472,8 +499,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
472
499
|
})(UserStatus || {});
|
|
473
500
|
|
|
474
501
|
// generated_types/withdrawFromVault.ts
|
|
475
|
-
var
|
|
476
|
-
"address": "
|
|
502
|
+
var ABI15 = {
|
|
503
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
477
504
|
"name": "withdraw_from_vault",
|
|
478
505
|
"friends": [],
|
|
479
506
|
"exposed_functions": [
|
|
@@ -495,7 +522,7 @@ var ABI14 = {
|
|
|
495
522
|
],
|
|
496
523
|
"structs": []
|
|
497
524
|
};
|
|
498
|
-
var withdrawFromVault_default =
|
|
525
|
+
var withdrawFromVault_default = ABI15;
|
|
499
526
|
|
|
500
527
|
// src/utils.ts
|
|
501
528
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -544,6 +571,10 @@ var getTopicFromCommand = (data) => {
|
|
|
544
571
|
return "OracleUpdates";
|
|
545
572
|
case "UnsubscribeOracle":
|
|
546
573
|
return "OracleUpdates";
|
|
574
|
+
case "SubscribeBorrowLend":
|
|
575
|
+
return "BorrowLendUpdate";
|
|
576
|
+
case "UnsubscribeBorrowLend":
|
|
577
|
+
return "BorrowLendUpdate";
|
|
547
578
|
}
|
|
548
579
|
};
|
|
549
580
|
var getTopicFromMessage = (data) => {
|
|
@@ -580,7 +611,7 @@ var getTopicFromMessage = (data) => {
|
|
|
580
611
|
return data.content.userId;
|
|
581
612
|
case "OrderFills":
|
|
582
613
|
return data.content.userId;
|
|
583
|
-
case "
|
|
614
|
+
case "SetAutoLend":
|
|
584
615
|
return data.content.userId;
|
|
585
616
|
case "SetAlias":
|
|
586
617
|
return data.content.userId;
|
|
@@ -590,6 +621,8 @@ var getTopicFromMessage = (data) => {
|
|
|
590
621
|
return data.content.userId;
|
|
591
622
|
case "FundingPayment":
|
|
592
623
|
return data.content.userId;
|
|
624
|
+
case "BorrowLendUpdate":
|
|
625
|
+
return data.type;
|
|
593
626
|
}
|
|
594
627
|
};
|
|
595
628
|
|
|
@@ -1087,7 +1120,26 @@ var Client = class _Client {
|
|
|
1087
1120
|
}
|
|
1088
1121
|
async unsubscribeIndexPricesUpdates() {
|
|
1089
1122
|
const command = {
|
|
1090
|
-
type: "
|
|
1123
|
+
type: "UnsubscribeOracle",
|
|
1124
|
+
content: { id: getRandomId() }
|
|
1125
|
+
};
|
|
1126
|
+
await this.sendWsMessage(command);
|
|
1127
|
+
const topic = getTopicFromCommand(command);
|
|
1128
|
+
this._subscriptions.delete(topic);
|
|
1129
|
+
}
|
|
1130
|
+
async subscribeBorrowLendingUpdates(callback) {
|
|
1131
|
+
const command = {
|
|
1132
|
+
type: "SubscribeBorrowLend",
|
|
1133
|
+
content: { id: getRandomId() }
|
|
1134
|
+
};
|
|
1135
|
+
await this.sendWsMessage(command);
|
|
1136
|
+
const topic = getTopicFromCommand(command);
|
|
1137
|
+
this._subscriptions.set(topic, callback);
|
|
1138
|
+
return this.unsubscribeIndexPricesUpdates;
|
|
1139
|
+
}
|
|
1140
|
+
async unsubscribeBorrowLendingUpdates() {
|
|
1141
|
+
const command = {
|
|
1142
|
+
type: "UnsubscribeBorrowLend",
|
|
1091
1143
|
content: { id: getRandomId() }
|
|
1092
1144
|
};
|
|
1093
1145
|
await this.sendWsMessage(command);
|
|
@@ -1275,6 +1327,42 @@ var Client = class _Client {
|
|
|
1275
1327
|
});
|
|
1276
1328
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1277
1329
|
}
|
|
1330
|
+
async changePerpOrderPrice(params) {
|
|
1331
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1332
|
+
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1333
|
+
aptosConfig: this._aptos.config,
|
|
1334
|
+
abi: parseEntryFunctionAbi({
|
|
1335
|
+
moduleAbi: changePerpOrderPrice_default,
|
|
1336
|
+
functionName: changePerpOrderPrice_default.name,
|
|
1337
|
+
moduleAddress: changePerpOrderPrice_default.address,
|
|
1338
|
+
moduleName: changePerpOrderPrice_default.name
|
|
1339
|
+
}),
|
|
1340
|
+
function: `${changePerpOrderPrice_default.address}::${changePerpOrderPrice_default.name}::change_perp_order_price`,
|
|
1341
|
+
typeArguments: [],
|
|
1342
|
+
functionArguments: [
|
|
1343
|
+
params.userId,
|
|
1344
|
+
params.market,
|
|
1345
|
+
params.orderId,
|
|
1346
|
+
params.newPrice,
|
|
1347
|
+
params.postOnly
|
|
1348
|
+
]
|
|
1349
|
+
});
|
|
1350
|
+
const rawTx = new import_ts_sdk2.RawTransaction(
|
|
1351
|
+
import_ts_sdk2.AccountAddress.from(this._apiKey.accountAddress),
|
|
1352
|
+
BigInt(sequenceNumber),
|
|
1353
|
+
aptosPayload,
|
|
1354
|
+
BigInt(1e4),
|
|
1355
|
+
BigInt(100),
|
|
1356
|
+
BigInt(Date.now() + 10 * 1e3),
|
|
1357
|
+
new import_ts_sdk2.ChainId(this._chainId)
|
|
1358
|
+
);
|
|
1359
|
+
const tx = new import_ts_sdk2.SimpleTransaction(rawTx, import_ts_sdk2.AccountAddress.ZERO);
|
|
1360
|
+
const signature = this._aptos.sign({
|
|
1361
|
+
signer: this._apiKey,
|
|
1362
|
+
transaction: tx
|
|
1363
|
+
});
|
|
1364
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1365
|
+
}
|
|
1278
1366
|
async cancelPerpOrders(params) {
|
|
1279
1367
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1280
1368
|
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
@@ -1559,8 +1647,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1559
1647
|
var import_surf2 = require("@thalalabs/surf");
|
|
1560
1648
|
|
|
1561
1649
|
// generated_types/faucetEntrypoints.ts
|
|
1562
|
-
var
|
|
1563
|
-
"address": "
|
|
1650
|
+
var ABI16 = {
|
|
1651
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
1564
1652
|
"name": "faucet_entrypoints",
|
|
1565
1653
|
"friends": [],
|
|
1566
1654
|
"exposed_functions": [
|
|
@@ -1591,11 +1679,11 @@ var ABI15 = {
|
|
|
1591
1679
|
],
|
|
1592
1680
|
"structs": []
|
|
1593
1681
|
};
|
|
1594
|
-
var faucetEntrypoints_default =
|
|
1682
|
+
var faucetEntrypoints_default = ABI16;
|
|
1595
1683
|
|
|
1596
1684
|
// generated_types/testFaucet.ts
|
|
1597
|
-
var
|
|
1598
|
-
"address": "
|
|
1685
|
+
var ABI17 = {
|
|
1686
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
1599
1687
|
"name": "test_faucet",
|
|
1600
1688
|
"friends": [],
|
|
1601
1689
|
"exposed_functions": [
|
|
@@ -1632,7 +1720,7 @@ var ABI16 = {
|
|
|
1632
1720
|
],
|
|
1633
1721
|
"return": [
|
|
1634
1722
|
"0x1::object::ConstructorRef",
|
|
1635
|
-
"0x1::object::Object<
|
|
1723
|
+
"0x1::object::Object<0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::Token>"
|
|
1636
1724
|
]
|
|
1637
1725
|
},
|
|
1638
1726
|
{
|
|
@@ -1771,7 +1859,7 @@ var ABI16 = {
|
|
|
1771
1859
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1772
1860
|
],
|
|
1773
1861
|
"return": [
|
|
1774
|
-
"
|
|
1862
|
+
"0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::FaucetToken"
|
|
1775
1863
|
]
|
|
1776
1864
|
}
|
|
1777
1865
|
],
|
|
@@ -1803,7 +1891,7 @@ var ABI16 = {
|
|
|
1803
1891
|
"fields": [
|
|
1804
1892
|
{
|
|
1805
1893
|
"name": "tokens",
|
|
1806
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1894
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::FaucetToken>"
|
|
1807
1895
|
}
|
|
1808
1896
|
]
|
|
1809
1897
|
},
|
|
@@ -1828,7 +1916,7 @@ var ABI16 = {
|
|
|
1828
1916
|
}
|
|
1829
1917
|
]
|
|
1830
1918
|
};
|
|
1831
|
-
var testFaucet_default =
|
|
1919
|
+
var testFaucet_default = ABI17;
|
|
1832
1920
|
|
|
1833
1921
|
// src/testFaucet.ts
|
|
1834
1922
|
var TestFaucet = class _TestFaucet extends client_default {
|
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,13 @@ interface Borrow {
|
|
|
27
27
|
tokenAmount: string;
|
|
28
28
|
sharesReceived: string;
|
|
29
29
|
}
|
|
30
|
+
interface BorrowLendUpdate {
|
|
31
|
+
tokenAddress: string;
|
|
32
|
+
lendShares: string;
|
|
33
|
+
lendAmount: string;
|
|
34
|
+
borrowShares: string;
|
|
35
|
+
borrowAmount: string;
|
|
36
|
+
}
|
|
30
37
|
interface UtilizationCurve {
|
|
31
38
|
base: string;
|
|
32
39
|
multiplier: string;
|
|
@@ -392,7 +399,7 @@ interface HistoricalWithdraw {
|
|
|
392
399
|
timestamp: string;
|
|
393
400
|
}
|
|
394
401
|
interface GetUserWithdrawalsResponse {
|
|
395
|
-
|
|
402
|
+
withdrawals: HistoricalWithdraw[];
|
|
396
403
|
paginationCursor?: PaginationCursor;
|
|
397
404
|
}
|
|
398
405
|
interface GetUsersByAddressRequest {
|
|
@@ -477,7 +484,7 @@ interface SetAlias {
|
|
|
477
484
|
userId: string;
|
|
478
485
|
newAlias: string;
|
|
479
486
|
}
|
|
480
|
-
interface
|
|
487
|
+
interface SetAutoLend {
|
|
481
488
|
userId: string;
|
|
482
489
|
enabled: boolean;
|
|
483
490
|
}
|
|
@@ -562,6 +569,9 @@ type Topic = {
|
|
|
562
569
|
} | {
|
|
563
570
|
type: "Oracle";
|
|
564
571
|
content?: undefined;
|
|
572
|
+
} | {
|
|
573
|
+
type: "BorrowLend";
|
|
574
|
+
content?: undefined;
|
|
565
575
|
};
|
|
566
576
|
declare enum UserStatus {
|
|
567
577
|
Active = "Active",
|
|
@@ -601,6 +611,16 @@ type WsCommand = {
|
|
|
601
611
|
content: {
|
|
602
612
|
id: string;
|
|
603
613
|
};
|
|
614
|
+
} | {
|
|
615
|
+
type: "SubscribeBorrowLend";
|
|
616
|
+
content: {
|
|
617
|
+
id: string;
|
|
618
|
+
};
|
|
619
|
+
} | {
|
|
620
|
+
type: "UnsubscribeBorrowLend";
|
|
621
|
+
content: {
|
|
622
|
+
id: string;
|
|
623
|
+
};
|
|
604
624
|
};
|
|
605
625
|
type WsMessage = {
|
|
606
626
|
type: "Ack";
|
|
@@ -656,8 +676,8 @@ type WsMessage = {
|
|
|
656
676
|
type: "OrderFills";
|
|
657
677
|
content: OrderFills;
|
|
658
678
|
} | {
|
|
659
|
-
type: "
|
|
660
|
-
content:
|
|
679
|
+
type: "SetAutoLend";
|
|
680
|
+
content: SetAutoLend;
|
|
661
681
|
} | {
|
|
662
682
|
type: "SetAlias";
|
|
663
683
|
content: SetAlias;
|
|
@@ -670,6 +690,9 @@ type WsMessage = {
|
|
|
670
690
|
} | {
|
|
671
691
|
type: "FundingPayment";
|
|
672
692
|
content: FundingPayment;
|
|
693
|
+
} | {
|
|
694
|
+
type: "BorrowLendUpdate";
|
|
695
|
+
content: BorrowLendUpdate;
|
|
673
696
|
};
|
|
674
697
|
|
|
675
698
|
type Address = `0x${string}`;
|
|
@@ -791,6 +814,8 @@ declare class Client {
|
|
|
791
814
|
}>;
|
|
792
815
|
subscribeIndexPricesUpdates(callback: (data: WsOracleUpdates) => void): Promise<() => Promise<void>>;
|
|
793
816
|
unsubscribeIndexPricesUpdates(): Promise<void>;
|
|
817
|
+
subscribeBorrowLendingUpdates(callback: (data: WsBorrowLendUpdate) => void): Promise<() => Promise<void>>;
|
|
818
|
+
unsubscribeBorrowLendingUpdates(): Promise<void>;
|
|
794
819
|
subscribeUserUpdates(userId: string, callback: (data: WsUserUpdates) => void): Promise<() => Promise<void>>;
|
|
795
820
|
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
796
821
|
subscribePerpMarketUpdates(market: string, callback: (data: WsPerpMarketUpdates) => void): Promise<() => Promise<void>>;
|
|
@@ -800,6 +825,7 @@ declare class Client {
|
|
|
800
825
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
801
826
|
placePerpLimitOrder(params: PlacePerpLimitOrderParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
802
827
|
placePerpMarketOrder(params: PlacePerpMarketOrderParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
828
|
+
changePerpOrderPrice(params: ChangePerpOrderPriceParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
803
829
|
cancelPerpOrders(params: CancelPerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
804
830
|
cancelAllPerpOrders(params: CancelAllPerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
805
831
|
setAutolend(params: SetAutolendParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -832,6 +858,13 @@ declare class Client {
|
|
|
832
858
|
getUserPortfolioValueHistory: (request: GetUserPortfolioValueRequest) => Promise<GetUserPortfolioValueResponse>;
|
|
833
859
|
getTime: () => Promise<string>;
|
|
834
860
|
}
|
|
861
|
+
interface ChangePerpOrderPriceParams {
|
|
862
|
+
userId: string;
|
|
863
|
+
market: string;
|
|
864
|
+
orderId: string;
|
|
865
|
+
newPrice: string;
|
|
866
|
+
postOnly: boolean;
|
|
867
|
+
}
|
|
835
868
|
interface PlacePerpLimitOrderParams {
|
|
836
869
|
userId: string;
|
|
837
870
|
market: string;
|
|
@@ -923,6 +956,9 @@ type WsUserUpdates = Extract<WsMessage, {
|
|
|
923
956
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
924
957
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
925
958
|
}>;
|
|
959
|
+
type WsBorrowLendUpdate = Extract<WsMessage, {
|
|
960
|
+
type: 'BorrowLendUpdate';
|
|
961
|
+
}>;
|
|
926
962
|
|
|
927
963
|
declare function parseEntryFunctionAbi(args: {
|
|
928
964
|
moduleAbi: MoveModule;
|
|
@@ -953,4 +989,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
953
989
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
954
990
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
955
991
|
|
|
956
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type
|
|
992
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, type UserPortfolioValue, UserStatus, type UtilizationCurve, type Vault, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ interface Borrow {
|
|
|
27
27
|
tokenAmount: string;
|
|
28
28
|
sharesReceived: string;
|
|
29
29
|
}
|
|
30
|
+
interface BorrowLendUpdate {
|
|
31
|
+
tokenAddress: string;
|
|
32
|
+
lendShares: string;
|
|
33
|
+
lendAmount: string;
|
|
34
|
+
borrowShares: string;
|
|
35
|
+
borrowAmount: string;
|
|
36
|
+
}
|
|
30
37
|
interface UtilizationCurve {
|
|
31
38
|
base: string;
|
|
32
39
|
multiplier: string;
|
|
@@ -392,7 +399,7 @@ interface HistoricalWithdraw {
|
|
|
392
399
|
timestamp: string;
|
|
393
400
|
}
|
|
394
401
|
interface GetUserWithdrawalsResponse {
|
|
395
|
-
|
|
402
|
+
withdrawals: HistoricalWithdraw[];
|
|
396
403
|
paginationCursor?: PaginationCursor;
|
|
397
404
|
}
|
|
398
405
|
interface GetUsersByAddressRequest {
|
|
@@ -477,7 +484,7 @@ interface SetAlias {
|
|
|
477
484
|
userId: string;
|
|
478
485
|
newAlias: string;
|
|
479
486
|
}
|
|
480
|
-
interface
|
|
487
|
+
interface SetAutoLend {
|
|
481
488
|
userId: string;
|
|
482
489
|
enabled: boolean;
|
|
483
490
|
}
|
|
@@ -562,6 +569,9 @@ type Topic = {
|
|
|
562
569
|
} | {
|
|
563
570
|
type: "Oracle";
|
|
564
571
|
content?: undefined;
|
|
572
|
+
} | {
|
|
573
|
+
type: "BorrowLend";
|
|
574
|
+
content?: undefined;
|
|
565
575
|
};
|
|
566
576
|
declare enum UserStatus {
|
|
567
577
|
Active = "Active",
|
|
@@ -601,6 +611,16 @@ type WsCommand = {
|
|
|
601
611
|
content: {
|
|
602
612
|
id: string;
|
|
603
613
|
};
|
|
614
|
+
} | {
|
|
615
|
+
type: "SubscribeBorrowLend";
|
|
616
|
+
content: {
|
|
617
|
+
id: string;
|
|
618
|
+
};
|
|
619
|
+
} | {
|
|
620
|
+
type: "UnsubscribeBorrowLend";
|
|
621
|
+
content: {
|
|
622
|
+
id: string;
|
|
623
|
+
};
|
|
604
624
|
};
|
|
605
625
|
type WsMessage = {
|
|
606
626
|
type: "Ack";
|
|
@@ -656,8 +676,8 @@ type WsMessage = {
|
|
|
656
676
|
type: "OrderFills";
|
|
657
677
|
content: OrderFills;
|
|
658
678
|
} | {
|
|
659
|
-
type: "
|
|
660
|
-
content:
|
|
679
|
+
type: "SetAutoLend";
|
|
680
|
+
content: SetAutoLend;
|
|
661
681
|
} | {
|
|
662
682
|
type: "SetAlias";
|
|
663
683
|
content: SetAlias;
|
|
@@ -670,6 +690,9 @@ type WsMessage = {
|
|
|
670
690
|
} | {
|
|
671
691
|
type: "FundingPayment";
|
|
672
692
|
content: FundingPayment;
|
|
693
|
+
} | {
|
|
694
|
+
type: "BorrowLendUpdate";
|
|
695
|
+
content: BorrowLendUpdate;
|
|
673
696
|
};
|
|
674
697
|
|
|
675
698
|
type Address = `0x${string}`;
|
|
@@ -791,6 +814,8 @@ declare class Client {
|
|
|
791
814
|
}>;
|
|
792
815
|
subscribeIndexPricesUpdates(callback: (data: WsOracleUpdates) => void): Promise<() => Promise<void>>;
|
|
793
816
|
unsubscribeIndexPricesUpdates(): Promise<void>;
|
|
817
|
+
subscribeBorrowLendingUpdates(callback: (data: WsBorrowLendUpdate) => void): Promise<() => Promise<void>>;
|
|
818
|
+
unsubscribeBorrowLendingUpdates(): Promise<void>;
|
|
794
819
|
subscribeUserUpdates(userId: string, callback: (data: WsUserUpdates) => void): Promise<() => Promise<void>>;
|
|
795
820
|
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
796
821
|
subscribePerpMarketUpdates(market: string, callback: (data: WsPerpMarketUpdates) => void): Promise<() => Promise<void>>;
|
|
@@ -800,6 +825,7 @@ declare class Client {
|
|
|
800
825
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
801
826
|
placePerpLimitOrder(params: PlacePerpLimitOrderParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
802
827
|
placePerpMarketOrder(params: PlacePerpMarketOrderParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
828
|
+
changePerpOrderPrice(params: ChangePerpOrderPriceParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
803
829
|
cancelPerpOrders(params: CancelPerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
804
830
|
cancelAllPerpOrders(params: CancelAllPerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
805
831
|
setAutolend(params: SetAutolendParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -832,6 +858,13 @@ declare class Client {
|
|
|
832
858
|
getUserPortfolioValueHistory: (request: GetUserPortfolioValueRequest) => Promise<GetUserPortfolioValueResponse>;
|
|
833
859
|
getTime: () => Promise<string>;
|
|
834
860
|
}
|
|
861
|
+
interface ChangePerpOrderPriceParams {
|
|
862
|
+
userId: string;
|
|
863
|
+
market: string;
|
|
864
|
+
orderId: string;
|
|
865
|
+
newPrice: string;
|
|
866
|
+
postOnly: boolean;
|
|
867
|
+
}
|
|
835
868
|
interface PlacePerpLimitOrderParams {
|
|
836
869
|
userId: string;
|
|
837
870
|
market: string;
|
|
@@ -923,6 +956,9 @@ type WsUserUpdates = Extract<WsMessage, {
|
|
|
923
956
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
924
957
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
925
958
|
}>;
|
|
959
|
+
type WsBorrowLendUpdate = Extract<WsMessage, {
|
|
960
|
+
type: 'BorrowLendUpdate';
|
|
961
|
+
}>;
|
|
926
962
|
|
|
927
963
|
declare function parseEntryFunctionAbi(args: {
|
|
928
964
|
moduleAbi: MoveModule;
|
|
@@ -953,4 +989,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
953
989
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
954
990
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
955
991
|
|
|
956
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type
|
|
992
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, type UserPortfolioValue, UserStatus, type UtilizationCurve, type Vault, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
14
14
|
|
|
15
15
|
// generated_types/addApiKey.ts
|
|
16
16
|
var ABI = {
|
|
17
|
-
"address": "
|
|
17
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
18
18
|
"name": "add_api_key",
|
|
19
19
|
"friends": [],
|
|
20
20
|
"exposed_functions": [
|
|
@@ -39,7 +39,7 @@ var addApiKey_default = ABI;
|
|
|
39
39
|
|
|
40
40
|
// generated_types/cancelAllPerpOrders.ts
|
|
41
41
|
var ABI2 = {
|
|
42
|
-
"address": "
|
|
42
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
43
43
|
"name": "cancel_all_perp_orders",
|
|
44
44
|
"friends": [],
|
|
45
45
|
"exposed_functions": [
|
|
@@ -62,7 +62,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
62
62
|
|
|
63
63
|
// generated_types/cancelPerpOrders.ts
|
|
64
64
|
var ABI3 = {
|
|
65
|
-
"address": "
|
|
65
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
66
66
|
"name": "cancel_perp_orders",
|
|
67
67
|
"friends": [],
|
|
68
68
|
"exposed_functions": [
|
|
@@ -87,7 +87,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
87
87
|
|
|
88
88
|
// generated_types/createUser.ts
|
|
89
89
|
var ABI4 = {
|
|
90
|
-
"address": "
|
|
90
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
91
91
|
"name": "create_user",
|
|
92
92
|
"friends": [],
|
|
93
93
|
"exposed_functions": [
|
|
@@ -112,7 +112,7 @@ var createUser_default = ABI4;
|
|
|
112
112
|
|
|
113
113
|
// generated_types/depositToVault.ts
|
|
114
114
|
var ABI5 = {
|
|
115
|
-
"address": "
|
|
115
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
116
116
|
"name": "deposit_to_vault",
|
|
117
117
|
"friends": [],
|
|
118
118
|
"exposed_functions": [
|
|
@@ -137,7 +137,7 @@ var depositToVault_default = ABI5;
|
|
|
137
137
|
|
|
138
138
|
// generated_types/depositToken.ts
|
|
139
139
|
var ABI6 = {
|
|
140
|
-
"address": "
|
|
140
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
141
141
|
"name": "deposit_token",
|
|
142
142
|
"friends": [],
|
|
143
143
|
"exposed_functions": [
|
|
@@ -162,7 +162,7 @@ var depositToken_default = ABI6;
|
|
|
162
162
|
|
|
163
163
|
// generated_types/lendToken.ts
|
|
164
164
|
var ABI7 = {
|
|
165
|
-
"address": "
|
|
165
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
166
166
|
"name": "lend_token",
|
|
167
167
|
"friends": [],
|
|
168
168
|
"exposed_functions": [
|
|
@@ -188,7 +188,7 @@ var lendToken_default = ABI7;
|
|
|
188
188
|
|
|
189
189
|
// generated_types/placePerpLimitOrder.ts
|
|
190
190
|
var ABI8 = {
|
|
191
|
-
"address": "
|
|
191
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
192
192
|
"name": "place_perp_limit_order",
|
|
193
193
|
"friends": [],
|
|
194
194
|
"exposed_functions": [
|
|
@@ -215,9 +215,36 @@ var ABI8 = {
|
|
|
215
215
|
};
|
|
216
216
|
var placePerpLimitOrder_default = ABI8;
|
|
217
217
|
|
|
218
|
-
// generated_types/
|
|
218
|
+
// generated_types/changePerpOrderPrice.ts
|
|
219
219
|
var ABI9 = {
|
|
220
|
-
"address": "
|
|
220
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
221
|
+
"name": "change_perp_order_price",
|
|
222
|
+
"friends": [],
|
|
223
|
+
"exposed_functions": [
|
|
224
|
+
{
|
|
225
|
+
"name": "change_perp_order_price",
|
|
226
|
+
"visibility": "public",
|
|
227
|
+
"is_entry": true,
|
|
228
|
+
"is_view": false,
|
|
229
|
+
"generic_type_params": [],
|
|
230
|
+
"params": [
|
|
231
|
+
"&signer",
|
|
232
|
+
"u64",
|
|
233
|
+
"vector<u8>",
|
|
234
|
+
"u64",
|
|
235
|
+
"u64",
|
|
236
|
+
"bool"
|
|
237
|
+
],
|
|
238
|
+
"return": []
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"structs": []
|
|
242
|
+
};
|
|
243
|
+
var changePerpOrderPrice_default = ABI9;
|
|
244
|
+
|
|
245
|
+
// generated_types/placePerpMarketOrder.ts
|
|
246
|
+
var ABI10 = {
|
|
247
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
221
248
|
"name": "place_perp_market_order",
|
|
222
249
|
"friends": [],
|
|
223
250
|
"exposed_functions": [
|
|
@@ -241,11 +268,11 @@ var ABI9 = {
|
|
|
241
268
|
],
|
|
242
269
|
"structs": []
|
|
243
270
|
};
|
|
244
|
-
var placePerpMarketOrder_default =
|
|
271
|
+
var placePerpMarketOrder_default = ABI10;
|
|
245
272
|
|
|
246
273
|
// generated_types/redeemToken.ts
|
|
247
|
-
var
|
|
248
|
-
"address": "
|
|
274
|
+
var ABI11 = {
|
|
275
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
249
276
|
"name": "redeem_token",
|
|
250
277
|
"friends": [],
|
|
251
278
|
"exposed_functions": [
|
|
@@ -267,11 +294,11 @@ var ABI10 = {
|
|
|
267
294
|
],
|
|
268
295
|
"structs": []
|
|
269
296
|
};
|
|
270
|
-
var redeemToken_default =
|
|
297
|
+
var redeemToken_default = ABI11;
|
|
271
298
|
|
|
272
299
|
// generated_types/removeApiKey.ts
|
|
273
|
-
var
|
|
274
|
-
"address": "
|
|
300
|
+
var ABI12 = {
|
|
301
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
275
302
|
"name": "remove_api_key",
|
|
276
303
|
"friends": [],
|
|
277
304
|
"exposed_functions": [
|
|
@@ -291,11 +318,11 @@ var ABI11 = {
|
|
|
291
318
|
],
|
|
292
319
|
"structs": []
|
|
293
320
|
};
|
|
294
|
-
var removeApiKey_default =
|
|
321
|
+
var removeApiKey_default = ABI12;
|
|
295
322
|
|
|
296
323
|
// generated_types/setAliasName.ts
|
|
297
|
-
var
|
|
298
|
-
"address": "
|
|
324
|
+
var ABI13 = {
|
|
325
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
299
326
|
"name": "set_alias_name",
|
|
300
327
|
"friends": [],
|
|
301
328
|
"exposed_functions": [
|
|
@@ -315,11 +342,11 @@ var ABI12 = {
|
|
|
315
342
|
],
|
|
316
343
|
"structs": []
|
|
317
344
|
};
|
|
318
|
-
var setAliasName_default =
|
|
345
|
+
var setAliasName_default = ABI13;
|
|
319
346
|
|
|
320
347
|
// generated_types/setAutolend.ts
|
|
321
|
-
var
|
|
322
|
-
"address": "
|
|
348
|
+
var ABI14 = {
|
|
349
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
323
350
|
"name": "set_autolend",
|
|
324
351
|
"friends": [],
|
|
325
352
|
"exposed_functions": [
|
|
@@ -339,7 +366,7 @@ var ABI13 = {
|
|
|
339
366
|
],
|
|
340
367
|
"structs": []
|
|
341
368
|
};
|
|
342
|
-
var setAutolend_default =
|
|
369
|
+
var setAutolend_default = ABI14;
|
|
343
370
|
|
|
344
371
|
// generated_types/typeshareTypes.ts
|
|
345
372
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
@@ -421,8 +448,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
421
448
|
})(UserStatus || {});
|
|
422
449
|
|
|
423
450
|
// generated_types/withdrawFromVault.ts
|
|
424
|
-
var
|
|
425
|
-
"address": "
|
|
451
|
+
var ABI15 = {
|
|
452
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
426
453
|
"name": "withdraw_from_vault",
|
|
427
454
|
"friends": [],
|
|
428
455
|
"exposed_functions": [
|
|
@@ -444,7 +471,7 @@ var ABI14 = {
|
|
|
444
471
|
],
|
|
445
472
|
"structs": []
|
|
446
473
|
};
|
|
447
|
-
var withdrawFromVault_default =
|
|
474
|
+
var withdrawFromVault_default = ABI15;
|
|
448
475
|
|
|
449
476
|
// src/utils.ts
|
|
450
477
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -493,6 +520,10 @@ var getTopicFromCommand = (data) => {
|
|
|
493
520
|
return "OracleUpdates";
|
|
494
521
|
case "UnsubscribeOracle":
|
|
495
522
|
return "OracleUpdates";
|
|
523
|
+
case "SubscribeBorrowLend":
|
|
524
|
+
return "BorrowLendUpdate";
|
|
525
|
+
case "UnsubscribeBorrowLend":
|
|
526
|
+
return "BorrowLendUpdate";
|
|
496
527
|
}
|
|
497
528
|
};
|
|
498
529
|
var getTopicFromMessage = (data) => {
|
|
@@ -529,7 +560,7 @@ var getTopicFromMessage = (data) => {
|
|
|
529
560
|
return data.content.userId;
|
|
530
561
|
case "OrderFills":
|
|
531
562
|
return data.content.userId;
|
|
532
|
-
case "
|
|
563
|
+
case "SetAutoLend":
|
|
533
564
|
return data.content.userId;
|
|
534
565
|
case "SetAlias":
|
|
535
566
|
return data.content.userId;
|
|
@@ -539,6 +570,8 @@ var getTopicFromMessage = (data) => {
|
|
|
539
570
|
return data.content.userId;
|
|
540
571
|
case "FundingPayment":
|
|
541
572
|
return data.content.userId;
|
|
573
|
+
case "BorrowLendUpdate":
|
|
574
|
+
return data.type;
|
|
542
575
|
}
|
|
543
576
|
};
|
|
544
577
|
|
|
@@ -1036,7 +1069,26 @@ var Client = class _Client {
|
|
|
1036
1069
|
}
|
|
1037
1070
|
async unsubscribeIndexPricesUpdates() {
|
|
1038
1071
|
const command = {
|
|
1039
|
-
type: "
|
|
1072
|
+
type: "UnsubscribeOracle",
|
|
1073
|
+
content: { id: getRandomId() }
|
|
1074
|
+
};
|
|
1075
|
+
await this.sendWsMessage(command);
|
|
1076
|
+
const topic = getTopicFromCommand(command);
|
|
1077
|
+
this._subscriptions.delete(topic);
|
|
1078
|
+
}
|
|
1079
|
+
async subscribeBorrowLendingUpdates(callback) {
|
|
1080
|
+
const command = {
|
|
1081
|
+
type: "SubscribeBorrowLend",
|
|
1082
|
+
content: { id: getRandomId() }
|
|
1083
|
+
};
|
|
1084
|
+
await this.sendWsMessage(command);
|
|
1085
|
+
const topic = getTopicFromCommand(command);
|
|
1086
|
+
this._subscriptions.set(topic, callback);
|
|
1087
|
+
return this.unsubscribeIndexPricesUpdates;
|
|
1088
|
+
}
|
|
1089
|
+
async unsubscribeBorrowLendingUpdates() {
|
|
1090
|
+
const command = {
|
|
1091
|
+
type: "UnsubscribeBorrowLend",
|
|
1040
1092
|
content: { id: getRandomId() }
|
|
1041
1093
|
};
|
|
1042
1094
|
await this.sendWsMessage(command);
|
|
@@ -1224,6 +1276,42 @@ var Client = class _Client {
|
|
|
1224
1276
|
});
|
|
1225
1277
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1226
1278
|
}
|
|
1279
|
+
async changePerpOrderPrice(params) {
|
|
1280
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1281
|
+
const aptosPayload = await generateTransactionPayload({
|
|
1282
|
+
aptosConfig: this._aptos.config,
|
|
1283
|
+
abi: parseEntryFunctionAbi({
|
|
1284
|
+
moduleAbi: changePerpOrderPrice_default,
|
|
1285
|
+
functionName: changePerpOrderPrice_default.name,
|
|
1286
|
+
moduleAddress: changePerpOrderPrice_default.address,
|
|
1287
|
+
moduleName: changePerpOrderPrice_default.name
|
|
1288
|
+
}),
|
|
1289
|
+
function: `${changePerpOrderPrice_default.address}::${changePerpOrderPrice_default.name}::change_perp_order_price`,
|
|
1290
|
+
typeArguments: [],
|
|
1291
|
+
functionArguments: [
|
|
1292
|
+
params.userId,
|
|
1293
|
+
params.market,
|
|
1294
|
+
params.orderId,
|
|
1295
|
+
params.newPrice,
|
|
1296
|
+
params.postOnly
|
|
1297
|
+
]
|
|
1298
|
+
});
|
|
1299
|
+
const rawTx = new RawTransaction(
|
|
1300
|
+
AccountAddress.from(this._apiKey.accountAddress),
|
|
1301
|
+
BigInt(sequenceNumber),
|
|
1302
|
+
aptosPayload,
|
|
1303
|
+
BigInt(1e4),
|
|
1304
|
+
BigInt(100),
|
|
1305
|
+
BigInt(Date.now() + 10 * 1e3),
|
|
1306
|
+
new ChainId(this._chainId)
|
|
1307
|
+
);
|
|
1308
|
+
const tx = new SimpleTransaction(rawTx, AccountAddress.ZERO);
|
|
1309
|
+
const signature = this._aptos.sign({
|
|
1310
|
+
signer: this._apiKey,
|
|
1311
|
+
transaction: tx
|
|
1312
|
+
});
|
|
1313
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1314
|
+
}
|
|
1227
1315
|
async cancelPerpOrders(params) {
|
|
1228
1316
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1229
1317
|
const aptosPayload = await generateTransactionPayload({
|
|
@@ -1508,8 +1596,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1508
1596
|
import { createEntryPayload as createEntryPayload2 } from "@thalalabs/surf";
|
|
1509
1597
|
|
|
1510
1598
|
// generated_types/faucetEntrypoints.ts
|
|
1511
|
-
var
|
|
1512
|
-
"address": "
|
|
1599
|
+
var ABI16 = {
|
|
1600
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
1513
1601
|
"name": "faucet_entrypoints",
|
|
1514
1602
|
"friends": [],
|
|
1515
1603
|
"exposed_functions": [
|
|
@@ -1540,11 +1628,11 @@ var ABI15 = {
|
|
|
1540
1628
|
],
|
|
1541
1629
|
"structs": []
|
|
1542
1630
|
};
|
|
1543
|
-
var faucetEntrypoints_default =
|
|
1631
|
+
var faucetEntrypoints_default = ABI16;
|
|
1544
1632
|
|
|
1545
1633
|
// generated_types/testFaucet.ts
|
|
1546
|
-
var
|
|
1547
|
-
"address": "
|
|
1634
|
+
var ABI17 = {
|
|
1635
|
+
"address": "0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502",
|
|
1548
1636
|
"name": "test_faucet",
|
|
1549
1637
|
"friends": [],
|
|
1550
1638
|
"exposed_functions": [
|
|
@@ -1581,7 +1669,7 @@ var ABI16 = {
|
|
|
1581
1669
|
],
|
|
1582
1670
|
"return": [
|
|
1583
1671
|
"0x1::object::ConstructorRef",
|
|
1584
|
-
"0x1::object::Object<
|
|
1672
|
+
"0x1::object::Object<0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::Token>"
|
|
1585
1673
|
]
|
|
1586
1674
|
},
|
|
1587
1675
|
{
|
|
@@ -1720,7 +1808,7 @@ var ABI16 = {
|
|
|
1720
1808
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1721
1809
|
],
|
|
1722
1810
|
"return": [
|
|
1723
|
-
"
|
|
1811
|
+
"0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::FaucetToken"
|
|
1724
1812
|
]
|
|
1725
1813
|
}
|
|
1726
1814
|
],
|
|
@@ -1752,7 +1840,7 @@ var ABI16 = {
|
|
|
1752
1840
|
"fields": [
|
|
1753
1841
|
{
|
|
1754
1842
|
"name": "tokens",
|
|
1755
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1843
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xfc3b1b614d9cad0d6b4cd6222a205fa6b10b8b7ee1d0143b4d05691d8908f502::test_faucet::FaucetToken>"
|
|
1756
1844
|
}
|
|
1757
1845
|
]
|
|
1758
1846
|
},
|
|
@@ -1777,7 +1865,7 @@ var ABI16 = {
|
|
|
1777
1865
|
}
|
|
1778
1866
|
]
|
|
1779
1867
|
};
|
|
1780
|
-
var testFaucet_default =
|
|
1868
|
+
var testFaucet_default = ABI17;
|
|
1781
1869
|
|
|
1782
1870
|
// src/testFaucet.ts
|
|
1783
1871
|
var TestFaucet = class _TestFaucet extends client_default {
|