@augustdigital/sdk 8.16.1 → 8.19.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.
@@ -2133,8 +2133,10 @@ async function getVaultUserLifetimePnl({ vault, wallet, options, }) {
2133
2133
  });
2134
2134
  let sharePriceRaw = BigInt(0);
2135
2135
  try {
2136
+ // Retried on transport blips only (bounded, no fallback); a vault that
2137
+ // genuinely has no `lpTokenAddress()` still throws into the catch below.
2136
2138
  const lpTokenAddress = version === 'evm-2'
2137
- ? (await vaultContract.lpTokenAddress())
2139
+ ? await (0, core_1.getReceiptTokenAddressOrThrow)(provider, vault, 'getVaultUserLifetimePnl:receiptToken')
2138
2140
  : vault;
2139
2141
  let currentShares = BigInt(0);
2140
2142
  if (version === 'evm-2') {
@@ -2648,7 +2650,9 @@ async function getPreviewRedemption({ vault, sharesAmount, options, }) {
2648
2650
  abi: TokenizedVaultV2_1.ABI_TOKENIZED_VAULT_V2,
2649
2651
  provider,
2650
2652
  });
2651
- const lpTokenAddress = (await contract.lpTokenAddress());
2653
+ // Retried on transport blips only (bounded, no fallback); a misroute
2654
+ // still surfaces the original error.
2655
+ const lpTokenAddress = await (0, core_1.getReceiptTokenAddressOrThrow)(provider, vault, 'getPreviewRedemption:receiptToken');
2652
2656
  const lpTokenContract = (0, core_1.createContract)({
2653
2657
  address: lpTokenAddress,
2654
2658
  abi: abis_1.ABI_LENDING_POOL_V2,
@@ -390,6 +390,8 @@ function buildBackendVault(tokenizedVault, overrides) {
390
390
  performanceFeeWaivedUntilTvl: tokenizedVault.performance_fee_waived_until_tvl ?? null,
391
391
  },
392
392
  lagDuration: 0,
393
+ withdrawalMarginSeconds: tokenizedVault.withdrawal_margin_seconds ?? null,
394
+ iatTraders: tokenizedVault.iat_traders ?? null,
393
395
  maxDailyDrawdown: tokenizedVault.max_daily_drawdown || 0,
394
396
  risk: tokenizedVault.risk || 'low',
395
397
  isWithdrawalPaused: false,
@@ -471,6 +473,8 @@ async function buildFormattedVault(provider, tokenizedVault, contractCalls) {
471
473
  maxDailyDrawdown: tokenizedVault.max_daily_drawdown || 0,
472
474
  risk: tokenizedVault.risk,
473
475
  lagDuration: Number(contractCalls.lagDuration),
476
+ withdrawalMarginSeconds: tokenizedVault.withdrawal_margin_seconds ?? null,
477
+ iatTraders: tokenizedVault.iat_traders ?? null,
474
478
  address: tokenizedVault.address,
475
479
  name: tokenizedVault.vault_name,
476
480
  logoUrl: tokenizedVault.vault_logo_url,
@@ -81,7 +81,47 @@ export declare function resolveSpender(args: {
81
81
  export declare function validateAmountPrecision(amount: string | bigint | number): void;
82
82
  /** @internal */
83
83
  export declare function isNonceParsing(error: unknown): boolean;
84
- /** @internal */
84
+ /**
85
+ * Await a broadcast transaction's receipt, surviving both malformed-nonce RPCs
86
+ * and transient transport faults while still reporting genuine on-chain
87
+ * failures.
88
+ *
89
+ * `tx.wait()` is tried first because it preserves ethers' replacement-tx
90
+ * detection and revert checks. Two recoverable failure modes are handled:
91
+ *
92
+ * 1. **Malformed nonce** ({@link isNonceParsing}) — Monad-style RPCs return
93
+ * `nonce: "undefined"` on the pending tx and ethers throws while parsing.
94
+ * One direct `provider.waitForTransaction()` recovers it (unchanged
95
+ * behaviour).
96
+ * 2. **Transient transport fault** ({@link isRetryableRpcError}) — the provider
97
+ * hiccups while polling `eth_getTransactionReceipt` and ethers surfaces
98
+ * `could not coalesce error (… "code": -32603 …)`. This used to propagate
99
+ * and make every write path report a **successfully mined** transaction as
100
+ * failed, driving users to retry into `ERC20InsufficientBalance`. The hash
101
+ * is already on the wire and receipt polling is idempotent, so we re-poll
102
+ * with bounded exponential backoff instead of rethrowing.
103
+ *
104
+ * Everything else — notably a real revert — is rethrown untouched.
105
+ *
106
+ * Every error this function throws is stamped by {@link markBroadcast}: by the
107
+ * time `tx.wait()` can fail, the transaction is already on the wire, so the
108
+ * caller must never report it as "never sent". See
109
+ * {@link localTxBroadcastContext} for how that reaches
110
+ * `AugustSDKError.context`.
111
+ *
112
+ * @param tx - The broadcast transaction response to await.
113
+ * @returns The mined receipt (never `null` on the fallback paths; `tx.wait()`
114
+ * itself may return `null` when the caller configured 0 confirmations).
115
+ * @throws {Error} `Transaction <hash> reverted on-chain` when the receipt
116
+ * reports `status === 0`. Marked `confirmationUnknown: false` — the chain
117
+ * answered.
118
+ * @throws {Error} `Transaction <hash> was not confirmed within <n>s` when the
119
+ * overall wait times out with no receipt. Marked
120
+ * `confirmationUnknown: true`.
121
+ * @throws The underlying transport error once receipt-poll retries are
122
+ * exhausted, marked `confirmationUnknown: true`.
123
+ * @internal
124
+ */
85
125
  export declare function safeWaitForTx(tx: TransactionResponse): Promise<import("ethers").TransactionReceipt>;
86
126
  /**
87
127
  * Wraps an ethers contract call that returns a TransactionResponse.