@bulletxyz/bullet-sdk 0.21.0-rc.7 → 0.22.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +124 -70
- package/dist/browser/index.js.map +3 -3
- package/dist/node/index.js +124 -70
- package/dist/node/index.js.map +3 -3
- package/dist/types/client.d.ts +4 -1
- package/dist/types/connection.d.ts +1 -1
- package/dist/types/constants.d.ts +5 -4
- package/dist/types/exchange.d.ts +7 -2
- package/dist/types/utils.d.ts +6 -0
- package/package.json +1 -1
package/dist/types/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Transaction, type TransactionResult } from "@sovereign-sdk/web3";
|
|
2
2
|
import type Decimal from "decimal.js";
|
|
3
3
|
import { Connection } from "./connection";
|
|
4
|
+
import { Endpoints } from "./constants";
|
|
4
5
|
import { ExchangeConnection } from "./exchange";
|
|
5
6
|
import type { RuntimeCall } from "./rollupTypes";
|
|
6
7
|
import { type Address, type Asset, type MarkPriceUpdateArgs, type Network, type OraclePriceUpdateArgs, type PlaceOrderArgs, type TokenId, type TpslOrder } from "./types";
|
|
@@ -20,7 +21,9 @@ export declare class Client {
|
|
|
20
21
|
private queue;
|
|
21
22
|
private generationOverride;
|
|
22
23
|
private constructor();
|
|
23
|
-
static
|
|
24
|
+
static fromEndpoints(endpoints: Endpoints, wallet: Wallet, txOpts?: TransactionOpts): Promise<Client>;
|
|
25
|
+
static fromNetwork(network: Network, wallet: Wallet, txOpts?: TransactionOpts): Promise<Client>;
|
|
26
|
+
static fromRestUrl(restUrl: string, wallet: Wallet, txOpts?: TransactionOpts): Promise<Client>;
|
|
24
27
|
setGenerationOverride(generation: (() => number) | undefined): void;
|
|
25
28
|
getNonce(): Promise<import("@sovereign-sdk/web3").Dedup>;
|
|
26
29
|
getTokenBalance(tokenId: string): Promise<bigint>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address, TokenId } from "./types";
|
|
2
2
|
export declare class BaseConnection {
|
|
3
3
|
endpoint: string;
|
|
4
|
-
constructor(rawEndpoint
|
|
4
|
+
constructor(rawEndpoint: string);
|
|
5
5
|
protected fetchApiResource<T>(path: string, params?: Record<string, string | undefined>): Promise<T>;
|
|
6
6
|
protected fetchBulkApiResource<T>(path: string, body: Record<string, unknown>, params?: Record<string, string>): Promise<T>;
|
|
7
7
|
}
|
|
@@ -19,8 +19,9 @@ export declare const TOKEN_ADDRESSES: {
|
|
|
19
19
|
readonly TIA: "token_185jxgchq6kpxskn4eggjfeju3t4sjxxfxj5mx9dn6wgydud7mtys4glllf";
|
|
20
20
|
readonly ZEX: "token_1g3hhmzp0c358t0s2dxht8jqqrfnnrgerk423mgs4cxd96u8ux24stetj0c";
|
|
21
21
|
};
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
22
|
+
export interface Endpoints {
|
|
23
|
+
rest: string;
|
|
24
|
+
ws?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const NETWORKS: Record<Network, Endpoints>;
|
|
26
27
|
export declare const GLOBAL_DEFAULT_MAX_LEVERAGE = 1000;
|
package/dist/types/exchange.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { BaseConnection } from "./connection";
|
|
2
|
+
import { Endpoints } from "./constants";
|
|
2
3
|
import type { Orderbook } from "./orderbook";
|
|
3
4
|
import type { Address, Asset, AssetId, Network } from "./types";
|
|
4
5
|
import { AccountAddresses, type BorrowLendMarket, type MarginConfig, type OraclePrices, type Order, type OrderbookL2, type PerpMarket, type PerpPrices, type UsdcInsuranceFund, type UsdcPnlPool, type UserAccount } from "./zod-types/rest";
|
|
5
6
|
export declare class ExchangeConnection extends BaseConnection {
|
|
6
|
-
private wsManager
|
|
7
|
-
constructor(
|
|
7
|
+
private wsManager?;
|
|
8
|
+
private constructor();
|
|
9
|
+
static fromEndpoints(endpoints: Endpoints): ExchangeConnection;
|
|
10
|
+
static fromNetwork(network: Network): ExchangeConnection;
|
|
11
|
+
static fromRestUrl(restUrl: string): ExchangeConnection;
|
|
8
12
|
getValue(): Promise<number | null>;
|
|
9
13
|
getOrder(order_id: bigint): Promise<Order | null>;
|
|
10
14
|
getOrderbookL2(asset: Asset, levels?: number): Promise<OrderbookL2>;
|
|
@@ -23,6 +27,7 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
23
27
|
getMarginConfig(): Promise<MarginConfig | null>;
|
|
24
28
|
getPerpAssets(): Promise<Map<Asset, string>>;
|
|
25
29
|
getBorrowLendAssets(): Promise<Map<Asset, string>>;
|
|
30
|
+
private getWebSocketManager;
|
|
26
31
|
subscribeOrderbook(assetId: AssetId): AsyncIterable<Orderbook>;
|
|
27
32
|
unsubscribeOrderbook(assetId: AssetId): Promise<void>;
|
|
28
33
|
}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Network } from "./types";
|
|
2
|
+
import { Endpoints } from "./constants";
|
|
1
3
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
2
4
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
3
5
|
export declare function hexToBase64(hex: string): string;
|
|
@@ -7,3 +9,7 @@ export declare function base58ToHex(base58: string): string;
|
|
|
7
9
|
export declare function sleep(ms: number): Promise<void>;
|
|
8
10
|
export declare function isNode(): boolean;
|
|
9
11
|
export declare function serialize<T>(value: T): T;
|
|
12
|
+
export declare const isNetwork: (value: string) => value is Network;
|
|
13
|
+
export declare const isValidHttpUrl: (url: string) => boolean;
|
|
14
|
+
export declare const isValidWsUrl: (url: string) => boolean;
|
|
15
|
+
export declare const validateEndpoints: (endpoints: Endpoints) => void;
|