ault-sdk-ts 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { type RestContext } from "./context";
2
2
  import type { PaginationParams } from "./types";
3
+ import { type MarketId } from "../utils/opaque-id";
3
4
  import { QueryOrderResponse, QueryOrdersResponse, QueryParamsResponse, QueryTwapOrdersResponse } from "../proto/gen/ault/clob/v1/query";
4
5
  import { ConditionalOrder as ConditionalOrderProto } from "../proto/gen/ault/clob/v1/conditional";
5
6
  import { MsgPlaceLimitOrder, MsgPlaceMarketOrder } from "../proto/gen/ault/clob/v1/tx";
@@ -36,7 +37,8 @@ export interface ClobApi {
36
37
  */
37
38
  getOrderByCloid: (orderer: string, cloid: Uint8Array) => Promise<OrderResponse>;
38
39
  getOrders: (params?: {
39
- marketId?: Uint8Array | string;
40
+ /** Bytes, a `MarketId`, or a hex (optionally 0x-prefixed) or base64 string. */
41
+ marketId?: Uint8Array | MarketId | string;
40
42
  pagination?: PaginationParams;
41
43
  }) => Promise<QueryOrdersResponse>;
42
44
  /**
@@ -1,8 +1,8 @@
1
1
  import { type RestContext } from "./context";
2
- import { MarketId } from "../utils/opaque-id";
2
+ import type { MarketId } from "../utils/opaque-id";
3
3
  import type { PaginationParams } from "./types";
4
4
  import { QueryEnabledMarketsResponse, QueryMarginAccountResponse, QueryMarginOrdersResponse, QueryParamsResponse } from "../proto/gen/ault/margin/v1/query";
5
- /** A market id as raw bytes, a `MarketId`, or a base64 string (grpc-gateway form). */
5
+ /** A market id as raw bytes, a `MarketId`, or a hex (optionally 0x-prefixed) or base64 string. */
6
6
  export type MarginQueryMarketId = Uint8Array | MarketId | string;
7
7
  /**
8
8
  * Chain-side `x/margin` queries. The margin Lending pool id is not a query
@@ -0,0 +1,13 @@
1
+ import { MarketId } from "../utils/opaque-id";
2
+ /**
3
+ * Encodes a market id for a chain REST (grpc-gateway) request, which takes
4
+ * `bytes` params as base64. A string matching the hex pattern is decoded as
5
+ * hex, the form the dex-api returns; any other string is passed through as
6
+ * base64. No real market id has a base64 form that matches the pattern: the
7
+ * id starts with a 0x01/0x02 type byte and an ASCII denom, which puts a
8
+ * character from Q-X or g-n second, and `0x` never occurs in base64.
9
+ *
10
+ * Market ids only. Order ids keep their own rule in `clob.ts`, since the
11
+ * base64 of an order id can be all hex characters.
12
+ */
13
+ export declare function marketIdToBase64(marketId: Uint8Array | MarketId | string): string;
@@ -1,11 +1,13 @@
1
1
  import { type RestContext } from "./context";
2
2
  import type { PaginationParams } from "./types";
3
+ import type { MarketId } from "../utils/opaque-id";
3
4
  import { QueryMarketResponse, QueryMarketsResponse, QueryParamsResponse } from "../proto/gen/ault/market/v1/query";
4
5
  export interface MarketApi {
5
6
  getParams: () => Promise<QueryParamsResponse>;
6
7
  getMarkets: (params?: {
7
8
  pagination?: PaginationParams;
8
9
  }) => Promise<QueryMarketsResponse>;
9
- getMarket: (marketId: Uint8Array | string) => Promise<QueryMarketResponse>;
10
+ /** `marketId` is bytes, a `MarketId`, or a hex (optionally 0x-prefixed) or base64 string. */
11
+ getMarket: (marketId: Uint8Array | MarketId | string) => Promise<QueryMarketResponse>;
10
12
  }
11
13
  export declare function createMarketApi(context: RestContext): MarketApi;
@@ -1,7 +1,10 @@
1
1
  import { type RestContext } from "./context";
2
- import { MarketId } from "../utils/opaque-id";
2
+ import type { MarketId } from "../utils/opaque-id";
3
3
  import { QueryAccountResponse, QueryAccountRiskResponse, QueryCollateralDenomResponse, QueryFundingResponse, QueryImpactPricesResponse, QueryParamsResponse, QueryPositionResponse, QueryPricesResponse } from "../proto/gen/ault/perpetual/v1/query";
4
- /** A perpetual market id as raw bytes, a `MarketId`, or a base64 string (grpc-gateway form). */
4
+ /**
5
+ * A perpetual market id as raw bytes, a `MarketId`, or a hex (optionally
6
+ * 0x-prefixed) or base64 string.
7
+ */
5
8
  export type PerpetualMarketIdInput = Uint8Array | MarketId | string;
6
9
  /**
7
10
  * Chain-side `x/perpetual` queries.
@@ -1,5 +1,6 @@
1
1
  import { type RestContext } from "./context";
2
2
  import type { PaginationParams } from "./types";
3
+ import type { MarketId } from "../utils/opaque-id";
3
4
  import { QueryBuilderAllowancesResponse, QueryDeployerShareResponse, QueryEligibleReferrersResponse, QueryParamsResponse, QueryReferralCodeResponse, QueryReferrerResponse } from "../proto/gen/ault/reward/v1/query";
4
5
  export type RewardReferrerParams = {
5
6
  code: string;
@@ -15,7 +16,8 @@ export interface RewardApi {
15
16
  getEligibleReferrers: (params?: {
16
17
  pagination?: PaginationParams;
17
18
  }) => Promise<QueryEligibleReferrersResponse>;
18
- getDeployerShare: (marketId: Uint8Array | string) => Promise<QueryDeployerShareResponse>;
19
+ /** `marketId` is bytes, a `MarketId`, or a hex (optionally 0x-prefixed) or base64 string. */
20
+ getDeployerShare: (marketId: Uint8Array | MarketId | string) => Promise<QueryDeployerShareResponse>;
19
21
  getBuilderAllowances: (params?: {
20
22
  user?: string;
21
23
  builder?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ault-sdk-ts",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "TypeScript SDK for the Ault blockchain with high-level transaction methods and REST query clients",
5
5
  "keywords": [
6
6
  "ault",