@gvnrdao/dh-sdk 0.0.298 → 0.0.300

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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Shared decoder for custom-error reverts surfaced by quantum-signed operations
3
+ * (mintUCD / makePayment / withdrawBTC / extendPosition / liquidation).
4
+ *
5
+ * Consolidates what used to be three hand-rolled selector maps + ad-hoc error-data
6
+ * extraction scattered across diamond-hands-sdk.ts. The extraction probes EVERY
7
+ * nesting ethers v6 uses across provider types — notably `info.error.data`, which
8
+ * `BrowserProvider` (MetaMask) uses and the older per-site extractors missed, so a
9
+ * browser-provider DeadZoneViolation could slip through undetected and wrongly throw.
10
+ */
11
+ /** `DeadZoneViolation()` selector — the stale-latest-block artifact we tolerate. */
12
+ export declare const DEAD_ZONE_VIOLATION_SELECTOR = "0xbe4b82c1";
13
+ /**
14
+ * Union of the custom-error selectors the mint/payment/quantum paths decode. Keep in
15
+ * sync with OperationAuthorizationRegistry / PositionManager / LoanOperationsManager.
16
+ */
17
+ export declare const QUANTUM_REVERT_NAMES: Record<string, string>;
18
+ export interface DecodedRevert {
19
+ /** Raw revert data (`0x…`) if any provider nesting carried it, else null. */
20
+ data: string | null;
21
+ /** 4-byte custom-error selector (`0x…`) if the data is a valid custom error. */
22
+ selector: string | null;
23
+ /** Human-readable error name if the selector is known, else null. */
24
+ name: string | null;
25
+ }
26
+ /**
27
+ * Extract the revert data / custom-error selector / known name from an ethers error,
28
+ * probing every provider nesting (JsonRpc, Browser/MetaMask, wrapped `error.error`).
29
+ */
30
+ export declare function decodeQuantumRevert(e: any): DecodedRevert;
31
+ /** True iff the error decodes to `DeadZoneViolation()` from any provider nesting. */
32
+ export declare function isDeadZoneViolation(e: any): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.298",
3
+ "version": "0.0.300",
4
4
  "description": "TypeScript SDK for Diamond Hands Protocol - Bitcoin-backed lending with LIT Protocol PKPs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",