ault-sdk-ts 0.0.2-alpha.5
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 +932 -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 +18434 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +18162 -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 +37 -0
- package/dist/ws/index.d.ts +5 -0
- package/dist/ws/types.d.ts +66 -0
- 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,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,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 {};
|