@nightlylabs/dex-sdk 0.0.72 → 0.0.73
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 +85 -26
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +85 -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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
401
401
|
"name": "set_autolend",
|
|
402
402
|
"friends": [],
|
|
403
403
|
"exposed_functions": [
|
|
@@ -419,6 +419,30 @@ var ABI14 = {
|
|
|
419
419
|
};
|
|
420
420
|
var setAutolend_default = ABI14;
|
|
421
421
|
|
|
422
|
+
// generated_types/claimReferralFees.ts
|
|
423
|
+
var ABI15 = {
|
|
424
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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
|
+
|
|
422
446
|
// generated_types/typeshareTypes.ts
|
|
423
447
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
424
448
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -503,8 +527,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
503
527
|
})(UserStatus || {});
|
|
504
528
|
|
|
505
529
|
// generated_types/withdrawFromVault.ts
|
|
506
|
-
var
|
|
507
|
-
"address": "
|
|
530
|
+
var ABI16 = {
|
|
531
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
508
532
|
"name": "withdraw_from_vault",
|
|
509
533
|
"friends": [],
|
|
510
534
|
"exposed_functions": [
|
|
@@ -526,7 +550,7 @@ var ABI15 = {
|
|
|
526
550
|
],
|
|
527
551
|
"structs": []
|
|
528
552
|
};
|
|
529
|
-
var withdrawFromVault_default =
|
|
553
|
+
var withdrawFromVault_default = ABI16;
|
|
530
554
|
|
|
531
555
|
// src/utils.ts
|
|
532
556
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -627,6 +651,8 @@ var getTopicFromMessage = (data) => {
|
|
|
627
651
|
return data.content.userId;
|
|
628
652
|
case "BorrowLendUpdate":
|
|
629
653
|
return data.type;
|
|
654
|
+
case "ClaimReferralFee":
|
|
655
|
+
return data.content.userId;
|
|
630
656
|
}
|
|
631
657
|
};
|
|
632
658
|
|
|
@@ -1666,6 +1692,39 @@ var Client = class _Client {
|
|
|
1666
1692
|
});
|
|
1667
1693
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1668
1694
|
}
|
|
1695
|
+
async claimReferralFees(params) {
|
|
1696
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1697
|
+
const aptosPayload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1698
|
+
aptosConfig: this._aptos.config,
|
|
1699
|
+
abi: parseEntryFunctionAbi({
|
|
1700
|
+
moduleAbi: claimReferralFees_default,
|
|
1701
|
+
functionName: claimReferralFees_default.name,
|
|
1702
|
+
moduleAddress: claimReferralFees_default.address,
|
|
1703
|
+
moduleName: claimReferralFees_default.name
|
|
1704
|
+
}),
|
|
1705
|
+
function: `${claimReferralFees_default.address}::${claimReferralFees_default.name}::claim_referral_fees`,
|
|
1706
|
+
typeArguments: [],
|
|
1707
|
+
functionArguments: [params.userId, params.referrals]
|
|
1708
|
+
});
|
|
1709
|
+
const rawTx = new import_ts_sdk2.RawTransaction(
|
|
1710
|
+
import_ts_sdk2.AccountAddress.from(this._apiKey.accountAddress),
|
|
1711
|
+
BigInt(sequenceNumber),
|
|
1712
|
+
aptosPayload,
|
|
1713
|
+
BigInt(1e6),
|
|
1714
|
+
// maxGasAmount
|
|
1715
|
+
BigInt(100),
|
|
1716
|
+
// gasUnitPrice
|
|
1717
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1718
|
+
// expirationTimestampSecs
|
|
1719
|
+
new import_ts_sdk2.ChainId(this._chainId)
|
|
1720
|
+
);
|
|
1721
|
+
const tx = new import_ts_sdk2.SimpleTransaction(rawTx, import_ts_sdk2.AccountAddress.ZERO);
|
|
1722
|
+
const signature = this._aptos.sign({
|
|
1723
|
+
signer: this._apiKey,
|
|
1724
|
+
transaction: tx
|
|
1725
|
+
});
|
|
1726
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1727
|
+
}
|
|
1669
1728
|
};
|
|
1670
1729
|
var client_default = Client;
|
|
1671
1730
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1697,8 +1756,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1697
1756
|
var import_surf2 = require("@thalalabs/surf");
|
|
1698
1757
|
|
|
1699
1758
|
// generated_types/faucetEntrypoints.ts
|
|
1700
|
-
var
|
|
1701
|
-
"address": "
|
|
1759
|
+
var ABI17 = {
|
|
1760
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1702
1761
|
"name": "faucet_entrypoints",
|
|
1703
1762
|
"friends": [],
|
|
1704
1763
|
"exposed_functions": [
|
|
@@ -1729,11 +1788,11 @@ var ABI16 = {
|
|
|
1729
1788
|
],
|
|
1730
1789
|
"structs": []
|
|
1731
1790
|
};
|
|
1732
|
-
var faucetEntrypoints_default =
|
|
1791
|
+
var faucetEntrypoints_default = ABI17;
|
|
1733
1792
|
|
|
1734
1793
|
// generated_types/testFaucet.ts
|
|
1735
|
-
var
|
|
1736
|
-
"address": "
|
|
1794
|
+
var ABI18 = {
|
|
1795
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1737
1796
|
"name": "test_faucet",
|
|
1738
1797
|
"friends": [],
|
|
1739
1798
|
"exposed_functions": [
|
|
@@ -1770,7 +1829,7 @@ var ABI17 = {
|
|
|
1770
1829
|
],
|
|
1771
1830
|
"return": [
|
|
1772
1831
|
"0x1::object::ConstructorRef",
|
|
1773
|
-
"0x1::object::Object<
|
|
1832
|
+
"0x1::object::Object<0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::Token>"
|
|
1774
1833
|
]
|
|
1775
1834
|
},
|
|
1776
1835
|
{
|
|
@@ -1921,7 +1980,7 @@ var ABI17 = {
|
|
|
1921
1980
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1922
1981
|
],
|
|
1923
1982
|
"return": [
|
|
1924
|
-
"
|
|
1983
|
+
"0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken"
|
|
1925
1984
|
]
|
|
1926
1985
|
}
|
|
1927
1986
|
],
|
|
@@ -1953,7 +2012,7 @@ var ABI17 = {
|
|
|
1953
2012
|
"fields": [
|
|
1954
2013
|
{
|
|
1955
2014
|
"name": "tokens",
|
|
1956
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2015
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken>"
|
|
1957
2016
|
}
|
|
1958
2017
|
]
|
|
1959
2018
|
},
|
|
@@ -1978,7 +2037,7 @@ var ABI17 = {
|
|
|
1978
2037
|
}
|
|
1979
2038
|
]
|
|
1980
2039
|
};
|
|
1981
|
-
var testFaucet_default =
|
|
2040
|
+
var testFaucet_default = ABI18;
|
|
1982
2041
|
|
|
1983
2042
|
// src/testFaucet.ts
|
|
1984
2043
|
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;
|
|
@@ -358,6 +363,7 @@ interface User {
|
|
|
358
363
|
tokenBalances: Record<string, string>;
|
|
359
364
|
positions: Record<string, PerpPosition>;
|
|
360
365
|
perpOrders: Record<string, Record<string, Order>>;
|
|
366
|
+
referralToClaim: Record<string, string>;
|
|
361
367
|
lendingShares: Record<string, string>;
|
|
362
368
|
borrowShares: Record<string, string>;
|
|
363
369
|
apiKeys: Record<string, string>;
|
|
@@ -765,6 +771,9 @@ type WsMessage = {
|
|
|
765
771
|
} | {
|
|
766
772
|
type: "BorrowLendUpdate";
|
|
767
773
|
content: BorrowLendUpdate;
|
|
774
|
+
} | {
|
|
775
|
+
type: "ClaimReferralFee";
|
|
776
|
+
content: ClaimReferralFee;
|
|
768
777
|
};
|
|
769
778
|
|
|
770
779
|
type Address = `0x${string}`;
|
|
@@ -906,6 +915,7 @@ declare class Client {
|
|
|
906
915
|
withdrawFromVault(params: WithdrawFromVaultParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
907
916
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
908
917
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
918
|
+
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
909
919
|
sendGetJson: (endpoint: string, message?: {
|
|
910
920
|
[key: string]: any;
|
|
911
921
|
}) => Promise<any>;
|
|
@@ -1016,6 +1026,10 @@ interface LendTokenParams {
|
|
|
1016
1026
|
amount: string;
|
|
1017
1027
|
max: boolean;
|
|
1018
1028
|
}
|
|
1029
|
+
interface ClaimReferralFeesParams {
|
|
1030
|
+
userId: string;
|
|
1031
|
+
referrals: string[];
|
|
1032
|
+
}
|
|
1019
1033
|
interface IGetChartCandlesInRange {
|
|
1020
1034
|
marketName: string;
|
|
1021
1035
|
interval: ChartInterval;
|
|
@@ -1027,7 +1041,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1027
1041
|
type: 'OracleUpdates';
|
|
1028
1042
|
}>;
|
|
1029
1043
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1030
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey';
|
|
1044
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1031
1045
|
}>;
|
|
1032
1046
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1033
1047
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1065,4 +1079,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1065
1079
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1066
1080
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1067
1081
|
|
|
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 };
|
|
1082
|
+
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 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 };
|
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;
|
|
@@ -358,6 +363,7 @@ interface User {
|
|
|
358
363
|
tokenBalances: Record<string, string>;
|
|
359
364
|
positions: Record<string, PerpPosition>;
|
|
360
365
|
perpOrders: Record<string, Record<string, Order>>;
|
|
366
|
+
referralToClaim: Record<string, string>;
|
|
361
367
|
lendingShares: Record<string, string>;
|
|
362
368
|
borrowShares: Record<string, string>;
|
|
363
369
|
apiKeys: Record<string, string>;
|
|
@@ -765,6 +771,9 @@ type WsMessage = {
|
|
|
765
771
|
} | {
|
|
766
772
|
type: "BorrowLendUpdate";
|
|
767
773
|
content: BorrowLendUpdate;
|
|
774
|
+
} | {
|
|
775
|
+
type: "ClaimReferralFee";
|
|
776
|
+
content: ClaimReferralFee;
|
|
768
777
|
};
|
|
769
778
|
|
|
770
779
|
type Address = `0x${string}`;
|
|
@@ -906,6 +915,7 @@ declare class Client {
|
|
|
906
915
|
withdrawFromVault(params: WithdrawFromVaultParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
907
916
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
908
917
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
918
|
+
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
909
919
|
sendGetJson: (endpoint: string, message?: {
|
|
910
920
|
[key: string]: any;
|
|
911
921
|
}) => Promise<any>;
|
|
@@ -1016,6 +1026,10 @@ interface LendTokenParams {
|
|
|
1016
1026
|
amount: string;
|
|
1017
1027
|
max: boolean;
|
|
1018
1028
|
}
|
|
1029
|
+
interface ClaimReferralFeesParams {
|
|
1030
|
+
userId: string;
|
|
1031
|
+
referrals: string[];
|
|
1032
|
+
}
|
|
1019
1033
|
interface IGetChartCandlesInRange {
|
|
1020
1034
|
marketName: string;
|
|
1021
1035
|
interval: ChartInterval;
|
|
@@ -1027,7 +1041,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1027
1041
|
type: 'OracleUpdates';
|
|
1028
1042
|
}>;
|
|
1029
1043
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1030
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey';
|
|
1044
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1031
1045
|
}>;
|
|
1032
1046
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1033
1047
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1065,4 +1079,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1065
1079
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1066
1080
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1067
1081
|
|
|
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 };
|
|
1082
|
+
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 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 };
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
352
352
|
"name": "set_autolend",
|
|
353
353
|
"friends": [],
|
|
354
354
|
"exposed_functions": [
|
|
@@ -370,6 +370,30 @@ var ABI14 = {
|
|
|
370
370
|
};
|
|
371
371
|
var setAutolend_default = ABI14;
|
|
372
372
|
|
|
373
|
+
// generated_types/claimReferralFees.ts
|
|
374
|
+
var ABI15 = {
|
|
375
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
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
|
+
|
|
373
397
|
// generated_types/typeshareTypes.ts
|
|
374
398
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
375
399
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -454,8 +478,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
454
478
|
})(UserStatus || {});
|
|
455
479
|
|
|
456
480
|
// generated_types/withdrawFromVault.ts
|
|
457
|
-
var
|
|
458
|
-
"address": "
|
|
481
|
+
var ABI16 = {
|
|
482
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
459
483
|
"name": "withdraw_from_vault",
|
|
460
484
|
"friends": [],
|
|
461
485
|
"exposed_functions": [
|
|
@@ -477,7 +501,7 @@ var ABI15 = {
|
|
|
477
501
|
],
|
|
478
502
|
"structs": []
|
|
479
503
|
};
|
|
480
|
-
var withdrawFromVault_default =
|
|
504
|
+
var withdrawFromVault_default = ABI16;
|
|
481
505
|
|
|
482
506
|
// src/utils.ts
|
|
483
507
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -578,6 +602,8 @@ var getTopicFromMessage = (data) => {
|
|
|
578
602
|
return data.content.userId;
|
|
579
603
|
case "BorrowLendUpdate":
|
|
580
604
|
return data.type;
|
|
605
|
+
case "ClaimReferralFee":
|
|
606
|
+
return data.content.userId;
|
|
581
607
|
}
|
|
582
608
|
};
|
|
583
609
|
|
|
@@ -1617,6 +1643,39 @@ var Client = class _Client {
|
|
|
1617
1643
|
});
|
|
1618
1644
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1619
1645
|
}
|
|
1646
|
+
async claimReferralFees(params) {
|
|
1647
|
+
const sequenceNumber = await this.getApiKeySequenceNumber();
|
|
1648
|
+
const aptosPayload = await generateTransactionPayload({
|
|
1649
|
+
aptosConfig: this._aptos.config,
|
|
1650
|
+
abi: parseEntryFunctionAbi({
|
|
1651
|
+
moduleAbi: claimReferralFees_default,
|
|
1652
|
+
functionName: claimReferralFees_default.name,
|
|
1653
|
+
moduleAddress: claimReferralFees_default.address,
|
|
1654
|
+
moduleName: claimReferralFees_default.name
|
|
1655
|
+
}),
|
|
1656
|
+
function: `${claimReferralFees_default.address}::${claimReferralFees_default.name}::claim_referral_fees`,
|
|
1657
|
+
typeArguments: [],
|
|
1658
|
+
functionArguments: [params.userId, params.referrals]
|
|
1659
|
+
});
|
|
1660
|
+
const rawTx = new RawTransaction(
|
|
1661
|
+
AccountAddress.from(this._apiKey.accountAddress),
|
|
1662
|
+
BigInt(sequenceNumber),
|
|
1663
|
+
aptosPayload,
|
|
1664
|
+
BigInt(1e6),
|
|
1665
|
+
// maxGasAmount
|
|
1666
|
+
BigInt(100),
|
|
1667
|
+
// gasUnitPrice
|
|
1668
|
+
BigInt(Math.floor(Date.now() / 1e3) + 10),
|
|
1669
|
+
// expirationTimestampSecs
|
|
1670
|
+
new ChainId(this._chainId)
|
|
1671
|
+
);
|
|
1672
|
+
const tx = new SimpleTransaction(rawTx, AccountAddress.ZERO);
|
|
1673
|
+
const signature = this._aptos.sign({
|
|
1674
|
+
signer: this._apiKey,
|
|
1675
|
+
transaction: tx
|
|
1676
|
+
});
|
|
1677
|
+
return await this.submitSponsoredTransaction(tx, signature);
|
|
1678
|
+
}
|
|
1620
1679
|
};
|
|
1621
1680
|
var client_default = Client;
|
|
1622
1681
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1648,8 +1707,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1648
1707
|
import { createEntryPayload } from "@thalalabs/surf";
|
|
1649
1708
|
|
|
1650
1709
|
// generated_types/faucetEntrypoints.ts
|
|
1651
|
-
var
|
|
1652
|
-
"address": "
|
|
1710
|
+
var ABI17 = {
|
|
1711
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1653
1712
|
"name": "faucet_entrypoints",
|
|
1654
1713
|
"friends": [],
|
|
1655
1714
|
"exposed_functions": [
|
|
@@ -1680,11 +1739,11 @@ var ABI16 = {
|
|
|
1680
1739
|
],
|
|
1681
1740
|
"structs": []
|
|
1682
1741
|
};
|
|
1683
|
-
var faucetEntrypoints_default =
|
|
1742
|
+
var faucetEntrypoints_default = ABI17;
|
|
1684
1743
|
|
|
1685
1744
|
// generated_types/testFaucet.ts
|
|
1686
|
-
var
|
|
1687
|
-
"address": "
|
|
1745
|
+
var ABI18 = {
|
|
1746
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1688
1747
|
"name": "test_faucet",
|
|
1689
1748
|
"friends": [],
|
|
1690
1749
|
"exposed_functions": [
|
|
@@ -1721,7 +1780,7 @@ var ABI17 = {
|
|
|
1721
1780
|
],
|
|
1722
1781
|
"return": [
|
|
1723
1782
|
"0x1::object::ConstructorRef",
|
|
1724
|
-
"0x1::object::Object<
|
|
1783
|
+
"0x1::object::Object<0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::Token>"
|
|
1725
1784
|
]
|
|
1726
1785
|
},
|
|
1727
1786
|
{
|
|
@@ -1872,7 +1931,7 @@ var ABI17 = {
|
|
|
1872
1931
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1873
1932
|
],
|
|
1874
1933
|
"return": [
|
|
1875
|
-
"
|
|
1934
|
+
"0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken"
|
|
1876
1935
|
]
|
|
1877
1936
|
}
|
|
1878
1937
|
],
|
|
@@ -1904,7 +1963,7 @@ var ABI17 = {
|
|
|
1904
1963
|
"fields": [
|
|
1905
1964
|
{
|
|
1906
1965
|
"name": "tokens",
|
|
1907
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1966
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken>"
|
|
1908
1967
|
}
|
|
1909
1968
|
]
|
|
1910
1969
|
},
|
|
@@ -1929,7 +1988,7 @@ var ABI17 = {
|
|
|
1929
1988
|
}
|
|
1930
1989
|
]
|
|
1931
1990
|
};
|
|
1932
|
-
var testFaucet_default =
|
|
1991
|
+
var testFaucet_default = ABI18;
|
|
1933
1992
|
|
|
1934
1993
|
// src/testFaucet.ts
|
|
1935
1994
|
var TestFaucet = class _TestFaucet extends client_default {
|