ault-sdk-ts 0.7.2 → 0.9.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.
Files changed (67) hide show
  1. package/README.md +104 -1
  2. package/dist/agent/sign-and-broadcast.d.ts +1 -1
  3. package/dist/agent/tx/perpetual.d.ts +10 -0
  4. package/dist/client.d.ts +2 -0
  5. package/dist/core/clob-msgs.d.ts +12 -3
  6. package/dist/core/manifest-types.d.ts +8 -0
  7. package/dist/core/network.d.ts +11 -7
  8. package/dist/core/perpetual-gas.d.ts +12 -0
  9. package/dist/core/perpetual-msgs.d.ts +60 -0
  10. package/dist/eip712/msg-encoders.generated.d.ts +8 -0
  11. package/dist/eip712/msg.generated.d.ts +76 -6
  12. package/dist/eip712/registry.d.ts +11 -0
  13. package/dist/eip712/types.d.ts +5 -0
  14. package/dist/high-level/tx/perpetual.d.ts +3 -0
  15. package/dist/high-level/types.d.ts +83 -4
  16. package/dist/index.cjs +24916 -9691
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.js +25243 -10290
  20. package/dist/index.js.map +1 -1
  21. package/dist/perp/decimal.d.ts +39 -0
  22. package/dist/perp/funding.d.ts +18 -0
  23. package/dist/perp/index.d.ts +5 -0
  24. package/dist/perp/margin.d.ts +33 -0
  25. package/dist/perp/orders.d.ts +27 -0
  26. package/dist/perp/position.d.ts +29 -0
  27. package/dist/proto/gen/ault/accountx/v1/query.d.ts +10 -1
  28. package/dist/proto/gen/ault/authority/v1/authority.d.ts +2 -0
  29. package/dist/proto/gen/ault/clob/v1/genesis.d.ts +7 -0
  30. package/dist/proto/gen/ault/clob/v1/twap.d.ts +11 -8
  31. package/dist/proto/gen/ault/clob/v1/tx.d.ts +11 -1
  32. package/dist/proto/gen/ault/common/v1/system.d.ts +31 -0
  33. package/dist/proto/gen/ault/lending/v1/genesis.d.ts +34 -0
  34. package/dist/proto/gen/ault/lending/v1/lending.d.ts +152 -0
  35. package/dist/proto/gen/ault/lending/v1/params.d.ts +42 -0
  36. package/dist/proto/gen/ault/lending/v1/query.d.ts +157 -0
  37. package/dist/proto/gen/ault/lending/v1/tx.d.ts +236 -0
  38. package/dist/proto/gen/ault/margin/v1/genesis.d.ts +102 -0
  39. package/dist/proto/gen/ault/margin/v1/margin.d.ts +130 -0
  40. package/dist/proto/gen/ault/margin/v1/params.d.ts +31 -0
  41. package/dist/proto/gen/ault/margin/v1/query.d.ts +127 -0
  42. package/dist/proto/gen/ault/margin/v1/tx.d.ts +181 -0
  43. package/dist/proto/gen/ault/market/v1/market.d.ts +9 -0
  44. package/dist/proto/gen/ault/market/v1/tx.d.ts +16 -0
  45. package/dist/proto/gen/ault/oracle/v1/genesis.d.ts +69 -0
  46. package/dist/proto/gen/ault/oracle/v1/oracle.d.ts +154 -0
  47. package/dist/proto/gen/ault/oracle/v1/query.d.ts +93 -0
  48. package/dist/proto/gen/ault/oracle/v1/tx.d.ts +151 -0
  49. package/dist/proto/gen/ault/perpetual/v1/genesis.d.ts +119 -0
  50. package/dist/proto/gen/ault/perpetual/v1/order.d.ts +46 -0
  51. package/dist/proto/gen/ault/perpetual/v1/params.d.ts +30 -0
  52. package/dist/proto/gen/ault/perpetual/v1/perpetual.d.ts +192 -0
  53. package/dist/proto/gen/ault/perpetual/v1/query.d.ts +150 -0
  54. package/dist/proto/gen/ault/perpetual/v1/tx.d.ts +97 -0
  55. package/dist/proto/gen/ault/systemtx/v1/genesis.d.ts +37 -0
  56. package/dist/proto/gen/ault/vault/v1/genesis.d.ts +90 -0
  57. package/dist/proto/gen/ault/vault/v1/params.d.ts +55 -0
  58. package/dist/proto/gen/ault/vault/v1/query.d.ts +152 -0
  59. package/dist/proto/gen/ault/vault/v1/tx.d.ts +194 -0
  60. package/dist/proto/gen/ault/vault/v1/vault.d.ts +227 -0
  61. package/dist/rest/dex-types.generated.d.ts +2104 -25
  62. package/dist/rest/dex.d.ts +18 -1
  63. package/dist/rest/dex.generated.d.ts +4336 -445
  64. package/dist/rest/perpetual.d.ts +46 -0
  65. package/dist/rest/tokenregistry.d.ts +7 -0
  66. package/dist/utils/cosmos-dec.d.ts +1 -0
  67. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ import { type RestContext } from "./context";
2
+ import { MarketId } from "../utils/opaque-id";
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). */
5
+ export type PerpetualMarketIdInput = Uint8Array | MarketId | string;
6
+ /**
7
+ * Chain-side `x/perpetual` queries.
8
+ */
9
+ export interface PerpetualApi {
10
+ getParams: () => Promise<QueryParamsResponse>;
11
+ /** The single collateral denom shared by every perpetual market. */
12
+ getCollateralDenom: () => Promise<QueryCollateralDenomResponse>;
13
+ /**
14
+ * The owner's derived perpetual account and its collateral share. Without
15
+ * `marketId` this is the cross account; with one, the isolated account for
16
+ * that market. Collateral is a LegacyDec string and can be negative.
17
+ */
18
+ getAccount: (owner: string, marketId?: PerpetualMarketIdInput) => Promise<QueryAccountResponse>;
19
+ /**
20
+ * The owner's position in a market. `cross` selects which account the
21
+ * position is looked up in, independently of the owner's current margin mode.
22
+ */
23
+ getPosition: (owner: string, marketId: PerpetualMarketIdInput, cross: boolean) => Promise<QueryPositionResponse>;
24
+ /**
25
+ * Equity, initial/maintenance margin, order margin, notional, available
26
+ * margin and the liquidatable flag for the cross account (no `marketId`) or
27
+ * an isolated account. This is the health snapshot the chain gates on.
28
+ */
29
+ getAccountRisk: (owner: string, marketId?: PerpetualMarketIdInput) => Promise<QueryAccountRiskResponse>;
30
+ /** A market's cumulative funding index and current sampling window. */
31
+ getFunding: (marketId: PerpetualMarketIdInput) => Promise<QueryFundingResponse>;
32
+ /**
33
+ * A market's index, internal and mark prices. Each one is absent until the
34
+ * chain has a value for it: `indexPrice` while no valid oracle price is
35
+ * available, `internalPrice` while the source session is open, `markPrice`
36
+ * before the first mark update.
37
+ */
38
+ getPrices: (marketId: PerpetualMarketIdInput) => Promise<QueryPricesResponse>;
39
+ /**
40
+ * The prices last recorded for executing the market's impact notional
41
+ * against each side of its book. A side the book could not fill is zero, as
42
+ * is a market whose impact prices were never recorded.
43
+ */
44
+ getImpactPrices: (marketId: PerpetualMarketIdInput) => Promise<QueryImpactPricesResponse>;
45
+ }
46
+ export declare function createPerpetualApi(context: RestContext): PerpetualApi;
@@ -1,9 +1,16 @@
1
1
  import { type RestContext } from "./context";
2
2
  import type { PaginationParams } from "./types";
3
3
  import { QueryParamsResponse, QueryTokenPairResponse, QueryTokenPairsResponse, QueryTransferLimitResponse } from "../proto/gen/ault/tokenregistry/v1/query";
4
+ /**
5
+ * Page size sent when the caller does not set `pagination.limit`. The chain
6
+ * returns 10 pairs per page otherwise, which silently drops the rest of the
7
+ * registry once it grows past that.
8
+ */
9
+ export declare const DEFAULT_TOKEN_PAIRS_LIMIT = 1000;
4
10
  export interface TokenRegistryApi {
5
11
  getParams: () => Promise<QueryParamsResponse>;
6
12
  getTokenPair: (token: string) => Promise<QueryTokenPairResponse>;
13
+ /** Asks for up to `DEFAULT_TOKEN_PAIRS_LIMIT` pairs unless `pagination.limit` is set. */
7
14
  getTokenPairs: (params?: {
8
15
  pagination?: PaginationParams;
9
16
  }) => Promise<QueryTokenPairsResponse>;
@@ -1,2 +1,3 @@
1
1
  export declare function cosmosDecToDecimalString(value: string): string;
2
2
  export declare function cosmosDecToProtoInt(value: string): string;
3
+ export declare function protoIntToCosmosDec(value: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ault-sdk-ts",
3
- "version": "0.7.2",
3
+ "version": "0.9.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",