ault-sdk-ts 0.0.2-alpha.10

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +923 -0
  3. package/dist/agent/create-agent-client.d.ts +3 -0
  4. package/dist/agent/sign-and-broadcast.d.ts +38 -0
  5. package/dist/agent/tx/clob.d.ts +7 -0
  6. package/dist/agent/tx-executor.d.ts +17 -0
  7. package/dist/client.d.ts +61 -0
  8. package/dist/core/address.d.ts +14 -0
  9. package/dist/core/base64.d.ts +2 -0
  10. package/dist/core/clob-msgs.d.ts +33 -0
  11. package/dist/core/errors.d.ts +17 -0
  12. package/dist/core/http.d.ts +14 -0
  13. package/dist/core/network.d.ts +59 -0
  14. package/dist/core/pagination.d.ts +14 -0
  15. package/dist/core/query.d.ts +5 -0
  16. package/dist/core/with-status-fallback.d.ts +5 -0
  17. package/dist/eip712/builder.d.ts +45 -0
  18. package/dist/eip712/field-order.d.ts +2 -0
  19. package/dist/eip712/msg-encoders.generated.d.ts +1 -0
  20. package/dist/eip712/msg.generated.d.ts +109 -0
  21. package/dist/eip712/registry.d.ts +36 -0
  22. package/dist/eip712/registry.generated.d.ts +2 -0
  23. package/dist/eip712/sign-and-broadcast.d.ts +55 -0
  24. package/dist/eip712/signers.d.ts +83 -0
  25. package/dist/eip712/types.d.ts +58 -0
  26. package/dist/high-level/address-utils.d.ts +2 -0
  27. package/dist/high-level/create-client.d.ts +26 -0
  28. package/dist/high-level/query-helpers.d.ts +3 -0
  29. package/dist/high-level/signer.d.ts +6 -0
  30. package/dist/high-level/tx/agent.d.ts +3 -0
  31. package/dist/high-level/tx/authority.d.ts +3 -0
  32. package/dist/high-level/tx/clob.d.ts +3 -0
  33. package/dist/high-level/tx/context.d.ts +5 -0
  34. package/dist/high-level/tx/license.d.ts +3 -0
  35. package/dist/high-level/tx/market.d.ts +3 -0
  36. package/dist/high-level/tx/miner.d.ts +3 -0
  37. package/dist/high-level/tx/ratelimit.d.ts +3 -0
  38. package/dist/high-level/tx/reward.d.ts +3 -0
  39. package/dist/high-level/tx/staking.d.ts +3 -0
  40. package/dist/high-level/tx/tokenregistry.d.ts +3 -0
  41. package/dist/high-level/tx-executor.d.ts +18 -0
  42. package/dist/high-level/types.d.ts +477 -0
  43. package/dist/high-level-client.d.ts +2 -0
  44. package/dist/index.cjs +18409 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.d.ts +38 -0
  47. package/dist/index.js +18137 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/proto/duration-json.d.ts +6 -0
  50. package/dist/proto/gen/amino/amino.d.ts +1 -0
  51. package/dist/proto/gen/ault/agent/v1/agent.d.ts +63 -0
  52. package/dist/proto/gen/ault/agent/v1/genesis.d.ts +44 -0
  53. package/dist/proto/gen/ault/agent/v1/params.d.ts +42 -0
  54. package/dist/proto/gen/ault/agent/v1/query.d.ts +73 -0
  55. package/dist/proto/gen/ault/agent/v1/tx.d.ts +91 -0
  56. package/dist/proto/gen/ault/authority/v1/authority.d.ts +15 -0
  57. package/dist/proto/gen/ault/authority/v1/genesis.d.ts +36 -0
  58. package/dist/proto/gen/ault/authority/v1/query.d.ts +53 -0
  59. package/dist/proto/gen/ault/authority/v1/tx.d.ts +50 -0
  60. package/dist/proto/gen/ault/clob/v1/fee.d.ts +37 -0
  61. package/dist/proto/gen/ault/clob/v1/genesis.d.ts +56 -0
  62. package/dist/proto/gen/ault/clob/v1/order_book.d.ts +32 -0
  63. package/dist/proto/gen/ault/clob/v1/params.d.ts +29 -0
  64. package/dist/proto/gen/ault/clob/v1/query.d.ts +56 -0
  65. package/dist/proto/gen/ault/clob/v1/tx.d.ts +116 -0
  66. package/dist/proto/gen/ault/license/v1/genesis.d.ts +140 -0
  67. package/dist/proto/gen/ault/license/v1/license.d.ts +151 -0
  68. package/dist/proto/gen/ault/license/v1/query.d.ts +273 -0
  69. package/dist/proto/gen/ault/license/v1/tx.d.ts +227 -0
  70. package/dist/proto/gen/ault/market/v1/genesis.d.ts +28 -0
  71. package/dist/proto/gen/ault/market/v1/market.d.ts +66 -0
  72. package/dist/proto/gen/ault/market/v1/params.d.ts +34 -0
  73. package/dist/proto/gen/ault/market/v1/query.d.ts +48 -0
  74. package/dist/proto/gen/ault/market/v1/tx.d.ts +87 -0
  75. package/dist/proto/gen/ault/miner/v1/genesis.d.ts +166 -0
  76. package/dist/proto/gen/ault/miner/v1/miner.d.ts +232 -0
  77. package/dist/proto/gen/ault/miner/v1/query.d.ts +254 -0
  78. package/dist/proto/gen/ault/miner/v1/tx.d.ts +207 -0
  79. package/dist/proto/gen/ault/ratelimit/v1/genesis.d.ts +27 -0
  80. package/dist/proto/gen/ault/ratelimit/v1/params.d.ts +35 -0
  81. package/dist/proto/gen/ault/ratelimit/v1/query.d.ts +42 -0
  82. package/dist/proto/gen/ault/ratelimit/v1/tx.d.ts +32 -0
  83. package/dist/proto/gen/ault/reward/v1/genesis.d.ts +67 -0
  84. package/dist/proto/gen/ault/reward/v1/query.d.ts +93 -0
  85. package/dist/proto/gen/ault/reward/v1/reward.d.ts +53 -0
  86. package/dist/proto/gen/ault/reward/v1/tx.d.ts +120 -0
  87. package/dist/proto/gen/ault/spot/v1/genesis.d.ts +26 -0
  88. package/dist/proto/gen/ault/spot/v1/order.d.ts +66 -0
  89. package/dist/proto/gen/ault/tokenregistry/v1/genesis.d.ts +34 -0
  90. package/dist/proto/gen/ault/tokenregistry/v1/query.d.ts +77 -0
  91. package/dist/proto/gen/ault/tokenregistry/v1/tokenregistry.d.ts +118 -0
  92. package/dist/proto/gen/ault/tokenregistry/v1/tx.d.ts +132 -0
  93. package/dist/proto/gen/cosmos/base/query/v1beta1/pagination.d.ts +82 -0
  94. package/dist/proto/gen/cosmos/base/v1beta1/coin.d.ts +59 -0
  95. package/dist/proto/gen/cosmos/distribution/v1beta1/distribution.d.ts +162 -0
  96. package/dist/proto/gen/cosmos/distribution/v1beta1/tx.d.ts +140 -0
  97. package/dist/proto/gen/cosmos/msg/v1/msg.d.ts +1 -0
  98. package/dist/proto/gen/cosmos/staking/v1beta1/staking.d.ts +310 -0
  99. package/dist/proto/gen/cosmos/staking/v1beta1/tx.d.ts +144 -0
  100. package/dist/proto/gen/cosmos_proto/cosmos.d.ts +80 -0
  101. package/dist/proto/gen/gogoproto/gogo.d.ts +1 -0
  102. package/dist/proto/gen/google/api/annotations.d.ts +1 -0
  103. package/dist/proto/gen/google/api/http.d.ts +379 -0
  104. package/dist/proto/gen/google/protobuf/any.d.ts +144 -0
  105. package/dist/proto/gen/google/protobuf/descriptor.d.ts +1285 -0
  106. package/dist/proto/gen/google/protobuf/duration.d.ts +99 -0
  107. package/dist/proto/gen/google/protobuf/timestamp.d.ts +128 -0
  108. package/dist/proto/gen/tendermint/abci/types.d.ts +507 -0
  109. package/dist/proto/gen/tendermint/crypto/keys.d.ts +27 -0
  110. package/dist/proto/gen/tendermint/crypto/proof.d.ts +57 -0
  111. package/dist/proto/gen/tendermint/types/params.d.ts +112 -0
  112. package/dist/proto/gen/tendermint/types/types.d.ts +197 -0
  113. package/dist/proto/gen/tendermint/types/validator.d.ts +54 -0
  114. package/dist/proto/gen/tendermint/version/types.d.ts +41 -0
  115. package/dist/proto/tx-encode.d.ts +78 -0
  116. package/dist/rest/agent.d.ts +12 -0
  117. package/dist/rest/authority.d.ts +12 -0
  118. package/dist/rest/clob.d.ts +11 -0
  119. package/dist/rest/context.d.ts +22 -0
  120. package/dist/rest/dex-fetcher.d.ts +10 -0
  121. package/dist/rest/dex-types.generated.d.ts +780 -0
  122. package/dist/rest/dex.d.ts +34 -0
  123. package/dist/rest/dex.generated.d.ts +1381 -0
  124. package/dist/rest/license.d.ts +79 -0
  125. package/dist/rest/market.d.ts +11 -0
  126. package/dist/rest/miner.d.ts +59 -0
  127. package/dist/rest/ratelimit.d.ts +7 -0
  128. package/dist/rest/reward.d.ts +25 -0
  129. package/dist/rest/staking.d.ts +38 -0
  130. package/dist/rest/tokenregistry.d.ts +11 -0
  131. package/dist/rest/types.d.ts +871 -0
  132. package/dist/utils/address.d.ts +6 -0
  133. package/dist/utils/chain-id.d.ts +1 -0
  134. package/dist/utils/cosmos-dec.d.ts +2 -0
  135. package/dist/ws/client.d.ts +34 -0
  136. package/dist/ws/index.d.ts +5 -0
  137. package/dist/ws/types.d.ts +72 -0
  138. package/package.json +103 -0
@@ -0,0 +1,83 @@
1
+ import type { Eip712Field, Eip712TypedData } from "./types";
2
+ export type SignTypedDataResult = {
3
+ signature: string;
4
+ } | string;
5
+ export type SignTypedDataFn = (typedData: Eip712TypedData) => Promise<SignTypedDataResult>;
6
+ /**
7
+ * Symbol used to identify AultSigner instances created by this SDK.
8
+ * This prevents mis-detection when duck-typing wallet types.
9
+ */
10
+ export declare const AULT_SIGNER_MARKER: unique symbol;
11
+ export interface AultSigner {
12
+ signTypedData: SignTypedDataFn;
13
+ address?: string;
14
+ getAddress?: () => Promise<string> | string;
15
+ /** Internal marker to identify SDK-created signers */
16
+ [AULT_SIGNER_MARKER]?: true;
17
+ }
18
+ /**
19
+ * Check if an object is an AultSigner created by this SDK.
20
+ */
21
+ export declare function isAultSigner(obj: unknown): obj is AultSigner;
22
+ export type SignerInput = AultSigner | SignTypedDataFn;
23
+ export interface Eip1193ProviderLike {
24
+ request: (args: {
25
+ method: string;
26
+ params?: unknown[];
27
+ }) => Promise<unknown>;
28
+ }
29
+ export interface ViemWalletLike {
30
+ address?: string;
31
+ getAddresses?: () => Promise<readonly string[]>;
32
+ signTypedData?: (args: {
33
+ domain: Record<string, unknown>;
34
+ types: Record<string, Array<{
35
+ name: string;
36
+ type: string;
37
+ }>>;
38
+ primaryType: string;
39
+ message: Record<string, unknown>;
40
+ }) => Promise<string>;
41
+ request?: (args: {
42
+ method: string;
43
+ params?: unknown[];
44
+ }) => Promise<unknown>;
45
+ }
46
+ export interface EthersSignerLike {
47
+ getAddress: () => Promise<string>;
48
+ signTypedData?: (domain: Record<string, unknown>, types: Record<string, Array<{
49
+ name: string;
50
+ type: string;
51
+ }>>, message: Record<string, unknown>) => Promise<string>;
52
+ _signTypedData?: (domain: Record<string, unknown>, types: Record<string, Array<{
53
+ name: string;
54
+ type: string;
55
+ }>>, message: Record<string, unknown>) => Promise<string>;
56
+ }
57
+ export interface PrivySignTypedDataLike {
58
+ (input: unknown, options?: {
59
+ address?: string;
60
+ }): Promise<{
61
+ signature: string;
62
+ }>;
63
+ }
64
+ export declare function normalizeSigner(input?: SignerInput): AultSigner | null;
65
+ export declare function normalizeSignature(result: SignTypedDataResult): string;
66
+ export declare function resolveSignerAddress(signer: AultSigner | null, signerAddress?: string): Promise<string>;
67
+ export declare function stripEip712Domain(types: Record<string, Eip712Field[]>): {
68
+ [x: string]: Eip712Field[];
69
+ };
70
+ export declare function createEip1193Signer(options: {
71
+ provider: Eip1193ProviderLike;
72
+ address: string;
73
+ method?: "eth_signTypedData_v4" | "eth_signTypedData";
74
+ }): AultSigner;
75
+ export declare function createViemSigner(wallet: ViemWalletLike, options?: {
76
+ preferRpc?: boolean;
77
+ }): AultSigner;
78
+ export declare function createEthersSigner(signer: EthersSignerLike): AultSigner;
79
+ export declare function createPrivySigner(options: {
80
+ signTypedData: PrivySignTypedDataLike;
81
+ address?: string;
82
+ }): AultSigner;
83
+ export declare function createPrivateKeySigner(privateKey: string): AultSigner;
@@ -0,0 +1,58 @@
1
+ export declare const EIP712_DOMAIN_TYPE: readonly [{
2
+ readonly name: "name";
3
+ readonly type: "string";
4
+ }, {
5
+ readonly name: "version";
6
+ readonly type: "string";
7
+ }, {
8
+ readonly name: "chainId";
9
+ readonly type: "uint256";
10
+ }, {
11
+ readonly name: "verifyingContract";
12
+ readonly type: "string";
13
+ }, {
14
+ readonly name: "salt";
15
+ readonly type: "string";
16
+ }];
17
+ export declare const TX_BASE_FIELDS: readonly [{
18
+ readonly name: "account_number";
19
+ readonly type: "string";
20
+ }, {
21
+ readonly name: "chain_id";
22
+ readonly type: "string";
23
+ }, {
24
+ readonly name: "fee";
25
+ readonly type: "Fee";
26
+ }, {
27
+ readonly name: "memo";
28
+ readonly type: "string";
29
+ }, {
30
+ readonly name: "sequence";
31
+ readonly type: "string";
32
+ }];
33
+ export declare const FEE_TYPE: readonly [{
34
+ readonly name: "amount";
35
+ readonly type: "Coin[]";
36
+ }, {
37
+ readonly name: "gas";
38
+ readonly type: "string";
39
+ }];
40
+ export declare const COIN_TYPE: readonly [{
41
+ readonly name: "denom";
42
+ readonly type: "string";
43
+ }, {
44
+ readonly name: "amount";
45
+ readonly type: "string";
46
+ }];
47
+ export type Eip712Field = {
48
+ name: string;
49
+ type: string;
50
+ jsName?: string;
51
+ protoHint?: string;
52
+ };
53
+ export interface Eip712TypedData<TPrimary extends string = "Tx"> {
54
+ types: Record<string, Eip712Field[]>;
55
+ primaryType: TPrimary;
56
+ domain: Record<string, unknown>;
57
+ message: Record<string, unknown>;
58
+ }
@@ -0,0 +1,2 @@
1
+ export { normalizeAddress, normalizeAddresses, toBigInt } from "../core/address";
2
+ export type { BigIntLike } from "../core/address";
@@ -0,0 +1,26 @@
1
+ import type { Client, ClientOptions } from "./types";
2
+ /**
3
+ * Create a high-level client for the Ault SDK.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { createClient, getNetworkConfig } from 'ault-sdk-ts';
8
+ * import { privateKeyToAccount } from 'viem/accounts';
9
+ *
10
+ * const account = privateKeyToAccount('0x...');
11
+ * const client = await createClient({
12
+ * network: getNetworkConfig('ault_10904-1'),
13
+ * signer: account,
14
+ * });
15
+ *
16
+ * // Query
17
+ * const licenses = await client.license.getOwnedBy(client.address);
18
+ *
19
+ * // Transactions
20
+ * const result = await client.delegateMining({
21
+ * licenseIds: [1, 2, 3],
22
+ * operator: '0xOperator...',
23
+ * });
24
+ * ```
25
+ */
26
+ export declare function createClient(options: ClientOptions): Promise<Client>;
@@ -0,0 +1,3 @@
1
+ import type { AultClient } from "../client";
2
+ import type { ParallelQueryApi } from "./types";
3
+ export declare function createParallelQueryApi(lowLevel: AultClient): ParallelQueryApi;
@@ -0,0 +1,6 @@
1
+ import { type AultSigner } from "../eip712/signers";
2
+ import type { FlexibleSignerInput } from "./types";
3
+ /**
4
+ * Auto-detect and normalize signer input to AultSigner.
5
+ */
6
+ export declare function autoDetectSigner(input: FlexibleSignerInput): AultSigner;
@@ -0,0 +1,3 @@
1
+ import type { AgentTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createAgentTxApi({ signerAddress, exec }: TxModuleContext): AgentTxApi;
@@ -0,0 +1,3 @@
1
+ import type { AuthorityTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createAuthorityTxApi({ signerAddress, exec }: TxModuleContext): AuthorityTxApi;
@@ -0,0 +1,3 @@
1
+ import type { ClobTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createClobTxApi({ signerAddress, exec }: TxModuleContext): ClobTxApi;
@@ -0,0 +1,5 @@
1
+ import type { TxExecutor } from "../tx-executor";
2
+ export interface TxModuleContext {
3
+ signerAddress: string;
4
+ exec: TxExecutor;
5
+ }
@@ -0,0 +1,3 @@
1
+ import type { LicenseTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createLicenseTxApi({ signerAddress, exec }: TxModuleContext): LicenseTxApi;
@@ -0,0 +1,3 @@
1
+ import type { MarketTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createMarketTxApi({ signerAddress, exec }: TxModuleContext): MarketTxApi;
@@ -0,0 +1,3 @@
1
+ import type { MinerTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createMinerTxApi({ signerAddress, exec }: TxModuleContext): MinerTxApi;
@@ -0,0 +1,3 @@
1
+ import type { RateLimitTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createRateLimitTxApi({ signerAddress, exec }: TxModuleContext): RateLimitTxApi;
@@ -0,0 +1,3 @@
1
+ import type { RewardTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createRewardTxApi({ signerAddress, exec }: TxModuleContext): RewardTxApi;
@@ -0,0 +1,3 @@
1
+ import type { StakingTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createStakingTxApi({ signerAddress, exec }: TxModuleContext): StakingTxApi;
@@ -0,0 +1,3 @@
1
+ import type { TokenRegistryTxApi } from "../types";
2
+ import type { TxModuleContext } from "./context";
3
+ export declare function createTokenRegistryTxApi({ signerAddress, exec, }: TxModuleContext): TokenRegistryTxApi;
@@ -0,0 +1,18 @@
1
+ import type { FetchFn, FetchWithRetryOptions } from "../core/http";
2
+ import { type NetworkConfig } from "../core/network";
3
+ import type { AnyEip712Msg } from "../eip712/builder";
4
+ import type { AultSigner } from "../eip712/signers";
5
+ import type { TxOptions, TxResult } from "./types";
6
+ interface TxExecutorOptions {
7
+ network: NetworkConfig;
8
+ signer: AultSigner;
9
+ signerAddress: string;
10
+ fetchFn?: FetchFn;
11
+ fetchOptions?: FetchWithRetryOptions;
12
+ defaultGasLimit?: string;
13
+ defaultMemo?: string;
14
+ defaultConfirmationTimeoutMs?: number;
15
+ }
16
+ export type TxExecutor = (msgs: AnyEip712Msg[], txOptions?: TxOptions) => Promise<TxResult>;
17
+ export declare function createTxExecutor(options: TxExecutorOptions): TxExecutor;
18
+ export {};