ault-sdk-ts 0.0.2-alpha.7 → 0.1.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.
- package/README.md +375 -50
- package/dist/agent/attach.d.ts +26 -0
- package/dist/agent/sign-and-broadcast.d.ts +9 -2
- package/dist/agent/tx/clob.d.ts +8 -1
- package/dist/agent/tx-executor.d.ts +24 -2
- package/dist/client.d.ts +6 -7
- package/dist/core/clob-gas.d.ts +28 -0
- package/dist/core/clob-msgs.d.ts +31 -5
- package/dist/core/clob-responses.d.ts +20 -0
- package/dist/core/cloid.d.ts +4 -0
- package/dist/core/errors.d.ts +79 -0
- package/dist/core/manifest-fetcher.d.ts +12 -0
- package/dist/core/manifest-resolver.d.ts +121 -0
- package/dist/core/manifest-types.d.ts +102 -0
- package/dist/core/network.d.ts +42 -13
- package/dist/eip712/msg.generated.d.ts +26 -10
- package/dist/eip712/registry.d.ts +2 -0
- package/dist/eip712/sign-and-broadcast.d.ts +27 -3
- package/dist/high-level/cloid-lookup.d.ts +9 -0
- package/dist/high-level/create-client.d.ts +15 -11
- package/dist/high-level/tx/accountx.d.ts +3 -0
- package/dist/high-level/tx/agent.d.ts +1 -1
- package/dist/high-level/tx/clob.d.ts +1 -1
- package/dist/high-level/tx/context.d.ts +8 -0
- package/dist/high-level/tx/license.d.ts +1 -1
- package/dist/high-level/tx/miner.d.ts +1 -1
- package/dist/high-level/tx/reward.d.ts +1 -1
- package/dist/high-level/tx/staking.d.ts +1 -1
- package/dist/high-level/tx-executor.d.ts +23 -3
- package/dist/high-level/types.d.ts +356 -100
- package/dist/high-level-client.d.ts +1 -1
- package/dist/index.cjs +16101 -7908
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +15860 -7678
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/accountx/v1/genesis.d.ts +38 -0
- package/dist/proto/gen/ault/accountx/v1/params.d.ts +32 -0
- package/dist/proto/gen/ault/accountx/v1/query.d.ts +88 -0
- package/dist/proto/gen/ault/accountx/v1/tx.d.ts +52 -0
- package/dist/proto/gen/ault/agent/v1/tx.d.ts +4 -5
- package/dist/proto/gen/ault/authority/v1/authority.d.ts +2 -0
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +6 -5
- package/dist/proto/gen/ault/clob/v1/query.d.ts +14 -0
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +30 -3
- package/dist/proto/gen/ault/common/v1/system.d.ts +31 -0
- package/dist/proto/gen/ault/license/v1/genesis.d.ts +1 -26
- package/dist/proto/gen/ault/license/v1/license.d.ts +0 -26
- package/dist/proto/gen/ault/license/v1/query.d.ts +44 -18
- package/dist/proto/gen/ault/market/v1/market.d.ts +1 -0
- package/dist/proto/gen/ault/market/v1/tx.d.ts +9 -0
- package/dist/proto/gen/ault/miner/v1/genesis.d.ts +52 -84
- package/dist/proto/gen/ault/miner/v1/miner.d.ts +10 -45
- package/dist/proto/gen/ault/miner/v1/query.d.ts +0 -13
- package/dist/proto/gen/ault/spot/v1/genesis.d.ts +2 -2
- package/dist/proto/gen/ault/spot/v1/order.d.ts +12 -4
- package/dist/proto/gen/ault/systemtx/v1/genesis.d.ts +37 -0
- package/dist/proto/gen/ault/tokenregistry/v1/genesis.d.ts +3 -3
- package/dist/proto/gen/ault/tokenregistry/v1/query.d.ts +2 -2
- package/dist/proto/gen/ault/tokenregistry/v1/tokenregistry.d.ts +24 -15
- package/dist/proto/gen/ault/tokenregistry/v1/tx.d.ts +1 -16
- package/dist/proto/gen/cosmos/bank/v1beta1/bank.d.ts +119 -0
- package/dist/proto/gen/cosmos/bank/v1beta1/query.d.ts +264 -0
- package/dist/proto/gen/cosmos/distribution/v1beta1/query.d.ts +203 -0
- package/dist/proto/gen/cosmos/query/v1/query.d.ts +1 -0
- package/dist/proto/gen/cosmos/staking/v1beta1/query.d.ts +275 -0
- package/dist/proto/gen/google/api/http.d.ts +20 -28
- package/dist/proto/gen/tendermint/abci/types.d.ts +23 -0
- package/dist/proto/tx-decode.d.ts +18 -0
- package/dist/rest/accountx.d.ts +8 -0
- package/dist/rest/bank.d.ts +15 -0
- package/dist/rest/clob.d.ts +9 -1
- package/dist/rest/context.d.ts +4 -4
- package/dist/rest/dex-types.generated.d.ts +363 -120
- package/dist/rest/dex.d.ts +6 -0
- package/dist/rest/dex.generated.d.ts +599 -83
- package/dist/rest/feemarket.d.ts +114 -0
- package/dist/rest/license.d.ts +21 -59
- package/dist/rest/miner.d.ts +16 -46
- package/dist/rest/portfolio.d.ts +103 -0
- package/dist/rest/staking.d.ts +14 -28
- package/dist/rest/tokenregistry.d.ts +3 -1
- package/dist/rest/types.d.ts +82 -858
- package/dist/utils/address.d.ts +2 -0
- package/dist/utils/opaque-id.d.ts +25 -0
- package/dist/utils/tx-hash.d.ts +1 -0
- package/dist/ws/client.d.ts +45 -5
- package/dist/ws/types.d.ts +380 -21
- package/package.json +2 -1
- package/dist/agent/create-agent-client.d.ts +0 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type FetchFn, type FetchWithRetryOptions } from "../core/http";
|
|
2
|
+
import type { NetworkConfig } from "../core/network";
|
|
3
|
+
export interface FeeMarketParams {
|
|
4
|
+
noBaseFee: boolean;
|
|
5
|
+
/** Decimal string in aault per unit gas. */
|
|
6
|
+
baseFee: string;
|
|
7
|
+
/** Decimal string in aault per unit gas (chain-side floor). */
|
|
8
|
+
minGasPrice: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetch the current `cosmos/evm` feemarket params from the chain REST gateway.
|
|
12
|
+
*
|
|
13
|
+
* Throws on transport / 4xx / 5xx errors; callers wanting graceful fallback
|
|
14
|
+
* (e.g. for chains that don't expose the feemarket gateway) should use
|
|
15
|
+
* `getCachedFeeMarketParams` which absorbs the failure.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchFeeMarketParams(network: NetworkConfig, fetchFn?: FetchFn, fetchOptions?: FetchWithRetryOptions): Promise<FeeMarketParams>;
|
|
18
|
+
/**
|
|
19
|
+
* Compute the minimum fee amount (raw aault) required for the given gas
|
|
20
|
+
* limit under the supplied feemarket params, with a safety margin to absorb
|
|
21
|
+
* intra-block base-fee bumps. The chain's DynamicFeeChecker enforces
|
|
22
|
+
* `fee.amount / gas >= effective`, where `effective = max(baseFee, minGasPrice)`
|
|
23
|
+
* when base fee is enabled, else `minGasPrice` alone.
|
|
24
|
+
*
|
|
25
|
+
* Returns the smallest non-negative integer string `feeAmount` such that
|
|
26
|
+
* `feeAmount / gas >= effective * (1 + marginPercent/100)`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeRequiredFee(params: FeeMarketParams, gas: string | number | bigint, options?: {
|
|
29
|
+
marginPercent?: number;
|
|
30
|
+
}): string;
|
|
31
|
+
interface FeeMarketEntry {
|
|
32
|
+
params: FeeMarketParams | null;
|
|
33
|
+
fetchedAt: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Per-chain cache for feemarket params. Reused across tx submissions to
|
|
37
|
+
* avoid hitting `/params` on every signature; one entry per `chainId`.
|
|
38
|
+
*/
|
|
39
|
+
export interface FeeMarketCache {
|
|
40
|
+
ttlMs: number;
|
|
41
|
+
entries: Map<string, FeeMarketEntry>;
|
|
42
|
+
}
|
|
43
|
+
export declare function createFeeMarketCache(ttlMs?: number): FeeMarketCache;
|
|
44
|
+
/**
|
|
45
|
+
* Look up cached feemarket params or fetch fresh ones. Returns `null` only
|
|
46
|
+
* when the chain definitively does not expose the feemarket gateway — i.e.
|
|
47
|
+
* the gateway returns 404 (path not registered) or 501 (not implemented).
|
|
48
|
+
* Negative responses are cached for `ttlMs` to avoid re-spamming a chain
|
|
49
|
+
* that lacks the module.
|
|
50
|
+
*
|
|
51
|
+
* Transient failures (timeouts, network errors, 5xx) propagate unchanged so
|
|
52
|
+
* callers can decide whether to retry. Caching a transient miss would force
|
|
53
|
+
* every tx for `ttlMs` onto the static fallback fee, which on chains where
|
|
54
|
+
* `min_gas_price` exceeds the static default would underprice the tx and
|
|
55
|
+
* trigger the same "insufficient fee" rejection this module exists to avoid.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getCachedFeeMarketParams(cache: FeeMarketCache | undefined, network: NetworkConfig, fetchFn?: FetchFn, fetchOptions?: FetchWithRetryOptions): Promise<FeeMarketParams | null>;
|
|
58
|
+
export interface EvmFeesPerGas {
|
|
59
|
+
/** wei per gas; suitable for viem's `maxFeePerGas`. */
|
|
60
|
+
maxFeePerGas: bigint;
|
|
61
|
+
/** wei per gas; suitable for viem's `maxPriorityFeePerGas`. */
|
|
62
|
+
maxPriorityFeePerGas: bigint;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convert feemarket params into the EIP-1559 fee fields a wallet must set so
|
|
66
|
+
* the tx clears the chain's DynamicFeeChecker. The chain enforces
|
|
67
|
+
* `effectiveGasPrice >= max(baseFee, minGasPrice)`; we apply the same safety
|
|
68
|
+
* margin used for cosmos-side dynamic fees (default 20%) to absorb
|
|
69
|
+
* intra-block base-fee bumps and return matched
|
|
70
|
+
* `maxFeePerGas` / `maxPriorityFeePerGas`.
|
|
71
|
+
*
|
|
72
|
+
* Why matched: the chain check is `effectiveGasPrice = min(maxFeePerGas,
|
|
73
|
+
* baseFee + maxPriorityFeePerGas) >= floor`. Setting both fields equal makes
|
|
74
|
+
* `effectiveGasPrice == maxFeePerGas` regardless of the current `baseFee`,
|
|
75
|
+
* so a transient base-fee bump cannot drop the effective price below the
|
|
76
|
+
* floor between resolver call and broadcast. The validator captures the
|
|
77
|
+
* full margin as tip in exchange — acceptable given the alternative is a
|
|
78
|
+
* mid-flight rejection. Callers that need a smaller tip can post-process
|
|
79
|
+
* the returned values.
|
|
80
|
+
*
|
|
81
|
+
* Returns `{ maxFeePerGas: 0n, maxPriorityFeePerGas: 0n }` when the chain
|
|
82
|
+
* reports no fee floor (`noBaseFee` with zero `minGasPrice`); callers should
|
|
83
|
+
* treat that the same as a feemarket miss and let the wallet's auto-fill
|
|
84
|
+
* handle it.
|
|
85
|
+
*/
|
|
86
|
+
export declare function computeEvmFeesPerGas(params: FeeMarketParams, options?: {
|
|
87
|
+
marginPercent?: number;
|
|
88
|
+
}): EvmFeesPerGas;
|
|
89
|
+
/**
|
|
90
|
+
* Convenience wrapper around `getCachedFeeMarketParams` that returns the
|
|
91
|
+
* EIP-1559 fee fields a wallet needs to clear the chain's DynamicFeeChecker.
|
|
92
|
+
*
|
|
93
|
+
* Returns `null` when the chain doesn't expose the feemarket gateway
|
|
94
|
+
* (404/501), when both `baseFee` and `minGasPrice` resolve to zero, or when
|
|
95
|
+
* the gateway responds with malformed `Dec` values that `cosmosDecToProtoInt`
|
|
96
|
+
* can't parse. Callers should either skip the override (let the wallet's
|
|
97
|
+
* auto-fill handle it) or fall back to `eth_gasPrice` from a public client.
|
|
98
|
+
*
|
|
99
|
+
* The parse-failure null mirrors the cosmos-side `resolveDynamicFeeAmount`
|
|
100
|
+
* defensive path: a malformed Dec from the gateway is a recoverable miss,
|
|
101
|
+
* not a reason to abort the entire tx flow.
|
|
102
|
+
*
|
|
103
|
+
* Transient transport errors (timeouts, 5xx, ECONNREFUSED) propagate so the
|
|
104
|
+
* caller can decide whether to retry or degrade — silently dropping the
|
|
105
|
+
* override on a flaky node would recreate the same "insufficient fee" bug
|
|
106
|
+
* this resolver exists to prevent.
|
|
107
|
+
*/
|
|
108
|
+
export declare function resolveEvmFeesPerGas(network: NetworkConfig, options?: {
|
|
109
|
+
cache?: FeeMarketCache;
|
|
110
|
+
fetchFn?: FetchFn;
|
|
111
|
+
fetchOptions?: FetchWithRetryOptions;
|
|
112
|
+
marginPercent?: number;
|
|
113
|
+
}): Promise<EvmFeesPerGas | null>;
|
|
114
|
+
export {};
|
package/dist/rest/license.d.ts
CHANGED
|
@@ -1,79 +1,41 @@
|
|
|
1
1
|
import { type RestContext } from "./context";
|
|
2
|
-
import
|
|
2
|
+
import { QueryApprovedMembersResponse, QueryBalanceResponse, QueryIsActiveResponse, QueryIsApprovedMemberResponse, QueryIsKYCApproverResponse, QueryKYCApproversResponse, QueryLicenseResponse, QueryLicensesByOwnerResponse, QueryLicensesResponse, QueryMintersResponse, QueryOwnedByResponse, QueryOwnerResponse, QueryParamsResponse, QueryTokenByOwnerIndexResponse, QueryTotalSupplyResponse, QueryTransferUnlockTimeResponse } from "../proto/gen/ault/license/v1/query";
|
|
3
|
+
import { LicenseStatus } from "../proto/gen/ault/license/v1/license";
|
|
4
|
+
import type { PaginationParams } from "./types";
|
|
5
|
+
export { LicenseStatus } from "../proto/gen/ault/license/v1/license";
|
|
3
6
|
export interface LicenseApi {
|
|
4
|
-
getLicense: (id: string | number) => Promise<
|
|
5
|
-
license: License;
|
|
6
|
-
}>;
|
|
7
|
+
getLicense: (id: string | number | bigint) => Promise<QueryLicenseResponse>;
|
|
7
8
|
getLicenses: (params?: {
|
|
8
9
|
status?: LicenseStatus;
|
|
9
10
|
pagination?: PaginationParams;
|
|
10
|
-
}) => Promise<
|
|
11
|
-
licenses: License[];
|
|
12
|
-
pagination?: PageResponse;
|
|
13
|
-
}>;
|
|
11
|
+
}) => Promise<QueryLicensesResponse>;
|
|
14
12
|
getLicensesByOwner: (owner: string, params?: {
|
|
15
13
|
pagination?: PaginationParams;
|
|
16
|
-
}) => Promise<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getBalance: (owner: string) => Promise<{
|
|
21
|
-
balance: string;
|
|
22
|
-
}>;
|
|
23
|
-
getOwner: (id: string | number) => Promise<{
|
|
24
|
-
owner: string;
|
|
25
|
-
}>;
|
|
26
|
-
getTokenOfOwnerByIndex: (owner: string, index: number) => Promise<{
|
|
27
|
-
id: string;
|
|
28
|
-
}>;
|
|
14
|
+
}) => Promise<QueryLicensesByOwnerResponse>;
|
|
15
|
+
getBalance: (owner: string) => Promise<QueryBalanceResponse>;
|
|
16
|
+
getOwner: (id: string | number | bigint) => Promise<QueryOwnerResponse>;
|
|
17
|
+
getTokenOfOwnerByIndex: (owner: string, index: number) => Promise<QueryTokenByOwnerIndexResponse>;
|
|
29
18
|
getOwnedBy: (owner: string, params?: {
|
|
30
19
|
pagination?: PaginationParams;
|
|
31
|
-
}) => Promise<
|
|
32
|
-
license_ids: string[];
|
|
33
|
-
pagination?: PageResponse;
|
|
34
|
-
}>;
|
|
20
|
+
}) => Promise<QueryOwnedByResponse>;
|
|
35
21
|
getLicensesByOwnerAll: (owner: string) => Promise<{
|
|
36
|
-
|
|
22
|
+
licenseIds: bigint[];
|
|
37
23
|
total: number;
|
|
38
24
|
}>;
|
|
39
|
-
getTotalSupply: () => Promise<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
isActive: (id: string | number) => Promise<{
|
|
43
|
-
is_active: boolean;
|
|
44
|
-
}>;
|
|
45
|
-
getParams: () => Promise<{
|
|
46
|
-
params: LicenseModuleParams;
|
|
47
|
-
}>;
|
|
25
|
+
getTotalSupply: () => Promise<QueryTotalSupplyResponse>;
|
|
26
|
+
isActive: (id: string | number | bigint) => Promise<QueryIsActiveResponse>;
|
|
27
|
+
getParams: () => Promise<QueryParamsResponse>;
|
|
48
28
|
getMinters: (params?: {
|
|
49
29
|
pagination?: PaginationParams;
|
|
50
|
-
}) => Promise<
|
|
51
|
-
|
|
52
|
-
pagination?: PageResponse;
|
|
53
|
-
}>;
|
|
54
|
-
getTransferUnlockTime: () => Promise<{
|
|
55
|
-
unlock_time: string;
|
|
56
|
-
}>;
|
|
30
|
+
}) => Promise<QueryMintersResponse>;
|
|
31
|
+
getTransferUnlockTime: () => Promise<QueryTransferUnlockTimeResponse>;
|
|
57
32
|
getKycApprovers: (params?: {
|
|
58
33
|
pagination?: PaginationParams;
|
|
59
|
-
}) => Promise<
|
|
60
|
-
approvers: string[];
|
|
61
|
-
pagination?: PageResponse;
|
|
62
|
-
}>;
|
|
34
|
+
}) => Promise<QueryKYCApproversResponse>;
|
|
63
35
|
getApprovedMembers: (params?: {
|
|
64
36
|
pagination?: PaginationParams;
|
|
65
|
-
}) => Promise<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}>;
|
|
69
|
-
isApprovedMember: (address: string) => Promise<{
|
|
70
|
-
is_approved: boolean;
|
|
71
|
-
}>;
|
|
72
|
-
isKycApprover: (address: string) => Promise<{
|
|
73
|
-
is_approver: boolean;
|
|
74
|
-
}>;
|
|
75
|
-
getActiveLicenseCountAt: (owner: string, snapshotTime: string) => Promise<{
|
|
76
|
-
count: string;
|
|
77
|
-
}>;
|
|
37
|
+
}) => Promise<QueryApprovedMembersResponse>;
|
|
38
|
+
isApprovedMember: (address: string) => Promise<QueryIsApprovedMemberResponse>;
|
|
39
|
+
isKycApprover: (address: string) => Promise<QueryIsKYCApproverResponse>;
|
|
78
40
|
}
|
|
79
41
|
export declare function createLicenseApi(context: RestContext): LicenseApi;
|
package/dist/rest/miner.d.ts
CHANGED
|
@@ -1,59 +1,29 @@
|
|
|
1
1
|
import { type RestContext } from "./context";
|
|
2
|
-
import
|
|
2
|
+
import { QueryBeaconResponse, QueryDelegatedLicensesResponse, QueryEmissionInfoResponse, QueryEmissionScheduleResponse, QueryEpochInfoResponse, QueryEpochResponse, QueryEpochsResponse, QueryLicenseDelegationResponse, QueryLicenseMinerInfoResponse, QueryOperatorInfoResponse, QueryOperatorsResponse, QueryOwnerKeyResponse, QueryParamsResponse } from "../proto/gen/ault/miner/v1/query";
|
|
3
|
+
import type { PaginationParams } from "./types";
|
|
3
4
|
export interface MinerApi {
|
|
4
|
-
getCurrentEpoch: () => Promise<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
finalized: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
getParams: () => Promise<{
|
|
15
|
-
params: MinerModuleParams;
|
|
16
|
-
}>;
|
|
17
|
-
getOwnerKey: (owner: string) => Promise<OwnerKeyInfo>;
|
|
18
|
-
getEmissionInfo: () => Promise<EmissionInfo>;
|
|
19
|
-
getEmissionSchedule: () => Promise<{
|
|
20
|
-
schedule: YearEmission[];
|
|
21
|
-
}>;
|
|
22
|
-
getEpochInfo: (epoch: string | number) => Promise<{
|
|
23
|
-
info: EpochInfo;
|
|
24
|
-
}>;
|
|
5
|
+
getCurrentEpoch: () => Promise<QueryEpochResponse>;
|
|
6
|
+
getLicenseMinerInfo: (licenseId: string | number | bigint) => Promise<QueryLicenseMinerInfoResponse>;
|
|
7
|
+
getBeacon: (epoch: string | number | bigint) => Promise<QueryBeaconResponse>;
|
|
8
|
+
getParams: () => Promise<QueryParamsResponse>;
|
|
9
|
+
getOwnerKey: (owner: string) => Promise<QueryOwnerKeyResponse>;
|
|
10
|
+
getEmissionInfo: () => Promise<QueryEmissionInfoResponse>;
|
|
11
|
+
getEmissionSchedule: () => Promise<QueryEmissionScheduleResponse>;
|
|
12
|
+
getEpochInfo: (epoch: string | number | bigint) => Promise<QueryEpochInfoResponse>;
|
|
25
13
|
getEpochs: (params?: {
|
|
26
14
|
pagination?: PaginationParams;
|
|
27
|
-
}) => Promise<
|
|
28
|
-
epochs: EpochInfo[];
|
|
29
|
-
pagination?: PageResponse;
|
|
30
|
-
}>;
|
|
15
|
+
}) => Promise<QueryEpochsResponse>;
|
|
31
16
|
getEpochsAll: () => Promise<{
|
|
32
|
-
epochs:
|
|
17
|
+
epochs: QueryEpochsResponse["epochs"];
|
|
33
18
|
total: number;
|
|
34
19
|
}>;
|
|
35
|
-
getOperator: (operator: string) => Promise<
|
|
36
|
-
operator: Operator | null;
|
|
37
|
-
}>;
|
|
20
|
+
getOperator: (operator: string) => Promise<QueryOperatorInfoResponse>;
|
|
38
21
|
getOperators: (params?: {
|
|
39
22
|
pagination?: PaginationParams;
|
|
40
|
-
}) => Promise<
|
|
41
|
-
|
|
42
|
-
pagination?: PageResponse;
|
|
43
|
-
}>;
|
|
44
|
-
getLicenseDelegation: (licenseId: string | number) => Promise<{
|
|
45
|
-
delegation: MiningDelegation | null;
|
|
46
|
-
is_delegated: boolean;
|
|
47
|
-
}>;
|
|
23
|
+
}) => Promise<QueryOperatorsResponse>;
|
|
24
|
+
getLicenseDelegation: (licenseId: string | number | bigint) => Promise<QueryLicenseDelegationResponse>;
|
|
48
25
|
getDelegatedLicenses: (operator: string, params?: {
|
|
49
26
|
pagination?: PaginationParams;
|
|
50
|
-
}) => Promise<
|
|
51
|
-
license_ids: string[];
|
|
52
|
-
pagination?: PageResponse;
|
|
53
|
-
}>;
|
|
54
|
-
getLicensePayouts: (licenseId: string | number, params?: {
|
|
55
|
-
fromEpoch?: string | number;
|
|
56
|
-
toEpoch?: string | number;
|
|
57
|
-
}) => Promise<LicensePayouts>;
|
|
27
|
+
}) => Promise<QueryDelegatedLicensesResponse>;
|
|
58
28
|
}
|
|
59
29
|
export declare function createMinerApi(context: RestContext): MinerApi;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export interface PortfolioHolding {
|
|
2
|
+
denom: string;
|
|
3
|
+
symbol: string;
|
|
4
|
+
available: string;
|
|
5
|
+
locked: string;
|
|
6
|
+
total: string;
|
|
7
|
+
price: string;
|
|
8
|
+
valueUsd: string;
|
|
9
|
+
priceTs: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PortfolioUnpricedAsset {
|
|
12
|
+
denom: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
total: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PortfolioHoldings {
|
|
18
|
+
address: string;
|
|
19
|
+
holdings: PortfolioHolding[];
|
|
20
|
+
totalUsd: string;
|
|
21
|
+
unpriced?: PortfolioUnpricedAsset[];
|
|
22
|
+
partial: boolean;
|
|
23
|
+
asOf: number;
|
|
24
|
+
}
|
|
25
|
+
export interface PortfolioFlowDirection {
|
|
26
|
+
inUsd: string;
|
|
27
|
+
outUsd: string;
|
|
28
|
+
netUsd: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PortfolioFlowKind {
|
|
31
|
+
kind: string;
|
|
32
|
+
inUsd: string;
|
|
33
|
+
outUsd: string;
|
|
34
|
+
netUsd: string;
|
|
35
|
+
count: number;
|
|
36
|
+
partial: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface PortfolioFlows {
|
|
39
|
+
address: string;
|
|
40
|
+
byKind: PortfolioFlowKind[];
|
|
41
|
+
gas: PortfolioFlowDirection;
|
|
42
|
+
rewards: PortfolioFlowDirection;
|
|
43
|
+
transfer: PortfolioFlowDirection;
|
|
44
|
+
module: PortfolioFlowDirection;
|
|
45
|
+
clob: PortfolioFlowDirection;
|
|
46
|
+
tokenregistry: PortfolioFlowDirection;
|
|
47
|
+
staking: PortfolioFlowDirection;
|
|
48
|
+
partial: boolean;
|
|
49
|
+
asOf: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PortfolioMarketPnL {
|
|
52
|
+
symbol: string;
|
|
53
|
+
realizedPnl: string;
|
|
54
|
+
volume: string;
|
|
55
|
+
}
|
|
56
|
+
export interface PortfolioOpenPosition {
|
|
57
|
+
denom: string;
|
|
58
|
+
symbol: string;
|
|
59
|
+
quantity: string;
|
|
60
|
+
avgCostUsd: string;
|
|
61
|
+
priceUsd: string;
|
|
62
|
+
unrealizedPnl: string;
|
|
63
|
+
}
|
|
64
|
+
export interface PortfolioPnL {
|
|
65
|
+
address: string;
|
|
66
|
+
realizedPnl: string;
|
|
67
|
+
unrealizedPnl: string;
|
|
68
|
+
totalPnl: string;
|
|
69
|
+
pnl24h: string;
|
|
70
|
+
feeImpact: string;
|
|
71
|
+
totalVolume: string;
|
|
72
|
+
volume24h: string;
|
|
73
|
+
byMarket: PortfolioMarketPnL[];
|
|
74
|
+
byAsset: PortfolioMarketPnL[];
|
|
75
|
+
openPositions?: PortfolioOpenPosition[];
|
|
76
|
+
partial: boolean;
|
|
77
|
+
asOf: number;
|
|
78
|
+
}
|
|
79
|
+
export type PortfolioTimeRange = "day" | "week" | "month" | "allTime";
|
|
80
|
+
export interface PortfolioTimePoint {
|
|
81
|
+
ts: number;
|
|
82
|
+
accountValue: string;
|
|
83
|
+
realizedPnl: string;
|
|
84
|
+
unrealizedPnl: string;
|
|
85
|
+
totalPnl: string;
|
|
86
|
+
volume: string;
|
|
87
|
+
}
|
|
88
|
+
export interface PortfolioTimeSeries {
|
|
89
|
+
address: string;
|
|
90
|
+
range: PortfolioTimeRange;
|
|
91
|
+
points: PortfolioTimePoint[];
|
|
92
|
+
partial: boolean;
|
|
93
|
+
asOf: number;
|
|
94
|
+
}
|
|
95
|
+
export interface RestResponse<T> {
|
|
96
|
+
data: T;
|
|
97
|
+
status: number;
|
|
98
|
+
headers: Headers;
|
|
99
|
+
}
|
|
100
|
+
export declare function getPortfolioHoldings(address: string, options?: RequestInit): Promise<RestResponse<PortfolioHoldings>>;
|
|
101
|
+
export declare function getPortfolioFlows(address: string, range?: PortfolioTimeRange, options?: RequestInit): Promise<RestResponse<PortfolioFlows>>;
|
|
102
|
+
export declare function getPortfolioPnl(address: string, range?: PortfolioTimeRange, options?: RequestInit): Promise<RestResponse<PortfolioPnL>>;
|
|
103
|
+
export declare function getPortfolioTimeSeries(address: string, range?: PortfolioTimeRange, options?: RequestInit): Promise<RestResponse<PortfolioTimeSeries>>;
|
package/dist/rest/staking.d.ts
CHANGED
|
@@ -1,38 +1,24 @@
|
|
|
1
1
|
import { type RestContext } from "./context";
|
|
2
|
-
import
|
|
2
|
+
import { QueryDelegationResponse, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsResponse, QueryParamsResponse, QueryPoolResponse, QueryValidatorResponse, QueryValidatorsResponse } from "../proto/gen/cosmos/staking/v1beta1/query";
|
|
3
|
+
import { BondStatus } from "../proto/gen/cosmos/staking/v1beta1/staking";
|
|
4
|
+
import { QueryDelegationTotalRewardsResponse } from "../proto/gen/cosmos/distribution/v1beta1/query";
|
|
5
|
+
import type { PaginationParams } from "./types";
|
|
6
|
+
export { BondStatus } from "../proto/gen/cosmos/staking/v1beta1/staking";
|
|
3
7
|
export interface StakingApi {
|
|
4
8
|
getValidators: (params?: {
|
|
5
|
-
status?:
|
|
9
|
+
status?: BondStatus;
|
|
6
10
|
pagination?: PaginationParams;
|
|
7
|
-
}) => Promise<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}>;
|
|
11
|
-
getValidator: (validatorAddress: string) => Promise<{
|
|
12
|
-
validator: Validator;
|
|
13
|
-
}>;
|
|
14
|
-
getDelegation: (delegatorAddress: string, validatorAddress: string) => Promise<DelegationResponseEnvelope>;
|
|
11
|
+
}) => Promise<QueryValidatorsResponse>;
|
|
12
|
+
getValidator: (validatorAddress: string) => Promise<QueryValidatorResponse>;
|
|
13
|
+
getDelegation: (delegatorAddress: string, validatorAddress: string) => Promise<QueryDelegationResponse>;
|
|
15
14
|
getDelegations: (delegatorAddress: string, params?: {
|
|
16
15
|
pagination?: PaginationParams;
|
|
17
|
-
}) => Promise<
|
|
18
|
-
delegation_responses: DelegationResponse[];
|
|
19
|
-
pagination?: PageResponse;
|
|
20
|
-
}>;
|
|
16
|
+
}) => Promise<QueryDelegatorDelegationsResponse>;
|
|
21
17
|
getUnbondingDelegations: (delegatorAddress: string, params?: {
|
|
22
18
|
pagination?: PaginationParams;
|
|
23
|
-
}) => Promise<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
getStakingRewards: (delegatorAddress: string) => Promise<{
|
|
28
|
-
rewards: DelegationReward[];
|
|
29
|
-
total: DecCoin[];
|
|
30
|
-
}>;
|
|
31
|
-
getStakingParams: () => Promise<{
|
|
32
|
-
params: StakingParams;
|
|
33
|
-
}>;
|
|
34
|
-
getStakingPool: () => Promise<{
|
|
35
|
-
pool: StakingPool;
|
|
36
|
-
}>;
|
|
19
|
+
}) => Promise<QueryDelegatorUnbondingDelegationsResponse>;
|
|
20
|
+
getStakingRewards: (delegatorAddress: string) => Promise<QueryDelegationTotalRewardsResponse>;
|
|
21
|
+
getStakingParams: () => Promise<QueryParamsResponse>;
|
|
22
|
+
getStakingPool: () => Promise<QueryPoolResponse>;
|
|
37
23
|
}
|
|
38
24
|
export declare function createStakingApi(context: RestContext): StakingApi;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type RestContext } from "./context";
|
|
2
2
|
import type { PaginationParams } from "./types";
|
|
3
|
-
import { QueryParamsResponse, QueryTokenPairResponse, QueryTokenPairsResponse } from "../proto/gen/ault/tokenregistry/v1/query";
|
|
3
|
+
import { QueryParamsResponse, QueryTokenPairResponse, QueryTokenPairsResponse, QueryTransferLimitResponse } from "../proto/gen/ault/tokenregistry/v1/query";
|
|
4
4
|
export interface TokenRegistryApi {
|
|
5
5
|
getParams: () => Promise<QueryParamsResponse>;
|
|
6
6
|
getTokenPair: (token: string) => Promise<QueryTokenPairResponse>;
|
|
7
7
|
getTokenPairs: (params?: {
|
|
8
8
|
pagination?: PaginationParams;
|
|
9
9
|
}) => Promise<QueryTokenPairsResponse>;
|
|
10
|
+
/** `token` is either the ERC20 contract address (0x...) or cosmos denom (erc20:0x...). */
|
|
11
|
+
getTransferLimit: (token: string) => Promise<QueryTransferLimitResponse>;
|
|
10
12
|
}
|
|
11
13
|
export declare function createTokenRegistryApi(context: RestContext): TokenRegistryApi;
|