@nightlylabs/dex-sdk 0.0.106 → 0.0.108
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 +130 -40
- package/dist/index.d.cts +34 -8
- package/dist/index.d.ts +34 -8
- package/dist/index.js +130 -40
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,7 +66,7 @@ var import_uuid = require("uuid");
|
|
|
66
66
|
|
|
67
67
|
// generated_types/addApiKey.ts
|
|
68
68
|
var ABI = {
|
|
69
|
-
"address": "
|
|
69
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
70
70
|
"name": "add_api_key",
|
|
71
71
|
"friends": [],
|
|
72
72
|
"exposed_functions": [
|
|
@@ -91,7 +91,7 @@ var addApiKey_default = ABI;
|
|
|
91
91
|
|
|
92
92
|
// generated_types/cancelAllPerpOrders.ts
|
|
93
93
|
var ABI2 = {
|
|
94
|
-
"address": "
|
|
94
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
95
95
|
"name": "cancel_all_perp_orders",
|
|
96
96
|
"friends": [],
|
|
97
97
|
"exposed_functions": [
|
|
@@ -114,7 +114,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
114
114
|
|
|
115
115
|
// generated_types/cancelPerpOrders.ts
|
|
116
116
|
var ABI3 = {
|
|
117
|
-
"address": "
|
|
117
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
118
118
|
"name": "cancel_perp_orders",
|
|
119
119
|
"friends": [],
|
|
120
120
|
"exposed_functions": [
|
|
@@ -139,7 +139,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
139
139
|
|
|
140
140
|
// generated_types/createUser.ts
|
|
141
141
|
var ABI4 = {
|
|
142
|
-
"address": "
|
|
142
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
143
143
|
"name": "create_user",
|
|
144
144
|
"friends": [],
|
|
145
145
|
"exposed_functions": [
|
|
@@ -164,7 +164,7 @@ var createUser_default = ABI4;
|
|
|
164
164
|
|
|
165
165
|
// generated_types/depositToVault.ts
|
|
166
166
|
var ABI5 = {
|
|
167
|
-
"address": "
|
|
167
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
168
168
|
"name": "deposit_to_vault",
|
|
169
169
|
"friends": [],
|
|
170
170
|
"exposed_functions": [
|
|
@@ -189,7 +189,7 @@ var depositToVault_default = ABI5;
|
|
|
189
189
|
|
|
190
190
|
// generated_types/depositToken.ts
|
|
191
191
|
var ABI6 = {
|
|
192
|
-
"address": "
|
|
192
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
193
193
|
"name": "deposit_token",
|
|
194
194
|
"friends": [],
|
|
195
195
|
"exposed_functions": [
|
|
@@ -214,7 +214,7 @@ var depositToken_default = ABI6;
|
|
|
214
214
|
|
|
215
215
|
// generated_types/lendToken.ts
|
|
216
216
|
var ABI7 = {
|
|
217
|
-
"address": "
|
|
217
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
218
218
|
"name": "lend_token",
|
|
219
219
|
"friends": [],
|
|
220
220
|
"exposed_functions": [
|
|
@@ -240,7 +240,7 @@ var lendToken_default = ABI7;
|
|
|
240
240
|
|
|
241
241
|
// generated_types/placePerpLimitOrder.ts
|
|
242
242
|
var ABI8 = {
|
|
243
|
-
"address": "
|
|
243
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
244
244
|
"name": "place_perp_limit_order",
|
|
245
245
|
"friends": [],
|
|
246
246
|
"exposed_functions": [
|
|
@@ -269,7 +269,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
269
269
|
|
|
270
270
|
// generated_types/changePerpOrderPrice.ts
|
|
271
271
|
var ABI9 = {
|
|
272
|
-
"address": "
|
|
272
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
273
273
|
"name": "change_perp_order_price",
|
|
274
274
|
"friends": [],
|
|
275
275
|
"exposed_functions": [
|
|
@@ -296,7 +296,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
296
296
|
|
|
297
297
|
// generated_types/placePerpMarketOrder.ts
|
|
298
298
|
var ABI10 = {
|
|
299
|
-
"address": "
|
|
299
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
300
300
|
"name": "place_perp_market_order",
|
|
301
301
|
"friends": [],
|
|
302
302
|
"exposed_functions": [
|
|
@@ -324,7 +324,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
324
324
|
|
|
325
325
|
// generated_types/redeemToken.ts
|
|
326
326
|
var ABI11 = {
|
|
327
|
-
"address": "
|
|
327
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
328
328
|
"name": "redeem_token",
|
|
329
329
|
"friends": [],
|
|
330
330
|
"exposed_functions": [
|
|
@@ -350,7 +350,7 @@ var redeemToken_default = ABI11;
|
|
|
350
350
|
|
|
351
351
|
// generated_types/removeApiKey.ts
|
|
352
352
|
var ABI12 = {
|
|
353
|
-
"address": "
|
|
353
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
354
354
|
"name": "remove_api_key",
|
|
355
355
|
"friends": [],
|
|
356
356
|
"exposed_functions": [
|
|
@@ -374,7 +374,7 @@ var removeApiKey_default = ABI12;
|
|
|
374
374
|
|
|
375
375
|
// generated_types/setAliasName.ts
|
|
376
376
|
var ABI13 = {
|
|
377
|
-
"address": "
|
|
377
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
378
378
|
"name": "set_alias_name",
|
|
379
379
|
"friends": [],
|
|
380
380
|
"exposed_functions": [
|
|
@@ -398,7 +398,7 @@ var setAliasName_default = ABI13;
|
|
|
398
398
|
|
|
399
399
|
// generated_types/setAutolend.ts
|
|
400
400
|
var ABI14 = {
|
|
401
|
-
"address": "
|
|
401
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
402
402
|
"name": "set_autolend",
|
|
403
403
|
"friends": [],
|
|
404
404
|
"exposed_functions": [
|
|
@@ -422,7 +422,7 @@ var setAutolend_default = ABI14;
|
|
|
422
422
|
|
|
423
423
|
// generated_types/claimReferralFees.ts
|
|
424
424
|
var ABI15 = {
|
|
425
|
-
"address": "
|
|
425
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
426
426
|
"name": "claim_referral_fees",
|
|
427
427
|
"friends": [],
|
|
428
428
|
"exposed_functions": [
|
|
@@ -446,7 +446,7 @@ var claimReferralFees_default = ABI15;
|
|
|
446
446
|
|
|
447
447
|
// generated_types/transferToUser.ts
|
|
448
448
|
var ABI16 = {
|
|
449
|
-
"address": "
|
|
449
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
450
450
|
"name": "transfer_to_user",
|
|
451
451
|
"friends": [],
|
|
452
452
|
"exposed_functions": [
|
|
@@ -473,7 +473,7 @@ var transferToUser_default = ABI16;
|
|
|
473
473
|
|
|
474
474
|
// generated_types/placeMultiplePerpOrders.ts
|
|
475
475
|
var ABI17 = {
|
|
476
|
-
"address": "
|
|
476
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
477
477
|
"name": "place_multiple_perp_orders",
|
|
478
478
|
"friends": [],
|
|
479
479
|
"exposed_functions": [
|
|
@@ -502,7 +502,7 @@ var placeMultiplePerpOrders_default = ABI17;
|
|
|
502
502
|
|
|
503
503
|
// generated_types/claimKickbackFee.ts
|
|
504
504
|
var ABI18 = {
|
|
505
|
-
"address": "
|
|
505
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
506
506
|
"name": "claim_kickback_fee",
|
|
507
507
|
"friends": [],
|
|
508
508
|
"exposed_functions": [
|
|
@@ -525,7 +525,7 @@ var claimKickbackFee_default = ABI18;
|
|
|
525
525
|
|
|
526
526
|
// generated_types/replaceMultipleOrders.ts
|
|
527
527
|
var ABI19 = {
|
|
528
|
-
"address": "
|
|
528
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
529
529
|
"name": "replace_multiple_orders",
|
|
530
530
|
"friends": [],
|
|
531
531
|
"exposed_functions": [
|
|
@@ -553,7 +553,7 @@ var replaceMultipleOrders_default = ABI19;
|
|
|
553
553
|
|
|
554
554
|
// generated_types/claimDeposit.ts
|
|
555
555
|
var ABI20 = {
|
|
556
|
-
"address": "
|
|
556
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
557
557
|
"name": "claim_deposit",
|
|
558
558
|
"friends": [],
|
|
559
559
|
"exposed_functions": [
|
|
@@ -577,7 +577,7 @@ var claimDeposit_default = ABI20;
|
|
|
577
577
|
|
|
578
578
|
// generated_types/removeApiKeySigner.ts
|
|
579
579
|
var ABI21 = {
|
|
580
|
-
"address": "
|
|
580
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
581
581
|
"name": "remove_api_key_signer",
|
|
582
582
|
"friends": [],
|
|
583
583
|
"exposed_functions": [
|
|
@@ -601,7 +601,7 @@ var removeApiKeySigner_default = ABI21;
|
|
|
601
601
|
|
|
602
602
|
// generated_types/setReferralCode.ts
|
|
603
603
|
var ABI22 = {
|
|
604
|
-
"address": "
|
|
604
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
605
605
|
"name": "set_referral_code",
|
|
606
606
|
"friends": [],
|
|
607
607
|
"exposed_functions": [
|
|
@@ -623,6 +623,54 @@ var ABI22 = {
|
|
|
623
623
|
};
|
|
624
624
|
var setReferralCode_default = ABI22;
|
|
625
625
|
|
|
626
|
+
// generated_types/tokenizeUserVaultInvestment.ts
|
|
627
|
+
var ABI23 = {
|
|
628
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
629
|
+
"name": "tokenize_user_vault_investment",
|
|
630
|
+
"friends": [],
|
|
631
|
+
"exposed_functions": [
|
|
632
|
+
{
|
|
633
|
+
"name": "tokenize_user_vault_investment",
|
|
634
|
+
"visibility": "public",
|
|
635
|
+
"is_entry": true,
|
|
636
|
+
"is_view": false,
|
|
637
|
+
"generic_type_params": [],
|
|
638
|
+
"params": [
|
|
639
|
+
"&signer",
|
|
640
|
+
"u64",
|
|
641
|
+
"u64"
|
|
642
|
+
],
|
|
643
|
+
"return": []
|
|
644
|
+
}
|
|
645
|
+
],
|
|
646
|
+
"structs": []
|
|
647
|
+
};
|
|
648
|
+
var tokenizeUserVaultInvestment_default = ABI23;
|
|
649
|
+
|
|
650
|
+
// generated_types/addCredits.ts
|
|
651
|
+
var ABI24 = {
|
|
652
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
653
|
+
"name": "add_credits",
|
|
654
|
+
"friends": [],
|
|
655
|
+
"exposed_functions": [
|
|
656
|
+
{
|
|
657
|
+
"name": "add_credits",
|
|
658
|
+
"visibility": "public",
|
|
659
|
+
"is_entry": true,
|
|
660
|
+
"is_view": false,
|
|
661
|
+
"generic_type_params": [],
|
|
662
|
+
"params": [
|
|
663
|
+
"&signer",
|
|
664
|
+
"u64",
|
|
665
|
+
"u64"
|
|
666
|
+
],
|
|
667
|
+
"return": []
|
|
668
|
+
}
|
|
669
|
+
],
|
|
670
|
+
"structs": []
|
|
671
|
+
};
|
|
672
|
+
var addCredits_default = ABI24;
|
|
673
|
+
|
|
626
674
|
// generated_types/typeshareTypes.ts
|
|
627
675
|
var ChartInterval = /* @__PURE__ */ ((ChartInterval2) => {
|
|
628
676
|
ChartInterval2["OneMinute"] = "OneMinute";
|
|
@@ -721,8 +769,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
721
769
|
})(UserStatus || {});
|
|
722
770
|
|
|
723
771
|
// generated_types/withdrawFromVault.ts
|
|
724
|
-
var
|
|
725
|
-
"address": "
|
|
772
|
+
var ABI25 = {
|
|
773
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
726
774
|
"name": "withdraw_from_vault",
|
|
727
775
|
"friends": [],
|
|
728
776
|
"exposed_functions": [
|
|
@@ -744,7 +792,7 @@ var ABI23 = {
|
|
|
744
792
|
],
|
|
745
793
|
"structs": []
|
|
746
794
|
};
|
|
747
|
-
var withdrawFromVault_default =
|
|
795
|
+
var withdrawFromVault_default = ABI25;
|
|
748
796
|
|
|
749
797
|
// src/utils.ts
|
|
750
798
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -859,6 +907,8 @@ var getTopicFromMessage = (data) => {
|
|
|
859
907
|
return data.content.userId;
|
|
860
908
|
case "ClaimUserKickbackFee":
|
|
861
909
|
return data.content.userId;
|
|
910
|
+
case "ApiCreditsChange":
|
|
911
|
+
return data.content.userId;
|
|
862
912
|
}
|
|
863
913
|
};
|
|
864
914
|
|
|
@@ -1043,9 +1093,12 @@ var AccountSequenceNumber = class {
|
|
|
1043
1093
|
// src/client.ts
|
|
1044
1094
|
var getRandomId = () => (0, import_uuid.v4)();
|
|
1045
1095
|
var Client = class _Client {
|
|
1046
|
-
constructor(connection, enableWs, url, apiKey, chainId) {
|
|
1096
|
+
constructor(connection, enableWs, url, apiKey, chainId, params) {
|
|
1047
1097
|
this._apiKeySequenceNumber = 0;
|
|
1048
1098
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1099
|
+
this._gasUnitPrice = 100;
|
|
1100
|
+
this._expirationTimestampDelay = 20;
|
|
1101
|
+
// 20 seconds
|
|
1049
1102
|
this.timeout = 5e3;
|
|
1050
1103
|
/////////////////////////////////// Sponsored transactions
|
|
1051
1104
|
this.submitSponsoredTransaction = async (tx, signature) => {
|
|
@@ -1334,13 +1387,16 @@ var Client = class _Client {
|
|
|
1334
1387
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1335
1388
|
this._serverUrl = url || "https://api.dev.neony.exchange";
|
|
1336
1389
|
this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
|
|
1390
|
+
this._maxGas = params?.maxGas || 1e6;
|
|
1391
|
+
this._gasUnitPrice = params?.gasUnitPrice || 100;
|
|
1392
|
+
this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
|
|
1337
1393
|
if (enableWs) {
|
|
1338
1394
|
this.connectWebSocket();
|
|
1339
1395
|
}
|
|
1340
1396
|
}
|
|
1341
|
-
static async init(connection, enableWs = true, url, apiKey, chainId) {
|
|
1397
|
+
static async init(connection, enableWs = true, url, apiKey, chainId, params) {
|
|
1342
1398
|
const id = chainId || await connection.getChainId();
|
|
1343
|
-
const client = new _Client(connection, enableWs, url, apiKey, id);
|
|
1399
|
+
const client = new _Client(connection, enableWs, url, apiKey, id, params);
|
|
1344
1400
|
if (enableWs) {
|
|
1345
1401
|
client.connectWebSocket();
|
|
1346
1402
|
}
|
|
@@ -1364,6 +1420,11 @@ var Client = class _Client {
|
|
|
1364
1420
|
});
|
|
1365
1421
|
return Number(await accInfo.sequence_number);
|
|
1366
1422
|
}
|
|
1423
|
+
setTxParams(params) {
|
|
1424
|
+
this._maxGas = params.maxGas;
|
|
1425
|
+
this._gasUnitPrice = params.gasUnitPrice;
|
|
1426
|
+
this._expirationTimestampDelay = params.expirationTimestampSecs;
|
|
1427
|
+
}
|
|
1367
1428
|
//////////////////////////////////////// Websocket functions
|
|
1368
1429
|
async connectWebSocket() {
|
|
1369
1430
|
if (this._ws) {
|
|
@@ -1617,6 +1678,20 @@ var Client = class _Client {
|
|
|
1617
1678
|
functionArguments: [params.apiKeys, params.userId]
|
|
1618
1679
|
});
|
|
1619
1680
|
}
|
|
1681
|
+
async addApiCredits(params) {
|
|
1682
|
+
return await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1683
|
+
aptosConfig: this._aptos.config,
|
|
1684
|
+
abi: parseEntryFunctionAbi({
|
|
1685
|
+
moduleAbi: addCredits_default,
|
|
1686
|
+
functionName: addCredits_default.name,
|
|
1687
|
+
moduleAddress: addCredits_default.address,
|
|
1688
|
+
moduleName: addCredits_default.name
|
|
1689
|
+
}),
|
|
1690
|
+
function: `${addCredits_default.address}::${addCredits_default.name}::add_credits`,
|
|
1691
|
+
typeArguments: [],
|
|
1692
|
+
functionArguments: [params.userId, params.amount]
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1620
1695
|
// Helper function to submit sponsored transaction
|
|
1621
1696
|
async createAndSubmitTransaction(aptosPayload) {
|
|
1622
1697
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
@@ -1624,11 +1699,11 @@ var Client = class _Client {
|
|
|
1624
1699
|
import_ts_sdk2.AccountAddress.from(this._apiKey.accountAddress),
|
|
1625
1700
|
BigInt(sequenceNumber),
|
|
1626
1701
|
aptosPayload,
|
|
1627
|
-
BigInt(
|
|
1702
|
+
BigInt(this._maxGas),
|
|
1628
1703
|
// max gas
|
|
1629
|
-
BigInt(
|
|
1704
|
+
BigInt(this._gasUnitPrice),
|
|
1630
1705
|
// gas unit price
|
|
1631
|
-
BigInt(Math.floor(Date.now() / 1e3) +
|
|
1706
|
+
BigInt(Math.floor(Date.now() / 1e3) + this._expirationTimestampDelay),
|
|
1632
1707
|
// expiration timestamp
|
|
1633
1708
|
new import_ts_sdk2.ChainId(this._chainId)
|
|
1634
1709
|
);
|
|
@@ -1984,6 +2059,21 @@ var Client = class _Client {
|
|
|
1984
2059
|
});
|
|
1985
2060
|
return await this.createAndSubmitTransaction(aptosPayload);
|
|
1986
2061
|
}
|
|
2062
|
+
async tokenizeUserVaultInvestment(params) {
|
|
2063
|
+
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
2064
|
+
aptosConfig: this._aptos.config,
|
|
2065
|
+
abi: parseEntryFunctionAbi({
|
|
2066
|
+
moduleAbi: tokenizeUserVaultInvestment_default,
|
|
2067
|
+
functionName: tokenizeUserVaultInvestment_default.name,
|
|
2068
|
+
moduleAddress: tokenizeUserVaultInvestment_default.address,
|
|
2069
|
+
moduleName: tokenizeUserVaultInvestment_default.name
|
|
2070
|
+
}),
|
|
2071
|
+
function: `${tokenizeUserVaultInvestment_default.address}::${tokenizeUserVaultInvestment_default.name}::tokenize_user_vault_investment`,
|
|
2072
|
+
typeArguments: [],
|
|
2073
|
+
functionArguments: [params.userId, params.vaultId]
|
|
2074
|
+
});
|
|
2075
|
+
return await this.createAndSubmitTransaction(aptosPayload);
|
|
2076
|
+
}
|
|
1987
2077
|
};
|
|
1988
2078
|
var client_default = Client;
|
|
1989
2079
|
function parseEntryFunctionAbi(args) {
|
|
@@ -2015,8 +2105,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
2015
2105
|
var import_surf2 = require("@thalalabs/surf");
|
|
2016
2106
|
|
|
2017
2107
|
// generated_types/faucetEntrypoints.ts
|
|
2018
|
-
var
|
|
2019
|
-
"address": "
|
|
2108
|
+
var ABI26 = {
|
|
2109
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
2020
2110
|
"name": "faucet_entrypoints",
|
|
2021
2111
|
"friends": [],
|
|
2022
2112
|
"exposed_functions": [
|
|
@@ -2047,11 +2137,11 @@ var ABI24 = {
|
|
|
2047
2137
|
],
|
|
2048
2138
|
"structs": []
|
|
2049
2139
|
};
|
|
2050
|
-
var faucetEntrypoints_default =
|
|
2140
|
+
var faucetEntrypoints_default = ABI26;
|
|
2051
2141
|
|
|
2052
2142
|
// generated_types/testFaucet.ts
|
|
2053
|
-
var
|
|
2054
|
-
"address": "
|
|
2143
|
+
var ABI27 = {
|
|
2144
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
2055
2145
|
"name": "test_faucet",
|
|
2056
2146
|
"friends": [],
|
|
2057
2147
|
"exposed_functions": [
|
|
@@ -2088,7 +2178,7 @@ var ABI25 = {
|
|
|
2088
2178
|
],
|
|
2089
2179
|
"return": [
|
|
2090
2180
|
"0x1::object::ConstructorRef",
|
|
2091
|
-
"0x1::object::Object<
|
|
2181
|
+
"0x1::object::Object<0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::Token>"
|
|
2092
2182
|
]
|
|
2093
2183
|
},
|
|
2094
2184
|
{
|
|
@@ -2239,7 +2329,7 @@ var ABI25 = {
|
|
|
2239
2329
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2240
2330
|
],
|
|
2241
2331
|
"return": [
|
|
2242
|
-
"
|
|
2332
|
+
"0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::FaucetToken"
|
|
2243
2333
|
]
|
|
2244
2334
|
}
|
|
2245
2335
|
],
|
|
@@ -2271,7 +2361,7 @@ var ABI25 = {
|
|
|
2271
2361
|
"fields": [
|
|
2272
2362
|
{
|
|
2273
2363
|
"name": "tokens",
|
|
2274
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2364
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::FaucetToken>"
|
|
2275
2365
|
}
|
|
2276
2366
|
]
|
|
2277
2367
|
},
|
|
@@ -2296,7 +2386,7 @@ var ABI25 = {
|
|
|
2296
2386
|
}
|
|
2297
2387
|
]
|
|
2298
2388
|
};
|
|
2299
|
-
var testFaucet_default =
|
|
2389
|
+
var testFaucet_default = ABI27;
|
|
2300
2390
|
|
|
2301
2391
|
// src/testFaucet.ts
|
|
2302
2392
|
var TestFaucet = class _TestFaucet extends client_default {
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,10 @@ interface AddApiKey {
|
|
|
10
10
|
apiKey: string;
|
|
11
11
|
expirationTimestamp: string;
|
|
12
12
|
}
|
|
13
|
+
interface ApiCreditsChange {
|
|
14
|
+
userId: string;
|
|
15
|
+
currentCreditsAmount: string;
|
|
16
|
+
}
|
|
13
17
|
interface ApiStatus {
|
|
14
18
|
timestamp: string;
|
|
15
19
|
currentProcessedBlock: string;
|
|
@@ -180,13 +184,12 @@ interface ExchangeConfig {
|
|
|
180
184
|
usdcAddress?: string;
|
|
181
185
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
182
186
|
feeTiers: Record<string, FeeTier>;
|
|
187
|
+
basicMakerFee: string;
|
|
188
|
+
basicTakerFee: string;
|
|
183
189
|
}
|
|
184
190
|
interface FeeTier {
|
|
185
191
|
volume: string;
|
|
186
|
-
|
|
187
|
-
perpMakerFee: string;
|
|
188
|
-
spotTakerFee: string;
|
|
189
|
-
spotMakerFee: string;
|
|
192
|
+
cashback: string;
|
|
190
193
|
}
|
|
191
194
|
interface Fees {
|
|
192
195
|
tier: string;
|
|
@@ -513,6 +516,7 @@ interface User {
|
|
|
513
516
|
fees: Fees;
|
|
514
517
|
referral: Referral;
|
|
515
518
|
vault?: Vault;
|
|
519
|
+
credits: string;
|
|
516
520
|
}
|
|
517
521
|
interface GetUserDataResponse {
|
|
518
522
|
userData: User;
|
|
@@ -1003,6 +1007,9 @@ type WsMessage = {
|
|
|
1003
1007
|
} | {
|
|
1004
1008
|
type: "MarketStatusChange";
|
|
1005
1009
|
content: MarketStatusChange;
|
|
1010
|
+
} | {
|
|
1011
|
+
type: "ApiCreditsChange";
|
|
1012
|
+
content: ApiCreditsChange;
|
|
1006
1013
|
};
|
|
1007
1014
|
|
|
1008
1015
|
type Address = `0x${string}`;
|
|
@@ -1015,6 +1022,11 @@ declare enum Status {
|
|
|
1015
1022
|
declare enum Network {
|
|
1016
1023
|
Devnet = "Devnet"
|
|
1017
1024
|
}
|
|
1025
|
+
interface TxParams {
|
|
1026
|
+
maxGas: number;
|
|
1027
|
+
gasUnitPrice: number;
|
|
1028
|
+
expirationTimestampSecs: number;
|
|
1029
|
+
}
|
|
1018
1030
|
interface ChangePerpOrderPriceParams {
|
|
1019
1031
|
userId: string;
|
|
1020
1032
|
market: string;
|
|
@@ -1047,6 +1059,10 @@ interface RemoveApiKeySignerParams {
|
|
|
1047
1059
|
apiKeys: Address[];
|
|
1048
1060
|
userId: string;
|
|
1049
1061
|
}
|
|
1062
|
+
interface AddApiCreditsParams {
|
|
1063
|
+
userId: string;
|
|
1064
|
+
amount: number;
|
|
1065
|
+
}
|
|
1050
1066
|
interface CreateUserParams {
|
|
1051
1067
|
sender: Address;
|
|
1052
1068
|
name: string;
|
|
@@ -1140,11 +1156,15 @@ interface SetReferralCodeParams {
|
|
|
1140
1156
|
userId: string;
|
|
1141
1157
|
referralCode: string;
|
|
1142
1158
|
}
|
|
1159
|
+
interface TokenizeUserVaultInvestmentParams {
|
|
1160
|
+
userId: string;
|
|
1161
|
+
vaultId: string;
|
|
1162
|
+
}
|
|
1143
1163
|
type WsOracleUpdates = Extract<WsMessage, {
|
|
1144
1164
|
type: 'OracleUpdates';
|
|
1145
1165
|
}>;
|
|
1146
1166
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1147
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate';
|
|
1167
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange';
|
|
1148
1168
|
}>;
|
|
1149
1169
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1150
1170
|
type: 'OrderbookUpdate' | 'TradesUpdate' | 'MarketStatusChange';
|
|
@@ -1245,13 +1265,17 @@ declare class Client {
|
|
|
1245
1265
|
_serverUrl: string;
|
|
1246
1266
|
_subscriptions: Map<string, (data: WsMessage) => void>;
|
|
1247
1267
|
_sequenceNumberManager: AccountSequenceNumber;
|
|
1268
|
+
_maxGas: number;
|
|
1269
|
+
_gasUnitPrice: number;
|
|
1270
|
+
_expirationTimestampDelay: number;
|
|
1248
1271
|
timeout: number;
|
|
1249
|
-
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number): Promise<Client>;
|
|
1250
|
-
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number);
|
|
1272
|
+
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams): Promise<Client>;
|
|
1273
|
+
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams);
|
|
1251
1274
|
static create(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
|
|
1252
1275
|
setApiKey(apiKey: Account): Promise<void>;
|
|
1253
1276
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
1254
1277
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
1278
|
+
setTxParams(params: TxParams): void;
|
|
1255
1279
|
connectWebSocket(): Promise<void>;
|
|
1256
1280
|
private _setupWebSocketHandlers;
|
|
1257
1281
|
static initWebSocket(url: string, timeout?: number): Promise<WebSocket>;
|
|
@@ -1278,6 +1302,7 @@ declare class Client {
|
|
|
1278
1302
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1279
1303
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1280
1304
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1305
|
+
addApiCredits(params: AddApiCreditsParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1281
1306
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1282
1307
|
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1283
1308
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -1300,6 +1325,7 @@ declare class Client {
|
|
|
1300
1325
|
placeMultiplePerpOrders(params: PlaceMultiplePerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1301
1326
|
claimDeposit(params: ClaimDepositParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1302
1327
|
setReferralCode(params: SetReferralCodeParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1328
|
+
tokenizeUserVaultInvestment(params: TokenizeUserVaultInvestmentParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1303
1329
|
setReferralParams: (request: SetReferralParamsRequest) => Promise<void>;
|
|
1304
1330
|
sendGetJson: (endpoint: string, message?: {
|
|
1305
1331
|
[key: string]: any;
|
|
@@ -1366,4 +1392,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1366
1392
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1367
1393
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1368
1394
|
|
|
1369
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, 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 GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, type TransferToUserParams, type UpdateUserFeeTier, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UserTransfer, 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 };
|
|
1395
|
+
export { type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, 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 GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type TokenizeUserVaultInvestmentParams, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, type TransferToUserParams, type TxParams, type UpdateUserFeeTier, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UserTransfer, 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
|
@@ -10,6 +10,10 @@ interface AddApiKey {
|
|
|
10
10
|
apiKey: string;
|
|
11
11
|
expirationTimestamp: string;
|
|
12
12
|
}
|
|
13
|
+
interface ApiCreditsChange {
|
|
14
|
+
userId: string;
|
|
15
|
+
currentCreditsAmount: string;
|
|
16
|
+
}
|
|
13
17
|
interface ApiStatus {
|
|
14
18
|
timestamp: string;
|
|
15
19
|
currentProcessedBlock: string;
|
|
@@ -180,13 +184,12 @@ interface ExchangeConfig {
|
|
|
180
184
|
usdcAddress?: string;
|
|
181
185
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
182
186
|
feeTiers: Record<string, FeeTier>;
|
|
187
|
+
basicMakerFee: string;
|
|
188
|
+
basicTakerFee: string;
|
|
183
189
|
}
|
|
184
190
|
interface FeeTier {
|
|
185
191
|
volume: string;
|
|
186
|
-
|
|
187
|
-
perpMakerFee: string;
|
|
188
|
-
spotTakerFee: string;
|
|
189
|
-
spotMakerFee: string;
|
|
192
|
+
cashback: string;
|
|
190
193
|
}
|
|
191
194
|
interface Fees {
|
|
192
195
|
tier: string;
|
|
@@ -513,6 +516,7 @@ interface User {
|
|
|
513
516
|
fees: Fees;
|
|
514
517
|
referral: Referral;
|
|
515
518
|
vault?: Vault;
|
|
519
|
+
credits: string;
|
|
516
520
|
}
|
|
517
521
|
interface GetUserDataResponse {
|
|
518
522
|
userData: User;
|
|
@@ -1003,6 +1007,9 @@ type WsMessage = {
|
|
|
1003
1007
|
} | {
|
|
1004
1008
|
type: "MarketStatusChange";
|
|
1005
1009
|
content: MarketStatusChange;
|
|
1010
|
+
} | {
|
|
1011
|
+
type: "ApiCreditsChange";
|
|
1012
|
+
content: ApiCreditsChange;
|
|
1006
1013
|
};
|
|
1007
1014
|
|
|
1008
1015
|
type Address = `0x${string}`;
|
|
@@ -1015,6 +1022,11 @@ declare enum Status {
|
|
|
1015
1022
|
declare enum Network {
|
|
1016
1023
|
Devnet = "Devnet"
|
|
1017
1024
|
}
|
|
1025
|
+
interface TxParams {
|
|
1026
|
+
maxGas: number;
|
|
1027
|
+
gasUnitPrice: number;
|
|
1028
|
+
expirationTimestampSecs: number;
|
|
1029
|
+
}
|
|
1018
1030
|
interface ChangePerpOrderPriceParams {
|
|
1019
1031
|
userId: string;
|
|
1020
1032
|
market: string;
|
|
@@ -1047,6 +1059,10 @@ interface RemoveApiKeySignerParams {
|
|
|
1047
1059
|
apiKeys: Address[];
|
|
1048
1060
|
userId: string;
|
|
1049
1061
|
}
|
|
1062
|
+
interface AddApiCreditsParams {
|
|
1063
|
+
userId: string;
|
|
1064
|
+
amount: number;
|
|
1065
|
+
}
|
|
1050
1066
|
interface CreateUserParams {
|
|
1051
1067
|
sender: Address;
|
|
1052
1068
|
name: string;
|
|
@@ -1140,11 +1156,15 @@ interface SetReferralCodeParams {
|
|
|
1140
1156
|
userId: string;
|
|
1141
1157
|
referralCode: string;
|
|
1142
1158
|
}
|
|
1159
|
+
interface TokenizeUserVaultInvestmentParams {
|
|
1160
|
+
userId: string;
|
|
1161
|
+
vaultId: string;
|
|
1162
|
+
}
|
|
1143
1163
|
type WsOracleUpdates = Extract<WsMessage, {
|
|
1144
1164
|
type: 'OracleUpdates';
|
|
1145
1165
|
}>;
|
|
1146
1166
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1147
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate';
|
|
1167
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange';
|
|
1148
1168
|
}>;
|
|
1149
1169
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1150
1170
|
type: 'OrderbookUpdate' | 'TradesUpdate' | 'MarketStatusChange';
|
|
@@ -1245,13 +1265,17 @@ declare class Client {
|
|
|
1245
1265
|
_serverUrl: string;
|
|
1246
1266
|
_subscriptions: Map<string, (data: WsMessage) => void>;
|
|
1247
1267
|
_sequenceNumberManager: AccountSequenceNumber;
|
|
1268
|
+
_maxGas: number;
|
|
1269
|
+
_gasUnitPrice: number;
|
|
1270
|
+
_expirationTimestampDelay: number;
|
|
1248
1271
|
timeout: number;
|
|
1249
|
-
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number): Promise<Client>;
|
|
1250
|
-
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number);
|
|
1272
|
+
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams): Promise<Client>;
|
|
1273
|
+
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams);
|
|
1251
1274
|
static create(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
|
|
1252
1275
|
setApiKey(apiKey: Account): Promise<void>;
|
|
1253
1276
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
1254
1277
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
1278
|
+
setTxParams(params: TxParams): void;
|
|
1255
1279
|
connectWebSocket(): Promise<void>;
|
|
1256
1280
|
private _setupWebSocketHandlers;
|
|
1257
1281
|
static initWebSocket(url: string, timeout?: number): Promise<WebSocket>;
|
|
@@ -1278,6 +1302,7 @@ declare class Client {
|
|
|
1278
1302
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1279
1303
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1280
1304
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1305
|
+
addApiCredits(params: AddApiCreditsParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1281
1306
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1282
1307
|
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1283
1308
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -1300,6 +1325,7 @@ declare class Client {
|
|
|
1300
1325
|
placeMultiplePerpOrders(params: PlaceMultiplePerpOrdersParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1301
1326
|
claimDeposit(params: ClaimDepositParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1302
1327
|
setReferralCode(params: SetReferralCodeParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1328
|
+
tokenizeUserVaultInvestment(params: TokenizeUserVaultInvestmentParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1303
1329
|
setReferralParams: (request: SetReferralParamsRequest) => Promise<void>;
|
|
1304
1330
|
sendGetJson: (endpoint: string, message?: {
|
|
1305
1331
|
[key: string]: any;
|
|
@@ -1366,4 +1392,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1366
1392
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1367
1393
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1368
1394
|
|
|
1369
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, 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 GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, type TransferToUserParams, type UpdateUserFeeTier, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UserTransfer, 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 };
|
|
1395
|
+
export { type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, 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 GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type TokenizeUserVaultInvestmentParams, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, type TransferToUserParams, type TxParams, type UpdateUserFeeTier, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UserTransfer, 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
|
@@ -16,7 +16,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
16
16
|
|
|
17
17
|
// generated_types/addApiKey.ts
|
|
18
18
|
var ABI = {
|
|
19
|
-
"address": "
|
|
19
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
20
20
|
"name": "add_api_key",
|
|
21
21
|
"friends": [],
|
|
22
22
|
"exposed_functions": [
|
|
@@ -41,7 +41,7 @@ var addApiKey_default = ABI;
|
|
|
41
41
|
|
|
42
42
|
// generated_types/cancelAllPerpOrders.ts
|
|
43
43
|
var ABI2 = {
|
|
44
|
-
"address": "
|
|
44
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
45
45
|
"name": "cancel_all_perp_orders",
|
|
46
46
|
"friends": [],
|
|
47
47
|
"exposed_functions": [
|
|
@@ -64,7 +64,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
64
64
|
|
|
65
65
|
// generated_types/cancelPerpOrders.ts
|
|
66
66
|
var ABI3 = {
|
|
67
|
-
"address": "
|
|
67
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
68
68
|
"name": "cancel_perp_orders",
|
|
69
69
|
"friends": [],
|
|
70
70
|
"exposed_functions": [
|
|
@@ -89,7 +89,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
89
89
|
|
|
90
90
|
// generated_types/createUser.ts
|
|
91
91
|
var ABI4 = {
|
|
92
|
-
"address": "
|
|
92
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
93
93
|
"name": "create_user",
|
|
94
94
|
"friends": [],
|
|
95
95
|
"exposed_functions": [
|
|
@@ -114,7 +114,7 @@ var createUser_default = ABI4;
|
|
|
114
114
|
|
|
115
115
|
// generated_types/depositToVault.ts
|
|
116
116
|
var ABI5 = {
|
|
117
|
-
"address": "
|
|
117
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
118
118
|
"name": "deposit_to_vault",
|
|
119
119
|
"friends": [],
|
|
120
120
|
"exposed_functions": [
|
|
@@ -139,7 +139,7 @@ var depositToVault_default = ABI5;
|
|
|
139
139
|
|
|
140
140
|
// generated_types/depositToken.ts
|
|
141
141
|
var ABI6 = {
|
|
142
|
-
"address": "
|
|
142
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
143
143
|
"name": "deposit_token",
|
|
144
144
|
"friends": [],
|
|
145
145
|
"exposed_functions": [
|
|
@@ -164,7 +164,7 @@ var depositToken_default = ABI6;
|
|
|
164
164
|
|
|
165
165
|
// generated_types/lendToken.ts
|
|
166
166
|
var ABI7 = {
|
|
167
|
-
"address": "
|
|
167
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
168
168
|
"name": "lend_token",
|
|
169
169
|
"friends": [],
|
|
170
170
|
"exposed_functions": [
|
|
@@ -190,7 +190,7 @@ var lendToken_default = ABI7;
|
|
|
190
190
|
|
|
191
191
|
// generated_types/placePerpLimitOrder.ts
|
|
192
192
|
var ABI8 = {
|
|
193
|
-
"address": "
|
|
193
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
194
194
|
"name": "place_perp_limit_order",
|
|
195
195
|
"friends": [],
|
|
196
196
|
"exposed_functions": [
|
|
@@ -219,7 +219,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
219
219
|
|
|
220
220
|
// generated_types/changePerpOrderPrice.ts
|
|
221
221
|
var ABI9 = {
|
|
222
|
-
"address": "
|
|
222
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
223
223
|
"name": "change_perp_order_price",
|
|
224
224
|
"friends": [],
|
|
225
225
|
"exposed_functions": [
|
|
@@ -246,7 +246,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
246
246
|
|
|
247
247
|
// generated_types/placePerpMarketOrder.ts
|
|
248
248
|
var ABI10 = {
|
|
249
|
-
"address": "
|
|
249
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
250
250
|
"name": "place_perp_market_order",
|
|
251
251
|
"friends": [],
|
|
252
252
|
"exposed_functions": [
|
|
@@ -274,7 +274,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
274
274
|
|
|
275
275
|
// generated_types/redeemToken.ts
|
|
276
276
|
var ABI11 = {
|
|
277
|
-
"address": "
|
|
277
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
278
278
|
"name": "redeem_token",
|
|
279
279
|
"friends": [],
|
|
280
280
|
"exposed_functions": [
|
|
@@ -300,7 +300,7 @@ var redeemToken_default = ABI11;
|
|
|
300
300
|
|
|
301
301
|
// generated_types/removeApiKey.ts
|
|
302
302
|
var ABI12 = {
|
|
303
|
-
"address": "
|
|
303
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
304
304
|
"name": "remove_api_key",
|
|
305
305
|
"friends": [],
|
|
306
306
|
"exposed_functions": [
|
|
@@ -324,7 +324,7 @@ var removeApiKey_default = ABI12;
|
|
|
324
324
|
|
|
325
325
|
// generated_types/setAliasName.ts
|
|
326
326
|
var ABI13 = {
|
|
327
|
-
"address": "
|
|
327
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
328
328
|
"name": "set_alias_name",
|
|
329
329
|
"friends": [],
|
|
330
330
|
"exposed_functions": [
|
|
@@ -348,7 +348,7 @@ var setAliasName_default = ABI13;
|
|
|
348
348
|
|
|
349
349
|
// generated_types/setAutolend.ts
|
|
350
350
|
var ABI14 = {
|
|
351
|
-
"address": "
|
|
351
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
352
352
|
"name": "set_autolend",
|
|
353
353
|
"friends": [],
|
|
354
354
|
"exposed_functions": [
|
|
@@ -372,7 +372,7 @@ var setAutolend_default = ABI14;
|
|
|
372
372
|
|
|
373
373
|
// generated_types/claimReferralFees.ts
|
|
374
374
|
var ABI15 = {
|
|
375
|
-
"address": "
|
|
375
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
376
376
|
"name": "claim_referral_fees",
|
|
377
377
|
"friends": [],
|
|
378
378
|
"exposed_functions": [
|
|
@@ -396,7 +396,7 @@ var claimReferralFees_default = ABI15;
|
|
|
396
396
|
|
|
397
397
|
// generated_types/transferToUser.ts
|
|
398
398
|
var ABI16 = {
|
|
399
|
-
"address": "
|
|
399
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
400
400
|
"name": "transfer_to_user",
|
|
401
401
|
"friends": [],
|
|
402
402
|
"exposed_functions": [
|
|
@@ -423,7 +423,7 @@ var transferToUser_default = ABI16;
|
|
|
423
423
|
|
|
424
424
|
// generated_types/placeMultiplePerpOrders.ts
|
|
425
425
|
var ABI17 = {
|
|
426
|
-
"address": "
|
|
426
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
427
427
|
"name": "place_multiple_perp_orders",
|
|
428
428
|
"friends": [],
|
|
429
429
|
"exposed_functions": [
|
|
@@ -452,7 +452,7 @@ var placeMultiplePerpOrders_default = ABI17;
|
|
|
452
452
|
|
|
453
453
|
// generated_types/claimKickbackFee.ts
|
|
454
454
|
var ABI18 = {
|
|
455
|
-
"address": "
|
|
455
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
456
456
|
"name": "claim_kickback_fee",
|
|
457
457
|
"friends": [],
|
|
458
458
|
"exposed_functions": [
|
|
@@ -475,7 +475,7 @@ var claimKickbackFee_default = ABI18;
|
|
|
475
475
|
|
|
476
476
|
// generated_types/replaceMultipleOrders.ts
|
|
477
477
|
var ABI19 = {
|
|
478
|
-
"address": "
|
|
478
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
479
479
|
"name": "replace_multiple_orders",
|
|
480
480
|
"friends": [],
|
|
481
481
|
"exposed_functions": [
|
|
@@ -503,7 +503,7 @@ var replaceMultipleOrders_default = ABI19;
|
|
|
503
503
|
|
|
504
504
|
// generated_types/claimDeposit.ts
|
|
505
505
|
var ABI20 = {
|
|
506
|
-
"address": "
|
|
506
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
507
507
|
"name": "claim_deposit",
|
|
508
508
|
"friends": [],
|
|
509
509
|
"exposed_functions": [
|
|
@@ -527,7 +527,7 @@ var claimDeposit_default = ABI20;
|
|
|
527
527
|
|
|
528
528
|
// generated_types/removeApiKeySigner.ts
|
|
529
529
|
var ABI21 = {
|
|
530
|
-
"address": "
|
|
530
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
531
531
|
"name": "remove_api_key_signer",
|
|
532
532
|
"friends": [],
|
|
533
533
|
"exposed_functions": [
|
|
@@ -551,7 +551,7 @@ var removeApiKeySigner_default = ABI21;
|
|
|
551
551
|
|
|
552
552
|
// generated_types/setReferralCode.ts
|
|
553
553
|
var ABI22 = {
|
|
554
|
-
"address": "
|
|
554
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
555
555
|
"name": "set_referral_code",
|
|
556
556
|
"friends": [],
|
|
557
557
|
"exposed_functions": [
|
|
@@ -573,6 +573,54 @@ var ABI22 = {
|
|
|
573
573
|
};
|
|
574
574
|
var setReferralCode_default = ABI22;
|
|
575
575
|
|
|
576
|
+
// generated_types/tokenizeUserVaultInvestment.ts
|
|
577
|
+
var ABI23 = {
|
|
578
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
579
|
+
"name": "tokenize_user_vault_investment",
|
|
580
|
+
"friends": [],
|
|
581
|
+
"exposed_functions": [
|
|
582
|
+
{
|
|
583
|
+
"name": "tokenize_user_vault_investment",
|
|
584
|
+
"visibility": "public",
|
|
585
|
+
"is_entry": true,
|
|
586
|
+
"is_view": false,
|
|
587
|
+
"generic_type_params": [],
|
|
588
|
+
"params": [
|
|
589
|
+
"&signer",
|
|
590
|
+
"u64",
|
|
591
|
+
"u64"
|
|
592
|
+
],
|
|
593
|
+
"return": []
|
|
594
|
+
}
|
|
595
|
+
],
|
|
596
|
+
"structs": []
|
|
597
|
+
};
|
|
598
|
+
var tokenizeUserVaultInvestment_default = ABI23;
|
|
599
|
+
|
|
600
|
+
// generated_types/addCredits.ts
|
|
601
|
+
var ABI24 = {
|
|
602
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
603
|
+
"name": "add_credits",
|
|
604
|
+
"friends": [],
|
|
605
|
+
"exposed_functions": [
|
|
606
|
+
{
|
|
607
|
+
"name": "add_credits",
|
|
608
|
+
"visibility": "public",
|
|
609
|
+
"is_entry": true,
|
|
610
|
+
"is_view": false,
|
|
611
|
+
"generic_type_params": [],
|
|
612
|
+
"params": [
|
|
613
|
+
"&signer",
|
|
614
|
+
"u64",
|
|
615
|
+
"u64"
|
|
616
|
+
],
|
|
617
|
+
"return": []
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
"structs": []
|
|
621
|
+
};
|
|
622
|
+
var addCredits_default = ABI24;
|
|
623
|
+
|
|
576
624
|
// generated_types/typeshareTypes.ts
|
|
577
625
|
var ChartInterval = /* @__PURE__ */ ((ChartInterval2) => {
|
|
578
626
|
ChartInterval2["OneMinute"] = "OneMinute";
|
|
@@ -671,8 +719,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
671
719
|
})(UserStatus || {});
|
|
672
720
|
|
|
673
721
|
// generated_types/withdrawFromVault.ts
|
|
674
|
-
var
|
|
675
|
-
"address": "
|
|
722
|
+
var ABI25 = {
|
|
723
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
676
724
|
"name": "withdraw_from_vault",
|
|
677
725
|
"friends": [],
|
|
678
726
|
"exposed_functions": [
|
|
@@ -694,7 +742,7 @@ var ABI23 = {
|
|
|
694
742
|
],
|
|
695
743
|
"structs": []
|
|
696
744
|
};
|
|
697
|
-
var withdrawFromVault_default =
|
|
745
|
+
var withdrawFromVault_default = ABI25;
|
|
698
746
|
|
|
699
747
|
// src/utils.ts
|
|
700
748
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -809,6 +857,8 @@ var getTopicFromMessage = (data) => {
|
|
|
809
857
|
return data.content.userId;
|
|
810
858
|
case "ClaimUserKickbackFee":
|
|
811
859
|
return data.content.userId;
|
|
860
|
+
case "ApiCreditsChange":
|
|
861
|
+
return data.content.userId;
|
|
812
862
|
}
|
|
813
863
|
};
|
|
814
864
|
|
|
@@ -993,9 +1043,12 @@ var AccountSequenceNumber = class {
|
|
|
993
1043
|
// src/client.ts
|
|
994
1044
|
var getRandomId = () => uuidv4();
|
|
995
1045
|
var Client = class _Client {
|
|
996
|
-
constructor(connection, enableWs, url, apiKey, chainId) {
|
|
1046
|
+
constructor(connection, enableWs, url, apiKey, chainId, params) {
|
|
997
1047
|
this._apiKeySequenceNumber = 0;
|
|
998
1048
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1049
|
+
this._gasUnitPrice = 100;
|
|
1050
|
+
this._expirationTimestampDelay = 20;
|
|
1051
|
+
// 20 seconds
|
|
999
1052
|
this.timeout = 5e3;
|
|
1000
1053
|
/////////////////////////////////// Sponsored transactions
|
|
1001
1054
|
this.submitSponsoredTransaction = async (tx, signature) => {
|
|
@@ -1284,13 +1337,16 @@ var Client = class _Client {
|
|
|
1284
1337
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1285
1338
|
this._serverUrl = url || "https://api.dev.neony.exchange";
|
|
1286
1339
|
this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
|
|
1340
|
+
this._maxGas = params?.maxGas || 1e6;
|
|
1341
|
+
this._gasUnitPrice = params?.gasUnitPrice || 100;
|
|
1342
|
+
this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
|
|
1287
1343
|
if (enableWs) {
|
|
1288
1344
|
this.connectWebSocket();
|
|
1289
1345
|
}
|
|
1290
1346
|
}
|
|
1291
|
-
static async init(connection, enableWs = true, url, apiKey, chainId) {
|
|
1347
|
+
static async init(connection, enableWs = true, url, apiKey, chainId, params) {
|
|
1292
1348
|
const id = chainId || await connection.getChainId();
|
|
1293
|
-
const client = new _Client(connection, enableWs, url, apiKey, id);
|
|
1349
|
+
const client = new _Client(connection, enableWs, url, apiKey, id, params);
|
|
1294
1350
|
if (enableWs) {
|
|
1295
1351
|
client.connectWebSocket();
|
|
1296
1352
|
}
|
|
@@ -1314,6 +1370,11 @@ var Client = class _Client {
|
|
|
1314
1370
|
});
|
|
1315
1371
|
return Number(await accInfo.sequence_number);
|
|
1316
1372
|
}
|
|
1373
|
+
setTxParams(params) {
|
|
1374
|
+
this._maxGas = params.maxGas;
|
|
1375
|
+
this._gasUnitPrice = params.gasUnitPrice;
|
|
1376
|
+
this._expirationTimestampDelay = params.expirationTimestampSecs;
|
|
1377
|
+
}
|
|
1317
1378
|
//////////////////////////////////////// Websocket functions
|
|
1318
1379
|
async connectWebSocket() {
|
|
1319
1380
|
if (this._ws) {
|
|
@@ -1567,6 +1628,20 @@ var Client = class _Client {
|
|
|
1567
1628
|
functionArguments: [params.apiKeys, params.userId]
|
|
1568
1629
|
});
|
|
1569
1630
|
}
|
|
1631
|
+
async addApiCredits(params) {
|
|
1632
|
+
return await generateTransactionPayload({
|
|
1633
|
+
aptosConfig: this._aptos.config,
|
|
1634
|
+
abi: parseEntryFunctionAbi({
|
|
1635
|
+
moduleAbi: addCredits_default,
|
|
1636
|
+
functionName: addCredits_default.name,
|
|
1637
|
+
moduleAddress: addCredits_default.address,
|
|
1638
|
+
moduleName: addCredits_default.name
|
|
1639
|
+
}),
|
|
1640
|
+
function: `${addCredits_default.address}::${addCredits_default.name}::add_credits`,
|
|
1641
|
+
typeArguments: [],
|
|
1642
|
+
functionArguments: [params.userId, params.amount]
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1570
1645
|
// Helper function to submit sponsored transaction
|
|
1571
1646
|
async createAndSubmitTransaction(aptosPayload) {
|
|
1572
1647
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
@@ -1574,11 +1649,11 @@ var Client = class _Client {
|
|
|
1574
1649
|
AccountAddress.from(this._apiKey.accountAddress),
|
|
1575
1650
|
BigInt(sequenceNumber),
|
|
1576
1651
|
aptosPayload,
|
|
1577
|
-
BigInt(
|
|
1652
|
+
BigInt(this._maxGas),
|
|
1578
1653
|
// max gas
|
|
1579
|
-
BigInt(
|
|
1654
|
+
BigInt(this._gasUnitPrice),
|
|
1580
1655
|
// gas unit price
|
|
1581
|
-
BigInt(Math.floor(Date.now() / 1e3) +
|
|
1656
|
+
BigInt(Math.floor(Date.now() / 1e3) + this._expirationTimestampDelay),
|
|
1582
1657
|
// expiration timestamp
|
|
1583
1658
|
new ChainId(this._chainId)
|
|
1584
1659
|
);
|
|
@@ -1934,6 +2009,21 @@ var Client = class _Client {
|
|
|
1934
2009
|
});
|
|
1935
2010
|
return await this.createAndSubmitTransaction(aptosPayload);
|
|
1936
2011
|
}
|
|
2012
|
+
async tokenizeUserVaultInvestment(params) {
|
|
2013
|
+
const aptosPayload = await generateTransactionPayload({
|
|
2014
|
+
aptosConfig: this._aptos.config,
|
|
2015
|
+
abi: parseEntryFunctionAbi({
|
|
2016
|
+
moduleAbi: tokenizeUserVaultInvestment_default,
|
|
2017
|
+
functionName: tokenizeUserVaultInvestment_default.name,
|
|
2018
|
+
moduleAddress: tokenizeUserVaultInvestment_default.address,
|
|
2019
|
+
moduleName: tokenizeUserVaultInvestment_default.name
|
|
2020
|
+
}),
|
|
2021
|
+
function: `${tokenizeUserVaultInvestment_default.address}::${tokenizeUserVaultInvestment_default.name}::tokenize_user_vault_investment`,
|
|
2022
|
+
typeArguments: [],
|
|
2023
|
+
functionArguments: [params.userId, params.vaultId]
|
|
2024
|
+
});
|
|
2025
|
+
return await this.createAndSubmitTransaction(aptosPayload);
|
|
2026
|
+
}
|
|
1937
2027
|
};
|
|
1938
2028
|
var client_default = Client;
|
|
1939
2029
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1965,8 +2055,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1965
2055
|
import { createEntryPayload } from "@thalalabs/surf";
|
|
1966
2056
|
|
|
1967
2057
|
// generated_types/faucetEntrypoints.ts
|
|
1968
|
-
var
|
|
1969
|
-
"address": "
|
|
2058
|
+
var ABI26 = {
|
|
2059
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
1970
2060
|
"name": "faucet_entrypoints",
|
|
1971
2061
|
"friends": [],
|
|
1972
2062
|
"exposed_functions": [
|
|
@@ -1997,11 +2087,11 @@ var ABI24 = {
|
|
|
1997
2087
|
],
|
|
1998
2088
|
"structs": []
|
|
1999
2089
|
};
|
|
2000
|
-
var faucetEntrypoints_default =
|
|
2090
|
+
var faucetEntrypoints_default = ABI26;
|
|
2001
2091
|
|
|
2002
2092
|
// generated_types/testFaucet.ts
|
|
2003
|
-
var
|
|
2004
|
-
"address": "
|
|
2093
|
+
var ABI27 = {
|
|
2094
|
+
"address": "0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02",
|
|
2005
2095
|
"name": "test_faucet",
|
|
2006
2096
|
"friends": [],
|
|
2007
2097
|
"exposed_functions": [
|
|
@@ -2038,7 +2128,7 @@ var ABI25 = {
|
|
|
2038
2128
|
],
|
|
2039
2129
|
"return": [
|
|
2040
2130
|
"0x1::object::ConstructorRef",
|
|
2041
|
-
"0x1::object::Object<
|
|
2131
|
+
"0x1::object::Object<0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::Token>"
|
|
2042
2132
|
]
|
|
2043
2133
|
},
|
|
2044
2134
|
{
|
|
@@ -2189,7 +2279,7 @@ var ABI25 = {
|
|
|
2189
2279
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2190
2280
|
],
|
|
2191
2281
|
"return": [
|
|
2192
|
-
"
|
|
2282
|
+
"0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::FaucetToken"
|
|
2193
2283
|
]
|
|
2194
2284
|
}
|
|
2195
2285
|
],
|
|
@@ -2221,7 +2311,7 @@ var ABI25 = {
|
|
|
2221
2311
|
"fields": [
|
|
2222
2312
|
{
|
|
2223
2313
|
"name": "tokens",
|
|
2224
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2314
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xd8027d3cb3f051dc4622cae155f41b802c0cdd4e9fca1a1e3a8887caf30a4f02::test_faucet::FaucetToken>"
|
|
2225
2315
|
}
|
|
2226
2316
|
]
|
|
2227
2317
|
},
|
|
@@ -2246,7 +2336,7 @@ var ABI25 = {
|
|
|
2246
2336
|
}
|
|
2247
2337
|
]
|
|
2248
2338
|
};
|
|
2249
|
-
var testFaucet_default =
|
|
2339
|
+
var testFaucet_default = ABI27;
|
|
2250
2340
|
|
|
2251
2341
|
// src/testFaucet.ts
|
|
2252
2342
|
var TestFaucet = class _TestFaucet extends client_default {
|