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.
- package/LICENSE +21 -0
- package/README.md +923 -0
- package/dist/agent/create-agent-client.d.ts +3 -0
- package/dist/agent/sign-and-broadcast.d.ts +38 -0
- package/dist/agent/tx/clob.d.ts +7 -0
- package/dist/agent/tx-executor.d.ts +17 -0
- package/dist/client.d.ts +61 -0
- package/dist/core/address.d.ts +14 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/clob-msgs.d.ts +33 -0
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/http.d.ts +14 -0
- package/dist/core/network.d.ts +59 -0
- package/dist/core/pagination.d.ts +14 -0
- package/dist/core/query.d.ts +5 -0
- package/dist/core/with-status-fallback.d.ts +5 -0
- package/dist/eip712/builder.d.ts +45 -0
- package/dist/eip712/field-order.d.ts +2 -0
- package/dist/eip712/msg-encoders.generated.d.ts +1 -0
- package/dist/eip712/msg.generated.d.ts +109 -0
- package/dist/eip712/registry.d.ts +36 -0
- package/dist/eip712/registry.generated.d.ts +2 -0
- package/dist/eip712/sign-and-broadcast.d.ts +55 -0
- package/dist/eip712/signers.d.ts +83 -0
- package/dist/eip712/types.d.ts +58 -0
- package/dist/high-level/address-utils.d.ts +2 -0
- package/dist/high-level/create-client.d.ts +26 -0
- package/dist/high-level/query-helpers.d.ts +3 -0
- package/dist/high-level/signer.d.ts +6 -0
- package/dist/high-level/tx/agent.d.ts +3 -0
- package/dist/high-level/tx/authority.d.ts +3 -0
- package/dist/high-level/tx/clob.d.ts +3 -0
- package/dist/high-level/tx/context.d.ts +5 -0
- package/dist/high-level/tx/license.d.ts +3 -0
- package/dist/high-level/tx/market.d.ts +3 -0
- package/dist/high-level/tx/miner.d.ts +3 -0
- package/dist/high-level/tx/ratelimit.d.ts +3 -0
- package/dist/high-level/tx/reward.d.ts +3 -0
- package/dist/high-level/tx/staking.d.ts +3 -0
- package/dist/high-level/tx/tokenregistry.d.ts +3 -0
- package/dist/high-level/tx-executor.d.ts +18 -0
- package/dist/high-level/types.d.ts +477 -0
- package/dist/high-level-client.d.ts +2 -0
- package/dist/index.cjs +18409 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +18137 -0
- package/dist/index.js.map +1 -0
- package/dist/proto/duration-json.d.ts +6 -0
- package/dist/proto/gen/amino/amino.d.ts +1 -0
- package/dist/proto/gen/ault/agent/v1/agent.d.ts +63 -0
- package/dist/proto/gen/ault/agent/v1/genesis.d.ts +44 -0
- package/dist/proto/gen/ault/agent/v1/params.d.ts +42 -0
- package/dist/proto/gen/ault/agent/v1/query.d.ts +73 -0
- package/dist/proto/gen/ault/agent/v1/tx.d.ts +91 -0
- package/dist/proto/gen/ault/authority/v1/authority.d.ts +15 -0
- package/dist/proto/gen/ault/authority/v1/genesis.d.ts +36 -0
- package/dist/proto/gen/ault/authority/v1/query.d.ts +53 -0
- package/dist/proto/gen/ault/authority/v1/tx.d.ts +50 -0
- package/dist/proto/gen/ault/clob/v1/fee.d.ts +37 -0
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +56 -0
- package/dist/proto/gen/ault/clob/v1/order_book.d.ts +32 -0
- package/dist/proto/gen/ault/clob/v1/params.d.ts +29 -0
- package/dist/proto/gen/ault/clob/v1/query.d.ts +56 -0
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +116 -0
- package/dist/proto/gen/ault/license/v1/genesis.d.ts +140 -0
- package/dist/proto/gen/ault/license/v1/license.d.ts +151 -0
- package/dist/proto/gen/ault/license/v1/query.d.ts +273 -0
- package/dist/proto/gen/ault/license/v1/tx.d.ts +227 -0
- package/dist/proto/gen/ault/market/v1/genesis.d.ts +28 -0
- package/dist/proto/gen/ault/market/v1/market.d.ts +66 -0
- package/dist/proto/gen/ault/market/v1/params.d.ts +34 -0
- package/dist/proto/gen/ault/market/v1/query.d.ts +48 -0
- package/dist/proto/gen/ault/market/v1/tx.d.ts +87 -0
- package/dist/proto/gen/ault/miner/v1/genesis.d.ts +166 -0
- package/dist/proto/gen/ault/miner/v1/miner.d.ts +232 -0
- package/dist/proto/gen/ault/miner/v1/query.d.ts +254 -0
- package/dist/proto/gen/ault/miner/v1/tx.d.ts +207 -0
- package/dist/proto/gen/ault/ratelimit/v1/genesis.d.ts +27 -0
- package/dist/proto/gen/ault/ratelimit/v1/params.d.ts +35 -0
- package/dist/proto/gen/ault/ratelimit/v1/query.d.ts +42 -0
- package/dist/proto/gen/ault/ratelimit/v1/tx.d.ts +32 -0
- package/dist/proto/gen/ault/reward/v1/genesis.d.ts +67 -0
- package/dist/proto/gen/ault/reward/v1/query.d.ts +93 -0
- package/dist/proto/gen/ault/reward/v1/reward.d.ts +53 -0
- package/dist/proto/gen/ault/reward/v1/tx.d.ts +120 -0
- package/dist/proto/gen/ault/spot/v1/genesis.d.ts +26 -0
- package/dist/proto/gen/ault/spot/v1/order.d.ts +66 -0
- package/dist/proto/gen/ault/tokenregistry/v1/genesis.d.ts +34 -0
- package/dist/proto/gen/ault/tokenregistry/v1/query.d.ts +77 -0
- package/dist/proto/gen/ault/tokenregistry/v1/tokenregistry.d.ts +118 -0
- package/dist/proto/gen/ault/tokenregistry/v1/tx.d.ts +132 -0
- package/dist/proto/gen/cosmos/base/query/v1beta1/pagination.d.ts +82 -0
- package/dist/proto/gen/cosmos/base/v1beta1/coin.d.ts +59 -0
- package/dist/proto/gen/cosmos/distribution/v1beta1/distribution.d.ts +162 -0
- package/dist/proto/gen/cosmos/distribution/v1beta1/tx.d.ts +140 -0
- package/dist/proto/gen/cosmos/msg/v1/msg.d.ts +1 -0
- package/dist/proto/gen/cosmos/staking/v1beta1/staking.d.ts +310 -0
- package/dist/proto/gen/cosmos/staking/v1beta1/tx.d.ts +144 -0
- package/dist/proto/gen/cosmos_proto/cosmos.d.ts +80 -0
- package/dist/proto/gen/gogoproto/gogo.d.ts +1 -0
- package/dist/proto/gen/google/api/annotations.d.ts +1 -0
- package/dist/proto/gen/google/api/http.d.ts +379 -0
- package/dist/proto/gen/google/protobuf/any.d.ts +144 -0
- package/dist/proto/gen/google/protobuf/descriptor.d.ts +1285 -0
- package/dist/proto/gen/google/protobuf/duration.d.ts +99 -0
- package/dist/proto/gen/google/protobuf/timestamp.d.ts +128 -0
- package/dist/proto/gen/tendermint/abci/types.d.ts +507 -0
- package/dist/proto/gen/tendermint/crypto/keys.d.ts +27 -0
- package/dist/proto/gen/tendermint/crypto/proof.d.ts +57 -0
- package/dist/proto/gen/tendermint/types/params.d.ts +112 -0
- package/dist/proto/gen/tendermint/types/types.d.ts +197 -0
- package/dist/proto/gen/tendermint/types/validator.d.ts +54 -0
- package/dist/proto/gen/tendermint/version/types.d.ts +41 -0
- package/dist/proto/tx-encode.d.ts +78 -0
- package/dist/rest/agent.d.ts +12 -0
- package/dist/rest/authority.d.ts +12 -0
- package/dist/rest/clob.d.ts +11 -0
- package/dist/rest/context.d.ts +22 -0
- package/dist/rest/dex-fetcher.d.ts +10 -0
- package/dist/rest/dex-types.generated.d.ts +780 -0
- package/dist/rest/dex.d.ts +34 -0
- package/dist/rest/dex.generated.d.ts +1381 -0
- package/dist/rest/license.d.ts +79 -0
- package/dist/rest/market.d.ts +11 -0
- package/dist/rest/miner.d.ts +59 -0
- package/dist/rest/ratelimit.d.ts +7 -0
- package/dist/rest/reward.d.ts +25 -0
- package/dist/rest/staking.d.ts +38 -0
- package/dist/rest/tokenregistry.d.ts +11 -0
- package/dist/rest/types.d.ts +871 -0
- package/dist/utils/address.d.ts +6 -0
- package/dist/utils/chain-id.d.ts +1 -0
- package/dist/utils/cosmos-dec.d.ts +2 -0
- package/dist/ws/client.d.ts +34 -0
- package/dist/ws/index.d.ts +5 -0
- package/dist/ws/types.d.ts +72 -0
- package/package.json +103 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type AccountCache } from "../eip712/sign-and-broadcast";
|
|
2
|
+
import type { AnyEip712Msg } from "../eip712/builder";
|
|
3
|
+
import { type FetchFn, type FetchWithRetryOptions } from "../core/http";
|
|
4
|
+
import type { NetworkConfig } from "../core/network";
|
|
5
|
+
export declare const AGENT_DEFAULTS: {
|
|
6
|
+
readonly GAS_LIMIT: "147600";
|
|
7
|
+
readonly TIMEOUT_SECONDS: 300;
|
|
8
|
+
readonly EXTENSION_TYPE_URL: "/ault.agent.v1.ExtensionOptionsAgentTx";
|
|
9
|
+
readonly PUBKEY_TYPE_URL: "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey";
|
|
10
|
+
};
|
|
11
|
+
export interface AgentKeyMaterial {
|
|
12
|
+
privKeyBytes: Uint8Array;
|
|
13
|
+
compressedPubkey: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function computeAgentKeyMaterial(agentPrivateKey: string): AgentKeyMaterial;
|
|
16
|
+
export interface AgentSignAndBroadcastParams {
|
|
17
|
+
network: NetworkConfig;
|
|
18
|
+
keyMaterial: AgentKeyMaterial;
|
|
19
|
+
masterAddress: string;
|
|
20
|
+
msgs: AnyEip712Msg[];
|
|
21
|
+
memo?: string;
|
|
22
|
+
gasLimit?: string;
|
|
23
|
+
confirmationTimeoutMs?: number;
|
|
24
|
+
timeoutSeconds?: number;
|
|
25
|
+
timeoutTimestamp?: {
|
|
26
|
+
seconds: bigint;
|
|
27
|
+
nanos: number;
|
|
28
|
+
};
|
|
29
|
+
fetchFn?: FetchFn;
|
|
30
|
+
fetchOptions?: FetchWithRetryOptions;
|
|
31
|
+
cache?: AccountCache;
|
|
32
|
+
}
|
|
33
|
+
export declare function signAndBroadcastAgentTx({ network, keyMaterial, masterAddress, msgs, memo, gasLimit, confirmationTimeoutMs, timeoutSeconds, timeoutTimestamp, fetchFn, fetchOptions, cache, }: AgentSignAndBroadcastParams): Promise<{
|
|
34
|
+
txHash: string;
|
|
35
|
+
code: number;
|
|
36
|
+
rawLog?: string;
|
|
37
|
+
confirmed?: boolean;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentClobTxApi } from "../../high-level/types";
|
|
2
|
+
import type { AgentTxExecutor } from "../tx-executor";
|
|
3
|
+
export interface AgentClobTxContext {
|
|
4
|
+
masterAddress: string;
|
|
5
|
+
exec: AgentTxExecutor;
|
|
6
|
+
}
|
|
7
|
+
export declare function createAgentClobTxApi({ masterAddress, exec }: AgentClobTxContext): AgentClobTxApi;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { AgentTxOptions, TxResult } from "../high-level/types";
|
|
5
|
+
export interface AgentTxExecutorOptions {
|
|
6
|
+
network: NetworkConfig;
|
|
7
|
+
agentPrivateKey: string;
|
|
8
|
+
masterAddress: string;
|
|
9
|
+
fetchFn?: FetchFn;
|
|
10
|
+
fetchOptions?: FetchWithRetryOptions;
|
|
11
|
+
defaultGasLimit?: string;
|
|
12
|
+
defaultMemo?: string;
|
|
13
|
+
defaultConfirmationTimeoutMs?: number;
|
|
14
|
+
defaultTimeoutSeconds?: number;
|
|
15
|
+
}
|
|
16
|
+
export type AgentTxExecutor = (msgs: AnyEip712Msg[], txOptions?: AgentTxOptions) => Promise<TxResult>;
|
|
17
|
+
export declare function createAgentTxExecutor(options: AgentTxExecutorOptions): AgentTxExecutor;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { NetworkConfig } from "./core/network";
|
|
2
|
+
import type { FetchWithRetryOptions, FetchFn } from "./core/http";
|
|
3
|
+
import { type AgentApi } from "./rest/agent";
|
|
4
|
+
import { type AuthorityApi } from "./rest/authority";
|
|
5
|
+
import { type ClobApi } from "./rest/clob";
|
|
6
|
+
import { type LicenseApi } from "./rest/license";
|
|
7
|
+
import { type MarketApi } from "./rest/market";
|
|
8
|
+
import { type MinerApi } from "./rest/miner";
|
|
9
|
+
import { type RateLimitApi } from "./rest/ratelimit";
|
|
10
|
+
import { type RewardApi } from "./rest/reward";
|
|
11
|
+
import { type StakingApi } from "./rest/staking";
|
|
12
|
+
import { type DexApi } from "./rest/dex";
|
|
13
|
+
import { DexWsClient } from "./ws/client";
|
|
14
|
+
import type { DexWsOptions } from "./ws/types";
|
|
15
|
+
import { type TokenRegistryApi } from "./rest/tokenregistry";
|
|
16
|
+
import type { AnyEip712Msg, Eip712TxContext } from "./eip712/builder";
|
|
17
|
+
import type { SignAndBroadcastParams } from "./eip712/sign-and-broadcast";
|
|
18
|
+
import { EIP712_MSG_TYPES } from "./eip712/registry";
|
|
19
|
+
import { type SignerInput } from "./eip712/signers";
|
|
20
|
+
export interface AultClientOptions {
|
|
21
|
+
network: NetworkConfig;
|
|
22
|
+
signer?: SignerInput;
|
|
23
|
+
signerAddress?: string;
|
|
24
|
+
defaultConfirmationTimeoutMs?: number;
|
|
25
|
+
fetchFn?: FetchFn;
|
|
26
|
+
fetchOptions?: FetchWithRetryOptions;
|
|
27
|
+
wsOptions?: DexWsOptions;
|
|
28
|
+
}
|
|
29
|
+
export interface AultClient {
|
|
30
|
+
network: NetworkConfig;
|
|
31
|
+
rest: {
|
|
32
|
+
agent: AgentApi;
|
|
33
|
+
authority: AuthorityApi;
|
|
34
|
+
clob: ClobApi;
|
|
35
|
+
license: LicenseApi;
|
|
36
|
+
market: MarketApi;
|
|
37
|
+
miner: MinerApi;
|
|
38
|
+
ratelimit: RateLimitApi;
|
|
39
|
+
reward: RewardApi;
|
|
40
|
+
staking: StakingApi;
|
|
41
|
+
dex: DexApi;
|
|
42
|
+
tokenregistry: TokenRegistryApi;
|
|
43
|
+
};
|
|
44
|
+
ws: DexWsClient;
|
|
45
|
+
eip712: {
|
|
46
|
+
buildTypedData: (context: Eip712TxContext, msgs: AnyEip712Msg[], evmChainId: number) => {
|
|
47
|
+
types: Record<string, unknown>;
|
|
48
|
+
primaryType: "Tx";
|
|
49
|
+
domain: Record<string, unknown>;
|
|
50
|
+
message: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
signAndBroadcast: (params: Omit<SignAndBroadcastParams, "network" | "fetchFn">) => Promise<{
|
|
53
|
+
txHash: string;
|
|
54
|
+
code: number;
|
|
55
|
+
rawLog?: string;
|
|
56
|
+
confirmed?: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
registry: typeof EIP712_MSG_TYPES;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export declare function createAultClient(options: AultClientOptions): AultClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type BigIntLike = bigint | number | string;
|
|
2
|
+
/**
|
|
3
|
+
* Normalize any address to Ault bech32 format.
|
|
4
|
+
* Accepts: 0x... EVM address or ault1... bech32 address
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeAddress(address: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Normalize an array of addresses.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeAddresses(addresses: string[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Convert any bigint-like value to bigint.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toBigInt(value: BigIntLike): bigint;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Duration } from "../proto/gen/google/protobuf/duration";
|
|
2
|
+
export declare function buildLimitOrderMsg(sender: string, params: {
|
|
3
|
+
marketId: Uint8Array;
|
|
4
|
+
isBuy: boolean;
|
|
5
|
+
price: string;
|
|
6
|
+
quantity: string;
|
|
7
|
+
lifespan: Duration;
|
|
8
|
+
postOnly?: boolean;
|
|
9
|
+
builderAddress?: string;
|
|
10
|
+
builderFeeRate?: string;
|
|
11
|
+
}): import("../index.js").Eip712Msg<Omit<import("../proto/gen/ault/clob/v1/tx").MsgPlaceLimitOrder, "builderFeeRate" | "postOnly" | "builderAddress"> & Partial<Pick<import("../proto/gen/ault/clob/v1/tx").MsgPlaceLimitOrder, "builderFeeRate" | "postOnly" | "builderAddress">>, "/ault.clob.v1.MsgPlaceLimitOrder">;
|
|
12
|
+
export declare function buildMarketOrderMsg(sender: string, params: {
|
|
13
|
+
marketId: Uint8Array;
|
|
14
|
+
isBuy: boolean;
|
|
15
|
+
deposit: string;
|
|
16
|
+
worstPrice?: string;
|
|
17
|
+
priceTolerance?: string;
|
|
18
|
+
builderAddress?: string;
|
|
19
|
+
builderFeeRate?: string;
|
|
20
|
+
}): import("../index.js").Eip712Msg<Omit<import("../proto/gen/ault/clob/v1/tx").MsgPlaceMarketOrder, "builderFeeRate" | "builderAddress" | "worstPrice" | "priceTolerance"> & Partial<Pick<import("../proto/gen/ault/clob/v1/tx").MsgPlaceMarketOrder, "builderFeeRate" | "builderAddress" | "worstPrice" | "priceTolerance">>, "/ault.clob.v1.MsgPlaceMarketOrder">;
|
|
21
|
+
export declare function buildCancelOrdersMsg(sender: string, orderIds: Uint8Array[]): import("../index.js").Eip712Msg<import("../proto/gen/ault/clob/v1/tx").MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders">;
|
|
22
|
+
export declare function buildScaleOrderMsg(sender: string, params: {
|
|
23
|
+
marketId: Uint8Array;
|
|
24
|
+
isBuy: boolean;
|
|
25
|
+
lowPrice: string;
|
|
26
|
+
highPrice: string;
|
|
27
|
+
totalQuantity: string;
|
|
28
|
+
weights: number[];
|
|
29
|
+
lifespan: Duration;
|
|
30
|
+
postOnly?: boolean;
|
|
31
|
+
builderAddress?: string;
|
|
32
|
+
builderFeeRate?: string;
|
|
33
|
+
}): import("../index.js").Eip712Msg<Omit<import("../proto/gen/ault/clob/v1/tx").MsgPlaceScaleOrder, "builderFeeRate" | "postOnly" | "builderAddress"> & Partial<Pick<import("../proto/gen/ault/clob/v1/tx").MsgPlaceScaleOrder, "builderFeeRate" | "postOnly" | "builderAddress">>, "/ault.clob.v1.MsgPlaceScaleOrder">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class ApiError extends Error {
|
|
2
|
+
status?: number;
|
|
3
|
+
response?: string;
|
|
4
|
+
constructor(message: string, status?: number, response?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class NetworkError extends Error {
|
|
7
|
+
originalError?: Error;
|
|
8
|
+
constructor(message: string, originalError?: Error);
|
|
9
|
+
}
|
|
10
|
+
export declare class TimeoutError extends Error {
|
|
11
|
+
constructor(message?: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class WebSocketError extends Error {
|
|
14
|
+
code?: number;
|
|
15
|
+
reason?: string;
|
|
16
|
+
constructor(message: string, code?: number, reason?: string);
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A minimal fetch function signature that we use throughout the SDK */
|
|
2
|
+
export type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export interface FetchWithRetryOptions {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
retries?: number;
|
|
6
|
+
retryDelay?: number;
|
|
7
|
+
exponentialBackoff?: boolean;
|
|
8
|
+
retryableMethods?: string[];
|
|
9
|
+
retryableStatuses?: number[];
|
|
10
|
+
retryOnTimeout?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function fetchWithRetry(url: string, options?: RequestInit, fetchOptions?: FetchWithRetryOptions, fetchFn?: FetchFn): Promise<Response>;
|
|
13
|
+
export declare function fetchJson<T>(url: string, options?: RequestInit, fetchOptions?: FetchWithRetryOptions, fetchFn?: FetchFn): Promise<T>;
|
|
14
|
+
export declare function postJson<T, R>(url: string, data: T, fetchOptions?: FetchWithRetryOptions, fetchFn?: FetchFn): Promise<R>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Chain } from "viem";
|
|
2
|
+
export type NetworkType = "mainnet" | "testnet" | "devnet" | "localnet" | "unknown";
|
|
3
|
+
export interface NetworkConfig {
|
|
4
|
+
name: string;
|
|
5
|
+
type: NetworkType;
|
|
6
|
+
chainId: string;
|
|
7
|
+
evmChainId: number;
|
|
8
|
+
rpcUrl: string;
|
|
9
|
+
restUrl: string;
|
|
10
|
+
evmRpcUrl: string;
|
|
11
|
+
dexApiUrl?: string;
|
|
12
|
+
dexWsUrl?: string;
|
|
13
|
+
explorerUrl?: string;
|
|
14
|
+
isProduction: boolean;
|
|
15
|
+
/** Default EIP-712 fee amount in smallest denom (e.g. aault). Overrides GAS_CONSTANTS.EIP712_FEE_AMOUNT. */
|
|
16
|
+
eip712FeeAmount?: string;
|
|
17
|
+
/** Default EIP-712 gas limit. Overrides GAS_CONSTANTS.EIP712_GAS_LIMIT. */
|
|
18
|
+
eip712GasLimit?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const NETWORKS: Record<string, NetworkConfig>;
|
|
21
|
+
export declare const DEFAULT_CHAIN_ID = "ault_10904-1";
|
|
22
|
+
export declare function getNetworkConfig(chainId?: string): NetworkConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Convert a NetworkConfig into a viem Chain definition, suitable for
|
|
25
|
+
* Privy's `supportedChains` / `defaultChain` or any viem client.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toViemChain(network: NetworkConfig, evmRpcOverride?: string): Chain;
|
|
28
|
+
export declare const TIMING_CONSTANTS: {
|
|
29
|
+
readonly API_TIMEOUT_MS: 30000;
|
|
30
|
+
readonly API_RETRY_DELAY_MS: 1000;
|
|
31
|
+
readonly API_MAX_BACKOFF_MS: 30000;
|
|
32
|
+
readonly TX_POLL_TIMEOUT_MS: 30000;
|
|
33
|
+
};
|
|
34
|
+
export declare const GAS_CONSTANTS: {
|
|
35
|
+
readonly EIP712_FEE_AMOUNT: "5000000000000000";
|
|
36
|
+
readonly EIP712_GAS_LIMIT: "200000";
|
|
37
|
+
readonly DENOM: "aault";
|
|
38
|
+
/** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
|
|
39
|
+
readonly FEE_FREE_GAS_MULTIPLIER: 120;
|
|
40
|
+
readonly PER_LICENSE: 200000;
|
|
41
|
+
readonly PER_KYC_MEMBER: 200000;
|
|
42
|
+
readonly PER_DELEGATE_MINING: 200000;
|
|
43
|
+
readonly PER_SUBMIT_WORK: 200000;
|
|
44
|
+
readonly SET_OWNER_VRF_KEY: 200000;
|
|
45
|
+
readonly APPROVE_AGENT: 95000;
|
|
46
|
+
readonly REVOKE_AGENT: 59000;
|
|
47
|
+
readonly APPROVE_BUILDER: 79000;
|
|
48
|
+
readonly REVOKE_BUILDER: 55000;
|
|
49
|
+
readonly SET_REFERRAL_CODE: 73000;
|
|
50
|
+
readonly SET_REFERRAL: 69000;
|
|
51
|
+
readonly LIMIT_ORDER: 123000;
|
|
52
|
+
readonly MARKET_ORDER: 115000;
|
|
53
|
+
readonly SCALE_ORDER_BASE: 115000;
|
|
54
|
+
readonly SCALE_ORDER_PER_SUB: 11000;
|
|
55
|
+
readonly CANCEL_ORDER_BASE: 49000;
|
|
56
|
+
readonly CANCEL_ORDER_PER_ID: 22000;
|
|
57
|
+
};
|
|
58
|
+
export declare function computeFeeFreeGas(minGasPerOp: number, count: number): string;
|
|
59
|
+
export declare function computeFeeFreeGasCompound(base: number, perItem: number, count: number): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FetchWithRetryOptions, type FetchFn } from "./http";
|
|
2
|
+
export interface PaginateAllOptions<TResponse, TItem, TCursor> {
|
|
3
|
+
buildUrl: (cursor: TCursor | null) => string;
|
|
4
|
+
getItems: (response: TResponse) => TItem[];
|
|
5
|
+
getNextCursor: (response: TResponse) => TCursor | null;
|
|
6
|
+
getTotal?: (response: TResponse) => number;
|
|
7
|
+
parseResponse?: (response: unknown, url: string) => TResponse;
|
|
8
|
+
fetchOptions?: FetchWithRetryOptions;
|
|
9
|
+
fetchFn?: FetchFn;
|
|
10
|
+
}
|
|
11
|
+
export declare function paginateAll<TResponse, TItem, TCursor>(options: PaginateAllOptions<TResponse, TItem, TCursor>): Promise<{
|
|
12
|
+
items: TItem[];
|
|
13
|
+
total: number;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a query string from params, filtering out undefined/null values.
|
|
3
|
+
* Returns empty string if no params, otherwise returns `?key=value&...`
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildQuery(params: Record<string, string | number | boolean | undefined | null>): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run an async operation; if it throws an ApiError whose status is in
|
|
3
|
+
* the given set (defaults to [404, 400]), return the fallback value instead.
|
|
4
|
+
*/
|
|
5
|
+
export declare function withStatusFallback<T>(fn: () => Promise<T>, fallback: T, statuses?: number[]): Promise<T>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type AgentParams, type ClobParams, type LicenseParams, type MarketParams, type MarketType, type MinerParams, type RateLimitParams, type Role, type WorkSubmission } from "./registry";
|
|
2
|
+
import { type Eip712TypedData } from "./types";
|
|
3
|
+
import type { AnyEip712Msg } from "./msg.generated";
|
|
4
|
+
export interface Eip712TxContext {
|
|
5
|
+
chainId: string;
|
|
6
|
+
accountNumber: string;
|
|
7
|
+
sequence: string;
|
|
8
|
+
fee: {
|
|
9
|
+
amount: string;
|
|
10
|
+
denom: string;
|
|
11
|
+
gas: string;
|
|
12
|
+
};
|
|
13
|
+
memo: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Eip712Msg<TValue = unknown, TTypeUrl extends string = string> {
|
|
16
|
+
typeUrl: TTypeUrl;
|
|
17
|
+
value: TValue;
|
|
18
|
+
}
|
|
19
|
+
export interface Eip712AminoCoin {
|
|
20
|
+
denom: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Eip712AminoFee {
|
|
24
|
+
amount: Eip712AminoCoin[];
|
|
25
|
+
gas: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Eip712AminoMsg {
|
|
28
|
+
type: string;
|
|
29
|
+
value: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface Eip712AminoSignDoc {
|
|
32
|
+
account_number: string;
|
|
33
|
+
chain_id: string;
|
|
34
|
+
fee: Eip712AminoFee;
|
|
35
|
+
memo: string;
|
|
36
|
+
msgs: Eip712AminoMsg[];
|
|
37
|
+
sequence: string;
|
|
38
|
+
}
|
|
39
|
+
export type { AgentParams, ClobParams, LicenseParams, MarketParams, MarketType, MinerParams, RateLimitParams, Role, WorkSubmission, };
|
|
40
|
+
export declare function buildEip712AminoMsg(msg: AnyEip712Msg): Eip712AminoMsg;
|
|
41
|
+
export declare function buildEip712AminoMsgs(msgs: AnyEip712Msg[]): Eip712AminoMsg[];
|
|
42
|
+
export declare function buildEip712AminoSignDoc(context: Eip712TxContext, msgs: AnyEip712Msg[]): Eip712AminoSignDoc;
|
|
43
|
+
export declare function buildEip712TypedData(context: Eip712TxContext, msgs: AnyEip712Msg[], evmChainId: number): Eip712TypedData;
|
|
44
|
+
export { msg } from "./msg.generated";
|
|
45
|
+
export type { AnyEip712Msg } from "./msg.generated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MSG_ENCODERS: Record<string, (value: unknown) => Uint8Array>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Eip712Msg } from "./builder";
|
|
2
|
+
import type { MsgApproveAgent, MsgRevokeAgent, MsgUpdateParams as MsgUpdateParamsAultAgentV1 } from "../proto/gen/ault/agent/v1/tx";
|
|
3
|
+
import type { MsgGrantRole, MsgRevokeRole } from "../proto/gen/ault/authority/v1/tx";
|
|
4
|
+
import type { MsgCancelOrders, MsgPlaceLimitOrder, MsgPlaceMarketOrder, MsgPlaceScaleOrder, MsgUpdateParams as MsgUpdateParamsAultClobV1 } from "../proto/gen/ault/clob/v1/tx";
|
|
5
|
+
import type { MsgApproveMember, MsgBatchApproveMember, MsgBatchMintLicense, MsgBatchRevokeMember, MsgBurnLicense, MsgMintLicense, MsgRevokeLicense, MsgRevokeMember, MsgSetKYCApprovers, MsgSetMinters, MsgSetTokenURI, MsgTransferLicense, MsgUpdateParams as MsgUpdateParamsAultLicenseV1 } from "../proto/gen/ault/license/v1/tx";
|
|
6
|
+
import type { MsgCreateMarket, MsgHaltAllMarkets, MsgHaltMarkets, MsgResumeAllMarkets, MsgResumeMarkets, MsgUpdateMarket, MsgUpdateParams as MsgUpdateParamsAultMarketV1 } from "../proto/gen/ault/market/v1/tx";
|
|
7
|
+
import type { MsgBatchSubmitWork, MsgCancelMiningDelegation, MsgDelegateMining, MsgRedelegateMining, MsgRegisterOperator, MsgSetOwnerVrfKey, MsgSubmitWork, MsgUnregisterOperator, MsgUpdateOperatorInfo, MsgUpdateParams as MsgUpdateParamsAultMinerV1, WorkSubmission } from "../proto/gen/ault/miner/v1/tx";
|
|
8
|
+
import type { MsgUpdateParams as MsgUpdateParamsAultRatelimitV1 } from "../proto/gen/ault/ratelimit/v1/tx";
|
|
9
|
+
import type { MsgApproveBuilder, MsgRevokeBuilder, MsgSetDeployerShare, MsgSetReferral, MsgSetReferralCode, MsgUpdateEligibleReferrers, MsgUpdateParams as MsgUpdateParamsAultRewardV1 } from "../proto/gen/ault/reward/v1/tx";
|
|
10
|
+
import type { MsgCleanupTokenPair, MsgDisableTokenPair, MsgDisableTransfers, MsgEnableTokenPair, MsgEnableTransfers, MsgRegisterTokenPair, MsgRemoveTransferLimit, MsgSetTransferLimit } from "../proto/gen/ault/tokenregistry/v1/tx";
|
|
11
|
+
import type { MsgWithdrawDelegatorReward } from "../proto/gen/cosmos/distribution/v1beta1/tx";
|
|
12
|
+
import type { MsgBeginRedelegate, MsgDelegate, MsgUndelegate } from "../proto/gen/cosmos/staking/v1beta1/tx";
|
|
13
|
+
type WorkSubmissionInput = Omit<WorkSubmission, "nonce"> & Partial<Pick<WorkSubmission, "nonce">>;
|
|
14
|
+
type MsgApproveAgentInput = Omit<MsgApproveAgent, "expiry" | "name"> & Partial<Pick<MsgApproveAgent, "expiry" | "name">>;
|
|
15
|
+
type MsgBatchSubmitWorkInput = Omit<MsgBatchSubmitWork, "submissions"> & {
|
|
16
|
+
submissions: WorkSubmissionInput[];
|
|
17
|
+
};
|
|
18
|
+
type MsgPlaceLimitOrderInput = Omit<MsgPlaceLimitOrder, "builderAddress" | "builderFeeRate" | "postOnly"> & Partial<Pick<MsgPlaceLimitOrder, "builderAddress" | "builderFeeRate" | "postOnly">>;
|
|
19
|
+
type MsgPlaceMarketOrderInput = Omit<MsgPlaceMarketOrder, "builderAddress" | "builderFeeRate" | "priceTolerance" | "worstPrice"> & Partial<Pick<MsgPlaceMarketOrder, "builderAddress" | "builderFeeRate" | "priceTolerance" | "worstPrice">>;
|
|
20
|
+
type MsgPlaceScaleOrderInput = Omit<MsgPlaceScaleOrder, "builderAddress" | "builderFeeRate" | "postOnly"> & Partial<Pick<MsgPlaceScaleOrder, "builderAddress" | "builderFeeRate" | "postOnly">>;
|
|
21
|
+
type MsgRegisterOperatorInput = Omit<MsgRegisterOperator, "commissionRecipient"> & Partial<Pick<MsgRegisterOperator, "commissionRecipient">>;
|
|
22
|
+
type MsgSubmitWorkInput = Omit<MsgSubmitWork, "nonce"> & Partial<Pick<MsgSubmitWork, "nonce">>;
|
|
23
|
+
type MsgUpdateOperatorInfoInput = Omit<MsgUpdateOperatorInfo, "newCommissionRecipient"> & Partial<Pick<MsgUpdateOperatorInfo, "newCommissionRecipient">>;
|
|
24
|
+
export declare const msg: {
|
|
25
|
+
readonly agent: {
|
|
26
|
+
readonly approveAgent: (value: MsgApproveAgentInput) => Eip712Msg<MsgApproveAgentInput, "/ault.agent.v1.MsgApproveAgent">;
|
|
27
|
+
readonly revokeAgent: (value: MsgRevokeAgent) => Eip712Msg<MsgRevokeAgent, "/ault.agent.v1.MsgRevokeAgent">;
|
|
28
|
+
readonly updateParams: (value: MsgUpdateParamsAultAgentV1) => Eip712Msg<MsgUpdateParamsAultAgentV1, "/ault.agent.v1.MsgUpdateParams">;
|
|
29
|
+
};
|
|
30
|
+
readonly authority: {
|
|
31
|
+
readonly grantRole: (value: MsgGrantRole) => Eip712Msg<MsgGrantRole, "/ault.authority.v1.MsgGrantRole">;
|
|
32
|
+
readonly revokeRole: (value: MsgRevokeRole) => Eip712Msg<MsgRevokeRole, "/ault.authority.v1.MsgRevokeRole">;
|
|
33
|
+
};
|
|
34
|
+
readonly clob: {
|
|
35
|
+
readonly cancelOrders: (value: MsgCancelOrders) => Eip712Msg<MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders">;
|
|
36
|
+
readonly placeLimitOrder: (value: MsgPlaceLimitOrderInput) => Eip712Msg<MsgPlaceLimitOrderInput, "/ault.clob.v1.MsgPlaceLimitOrder">;
|
|
37
|
+
readonly placeMarketOrder: (value: MsgPlaceMarketOrderInput) => Eip712Msg<MsgPlaceMarketOrderInput, "/ault.clob.v1.MsgPlaceMarketOrder">;
|
|
38
|
+
readonly placeScaleOrder: (value: MsgPlaceScaleOrderInput) => Eip712Msg<MsgPlaceScaleOrderInput, "/ault.clob.v1.MsgPlaceScaleOrder">;
|
|
39
|
+
readonly updateParams: (value: MsgUpdateParamsAultClobV1) => Eip712Msg<MsgUpdateParamsAultClobV1, "/ault.clob.v1.MsgUpdateParams">;
|
|
40
|
+
};
|
|
41
|
+
readonly distribution: {
|
|
42
|
+
readonly withdrawDelegatorReward: (value: MsgWithdrawDelegatorReward) => Eip712Msg<MsgWithdrawDelegatorReward, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward">;
|
|
43
|
+
};
|
|
44
|
+
readonly license: {
|
|
45
|
+
readonly approveMember: (value: MsgApproveMember) => Eip712Msg<MsgApproveMember, "/ault.license.v1.MsgApproveMember">;
|
|
46
|
+
readonly batchApproveMember: (value: MsgBatchApproveMember) => Eip712Msg<MsgBatchApproveMember, "/ault.license.v1.MsgBatchApproveMember">;
|
|
47
|
+
readonly batchMintLicense: (value: MsgBatchMintLicense) => Eip712Msg<MsgBatchMintLicense, "/ault.license.v1.MsgBatchMintLicense">;
|
|
48
|
+
readonly batchRevokeMember: (value: MsgBatchRevokeMember) => Eip712Msg<MsgBatchRevokeMember, "/ault.license.v1.MsgBatchRevokeMember">;
|
|
49
|
+
readonly burnLicense: (value: MsgBurnLicense) => Eip712Msg<MsgBurnLicense, "/ault.license.v1.MsgBurnLicense">;
|
|
50
|
+
readonly mintLicense: (value: MsgMintLicense) => Eip712Msg<MsgMintLicense, "/ault.license.v1.MsgMintLicense">;
|
|
51
|
+
readonly revokeLicense: (value: MsgRevokeLicense) => Eip712Msg<MsgRevokeLicense, "/ault.license.v1.MsgRevokeLicense">;
|
|
52
|
+
readonly revokeMember: (value: MsgRevokeMember) => Eip712Msg<MsgRevokeMember, "/ault.license.v1.MsgRevokeMember">;
|
|
53
|
+
readonly setKYCApprovers: (value: MsgSetKYCApprovers) => Eip712Msg<MsgSetKYCApprovers, "/ault.license.v1.MsgSetKYCApprovers">;
|
|
54
|
+
readonly setMinters: (value: MsgSetMinters) => Eip712Msg<MsgSetMinters, "/ault.license.v1.MsgSetMinters">;
|
|
55
|
+
readonly setTokenURI: (value: MsgSetTokenURI) => Eip712Msg<MsgSetTokenURI, "/ault.license.v1.MsgSetTokenURI">;
|
|
56
|
+
readonly transferLicense: (value: MsgTransferLicense) => Eip712Msg<MsgTransferLicense, "/ault.license.v1.MsgTransferLicense">;
|
|
57
|
+
readonly updateParams: (value: MsgUpdateParamsAultLicenseV1) => Eip712Msg<MsgUpdateParamsAultLicenseV1, "/ault.license.v1.MsgUpdateParams">;
|
|
58
|
+
};
|
|
59
|
+
readonly market: {
|
|
60
|
+
readonly createMarket: (value: MsgCreateMarket) => Eip712Msg<MsgCreateMarket, "/ault.market.v1.MsgCreateMarket">;
|
|
61
|
+
readonly haltAllMarkets: (value: MsgHaltAllMarkets) => Eip712Msg<MsgHaltAllMarkets, "/ault.market.v1.MsgHaltAllMarkets">;
|
|
62
|
+
readonly haltMarkets: (value: MsgHaltMarkets) => Eip712Msg<MsgHaltMarkets, "/ault.market.v1.MsgHaltMarkets">;
|
|
63
|
+
readonly resumeAllMarkets: (value: MsgResumeAllMarkets) => Eip712Msg<MsgResumeAllMarkets, "/ault.market.v1.MsgResumeAllMarkets">;
|
|
64
|
+
readonly resumeMarkets: (value: MsgResumeMarkets) => Eip712Msg<MsgResumeMarkets, "/ault.market.v1.MsgResumeMarkets">;
|
|
65
|
+
readonly updateMarket: (value: MsgUpdateMarket) => Eip712Msg<MsgUpdateMarket, "/ault.market.v1.MsgUpdateMarket">;
|
|
66
|
+
readonly updateParams: (value: MsgUpdateParamsAultMarketV1) => Eip712Msg<MsgUpdateParamsAultMarketV1, "/ault.market.v1.MsgUpdateParams">;
|
|
67
|
+
};
|
|
68
|
+
readonly miner: {
|
|
69
|
+
readonly batchSubmitWork: (value: MsgBatchSubmitWorkInput) => Eip712Msg<MsgBatchSubmitWorkInput, "/ault.miner.v1.MsgBatchSubmitWork">;
|
|
70
|
+
readonly cancelMiningDelegation: (value: MsgCancelMiningDelegation) => Eip712Msg<MsgCancelMiningDelegation, "/ault.miner.v1.MsgCancelMiningDelegation">;
|
|
71
|
+
readonly delegateMining: (value: MsgDelegateMining) => Eip712Msg<MsgDelegateMining, "/ault.miner.v1.MsgDelegateMining">;
|
|
72
|
+
readonly redelegateMining: (value: MsgRedelegateMining) => Eip712Msg<MsgRedelegateMining, "/ault.miner.v1.MsgRedelegateMining">;
|
|
73
|
+
readonly registerOperator: (value: MsgRegisterOperatorInput) => Eip712Msg<MsgRegisterOperatorInput, "/ault.miner.v1.MsgRegisterOperator">;
|
|
74
|
+
readonly setOwnerVrfKey: (value: MsgSetOwnerVrfKey) => Eip712Msg<MsgSetOwnerVrfKey, "/ault.miner.v1.MsgSetOwnerVrfKey">;
|
|
75
|
+
readonly submitWork: (value: MsgSubmitWorkInput) => Eip712Msg<MsgSubmitWorkInput, "/ault.miner.v1.MsgSubmitWork">;
|
|
76
|
+
readonly unregisterOperator: (value: MsgUnregisterOperator) => Eip712Msg<MsgUnregisterOperator, "/ault.miner.v1.MsgUnregisterOperator">;
|
|
77
|
+
readonly updateOperatorInfo: (value: MsgUpdateOperatorInfoInput) => Eip712Msg<MsgUpdateOperatorInfoInput, "/ault.miner.v1.MsgUpdateOperatorInfo">;
|
|
78
|
+
readonly updateParams: (value: MsgUpdateParamsAultMinerV1) => Eip712Msg<MsgUpdateParamsAultMinerV1, "/ault.miner.v1.MsgUpdateParams">;
|
|
79
|
+
};
|
|
80
|
+
readonly ratelimit: {
|
|
81
|
+
readonly updateParams: (value: MsgUpdateParamsAultRatelimitV1) => Eip712Msg<MsgUpdateParamsAultRatelimitV1, "/ault.ratelimit.v1.MsgUpdateParams">;
|
|
82
|
+
};
|
|
83
|
+
readonly reward: {
|
|
84
|
+
readonly approveBuilder: (value: MsgApproveBuilder) => Eip712Msg<MsgApproveBuilder, "/ault.reward.v1.MsgApproveBuilder">;
|
|
85
|
+
readonly revokeBuilder: (value: MsgRevokeBuilder) => Eip712Msg<MsgRevokeBuilder, "/ault.reward.v1.MsgRevokeBuilder">;
|
|
86
|
+
readonly setDeployerShare: (value: MsgSetDeployerShare) => Eip712Msg<MsgSetDeployerShare, "/ault.reward.v1.MsgSetDeployerShare">;
|
|
87
|
+
readonly setReferral: (value: MsgSetReferral) => Eip712Msg<MsgSetReferral, "/ault.reward.v1.MsgSetReferral">;
|
|
88
|
+
readonly setReferralCode: (value: MsgSetReferralCode) => Eip712Msg<MsgSetReferralCode, "/ault.reward.v1.MsgSetReferralCode">;
|
|
89
|
+
readonly updateEligibleReferrers: (value: MsgUpdateEligibleReferrers) => Eip712Msg<MsgUpdateEligibleReferrers, "/ault.reward.v1.MsgUpdateEligibleReferrers">;
|
|
90
|
+
readonly updateParams: (value: MsgUpdateParamsAultRewardV1) => Eip712Msg<MsgUpdateParamsAultRewardV1, "/ault.reward.v1.MsgUpdateParams">;
|
|
91
|
+
};
|
|
92
|
+
readonly staking: {
|
|
93
|
+
readonly beginRedelegate: (value: MsgBeginRedelegate) => Eip712Msg<MsgBeginRedelegate, "/cosmos.staking.v1beta1.MsgBeginRedelegate">;
|
|
94
|
+
readonly delegate: (value: MsgDelegate) => Eip712Msg<MsgDelegate, "/cosmos.staking.v1beta1.MsgDelegate">;
|
|
95
|
+
readonly undelegate: (value: MsgUndelegate) => Eip712Msg<MsgUndelegate, "/cosmos.staking.v1beta1.MsgUndelegate">;
|
|
96
|
+
};
|
|
97
|
+
readonly tokenregistry: {
|
|
98
|
+
readonly cleanupTokenPair: (value: MsgCleanupTokenPair) => Eip712Msg<MsgCleanupTokenPair, "/ault.tokenregistry.v1.MsgCleanupTokenPair">;
|
|
99
|
+
readonly disableTokenPair: (value: MsgDisableTokenPair) => Eip712Msg<MsgDisableTokenPair, "/ault.tokenregistry.v1.MsgDisableTokenPair">;
|
|
100
|
+
readonly disableTransfers: (value: MsgDisableTransfers) => Eip712Msg<MsgDisableTransfers, "/ault.tokenregistry.v1.MsgDisableTransfers">;
|
|
101
|
+
readonly enableTokenPair: (value: MsgEnableTokenPair) => Eip712Msg<MsgEnableTokenPair, "/ault.tokenregistry.v1.MsgEnableTokenPair">;
|
|
102
|
+
readonly enableTransfers: (value: MsgEnableTransfers) => Eip712Msg<MsgEnableTransfers, "/ault.tokenregistry.v1.MsgEnableTransfers">;
|
|
103
|
+
readonly registerTokenPair: (value: MsgRegisterTokenPair) => Eip712Msg<MsgRegisterTokenPair, "/ault.tokenregistry.v1.MsgRegisterTokenPair">;
|
|
104
|
+
readonly removeTransferLimit: (value: MsgRemoveTransferLimit) => Eip712Msg<MsgRemoveTransferLimit, "/ault.tokenregistry.v1.MsgRemoveTransferLimit">;
|
|
105
|
+
readonly setTransferLimit: (value: MsgSetTransferLimit) => Eip712Msg<MsgSetTransferLimit, "/ault.tokenregistry.v1.MsgSetTransferLimit">;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export type AnyEip712Msg = Eip712Msg<MsgApproveAgentInput, "/ault.agent.v1.MsgApproveAgent"> | Eip712Msg<MsgRevokeAgent, "/ault.agent.v1.MsgRevokeAgent"> | Eip712Msg<MsgUpdateParamsAultAgentV1, "/ault.agent.v1.MsgUpdateParams"> | Eip712Msg<MsgGrantRole, "/ault.authority.v1.MsgGrantRole"> | Eip712Msg<MsgRevokeRole, "/ault.authority.v1.MsgRevokeRole"> | Eip712Msg<MsgCancelOrders, "/ault.clob.v1.MsgCancelOrders"> | Eip712Msg<MsgPlaceLimitOrderInput, "/ault.clob.v1.MsgPlaceLimitOrder"> | Eip712Msg<MsgPlaceMarketOrderInput, "/ault.clob.v1.MsgPlaceMarketOrder"> | Eip712Msg<MsgPlaceScaleOrderInput, "/ault.clob.v1.MsgPlaceScaleOrder"> | Eip712Msg<MsgUpdateParamsAultClobV1, "/ault.clob.v1.MsgUpdateParams"> | Eip712Msg<MsgApproveMember, "/ault.license.v1.MsgApproveMember"> | Eip712Msg<MsgBatchApproveMember, "/ault.license.v1.MsgBatchApproveMember"> | Eip712Msg<MsgBatchMintLicense, "/ault.license.v1.MsgBatchMintLicense"> | Eip712Msg<MsgBatchRevokeMember, "/ault.license.v1.MsgBatchRevokeMember"> | Eip712Msg<MsgBurnLicense, "/ault.license.v1.MsgBurnLicense"> | Eip712Msg<MsgMintLicense, "/ault.license.v1.MsgMintLicense"> | Eip712Msg<MsgRevokeLicense, "/ault.license.v1.MsgRevokeLicense"> | Eip712Msg<MsgRevokeMember, "/ault.license.v1.MsgRevokeMember"> | Eip712Msg<MsgSetKYCApprovers, "/ault.license.v1.MsgSetKYCApprovers"> | Eip712Msg<MsgSetMinters, "/ault.license.v1.MsgSetMinters"> | Eip712Msg<MsgSetTokenURI, "/ault.license.v1.MsgSetTokenURI"> | Eip712Msg<MsgTransferLicense, "/ault.license.v1.MsgTransferLicense"> | Eip712Msg<MsgUpdateParamsAultLicenseV1, "/ault.license.v1.MsgUpdateParams"> | Eip712Msg<MsgCreateMarket, "/ault.market.v1.MsgCreateMarket"> | Eip712Msg<MsgHaltAllMarkets, "/ault.market.v1.MsgHaltAllMarkets"> | Eip712Msg<MsgHaltMarkets, "/ault.market.v1.MsgHaltMarkets"> | Eip712Msg<MsgResumeAllMarkets, "/ault.market.v1.MsgResumeAllMarkets"> | Eip712Msg<MsgResumeMarkets, "/ault.market.v1.MsgResumeMarkets"> | Eip712Msg<MsgUpdateMarket, "/ault.market.v1.MsgUpdateMarket"> | Eip712Msg<MsgUpdateParamsAultMarketV1, "/ault.market.v1.MsgUpdateParams"> | Eip712Msg<MsgBatchSubmitWorkInput, "/ault.miner.v1.MsgBatchSubmitWork"> | Eip712Msg<MsgCancelMiningDelegation, "/ault.miner.v1.MsgCancelMiningDelegation"> | Eip712Msg<MsgDelegateMining, "/ault.miner.v1.MsgDelegateMining"> | Eip712Msg<MsgRedelegateMining, "/ault.miner.v1.MsgRedelegateMining"> | Eip712Msg<MsgRegisterOperatorInput, "/ault.miner.v1.MsgRegisterOperator"> | Eip712Msg<MsgSetOwnerVrfKey, "/ault.miner.v1.MsgSetOwnerVrfKey"> | Eip712Msg<MsgSubmitWorkInput, "/ault.miner.v1.MsgSubmitWork"> | Eip712Msg<MsgUnregisterOperator, "/ault.miner.v1.MsgUnregisterOperator"> | Eip712Msg<MsgUpdateOperatorInfoInput, "/ault.miner.v1.MsgUpdateOperatorInfo"> | Eip712Msg<MsgUpdateParamsAultMinerV1, "/ault.miner.v1.MsgUpdateParams"> | Eip712Msg<MsgUpdateParamsAultRatelimitV1, "/ault.ratelimit.v1.MsgUpdateParams"> | Eip712Msg<MsgApproveBuilder, "/ault.reward.v1.MsgApproveBuilder"> | Eip712Msg<MsgRevokeBuilder, "/ault.reward.v1.MsgRevokeBuilder"> | Eip712Msg<MsgSetDeployerShare, "/ault.reward.v1.MsgSetDeployerShare"> | Eip712Msg<MsgSetReferral, "/ault.reward.v1.MsgSetReferral"> | Eip712Msg<MsgSetReferralCode, "/ault.reward.v1.MsgSetReferralCode"> | Eip712Msg<MsgUpdateEligibleReferrers, "/ault.reward.v1.MsgUpdateEligibleReferrers"> | Eip712Msg<MsgUpdateParamsAultRewardV1, "/ault.reward.v1.MsgUpdateParams"> | Eip712Msg<MsgCleanupTokenPair, "/ault.tokenregistry.v1.MsgCleanupTokenPair"> | Eip712Msg<MsgDisableTokenPair, "/ault.tokenregistry.v1.MsgDisableTokenPair"> | Eip712Msg<MsgDisableTransfers, "/ault.tokenregistry.v1.MsgDisableTransfers"> | Eip712Msg<MsgEnableTokenPair, "/ault.tokenregistry.v1.MsgEnableTokenPair"> | Eip712Msg<MsgEnableTransfers, "/ault.tokenregistry.v1.MsgEnableTransfers"> | Eip712Msg<MsgRegisterTokenPair, "/ault.tokenregistry.v1.MsgRegisterTokenPair"> | Eip712Msg<MsgRemoveTransferLimit, "/ault.tokenregistry.v1.MsgRemoveTransferLimit"> | Eip712Msg<MsgSetTransferLimit, "/ault.tokenregistry.v1.MsgSetTransferLimit"> | Eip712Msg<MsgWithdrawDelegatorReward, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"> | Eip712Msg<MsgBeginRedelegate, "/cosmos.staking.v1beta1.MsgBeginRedelegate"> | Eip712Msg<MsgDelegate, "/cosmos.staking.v1beta1.MsgDelegate"> | Eip712Msg<MsgUndelegate, "/cosmos.staking.v1beta1.MsgUndelegate">;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Eip712Field } from "./types";
|
|
2
|
+
export interface FieldSemantics {
|
|
3
|
+
isAddress?: boolean;
|
|
4
|
+
isLegacyDec?: boolean;
|
|
5
|
+
/** Field has (cosmos_proto.scalar)="cosmos.Dec". The chain's amino JSON encoder
|
|
6
|
+
* converts these to human-readable decimal strings (e.g. "0.005000000000000000")
|
|
7
|
+
* instead of passing through the raw proto integer. */
|
|
8
|
+
isCosmosDecScalar?: boolean;
|
|
9
|
+
isCosmosInt?: boolean;
|
|
10
|
+
isBinary?: boolean;
|
|
11
|
+
isPubKey?: boolean;
|
|
12
|
+
deprecated?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface Eip712MsgTypeConfig {
|
|
15
|
+
aminoType: string;
|
|
16
|
+
eip712TypeName: string;
|
|
17
|
+
valueFields: readonly Eip712Field[];
|
|
18
|
+
nestedTypes?: Record<string, readonly Eip712Field[]>;
|
|
19
|
+
durationFields?: readonly string[];
|
|
20
|
+
enumFieldPaths?: Record<string, Record<string, string>>;
|
|
21
|
+
optionalFields?: readonly string[];
|
|
22
|
+
legacyAminoRegistered?: boolean;
|
|
23
|
+
fieldSemantics?: Record<string, FieldSemantics>;
|
|
24
|
+
}
|
|
25
|
+
export { EIP712_MSG_TYPES } from "./registry.generated";
|
|
26
|
+
export type { Params as AgentParams } from "../proto/gen/ault/agent/v1/params";
|
|
27
|
+
export { Role } from "../proto/gen/ault/authority/v1/authority";
|
|
28
|
+
export type { Params as ClobParams } from "../proto/gen/ault/clob/v1/params";
|
|
29
|
+
export type { Params as LicenseParams } from "../proto/gen/ault/license/v1/license";
|
|
30
|
+
export type { Params as MarketParams } from "../proto/gen/ault/market/v1/params";
|
|
31
|
+
export { MarketType } from "../proto/gen/ault/market/v1/market";
|
|
32
|
+
export type { Params as MinerParams } from "../proto/gen/ault/miner/v1/miner";
|
|
33
|
+
export type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
|
|
34
|
+
export type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
|
|
35
|
+
export type { Params as TokenRegistryParams, TokenPair, } from "../proto/gen/ault/tokenregistry/v1/tokenregistry";
|
|
36
|
+
export type { WorkSubmission } from "../proto/gen/ault/miner/v1/tx";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type AnyEip712Msg } from "./builder";
|
|
2
|
+
import { type NetworkConfig } from "../core/network";
|
|
3
|
+
import { type FetchFn, type FetchWithRetryOptions } from "../core/http";
|
|
4
|
+
import { type SignerInput } from "./signers";
|
|
5
|
+
export interface AccountInfo {
|
|
6
|
+
accountNumber: string;
|
|
7
|
+
sequence: string;
|
|
8
|
+
pubkeyBase64: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function queryAccount(network: NetworkConfig, address: string, fetchFn?: FetchFn, fetchOptions?: import("../core/http").FetchWithRetryOptions): Promise<AccountInfo>;
|
|
11
|
+
export interface AccountCache {
|
|
12
|
+
accountNumber: string | null;
|
|
13
|
+
pubkeyBase64: string | null;
|
|
14
|
+
nextSequence: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function createAccountCache(): AccountCache;
|
|
17
|
+
/** @internal Retained for compatibility; polling is now stateless. */
|
|
18
|
+
export declare function _resetIndexingCache(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Polls the chain for a transaction by hash until it is included in a block,
|
|
21
|
+
* then returns the DeliverTx result (the actual execution code and log).
|
|
22
|
+
*
|
|
23
|
+
* BROADCAST_MODE_SYNC only returns the CheckTx result (mempool acceptance).
|
|
24
|
+
* A transaction can pass CheckTx (code=0) but fail during DeliverTx when
|
|
25
|
+
* the message handler rejects it (e.g. authorization failures). This function
|
|
26
|
+
* bridges that gap by waiting for block inclusion.
|
|
27
|
+
*
|
|
28
|
+
* If tx lookup is unavailable for any reason other than "not found yet",
|
|
29
|
+
* the function returns `confirmed: undefined` and the caller can treat the
|
|
30
|
+
* transaction as broadcast but not definitively confirmed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pollTxInclusion(network: NetworkConfig, txHash: string, fetchFn?: FetchFn, fetchOptions?: FetchWithRetryOptions, timeoutMs?: number, intervalMs?: number): Promise<{
|
|
33
|
+
code: number;
|
|
34
|
+
rawLog?: string;
|
|
35
|
+
confirmed: boolean | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export interface SignAndBroadcastParams {
|
|
38
|
+
network: NetworkConfig;
|
|
39
|
+
signer?: SignerInput;
|
|
40
|
+
signerAddress?: string;
|
|
41
|
+
msgs: AnyEip712Msg[];
|
|
42
|
+
memo?: string;
|
|
43
|
+
gasLimit?: string;
|
|
44
|
+
feeAmount?: string;
|
|
45
|
+
confirmationTimeoutMs?: number;
|
|
46
|
+
fetchFn?: FetchFn;
|
|
47
|
+
fetchOptions?: import("../core/http").FetchWithRetryOptions;
|
|
48
|
+
cache?: AccountCache;
|
|
49
|
+
}
|
|
50
|
+
export declare function signAndBroadcastEip712({ network, signerAddress, signer, msgs, memo, gasLimit, feeAmount, confirmationTimeoutMs, fetchFn, fetchOptions, cache, }: SignAndBroadcastParams): Promise<{
|
|
51
|
+
txHash: string;
|
|
52
|
+
code: number;
|
|
53
|
+
rawLog?: string;
|
|
54
|
+
confirmed?: boolean;
|
|
55
|
+
}>;
|