@nightlylabs/dex-sdk 0.0.71 → 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 +88 -28
- package/dist/index.d.cts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +89 -28
- 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
|
|
|
@@ -1126,12 +1152,13 @@ var Client = class _Client {
|
|
|
1126
1152
|
typeArguments: [],
|
|
1127
1153
|
functionArguments: [params.name, params.referralId]
|
|
1128
1154
|
});
|
|
1129
|
-
const tx = new import_ts_sdk2.
|
|
1155
|
+
const tx = new import_ts_sdk2.MultiAgentTransaction(
|
|
1130
1156
|
await (0, import_ts_sdk2.generateRawTransaction)({
|
|
1131
1157
|
sender: params.sender,
|
|
1132
1158
|
aptosConfig: this._aptos.config,
|
|
1133
1159
|
payload
|
|
1134
|
-
})
|
|
1160
|
+
}),
|
|
1161
|
+
[apiKey.accountAddress]
|
|
1135
1162
|
);
|
|
1136
1163
|
const signature = this._aptos.sign({
|
|
1137
1164
|
signer: apiKey,
|
|
@@ -1665,6 +1692,39 @@ var Client = class _Client {
|
|
|
1665
1692
|
});
|
|
1666
1693
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1667
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
|
+
}
|
|
1668
1728
|
};
|
|
1669
1729
|
var client_default = Client;
|
|
1670
1730
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1696,8 +1756,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1696
1756
|
var import_surf2 = require("@thalalabs/surf");
|
|
1697
1757
|
|
|
1698
1758
|
// generated_types/faucetEntrypoints.ts
|
|
1699
|
-
var
|
|
1700
|
-
"address": "
|
|
1759
|
+
var ABI17 = {
|
|
1760
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1701
1761
|
"name": "faucet_entrypoints",
|
|
1702
1762
|
"friends": [],
|
|
1703
1763
|
"exposed_functions": [
|
|
@@ -1728,11 +1788,11 @@ var ABI16 = {
|
|
|
1728
1788
|
],
|
|
1729
1789
|
"structs": []
|
|
1730
1790
|
};
|
|
1731
|
-
var faucetEntrypoints_default =
|
|
1791
|
+
var faucetEntrypoints_default = ABI17;
|
|
1732
1792
|
|
|
1733
1793
|
// generated_types/testFaucet.ts
|
|
1734
|
-
var
|
|
1735
|
-
"address": "
|
|
1794
|
+
var ABI18 = {
|
|
1795
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1736
1796
|
"name": "test_faucet",
|
|
1737
1797
|
"friends": [],
|
|
1738
1798
|
"exposed_functions": [
|
|
@@ -1769,7 +1829,7 @@ var ABI17 = {
|
|
|
1769
1829
|
],
|
|
1770
1830
|
"return": [
|
|
1771
1831
|
"0x1::object::ConstructorRef",
|
|
1772
|
-
"0x1::object::Object<
|
|
1832
|
+
"0x1::object::Object<0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::Token>"
|
|
1773
1833
|
]
|
|
1774
1834
|
},
|
|
1775
1835
|
{
|
|
@@ -1920,7 +1980,7 @@ var ABI17 = {
|
|
|
1920
1980
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1921
1981
|
],
|
|
1922
1982
|
"return": [
|
|
1923
|
-
"
|
|
1983
|
+
"0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken"
|
|
1924
1984
|
]
|
|
1925
1985
|
}
|
|
1926
1986
|
],
|
|
@@ -1952,7 +2012,7 @@ var ABI17 = {
|
|
|
1952
2012
|
"fields": [
|
|
1953
2013
|
{
|
|
1954
2014
|
"name": "tokens",
|
|
1955
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2015
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken>"
|
|
1956
2016
|
}
|
|
1957
2017
|
]
|
|
1958
2018
|
},
|
|
@@ -1977,7 +2037,7 @@ var ABI17 = {
|
|
|
1977
2037
|
}
|
|
1978
2038
|
]
|
|
1979
2039
|
};
|
|
1980
|
-
var testFaucet_default =
|
|
2040
|
+
var testFaucet_default = ABI18;
|
|
1981
2041
|
|
|
1982
2042
|
// src/testFaucet.ts
|
|
1983
2043
|
var TestFaucet = class _TestFaucet extends client_default {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
|
-
import { Account, Aptos,
|
|
2
|
+
import { Account, Aptos, MultiAgentTransaction, AccountAuthenticator, SimpleTransaction, MoveModule, EntryFunctionABI } from '@aptos-labs/ts-sdk';
|
|
3
3
|
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
@@ -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}`;
|
|
@@ -880,7 +889,7 @@ declare class Client {
|
|
|
880
889
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
881
890
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
882
891
|
createUser(params: CreateUserParams): Promise<{
|
|
883
|
-
tx:
|
|
892
|
+
tx: MultiAgentTransaction;
|
|
884
893
|
signature: AccountAuthenticator;
|
|
885
894
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
886
895
|
}>;
|
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
|
-
import { Account, Aptos,
|
|
2
|
+
import { Account, Aptos, MultiAgentTransaction, AccountAuthenticator, SimpleTransaction, MoveModule, EntryFunctionABI } from '@aptos-labs/ts-sdk';
|
|
3
3
|
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
@@ -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}`;
|
|
@@ -880,7 +889,7 @@ declare class Client {
|
|
|
880
889
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
881
890
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
882
891
|
createUser(params: CreateUserParams): Promise<{
|
|
883
|
-
tx:
|
|
892
|
+
tx: MultiAgentTransaction;
|
|
884
893
|
signature: AccountAuthenticator;
|
|
885
894
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
886
895
|
}>;
|
|
@@ -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
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
findFirstNonSignerArg,
|
|
6
6
|
generateRawTransaction,
|
|
7
7
|
generateTransactionPayload,
|
|
8
|
+
MultiAgentTransaction,
|
|
8
9
|
parseTypeTag,
|
|
9
10
|
RawTransaction,
|
|
10
11
|
SimpleTransaction
|
|
@@ -15,7 +16,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
15
16
|
|
|
16
17
|
// generated_types/addApiKey.ts
|
|
17
18
|
var ABI = {
|
|
18
|
-
"address": "
|
|
19
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
19
20
|
"name": "add_api_key",
|
|
20
21
|
"friends": [],
|
|
21
22
|
"exposed_functions": [
|
|
@@ -40,7 +41,7 @@ var addApiKey_default = ABI;
|
|
|
40
41
|
|
|
41
42
|
// generated_types/cancelAllPerpOrders.ts
|
|
42
43
|
var ABI2 = {
|
|
43
|
-
"address": "
|
|
44
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
44
45
|
"name": "cancel_all_perp_orders",
|
|
45
46
|
"friends": [],
|
|
46
47
|
"exposed_functions": [
|
|
@@ -63,7 +64,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
63
64
|
|
|
64
65
|
// generated_types/cancelPerpOrders.ts
|
|
65
66
|
var ABI3 = {
|
|
66
|
-
"address": "
|
|
67
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
67
68
|
"name": "cancel_perp_orders",
|
|
68
69
|
"friends": [],
|
|
69
70
|
"exposed_functions": [
|
|
@@ -88,7 +89,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
88
89
|
|
|
89
90
|
// generated_types/createUser.ts
|
|
90
91
|
var ABI4 = {
|
|
91
|
-
"address": "
|
|
92
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
92
93
|
"name": "create_user",
|
|
93
94
|
"friends": [],
|
|
94
95
|
"exposed_functions": [
|
|
@@ -113,7 +114,7 @@ var createUser_default = ABI4;
|
|
|
113
114
|
|
|
114
115
|
// generated_types/depositToVault.ts
|
|
115
116
|
var ABI5 = {
|
|
116
|
-
"address": "
|
|
117
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
117
118
|
"name": "deposit_to_vault",
|
|
118
119
|
"friends": [],
|
|
119
120
|
"exposed_functions": [
|
|
@@ -138,7 +139,7 @@ var depositToVault_default = ABI5;
|
|
|
138
139
|
|
|
139
140
|
// generated_types/depositToken.ts
|
|
140
141
|
var ABI6 = {
|
|
141
|
-
"address": "
|
|
142
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
142
143
|
"name": "deposit_token",
|
|
143
144
|
"friends": [],
|
|
144
145
|
"exposed_functions": [
|
|
@@ -163,7 +164,7 @@ var depositToken_default = ABI6;
|
|
|
163
164
|
|
|
164
165
|
// generated_types/lendToken.ts
|
|
165
166
|
var ABI7 = {
|
|
166
|
-
"address": "
|
|
167
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
167
168
|
"name": "lend_token",
|
|
168
169
|
"friends": [],
|
|
169
170
|
"exposed_functions": [
|
|
@@ -189,7 +190,7 @@ var lendToken_default = ABI7;
|
|
|
189
190
|
|
|
190
191
|
// generated_types/placePerpLimitOrder.ts
|
|
191
192
|
var ABI8 = {
|
|
192
|
-
"address": "
|
|
193
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
193
194
|
"name": "place_perp_limit_order",
|
|
194
195
|
"friends": [],
|
|
195
196
|
"exposed_functions": [
|
|
@@ -218,7 +219,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
218
219
|
|
|
219
220
|
// generated_types/changePerpOrderPrice.ts
|
|
220
221
|
var ABI9 = {
|
|
221
|
-
"address": "
|
|
222
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
222
223
|
"name": "change_perp_order_price",
|
|
223
224
|
"friends": [],
|
|
224
225
|
"exposed_functions": [
|
|
@@ -245,7 +246,7 @@ var changePerpOrderPrice_default = ABI9;
|
|
|
245
246
|
|
|
246
247
|
// generated_types/placePerpMarketOrder.ts
|
|
247
248
|
var ABI10 = {
|
|
248
|
-
"address": "
|
|
249
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
249
250
|
"name": "place_perp_market_order",
|
|
250
251
|
"friends": [],
|
|
251
252
|
"exposed_functions": [
|
|
@@ -273,7 +274,7 @@ var placePerpMarketOrder_default = ABI10;
|
|
|
273
274
|
|
|
274
275
|
// generated_types/redeemToken.ts
|
|
275
276
|
var ABI11 = {
|
|
276
|
-
"address": "
|
|
277
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
277
278
|
"name": "redeem_token",
|
|
278
279
|
"friends": [],
|
|
279
280
|
"exposed_functions": [
|
|
@@ -299,7 +300,7 @@ var redeemToken_default = ABI11;
|
|
|
299
300
|
|
|
300
301
|
// generated_types/removeApiKey.ts
|
|
301
302
|
var ABI12 = {
|
|
302
|
-
"address": "
|
|
303
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
303
304
|
"name": "remove_api_key",
|
|
304
305
|
"friends": [],
|
|
305
306
|
"exposed_functions": [
|
|
@@ -323,7 +324,7 @@ var removeApiKey_default = ABI12;
|
|
|
323
324
|
|
|
324
325
|
// generated_types/setAliasName.ts
|
|
325
326
|
var ABI13 = {
|
|
326
|
-
"address": "
|
|
327
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
327
328
|
"name": "set_alias_name",
|
|
328
329
|
"friends": [],
|
|
329
330
|
"exposed_functions": [
|
|
@@ -347,7 +348,7 @@ var setAliasName_default = ABI13;
|
|
|
347
348
|
|
|
348
349
|
// generated_types/setAutolend.ts
|
|
349
350
|
var ABI14 = {
|
|
350
|
-
"address": "
|
|
351
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
351
352
|
"name": "set_autolend",
|
|
352
353
|
"friends": [],
|
|
353
354
|
"exposed_functions": [
|
|
@@ -369,6 +370,30 @@ var ABI14 = {
|
|
|
369
370
|
};
|
|
370
371
|
var setAutolend_default = ABI14;
|
|
371
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
|
+
|
|
372
397
|
// generated_types/typeshareTypes.ts
|
|
373
398
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
374
399
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -453,8 +478,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
453
478
|
})(UserStatus || {});
|
|
454
479
|
|
|
455
480
|
// generated_types/withdrawFromVault.ts
|
|
456
|
-
var
|
|
457
|
-
"address": "
|
|
481
|
+
var ABI16 = {
|
|
482
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
458
483
|
"name": "withdraw_from_vault",
|
|
459
484
|
"friends": [],
|
|
460
485
|
"exposed_functions": [
|
|
@@ -476,7 +501,7 @@ var ABI15 = {
|
|
|
476
501
|
],
|
|
477
502
|
"structs": []
|
|
478
503
|
};
|
|
479
|
-
var withdrawFromVault_default =
|
|
504
|
+
var withdrawFromVault_default = ABI16;
|
|
480
505
|
|
|
481
506
|
// src/utils.ts
|
|
482
507
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -577,6 +602,8 @@ var getTopicFromMessage = (data) => {
|
|
|
577
602
|
return data.content.userId;
|
|
578
603
|
case "BorrowLendUpdate":
|
|
579
604
|
return data.type;
|
|
605
|
+
case "ClaimReferralFee":
|
|
606
|
+
return data.content.userId;
|
|
580
607
|
}
|
|
581
608
|
};
|
|
582
609
|
|
|
@@ -1076,12 +1103,13 @@ var Client = class _Client {
|
|
|
1076
1103
|
typeArguments: [],
|
|
1077
1104
|
functionArguments: [params.name, params.referralId]
|
|
1078
1105
|
});
|
|
1079
|
-
const tx = new
|
|
1106
|
+
const tx = new MultiAgentTransaction(
|
|
1080
1107
|
await generateRawTransaction({
|
|
1081
1108
|
sender: params.sender,
|
|
1082
1109
|
aptosConfig: this._aptos.config,
|
|
1083
1110
|
payload
|
|
1084
|
-
})
|
|
1111
|
+
}),
|
|
1112
|
+
[apiKey.accountAddress]
|
|
1085
1113
|
);
|
|
1086
1114
|
const signature = this._aptos.sign({
|
|
1087
1115
|
signer: apiKey,
|
|
@@ -1615,6 +1643,39 @@ var Client = class _Client {
|
|
|
1615
1643
|
});
|
|
1616
1644
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1617
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
|
+
}
|
|
1618
1679
|
};
|
|
1619
1680
|
var client_default = Client;
|
|
1620
1681
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1646,8 +1707,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1646
1707
|
import { createEntryPayload } from "@thalalabs/surf";
|
|
1647
1708
|
|
|
1648
1709
|
// generated_types/faucetEntrypoints.ts
|
|
1649
|
-
var
|
|
1650
|
-
"address": "
|
|
1710
|
+
var ABI17 = {
|
|
1711
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1651
1712
|
"name": "faucet_entrypoints",
|
|
1652
1713
|
"friends": [],
|
|
1653
1714
|
"exposed_functions": [
|
|
@@ -1678,11 +1739,11 @@ var ABI16 = {
|
|
|
1678
1739
|
],
|
|
1679
1740
|
"structs": []
|
|
1680
1741
|
};
|
|
1681
|
-
var faucetEntrypoints_default =
|
|
1742
|
+
var faucetEntrypoints_default = ABI17;
|
|
1682
1743
|
|
|
1683
1744
|
// generated_types/testFaucet.ts
|
|
1684
|
-
var
|
|
1685
|
-
"address": "
|
|
1745
|
+
var ABI18 = {
|
|
1746
|
+
"address": "0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a",
|
|
1686
1747
|
"name": "test_faucet",
|
|
1687
1748
|
"friends": [],
|
|
1688
1749
|
"exposed_functions": [
|
|
@@ -1719,7 +1780,7 @@ var ABI17 = {
|
|
|
1719
1780
|
],
|
|
1720
1781
|
"return": [
|
|
1721
1782
|
"0x1::object::ConstructorRef",
|
|
1722
|
-
"0x1::object::Object<
|
|
1783
|
+
"0x1::object::Object<0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::Token>"
|
|
1723
1784
|
]
|
|
1724
1785
|
},
|
|
1725
1786
|
{
|
|
@@ -1870,7 +1931,7 @@ var ABI17 = {
|
|
|
1870
1931
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1871
1932
|
],
|
|
1872
1933
|
"return": [
|
|
1873
|
-
"
|
|
1934
|
+
"0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken"
|
|
1874
1935
|
]
|
|
1875
1936
|
}
|
|
1876
1937
|
],
|
|
@@ -1902,7 +1963,7 @@ var ABI17 = {
|
|
|
1902
1963
|
"fields": [
|
|
1903
1964
|
{
|
|
1904
1965
|
"name": "tokens",
|
|
1905
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1966
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x7799a0453763e2b2d7118c9caa5e0b9aa2c9c4405190a2bce3d931e1126793a::test_faucet::FaucetToken>"
|
|
1906
1967
|
}
|
|
1907
1968
|
]
|
|
1908
1969
|
},
|
|
@@ -1927,7 +1988,7 @@ var ABI17 = {
|
|
|
1927
1988
|
}
|
|
1928
1989
|
]
|
|
1929
1990
|
};
|
|
1930
|
-
var testFaucet_default =
|
|
1991
|
+
var testFaucet_default = ABI18;
|
|
1931
1992
|
|
|
1932
1993
|
// src/testFaucet.ts
|
|
1933
1994
|
var TestFaucet = class _TestFaucet extends client_default {
|