@nightlylabs/dex-sdk 0.1.56 → 0.1.58
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 +144 -32
- package/dist/index.d.cts +79 -2
- package/dist/index.d.ts +79 -2
- package/dist/index.js +143 -32
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AdminEndpoints: () => AdminEndpoints,
|
|
34
34
|
BaseEndpoints: () => BaseEndpoints,
|
|
35
|
+
BoxRewardTier: () => BoxRewardTier,
|
|
35
36
|
ChartInterval: () => ChartInterval,
|
|
36
37
|
Client: () => Client,
|
|
37
38
|
EndpointsV1: () => EndpointsV1,
|
|
@@ -65,7 +66,7 @@ var import_uuid = require("uuid");
|
|
|
65
66
|
|
|
66
67
|
// generated_types/addApiKey.ts
|
|
67
68
|
var ABI = {
|
|
68
|
-
"address": "
|
|
69
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
69
70
|
"name": "add_api_key",
|
|
70
71
|
"friends": [],
|
|
71
72
|
"exposed_functions": [
|
|
@@ -90,7 +91,7 @@ var addApiKey_default = ABI;
|
|
|
90
91
|
|
|
91
92
|
// generated_types/cancelAllPerpOrders.ts
|
|
92
93
|
var ABI2 = {
|
|
93
|
-
"address": "
|
|
94
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
94
95
|
"name": "cancel_all_perp_orders",
|
|
95
96
|
"friends": [],
|
|
96
97
|
"exposed_functions": [
|
|
@@ -113,7 +114,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
113
114
|
|
|
114
115
|
// generated_types/cancelPerpOrders.ts
|
|
115
116
|
var ABI3 = {
|
|
116
|
-
"address": "
|
|
117
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
117
118
|
"name": "cancel_perp_orders",
|
|
118
119
|
"friends": [],
|
|
119
120
|
"exposed_functions": [
|
|
@@ -138,7 +139,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
138
139
|
|
|
139
140
|
// generated_types/createUser.ts
|
|
140
141
|
var ABI4 = {
|
|
141
|
-
"address": "
|
|
142
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
142
143
|
"name": "create_user",
|
|
143
144
|
"friends": [],
|
|
144
145
|
"exposed_functions": [
|
|
@@ -163,7 +164,7 @@ var createUser_default = ABI4;
|
|
|
163
164
|
|
|
164
165
|
// generated_types/depositToVault.ts
|
|
165
166
|
var ABI5 = {
|
|
166
|
-
"address": "
|
|
167
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
167
168
|
"name": "deposit_to_vault",
|
|
168
169
|
"friends": [],
|
|
169
170
|
"exposed_functions": [
|
|
@@ -188,7 +189,7 @@ var depositToVault_default = ABI5;
|
|
|
188
189
|
|
|
189
190
|
// generated_types/depositToken.ts
|
|
190
191
|
var ABI6 = {
|
|
191
|
-
"address": "
|
|
192
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
192
193
|
"name": "deposit_token",
|
|
193
194
|
"friends": [],
|
|
194
195
|
"exposed_functions": [
|
|
@@ -213,7 +214,7 @@ var depositToken_default = ABI6;
|
|
|
213
214
|
|
|
214
215
|
// generated_types/lendToken.ts
|
|
215
216
|
var ABI7 = {
|
|
216
|
-
"address": "
|
|
217
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
217
218
|
"name": "lend_token",
|
|
218
219
|
"friends": [],
|
|
219
220
|
"exposed_functions": [
|
|
@@ -239,7 +240,7 @@ var lendToken_default = ABI7;
|
|
|
239
240
|
|
|
240
241
|
// generated_types/placePerpLimitOrder.ts
|
|
241
242
|
var ABI8 = {
|
|
242
|
-
"address": "
|
|
243
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
243
244
|
"name": "place_perp_limit_order",
|
|
244
245
|
"friends": [],
|
|
245
246
|
"exposed_functions": [
|
|
@@ -268,7 +269,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
268
269
|
|
|
269
270
|
// generated_types/changePerpOrderPrice.ts
|
|
270
271
|
var ABI9 = {
|
|
271
|
-
"address": "
|
|
272
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
272
273
|
"name": "change_perp_order_price",
|
|
273
274
|
"friends": [],
|
|
274
275
|
"exposed_functions": [
|
|
@@ -284,6 +285,7 @@ var ABI9 = {
|
|
|
284
285
|
"vector<u8>",
|
|
285
286
|
"u64",
|
|
286
287
|
"u64",
|
|
288
|
+
"bool",
|
|
287
289
|
"bool"
|
|
288
290
|
],
|
|
289
291
|
"return": []
|
|
@@ -295,7 +297,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
295
297
|
|
|
296
298
|
// generated_types/placePerpMarketOrder.ts
|
|
297
299
|
var ABI10 = {
|
|
298
|
-
"address": "
|
|
300
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
299
301
|
"name": "place_perp_market_order",
|
|
300
302
|
"friends": [],
|
|
301
303
|
"exposed_functions": [
|
|
@@ -323,7 +325,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
323
325
|
|
|
324
326
|
// generated_types/redeemToken.ts
|
|
325
327
|
var ABI11 = {
|
|
326
|
-
"address": "
|
|
328
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
327
329
|
"name": "redeem_token",
|
|
328
330
|
"friends": [],
|
|
329
331
|
"exposed_functions": [
|
|
@@ -349,7 +351,7 @@ var redeemToken_default = ABI11;
|
|
|
349
351
|
|
|
350
352
|
// generated_types/removeApiKey.ts
|
|
351
353
|
var ABI12 = {
|
|
352
|
-
"address": "
|
|
354
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
353
355
|
"name": "remove_api_key",
|
|
354
356
|
"friends": [],
|
|
355
357
|
"exposed_functions": [
|
|
@@ -373,7 +375,7 @@ var removeApiKey_default = ABI12;
|
|
|
373
375
|
|
|
374
376
|
// generated_types/setAliasName.ts
|
|
375
377
|
var ABI13 = {
|
|
376
|
-
"address": "
|
|
378
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
377
379
|
"name": "set_alias_name",
|
|
378
380
|
"friends": [],
|
|
379
381
|
"exposed_functions": [
|
|
@@ -397,7 +399,7 @@ var setAliasName_default = ABI13;
|
|
|
397
399
|
|
|
398
400
|
// generated_types/setAutolend.ts
|
|
399
401
|
var ABI14 = {
|
|
400
|
-
"address": "
|
|
402
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
401
403
|
"name": "set_autolend",
|
|
402
404
|
"friends": [],
|
|
403
405
|
"exposed_functions": [
|
|
@@ -421,7 +423,7 @@ var setAutolend_default = ABI14;
|
|
|
421
423
|
|
|
422
424
|
// generated_types/claimReferralFees.ts
|
|
423
425
|
var ABI15 = {
|
|
424
|
-
"address": "
|
|
426
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
425
427
|
"name": "claim_referral_fees",
|
|
426
428
|
"friends": [],
|
|
427
429
|
"exposed_functions": [
|
|
@@ -445,7 +447,7 @@ var claimReferralFees_default = ABI15;
|
|
|
445
447
|
|
|
446
448
|
// generated_types/transferToUser.ts
|
|
447
449
|
var ABI16 = {
|
|
448
|
-
"address": "
|
|
450
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
449
451
|
"name": "transfer_to_user",
|
|
450
452
|
"friends": [],
|
|
451
453
|
"exposed_functions": [
|
|
@@ -461,7 +463,8 @@ var ABI16 = {
|
|
|
461
463
|
"0x1::object::Object<0x1::fungible_asset::Metadata>",
|
|
462
464
|
"u64",
|
|
463
465
|
"bool",
|
|
464
|
-
"u64"
|
|
466
|
+
"u64",
|
|
467
|
+
"bool"
|
|
465
468
|
],
|
|
466
469
|
"return": []
|
|
467
470
|
}
|
|
@@ -472,7 +475,7 @@ var transferToUser_default = ABI16;
|
|
|
472
475
|
|
|
473
476
|
// generated_types/withdrawToken.ts
|
|
474
477
|
var ABI17 = {
|
|
475
|
-
"address": "
|
|
478
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
476
479
|
"name": "withdraw_token",
|
|
477
480
|
"friends": [],
|
|
478
481
|
"exposed_functions": [
|
|
@@ -500,7 +503,7 @@ var withdrawToken_default = ABI17;
|
|
|
500
503
|
|
|
501
504
|
// generated_types/placeMultiplePerpOrders.ts
|
|
502
505
|
var ABI18 = {
|
|
503
|
-
"address": "
|
|
506
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
504
507
|
"name": "place_multiple_perp_orders",
|
|
505
508
|
"friends": [],
|
|
506
509
|
"exposed_functions": [
|
|
@@ -529,7 +532,7 @@ var placeMultiplePerpOrders_default = ABI18;
|
|
|
529
532
|
|
|
530
533
|
// generated_types/claimKickbackFee.ts
|
|
531
534
|
var ABI19 = {
|
|
532
|
-
"address": "
|
|
535
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
533
536
|
"name": "claim_kickback_fee",
|
|
534
537
|
"friends": [],
|
|
535
538
|
"exposed_functions": [
|
|
@@ -552,7 +555,7 @@ var claimKickbackFee_default = ABI19;
|
|
|
552
555
|
|
|
553
556
|
// generated_types/replaceMultipleOrders.ts
|
|
554
557
|
var ABI20 = {
|
|
555
|
-
"address": "
|
|
558
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
556
559
|
"name": "replace_multiple_orders",
|
|
557
560
|
"friends": [],
|
|
558
561
|
"exposed_functions": [
|
|
@@ -580,7 +583,7 @@ var replaceMultipleOrders_default = ABI20;
|
|
|
580
583
|
|
|
581
584
|
// generated_types/claimDeposit.ts
|
|
582
585
|
var ABI21 = {
|
|
583
|
-
"address": "
|
|
586
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
584
587
|
"name": "claim_deposit",
|
|
585
588
|
"friends": [],
|
|
586
589
|
"exposed_functions": [
|
|
@@ -604,7 +607,7 @@ var claimDeposit_default = ABI21;
|
|
|
604
607
|
|
|
605
608
|
// generated_types/removeApiKeySigner.ts
|
|
606
609
|
var ABI22 = {
|
|
607
|
-
"address": "
|
|
610
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
608
611
|
"name": "remove_api_key_signer",
|
|
609
612
|
"friends": [],
|
|
610
613
|
"exposed_functions": [
|
|
@@ -628,7 +631,7 @@ var removeApiKeySigner_default = ABI22;
|
|
|
628
631
|
|
|
629
632
|
// generated_types/setReferralCode.ts
|
|
630
633
|
var ABI23 = {
|
|
631
|
-
"address": "
|
|
634
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
632
635
|
"name": "set_referral_code",
|
|
633
636
|
"friends": [],
|
|
634
637
|
"exposed_functions": [
|
|
@@ -652,7 +655,7 @@ var setReferralCode_default = ABI23;
|
|
|
652
655
|
|
|
653
656
|
// generated_types/tokenizeUserVaultInvestment.ts
|
|
654
657
|
var ABI24 = {
|
|
655
|
-
"address": "
|
|
658
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
656
659
|
"name": "tokenize_user_vault_investment",
|
|
657
660
|
"friends": [],
|
|
658
661
|
"exposed_functions": [
|
|
@@ -676,7 +679,7 @@ var tokenizeUserVaultInvestment_default = ABI24;
|
|
|
676
679
|
|
|
677
680
|
// generated_types/addCredits.ts
|
|
678
681
|
var ABI25 = {
|
|
679
|
-
"address": "
|
|
682
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
680
683
|
"name": "add_credits",
|
|
681
684
|
"friends": [],
|
|
682
685
|
"exposed_functions": [
|
|
@@ -698,7 +701,47 @@ var ABI25 = {
|
|
|
698
701
|
};
|
|
699
702
|
var addCredits_default = ABI25;
|
|
700
703
|
|
|
704
|
+
// generated_types/openBoxes.ts
|
|
705
|
+
var ABI26 = {
|
|
706
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
707
|
+
"name": "open_boxes",
|
|
708
|
+
"friends": [],
|
|
709
|
+
"exposed_functions": [
|
|
710
|
+
{
|
|
711
|
+
"name": "open_boxes_with_rewards",
|
|
712
|
+
"visibility": "public",
|
|
713
|
+
"is_entry": true,
|
|
714
|
+
"is_view": false,
|
|
715
|
+
"generic_type_params": [],
|
|
716
|
+
"params": [
|
|
717
|
+
"&signer",
|
|
718
|
+
"&signer",
|
|
719
|
+
"u64",
|
|
720
|
+
"u64",
|
|
721
|
+
"u64",
|
|
722
|
+
"u64",
|
|
723
|
+
"vector<address>",
|
|
724
|
+
"vector<u64>",
|
|
725
|
+
"vector<u64>",
|
|
726
|
+
"vector<0x1::string::String>",
|
|
727
|
+
"vector<0x1::string::String>"
|
|
728
|
+
],
|
|
729
|
+
"return": []
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
"structs": []
|
|
733
|
+
};
|
|
734
|
+
var openBoxes_default = ABI26;
|
|
735
|
+
|
|
701
736
|
// generated_types/typeshareTypes.ts
|
|
737
|
+
var BoxRewardTier = /* @__PURE__ */ ((BoxRewardTier2) => {
|
|
738
|
+
BoxRewardTier2["Common"] = "Common";
|
|
739
|
+
BoxRewardTier2["Rare"] = "Rare";
|
|
740
|
+
BoxRewardTier2["Epic"] = "Epic";
|
|
741
|
+
BoxRewardTier2["Legendary"] = "Legendary";
|
|
742
|
+
BoxRewardTier2["Mystic"] = "Mystic";
|
|
743
|
+
return BoxRewardTier2;
|
|
744
|
+
})(BoxRewardTier || {});
|
|
702
745
|
var ChartInterval = /* @__PURE__ */ ((ChartInterval2) => {
|
|
703
746
|
ChartInterval2["OneMinute"] = "OneMinute";
|
|
704
747
|
ChartInterval2["FiveMinutes"] = "FiveMinutes";
|
|
@@ -808,8 +851,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
808
851
|
})(UserStatus || {});
|
|
809
852
|
|
|
810
853
|
// generated_types/withdrawFromVault.ts
|
|
811
|
-
var
|
|
812
|
-
"address": "
|
|
854
|
+
var ABI27 = {
|
|
855
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
813
856
|
"name": "withdraw_from_vault",
|
|
814
857
|
"friends": [],
|
|
815
858
|
"exposed_functions": [
|
|
@@ -831,7 +874,7 @@ var ABI26 = {
|
|
|
831
874
|
],
|
|
832
875
|
"structs": []
|
|
833
876
|
};
|
|
834
|
-
var withdrawFromVault_default =
|
|
877
|
+
var withdrawFromVault_default = ABI27;
|
|
835
878
|
|
|
836
879
|
// src/utils.ts
|
|
837
880
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -884,6 +927,14 @@ var getTopicFromCommand = (data) => {
|
|
|
884
927
|
return "BorrowLendUpdate";
|
|
885
928
|
case "UnsubscribeBorrowLend":
|
|
886
929
|
return "BorrowLendUpdate";
|
|
930
|
+
case "SubscribeBoxes":
|
|
931
|
+
return "BoxOpening";
|
|
932
|
+
case "UnsubscribeBoxes":
|
|
933
|
+
return "BoxOpening";
|
|
934
|
+
case "SubscribeLiquidations":
|
|
935
|
+
return "Liquidations";
|
|
936
|
+
case "UnsubscribeLiquidations":
|
|
937
|
+
return "Liquidations";
|
|
887
938
|
}
|
|
888
939
|
};
|
|
889
940
|
var getTopicFromMessage = (data) => {
|
|
@@ -934,6 +985,8 @@ var getTopicFromMessage = (data) => {
|
|
|
934
985
|
return data.content.userId;
|
|
935
986
|
case "BorrowLendUpdate":
|
|
936
987
|
return data.type;
|
|
988
|
+
case "BoxOpening":
|
|
989
|
+
return data.type;
|
|
937
990
|
case "ClaimReferralFee":
|
|
938
991
|
return data.content.userId;
|
|
939
992
|
case "UpdateUserFeeTier":
|
|
@@ -952,6 +1005,8 @@ var getTopicFromMessage = (data) => {
|
|
|
952
1005
|
return data.content.userId;
|
|
953
1006
|
case "VaultWithdraw":
|
|
954
1007
|
return data.content.userId;
|
|
1008
|
+
case "Liquidation":
|
|
1009
|
+
return data.content.userId;
|
|
955
1010
|
}
|
|
956
1011
|
};
|
|
957
1012
|
|
|
@@ -1658,6 +1713,44 @@ var Client = class _Client {
|
|
|
1658
1713
|
const topic = getTopicFromCommand(command);
|
|
1659
1714
|
this._subscriptions.delete(topic);
|
|
1660
1715
|
}
|
|
1716
|
+
async subscribeBoxOpeningUpdates(callback) {
|
|
1717
|
+
const command = {
|
|
1718
|
+
type: "SubscribeBoxes",
|
|
1719
|
+
content: { id: getRandomId() }
|
|
1720
|
+
};
|
|
1721
|
+
await this.sendWsMessage(command);
|
|
1722
|
+
const topic = getTopicFromCommand(command);
|
|
1723
|
+
this._subscriptions.set(topic, callback);
|
|
1724
|
+
return this.unsubscribeBoxOpeningUpdates;
|
|
1725
|
+
}
|
|
1726
|
+
async unsubscribeBoxOpeningUpdates() {
|
|
1727
|
+
const command = {
|
|
1728
|
+
type: "UnsubscribeBoxes",
|
|
1729
|
+
content: { id: getRandomId() }
|
|
1730
|
+
};
|
|
1731
|
+
await this.sendWsMessage(command);
|
|
1732
|
+
const topic = getTopicFromCommand(command);
|
|
1733
|
+
this._subscriptions.delete(topic);
|
|
1734
|
+
}
|
|
1735
|
+
async subscribeLiquidationUpdates(callback) {
|
|
1736
|
+
const command = {
|
|
1737
|
+
type: "SubscribeLiquidations",
|
|
1738
|
+
content: { id: getRandomId() }
|
|
1739
|
+
};
|
|
1740
|
+
await this.sendWsMessage(command);
|
|
1741
|
+
const topic = getTopicFromCommand(command);
|
|
1742
|
+
this._subscriptions.set(topic, callback);
|
|
1743
|
+
return this.unsubscribeLiquidationUpdates;
|
|
1744
|
+
}
|
|
1745
|
+
async unsubscribeLiquidationUpdates() {
|
|
1746
|
+
const command = {
|
|
1747
|
+
type: "UnsubscribeLiquidations",
|
|
1748
|
+
content: { id: getRandomId() }
|
|
1749
|
+
};
|
|
1750
|
+
await this.sendWsMessage(command);
|
|
1751
|
+
const topic = getTopicFromCommand(command);
|
|
1752
|
+
this._subscriptions.delete(topic);
|
|
1753
|
+
}
|
|
1661
1754
|
async subscribeUserUpdates(userId, callback) {
|
|
1662
1755
|
const command = {
|
|
1663
1756
|
type: "SubscribeUser",
|
|
@@ -1804,6 +1897,24 @@ var Client = class _Client {
|
|
|
1804
1897
|
functionArguments: [params.userId, params.amount]
|
|
1805
1898
|
});
|
|
1806
1899
|
}
|
|
1900
|
+
async openBoxesPayload(params) {
|
|
1901
|
+
return await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1902
|
+
aptosConfig: this._aptos.config,
|
|
1903
|
+
abi: parseEntryFunctionAbi({
|
|
1904
|
+
moduleAbi: openBoxes_default,
|
|
1905
|
+
functionName: openBoxes_default.name,
|
|
1906
|
+
moduleAddress: openBoxes_default.address,
|
|
1907
|
+
moduleName: openBoxes_default.name
|
|
1908
|
+
}),
|
|
1909
|
+
function: `${openBoxes_default.address}::${openBoxes_default.name}::open_boxes`,
|
|
1910
|
+
typeArguments: [],
|
|
1911
|
+
functionArguments: [params.userId, params.boxId, params.amount]
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
async openBoxes(params) {
|
|
1915
|
+
const aptosPayload = await this.openBoxesPayload(params);
|
|
1916
|
+
return await this.createAndSubmitTransaction(aptosPayload);
|
|
1917
|
+
}
|
|
1807
1918
|
// Helper function to submit sponsored transaction
|
|
1808
1919
|
async createAndSubmitTransaction(aptosPayload) {
|
|
1809
1920
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
@@ -2236,8 +2347,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
2236
2347
|
}
|
|
2237
2348
|
|
|
2238
2349
|
// generated_types/faucetEntrypoints.ts
|
|
2239
|
-
var
|
|
2240
|
-
"address": "
|
|
2350
|
+
var ABI28 = {
|
|
2351
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
2241
2352
|
"name": "faucet_entrypoints",
|
|
2242
2353
|
"friends": [],
|
|
2243
2354
|
"exposed_functions": [
|
|
@@ -2268,7 +2379,7 @@ var ABI27 = {
|
|
|
2268
2379
|
],
|
|
2269
2380
|
"structs": []
|
|
2270
2381
|
};
|
|
2271
|
-
var faucetEntrypoints_default =
|
|
2382
|
+
var faucetEntrypoints_default = ABI28;
|
|
2272
2383
|
|
|
2273
2384
|
// src/testFaucet.ts
|
|
2274
2385
|
var import_ts_sdk3 = require("@aptos-labs/ts-sdk");
|
|
@@ -2344,6 +2455,7 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
2344
2455
|
0 && (module.exports = {
|
|
2345
2456
|
AdminEndpoints,
|
|
2346
2457
|
BaseEndpoints,
|
|
2458
|
+
BoxRewardTier,
|
|
2347
2459
|
ChartInterval,
|
|
2348
2460
|
Client,
|
|
2349
2461
|
EndpointsV1,
|
package/dist/index.d.cts
CHANGED
|
@@ -71,6 +71,28 @@ interface BorrowLendingHistoricalData {
|
|
|
71
71
|
borrowers: string;
|
|
72
72
|
timestamp: string;
|
|
73
73
|
}
|
|
74
|
+
declare enum BoxRewardTier {
|
|
75
|
+
Common = "Common",
|
|
76
|
+
Rare = "Rare",
|
|
77
|
+
Epic = "Epic",
|
|
78
|
+
Legendary = "Legendary",
|
|
79
|
+
Mystic = "Mystic"
|
|
80
|
+
}
|
|
81
|
+
interface BoxReward {
|
|
82
|
+
tier: string;
|
|
83
|
+
usdcAmount?: string;
|
|
84
|
+
pointsAmount?: string;
|
|
85
|
+
badgeType?: BoxRewardTier;
|
|
86
|
+
}
|
|
87
|
+
interface BoxOpeningEvent {
|
|
88
|
+
txHash: string;
|
|
89
|
+
userId: string;
|
|
90
|
+
boxId: string;
|
|
91
|
+
rewards: BoxReward[];
|
|
92
|
+
totalUsdc: string;
|
|
93
|
+
totalPoints: string;
|
|
94
|
+
timestamp: string;
|
|
95
|
+
}
|
|
74
96
|
interface CanceledPerpOrders {
|
|
75
97
|
market: string;
|
|
76
98
|
userId: string;
|
|
@@ -175,6 +197,7 @@ interface PerpetualMarketConfigEntry {
|
|
|
175
197
|
liquidationPenalty: string;
|
|
176
198
|
lotSize: string;
|
|
177
199
|
tickSize: string;
|
|
200
|
+
maxOpenInterest: string;
|
|
178
201
|
status: PerpetualMarketStatus;
|
|
179
202
|
fundingRate: FundingRate;
|
|
180
203
|
}
|
|
@@ -564,6 +587,7 @@ interface User {
|
|
|
564
587
|
ownerAddress: string;
|
|
565
588
|
userSignerAddress: string;
|
|
566
589
|
tokenBalances: Record<string, string>;
|
|
590
|
+
points: string;
|
|
567
591
|
positions: Record<string, PerpPosition>;
|
|
568
592
|
perpOrders: Record<string, Record<string, Order>>;
|
|
569
593
|
referralToClaim: Record<string, string>;
|
|
@@ -834,6 +858,10 @@ interface Lend {
|
|
|
834
858
|
tokenAmount: string;
|
|
835
859
|
sharesReceived: string;
|
|
836
860
|
}
|
|
861
|
+
interface Liquidation {
|
|
862
|
+
userId: string;
|
|
863
|
+
liquidationValue: string;
|
|
864
|
+
}
|
|
837
865
|
interface MarketStatusChange {
|
|
838
866
|
market: string;
|
|
839
867
|
status: PerpetualMarketStatus;
|
|
@@ -1069,6 +1097,12 @@ type Topic = {
|
|
|
1069
1097
|
} | {
|
|
1070
1098
|
type: "BorrowLend";
|
|
1071
1099
|
content?: undefined;
|
|
1100
|
+
} | {
|
|
1101
|
+
type: "Boxes";
|
|
1102
|
+
content?: undefined;
|
|
1103
|
+
} | {
|
|
1104
|
+
type: "Liquidations";
|
|
1105
|
+
content?: undefined;
|
|
1072
1106
|
};
|
|
1073
1107
|
declare enum TransferAction {
|
|
1074
1108
|
Sent = "Sent",
|
|
@@ -1122,6 +1156,26 @@ type WsCommand = {
|
|
|
1122
1156
|
content: {
|
|
1123
1157
|
id: string;
|
|
1124
1158
|
};
|
|
1159
|
+
} | {
|
|
1160
|
+
type: "SubscribeBoxes";
|
|
1161
|
+
content: {
|
|
1162
|
+
id: string;
|
|
1163
|
+
};
|
|
1164
|
+
} | {
|
|
1165
|
+
type: "UnsubscribeBoxes";
|
|
1166
|
+
content: {
|
|
1167
|
+
id: string;
|
|
1168
|
+
};
|
|
1169
|
+
} | {
|
|
1170
|
+
type: "SubscribeLiquidations";
|
|
1171
|
+
content: {
|
|
1172
|
+
id: string;
|
|
1173
|
+
};
|
|
1174
|
+
} | {
|
|
1175
|
+
type: "UnsubscribeLiquidations";
|
|
1176
|
+
content: {
|
|
1177
|
+
id: string;
|
|
1178
|
+
};
|
|
1125
1179
|
};
|
|
1126
1180
|
type WsMessage = {
|
|
1127
1181
|
type: "Ack";
|
|
@@ -1224,6 +1278,12 @@ type WsMessage = {
|
|
|
1224
1278
|
} | {
|
|
1225
1279
|
type: "VaultWithdraw";
|
|
1226
1280
|
content: VaultWithdraw;
|
|
1281
|
+
} | {
|
|
1282
|
+
type: "BoxOpening";
|
|
1283
|
+
content: BoxOpeningEvent;
|
|
1284
|
+
} | {
|
|
1285
|
+
type: "Liquidation";
|
|
1286
|
+
content: Liquidation;
|
|
1227
1287
|
};
|
|
1228
1288
|
|
|
1229
1289
|
type Address = `0x${string}`;
|
|
@@ -1382,11 +1442,16 @@ interface TokenizeUserVaultInvestmentParams {
|
|
|
1382
1442
|
userId: string;
|
|
1383
1443
|
vaultId: string;
|
|
1384
1444
|
}
|
|
1445
|
+
interface OpenBoxesParams {
|
|
1446
|
+
userId: string;
|
|
1447
|
+
boxId: string;
|
|
1448
|
+
amount: string;
|
|
1449
|
+
}
|
|
1385
1450
|
type WsOracleUpdates = Extract<WsMessage, {
|
|
1386
1451
|
type: 'OracleUpdates';
|
|
1387
1452
|
}>;
|
|
1388
1453
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1389
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange' | 'VaultDeposit' | 'VaultWithdraw';
|
|
1454
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange' | 'VaultDeposit' | 'VaultWithdraw' | 'BoxOpening' | 'Liquidation';
|
|
1390
1455
|
}>;
|
|
1391
1456
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1392
1457
|
type: 'OrderbookUpdate' | 'TradesUpdate' | 'MarketStatusChange';
|
|
@@ -1394,6 +1459,12 @@ type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
|
1394
1459
|
type WsBorrowLendUpdate = Extract<WsMessage, {
|
|
1395
1460
|
type: 'BorrowLendUpdate';
|
|
1396
1461
|
}>;
|
|
1462
|
+
type WsBoxOpeningUpdate = Extract<WsMessage, {
|
|
1463
|
+
type: 'BoxOpening';
|
|
1464
|
+
}>;
|
|
1465
|
+
type WsLiquidationUpdate = Extract<WsMessage, {
|
|
1466
|
+
type: 'Liquidation';
|
|
1467
|
+
}>;
|
|
1397
1468
|
|
|
1398
1469
|
/**
|
|
1399
1470
|
* Manages sequence numbers for Aptos blockchain transactions.
|
|
@@ -1507,6 +1578,10 @@ declare class Client {
|
|
|
1507
1578
|
unsubscribeIndexPricesUpdates(): Promise<void>;
|
|
1508
1579
|
subscribeBorrowLendingUpdates(callback: (data: WsBorrowLendUpdate) => void): Promise<() => Promise<void>>;
|
|
1509
1580
|
unsubscribeBorrowLendingUpdates(): Promise<void>;
|
|
1581
|
+
subscribeBoxOpeningUpdates(callback: (data: WsBoxOpeningUpdate) => void): Promise<() => Promise<void>>;
|
|
1582
|
+
unsubscribeBoxOpeningUpdates(): Promise<void>;
|
|
1583
|
+
subscribeLiquidationUpdates(callback: (data: WsLiquidationUpdate) => void): Promise<() => Promise<void>>;
|
|
1584
|
+
unsubscribeLiquidationUpdates(): Promise<void>;
|
|
1510
1585
|
subscribeUserUpdates(userId: string, callback: (data: WsUserUpdates) => void): Promise<() => Promise<void>>;
|
|
1511
1586
|
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
1512
1587
|
subscribePerpMarketUpdates(market: string, callback: (data: WsPerpMarketUpdates) => void): Promise<() => Promise<void>>;
|
|
@@ -1524,6 +1599,8 @@ declare class Client {
|
|
|
1524
1599
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1525
1600
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1526
1601
|
addApiCredits(params: AddApiCreditsParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1602
|
+
openBoxesPayload(params: OpenBoxesParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1603
|
+
openBoxes(params: OpenBoxesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1527
1604
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1528
1605
|
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1529
1606
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -1625,4 +1702,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1625
1702
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1626
1703
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1627
1704
|
|
|
1628
|
-
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 FeeData, 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 GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexerStatusResponse, 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 GetServicesStatusResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalLiquidation, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IGetChartCandlesInRange, type IndexPriceHistory, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, Network, type NodeStatus, 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, type SetReferralParamsResponse, SpotMarketStatus, Status, type StatusResponse, type SubServiceStatus, 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 UserAggregatedVaultStats, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
|
1705
|
+
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 BoxOpeningEvent, type BoxReward, BoxRewardTier, 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 FeeData, 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 GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexerStatusResponse, 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 GetServicesStatusResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalLiquidation, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IGetChartCandlesInRange, type IndexPriceHistory, type Lend, type LendTokenParams, type Liquidation, type MarginStep, type MarketStatusChange, Network, type NodeStatus, type OpenBoxesParams, 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, type SetReferralParamsResponse, SpotMarketStatus, Status, type StatusResponse, type SubServiceStatus, 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 UserAggregatedVaultStats, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsBoxOpeningUpdate, type WsCommand, type WsFill, type WsLiquidationUpdate, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,28 @@ interface BorrowLendingHistoricalData {
|
|
|
71
71
|
borrowers: string;
|
|
72
72
|
timestamp: string;
|
|
73
73
|
}
|
|
74
|
+
declare enum BoxRewardTier {
|
|
75
|
+
Common = "Common",
|
|
76
|
+
Rare = "Rare",
|
|
77
|
+
Epic = "Epic",
|
|
78
|
+
Legendary = "Legendary",
|
|
79
|
+
Mystic = "Mystic"
|
|
80
|
+
}
|
|
81
|
+
interface BoxReward {
|
|
82
|
+
tier: string;
|
|
83
|
+
usdcAmount?: string;
|
|
84
|
+
pointsAmount?: string;
|
|
85
|
+
badgeType?: BoxRewardTier;
|
|
86
|
+
}
|
|
87
|
+
interface BoxOpeningEvent {
|
|
88
|
+
txHash: string;
|
|
89
|
+
userId: string;
|
|
90
|
+
boxId: string;
|
|
91
|
+
rewards: BoxReward[];
|
|
92
|
+
totalUsdc: string;
|
|
93
|
+
totalPoints: string;
|
|
94
|
+
timestamp: string;
|
|
95
|
+
}
|
|
74
96
|
interface CanceledPerpOrders {
|
|
75
97
|
market: string;
|
|
76
98
|
userId: string;
|
|
@@ -175,6 +197,7 @@ interface PerpetualMarketConfigEntry {
|
|
|
175
197
|
liquidationPenalty: string;
|
|
176
198
|
lotSize: string;
|
|
177
199
|
tickSize: string;
|
|
200
|
+
maxOpenInterest: string;
|
|
178
201
|
status: PerpetualMarketStatus;
|
|
179
202
|
fundingRate: FundingRate;
|
|
180
203
|
}
|
|
@@ -564,6 +587,7 @@ interface User {
|
|
|
564
587
|
ownerAddress: string;
|
|
565
588
|
userSignerAddress: string;
|
|
566
589
|
tokenBalances: Record<string, string>;
|
|
590
|
+
points: string;
|
|
567
591
|
positions: Record<string, PerpPosition>;
|
|
568
592
|
perpOrders: Record<string, Record<string, Order>>;
|
|
569
593
|
referralToClaim: Record<string, string>;
|
|
@@ -834,6 +858,10 @@ interface Lend {
|
|
|
834
858
|
tokenAmount: string;
|
|
835
859
|
sharesReceived: string;
|
|
836
860
|
}
|
|
861
|
+
interface Liquidation {
|
|
862
|
+
userId: string;
|
|
863
|
+
liquidationValue: string;
|
|
864
|
+
}
|
|
837
865
|
interface MarketStatusChange {
|
|
838
866
|
market: string;
|
|
839
867
|
status: PerpetualMarketStatus;
|
|
@@ -1069,6 +1097,12 @@ type Topic = {
|
|
|
1069
1097
|
} | {
|
|
1070
1098
|
type: "BorrowLend";
|
|
1071
1099
|
content?: undefined;
|
|
1100
|
+
} | {
|
|
1101
|
+
type: "Boxes";
|
|
1102
|
+
content?: undefined;
|
|
1103
|
+
} | {
|
|
1104
|
+
type: "Liquidations";
|
|
1105
|
+
content?: undefined;
|
|
1072
1106
|
};
|
|
1073
1107
|
declare enum TransferAction {
|
|
1074
1108
|
Sent = "Sent",
|
|
@@ -1122,6 +1156,26 @@ type WsCommand = {
|
|
|
1122
1156
|
content: {
|
|
1123
1157
|
id: string;
|
|
1124
1158
|
};
|
|
1159
|
+
} | {
|
|
1160
|
+
type: "SubscribeBoxes";
|
|
1161
|
+
content: {
|
|
1162
|
+
id: string;
|
|
1163
|
+
};
|
|
1164
|
+
} | {
|
|
1165
|
+
type: "UnsubscribeBoxes";
|
|
1166
|
+
content: {
|
|
1167
|
+
id: string;
|
|
1168
|
+
};
|
|
1169
|
+
} | {
|
|
1170
|
+
type: "SubscribeLiquidations";
|
|
1171
|
+
content: {
|
|
1172
|
+
id: string;
|
|
1173
|
+
};
|
|
1174
|
+
} | {
|
|
1175
|
+
type: "UnsubscribeLiquidations";
|
|
1176
|
+
content: {
|
|
1177
|
+
id: string;
|
|
1178
|
+
};
|
|
1125
1179
|
};
|
|
1126
1180
|
type WsMessage = {
|
|
1127
1181
|
type: "Ack";
|
|
@@ -1224,6 +1278,12 @@ type WsMessage = {
|
|
|
1224
1278
|
} | {
|
|
1225
1279
|
type: "VaultWithdraw";
|
|
1226
1280
|
content: VaultWithdraw;
|
|
1281
|
+
} | {
|
|
1282
|
+
type: "BoxOpening";
|
|
1283
|
+
content: BoxOpeningEvent;
|
|
1284
|
+
} | {
|
|
1285
|
+
type: "Liquidation";
|
|
1286
|
+
content: Liquidation;
|
|
1227
1287
|
};
|
|
1228
1288
|
|
|
1229
1289
|
type Address = `0x${string}`;
|
|
@@ -1382,11 +1442,16 @@ interface TokenizeUserVaultInvestmentParams {
|
|
|
1382
1442
|
userId: string;
|
|
1383
1443
|
vaultId: string;
|
|
1384
1444
|
}
|
|
1445
|
+
interface OpenBoxesParams {
|
|
1446
|
+
userId: string;
|
|
1447
|
+
boxId: string;
|
|
1448
|
+
amount: string;
|
|
1449
|
+
}
|
|
1385
1450
|
type WsOracleUpdates = Extract<WsMessage, {
|
|
1386
1451
|
type: 'OracleUpdates';
|
|
1387
1452
|
}>;
|
|
1388
1453
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1389
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange' | 'VaultDeposit' | 'VaultWithdraw';
|
|
1454
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'ClaimUserKickbackFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived' | 'ReferralUpdate' | 'ApiCreditsChange' | 'VaultDeposit' | 'VaultWithdraw' | 'BoxOpening' | 'Liquidation';
|
|
1390
1455
|
}>;
|
|
1391
1456
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1392
1457
|
type: 'OrderbookUpdate' | 'TradesUpdate' | 'MarketStatusChange';
|
|
@@ -1394,6 +1459,12 @@ type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
|
1394
1459
|
type WsBorrowLendUpdate = Extract<WsMessage, {
|
|
1395
1460
|
type: 'BorrowLendUpdate';
|
|
1396
1461
|
}>;
|
|
1462
|
+
type WsBoxOpeningUpdate = Extract<WsMessage, {
|
|
1463
|
+
type: 'BoxOpening';
|
|
1464
|
+
}>;
|
|
1465
|
+
type WsLiquidationUpdate = Extract<WsMessage, {
|
|
1466
|
+
type: 'Liquidation';
|
|
1467
|
+
}>;
|
|
1397
1468
|
|
|
1398
1469
|
/**
|
|
1399
1470
|
* Manages sequence numbers for Aptos blockchain transactions.
|
|
@@ -1507,6 +1578,10 @@ declare class Client {
|
|
|
1507
1578
|
unsubscribeIndexPricesUpdates(): Promise<void>;
|
|
1508
1579
|
subscribeBorrowLendingUpdates(callback: (data: WsBorrowLendUpdate) => void): Promise<() => Promise<void>>;
|
|
1509
1580
|
unsubscribeBorrowLendingUpdates(): Promise<void>;
|
|
1581
|
+
subscribeBoxOpeningUpdates(callback: (data: WsBoxOpeningUpdate) => void): Promise<() => Promise<void>>;
|
|
1582
|
+
unsubscribeBoxOpeningUpdates(): Promise<void>;
|
|
1583
|
+
subscribeLiquidationUpdates(callback: (data: WsLiquidationUpdate) => void): Promise<() => Promise<void>>;
|
|
1584
|
+
unsubscribeLiquidationUpdates(): Promise<void>;
|
|
1510
1585
|
subscribeUserUpdates(userId: string, callback: (data: WsUserUpdates) => void): Promise<() => Promise<void>>;
|
|
1511
1586
|
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
1512
1587
|
subscribePerpMarketUpdates(market: string, callback: (data: WsPerpMarketUpdates) => void): Promise<() => Promise<void>>;
|
|
@@ -1524,6 +1599,8 @@ declare class Client {
|
|
|
1524
1599
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1525
1600
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1526
1601
|
addApiCredits(params: AddApiCreditsParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1602
|
+
openBoxesPayload(params: OpenBoxesParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1603
|
+
openBoxes(params: OpenBoxesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1527
1604
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1528
1605
|
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1529
1606
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -1625,4 +1702,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1625
1702
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1626
1703
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1627
1704
|
|
|
1628
|
-
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 FeeData, 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 GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexerStatusResponse, 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 GetServicesStatusResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalLiquidation, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IGetChartCandlesInRange, type IndexPriceHistory, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, Network, type NodeStatus, 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, type SetReferralParamsResponse, SpotMarketStatus, Status, type StatusResponse, type SubServiceStatus, 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 UserAggregatedVaultStats, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
|
1705
|
+
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 BoxOpeningEvent, type BoxReward, BoxRewardTier, 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 FeeData, 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 GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexerStatusResponse, 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 GetServicesStatusResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalLiquidation, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IGetChartCandlesInRange, type IndexPriceHistory, type Lend, type LendTokenParams, type Liquidation, type MarginStep, type MarketStatusChange, Network, type NodeStatus, type OpenBoxesParams, 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, type SetReferralParamsResponse, SpotMarketStatus, Status, type StatusResponse, type SubServiceStatus, 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 UserAggregatedVaultStats, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsBoxOpeningUpdate, type WsCommand, type WsFill, type WsLiquidationUpdate, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
15
15
|
|
|
16
16
|
// generated_types/addApiKey.ts
|
|
17
17
|
var ABI = {
|
|
18
|
-
"address": "
|
|
18
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
19
19
|
"name": "add_api_key",
|
|
20
20
|
"friends": [],
|
|
21
21
|
"exposed_functions": [
|
|
@@ -40,7 +40,7 @@ var addApiKey_default = ABI;
|
|
|
40
40
|
|
|
41
41
|
// generated_types/cancelAllPerpOrders.ts
|
|
42
42
|
var ABI2 = {
|
|
43
|
-
"address": "
|
|
43
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
44
44
|
"name": "cancel_all_perp_orders",
|
|
45
45
|
"friends": [],
|
|
46
46
|
"exposed_functions": [
|
|
@@ -63,7 +63,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
63
63
|
|
|
64
64
|
// generated_types/cancelPerpOrders.ts
|
|
65
65
|
var ABI3 = {
|
|
66
|
-
"address": "
|
|
66
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
67
67
|
"name": "cancel_perp_orders",
|
|
68
68
|
"friends": [],
|
|
69
69
|
"exposed_functions": [
|
|
@@ -88,7 +88,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
88
88
|
|
|
89
89
|
// generated_types/createUser.ts
|
|
90
90
|
var ABI4 = {
|
|
91
|
-
"address": "
|
|
91
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
92
92
|
"name": "create_user",
|
|
93
93
|
"friends": [],
|
|
94
94
|
"exposed_functions": [
|
|
@@ -113,7 +113,7 @@ var createUser_default = ABI4;
|
|
|
113
113
|
|
|
114
114
|
// generated_types/depositToVault.ts
|
|
115
115
|
var ABI5 = {
|
|
116
|
-
"address": "
|
|
116
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
117
117
|
"name": "deposit_to_vault",
|
|
118
118
|
"friends": [],
|
|
119
119
|
"exposed_functions": [
|
|
@@ -138,7 +138,7 @@ var depositToVault_default = ABI5;
|
|
|
138
138
|
|
|
139
139
|
// generated_types/depositToken.ts
|
|
140
140
|
var ABI6 = {
|
|
141
|
-
"address": "
|
|
141
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
142
142
|
"name": "deposit_token",
|
|
143
143
|
"friends": [],
|
|
144
144
|
"exposed_functions": [
|
|
@@ -163,7 +163,7 @@ var depositToken_default = ABI6;
|
|
|
163
163
|
|
|
164
164
|
// generated_types/lendToken.ts
|
|
165
165
|
var ABI7 = {
|
|
166
|
-
"address": "
|
|
166
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
167
167
|
"name": "lend_token",
|
|
168
168
|
"friends": [],
|
|
169
169
|
"exposed_functions": [
|
|
@@ -189,7 +189,7 @@ var lendToken_default = ABI7;
|
|
|
189
189
|
|
|
190
190
|
// generated_types/placePerpLimitOrder.ts
|
|
191
191
|
var ABI8 = {
|
|
192
|
-
"address": "
|
|
192
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
193
193
|
"name": "place_perp_limit_order",
|
|
194
194
|
"friends": [],
|
|
195
195
|
"exposed_functions": [
|
|
@@ -218,7 +218,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
218
218
|
|
|
219
219
|
// generated_types/changePerpOrderPrice.ts
|
|
220
220
|
var ABI9 = {
|
|
221
|
-
"address": "
|
|
221
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
222
222
|
"name": "change_perp_order_price",
|
|
223
223
|
"friends": [],
|
|
224
224
|
"exposed_functions": [
|
|
@@ -234,6 +234,7 @@ var ABI9 = {
|
|
|
234
234
|
"vector<u8>",
|
|
235
235
|
"u64",
|
|
236
236
|
"u64",
|
|
237
|
+
"bool",
|
|
237
238
|
"bool"
|
|
238
239
|
],
|
|
239
240
|
"return": []
|
|
@@ -245,7 +246,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
245
246
|
|
|
246
247
|
// generated_types/placePerpMarketOrder.ts
|
|
247
248
|
var ABI10 = {
|
|
248
|
-
"address": "
|
|
249
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
249
250
|
"name": "place_perp_market_order",
|
|
250
251
|
"friends": [],
|
|
251
252
|
"exposed_functions": [
|
|
@@ -273,7 +274,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
273
274
|
|
|
274
275
|
// generated_types/redeemToken.ts
|
|
275
276
|
var ABI11 = {
|
|
276
|
-
"address": "
|
|
277
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
277
278
|
"name": "redeem_token",
|
|
278
279
|
"friends": [],
|
|
279
280
|
"exposed_functions": [
|
|
@@ -299,7 +300,7 @@ var redeemToken_default = ABI11;
|
|
|
299
300
|
|
|
300
301
|
// generated_types/removeApiKey.ts
|
|
301
302
|
var ABI12 = {
|
|
302
|
-
"address": "
|
|
303
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
303
304
|
"name": "remove_api_key",
|
|
304
305
|
"friends": [],
|
|
305
306
|
"exposed_functions": [
|
|
@@ -323,7 +324,7 @@ var removeApiKey_default = ABI12;
|
|
|
323
324
|
|
|
324
325
|
// generated_types/setAliasName.ts
|
|
325
326
|
var ABI13 = {
|
|
326
|
-
"address": "
|
|
327
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
327
328
|
"name": "set_alias_name",
|
|
328
329
|
"friends": [],
|
|
329
330
|
"exposed_functions": [
|
|
@@ -347,7 +348,7 @@ var setAliasName_default = ABI13;
|
|
|
347
348
|
|
|
348
349
|
// generated_types/setAutolend.ts
|
|
349
350
|
var ABI14 = {
|
|
350
|
-
"address": "
|
|
351
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
351
352
|
"name": "set_autolend",
|
|
352
353
|
"friends": [],
|
|
353
354
|
"exposed_functions": [
|
|
@@ -371,7 +372,7 @@ var setAutolend_default = ABI14;
|
|
|
371
372
|
|
|
372
373
|
// generated_types/claimReferralFees.ts
|
|
373
374
|
var ABI15 = {
|
|
374
|
-
"address": "
|
|
375
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
375
376
|
"name": "claim_referral_fees",
|
|
376
377
|
"friends": [],
|
|
377
378
|
"exposed_functions": [
|
|
@@ -395,7 +396,7 @@ var claimReferralFees_default = ABI15;
|
|
|
395
396
|
|
|
396
397
|
// generated_types/transferToUser.ts
|
|
397
398
|
var ABI16 = {
|
|
398
|
-
"address": "
|
|
399
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
399
400
|
"name": "transfer_to_user",
|
|
400
401
|
"friends": [],
|
|
401
402
|
"exposed_functions": [
|
|
@@ -411,7 +412,8 @@ var ABI16 = {
|
|
|
411
412
|
"0x1::object::Object<0x1::fungible_asset::Metadata>",
|
|
412
413
|
"u64",
|
|
413
414
|
"bool",
|
|
414
|
-
"u64"
|
|
415
|
+
"u64",
|
|
416
|
+
"bool"
|
|
415
417
|
],
|
|
416
418
|
"return": []
|
|
417
419
|
}
|
|
@@ -422,7 +424,7 @@ var transferToUser_default = ABI16;
|
|
|
422
424
|
|
|
423
425
|
// generated_types/withdrawToken.ts
|
|
424
426
|
var ABI17 = {
|
|
425
|
-
"address": "
|
|
427
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
426
428
|
"name": "withdraw_token",
|
|
427
429
|
"friends": [],
|
|
428
430
|
"exposed_functions": [
|
|
@@ -450,7 +452,7 @@ var withdrawToken_default = ABI17;
|
|
|
450
452
|
|
|
451
453
|
// generated_types/placeMultiplePerpOrders.ts
|
|
452
454
|
var ABI18 = {
|
|
453
|
-
"address": "
|
|
455
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
454
456
|
"name": "place_multiple_perp_orders",
|
|
455
457
|
"friends": [],
|
|
456
458
|
"exposed_functions": [
|
|
@@ -479,7 +481,7 @@ var placeMultiplePerpOrders_default = ABI18;
|
|
|
479
481
|
|
|
480
482
|
// generated_types/claimKickbackFee.ts
|
|
481
483
|
var ABI19 = {
|
|
482
|
-
"address": "
|
|
484
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
483
485
|
"name": "claim_kickback_fee",
|
|
484
486
|
"friends": [],
|
|
485
487
|
"exposed_functions": [
|
|
@@ -502,7 +504,7 @@ var claimKickbackFee_default = ABI19;
|
|
|
502
504
|
|
|
503
505
|
// generated_types/replaceMultipleOrders.ts
|
|
504
506
|
var ABI20 = {
|
|
505
|
-
"address": "
|
|
507
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
506
508
|
"name": "replace_multiple_orders",
|
|
507
509
|
"friends": [],
|
|
508
510
|
"exposed_functions": [
|
|
@@ -530,7 +532,7 @@ var replaceMultipleOrders_default = ABI20;
|
|
|
530
532
|
|
|
531
533
|
// generated_types/claimDeposit.ts
|
|
532
534
|
var ABI21 = {
|
|
533
|
-
"address": "
|
|
535
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
534
536
|
"name": "claim_deposit",
|
|
535
537
|
"friends": [],
|
|
536
538
|
"exposed_functions": [
|
|
@@ -554,7 +556,7 @@ var claimDeposit_default = ABI21;
|
|
|
554
556
|
|
|
555
557
|
// generated_types/removeApiKeySigner.ts
|
|
556
558
|
var ABI22 = {
|
|
557
|
-
"address": "
|
|
559
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
558
560
|
"name": "remove_api_key_signer",
|
|
559
561
|
"friends": [],
|
|
560
562
|
"exposed_functions": [
|
|
@@ -578,7 +580,7 @@ var removeApiKeySigner_default = ABI22;
|
|
|
578
580
|
|
|
579
581
|
// generated_types/setReferralCode.ts
|
|
580
582
|
var ABI23 = {
|
|
581
|
-
"address": "
|
|
583
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
582
584
|
"name": "set_referral_code",
|
|
583
585
|
"friends": [],
|
|
584
586
|
"exposed_functions": [
|
|
@@ -602,7 +604,7 @@ var setReferralCode_default = ABI23;
|
|
|
602
604
|
|
|
603
605
|
// generated_types/tokenizeUserVaultInvestment.ts
|
|
604
606
|
var ABI24 = {
|
|
605
|
-
"address": "
|
|
607
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
606
608
|
"name": "tokenize_user_vault_investment",
|
|
607
609
|
"friends": [],
|
|
608
610
|
"exposed_functions": [
|
|
@@ -626,7 +628,7 @@ var tokenizeUserVaultInvestment_default = ABI24;
|
|
|
626
628
|
|
|
627
629
|
// generated_types/addCredits.ts
|
|
628
630
|
var ABI25 = {
|
|
629
|
-
"address": "
|
|
631
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
630
632
|
"name": "add_credits",
|
|
631
633
|
"friends": [],
|
|
632
634
|
"exposed_functions": [
|
|
@@ -648,7 +650,47 @@ var ABI25 = {
|
|
|
648
650
|
};
|
|
649
651
|
var addCredits_default = ABI25;
|
|
650
652
|
|
|
653
|
+
// generated_types/openBoxes.ts
|
|
654
|
+
var ABI26 = {
|
|
655
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
656
|
+
"name": "open_boxes",
|
|
657
|
+
"friends": [],
|
|
658
|
+
"exposed_functions": [
|
|
659
|
+
{
|
|
660
|
+
"name": "open_boxes_with_rewards",
|
|
661
|
+
"visibility": "public",
|
|
662
|
+
"is_entry": true,
|
|
663
|
+
"is_view": false,
|
|
664
|
+
"generic_type_params": [],
|
|
665
|
+
"params": [
|
|
666
|
+
"&signer",
|
|
667
|
+
"&signer",
|
|
668
|
+
"u64",
|
|
669
|
+
"u64",
|
|
670
|
+
"u64",
|
|
671
|
+
"u64",
|
|
672
|
+
"vector<address>",
|
|
673
|
+
"vector<u64>",
|
|
674
|
+
"vector<u64>",
|
|
675
|
+
"vector<0x1::string::String>",
|
|
676
|
+
"vector<0x1::string::String>"
|
|
677
|
+
],
|
|
678
|
+
"return": []
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
"structs": []
|
|
682
|
+
};
|
|
683
|
+
var openBoxes_default = ABI26;
|
|
684
|
+
|
|
651
685
|
// generated_types/typeshareTypes.ts
|
|
686
|
+
var BoxRewardTier = /* @__PURE__ */ ((BoxRewardTier2) => {
|
|
687
|
+
BoxRewardTier2["Common"] = "Common";
|
|
688
|
+
BoxRewardTier2["Rare"] = "Rare";
|
|
689
|
+
BoxRewardTier2["Epic"] = "Epic";
|
|
690
|
+
BoxRewardTier2["Legendary"] = "Legendary";
|
|
691
|
+
BoxRewardTier2["Mystic"] = "Mystic";
|
|
692
|
+
return BoxRewardTier2;
|
|
693
|
+
})(BoxRewardTier || {});
|
|
652
694
|
var ChartInterval = /* @__PURE__ */ ((ChartInterval2) => {
|
|
653
695
|
ChartInterval2["OneMinute"] = "OneMinute";
|
|
654
696
|
ChartInterval2["FiveMinutes"] = "FiveMinutes";
|
|
@@ -758,8 +800,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
758
800
|
})(UserStatus || {});
|
|
759
801
|
|
|
760
802
|
// generated_types/withdrawFromVault.ts
|
|
761
|
-
var
|
|
762
|
-
"address": "
|
|
803
|
+
var ABI27 = {
|
|
804
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
763
805
|
"name": "withdraw_from_vault",
|
|
764
806
|
"friends": [],
|
|
765
807
|
"exposed_functions": [
|
|
@@ -781,7 +823,7 @@ var ABI26 = {
|
|
|
781
823
|
],
|
|
782
824
|
"structs": []
|
|
783
825
|
};
|
|
784
|
-
var withdrawFromVault_default =
|
|
826
|
+
var withdrawFromVault_default = ABI27;
|
|
785
827
|
|
|
786
828
|
// src/utils.ts
|
|
787
829
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -834,6 +876,14 @@ var getTopicFromCommand = (data) => {
|
|
|
834
876
|
return "BorrowLendUpdate";
|
|
835
877
|
case "UnsubscribeBorrowLend":
|
|
836
878
|
return "BorrowLendUpdate";
|
|
879
|
+
case "SubscribeBoxes":
|
|
880
|
+
return "BoxOpening";
|
|
881
|
+
case "UnsubscribeBoxes":
|
|
882
|
+
return "BoxOpening";
|
|
883
|
+
case "SubscribeLiquidations":
|
|
884
|
+
return "Liquidations";
|
|
885
|
+
case "UnsubscribeLiquidations":
|
|
886
|
+
return "Liquidations";
|
|
837
887
|
}
|
|
838
888
|
};
|
|
839
889
|
var getTopicFromMessage = (data) => {
|
|
@@ -884,6 +934,8 @@ var getTopicFromMessage = (data) => {
|
|
|
884
934
|
return data.content.userId;
|
|
885
935
|
case "BorrowLendUpdate":
|
|
886
936
|
return data.type;
|
|
937
|
+
case "BoxOpening":
|
|
938
|
+
return data.type;
|
|
887
939
|
case "ClaimReferralFee":
|
|
888
940
|
return data.content.userId;
|
|
889
941
|
case "UpdateUserFeeTier":
|
|
@@ -902,6 +954,8 @@ var getTopicFromMessage = (data) => {
|
|
|
902
954
|
return data.content.userId;
|
|
903
955
|
case "VaultWithdraw":
|
|
904
956
|
return data.content.userId;
|
|
957
|
+
case "Liquidation":
|
|
958
|
+
return data.content.userId;
|
|
905
959
|
}
|
|
906
960
|
};
|
|
907
961
|
|
|
@@ -1608,6 +1662,44 @@ var Client = class _Client {
|
|
|
1608
1662
|
const topic = getTopicFromCommand(command);
|
|
1609
1663
|
this._subscriptions.delete(topic);
|
|
1610
1664
|
}
|
|
1665
|
+
async subscribeBoxOpeningUpdates(callback) {
|
|
1666
|
+
const command = {
|
|
1667
|
+
type: "SubscribeBoxes",
|
|
1668
|
+
content: { id: getRandomId() }
|
|
1669
|
+
};
|
|
1670
|
+
await this.sendWsMessage(command);
|
|
1671
|
+
const topic = getTopicFromCommand(command);
|
|
1672
|
+
this._subscriptions.set(topic, callback);
|
|
1673
|
+
return this.unsubscribeBoxOpeningUpdates;
|
|
1674
|
+
}
|
|
1675
|
+
async unsubscribeBoxOpeningUpdates() {
|
|
1676
|
+
const command = {
|
|
1677
|
+
type: "UnsubscribeBoxes",
|
|
1678
|
+
content: { id: getRandomId() }
|
|
1679
|
+
};
|
|
1680
|
+
await this.sendWsMessage(command);
|
|
1681
|
+
const topic = getTopicFromCommand(command);
|
|
1682
|
+
this._subscriptions.delete(topic);
|
|
1683
|
+
}
|
|
1684
|
+
async subscribeLiquidationUpdates(callback) {
|
|
1685
|
+
const command = {
|
|
1686
|
+
type: "SubscribeLiquidations",
|
|
1687
|
+
content: { id: getRandomId() }
|
|
1688
|
+
};
|
|
1689
|
+
await this.sendWsMessage(command);
|
|
1690
|
+
const topic = getTopicFromCommand(command);
|
|
1691
|
+
this._subscriptions.set(topic, callback);
|
|
1692
|
+
return this.unsubscribeLiquidationUpdates;
|
|
1693
|
+
}
|
|
1694
|
+
async unsubscribeLiquidationUpdates() {
|
|
1695
|
+
const command = {
|
|
1696
|
+
type: "UnsubscribeLiquidations",
|
|
1697
|
+
content: { id: getRandomId() }
|
|
1698
|
+
};
|
|
1699
|
+
await this.sendWsMessage(command);
|
|
1700
|
+
const topic = getTopicFromCommand(command);
|
|
1701
|
+
this._subscriptions.delete(topic);
|
|
1702
|
+
}
|
|
1611
1703
|
async subscribeUserUpdates(userId, callback) {
|
|
1612
1704
|
const command = {
|
|
1613
1705
|
type: "SubscribeUser",
|
|
@@ -1754,6 +1846,24 @@ var Client = class _Client {
|
|
|
1754
1846
|
functionArguments: [params.userId, params.amount]
|
|
1755
1847
|
});
|
|
1756
1848
|
}
|
|
1849
|
+
async openBoxesPayload(params) {
|
|
1850
|
+
return await generateTransactionPayload({
|
|
1851
|
+
aptosConfig: this._aptos.config,
|
|
1852
|
+
abi: parseEntryFunctionAbi({
|
|
1853
|
+
moduleAbi: openBoxes_default,
|
|
1854
|
+
functionName: openBoxes_default.name,
|
|
1855
|
+
moduleAddress: openBoxes_default.address,
|
|
1856
|
+
moduleName: openBoxes_default.name
|
|
1857
|
+
}),
|
|
1858
|
+
function: `${openBoxes_default.address}::${openBoxes_default.name}::open_boxes`,
|
|
1859
|
+
typeArguments: [],
|
|
1860
|
+
functionArguments: [params.userId, params.boxId, params.amount]
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
async openBoxes(params) {
|
|
1864
|
+
const aptosPayload = await this.openBoxesPayload(params);
|
|
1865
|
+
return await this.createAndSubmitTransaction(aptosPayload);
|
|
1866
|
+
}
|
|
1757
1867
|
// Helper function to submit sponsored transaction
|
|
1758
1868
|
async createAndSubmitTransaction(aptosPayload) {
|
|
1759
1869
|
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
@@ -2186,8 +2296,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
2186
2296
|
}
|
|
2187
2297
|
|
|
2188
2298
|
// generated_types/faucetEntrypoints.ts
|
|
2189
|
-
var
|
|
2190
|
-
"address": "
|
|
2299
|
+
var ABI28 = {
|
|
2300
|
+
"address": "0xaadb16682f0afe2f149ae1ec5e1522e9f6ad693610e5bc19c833fc807f6b2388",
|
|
2191
2301
|
"name": "faucet_entrypoints",
|
|
2192
2302
|
"friends": [],
|
|
2193
2303
|
"exposed_functions": [
|
|
@@ -2218,7 +2328,7 @@ var ABI27 = {
|
|
|
2218
2328
|
],
|
|
2219
2329
|
"structs": []
|
|
2220
2330
|
};
|
|
2221
|
-
var faucetEntrypoints_default =
|
|
2331
|
+
var faucetEntrypoints_default = ABI28;
|
|
2222
2332
|
|
|
2223
2333
|
// src/testFaucet.ts
|
|
2224
2334
|
import {
|
|
@@ -2298,6 +2408,7 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
2298
2408
|
export {
|
|
2299
2409
|
AdminEndpoints,
|
|
2300
2410
|
BaseEndpoints,
|
|
2411
|
+
BoxRewardTier,
|
|
2301
2412
|
ChartInterval,
|
|
2302
2413
|
Client,
|
|
2303
2414
|
EndpointsV1,
|