ault-sdk-ts 0.0.2-alpha.13 → 0.0.2-alpha.15

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.
@@ -32,7 +32,7 @@ export interface AgentSignAndBroadcastParams {
32
32
  }
33
33
  export declare function signAndBroadcastAgentTx({ network, keyMaterial, masterAddress, msgs, memo, gasLimit, confirmationTimeoutMs, timeoutSeconds, timeoutTimestamp, fetchFn, fetchOptions, cache, }: AgentSignAndBroadcastParams): Promise<{
34
34
  txHash: string;
35
- code: number;
35
+ code: 0;
36
36
  rawLog?: string;
37
- confirmed?: boolean;
37
+ confirmed: true;
38
38
  }>;
@@ -15,3 +15,69 @@ export declare class WebSocketError extends Error {
15
15
  reason?: string;
16
16
  constructor(message: string, code?: number, reason?: string);
17
17
  }
18
+ export interface TxErrorParams {
19
+ txHash: string;
20
+ code: number;
21
+ rawLog?: string;
22
+ /**
23
+ * - `true` -- chain returned a definitive non-zero code (CheckTx or DeliverTx).
24
+ * - `false` -- broadcast accepted but inclusion never observed within the timeout.
25
+ * - `undefined` -- broadcast accepted but the confirmation lookup endpoint failed.
26
+ */
27
+ confirmed: boolean | undefined;
28
+ }
29
+ /**
30
+ * Thrown when a tx broadcast resolves to a definitive on-chain failure
31
+ * (CheckTx or DeliverTx returned a non-zero code). Callers should catch
32
+ * this and surface the failure (e.g. UI toasts).
33
+ */
34
+ export declare class TxError extends Error {
35
+ txHash: string;
36
+ code: number;
37
+ rawLog?: string;
38
+ confirmed: boolean | undefined;
39
+ constructor(params: TxErrorParams, message?: string);
40
+ }
41
+ /**
42
+ * Thrown when a tx was broadcast but block inclusion could not be confirmed
43
+ * within the deadline. The tx may still commit later — callers can re-query
44
+ * by `txHash` to recover the final result.
45
+ */
46
+ export declare class TxNotConfirmedError extends TxError {
47
+ constructor(params: TxErrorParams);
48
+ }
49
+ /**
50
+ * Thrown when a tx was broadcast but the confirmation lookup endpoint was
51
+ * unreachable or returned an unrecognized payload. Distinct from
52
+ * `TxNotConfirmedError` so callers can distinguish "still pending" from
53
+ * "we cannot tell at all".
54
+ */
55
+ export declare class TxConfirmationUnavailableError extends TxError {
56
+ constructor(params: TxErrorParams);
57
+ }
58
+ /**
59
+ * Thrown by `withdrawRewards` when a mid-loop tx fails AFTER one or more
60
+ * validators have already been withdrawn on-chain. Carries the txs that
61
+ * already committed so callers can reconcile the partial state.
62
+ *
63
+ * `cause` is the underlying error for the failed validator — typically a
64
+ * `TxError` (chain rejection) but it can also be a transport-level failure
65
+ * (`NetworkError`, `TimeoutError`, `ApiError`) raised by the broadcast
66
+ * helper before the chain ever sees the tx.
67
+ */
68
+ export declare class WithdrawRewardsPartialError extends Error {
69
+ failedValidatorAddress: string;
70
+ partialResults: ReadonlyArray<{
71
+ txHash: string;
72
+ validatorAddress: string;
73
+ }>;
74
+ cause: Error;
75
+ constructor(params: {
76
+ failedValidatorAddress: string;
77
+ partialResults: ReadonlyArray<{
78
+ txHash: string;
79
+ validatorAddress: string;
80
+ }>;
81
+ cause: Error;
82
+ });
83
+ }
@@ -58,7 +58,7 @@ export interface SignAndBroadcastParams {
58
58
  }
59
59
  export declare function signAndBroadcastEip712({ network, signerAddress, signer, msgs, memo, gasLimit, feeDenom, feeAmount, confirmationTimeoutMs, fetchFn, fetchOptions, cache, feeMarketCache, }: SignAndBroadcastParams): Promise<{
60
60
  txHash: string;
61
- code: number;
61
+ code: 0;
62
62
  rawLog?: string;
63
- confirmed?: boolean;
63
+ confirmed: true;
64
64
  }>;
@@ -366,9 +366,20 @@ export interface StakingTxApi {
366
366
  amount: string;
367
367
  };
368
368
  } & TxOptions): Promise<TxResult>;
369
+ /**
370
+ * Issues one `MsgWithdrawDelegatorReward` per validator as an independent,
371
+ * sequentially signed tx. The chain rejects EIP-712 transactions that pack
372
+ * multiple Cosmos messages (`sdk/18: expected exactly 1 message, got N`),
373
+ * so bundling is unsafe; each validator must travel in its own tx.
374
+ *
375
+ * On full success returns one `TxResult` per validator in the order the
376
+ * caller supplied them. If any tx fails, throws `WithdrawRewardsPartialError`
377
+ * carrying the validator that failed and the txs that already committed.
378
+ * Subsequent validators are not attempted.
379
+ */
369
380
  withdrawRewards(params: {
370
381
  validatorAddresses: string[];
371
- } & TxOptions): Promise<TxResult>;
382
+ } & TxOptions): Promise<TxResult[]>;
372
383
  }
373
384
  export interface TokenRegistryTxApi {
374
385
  enableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;