@rabby-wallet/hyperliquid-sdk 1.0.6 → 1.0.7-alpha.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, AssetCtx, ClearinghouseState, UserFills, CandleSnapshot, AllMids, ExtraAgent, OpenOrder, FeeResponse, UserNonFundingLedgerUpdates, UserHistoricalOrders } from '../types';
|
|
1
|
+
import type { Meta, AssetCtx, ClearinghouseState, UserFills, CandleSnapshot, AllMids, ExtraAgent, OpenOrder, FeeResponse, UserNonFundingLedgerUpdates, UserHistoricalOrders, ReferralResponse } from '../types';
|
|
2
2
|
export interface InfoClientConfig {
|
|
3
3
|
isTestnet?: boolean;
|
|
4
4
|
timeout?: number;
|
|
@@ -31,8 +31,8 @@ export declare class InfoClient {
|
|
|
31
31
|
*/
|
|
32
32
|
getUserFills(address?: string, aggregateByTime?: boolean): Promise<UserFills>;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
* Get user's fill and cancel and other all orders history
|
|
35
|
+
*/
|
|
36
36
|
getUserHistoricalOrders(address?: string, startTime?: number, endTime?: number): Promise<UserHistoricalOrders[]>;
|
|
37
37
|
/**
|
|
38
38
|
* Get candlestick data snapshot
|
|
@@ -49,6 +49,10 @@ export declare class InfoClient {
|
|
|
49
49
|
getUserRole(address?: string): Promise<{
|
|
50
50
|
role: 'user' | 'agent' | 'vault' | 'subAccount' | 'missing';
|
|
51
51
|
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Get referral
|
|
54
|
+
*/
|
|
55
|
+
getReferral(address?: string): Promise<ReferralResponse>;
|
|
52
56
|
/**
|
|
53
57
|
* Get user fees information
|
|
54
58
|
*/
|
|
@@ -129,8 +129,8 @@ class InfoClient {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
* Get user's fill and cancel and other all orders history
|
|
133
|
+
*/
|
|
134
134
|
getUserHistoricalOrders(address, startTime, endTime) {
|
|
135
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
136
|
const user = address || this.masterAddress;
|
|
@@ -151,7 +151,7 @@ class InfoClient {
|
|
|
151
151
|
*/
|
|
152
152
|
candleSnapshot(coin, interval, startTime, endTime) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
// if no time range is specified, default to 24 hours ago
|
|
154
|
+
// if no time range is specified, default to 24 hours ago
|
|
155
155
|
const now = Date.now();
|
|
156
156
|
return this.httpClient.info({
|
|
157
157
|
type: constants_1.InfoType.CANDLES_SNAPSHOT,
|
|
@@ -196,6 +196,22 @@ class InfoClient {
|
|
|
196
196
|
return res;
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Get referral
|
|
201
|
+
*/
|
|
202
|
+
getReferral(address) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
const user = address || this.masterAddress;
|
|
205
|
+
if (!user) {
|
|
206
|
+
throw new Error('user address is empty');
|
|
207
|
+
}
|
|
208
|
+
const res = yield this.httpClient.info({
|
|
209
|
+
type: constants_1.InfoType.REFERRAL,
|
|
210
|
+
user,
|
|
211
|
+
});
|
|
212
|
+
return res;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
199
215
|
/**
|
|
200
216
|
* Get user fees information
|
|
201
217
|
*/
|
|
@@ -46,7 +46,8 @@ export declare enum InfoType {
|
|
|
46
46
|
MAX_BUILDER_FEE = "maxBuilderFee",
|
|
47
47
|
USER_FEES = "userFees",
|
|
48
48
|
USER_ROLE = "userRole",
|
|
49
|
-
EXTRA_AGENTS = "extraAgents"
|
|
49
|
+
EXTRA_AGENTS = "extraAgents",
|
|
50
|
+
REFERRAL = "referral"
|
|
50
51
|
}
|
|
51
52
|
export declare enum OrderType {
|
|
52
53
|
LIMIT = "limit",
|
|
@@ -58,7 +59,7 @@ export declare enum OrderType {
|
|
|
58
59
|
}
|
|
59
60
|
export declare enum TimeInForce {
|
|
60
61
|
GTC = "Gtc",// Good Till Cancel
|
|
61
|
-
IOC = "Ioc",// Immediate or Cancel
|
|
62
|
+
IOC = "Ioc",// Immediate or Cancel
|
|
62
63
|
ALO = "Alo"
|
|
63
64
|
}
|
|
64
65
|
export declare const CHAIN_IDS: {
|
package/dist/types/constants.js
CHANGED
|
@@ -55,6 +55,7 @@ var InfoType;
|
|
|
55
55
|
InfoType["USER_FEES"] = "userFees";
|
|
56
56
|
InfoType["USER_ROLE"] = "userRole";
|
|
57
57
|
InfoType["EXTRA_AGENTS"] = "extraAgents";
|
|
58
|
+
InfoType["REFERRAL"] = "referral";
|
|
58
59
|
})(InfoType || (exports.InfoType = InfoType = {}));
|
|
59
60
|
// Order types
|
|
60
61
|
var OrderType;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SymbolConversion } from
|
|
1
|
+
import { SymbolConversion } from '../client/symbolConversion';
|
|
2
2
|
export type Tif = 'Alo' | 'Ioc' | 'Gtc';
|
|
3
3
|
export type TriggerType = 'tp' | 'sl';
|
|
4
4
|
export type Side = 'A' | 'B';
|
|
@@ -43,8 +43,8 @@ export interface OpenOrder {
|
|
|
43
43
|
triggerPx: string;
|
|
44
44
|
isPositionTpsl: boolean;
|
|
45
45
|
reduceOnly: boolean;
|
|
46
|
-
orderType:
|
|
47
|
-
origSz:
|
|
46
|
+
orderType: 'Take Profit Market' | 'Stop Market';
|
|
47
|
+
origSz: '0.0';
|
|
48
48
|
tif: null;
|
|
49
49
|
}
|
|
50
50
|
export interface OrderRequest {
|
|
@@ -409,3 +409,36 @@ export interface SendApproveParams {
|
|
|
409
409
|
nonce: number;
|
|
410
410
|
signature: string;
|
|
411
411
|
}
|
|
412
|
+
export interface ReferralResponse {
|
|
413
|
+
referredBy: {
|
|
414
|
+
referrer: string;
|
|
415
|
+
code: string;
|
|
416
|
+
};
|
|
417
|
+
cumVlm: string;
|
|
418
|
+
unclaimedRewards: string;
|
|
419
|
+
claimedRewards: string;
|
|
420
|
+
builderRewards: string;
|
|
421
|
+
tokenToState: [
|
|
422
|
+
number,
|
|
423
|
+
{
|
|
424
|
+
cumVlm: string;
|
|
425
|
+
unclaimedRewards: string;
|
|
426
|
+
claimedRewards: string;
|
|
427
|
+
builderRewards: string;
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
referrerState: {
|
|
431
|
+
stage: string;
|
|
432
|
+
data: {
|
|
433
|
+
code: string;
|
|
434
|
+
referralStates: {
|
|
435
|
+
cumVlm: string;
|
|
436
|
+
cumRewardedFeesSinceReferred: string;
|
|
437
|
+
cumFeesRewardedToReferrer: string;
|
|
438
|
+
timeJoined: number;
|
|
439
|
+
user: string;
|
|
440
|
+
}[];
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
rewardHistory: any[];
|
|
444
|
+
}
|
package/package.json
CHANGED