@nktkas/hyperliquid
Version:
Unofficial Hyperliquid API SDK for all major JS runtimes, written in TypeScript and provided with tests
1,140 lines • 48.5 kB
TypeScript
import type { Hex } from "../base.js";
import type { IRequestTransport } from "../transports/base.js";
import type { BaseExchangeRequest } from "../types/exchange/requests.js";
import type { CreateSubAccountResponse, CreateVaultResponse, SuccessResponse } from "../types/exchange/responses.js";
import { type AbstractEthersSigner, type AbstractEthersV5Signer, type AbstractViemWalletClient, type AbstractWallet, type AbstractWindowEthereum, type Signature, userSignedActionEip712Types } from "../signing/mod.js";
import { type CancelResponseSuccess, type CSignerActionParameters_JailSelf, type CSignerActionParameters_UnjailSelf, type CValidatorActionParameters_ChangeProfile, type CValidatorActionParameters_Register, type CValidatorActionParameters_Unregister, ExchangeClient, type ExchangeClientParameters, type OrderResponseSuccess, type PerpDeployParameters_RegisterAsset, type PerpDeployParameters_SetOracle, type ScheduleCancelParameters, type SpotDeployParameters_Genesis, type SpotDeployParameters_RegisterHyperliquidity, type SpotDeployParameters_RegisterSpot, type SpotDeployParameters_RegisterToken2, type SpotDeployParameters_SetDeployerTradingFeeShare, type SpotDeployParameters_UserGenesis, type TwapCancelResponseSuccess, type TwapOrderResponseSuccess } from "./exchange.js";
/** Parameters for the {@linkcode MultiSignClient} constructor. */
export interface MultiSignClientParameters<T extends IRequestTransport = IRequestTransport, S extends readonly [AbstractWalletWithAddress, ...AbstractWallet[]] = [
AbstractWalletWithAddress,
...AbstractWallet[]
]> extends Omit<ExchangeClientParameters<T, S[0]>, "wallet"> {
/** The multi-signature account address. */
multiSignAddress: Hex;
/** Array of wallets used for multi-signature operations. The first wallet acts as the leader. */
signers: S;
}
/** Abstract interface for a wallet that can sign typed data and has wallet address. */
export type AbstractWalletWithAddress = Hex | AbstractViemWalletClientWithAddress | AbstractEthersSignerWithAddress | AbstractEthersV5SignerWithAddress | AbstractWindowEthereum;
/** Abstract interface for a [viem wallet](https://viem.sh/docs/clients/wallet) with wallet address. */
export interface AbstractViemWalletClientWithAddress extends AbstractViemWalletClient {
address: Hex;
}
/** Abstract interface for an [ethers.js signer](https://docs.ethers.org/v6/api/providers/#Signer) with wallet address. */
export interface AbstractEthersSignerWithAddress extends AbstractEthersSigner {
getAddress(): Promise<string>;
}
/** Abstract interface for an [ethers.js v5 signer](https://docs.ethers.org/v5/api/signer/) with wallet address. */
export interface AbstractEthersV5SignerWithAddress extends AbstractEthersV5Signer {
getAddress(): Promise<string>;
}
/**
* Multi-signature exchange client for interacting with the Hyperliquid API.
* @typeParam T The transport used to connect to the Hyperliquid API.
* @typeParam S Array of wallets where the first wallet acts as the leader.
*/
export declare class MultiSignClient<T extends IRequestTransport = IRequestTransport, S extends readonly [AbstractWalletWithAddress, ...AbstractWallet[]] = [
AbstractWalletWithAddress,
...AbstractWallet[]
]> extends ExchangeClient<T, S[0]> implements MultiSignClientParameters<T, S> {
multiSignAddress: Hex;
signers: S;
/**
* @multisign Is the first wallet from {@linkcode signers}.
*/
wallet: S[0];
/**
* Initialises a new multi-signature client instance.
* @param args - The parameters for the multi-signature client.
*
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport();
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
* ```
*/
constructor(args: MultiSignClientParameters<T, S>);
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.approveAgent({ agentAddress: "0x...", agentName: "agentName" });
* ```
*/
approveAgent(...[args, signal]: Parameters<ExchangeClient["approveAgent"]>): ReturnType<ExchangeClient["approveAgent"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
* ```
*/
approveBuilderFee(...[args, signal]: Parameters<ExchangeClient["approveBuilderFee"]>): ReturnType<ExchangeClient["approveBuilderFee"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link OrderResponse} without error statuses.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.batchModify({
* modifies: [{
* oid: 123,
* order: {
* a: 0, // Asset index
* b: true, // Buy order
* p: "31000", // New price
* s: "0.2", // New size
* r: false, // Not reduce-only
* t: {
* limit: {
* tif: "Gtc", // Good-til-cancelled
* },
* },
* c: "0x...", // Client Order ID (optional)
* },
* }],
* });
* ```
*/
batchModify(...[args, signal]: Parameters<ExchangeClient["batchModify"]>): ReturnType<ExchangeClient["batchModify"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link CancelResponse} without error statuses.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.cancel({
* cancels: [{
* a: 0, // Asset index
* o: 123, // Order ID
* }],
* });
* ```
*/
cancel(...[args, signal]: Parameters<ExchangeClient["cancel"]>): ReturnType<ExchangeClient["cancel"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link CancelResponse} without error statuses.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.cancelByCloid({
* cancels: [
* { asset: 0, cloid: "0x..." },
* ],
* });
* ```
*/
cancelByCloid(...[args, signal]: Parameters<ExchangeClient["cancelByCloid"]>): ReturnType<ExchangeClient["cancelByCloid"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.cDeposit({ wei: 1 * 1e8 });
* ```
*/
cDeposit(...[args, signal]: Parameters<ExchangeClient["cDeposit"]>): ReturnType<ExchangeClient["cDeposit"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.claimRewards();
* ```
*/
claimRewards(...[signal]: Parameters<ExchangeClient["claimRewards"]>): ReturnType<ExchangeClient["claimRewards"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.convertToMultiSigUser({ // convert to normal user
* authorizedUsers: [],
* threshold: 0,
* });
* ```
*/
convertToMultiSigUser(...[args, signal]: Parameters<ExchangeClient["convertToMultiSigUser"]>): ReturnType<ExchangeClient["convertToMultiSigUser"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Response for creating a sub-account.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.createSubAccount({ name: "subAccountName" });
* ```
*/
createSubAccount(...[args, signal]: Parameters<ExchangeClient["createSubAccount"]>): ReturnType<ExchangeClient["createSubAccount"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Response for creating a vault.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.createVault({
* name: "VaultName",
* description: "Vault description",
* initialUsd: 100 * 1e6,
* });
* ```
*/
createVault(...[args, signal]: Parameters<ExchangeClient["createVault"]>): ReturnType<ExchangeClient["createVault"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* // Jail self
* const data = await multiSignClient.cSignerAction({ jailSelf: null });
*
* // Unjail self
* const data = await multiSignClient.cSignerAction({ unjailSelf: null });
* ```
*/
cSignerAction(args: CSignerActionParameters_JailSelf, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
cSignerAction(args: CSignerActionParameters_UnjailSelf, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* // Change validator profile
* const data = await multiSignClient.cValidatorAction({
* changeProfile: {
* name: "My Validator",
* description: "Validator description",
* unjailed: true,
* }
* });
* ```
*/
cValidatorAction(args: CValidatorActionParameters_ChangeProfile, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
cValidatorAction(args: CValidatorActionParameters_Register, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
cValidatorAction(args: CValidatorActionParameters_Unregister, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.cWithdraw({ wei: 1 * 1e8 });
* ```
*/
cWithdraw(...[args, signal]: Parameters<ExchangeClient["cWithdraw"]>): ReturnType<ExchangeClient["cWithdraw"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Response for creating a sub-account.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/evm/dual-block-architecture
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.evmUserModify({ usingBigBlocks: true });
* ```
*/
evmUserModify(...[args, signal]: Parameters<ExchangeClient["evmUserModify"]>): ReturnType<ExchangeClient["evmUserModify"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.modify({
* oid: 123,
* order: {
* a: 0, // Asset index
* b: true, // Buy order
* p: "31000", // New price
* s: "0.2", // New size
* r: false, // Not reduce-only
* t: {
* limit: {
* tif: "Gtc", // Good-til-cancelled
* },
* },
* c: "0x...", // Client Order ID (optional)
* },
* });
* ```
*/
modify(...[args, signal]: Parameters<ExchangeClient["modify"]>): ReturnType<ExchangeClient["modify"]>;
/**
* @multisign Not implemented
*/
multiSig<T extends SuccessResponse | CancelResponseSuccess | CreateSubAccountResponse | CreateVaultResponse | OrderResponseSuccess | TwapOrderResponseSuccess | TwapCancelResponseSuccess>(...[_args, _signal]: Parameters<ExchangeClient["multiSig"]>): Promise<T>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link OrderResponse} without error statuses.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.order({
* orders: [{
* a: 0, // Asset index
* b: true, // Buy order
* p: "30000", // Price
* s: "0.1", // Size
* r: false, // Not reduce-only
* t: {
* limit: {
* tif: "Gtc", // Good-til-cancelled
* },
* },
* c: "0x...", // Client Order ID (optional)
* }],
* grouping: "na", // No grouping
* });
* ```
*/
order(...[args, signal]: Parameters<ExchangeClient["order"]>): ReturnType<ExchangeClient["order"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.perpDeploy({
* registerAsset: {
* maxGas: 1000000,
* assetRequest: {
* coin: "USDC",
* szDecimals: 8,
* oraclePx: "1",
* marginTableId: 1,
* onlyIsolated: false,
* },
* dex: "test",
* },
* });
* ```
*/
perpDeploy(args: PerpDeployParameters_RegisterAsset, signal?: AbortSignal): ReturnType<ExchangeClient["perpDeploy"]>;
perpDeploy(args: PerpDeployParameters_SetOracle, signal?: AbortSignal): ReturnType<ExchangeClient["perpDeploy"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.perpDexClassTransfer({
* dex: "test",
* token: "USDC",
* amount: "1",
* toPerp: true,
* });
* ```
*/
perpDexClassTransfer(...[args, signal]: Parameters<ExchangeClient["perpDexClassTransfer"]>): ReturnType<ExchangeClient["perpDexClassTransfer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.registerReferrer({ code: "TEST" });
* ```
*/
registerReferrer(...[args, signal]: Parameters<ExchangeClient["registerReferrer"]>): ReturnType<ExchangeClient["registerReferrer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.reserveRequestWeight({ weight: 10 });
* ```
*/
reserveRequestWeight(...[args, signal]: Parameters<ExchangeClient["reserveRequestWeight"]>): ReturnType<ExchangeClient["reserveRequestWeight"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.scheduleCancel({ time: Date.now() + 3600000 });
* ```
*/
scheduleCancel(args?: ScheduleCancelParameters, signal?: AbortSignal): ReturnType<ExchangeClient["scheduleCancel"]>;
scheduleCancel(signal?: AbortSignal): ReturnType<ExchangeClient["scheduleCancel"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.setDisplayName({ displayName: "My Name" });
* ```
*/
setDisplayName(...[args, signal]: Parameters<ExchangeClient["setDisplayName"]>): ReturnType<ExchangeClient["setDisplayName"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.setReferrer({ code: "TEST" });
* ```
*/
setReferrer(...[args, signal]: Parameters<ExchangeClient["setReferrer"]>): ReturnType<ExchangeClient["setReferrer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.spotDeploy({
* registerToken2: {
* spec: {
* name: "USDC",
* szDecimals: 8,
* weiDecimals: 8,
* },
* maxGas: 1000000,
* fullName: "USD Coin",
* },
* });
* ```
*/
spotDeploy(args: SpotDeployParameters_Genesis, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
spotDeploy(args: SpotDeployParameters_RegisterHyperliquidity, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
spotDeploy(args: SpotDeployParameters_RegisterSpot, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
spotDeploy(args: SpotDeployParameters_RegisterToken2, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
spotDeploy(args: SpotDeployParameters_SetDeployerTradingFeeShare, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
spotDeploy(args: SpotDeployParameters_UserGenesis, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.spotSend({
* destination: "0x...",
* token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
* amount: "1",
* });
* ```
*/
spotSend(...[args, signal]: Parameters<ExchangeClient["spotSend"]>): ReturnType<ExchangeClient["spotSend"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.spotUser({ toggleSpotDusting: { optOut: false } });
* ```
*/
spotUser(...[args, signal]: Parameters<ExchangeClient["spotUser"]>): ReturnType<ExchangeClient["spotUser"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.subAccountSpotTransfer({
* subAccountUser: "0x...",
* isDeposit: true,
* token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
* amount: "1",
* });
* ```
*/
subAccountSpotTransfer(...[args, signal]: Parameters<ExchangeClient["subAccountSpotTransfer"]>): ReturnType<ExchangeClient["subAccountSpotTransfer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.subAccountTransfer({
* subAccountUser: "0x...",
* isDeposit: true,
* usd: 1 * 1e6,
* });
* ```
*/
subAccountTransfer(...[args, signal]: Parameters<ExchangeClient["subAccountTransfer"]>): ReturnType<ExchangeClient["subAccountTransfer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.tokenDelegate({
* validator: "0x...",
* isUndelegate: true,
* wei: 1 * 1e8,
* });
* ```
*/
tokenDelegate(...[args, signal]: Parameters<ExchangeClient["tokenDelegate"]>): ReturnType<ExchangeClient["tokenDelegate"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link TwapCancelResponse} without error status.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.twapCancel({
* a: 0, // Asset index
* t: 1, // TWAP ID
* });
* ```
*/
twapCancel(...[args, signal]: Parameters<ExchangeClient["twapCancel"]>): ReturnType<ExchangeClient["twapCancel"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful variant of {@link TwapOrderResponse} without error status.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.twapOrder({
* a: 0, // Asset index
* b: true, // Buy order
* s: "1", // Size
* r: false, // Not reduce-only
* m: 10, // Duration in minutes
* t: true, // Randomize order timing
* });
* ```
*/
twapOrder(...[args, signal]: Parameters<ExchangeClient["twapOrder"]>): ReturnType<ExchangeClient["twapOrder"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.updateIsolatedMargin({
* asset: 0,
* isBuy: true,
* ntli: 1 * 1e6,
* });
* ```
*/
updateIsolatedMargin(...[args, signal]: Parameters<ExchangeClient["updateIsolatedMargin"]>): ReturnType<ExchangeClient["updateIsolatedMargin"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.updateLeverage({
* asset: 0,
* isCross: true,
* leverage: 5,
* });
* ```
*/
updateLeverage(...[args, signal]: Parameters<ExchangeClient["updateLeverage"]>): ReturnType<ExchangeClient["updateLeverage"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.usdClassTransfer({ amount: "1", toPerp: true });
* ```
*/
usdClassTransfer(...[args, signal]: Parameters<ExchangeClient["usdClassTransfer"]>): ReturnType<ExchangeClient["usdClassTransfer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.usdSend({ destination: "0x...", amount: "1" });
* ```
*/
usdSend(...[args, signal]: Parameters<ExchangeClient["usdSend"]>): ReturnType<ExchangeClient["usdSend"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
* ```
*/
vaultDistribute(...[args, signal]: Parameters<ExchangeClient["vaultDistribute"]>): ReturnType<ExchangeClient["vaultDistribute"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see null - no documentation
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.vaultModify({
* vaultAddress: "0x...",
* allowDeposits: true,
* alwaysCloseOnWithdraw: false,
* });
* ```
*/
vaultModify(...[args, signal]: Parameters<ExchangeClient["vaultModify"]>): ReturnType<ExchangeClient["vaultModify"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.vaultTransfer({
* vaultAddress: "0x...",
* isDeposit: true,
* usd: 10 * 1e6,
* });
* ```
*/
vaultTransfer(...[args, signal]: Parameters<ExchangeClient["vaultTransfer"]>): ReturnType<ExchangeClient["vaultTransfer"]>;
/**
* @param args - The parameters for the request.
* @param signal - An optional abort signal.
* @returns Successful response without specific data.
* @throws {ApiRequestError} When the API returns an error response.
*
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
* @example
* ```ts
* import * as hl from "@nktkas/hyperliquid";
*
* const multiSignAddress = "0x...";
* const signers = [
* "0x...", // Private key; or any other wallet libraries
* ] as const;
*
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
*
* const data = await multiSignClient.withdraw3({ destination: "0x...", amount: "1" });
* ```
*/
withdraw3(...[args, signal]: Parameters<ExchangeClient["withdraw3"]>): ReturnType<ExchangeClient["withdraw3"]>;
/** Extracts the wallet address from different wallet types. */
protected _getWalletAddress(wallet: AbstractWalletWithAddress): Promise<`0x${string}`>;
/** Signs L1 action with all signers for multi-signature operations. */
protected _multiSignL1Action(args: {
action: BaseExchangeRequest["action"];
nonce: number;
outerSigner: Hex;
vaultAddress?: Hex;
expiresAfter?: number;
}): Promise<Signature[]>;
/** Signs user-signed action with all signers for multi-signature operations. */
protected _multiSignUserSignedAction(action: BaseExchangeRequest["action"] & {
type: keyof typeof userSignedActionEip712Types;
signatureChainId: string;
} & ({
nonce: number;
time?: undefined;
} | {
time: number;
nonce?: undefined;
}), outerSigner: Hex): Promise<Signature[]>;
}
//# sourceMappingURL=multiSign.d.ts.map