@nightlylabs/dex-sdk 0.0.100 → 0.0.102
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 +24 -0
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +24 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -699,6 +699,7 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
699
699
|
EndpointsV12["GetBorrowLendAggregatedData"] = "/v1/get_borrow_lend_aggregated_data";
|
|
700
700
|
EndpointsV12["GetTokensStats"] = "/v1/get_tokens_stats";
|
|
701
701
|
EndpointsV12["GetTokensAggregatedStats"] = "/v1/get_tokens_aggregated_stats";
|
|
702
|
+
EndpointsV12["CheckReferralCode"] = "/v1/check_referral_code";
|
|
702
703
|
return EndpointsV12;
|
|
703
704
|
})(EndpointsV1 || {});
|
|
704
705
|
var SpotMarketStatus = /* @__PURE__ */ ((SpotMarketStatus2) => {
|
|
@@ -1317,6 +1318,10 @@ var Client = class _Client {
|
|
|
1317
1318
|
const response = await this.sendGetJson("/v1/get_tokens_aggregated_stats" /* GetTokensAggregatedStats */, request);
|
|
1318
1319
|
return response;
|
|
1319
1320
|
};
|
|
1321
|
+
this.checkReferralCode = async (request) => {
|
|
1322
|
+
const response = await this.sendGetJson("/v1/check_referral_code" /* CheckReferralCode */, request);
|
|
1323
|
+
return response;
|
|
1324
|
+
};
|
|
1320
1325
|
// Meta
|
|
1321
1326
|
this.getTime = async () => {
|
|
1322
1327
|
const response = await this.sendGetJson("/time" /* Time */);
|
|
@@ -1551,6 +1556,25 @@ var Client = class _Client {
|
|
|
1551
1556
|
apiKey
|
|
1552
1557
|
};
|
|
1553
1558
|
}
|
|
1559
|
+
async createUserPayload(params) {
|
|
1560
|
+
const apiKey = generateApiKey();
|
|
1561
|
+
const payload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1562
|
+
aptosConfig: this._aptos.config,
|
|
1563
|
+
abi: parseEntryFunctionAbi({
|
|
1564
|
+
moduleAbi: createUser_default,
|
|
1565
|
+
functionName: createUser_default.name,
|
|
1566
|
+
moduleAddress: createUser_default.address,
|
|
1567
|
+
moduleName: createUser_default.name
|
|
1568
|
+
}),
|
|
1569
|
+
function: `${createUser_default.address}::${createUser_default.name}::create_user`,
|
|
1570
|
+
typeArguments: [],
|
|
1571
|
+
functionArguments: [params.name, params.referralCode]
|
|
1572
|
+
});
|
|
1573
|
+
return {
|
|
1574
|
+
payload,
|
|
1575
|
+
apiKey
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1554
1578
|
async addApiKey(params) {
|
|
1555
1579
|
return await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1556
1580
|
aptosConfig: this._aptos.config,
|
package/dist/index.d.cts
CHANGED
|
@@ -85,6 +85,12 @@ interface ChartCandle {
|
|
|
85
85
|
timestampOpen: string;
|
|
86
86
|
timestampClose: string;
|
|
87
87
|
}
|
|
88
|
+
interface CheckReferralCodeRequest {
|
|
89
|
+
code: string;
|
|
90
|
+
}
|
|
91
|
+
interface CheckReferralCodeResponse {
|
|
92
|
+
available: boolean;
|
|
93
|
+
}
|
|
88
94
|
interface ClaimReferralFee {
|
|
89
95
|
userId: string;
|
|
90
96
|
referralUsers: string[];
|
|
@@ -828,7 +834,8 @@ declare enum EndpointsV1 {
|
|
|
828
834
|
GetBorrowLendHistoricalData = "/v1/get_borrow_lend_historical_data",
|
|
829
835
|
GetBorrowLendAggregatedData = "/v1/get_borrow_lend_aggregated_data",
|
|
830
836
|
GetTokensStats = "/v1/get_tokens_stats",
|
|
831
|
-
GetTokensAggregatedStats = "/v1/get_tokens_aggregated_stats"
|
|
837
|
+
GetTokensAggregatedStats = "/v1/get_tokens_aggregated_stats",
|
|
838
|
+
CheckReferralCode = "/v1/check_referral_code"
|
|
832
839
|
}
|
|
833
840
|
declare enum SpotMarketStatus {
|
|
834
841
|
Halted = "halted",
|
|
@@ -1264,6 +1271,10 @@ declare class Client {
|
|
|
1264
1271
|
signature: AccountAuthenticator;
|
|
1265
1272
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1266
1273
|
}>;
|
|
1274
|
+
createUserPayload(params: CreateUserParams): Promise<{
|
|
1275
|
+
payload: _aptos_labs_ts_sdk.TransactionPayloadEntryFunction;
|
|
1276
|
+
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1277
|
+
}>;
|
|
1267
1278
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1268
1279
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1269
1280
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
@@ -1322,6 +1333,7 @@ declare class Client {
|
|
|
1322
1333
|
getBorrowLendAggregatedStats: (request: GetBorrowLendingAggregatedStatsRequest) => Promise<GetBorrowLendingAggregatedStatsResponse>;
|
|
1323
1334
|
getTokenStats: (request: GetTokenStatsHistoryRequest) => Promise<GetTokenStatsHistoryResponse>;
|
|
1324
1335
|
getTokenAggregatedStats: (request: GetTokenAggregatedStatsRequest) => Promise<GetTokenAggregatedStatsResponse>;
|
|
1336
|
+
checkReferralCode: (request: CheckReferralCodeRequest) => Promise<CheckReferralCodeResponse>;
|
|
1325
1337
|
getTime: () => Promise<string>;
|
|
1326
1338
|
}
|
|
1327
1339
|
|
|
@@ -1354,4 +1366,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1354
1366
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1355
1367
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1356
1368
|
|
|
1357
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, 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 GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, 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 };
|
|
1369
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, 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 GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, 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
|
@@ -85,6 +85,12 @@ interface ChartCandle {
|
|
|
85
85
|
timestampOpen: string;
|
|
86
86
|
timestampClose: string;
|
|
87
87
|
}
|
|
88
|
+
interface CheckReferralCodeRequest {
|
|
89
|
+
code: string;
|
|
90
|
+
}
|
|
91
|
+
interface CheckReferralCodeResponse {
|
|
92
|
+
available: boolean;
|
|
93
|
+
}
|
|
88
94
|
interface ClaimReferralFee {
|
|
89
95
|
userId: string;
|
|
90
96
|
referralUsers: string[];
|
|
@@ -828,7 +834,8 @@ declare enum EndpointsV1 {
|
|
|
828
834
|
GetBorrowLendHistoricalData = "/v1/get_borrow_lend_historical_data",
|
|
829
835
|
GetBorrowLendAggregatedData = "/v1/get_borrow_lend_aggregated_data",
|
|
830
836
|
GetTokensStats = "/v1/get_tokens_stats",
|
|
831
|
-
GetTokensAggregatedStats = "/v1/get_tokens_aggregated_stats"
|
|
837
|
+
GetTokensAggregatedStats = "/v1/get_tokens_aggregated_stats",
|
|
838
|
+
CheckReferralCode = "/v1/check_referral_code"
|
|
832
839
|
}
|
|
833
840
|
declare enum SpotMarketStatus {
|
|
834
841
|
Halted = "halted",
|
|
@@ -1264,6 +1271,10 @@ declare class Client {
|
|
|
1264
1271
|
signature: AccountAuthenticator;
|
|
1265
1272
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1266
1273
|
}>;
|
|
1274
|
+
createUserPayload(params: CreateUserParams): Promise<{
|
|
1275
|
+
payload: _aptos_labs_ts_sdk.TransactionPayloadEntryFunction;
|
|
1276
|
+
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1277
|
+
}>;
|
|
1267
1278
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1268
1279
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1269
1280
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
@@ -1322,6 +1333,7 @@ declare class Client {
|
|
|
1322
1333
|
getBorrowLendAggregatedStats: (request: GetBorrowLendingAggregatedStatsRequest) => Promise<GetBorrowLendingAggregatedStatsResponse>;
|
|
1323
1334
|
getTokenStats: (request: GetTokenStatsHistoryRequest) => Promise<GetTokenStatsHistoryResponse>;
|
|
1324
1335
|
getTokenAggregatedStats: (request: GetTokenAggregatedStatsRequest) => Promise<GetTokenAggregatedStatsResponse>;
|
|
1336
|
+
checkReferralCode: (request: CheckReferralCodeRequest) => Promise<CheckReferralCodeResponse>;
|
|
1325
1337
|
getTime: () => Promise<string>;
|
|
1326
1338
|
}
|
|
1327
1339
|
|
|
@@ -1354,4 +1366,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
1354
1366
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
1355
1367
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
1356
1368
|
|
|
1357
|
-
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, 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 GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, 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 };
|
|
1369
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChangePerpOrderPriceParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, 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 GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type HistoricalDeposit, type HistoricalFunding, type HistoricalReferralStats, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalWithdraw, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, type MarketStatusChange, 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 PerpOrderData, type PerpOrderDataForMarket, type PerpPosition, type PerpTrade, type PerpetualMarketConfigEntry, type PerpetualMarketStatus, type PlaceMultiplePerpOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, SpotMarketStatus, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, TransferAction, 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
|
@@ -649,6 +649,7 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
649
649
|
EndpointsV12["GetBorrowLendAggregatedData"] = "/v1/get_borrow_lend_aggregated_data";
|
|
650
650
|
EndpointsV12["GetTokensStats"] = "/v1/get_tokens_stats";
|
|
651
651
|
EndpointsV12["GetTokensAggregatedStats"] = "/v1/get_tokens_aggregated_stats";
|
|
652
|
+
EndpointsV12["CheckReferralCode"] = "/v1/check_referral_code";
|
|
652
653
|
return EndpointsV12;
|
|
653
654
|
})(EndpointsV1 || {});
|
|
654
655
|
var SpotMarketStatus = /* @__PURE__ */ ((SpotMarketStatus2) => {
|
|
@@ -1267,6 +1268,10 @@ var Client = class _Client {
|
|
|
1267
1268
|
const response = await this.sendGetJson("/v1/get_tokens_aggregated_stats" /* GetTokensAggregatedStats */, request);
|
|
1268
1269
|
return response;
|
|
1269
1270
|
};
|
|
1271
|
+
this.checkReferralCode = async (request) => {
|
|
1272
|
+
const response = await this.sendGetJson("/v1/check_referral_code" /* CheckReferralCode */, request);
|
|
1273
|
+
return response;
|
|
1274
|
+
};
|
|
1270
1275
|
// Meta
|
|
1271
1276
|
this.getTime = async () => {
|
|
1272
1277
|
const response = await this.sendGetJson("/time" /* Time */);
|
|
@@ -1501,6 +1506,25 @@ var Client = class _Client {
|
|
|
1501
1506
|
apiKey
|
|
1502
1507
|
};
|
|
1503
1508
|
}
|
|
1509
|
+
async createUserPayload(params) {
|
|
1510
|
+
const apiKey = generateApiKey();
|
|
1511
|
+
const payload = await generateTransactionPayload({
|
|
1512
|
+
aptosConfig: this._aptos.config,
|
|
1513
|
+
abi: parseEntryFunctionAbi({
|
|
1514
|
+
moduleAbi: createUser_default,
|
|
1515
|
+
functionName: createUser_default.name,
|
|
1516
|
+
moduleAddress: createUser_default.address,
|
|
1517
|
+
moduleName: createUser_default.name
|
|
1518
|
+
}),
|
|
1519
|
+
function: `${createUser_default.address}::${createUser_default.name}::create_user`,
|
|
1520
|
+
typeArguments: [],
|
|
1521
|
+
functionArguments: [params.name, params.referralCode]
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
payload,
|
|
1525
|
+
apiKey
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1504
1528
|
async addApiKey(params) {
|
|
1505
1529
|
return await generateTransactionPayload({
|
|
1506
1530
|
aptosConfig: this._aptos.config,
|