@nightlylabs/dex-sdk 0.0.73 → 0.0.75
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 +99 -27
- package/dist/index.d.cts +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +99 -27
- 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": [
|
|
@@ -421,7 +421,7 @@ var setAutolend_default = ABI14;
|
|
|
421
421
|
|
|
422
422
|
// generated_types/claimReferralFees.ts
|
|
423
423
|
var ABI15 = {
|
|
424
|
-
"address": "
|
|
424
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
425
425
|
"name": "claim_referral_fees",
|
|
426
426
|
"friends": [],
|
|
427
427
|
"exposed_functions": [
|
|
@@ -443,6 +443,33 @@ var ABI15 = {
|
|
|
443
443
|
};
|
|
444
444
|
var claimReferralFees_default = ABI15;
|
|
445
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
|
+
|
|
446
473
|
// generated_types/typeshareTypes.ts
|
|
447
474
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
448
475
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -527,8 +554,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
527
554
|
})(UserStatus || {});
|
|
528
555
|
|
|
529
556
|
// generated_types/withdrawFromVault.ts
|
|
530
|
-
var
|
|
531
|
-
"address": "
|
|
557
|
+
var ABI17 = {
|
|
558
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
532
559
|
"name": "withdraw_from_vault",
|
|
533
560
|
"friends": [],
|
|
534
561
|
"exposed_functions": [
|
|
@@ -550,7 +577,7 @@ var ABI16 = {
|
|
|
550
577
|
],
|
|
551
578
|
"structs": []
|
|
552
579
|
};
|
|
553
|
-
var withdrawFromVault_default =
|
|
580
|
+
var withdrawFromVault_default = ABI17;
|
|
554
581
|
|
|
555
582
|
// src/utils.ts
|
|
556
583
|
var import_ts_sdk = require("@aptos-labs/ts-sdk");
|
|
@@ -653,6 +680,12 @@ var getTopicFromMessage = (data) => {
|
|
|
653
680
|
return data.type;
|
|
654
681
|
case "ClaimReferralFee":
|
|
655
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;
|
|
656
689
|
}
|
|
657
690
|
};
|
|
658
691
|
|
|
@@ -1725,6 +1758,45 @@ var Client = class _Client {
|
|
|
1725
1758
|
});
|
|
1726
1759
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1727
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
|
+
}
|
|
1728
1800
|
};
|
|
1729
1801
|
var client_default = Client;
|
|
1730
1802
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1756,8 +1828,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1756
1828
|
var import_surf2 = require("@thalalabs/surf");
|
|
1757
1829
|
|
|
1758
1830
|
// generated_types/faucetEntrypoints.ts
|
|
1759
|
-
var
|
|
1760
|
-
"address": "
|
|
1831
|
+
var ABI18 = {
|
|
1832
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1761
1833
|
"name": "faucet_entrypoints",
|
|
1762
1834
|
"friends": [],
|
|
1763
1835
|
"exposed_functions": [
|
|
@@ -1788,11 +1860,11 @@ var ABI17 = {
|
|
|
1788
1860
|
],
|
|
1789
1861
|
"structs": []
|
|
1790
1862
|
};
|
|
1791
|
-
var faucetEntrypoints_default =
|
|
1863
|
+
var faucetEntrypoints_default = ABI18;
|
|
1792
1864
|
|
|
1793
1865
|
// generated_types/testFaucet.ts
|
|
1794
|
-
var
|
|
1795
|
-
"address": "
|
|
1866
|
+
var ABI19 = {
|
|
1867
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1796
1868
|
"name": "test_faucet",
|
|
1797
1869
|
"friends": [],
|
|
1798
1870
|
"exposed_functions": [
|
|
@@ -1829,7 +1901,7 @@ var ABI18 = {
|
|
|
1829
1901
|
],
|
|
1830
1902
|
"return": [
|
|
1831
1903
|
"0x1::object::ConstructorRef",
|
|
1832
|
-
"0x1::object::Object<
|
|
1904
|
+
"0x1::object::Object<0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::Token>"
|
|
1833
1905
|
]
|
|
1834
1906
|
},
|
|
1835
1907
|
{
|
|
@@ -1980,7 +2052,7 @@ var ABI18 = {
|
|
|
1980
2052
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1981
2053
|
],
|
|
1982
2054
|
"return": [
|
|
1983
|
-
"
|
|
2055
|
+
"0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken"
|
|
1984
2056
|
]
|
|
1985
2057
|
}
|
|
1986
2058
|
],
|
|
@@ -2012,7 +2084,7 @@ var ABI18 = {
|
|
|
2012
2084
|
"fields": [
|
|
2013
2085
|
{
|
|
2014
2086
|
"name": "tokens",
|
|
2015
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2087
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken>"
|
|
2016
2088
|
}
|
|
2017
2089
|
]
|
|
2018
2090
|
},
|
|
@@ -2037,7 +2109,7 @@ var ABI18 = {
|
|
|
2037
2109
|
}
|
|
2038
2110
|
]
|
|
2039
2111
|
};
|
|
2040
|
-
var testFaucet_default =
|
|
2112
|
+
var testFaucet_default = ABI19;
|
|
2041
2113
|
|
|
2042
2114
|
// src/testFaucet.ts
|
|
2043
2115
|
var TestFaucet = class _TestFaucet extends client_default {
|
package/dist/index.d.cts
CHANGED
|
@@ -131,13 +131,17 @@ interface ExchangeConfig {
|
|
|
131
131
|
tokens: Record<string, TokenConfigEntry>;
|
|
132
132
|
usdcAddress?: string;
|
|
133
133
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
134
|
+
feeTiers: Record<string, FeeTier>;
|
|
134
135
|
}
|
|
135
|
-
interface
|
|
136
|
-
|
|
136
|
+
interface FeeTier {
|
|
137
|
+
volume: string;
|
|
137
138
|
perpTakerFee: string;
|
|
138
139
|
perpMakerFee: string;
|
|
139
140
|
spotTakerFee: string;
|
|
140
141
|
spotMakerFee: string;
|
|
142
|
+
}
|
|
143
|
+
interface Fees {
|
|
144
|
+
tier: string;
|
|
141
145
|
discount: string;
|
|
142
146
|
referrerUserId?: string;
|
|
143
147
|
referrerKickback: string;
|
|
@@ -592,6 +596,16 @@ interface TradesUpdate {
|
|
|
592
596
|
market: string;
|
|
593
597
|
updates: Trade[];
|
|
594
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
|
+
}
|
|
595
609
|
interface Withdraw {
|
|
596
610
|
userId: string;
|
|
597
611
|
tokenAddress: string;
|
|
@@ -774,6 +788,15 @@ type WsMessage = {
|
|
|
774
788
|
} | {
|
|
775
789
|
type: "ClaimReferralFee";
|
|
776
790
|
content: ClaimReferralFee;
|
|
791
|
+
} | {
|
|
792
|
+
type: "UpdateUserFeeTier";
|
|
793
|
+
content: UpdateUserFeeTier;
|
|
794
|
+
} | {
|
|
795
|
+
type: "UserTransferSent";
|
|
796
|
+
content: UserTransfer;
|
|
797
|
+
} | {
|
|
798
|
+
type: "UserTransferReceived";
|
|
799
|
+
content: UserTransfer;
|
|
777
800
|
};
|
|
778
801
|
|
|
779
802
|
type Address = `0x${string}`;
|
|
@@ -916,6 +939,7 @@ declare class Client {
|
|
|
916
939
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
917
940
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
918
941
|
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
942
|
+
transferToUser(params: TransferToUserParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
919
943
|
sendGetJson: (endpoint: string, message?: {
|
|
920
944
|
[key: string]: any;
|
|
921
945
|
}) => Promise<any>;
|
|
@@ -1030,6 +1054,13 @@ interface ClaimReferralFeesParams {
|
|
|
1030
1054
|
userId: string;
|
|
1031
1055
|
referrals: string[];
|
|
1032
1056
|
}
|
|
1057
|
+
interface TransferToUserParams {
|
|
1058
|
+
userId: string;
|
|
1059
|
+
tokenAddress: Address;
|
|
1060
|
+
amount: string;
|
|
1061
|
+
borrow: boolean;
|
|
1062
|
+
recipient: string;
|
|
1063
|
+
}
|
|
1033
1064
|
interface IGetChartCandlesInRange {
|
|
1034
1065
|
marketName: string;
|
|
1035
1066
|
interval: ChartInterval;
|
|
@@ -1041,7 +1072,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1041
1072
|
type: 'OracleUpdates';
|
|
1042
1073
|
}>;
|
|
1043
1074
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1044
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1075
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived';
|
|
1045
1076
|
}>;
|
|
1046
1077
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1047
1078
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1079,4 +1110,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1079
1110
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1080
1111
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1081
1112
|
|
|
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 };
|
|
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
|
@@ -131,13 +131,17 @@ interface ExchangeConfig {
|
|
|
131
131
|
tokens: Record<string, TokenConfigEntry>;
|
|
132
132
|
usdcAddress?: string;
|
|
133
133
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
134
|
+
feeTiers: Record<string, FeeTier>;
|
|
134
135
|
}
|
|
135
|
-
interface
|
|
136
|
-
|
|
136
|
+
interface FeeTier {
|
|
137
|
+
volume: string;
|
|
137
138
|
perpTakerFee: string;
|
|
138
139
|
perpMakerFee: string;
|
|
139
140
|
spotTakerFee: string;
|
|
140
141
|
spotMakerFee: string;
|
|
142
|
+
}
|
|
143
|
+
interface Fees {
|
|
144
|
+
tier: string;
|
|
141
145
|
discount: string;
|
|
142
146
|
referrerUserId?: string;
|
|
143
147
|
referrerKickback: string;
|
|
@@ -592,6 +596,16 @@ interface TradesUpdate {
|
|
|
592
596
|
market: string;
|
|
593
597
|
updates: Trade[];
|
|
594
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
|
+
}
|
|
595
609
|
interface Withdraw {
|
|
596
610
|
userId: string;
|
|
597
611
|
tokenAddress: string;
|
|
@@ -774,6 +788,15 @@ type WsMessage = {
|
|
|
774
788
|
} | {
|
|
775
789
|
type: "ClaimReferralFee";
|
|
776
790
|
content: ClaimReferralFee;
|
|
791
|
+
} | {
|
|
792
|
+
type: "UpdateUserFeeTier";
|
|
793
|
+
content: UpdateUserFeeTier;
|
|
794
|
+
} | {
|
|
795
|
+
type: "UserTransferSent";
|
|
796
|
+
content: UserTransfer;
|
|
797
|
+
} | {
|
|
798
|
+
type: "UserTransferReceived";
|
|
799
|
+
content: UserTransfer;
|
|
777
800
|
};
|
|
778
801
|
|
|
779
802
|
type Address = `0x${string}`;
|
|
@@ -916,6 +939,7 @@ declare class Client {
|
|
|
916
939
|
redeemToken(params: RedeemTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
917
940
|
lendToken(params: LendTokenParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
918
941
|
claimReferralFees(params: ClaimReferralFeesParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
942
|
+
transferToUser(params: TransferToUserParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
919
943
|
sendGetJson: (endpoint: string, message?: {
|
|
920
944
|
[key: string]: any;
|
|
921
945
|
}) => Promise<any>;
|
|
@@ -1030,6 +1054,13 @@ interface ClaimReferralFeesParams {
|
|
|
1030
1054
|
userId: string;
|
|
1031
1055
|
referrals: string[];
|
|
1032
1056
|
}
|
|
1057
|
+
interface TransferToUserParams {
|
|
1058
|
+
userId: string;
|
|
1059
|
+
tokenAddress: Address;
|
|
1060
|
+
amount: string;
|
|
1061
|
+
borrow: boolean;
|
|
1062
|
+
recipient: string;
|
|
1063
|
+
}
|
|
1033
1064
|
interface IGetChartCandlesInRange {
|
|
1034
1065
|
marketName: string;
|
|
1035
1066
|
interval: ChartInterval;
|
|
@@ -1041,7 +1072,7 @@ type WsOracleUpdates = Extract<WsMessage, {
|
|
|
1041
1072
|
type: 'OracleUpdates';
|
|
1042
1073
|
}>;
|
|
1043
1074
|
type WsUserUpdates = Extract<WsMessage, {
|
|
1044
|
-
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee';
|
|
1075
|
+
type: 'BalanceChange' | 'Deposit' | 'Withdraw' | 'WithdrawLend' | 'Lend' | 'Borrow' | 'RepayBorrow' | 'PlacePerpLimitOrder' | 'PlacePerpMarketOrder' | 'CanceledPerpOrders' | 'OrderFills' | 'SetAutoLend' | 'SetAlias' | 'AddApiKey' | 'RemoveApiKey' | 'ClaimReferralFee' | 'UpdateUserFeeTier' | 'UserTransferSent' | 'UserTransferReceived';
|
|
1045
1076
|
}>;
|
|
1046
1077
|
type WsPerpMarketUpdates = Extract<WsMessage, {
|
|
1047
1078
|
type: 'OrderbookUpdate' | 'TradesUpdate';
|
|
@@ -1079,4 +1110,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1079
1110
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1080
1111
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1081
1112
|
|
|
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 };
|
|
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": [
|
|
@@ -372,7 +372,7 @@ var setAutolend_default = ABI14;
|
|
|
372
372
|
|
|
373
373
|
// generated_types/claimReferralFees.ts
|
|
374
374
|
var ABI15 = {
|
|
375
|
-
"address": "
|
|
375
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
376
376
|
"name": "claim_referral_fees",
|
|
377
377
|
"friends": [],
|
|
378
378
|
"exposed_functions": [
|
|
@@ -394,6 +394,33 @@ var ABI15 = {
|
|
|
394
394
|
};
|
|
395
395
|
var claimReferralFees_default = ABI15;
|
|
396
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
|
+
|
|
397
424
|
// generated_types/typeshareTypes.ts
|
|
398
425
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
399
426
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
@@ -478,8 +505,8 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
478
505
|
})(UserStatus || {});
|
|
479
506
|
|
|
480
507
|
// generated_types/withdrawFromVault.ts
|
|
481
|
-
var
|
|
482
|
-
"address": "
|
|
508
|
+
var ABI17 = {
|
|
509
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
483
510
|
"name": "withdraw_from_vault",
|
|
484
511
|
"friends": [],
|
|
485
512
|
"exposed_functions": [
|
|
@@ -501,7 +528,7 @@ var ABI16 = {
|
|
|
501
528
|
],
|
|
502
529
|
"structs": []
|
|
503
530
|
};
|
|
504
|
-
var withdrawFromVault_default =
|
|
531
|
+
var withdrawFromVault_default = ABI17;
|
|
505
532
|
|
|
506
533
|
// src/utils.ts
|
|
507
534
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
@@ -604,6 +631,12 @@ var getTopicFromMessage = (data) => {
|
|
|
604
631
|
return data.type;
|
|
605
632
|
case "ClaimReferralFee":
|
|
606
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;
|
|
607
640
|
}
|
|
608
641
|
};
|
|
609
642
|
|
|
@@ -1676,6 +1709,45 @@ var Client = class _Client {
|
|
|
1676
1709
|
});
|
|
1677
1710
|
return await this.submitSponsoredTransaction(tx, signature);
|
|
1678
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
|
+
}
|
|
1679
1751
|
};
|
|
1680
1752
|
var client_default = Client;
|
|
1681
1753
|
function parseEntryFunctionAbi(args) {
|
|
@@ -1707,8 +1779,8 @@ function parseEntryFunctionAbi(args) {
|
|
|
1707
1779
|
import { createEntryPayload } from "@thalalabs/surf";
|
|
1708
1780
|
|
|
1709
1781
|
// generated_types/faucetEntrypoints.ts
|
|
1710
|
-
var
|
|
1711
|
-
"address": "
|
|
1782
|
+
var ABI18 = {
|
|
1783
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1712
1784
|
"name": "faucet_entrypoints",
|
|
1713
1785
|
"friends": [],
|
|
1714
1786
|
"exposed_functions": [
|
|
@@ -1739,11 +1811,11 @@ var ABI17 = {
|
|
|
1739
1811
|
],
|
|
1740
1812
|
"structs": []
|
|
1741
1813
|
};
|
|
1742
|
-
var faucetEntrypoints_default =
|
|
1814
|
+
var faucetEntrypoints_default = ABI18;
|
|
1743
1815
|
|
|
1744
1816
|
// generated_types/testFaucet.ts
|
|
1745
|
-
var
|
|
1746
|
-
"address": "
|
|
1817
|
+
var ABI19 = {
|
|
1818
|
+
"address": "0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75",
|
|
1747
1819
|
"name": "test_faucet",
|
|
1748
1820
|
"friends": [],
|
|
1749
1821
|
"exposed_functions": [
|
|
@@ -1780,7 +1852,7 @@ var ABI18 = {
|
|
|
1780
1852
|
],
|
|
1781
1853
|
"return": [
|
|
1782
1854
|
"0x1::object::ConstructorRef",
|
|
1783
|
-
"0x1::object::Object<
|
|
1855
|
+
"0x1::object::Object<0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::Token>"
|
|
1784
1856
|
]
|
|
1785
1857
|
},
|
|
1786
1858
|
{
|
|
@@ -1931,7 +2003,7 @@ var ABI18 = {
|
|
|
1931
2003
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1932
2004
|
],
|
|
1933
2005
|
"return": [
|
|
1934
|
-
"
|
|
2006
|
+
"0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken"
|
|
1935
2007
|
]
|
|
1936
2008
|
}
|
|
1937
2009
|
],
|
|
@@ -1963,7 +2035,7 @@ var ABI18 = {
|
|
|
1963
2035
|
"fields": [
|
|
1964
2036
|
{
|
|
1965
2037
|
"name": "tokens",
|
|
1966
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
2038
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x61b8df207dd4cba680ad2ead3caea8fa35f410d61542c7bb146b2fbcd3d04a75::test_faucet::FaucetToken>"
|
|
1967
2039
|
}
|
|
1968
2040
|
]
|
|
1969
2041
|
},
|
|
@@ -1988,7 +2060,7 @@ var ABI18 = {
|
|
|
1988
2060
|
}
|
|
1989
2061
|
]
|
|
1990
2062
|
};
|
|
1991
|
-
var testFaucet_default =
|
|
2063
|
+
var testFaucet_default = ABI19;
|
|
1992
2064
|
|
|
1993
2065
|
// src/testFaucet.ts
|
|
1994
2066
|
var TestFaucet = class _TestFaucet extends client_default {
|