@nightlylabs/dex-sdk 0.0.72 → 0.0.74
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 +157 -26
- package/dist/index.d.cts +49 -4
- package/dist/index.d.ts +49 -4
- package/dist/index.js +157 -26
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@ var import_uuid = require("uuid");
|
|
|
65
65
|
|
|
66
66
|
// generated_types/addApiKey.ts
|
|
67
67
|
var ABI = {
|
|
68
|
-
"address": "
|
|
68
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
69
69
|
"name": "add_api_key",
|
|
70
70
|
"friends": [],
|
|
71
71
|
"exposed_functions": [
|
|
@@ -90,7 +90,7 @@ var addApiKey_default = ABI;
|
|
|
90
90
|
|
|
91
91
|
// generated_types/cancelAllPerpOrders.ts
|
|
92
92
|
var ABI2 = {
|
|
93
|
-
"address": "
|
|
93
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
94
94
|
"name": "cancel_all_perp_orders",
|
|
95
95
|
"friends": [],
|
|
96
96
|
"exposed_functions": [
|
|
@@ -113,7 +113,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
113
113
|
|
|
114
114
|
// generated_types/cancelPerpOrders.ts
|
|
115
115
|
var ABI3 = {
|
|
116
|
-
"address": "
|
|
116
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
117
117
|
"name": "cancel_perp_orders",
|
|
118
118
|
"friends": [],
|
|
119
119
|
"exposed_functions": [
|
|
@@ -138,7 +138,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
138
138
|
|
|
139
139
|
// generated_types/createUser.ts
|
|
140
140
|
var ABI4 = {
|
|
141
|
-
"address": "
|
|
141
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
142
142
|
"name": "create_user",
|
|
143
143
|
"friends": [],
|
|
144
144
|
"exposed_functions": [
|
|
@@ -163,7 +163,7 @@ var createUser_default = ABI4;
|
|
|
163
163
|
|
|
164
164
|
// generated_types/depositToVault.ts
|
|
165
165
|
var ABI5 = {
|
|
166
|
-
"address": "
|
|
166
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
167
167
|
"name": "deposit_to_vault",
|
|
168
168
|
"friends": [],
|
|
169
169
|
"exposed_functions": [
|
|
@@ -188,7 +188,7 @@ var depositToVault_default = ABI5;
|
|
|
188
188
|
|
|
189
189
|
// generated_types/depositToken.ts
|
|
190
190
|
var ABI6 = {
|
|
191
|
-
"address": "
|
|
191
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
192
192
|
"name": "deposit_token",
|
|
193
193
|
"friends": [],
|
|
194
194
|
"exposed_functions": [
|
|
@@ -213,7 +213,7 @@ var depositToken_default = ABI6;
|
|
|
213
213
|
|
|
214
214
|
// generated_types/lendToken.ts
|
|
215
215
|
var ABI7 = {
|
|
216
|
-
"address": "
|
|
216
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
217
217
|
"name": "lend_token",
|
|
218
218
|
"friends": [],
|
|
219
219
|
"exposed_functions": [
|
|
@@ -239,7 +239,7 @@ var lendToken_default = ABI7;
|
|
|
239
239
|
|
|
240
240
|
// generated_types/placePerpLimitOrder.ts
|
|
241
241
|
var ABI8 = {
|
|
242
|
-
"address": "
|
|
242
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
243
243
|
"name": "place_perp_limit_order",
|
|
244
244
|
"friends": [],
|
|
245
245
|
"exposed_functions": [
|
|
@@ -268,7 +268,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
268
268
|
|
|
269
269
|
// generated_types/changePerpOrderPrice.ts
|
|
270
270
|
var ABI9 = {
|
|
271
|
-
"address": "
|
|
271
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
272
272
|
"name": "change_perp_order_price",
|
|
273
273
|
"friends": [],
|
|
274
274
|
"exposed_functions": [
|
|
@@ -295,7 +295,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
295
295
|
|
|
296
296
|
// generated_types/placePerpMarketOrder.ts
|
|
297
297
|
var ABI10 = {
|
|
298
|
-
"address": "
|
|
298
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
299
299
|
"name": "place_perp_market_order",
|
|
300
300
|
"friends": [],
|
|
301
301
|
"exposed_functions": [
|
|
@@ -323,7 +323,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
323
323
|
|
|
324
324
|
// generated_types/redeemToken.ts
|
|
325
325
|
var ABI11 = {
|
|
326
|
-
"address": "
|
|
326
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
327
327
|
"name": "redeem_token",
|
|
328
328
|
"friends": [],
|
|
329
329
|
"exposed_functions": [
|
|
@@ -349,7 +349,7 @@ var redeemToken_default = ABI11;
|
|
|
349
349
|
|
|
350
350
|
// generated_types/removeApiKey.ts
|
|
351
351
|
var ABI12 = {
|
|
352
|
-
"address": "
|
|
352
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
353
353
|
"name": "remove_api_key",
|
|
354
354
|
"friends": [],
|
|
355
355
|
"exposed_functions": [
|
|
@@ -373,7 +373,7 @@ var removeApiKey_default = ABI12;
|
|
|
373
373
|
|
|
374
374
|
// generated_types/setAliasName.ts
|
|
375
375
|
var ABI13 = {
|
|
376
|
-
"address": "
|
|
376
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
377
377
|
"name": "set_alias_name",
|
|
378
378
|
"friends": [],
|
|
379
379
|
"exposed_functions": [
|
|
@@ -397,7 +397,7 @@ var setAliasName_default = ABI13;
|
|
|
397
397
|
|
|
398
398
|
// generated_types/setAutolend.ts
|
|
399
399
|
var ABI14 = {
|
|
400
|
-
"address": "
|
|
400
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
401
401
|
"name": "set_autolend",
|
|
402
402
|
"friends": [],
|
|
403
403
|
"exposed_functions": [
|
|
@@ -419,6 +419,57 @@ var ABI14 = {
|
|
|
419
419
|
};
|
|
420
420
|
var setAutolend_default = ABI14;
|
|
421
421
|
|
|
422
|
+
// generated_types/claimReferralFees.ts
|
|
423
|
+
var ABI15 = {
|
|
424
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
425
|
+
"name": "claim_referral_fees",
|
|
426
|
+
"friends": [],
|
|
427
|
+
"exposed_functions": [
|
|
428
|
+
{
|
|
429
|
+
"name": "claim_referral_fees",
|
|
430
|
+
"visibility": "public",
|
|
431
|
+
"is_entry": true,
|
|
432
|
+
"is_view": false,
|
|
433
|
+
"generic_type_params": [],
|
|
434
|
+
"params": [
|
|
435
|
+
"&signer",
|
|
436
|
+
"u64",
|
|
437
|
+
"vector<u64>"
|
|
438
|
+
],
|
|
439
|
+
"return": []
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
"structs": []
|
|
443
|
+
};
|
|
444
|
+
var claimReferralFees_default = ABI15;
|
|
445
|
+
|
|
446
|
+
// generated_types/transferToUser.ts
|
|
447
|
+
var ABI16 = {
|
|
448
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
449
|
+
"name": "transfer_to_user",
|
|
450
|
+
"friends": [],
|
|
451
|
+
"exposed_functions": [
|
|
452
|
+
{
|
|
453
|
+
"name": "transfer_to_user",
|
|
454
|
+
"visibility": "public",
|
|
455
|
+
"is_entry": true,
|
|
456
|
+
"is_view": false,
|
|
457
|
+
"generic_type_params": [],
|
|
458
|
+
"params": [
|
|
459
|
+
"&signer",
|
|
460
|
+
"u64",
|
|
461
|
+
"0x1::object::Object<0x1::fungible_asset::Metadata>",
|
|
462
|
+
"u64",
|
|
463
|
+
"bool",
|
|
464
|
+
"u64"
|
|
465
|
+
],
|
|
466
|
+
"return": []
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"structs": []
|
|
470
|
+
};
|
|
471
|
+
var transferToUser_default = ABI16;
|
|
472
|
+
|
|
422
473
|
// generated_types/typeshareTypes.ts
|
|
423
474
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
424
475
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -503,8 +554,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
503
554
|
})(UserStatus || {});
|
|
504
555
|
|
|
505
556
|
// generated_types/withdrawFromVault.ts
|
|
506
|
-
var
|
|
507
|
-
"address": "
|
|
557
|
+
var ABI17 = {
|
|
558
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
508
559
|
"name": "withdraw_from_vault",
|
|
509
560
|
"friends": [],
|
|
510
561
|
"exposed_functions": [
|
|
@@ -526,7 +577,7 @@ var ABI15 = {
|
|
|
526
577
|
],
|
|
527
578
|
"structs": []
|
|
528
579
|
};
|
|
529
|
-
var withdrawFromVault_default =
|
|
580
|
+
var withdrawFromVault_default = ABI17;
|
|
530
581
|
|
|
531
582
|
// src/utils.ts
|
|
532
583
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -627,6 +678,14 @@ var getTopicFromMessage = (data) => {
|
|
|
627
678
|
return data.content.userId;
|
|
628
679
|
case "BorrowLendUpdate":
|
|
629
680
|
return data.type;
|
|
681
|
+
case "ClaimReferralFee":
|
|
682
|
+
return data.content.userId;
|
|
683
|
+
case "UpdateUserFeeTier":
|
|
684
|
+
return data.content.userId;
|
|
685
|
+
case "UserTransferSent":
|
|
686
|
+
return data.content.senderId;
|
|
687
|
+
case "UserTransferReceived":
|
|
688
|
+
return data.content.receiverId;
|
|
630
689
|
}
|
|
631
690
|
};
|
|
632
691
|
|
|
@@ -1666,6 +1725,78 @@ var Client = class _Client {
|
|
|
1666
1725
|
});
|
|
1667
1726
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1668
1727
|
}
|
|
1728
|
+
async claimReferralFees(params) {
|
|
1729
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1730
|
+
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1731
|
+
aptosConfig: this._aptos.config,
|
|
1732
|
+
abi: parseEntryFunctionAbi({
|
|
1733
|
+
moduleAbi: claimReferralFees_default,
|
|
1734
|
+
functionName: claimReferralFees_default.name,
|
|
1735
|
+
moduleAddress: claimReferralFees_default.address,
|
|
1736
|
+
moduleName: claimReferralFees_default.name
|
|
1737
|
+
}),
|
|
1738
|
+
function: `${claimReferralFees_default.address}::${claimReferralFees_default.name}::claim_referral_fees`,
|
|
1739
|
+
typeArguments: [],
|
|
1740
|
+
functionArguments: [params.userId, params.referrals]
|
|
1741
|
+
});
|
|
1742
|
+
const rawTx = new import_ts_sdk2.RawTransaction(
|
|
1743
|
+
import_ts_sdk2.AccountAddress.from(this._apiKey.accountAddress),
|
|
1744
|
+
BigInt(sequenceNumber),
|
|
1745
|
+
aptosPayload,
|
|
1746
|
+
BigInt(1e6),
|
|
1747
|
+
// maxGasAmount
|
|
1748
|
+
BigInt(100),
|
|
1749
|
+
// gasUnitPrice
|
|
1750
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1751
|
+
// expirationTimestampSecs
|
|
1752
|
+
new import_ts_sdk2.ChainId(this._chainId)
|
|
1753
|
+
);
|
|
1754
|
+
const tx = new import_ts_sdk2.SimpleTransaction(rawTx, import_ts_sdk2.AccountAddress.ZERO);
|
|
1755
|
+
const signature = this._aptos.sign({
|
|
1756
|
+
signer: this._apiKey,
|
|
1757
|
+
transaction: tx
|
|
1758
|
+
});
|
|
1759
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1760
|
+
}
|
|
1761
|
+
async transferToUser(params) {
|
|
1762
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1763
|
+
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1764
|
+
aptosConfig: this._aptos.config,
|
|
1765
|
+
abi: parseEntryFunctionAbi({
|
|
1766
|
+
moduleAbi: transferToUser_default,
|
|
1767
|
+
functionName: transferToUser_default.name,
|
|
1768
|
+
moduleAddress: transferToUser_default.address,
|
|
1769
|
+
moduleName: transferToUser_default.name
|
|
1770
|
+
}),
|
|
1771
|
+
function: `${transferToUser_default.address}::${transferToUser_default.name}::transfer_to_user`,
|
|
1772
|
+
typeArguments: [],
|
|
1773
|
+
functionArguments: [
|
|
1774
|
+
params.userId,
|
|
1775
|
+
params.tokenAddress,
|
|
1776
|
+
toSystemValue(params.amount),
|
|
1777
|
+
params.borrow,
|
|
1778
|
+
params.recipient
|
|
1779
|
+
]
|
|
1780
|
+
});
|
|
1781
|
+
const rawTx = new import_ts_sdk2.RawTransaction(
|
|
1782
|
+
import_ts_sdk2.AccountAddress.from(this._apiKey.accountAddress),
|
|
1783
|
+
BigInt(sequenceNumber),
|
|
1784
|
+
aptosPayload,
|
|
1785
|
+
BigInt(1e6),
|
|
1786
|
+
// maxGasAmount
|
|
1787
|
+
BigInt(100),
|
|
1788
|
+
// gasUnitPrice
|
|
1789
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1790
|
+
// expirationTimestampSecs
|
|
1791
|
+
new import_ts_sdk2.ChainId(this._chainId)
|
|
1792
|
+
);
|
|
1793
|
+
const tx = new import_ts_sdk2.SimpleTransaction(rawTx, import_ts_sdk2.AccountAddress.ZERO);
|
|
1794
|
+
const signature = this._aptos.sign({
|
|
1795
|
+
signer: this._apiKey,
|
|
1796
|
+
transaction: tx
|
|
1797
|
+
});
|
|
1798
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1799
|
+
}
|
|
1669
1800
|
};
|
|
1670
1801
|
var client_default = Client;
|
|
1671
1802
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1697,8 +1828,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1697
1828
|
var import_surf2 = require("@thalalabs/surf");
|
|
1698
1829
|
|
|
1699
1830
|
// generated_types/faucetEntrypoints.ts
|
|
1700
|
-
var
|
|
1701
|
-
"address": "
|
|
1831
|
+
var ABI18 = {
|
|
1832
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1702
1833
|
"name": "faucet_entrypoints",
|
|
1703
1834
|
"friends": [],
|
|
1704
1835
|
"exposed_functions": [
|
|
@@ -1729,11 +1860,11 @@ var ABI16 = {
|
|
|
1729
1860
|
],
|
|
1730
1861
|
"structs": []
|
|
1731
1862
|
};
|
|
1732
|
-
var faucetEntrypoints_default =
|
|
1863
|
+
var faucetEntrypoints_default = ABI18;
|
|
1733
1864
|
|
|
1734
1865
|
// generated_types/testFaucet.ts
|
|
1735
|
-
var
|
|
1736
|
-
"address": "
|
|
1866
|
+
var ABI19 = {
|
|
1867
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1737
1868
|
"name": "test_faucet",
|
|
1738
1869
|
"friends": [],
|
|
1739
1870
|
"exposed_functions": [
|
|
@@ -1770,7 +1901,7 @@ var ABI17 = {
|
|
|
1770
1901
|
],
|
|
1771
1902
|
"return": [
|
|
1772
1903
|
"0x1::object::ConstructorRef",
|
|
1773
|
-
"0x1::object::Object<
|
|
1904
|
+
"0x1::object::Object<0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::Token>"
|
|
1774
1905
|
]
|
|
1775
1906
|
},
|
|
1776
1907
|
{
|
|
@@ -1921,7 +2052,7 @@ var ABI17 = {
|
|
|
1921
2052
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1922
2053
|
],
|
|
1923
2054
|
"return": [
|
|
1924
|
-
"
|
|
2055
|
+
"0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken"
|
|
1925
2056
|
]
|
|
1926
2057
|
}
|
|
1927
2058
|
],
|
|
@@ -1953,7 +2084,7 @@ var ABI17 = {
|
|
|
1953
2084
|
"fields": [
|
|
1954
2085
|
{
|
|
1955
2086
|
"name": "tokens",
|
|
1956
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2087
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken>"
|
|
1957
2088
|
}
|
|
1958
2089
|
]
|
|
1959
2090
|
},
|
|
@@ -1978,7 +2109,7 @@ var ABI17 = {
|
|
|
1978
2109
|
}
|
|
1979
2110
|
]
|
|
1980
2111
|
};
|
|
1981
|
-
var testFaucet_default =
|
|
2112
|
+
var testFaucet_default = ABI19;
|
|
1982
2113
|
|
|
1983
2114
|
// src/testFaucet.ts
|
|
1984
2115
|
var TestFaucet = class _TestFaucet extends client_default {
|
package/dist/index.d.cts
CHANGED
|
@@ -66,6 +66,11 @@ interface ChartCandle {
|
|
|
66
66
|
timestampOpen: string;
|
|
67
67
|
timestampClose: string;
|
|
68
68
|
}
|
|
69
|
+
interface ClaimReferralFee {
|
|
70
|
+
userId: string;
|
|
71
|
+
referralUsers: string[];
|
|
72
|
+
totalAmount: string;
|
|
73
|
+
}
|
|
69
74
|
interface Content {
|
|
70
75
|
price: string;
|
|
71
76
|
size: string;
|
|
@@ -126,13 +131,17 @@ interface ExchangeConfig {
|
|
|
126
131
|
tokens: Record<string, TokenConfigEntry>;
|
|
127
132
|
usdcAddress?: string;
|
|
128
133
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
134
|
+
feeTiers: Record<string, FeeTier>;
|
|
129
135
|
}
|
|
130
|
-
interface
|
|
131
|
-
|
|
136
|
+
interface FeeTier {
|
|
137
|
+
volume: string;
|
|
132
138
|
perpTakerFee: string;
|
|
133
139
|
perpMakerFee: string;
|
|
134
140
|
spotTakerFee: string;
|
|
135
141
|
spotMakerFee: string;
|
|
142
|
+
}
|
|
143
|
+
interface Fees {
|
|
144
|
+
tier: string;
|
|
136
145
|
discount: string;
|
|
137
146
|
referrerUserId?: string;
|
|
138
147
|
referrerKickback: string;
|
|
@@ -358,6 +367,7 @@ interface User {
|
|
|
358
367
|
tokenBalances: Record<string, string>;
|
|
359
368
|
positions: Record<string, PerpPosition>;
|
|
360
369
|
perpOrders: Record<string, Record<string, Order>>;
|
|
370
|
+
referralToClaim: Record<string, string>;
|
|
361
371
|
lendingShares: Record<string, string>;
|
|
362
372
|
borrowShares: Record<string, string>;
|
|
363
373
|
apiKeys: Record<string, string>;
|
|
@@ -586,6 +596,16 @@ interface TradesUpdate {
|
|
|
586
596
|
market: string;
|
|
587
597
|
updates: Trade[];
|
|
588
598
|
}
|
|
599
|
+
interface UpdateUserFeeTier {
|
|
600
|
+
userId: string;
|
|
601
|
+
newTierIndex: string;
|
|
602
|
+
}
|
|
603
|
+
interface UserTransfer {
|
|
604
|
+
senderId: string;
|
|
605
|
+
receiverId: string;
|
|
606
|
+
tokenAddress: string;
|
|
607
|
+
amount: string;
|
|
608
|
+
}
|
|
589
609
|
interface Withdraw {
|
|
590
610
|
userId: string;
|
|
591
611
|
tokenAddress: string;
|
|
@@ -765,6 +785,18 @@ type WsMessage = {
|
|
|
765
785
|
} | {
|
|
766
786
|
type: "BorrowLendUpdate";
|
|
767
787
|
content: BorrowLendUpdate;
|
|
788
|
+
} | {
|
|
789
|
+
type: "ClaimReferralFee";
|
|
790
|
+
content: ClaimReferralFee;
|
|
791
|
+
} | {
|
|
792
|
+
type: "UpdateUserFeeTier";
|
|
793
|
+
content: UpdateUserFeeTier;
|
|
794
|
+
} | {
|
|
795
|
+
type: "UserTransferSent";
|
|
796
|
+
content: UserTransfer;
|
|
797
|
+
} | {
|
|
798
|
+
type: "UserTransferReceived";
|
|
799
|
+
content: UserTransfer;
|
|
768
800
|
};
|
|
769
801
|
|
|
770
802
|
type Address = `0x${string}`;
|
|
@@ -906,6 +938,8 @@ declare class Client {
|
|
|
906
938
|
withdrawFromVault(params: WithdrawFromVaultParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
907
939
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
908
940
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
941
|
+
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
942
|
+
transferToUser(params: TransferToUserParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
909
943
|
sendGetJson: (endpoint: string, message?: {
|
|
910
944
|
[key: string]: any;
|
|
911
945
|
}) => Promise<any>;
|
|
@@ -1016,6 +1050,17 @@ interface LendTokenParams {
|
|
|
1016
1050
|
amount: string;
|
|
1017
1051
|
max: boolean;
|
|
1018
1052
|
}
|
|
1053
|
+
interface ClaimReferralFeesParams {
|
|
1054
|
+
userId: string;
|
|
1055
|
+
referrals: string[];
|
|
1056
|
+
}
|
|
1057
|
+
interface TransferToUserParams {
|
|
1058
|
+
userId: string;
|
|
1059
|
+
tokenAddress: Address;
|
|
1060
|
+
amount: string;
|
|
1061
|
+
borrow: boolean;
|
|
1062
|
+
recipient: string;
|
|
1063
|
+
}
|
|
1019
1064
|
interface IGetChartCandlesInRange {
|
|
1020
1065
|
marketName: string;
|
|
1021
1066
|
interval: ChartInterval;
|
|
@@ -1027,7 +1072,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1027
1072
|
type: 'OracleUpdates';
|
|
1028
1073
|
}>;
|
|
1029
1074
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1030
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey';
|
|
1075
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1031
1076
|
}>;
|
|
1032
1077
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1033
1078
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1065,4 +1110,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1065
1110
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1066
1111
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1067
1112
|
|
|
1068
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, 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 GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTradeStats, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UtilizationCurve, type Vault, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
|
1113
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type ClaimReferralFee, type ClaimReferralFeesParams, 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 GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, 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 GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTradeStats, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,11 @@ interface ChartCandle {
|
|
|
66
66
|
timestampOpen: string;
|
|
67
67
|
timestampClose: string;
|
|
68
68
|
}
|
|
69
|
+
interface ClaimReferralFee {
|
|
70
|
+
userId: string;
|
|
71
|
+
referralUsers: string[];
|
|
72
|
+
totalAmount: string;
|
|
73
|
+
}
|
|
69
74
|
interface Content {
|
|
70
75
|
price: string;
|
|
71
76
|
size: string;
|
|
@@ -126,13 +131,17 @@ interface ExchangeConfig {
|
|
|
126
131
|
tokens: Record<string, TokenConfigEntry>;
|
|
127
132
|
usdcAddress?: string;
|
|
128
133
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
134
|
+
feeTiers: Record<string, FeeTier>;
|
|
129
135
|
}
|
|
130
|
-
interface
|
|
131
|
-
|
|
136
|
+
interface FeeTier {
|
|
137
|
+
volume: string;
|
|
132
138
|
perpTakerFee: string;
|
|
133
139
|
perpMakerFee: string;
|
|
134
140
|
spotTakerFee: string;
|
|
135
141
|
spotMakerFee: string;
|
|
142
|
+
}
|
|
143
|
+
interface Fees {
|
|
144
|
+
tier: string;
|
|
136
145
|
discount: string;
|
|
137
146
|
referrerUserId?: string;
|
|
138
147
|
referrerKickback: string;
|
|
@@ -358,6 +367,7 @@ interface User {
|
|
|
358
367
|
tokenBalances: Record<string, string>;
|
|
359
368
|
positions: Record<string, PerpPosition>;
|
|
360
369
|
perpOrders: Record<string, Record<string, Order>>;
|
|
370
|
+
referralToClaim: Record<string, string>;
|
|
361
371
|
lendingShares: Record<string, string>;
|
|
362
372
|
borrowShares: Record<string, string>;
|
|
363
373
|
apiKeys: Record<string, string>;
|
|
@@ -586,6 +596,16 @@ interface TradesUpdate {
|
|
|
586
596
|
market: string;
|
|
587
597
|
updates: Trade[];
|
|
588
598
|
}
|
|
599
|
+
interface UpdateUserFeeTier {
|
|
600
|
+
userId: string;
|
|
601
|
+
newTierIndex: string;
|
|
602
|
+
}
|
|
603
|
+
interface UserTransfer {
|
|
604
|
+
senderId: string;
|
|
605
|
+
receiverId: string;
|
|
606
|
+
tokenAddress: string;
|
|
607
|
+
amount: string;
|
|
608
|
+
}
|
|
589
609
|
interface Withdraw {
|
|
590
610
|
userId: string;
|
|
591
611
|
tokenAddress: string;
|
|
@@ -765,6 +785,18 @@ type WsMessage = {
|
|
|
765
785
|
} | {
|
|
766
786
|
type: "BorrowLendUpdate";
|
|
767
787
|
content: BorrowLendUpdate;
|
|
788
|
+
} | {
|
|
789
|
+
type: "ClaimReferralFee";
|
|
790
|
+
content: ClaimReferralFee;
|
|
791
|
+
} | {
|
|
792
|
+
type: "UpdateUserFeeTier";
|
|
793
|
+
content: UpdateUserFeeTier;
|
|
794
|
+
} | {
|
|
795
|
+
type: "UserTransferSent";
|
|
796
|
+
content: UserTransfer;
|
|
797
|
+
} | {
|
|
798
|
+
type: "UserTransferReceived";
|
|
799
|
+
content: UserTransfer;
|
|
768
800
|
};
|
|
769
801
|
|
|
770
802
|
type Address = `0x${string}`;
|
|
@@ -906,6 +938,8 @@ declare class Client {
|
|
|
906
938
|
withdrawFromVault(params: WithdrawFromVaultParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
907
939
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
908
940
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
941
|
+
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
942
|
+
transferToUser(params: TransferToUserParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
909
943
|
sendGetJson: (endpoint: string, message?: {
|
|
910
944
|
[key: string]: any;
|
|
911
945
|
}) => Promise<any>;
|
|
@@ -1016,6 +1050,17 @@ interface LendTokenParams {
|
|
|
1016
1050
|
amount: string;
|
|
1017
1051
|
max: boolean;
|
|
1018
1052
|
}
|
|
1053
|
+
interface ClaimReferralFeesParams {
|
|
1054
|
+
userId: string;
|
|
1055
|
+
referrals: string[];
|
|
1056
|
+
}
|
|
1057
|
+
interface TransferToUserParams {
|
|
1058
|
+
userId: string;
|
|
1059
|
+
tokenAddress: Address;
|
|
1060
|
+
amount: string;
|
|
1061
|
+
borrow: boolean;
|
|
1062
|
+
recipient: string;
|
|
1063
|
+
}
|
|
1019
1064
|
interface IGetChartCandlesInRange {
|
|
1020
1065
|
marketName: string;
|
|
1021
1066
|
interval: ChartInterval;
|
|
@@ -1027,7 +1072,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1027
1072
|
type: 'OracleUpdates';
|
|
1028
1073
|
}>;
|
|
1029
1074
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1030
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey';
|
|
1075
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1031
1076
|
}>;
|
|
1032
1077
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1033
1078
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1065,4 +1110,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1065
1110
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1066
1111
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1067
1112
|
|
|
1068
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, 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 GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTradeStats, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, type UserAggregatedReferralStats, type UserAggregatedStats, type UserPortfolioValue, UserStatus, type UtilizationCurve, type Vault, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsBorrowLendUpdate, type WsCommand, type WsFill, type WsMessage, type WsOracleUpdates, type WsPerpMarketUpdates, type WsUserUpdates, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
|
1113
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type ClaimReferralFee, type ClaimReferralFeesParams, 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 GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, 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 GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTradeStats, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type 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 };
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
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": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
352
352
|
"name": "set_autolend",
|
|
353
353
|
"friends": [],
|
|
354
354
|
"exposed_functions": [
|
|
@@ -370,6 +370,57 @@ var ABI14 = {
|
|
|
370
370
|
};
|
|
371
371
|
var setAutolend_default = ABI14;
|
|
372
372
|
|
|
373
|
+
// generated_types/claimReferralFees.ts
|
|
374
|
+
var ABI15 = {
|
|
375
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
376
|
+
"name": "claim_referral_fees",
|
|
377
|
+
"friends": [],
|
|
378
|
+
"exposed_functions": [
|
|
379
|
+
{
|
|
380
|
+
"name": "claim_referral_fees",
|
|
381
|
+
"visibility": "public",
|
|
382
|
+
"is_entry": true,
|
|
383
|
+
"is_view": false,
|
|
384
|
+
"generic_type_params": [],
|
|
385
|
+
"params": [
|
|
386
|
+
"&signer",
|
|
387
|
+
"u64",
|
|
388
|
+
"vector<u64>"
|
|
389
|
+
],
|
|
390
|
+
"return": []
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"structs": []
|
|
394
|
+
};
|
|
395
|
+
var claimReferralFees_default = ABI15;
|
|
396
|
+
|
|
397
|
+
// generated_types/transferToUser.ts
|
|
398
|
+
var ABI16 = {
|
|
399
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
400
|
+
"name": "transfer_to_user",
|
|
401
|
+
"friends": [],
|
|
402
|
+
"exposed_functions": [
|
|
403
|
+
{
|
|
404
|
+
"name": "transfer_to_user",
|
|
405
|
+
"visibility": "public",
|
|
406
|
+
"is_entry": true,
|
|
407
|
+
"is_view": false,
|
|
408
|
+
"generic_type_params": [],
|
|
409
|
+
"params": [
|
|
410
|
+
"&signer",
|
|
411
|
+
"u64",
|
|
412
|
+
"0x1::object::Object<0x1::fungible_asset::Metadata>",
|
|
413
|
+
"u64",
|
|
414
|
+
"bool",
|
|
415
|
+
"u64"
|
|
416
|
+
],
|
|
417
|
+
"return": []
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
"structs": []
|
|
421
|
+
};
|
|
422
|
+
var transferToUser_default = ABI16;
|
|
423
|
+
|
|
373
424
|
// generated_types/typeshareTypes.ts
|
|
374
425
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
375
426
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -454,8 +505,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
454
505
|
})(UserStatus || {});
|
|
455
506
|
|
|
456
507
|
// generated_types/withdrawFromVault.ts
|
|
457
|
-
var
|
|
458
|
-
"address": "
|
|
508
|
+
var ABI17 = {
|
|
509
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
459
510
|
"name": "withdraw_from_vault",
|
|
460
511
|
"friends": [],
|
|
461
512
|
"exposed_functions": [
|
|
@@ -477,7 +528,7 @@ var ABI15 = {
|
|
|
477
528
|
],
|
|
478
529
|
"structs": []
|
|
479
530
|
};
|
|
480
|
-
var withdrawFromVault_default =
|
|
531
|
+
var withdrawFromVault_default = ABI17;
|
|
481
532
|
|
|
482
533
|
// src/utils.ts
|
|
483
534
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -578,6 +629,14 @@ var getTopicFromMessage = (data) => {
|
|
|
578
629
|
return data.content.userId;
|
|
579
630
|
case "BorrowLendUpdate":
|
|
580
631
|
return data.type;
|
|
632
|
+
case "ClaimReferralFee":
|
|
633
|
+
return data.content.userId;
|
|
634
|
+
case "UpdateUserFeeTier":
|
|
635
|
+
return data.content.userId;
|
|
636
|
+
case "UserTransferSent":
|
|
637
|
+
return data.content.senderId;
|
|
638
|
+
case "UserTransferReceived":
|
|
639
|
+
return data.content.receiverId;
|
|
581
640
|
}
|
|
582
641
|
};
|
|
583
642
|
|
|
@@ -1617,6 +1676,78 @@ var Client = class _Client {
|
|
|
1617
1676
|
});
|
|
1618
1677
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1619
1678
|
}
|
|
1679
|
+
async claimReferralFees(params) {
|
|
1680
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1681
|
+
const aptosPayload = await generateTransactionPayload({
|
|
1682
|
+
aptosConfig: this._aptos.config,
|
|
1683
|
+
abi: parseEntryFunctionAbi({
|
|
1684
|
+
moduleAbi: claimReferralFees_default,
|
|
1685
|
+
functionName: claimReferralFees_default.name,
|
|
1686
|
+
moduleAddress: claimReferralFees_default.address,
|
|
1687
|
+
moduleName: claimReferralFees_default.name
|
|
1688
|
+
}),
|
|
1689
|
+
function: `${claimReferralFees_default.address}::${claimReferralFees_default.name}::claim_referral_fees`,
|
|
1690
|
+
typeArguments: [],
|
|
1691
|
+
functionArguments: [params.userId, params.referrals]
|
|
1692
|
+
});
|
|
1693
|
+
const rawTx = new RawTransaction(
|
|
1694
|
+
AccountAddress.from(this._apiKey.accountAddress),
|
|
1695
|
+
BigInt(sequenceNumber),
|
|
1696
|
+
aptosPayload,
|
|
1697
|
+
BigInt(1e6),
|
|
1698
|
+
// maxGasAmount
|
|
1699
|
+
BigInt(100),
|
|
1700
|
+
// gasUnitPrice
|
|
1701
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1702
|
+
// expirationTimestampSecs
|
|
1703
|
+
new ChainId(this._chainId)
|
|
1704
|
+
);
|
|
1705
|
+
const tx = new SimpleTransaction(rawTx, AccountAddress.ZERO);
|
|
1706
|
+
const signature = this._aptos.sign({
|
|
1707
|
+
signer: this._apiKey,
|
|
1708
|
+
transaction: tx
|
|
1709
|
+
});
|
|
1710
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1711
|
+
}
|
|
1712
|
+
async transferToUser(params) {
|
|
1713
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1714
|
+
const aptosPayload = await generateTransactionPayload({
|
|
1715
|
+
aptosConfig: this._aptos.config,
|
|
1716
|
+
abi: parseEntryFunctionAbi({
|
|
1717
|
+
moduleAbi: transferToUser_default,
|
|
1718
|
+
functionName: transferToUser_default.name,
|
|
1719
|
+
moduleAddress: transferToUser_default.address,
|
|
1720
|
+
moduleName: transferToUser_default.name
|
|
1721
|
+
}),
|
|
1722
|
+
function: `${transferToUser_default.address}::${transferToUser_default.name}::transfer_to_user`,
|
|
1723
|
+
typeArguments: [],
|
|
1724
|
+
functionArguments: [
|
|
1725
|
+
params.userId,
|
|
1726
|
+
params.tokenAddress,
|
|
1727
|
+
toSystemValue(params.amount),
|
|
1728
|
+
params.borrow,
|
|
1729
|
+
params.recipient
|
|
1730
|
+
]
|
|
1731
|
+
});
|
|
1732
|
+
const rawTx = new RawTransaction(
|
|
1733
|
+
AccountAddress.from(this._apiKey.accountAddress),
|
|
1734
|
+
BigInt(sequenceNumber),
|
|
1735
|
+
aptosPayload,
|
|
1736
|
+
BigInt(1e6),
|
|
1737
|
+
// maxGasAmount
|
|
1738
|
+
BigInt(100),
|
|
1739
|
+
// gasUnitPrice
|
|
1740
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1741
|
+
// expirationTimestampSecs
|
|
1742
|
+
new ChainId(this._chainId)
|
|
1743
|
+
);
|
|
1744
|
+
const tx = new SimpleTransaction(rawTx, AccountAddress.ZERO);
|
|
1745
|
+
const signature = this._aptos.sign({
|
|
1746
|
+
signer: this._apiKey,
|
|
1747
|
+
transaction: tx
|
|
1748
|
+
});
|
|
1749
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1750
|
+
}
|
|
1620
1751
|
};
|
|
1621
1752
|
var client_default = Client;
|
|
1622
1753
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1648,8 +1779,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1648
1779
|
import { createEntryPayload } from "@thalalabs/surf";
|
|
1649
1780
|
|
|
1650
1781
|
// generated_types/faucetEntrypoints.ts
|
|
1651
|
-
var
|
|
1652
|
-
"address": "
|
|
1782
|
+
var ABI18 = {
|
|
1783
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1653
1784
|
"name": "faucet_entrypoints",
|
|
1654
1785
|
"friends": [],
|
|
1655
1786
|
"exposed_functions": [
|
|
@@ -1680,11 +1811,11 @@ var ABI16 = {
|
|
|
1680
1811
|
],
|
|
1681
1812
|
"structs": []
|
|
1682
1813
|
};
|
|
1683
|
-
var faucetEntrypoints_default =
|
|
1814
|
+
var faucetEntrypoints_default = ABI18;
|
|
1684
1815
|
|
|
1685
1816
|
// generated_types/testFaucet.ts
|
|
1686
|
-
var
|
|
1687
|
-
"address": "
|
|
1817
|
+
var ABI19 = {
|
|
1818
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1688
1819
|
"name": "test_faucet",
|
|
1689
1820
|
"friends": [],
|
|
1690
1821
|
"exposed_functions": [
|
|
@@ -1721,7 +1852,7 @@ var ABI17 = {
|
|
|
1721
1852
|
],
|
|
1722
1853
|
"return": [
|
|
1723
1854
|
"0x1::object::ConstructorRef",
|
|
1724
|
-
"0x1::object::Object<
|
|
1855
|
+
"0x1::object::Object<0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::Token>"
|
|
1725
1856
|
]
|
|
1726
1857
|
},
|
|
1727
1858
|
{
|
|
@@ -1872,7 +2003,7 @@ var ABI17 = {
|
|
|
1872
2003
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1873
2004
|
],
|
|
1874
2005
|
"return": [
|
|
1875
|
-
"
|
|
2006
|
+
"0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken"
|
|
1876
2007
|
]
|
|
1877
2008
|
}
|
|
1878
2009
|
],
|
|
@@ -1904,7 +2035,7 @@ var ABI17 = {
|
|
|
1904
2035
|
"fields": [
|
|
1905
2036
|
{
|
|
1906
2037
|
"name": "tokens",
|
|
1907
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2038
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken>"
|
|
1908
2039
|
}
|
|
1909
2040
|
]
|
|
1910
2041
|
},
|
|
@@ -1929,7 +2060,7 @@ var ABI17 = {
|
|
|
1929
2060
|
}
|
|
1930
2061
|
]
|
|
1931
2062
|
};
|
|
1932
|
-
var testFaucet_default =
|
|
2063
|
+
var testFaucet_default = ABI19;
|
|
1933
2064
|
|
|
1934
2065
|
// src/testFaucet.ts
|
|
1935
2066
|
var TestFaucet = class _TestFaucet extends client_default {
|