🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@ambitlabs/hyperliquid-sdk

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ambitlabs/hyperliquid-sdk - npm Package Compare versions

Comparing version

to
0.0.1-beta9

12

dist/cjs/HyperliquidSDK.d.ts

@@ -1,2 +0,2 @@

import { Wallet } from 'ethers';
import { Signer as EthersSigner } from 'ethers';
import { ExchangeEndpoint, HyperliquidAction, SpotDeployAction } from './ExchangeEndpoint';

@@ -21,3 +21,3 @@ import { AllMidsResponse, ClearingHouseStateResponse, InfoEndpoint, SpotMetaResponse, VaultDetailsResponse } from './InfoEndpoint';

vault: string;
user?: string;
user: string;
};

@@ -47,6 +47,6 @@ type RegisterToken2Options = Extract<SpotDeployAction, {

readonly environment: HyperliquidEnvironment;
readonly wallet?: Wallet | undefined;
readonly signer?: EthersSigner | undefined;
readonly exchange: ExchangeEndpoint | undefined;
readonly info: InfoEndpoint;
constructor(environment: HyperliquidEnvironment, wallet?: Wallet | undefined);
constructor(environment: HyperliquidEnvironment, signer?: EthersSigner | undefined);
fetchSpotMeta(): Promise<SpotMetaResponse>;

@@ -67,4 +67,4 @@ fetchSpotTokens(): Promise<Record<string, {

fetchMids(): Promise<AllMidsResponse>;
fetchClearinghouseState(user?: string | undefined): Promise<ClearingHouseStateResponse>;
fetchSpotClearinghouseState(user?: string | undefined): Promise<Record<string, {
fetchClearinghouseState(user: string): Promise<ClearingHouseStateResponse>;
fetchSpotClearinghouseState(user: string): Promise<Record<string, {
coin: string;

@@ -71,0 +71,0 @@ token: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HyperliquidSDK = void 0;
const ethers_1 = require("ethers");
const Signer_1 = require("./Signer");

@@ -11,10 +10,10 @@ const ExchangeEndpoint_1 = require("./ExchangeEndpoint");

environment;
wallet;
signer;
exchange;
info;
constructor(environment, wallet) {
constructor(environment, signer) {
this.environment = environment;
this.wallet = wallet;
this.signer = signer;
const endpoint = constants_1.HYPERLIQUID_API_URL[this.environment];
this.exchange = wallet ? new ExchangeEndpoint_1.ExchangeEndpoint(new Signer_1.Signer(wallet, environment), environment, endpoint) : undefined;
this.exchange = signer ? new ExchangeEndpoint_1.ExchangeEndpoint(new Signer_1.Signer(signer, environment), environment, endpoint) : undefined;
this.info = new InfoEndpoint_1.InfoEndpoint(endpoint);

@@ -37,13 +36,13 @@ }

}
async fetchClearinghouseState(user = undefined) {
async fetchClearinghouseState(user) {
const response = await this.info.fetch({
type: 'clearinghouseState',
user: user ?? (this.wallet ? this.wallet.address : ethers_1.ZeroAddress),
user,
});
return response;
}
async fetchSpotClearinghouseState(user = undefined) {
async fetchSpotClearinghouseState(user) {
const response = await this.info.fetch({
type: 'spotClearinghouseState',
user: user ?? (this.wallet ? this.wallet.address : ethers_1.ZeroAddress),
user,
});

@@ -61,3 +60,3 @@ return response.balances.reduce((previous, current) => {

vaultAddress: options.vault,
user: options.user ?? (this.wallet ? this.wallet.address : ethers_1.ZeroAddress),
user: options.user,
});

@@ -64,0 +63,0 @@ }

@@ -1,2 +0,2 @@

import { Wallet } from 'ethers';
import { Signer as EthersSigner } from 'ethers';
import { ExchangeEndpoint, HyperliquidAction, SpotDeployAction } from './ExchangeEndpoint';

@@ -21,3 +21,3 @@ import { AllMidsResponse, ClearingHouseStateResponse, InfoEndpoint, SpotMetaResponse, VaultDetailsResponse } from './InfoEndpoint';

vault: string;
user?: string;
user: string;
};

@@ -47,6 +47,6 @@ type RegisterToken2Options = Extract<SpotDeployAction, {

readonly environment: HyperliquidEnvironment;
readonly wallet?: Wallet | undefined;
readonly signer?: EthersSigner | undefined;
readonly exchange: ExchangeEndpoint | undefined;
readonly info: InfoEndpoint;
constructor(environment: HyperliquidEnvironment, wallet?: Wallet | undefined);
constructor(environment: HyperliquidEnvironment, signer?: EthersSigner | undefined);
fetchSpotMeta(): Promise<SpotMetaResponse>;

@@ -67,4 +67,4 @@ fetchSpotTokens(): Promise<Record<string, {

fetchMids(): Promise<AllMidsResponse>;
fetchClearinghouseState(user?: string | undefined): Promise<ClearingHouseStateResponse>;
fetchSpotClearinghouseState(user?: string | undefined): Promise<Record<string, {
fetchClearinghouseState(user: string): Promise<ClearingHouseStateResponse>;
fetchSpotClearinghouseState(user: string): Promise<Record<string, {
coin: string;

@@ -71,0 +71,0 @@ token: number;

@@ -1,2 +0,1 @@

import { ZeroAddress } from 'ethers';
import { Signer } from './Signer';

@@ -8,10 +7,10 @@ import { ExchangeEndpoint, } from './ExchangeEndpoint';

environment;
wallet;
signer;
exchange;
info;
constructor(environment, wallet) {
constructor(environment, signer) {
this.environment = environment;
this.wallet = wallet;
this.signer = signer;
const endpoint = HYPERLIQUID_API_URL[this.environment];
this.exchange = wallet ? new ExchangeEndpoint(new Signer(wallet, environment), environment, endpoint) : undefined;
this.exchange = signer ? new ExchangeEndpoint(new Signer(signer, environment), environment, endpoint) : undefined;
this.info = new InfoEndpoint(endpoint);

@@ -34,13 +33,13 @@ }

}
async fetchClearinghouseState(user = undefined) {
async fetchClearinghouseState(user) {
const response = await this.info.fetch({
type: 'clearinghouseState',
user: user ?? (this.wallet ? this.wallet.address : ZeroAddress),
user,
});
return response;
}
async fetchSpotClearinghouseState(user = undefined) {
async fetchSpotClearinghouseState(user) {
const response = await this.info.fetch({
type: 'spotClearinghouseState',
user: user ?? (this.wallet ? this.wallet.address : ZeroAddress),
user,
});

@@ -58,3 +57,3 @@ return response.balances.reduce((previous, current) => {

vaultAddress: options.vault,
user: options.user ?? (this.wallet ? this.wallet.address : ZeroAddress),
user: options.user,
});

@@ -61,0 +60,0 @@ }

{
"name": "@ambitlabs/hyperliquid-sdk",
"version": "0.0.1-beta8",
"version": "0.0.1-beta9",
"types": "./dist/esm/index.d.ts",

@@ -5,0 +5,0 @@ "module": "./dist/esm/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet