- Extract rpcCall into helpers/rpc.ts to eliminate the duplicate copy in wallet.ts and assertions.ts (warning: code duplication) - Fix waitForReceipt() in swap.ts to assert receipt.status === '0x1': reverted transactions (status 0x0) now throw immediately with a clear message instead of letting sellAllKrk silently succeed and fail later at the balance assertion (bug) - Add screen.width debug log to connectWallet() before the isVisible check, restoring the regression signal from always-leave.spec.ts (warning) - Fix expectPoolHasLiquidity() to only assert sqrtPriceX96 > 0 (pool is initialised); drop the active-tick liquidity() check which gives false negatives when price moves outside all LiquidityManager ranges after a sovereign exit (warning) - Add WETH balance snapshot before/after the swap in sellAllKrk() and log a warning when WETH output is 0, making pool health degradation visible despite amountOutMinimum: 0n (warning) - Add before/after screenshots in buyKrk() (holdout-before-buy.png, holdout-after-buy.png) to restore CI debugging artefacts (nit) - Move waitForTimeout(2_000) settle buffer in buyKrk() to the catch path only; when the Submitting→idle transition is observed the extra wait is redundant (nit) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
681 B
TypeScript
17 lines
681 B
TypeScript
/**
|
|
* Shared JSON-RPC utility for holdout helpers.
|
|
*
|
|
* Exported from one place so wallet.ts, assertions.ts, and future helpers
|
|
* share a single implementation rather than embedding the same fetch +
|
|
* error-check block in each file.
|
|
*/
|
|
export async function rpcCall(rpcUrl: string, method: string, params: unknown[]): Promise<unknown> {
|
|
const resp = await fetch(rpcUrl, {
|
|
method: 'POST',
|
|
headers: { 'content-type': 'application/json' },
|
|
body: JSON.stringify({ jsonrpc: '2.0', id: Date.now(), method, params }),
|
|
});
|
|
const payload = await resp.json();
|
|
if (payload.error) throw new Error(`RPC ${method}: ${payload.error.message}`);
|
|
return payload.result;
|
|
}
|