Class: RestClient
Extends
BaseRestClient
Extended by
Constructors
Constructor
new RestClient(options?: RestClientOptions, networkOptions?: RestClientNetworkOptions): RestClient;Parameters
| Parameter | Type |
|---|---|
options? | RestClientOptions |
networkOptions? | RestClientNetworkOptions |
Returns
RestClient
Overrides
BaseRestClient.constructor
Properties
baseUrl
readonly baseUrl: string;Inherited from
BaseRestClient.baseUrl
Methods
approveApiWallet()
approveApiWallet(params: ApproveApiWalletRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Approve an API wallet (approveAgent). An account can have one unnamed agent and three named agents, with two additional named agents allowed per subaccount. Append valid_until {timestamp} to the agent name to set an expiration no more than 180 days ahead.
Parameters
| Parameter | Type |
|---|---|
params | ApproveApiWalletRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
approveBuilderFee()
approveBuilderFee(options?: UserSignedActionOptions): Promise<ExchangeResponse>;Approve the configured builder fee (approveBuilderFee).
maxFeeRate is a percent string such as "0.001%".
Parameters
| Parameter | Type |
|---|---|
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
authorizeAqav2Role()
authorizeAqav2Role(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Authorize an AQAv2 role (authorizeAqav2Role).
token is the token index, for example 0 for USDC. role is "technical" or "treasury".
Parameters
| Parameter | Type |
|---|---|
params | { role: "technical" | "treasury"; token: number; } |
params.role | "technical" | "treasury" |
params.token | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
cancelOrders()
cancelOrders(params: CancelOrdersRequest, options?: L1ActionOptions): Promise<ExchangeResponse<CancelResponseData>>;Cancel orders by order id (cancel).
Each status is "success" or { error }. fastCancel sends f: true. Trigger orders are rejected when fast cancel is set. false is omitted.
Parameters
| Parameter | Type |
|---|---|
params | CancelOrdersRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<CancelResponseData>>
See
cancelOrdersByClientOrderId()
cancelOrdersByClientOrderId(params: CancelOrdersByClientOrderIdRequest, options?: L1ActionOptions): Promise<ExchangeResponse<CancelResponseData>>;Cancel orders by client order id (cancelByCloid).
Statuses match cancelOrders(). fastCancel has the same meaning.
Parameters
| Parameter | Type |
|---|---|
params | CancelOrdersByClientOrderIdRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<CancelResponseData>>
cancelTwapOrder()
cancelTwapOrder(params: CancelTwapOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse<TwapCancelResponseData>>;Cancel a TWAP order (twapCancel).
status is "success" or { error }.
Parameters
| Parameter | Type |
|---|---|
params | CancelTwapOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<TwapCancelResponseData>>
claimRewards()
claimRewards(options?: L1ActionOptions): Promise<ExchangeResponse>;Claim rewards (claimRewards).
Parameters
| Parameter | Type |
|---|---|
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
convertToMultiSigUser()
convertToMultiSigUser(params: ConvertToMultiSigUserRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | ConvertToMultiSigUserRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
createSubAccount()
createSubAccount(params: object, options?: L1ActionOptions): Promise<ExchangeResponse<string>>;Parameters
| Parameter | Type |
|---|---|
params | { name: string; } |
params.name | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<string>>
createVault()
createVault(params: object, options?: L1ActionOptions): Promise<ExchangeResponse<string>>;Parameters
| Parameter | Type |
|---|---|
params | { description: string; initialUsd: number; name: string; } |
params.description | string |
params.initialUsd | number |
params.name | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<string>>
delegateOrUndelegateStake()
delegateOrUndelegateStake(params: DelegateOrUndelegateStakeRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Delegate or undelegate stake to a validator (tokenDelegate).
A delegation to one validator locks for 1 day.
Parameters
| Parameter | Type |
|---|---|
params | DelegateOrUndelegateStakeRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
deployPerp()
deployPerp(params: DeployPerpRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | DeployPerpRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
deploySpot()
deploySpot(params: DeploySpotRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | DeploySpotRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
depositIntoStaking()
depositIntoStaking(params: object, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Move native token from spot into staking (cDeposit).
wei is the amount in wei.
Parameters
| Parameter | Type |
|---|---|
params | { wei: number; } |
params.wei | number |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
disableStakingTradingLink()
disableStakingTradingLink(params: object, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { tradingUser: string; } |
params.tradingUser | string |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
distributeVaultFunds()
distributeVaultFunds(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { usd: number; vaultAddress: string; } |
params.usd | number |
params.vaultAddress | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
enableApiWalletDexAbstraction()
enableApiWalletDexAbstraction(options?: L1ActionOptions): Promise<ExchangeResponse>;Enable HIP-3 DEX abstraction from an API wallet (agentEnableDexAbstraction).
Deprecated. Prefer setApiWalletAbstraction(). This only changes null to enabled.
Parameters
| Parameter | Type |
|---|---|
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
executeBorrowLendOperation()
executeBorrowLendOperation(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { amount: string | null; operation: "withdraw" | "borrow" | "repay" | "supply"; token: number; } |
params.amount | string | null |
params.operation | "withdraw" | "borrow" | "repay" | "supply" |
params.token | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
finalizeEvmContract()
finalizeEvmContract(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { input: | { create: { nonce: number; }; } | "customStorageSlot" | "firstStorageSlot"; token: number; } |
params.input | | { create: { nonce: number; }; } | "customStorageSlot" | "firstStorageSlot" |
params.token | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
getAccountAddress()
getAccountAddress(): Promise<string>;Returns
Promise<string>
getActiveAssetData()
getActiveAssetData(params: AccountRequest & object): Promise<ActiveAssetData>;User's active asset data (activeAssetData): leverage, max trade size, available to trade, and mark price for one coin.
Parameters
| Parameter | Type |
|---|---|
params | AccountRequest & object |
Returns
Promise<ActiveAssetData>
getAlignedQuoteTokenStatus()
getAlignedQuoteTokenStatus(params: object): Promise<AlignedQuoteTokenStatus>;Send an alignedQuoteTokenInfo info request for a token index.
Parameters
| Parameter | Type |
|---|---|
params | { token: number; } |
params.token | number |
Returns
Promise<AlignedQuoteTokenStatus>
getAllBorrowLendReserveStates()
getAllBorrowLendReserveStates(): Promise<BorrowLendReserveEntry[]>;Borrow and lend reserve state for every token (allBorrowLendReserveStates).
Each entry is [token, reserve].
Returns
Promise<BorrowLendReserveEntry[]>
getAllMids()
getAllMids(params?: object): Promise<AllMidsResponse>;Mid prices for all coins (allMids).
An empty book falls back to the last trade price. Spot mids are included only when dex is omitted or empty.
Parameters
| Parameter | Type |
|---|---|
params? | { dex?: string; } |
params.dex? | string |
Returns
Promise<AllMidsResponse>
Example
import { RestClient } from '@siebly/hyperliquid-api';
async function main() {
const client = new RestClient();
const mids = await client.getAllMids();
if (mids.BTC === undefined) {
throw new Error('BTC was not present in the mid-price response.');
}
console.log('BTC mid price:', mids.BTC);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getAllPerpMetadata()
getAllPerpMetadata(): Promise<PerpMeta[]>;Metadata for every perp DEX (allPerpMetas).
Each entry is one DEX: universe, margin tables, and collateral token. Index 0 is the default perp DEX.
Returns
Promise<PerpMeta[]>
getApprovedBuilders()
getApprovedBuilders(params?: AccountRequest): Promise<string[]>;Builder addresses this user has approved (approvedBuilders).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<string[]>
getBalances()
getBalances(params?: AccountDexRequest): Promise<AccountBalancesResponse>;Parameters
| Parameter | Type |
|---|---|
params? | AccountDexRequest |
Returns
Promise<AccountBalancesResponse>
getBorrowLendReserveState()
getBorrowLendReserveState(params: object): Promise<BorrowLendReserveState>;Borrow and lend reserve state for one token (borrowLendReserveState).
Parameters
| Parameter | Type |
|---|---|
params | { token: number; } |
params.token | number |
Returns
Promise<BorrowLendReserveState>
getCandles()
getCandles(params: GetCandlesRequest): Promise<Candle[]>;Candle snapshot (candleSnapshot).
Only the most recent 5000 candles are available. HIP-3 coins use a dex:COIN name.
Parameters
| Parameter | Type |
|---|---|
params | GetCandlesRequest |
Returns
Promise<Candle[]>
Example
import { RestClient } from '@siebly/hyperliquid-api';
async function main() {
const client = new RestClient();
const candles = await client.getCandles({
coin: 'BTC',
interval: '1h',
startTime: Date.now() - 24 * 60 * 60 * 1000,
});
console.log(candles);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getConcisePerpAnnotations()
getConcisePerpAnnotations(): Promise<PerpConciseAnnotation[]>;Concise perp annotations (perpConciseAnnotations).
Each entry is [coin, annotation]. keywords is omitted when absent.
Returns
Promise<PerpConciseAnnotation[]>
getExchangeStatus()
getExchangeStatus(): Promise<ExchangeStatus>;Returns
Promise<ExchangeStatus>
getExtraAgents()
getExtraAgents(params?: AccountRequest): Promise<ExtraAgent[]>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<ExtraAgent[]>
getFrontendOpenOrders()
getFrontendOpenOrders(params?: AccountDexRequest): Promise<FrontendOpenOrder[]>;Open orders with trigger and reduce-only fields (frontendOpenOrders).
Spot orders are included only for the first perp DEX.
Parameters
| Parameter | Type |
|---|---|
params? | AccountDexRequest |
Returns
Promise<FrontendOpenOrder[]>
getFundingHistory()
getFundingHistory(params: GetFundingHistoryRequest): Promise<FundingHistory[]>;Historical funding rates for one coin (fundingHistory).
Parameters
| Parameter | Type |
|---|---|
params | GetFundingHistoryRequest |
Returns
Promise<FundingHistory[]>
Example
import { RestClient } from '@siebly/hyperliquid-api';
async function main() {
const client = new RestClient();
// Current funding for every perpetual. `funding` is an hourly rate.
const [meta, contexts] = await client.getPerpAssetContexts();
const index = meta.universe.findIndex((asset) => asset.name === 'ETH');
const hourly = Number(contexts[index].funding);
console.log({
hourly,
per8h: hourly * 8,
annualisedPct: hourly * 24 * 365 * 100,
});
// Settled funding over the last 24 hours: one entry per hour.
const history = await client.getFundingHistory({
coin: 'ETH',
startTime: Date.now() - 24 * 60 * 60 * 1000,
});
console.log(history.slice(-3));
// Predicted rates by venue. Divide by `fundingIntervalHours` before
// comparing venues that settle on different schedules.
const predicted = await client.getPredictedFundingRates();
const venues = predicted.find(([coin]) => coin === 'ETH')?.[1] ?? [];
for (const [venue, rate] of venues) {
if (rate?.fundingIntervalHours) {
const perHour = Number(rate.fundingRate) / rate.fundingIntervalHours;
console.log(venue, { perHour, intervalHours: rate.fundingIntervalHours });
}
}
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getGossipPriorityAuctionStatus()
getGossipPriorityAuctionStatus(): Promise<GossipPriorityAuctionStatus>;Returns
Promise<GossipPriorityAuctionStatus>
getGossipRootIps()
getGossipRootIps(): Promise<string[]>;Returns
Promise<string[]>
getLeadingVaults()
getLeadingVaults(params?: AccountRequest): Promise<LeadingVault[]>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<LeadingVault[]>
getLegalStatus()
getLegalStatus(params?: AccountRequest): Promise<LegalStatus>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<LegalStatus>
getLiquidatablePositions()
getLiquidatablePositions(): Promise<LiquidatablePosition[]>;Returns
Promise<LiquidatablePosition[]>
getMarginTable()
getMarginTable(params: object): Promise<PerpMarginTable>;Parameters
| Parameter | Type |
|---|---|
params | { id: number; } |
params.id | number |
Returns
Promise<PerpMarginTable>
getMaxBuilderFee()
getMaxBuilderFee(params: GetMaxBuilderFeeRequest): Promise<number>;Maximum approved builder fee (maxBuilderFee).
The number is in tenths of a basis point. 1 means 0.001%.
Parameters
| Parameter | Type |
|---|---|
params | GetMaxBuilderFeeRequest |
Returns
Promise<number>
getMaxMarketOrderNotionals()
getMaxMarketOrderNotionals(): Promise<MaxMarketOrderNotional[]>;Returns
Promise<MaxMarketOrderNotional[]>
getMultiSigSigners()
getMultiSigSigners(params?: AccountRequest): Promise<MultiSigSigners | null>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<MultiSigSigners | null>
getOpenOrders()
getOpenOrders(params?: AccountDexRequest): Promise<OpenOrder[]>;Open orders (openOrders).
Spot orders are included only for the first perp DEX. side "B" is bid and "A" is ask.
Parameters
| Parameter | Type |
|---|---|
params? | AccountDexRequest |
Returns
Promise<OpenOrder[]>
getOrderBook()
getOrderBook(params: GetOrderBookRequest): Promise<OrderBookResponse | null>;L2 order book (l2Book).
At most 20 levels per side. nSigFigs aggregates prices. mantissa is only valid when nSigFigs is 5.
Parameters
| Parameter | Type |
|---|---|
params | GetOrderBookRequest |
Returns
Promise<OrderBookResponse | null>
Example
import { RestClient } from '@siebly/hyperliquid-api';
async function main() {
const client = new RestClient();
const book = await client.getOrderBook({ coin: 'BTC' });
if (!book) {
console.log('No order book was returned for BTC.');
return;
}
const [bids, asks] = book.levels;
console.log({ bestBid: bids[0] ?? null, bestAsk: asks[0] ?? null });
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getOrderHistory()
getOrderHistory(params?: AccountRequest): Promise<HistoricalOrder[]>;Recent historical orders (historicalOrders).
Returns at most 2000 orders. status uses the same values as getOrderStatus().
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<HistoricalOrder[]>
getOrderStatus()
getOrderStatus(params: GetOrderStatusRequest): Promise<OrderStatusResponse>;Order status by order id or client order id (orderStatus).
status: "unknownOid" means the order was not found. Otherwise status is "order" and order.status is the order state.
Parameters
| Parameter | Type |
|---|---|
params | GetOrderStatusRequest |
Returns
Promise<OrderStatusResponse>
Example
import { RestClient } from '@siebly/hyperliquid-api';
// One-shot diagnostic for unresolved state. Use account WebSocket subscriptions
// for ongoing order and fill updates, rather than calling this after each action.
async function main() {
const accountAddress = process.env.HYPERLIQUID_ACCOUNT_ADDRESS;
const savedOrderId = process.env.HYPERLIQUID_ORDER_ID;
if (!accountAddress || !savedOrderId) {
throw new Error(
'Set HYPERLIQUID_ACCOUNT_ADDRESS and HYPERLIQUID_ORDER_ID.',
);
}
const orderId = Number(savedOrderId);
if (!Number.isSafeInteger(orderId) || orderId <= 0) {
throw new Error(
'HYPERLIQUID_ORDER_ID must be the numeric ID returned by the exchange.',
);
}
const client = new RestClient({ accountAddress });
const result = await client.getOrderStatus({ oid: orderId });
if (result.status === 'unknownOid') {
console.log('Order not found. Check the account, network and order ID.');
return;
}
console.log('Order status:', result.order.status);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
Check an order after a timeout
getOutcomeDeployerLimits()
getOutcomeDeployerLimits(params: object): Promise<OutcomeDeployerLimits>;Remaining outcome deployment allowance for a venue (outcomeDeployerLimits).
venue is the venue name, for example "out".
Parameters
| Parameter | Type |
|---|---|
params | { venue: string; } |
params.venue | string |
Returns
Promise<OutcomeDeployerLimits>
getOutcomeMetadata()
getOutcomeMetadata(): Promise<OutcomeMetadata>;Retrieve outcome metadata (outcomeMeta), including outcomes, questions and deployers.
Returns
Promise<OutcomeMetadata>
getPerpAccountSummary()
getPerpAccountSummary(params?: AccountDexRequest): Promise<PerpAccountSummaryResponse>;Perp account summary (clearinghouseState): open positions and margin.
assetPositions[].position.szi is signed: positive is long, negative is short. Under unified account or portfolio margin, use spot balances for the trading account balance across spot and perps.
Parameters
| Parameter | Type |
|---|---|
params? | AccountDexRequest |
Returns
Promise<PerpAccountSummaryResponse>
Example
import { RestClient } from '@siebly/hyperliquid-api';
async function main() {
const accountAddress = process.env.HYPERLIQUID_ACCOUNT_ADDRESS;
if (!accountAddress) throw new Error('Set HYPERLIQUID_ACCOUNT_ADDRESS.');
const client = new RestClient({ accountAddress });
const account = await client.getPerpAccountSummary();
console.log(account.assetPositions);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getPerpAnnotation()
getPerpAnnotation(params: object): Promise<PerpAnnotation | null>;Retrieve the annotation for a perpetual market (perpAnnotation). The response can be null; check it before reading annotation fields.
Parameters
| Parameter | Type |
|---|---|
params | { coin: string; } |
params.coin | string |
Returns
Promise<PerpAnnotation | null>
getPerpAssetContexts()
getPerpAssetContexts(params?: object): Promise<PerpMetaAndAssetContexts>;Perp metadata plus asset contexts (metaAndAssetCtxs).
The tuple is [meta, contexts]. Contexts line up with meta.universe and include mark price, funding, open interest, and related fields. dex defaults to the empty string, which is the first perp DEX.
Parameters
| Parameter | Type |
|---|---|
params? | { dex?: string; } |
params.dex? | string |
Returns
Promise<PerpMetaAndAssetContexts>
getPerpCategories()
getPerpCategories(): Promise<PerpCategory[]>;Perp category for each listed coin (perpCategories).
Each entry is [coin, category].
Returns
Promise<PerpCategory[]>
getPerpDeployAuctionStatus()
getPerpDeployAuctionStatus(): Promise<DeployGasAuction>;Perp deploy auction status (perpDeployAuctionStatus).
Returns
Promise<DeployGasAuction>
getPerpDexLimits()
getPerpDexLimits(params: object): Promise<PerpDexLimits>;Builder-deployed perp market limits (perpDexLimits).
dex is required. The empty string is not allowed.
Parameters
| Parameter | Type |
|---|---|
params | { dex: string; } |
params.dex | string |
Returns
Promise<PerpDexLimits>
getPerpDexs()
getPerpDexs(): Promise<(PerpDex | null)[]>;All perpetual DEXs (perpDexs).
Index 0 is null, the default perp DEX. Later entries are builder-deployed HIP-3 DEXs.
Returns
Promise<(PerpDex | null)[]>
getPerpDexStatus()
getPerpDexStatus(params: object): Promise<PerpDexStatus>;Perp DEX deposit status (perpDexStatus).
The empty string is the first perp DEX.
Parameters
| Parameter | Type |
|---|---|
params | { dex: string; } |
params.dex | string |
Returns
Promise<PerpDexStatus>
getPerpMetadata()
getPerpMetadata(params?: object): Promise<PerpMeta>;Perp metadata (meta): universe and margin tables.
dex defaults to the empty string, which is the first perp DEX.
Parameters
| Parameter | Type |
|---|---|
params? | { dex?: string; } |
params.dex? | string |
Returns
Promise<PerpMeta>
getPerpsAtOpenInterestCap()
getPerpsAtOpenInterestCap(params?: object): Promise<string[]>;Coins currently at their open-interest cap (perpsAtOpenInterestCap).
dex selects a builder-deployed market. Omitted means the first perp DEX.
Parameters
| Parameter | Type |
|---|---|
params? | { dex?: string; } |
params.dex? | string |
Returns
Promise<string[]>
getPortfolio()
getPortfolio(params?: AccountRequest): Promise<PortfolioEntry[]>;Account value, PnL, and volume history (portfolio).
Each entry is [period, snapshot]. Periods include day, week, month, allTime, and the perp* variants.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<PortfolioEntry[]>
getPredictedFundingRates()
getPredictedFundingRates(): Promise<PredictedFunding[]>;Retrieve predicted funding rates by coin and venue (predictedFundings). A venue entry can be null when no rate payload is supplied.
Returns
Promise<PredictedFunding[]>
getPreTransferCheck()
getPreTransferCheck(params: GetPreTransferCheckRequest): Promise<PreTransferCheck>;Parameters
| Parameter | Type |
|---|---|
params | GetPreTransferCheckRequest |
Returns
Promise<PreTransferCheck>
getRecentTrades()
getRecentTrades(params: object): Promise<Trade[]>;Parameters
| Parameter | Type |
|---|---|
params | { coin: string; } |
params.coin | string |
Returns
Promise<Trade[]>
getReferralInfo()
getReferralInfo(params?: AccountRequest): Promise<ReferralInfo>;Get referral information for an account with a referral info request. Claimed referral rewards are also recorded in the non-funding ledger.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<ReferralInfo>
getSettledOutcome()
getSettledOutcome(params: object): Promise<SettledOutcome | null>;Retrieve settlement information for an outcome (settledOutcome). The response can be null, including for an unsettled outcome.
Parameters
| Parameter | Type |
|---|---|
params | { outcome: number; } |
params.outcome | number |
Returns
Promise<SettledOutcome | null>
getSpotAssetContexts()
getSpotAssetContexts(): Promise<SpotMetaAndAssetContexts>;Retrieve spot metadata and market contexts (spotMetaAndAssetCtxs), including prices, volume and supply. midPx can be null when the order book has no midpoint.
Returns
Promise<SpotMetaAndAssetContexts>
getSpotBalances()
getSpotBalances(params?: AccountRequest): Promise<SpotBalancesResponse>;Spot token balances (spotClearinghouseState).
Under unified account or portfolio margin, this is the trading-account balance across spot and perps.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<SpotBalancesResponse>
getSpotDeployAuctionStatus()
getSpotDeployAuctionStatus(params?: AccountRequest): Promise<SpotDeployStateResponse>;Spot deploy state for a user (spotDeployState), including the gas auction.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<SpotDeployStateResponse>
getSpotMetadata()
getSpotMetadata(): Promise<SpotMeta>;Spot metadata (spotMeta): tokens and trading pairs.
Returns
Promise<SpotMeta>
getSpotPairDeployAuctionStatus()
getSpotPairDeployAuctionStatus(): Promise<DeployGasAuction>;Dutch auction for deploying a spot pair (spotPairDeployAuctionStatus).
Returns
Promise<DeployGasAuction>
getStakingDelegations()
getStakingDelegations(params?: AccountRequest): Promise<StakingDelegation[]>;Stake delegated to validators (delegations).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<StakingDelegation[]>
getStakingHistory()
getStakingHistory(params?: AccountRequest): Promise<StakingHistoryEntry[]>;Retrieve staking history (delegatorHistory). Entries include a timestamp, transaction hash and a delta, such as delegate, cDeposit or withdrawal.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<StakingHistoryEntry[]>
getStakingRewards()
getStakingRewards(params?: AccountRequest): Promise<StakingReward[]>;Staking rewards (delegatorRewards).
source is "delegation" or "commission" in the documented samples.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<StakingReward[]>
getStakingSummary()
getStakingSummary(params?: AccountRequest): Promise<StakingSummary>;Staking summary (delegatorSummary): delegated, undelegated, and pending withdrawals.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<StakingSummary>
getSubAccounts()
getSubAccounts(params?: AccountRequest): Promise<SubAccount[] | null>;Retrieve the subaccounts for an address (subAccounts). Handle null as well as a list of subaccounts.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<SubAccount[] | null>
getSubAccountsWithAllDexStates()
getSubAccountsWithAllDexStates(params?: AccountRequest): Promise<
| SubAccountWithAllDexStates[]
| null>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise< | SubAccountWithAllDexStates[] | null>
getTokenDetails()
getTokenDetails(params: object): Promise<TokenDetails>;Token details (tokenDetails): supply, prices, and genesis balances.
tokenId is the 34-character onchain id, for example 0x00000000000000000000000000000000.
Parameters
| Parameter | Type |
|---|---|
params | { tokenId: string; } |
params.tokenId | string |
Returns
Promise<TokenDetails>
getTwapHistory()
getTwapHistory(params?: AccountRequest): Promise<TwapHistoryEntry[]>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<TwapHistoryEntry[]>
getUserAbstraction()
getUserAbstraction(params?: AccountRequest): Promise<UserAbstraction>;Account abstraction mode (userAbstraction).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<UserAbstraction>
getUserBorrowLendInterest()
getUserBorrowLendInterest(params: GetUserBorrowLendInterestRequest): Promise<UserBorrowLendInterest[]>;Parameters
| Parameter | Type |
|---|---|
params | GetUserBorrowLendInterestRequest |
Returns
Promise<UserBorrowLendInterest[]>
getUserBorrowLendState()
getUserBorrowLendState(params?: AccountRequest): Promise<BorrowLendUserState>;User borrow and lend balances (borrowLendUserState).
tokenToState entries are [token, state].
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<BorrowLendUserState>
getUserDexAbstraction()
getUserDexAbstraction(params?: AccountRequest): Promise<boolean>;Whether HIP-3 DEX abstraction is enabled (userDexAbstraction).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<boolean>
getUserFees()
getUserFees(params?: AccountRequest): Promise<UserFees>;User fee rates and the current fee schedule (userFees).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<UserFees>
getUserFills()
getUserFills(params?: GetUserFillsRequest): Promise<UserFill[]>;Recent fills (userFills).
Returns at most 2000 fills. builderFee is omitted when it is zero. side "B" is buy and "A" is sell.
Parameters
| Parameter | Type |
|---|---|
params? | GetUserFillsRequest |
Returns
Promise<UserFill[]>
getUserFillsByTime()
getUserFillsByTime(params: GetUserFillsByTimeRequest): Promise<UserFill[]>;Fills in a time range (userFillsByTime).
Returns at most 2000 fills, and only the 10000 most recent fills are available. Paginate by using the last time as the next startTime.
Parameters
| Parameter | Type |
|---|---|
params | GetUserFillsByTimeRequest |
Returns
Promise<UserFill[]>
getUserFundingHistory()
getUserFundingHistory(params?: GetUserFundingHistoryRequest): Promise<UserFunding[]>;User funding payments (userFunding).
startTime is inclusive, in milliseconds. endTime defaults to now.
Parameters
| Parameter | Type |
|---|---|
params? | GetUserFundingHistoryRequest |
Returns
Promise<UserFunding[]>
getUserNonFundingLedgerUpdates()
getUserNonFundingLedgerUpdates(params?: GetUserNonFundingLedgerUpdatesRequest): Promise<UserNonFundingLedgerUpdate[]>;User non-funding ledger updates (userNonFundingLedgerUpdates): deposits, withdrawals, transfers, and other account events.
startTime is inclusive, in milliseconds. endTime defaults to now. Read delta.type to see which delta fields are set.
Parameters
| Parameter | Type |
|---|---|
params? | GetUserNonFundingLedgerUpdatesRequest |
Returns
Promise<UserNonFundingLedgerUpdate[]>
getUserRateLimit()
getUserRateLimit(params?: AccountRequest): Promise<UserRateLimit>;Address request usage and cap (userRateLimit).
nRequestsUsed is usage above the reserved amount. nRequestsSurplus is reserved amount not yet used.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<UserRateLimit>
Example
import { RestClient } from '@siebly/hyperliquid-api';
// Address-based limits count signed actions, not info requests.
// Query the trading account (master or subaccount), not the API wallet.
async function main() {
const user = process.env.HYPERLIQUID_ACCOUNT_ADDRESS;
if (!user) {
throw new Error('Set HYPERLIQUID_ACCOUNT_ADDRESS.');
}
const client = new RestClient();
const limit = await client.getUserRateLimit({ user });
// nRequestsUsed is net of reserved actions; nRequestsSurplus is reserved and unused.
const remaining =
limit.nRequestsCap - limit.nRequestsUsed + limit.nRequestsSurplus;
console.log('Cumulative volume (USDC):', limit.cumVlm);
console.log('Action cap:', limit.nRequestsCap);
console.log('Actions used:', limit.nRequestsUsed);
console.log('Reserved, unused:', limit.nRequestsSurplus);
console.log('Actions remaining:', remaining);
if (remaining <= 0) {
console.log('Rate limited: one action every 10 seconds until volume raises the cap.');
}
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});See
getUserRole()
getUserRole(params: UserRequest): Promise<UserRoleResponse>;Account role (userRole): user, agent, vault, subaccount, or missing.
Query the master or subaccount address itself. An agent wallet address returns the agent role, not the trading account.
Parameters
| Parameter | Type |
|---|---|
params | UserRequest |
Returns
Promise<UserRoleResponse>
getUserTwapSliceFills()
getUserTwapSliceFills(params?: AccountRequest): Promise<TwapSliceFill[]>;Recent TWAP slice fills (userTwapSliceFills).
Returns at most 2000 fills. TWAP fill hashes are zero.
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<TwapSliceFill[]>
getUserTwapSliceFillsByTime()
getUserTwapSliceFillsByTime(params: GetUserTwapSliceFillsByTimeRequest): Promise<TwapSliceFill[]>;Parameters
| Parameter | Type |
|---|---|
params | GetUserTwapSliceFillsByTimeRequest |
Returns
Promise<TwapSliceFill[]>
getUserVaultDeposits()
getUserVaultDeposits(params?: AccountRequest): Promise<UserVaultDeposit[]>;Vault equity for this user (userVaultEquities).
Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<UserVaultDeposit[]>
getValidatorL1Votes()
getValidatorL1Votes(): Promise<ValidatorL1Vote[]>;Returns
Promise<ValidatorL1Vote[]>
getValidatorSummaries()
getValidatorSummaries(): Promise<ValidatorSummary[]>;Returns
Promise<ValidatorSummary[]>
getVaultDetails()
getVaultDetails(params: GetVaultDetailsRequest): Promise<VaultDetails | null>;Query details for a vault with a vaultDetails info request. Supply vaultAddress; the request also accepts an optional user address.
Parameters
| Parameter | Type |
|---|---|
params | GetVaultDetailsRequest |
Returns
Promise<VaultDetails | null>
getVaultSummaries()
getVaultSummaries(): Promise<VaultSummary[]>;Returns
Promise<VaultSummary[]>
getVipStatus()
getVipStatus(params?: AccountRequest): Promise<boolean>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<boolean>
getWebData2()
getWebData2(params?: AccountRequest): Promise<WebData2>;Parameters
| Parameter | Type |
|---|---|
params? | AccountRequest |
Returns
Promise<WebData2>
invalidateNonce()
invalidateNonce(options?: L1ActionOptions): Promise<ExchangeResponse>;Mark a nonce as used without another effect (noop).
Parameters
| Parameter | Type |
|---|---|
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
linkStakingAccount()
linkStakingAccount(params: LinkStakingAccountRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | LinkStakingAccountRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
modifyOrder()
modifyOrder(params: ModifyOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Modify one order (modify). alwaysPlace: true sends a: true, allowing the replacement order even if cancellation fails. Otherwise the replacement must be a non-trigger ALO order or a non-executable GTC order; the exchange changes the latter to ALO. The SDK omits a when false because the exchange rejects actions hashed with a: false.
Parameters
| Parameter | Type |
|---|---|
params | ModifyOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
modifyOrders()
modifyOrders(params: ModifyOrdersRequest, options?: L1ActionOptions): Promise<ExchangeResponse<OrderResponseData>>;Modify multiple resting orders with a batchModify action. The response uses the same status structure as order submissions. alwaysPlace has the same behavior as in modifyOrder(): when true, it allows the replacement order even if cancellation fails.
Parameters
| Parameter | Type |
|---|---|
params | ModifyOrdersRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<OrderResponseData>>
modifyVault()
modifyVault(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { allowDeposits?: boolean | null; alwaysCloseOnWithdraw?: boolean | null; vaultAddress: string; } |
params.allowDeposits? | boolean | null |
params.alwaysCloseOnWithdraw? | boolean | null |
params.vaultAddress | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
nameToCoin()
nameToCoin(name: string): Promise<string>;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Promise<string>
refreshAssetMetadata()
refreshAssetMetadata(): Promise<void>;Returns
Promise<void>
registerReferrer()
registerReferrer(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { code: string; } |
params.code | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
renameSubAccount()
renameSubAccount(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { name: string; subAccountUser: string; } |
params.name | string |
params.subAccountUser | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
reserveAdditionalActions()
reserveAdditionalActions(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Buy extra address request weight (reserveRequestWeight).
Each reserved action costs 0.0005 USDC from the perp balance.
Parameters
| Parameter | Type |
|---|---|
params | { weight: number; } |
params.weight | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
resolveAsset()
resolveAsset(identifier: AssetIdentifier): Promise<ResolvedAsset>;Parameters
| Parameter | Type |
|---|---|
identifier | AssetIdentifier |
Returns
Promise<ResolvedAsset>
sendAsset()
sendAsset(params: SendAssetRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Transfer collateral between perp DEXs, spot, users, or subaccounts (sendAsset).
Use "" for the default USDC perp DEX and "spot" for spot. Only the collateral token can move to or from a perp DEX.
Parameters
| Parameter | Type |
|---|---|
params | SendAssetRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
sendAssetFromApiWallet()
sendAssetFromApiWallet(params: SendAssetRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Transfer collateral with an API wallet (agentSendAsset).
Destination must match the source address. Dex names match sendAsset().
Parameters
| Parameter | Type |
|---|---|
params | SendAssetRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
sendSpotAsset()
sendSpotAsset(params: SendSpotAssetRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Send a spot token to another address on HyperCore (spotSend).
This does not touch the EVM bridge. token is name:tokenId.
Parameters
| Parameter | Type |
|---|---|
params | SendSpotAssetRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
sendToEvmWithData()
sendToEvmWithData(params: SendToEvmWithDataRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Send tokens from Core to EVM with calldata (sendToEvmWithData).
The linked contract must implement coreReceiveWithData.
Parameters
| Parameter | Type |
|---|---|
params | SendToEvmWithDataRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
sendUsd()
sendUsd(params: SendUsdRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Send USDC to another address on HyperCore (usdSend).
This does not touch the EVM bridge. expiresAfter is not supported.
Parameters
| Parameter | Type |
|---|---|
params | SendUsdRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
setApiWalletAbstraction()
setApiWalletAbstraction(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Set account abstraction from an API wallet (agentSetAbstraction).
"i" is disabled, "u" is unified account, and "p" is portfolio margin.
Parameters
| Parameter | Type |
|---|---|
params | { abstraction: "i" | "p" | "u"; } |
params.abstraction | "i" | "p" | "u" |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setCancelAllAfter()
setCancelAllAfter(params?: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Schedule a cancel-all, or clear one (scheduleCancel).
time is a millisecond timestamp at least 5 seconds in the future. Omit time to remove the scheduled cancel. At most 10 triggers per day.
Parameters
| Parameter | Type |
|---|---|
params? | { time?: number; } |
params.time? | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setDisplayName()
setDisplayName(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { displayName: string; } |
params.displayName | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setEvmBigBlocks()
setEvmBigBlocks(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { usingBigBlocks: boolean; } |
params.usingBigBlocks | boolean |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setIsolatedMarginLeverage()
setIsolatedMarginLeverage(params: SetIsolatedMarginLeverageRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Set isolated margin to a target leverage (topUpIsolatedOnlyMargin).
This changes leverage directly. updateIsolatedMargin() changes a USDC amount.
Parameters
| Parameter | Type |
|---|---|
params | SetIsolatedMarginLeverageRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setReferrer()
setReferrer(options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setSpotDusting()
setSpotDusting(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { toggleSpotDusting: { optOut: boolean; }; } |
params.toggleSpotDusting | { optOut: boolean; } |
params.toggleSpotDusting.optOut | boolean |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
setUserAbstraction()
setUserAbstraction(params: SetUserAbstractionRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Set account abstraction (userSetAbstraction).
abstraction is "disabled", "unifiedAccount", or "portfolioMargin".
Parameters
| Parameter | Type |
|---|---|
params | SetUserAbstractionRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
setUserDexAbstraction()
setUserDexAbstraction(params: UserToggleRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Enable or disable HIP-3 DEX abstraction (userDexAbstraction).
Deprecated. Prefer setUserAbstraction().
Parameters
| Parameter | Type |
|---|---|
params | UserToggleRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
setUserPortfolioMargin()
setUserPortfolioMargin(params: UserToggleRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | UserToggleRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
submitGossipPriorityBid()
submitGossipPriorityBid(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | { ip: string; maxGas: number; slotId: 0 | 1; } |
params.ip | string |
params.maxGas | number |
params.slotId | 0 | 1 |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
submitLimitOrder()
submitLimitOrder(params: SubmitLimitOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse<OrderResponseData>>;Place a limit order (order).
postOnly sends ALO. timeInForce: "IOC" sends IOC. Otherwise the order is GTC.
Parameters
| Parameter | Type |
|---|---|
params | SubmitLimitOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<OrderResponseData>>
See
submitMarketClose()
submitMarketClose(params: SubmitMarketCloseRequest, options?: L1ActionOptions): Promise<ExchangeResponse<OrderResponseData>>;Submit a reduce-only IOC order opposite the current perpetual position. If size is omitted, use the absolute open position size returned by the account query; pass size for a partial close. Execution is subject to available liquidity and the limit price, so a successful request does not guarantee the entire requested size filled.
Parameters
| Parameter | Type |
|---|---|
params | SubmitMarketCloseRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<OrderResponseData>>
submitMarketOrder()
submitMarketOrder(params: SubmitMarketOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse<OrderResponseData>>;Submit an IOC order using price as the reference price, or the current midpoint when price is omitted. The SDK applies maxSlippage to that reference price to calculate the limit price. maxSlippage must be at least 0 and less than 1; it defaults to 0.05.
Parameters
| Parameter | Type |
|---|---|
params | SubmitMarketOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<OrderResponseData>>
submitMultiSigL1Action()
submitMultiSigL1Action<T = ExchangeResponse<unknown>>(action: JsonObject, options: MultiSigL1RequestOptions): Promise<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T | ExchangeResponse<unknown> |
Parameters
| Parameter | Type |
|---|---|
action | JsonObject |
options | MultiSigL1RequestOptions |
Returns
Promise<T>
Inherited from
BaseRestClient.submitMultiSigL1Action
submitMultiSigUserSignedAction()
submitMultiSigUserSignedAction<T = ExchangeResponse<unknown>>(
action: JsonObject,
definition: UserSignedActionDefinition,
options: MultiSigUserSignedRequestOptions
): Promise<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T | ExchangeResponse<unknown> |
Parameters
| Parameter | Type |
|---|---|
action | JsonObject |
definition | UserSignedActionDefinition |
options | MultiSigUserSignedRequestOptions |
Returns
Promise<T>
Inherited from
BaseRestClient.submitMultiSigUserSignedAction
submitOrder()
submitOrder(params: SubmitOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse<OrderResponseData>>;Place one or more orders (order).
Each status is resting, filled, or error. The request can succeed while an individual order is rejected.
Parameters
| Parameter | Type |
|---|---|
params | SubmitOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<OrderResponseData>>
See
Handle individual order results
submitRawInfoRequest()
submitRawInfoRequest<T = InfoResponse>(request: object): Promise<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T | InfoResponse |
Parameters
| Parameter | Type |
|---|---|
request | object |
Returns
Promise<T>
Inherited from
BaseRestClient.submitRawInfoRequest
submitRawL1Action()
submitRawL1Action<T = ExchangeResponse<unknown>>(action: JsonObject, options?: L1ActionOptions): Promise<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T | ExchangeResponse<unknown> |
Parameters
| Parameter | Type |
|---|---|
action | JsonObject |
options? | L1ActionOptions |
Returns
Promise<T>
Inherited from
BaseRestClient.submitRawL1Action
submitRawUserSignedAction()
submitRawUserSignedAction<T = ExchangeResponse<unknown>>(
action: JsonObject,
definition: UserSignedActionDefinition,
options?: UserSignedActionOptions
): Promise<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T | ExchangeResponse<unknown> |
Parameters
| Parameter | Type |
|---|---|
action | JsonObject |
definition | UserSignedActionDefinition |
options? | UserSignedActionOptions |
Returns
Promise<T>
Inherited from
BaseRestClient.submitRawUserSignedAction
submitSignerAction()
submitSignerAction(params:
| {
jailSelf: null;
}
| {
unjailSelf: null;
}, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | | { jailSelf: null; } | { unjailSelf: null; } |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
submitTrailingStop()
submitTrailingStop(params: SubmitTrailingStopRequest, options?: L1ActionOptions): Promise<ExchangeResponse<TrailingStopResponseData>>;Place a trailing stop order for a perpetual market (trailingStop). asset is a numeric asset ID. Set retracement to a percent string such as { pct: '1.234%' } or a price distance such as { px: '100' }. On success, the order ID is in response.data.oid.
Parameters
| Parameter | Type |
|---|---|
params | SubmitTrailingStopRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<TrailingStopResponseData>>
submitTwapOrder()
submitTwapOrder(params: SubmitTwapOrderRequest, options?: L1ActionOptions): Promise<ExchangeResponse<TwapOrderResponseData>>;Place a TWAP order (twapOrder).
A running TWAP returns { running: { twapId } }. A rejected TWAP returns { error }.
Parameters
| Parameter | Type |
|---|---|
params | SubmitTwapOrderRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse<TwapOrderResponseData>>
submitUserOutcome()
submitUserOutcome(params: SubmitUserOutcomeRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Split, merge, or negate outcome shares (userOutcome).
splitOutcome turns quote tokens into Yes and No shares. mergeOutcome and mergeQuestion turn shares back into quote tokens. amount: null merges the maximum. negateOutcome converts No shares into Yes shares of the other outcomes on the same question.
Parameters
| Parameter | Type |
|---|---|
params | SubmitUserOutcomeRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
submitValidatorAction()
submitValidatorAction(params: Omit<JsonObject, "type">, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | Omit<JsonObject, "type"> |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
transferHip3LiquidatorFunds()
transferHip3LiquidatorFunds(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Deposit or withdraw from an HIP-3 backstop liquidator (hip3LiquidatorTransfer).
ntl is an integer in 1e-6 quote-token units and must be a multiple of 1000 quote tokens. Only principal can be withdrawn, not PnL.
Parameters
| Parameter | Type |
|---|---|
params | { dex: string; isDeposit: boolean; ntl: number; } |
params.dex | string |
params.isDeposit | boolean |
params.ntl | number |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
transferSpotToOrFromSubAccount()
transferSpotToOrFromSubAccount(params: TransferSpotToOrFromSubAccountRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | TransferSpotToOrFromSubAccountRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
transferUsdBetweenSpotAndPerp()
transferUsdBetweenSpotAndPerp(params: TransferUsdBetweenSpotAndPerpRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Move USDC between spot and perp (usdClassTransfer).
toPerp: true sends spot to perp.
Parameters
| Parameter | Type |
|---|---|
params | TransferUsdBetweenSpotAndPerpRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
transferUsdToOrFromSubAccount()
transferUsdToOrFromSubAccount(params: TransferUsdToOrFromSubAccountRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Parameters
| Parameter | Type |
|---|---|
params | TransferUsdToOrFromSubAccountRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
transferVaultFunds()
transferVaultFunds(params: TransferVaultFundsRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Deposit or withdraw vault funds (vaultTransfer).
Parameters
| Parameter | Type |
|---|---|
params | TransferVaultFundsRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
updateIsolatedMargin()
updateIsolatedMargin(params: UpdateIsolatedMarginRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Add or remove isolated margin (updateIsolatedMargin).
ntli is a 6-decimal integer. 1000000 is 1 USD.
Parameters
| Parameter | Type |
|---|---|
params | UpdateIsolatedMarginRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
updateLeverage()
updateLeverage(params: UpdateLeverageRequest, options?: L1ActionOptions): Promise<ExchangeResponse>;Set cross or isolated leverage for one asset (updateLeverage).
Parameters
| Parameter | Type |
|---|---|
params | UpdateLeverageRequest |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
updateValidatorL1Stream()
updateValidatorL1Stream(params: object, options?: L1ActionOptions): Promise<ExchangeResponse>;Vote the risk-free rate for an aligned quote asset (validatorL1Stream).
riskFreeRate is a decimal string such as "0.04" for 4%.
Parameters
| Parameter | Type |
|---|---|
params | { riskFreeRate: string; } |
params.riskFreeRate | string |
options? | L1ActionOptions |
Returns
Promise<ExchangeResponse>
withdrawFromStaking()
withdrawFromStaking(params: object, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Move native token from staking back to spot (cWithdraw).
The transfer waits in a 7-day unstaking queue.
Parameters
| Parameter | Type |
|---|---|
params | { wei: number; } |
params.wei | number |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>
withdrawUsd()
withdrawUsd(params: SendUsdRequest, options?: UserSignedActionOptions): Promise<ExchangeResponse>;Start a USDC withdrawal to the bridge (withdraw3).
Parameters
| Parameter | Type |
|---|---|
params | SendUsdRequest |
options? | UserSignedActionOptions |
Returns
Promise<ExchangeResponse>