@oddmaki-protocol/sdk 1.10.1 → 1.11.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/dist/index.d.mts CHANGED
@@ -9650,6 +9650,18 @@ declare class PriceMarketModule extends BaseModule {
9650
9650
  * Get the Pyth contract address configured on the Diamond
9651
9651
  */
9652
9652
  getPythContract(): Promise<Address>;
9653
+ /**
9654
+ * Mark a stuck price market as Invalid and refund holders 50/50 via the CTF.
9655
+ * Permissionless: anyone can call this once `closeTime + 7 days` has elapsed.
9656
+ *
9657
+ * Use this for markets that never resolve via Pyth — e.g. the feed was
9658
+ * deprecated by the publisher, or Hermes had no in-window VAA at closeTime.
9659
+ * Reports payouts `[1, 1]` to the CTF, so every YES and every NO token
9660
+ * redeems for half the underlying collateral.
9661
+ *
9662
+ * Reverts on chain with `GracePeriodNotElapsed` if called too early.
9663
+ */
9664
+ markInvalid(marketId: bigint): Promise<`0x${string}`>;
9653
9665
  /**
9654
9666
  * Set the Pyth oracle contract address. Diamond owner only.
9655
9667
  */
@@ -9731,9 +9743,15 @@ declare class PriceMarketModule extends BaseModule {
9731
9743
  private fetchPythHistoricalParsed;
9732
9744
  private fetchPythHistoricalRaw;
9733
9745
  /**
9734
- * Fetch a Hermes URL with exponential backoff on 429. Returns the response
9735
- * for 2xx, `null` for 404 (treated as "no VAA at this timestamp, try
9736
- * another"), and throws for other errors.
9746
+ * Fetch a Hermes URL with a short backoff on 429. Returns the response for
9747
+ * 2xx, `null` for 404 (treated as "no VAA at this timestamp, try another"),
9748
+ * and throws on persistent 429 or other non-OK statuses.
9749
+ *
9750
+ * Budget kept intentionally small (2 attempts) so callers that are already
9751
+ * iterating (e.g. multiple sample timestamps in `fetchPythHistoricalRaw`)
9752
+ * don't compound the rate-limit pressure. If Hermes is genuinely rate-
9753
+ * limiting us, retrying within the same request cycle won't help — better
9754
+ * to fail fast and let the caller back off until the next tick.
9737
9755
  */
9738
9756
  private hermesFetchWithBackoff;
9739
9757
  }
package/dist/index.d.ts CHANGED
@@ -9650,6 +9650,18 @@ declare class PriceMarketModule extends BaseModule {
9650
9650
  * Get the Pyth contract address configured on the Diamond
9651
9651
  */
9652
9652
  getPythContract(): Promise<Address>;
9653
+ /**
9654
+ * Mark a stuck price market as Invalid and refund holders 50/50 via the CTF.
9655
+ * Permissionless: anyone can call this once `closeTime + 7 days` has elapsed.
9656
+ *
9657
+ * Use this for markets that never resolve via Pyth — e.g. the feed was
9658
+ * deprecated by the publisher, or Hermes had no in-window VAA at closeTime.
9659
+ * Reports payouts `[1, 1]` to the CTF, so every YES and every NO token
9660
+ * redeems for half the underlying collateral.
9661
+ *
9662
+ * Reverts on chain with `GracePeriodNotElapsed` if called too early.
9663
+ */
9664
+ markInvalid(marketId: bigint): Promise<`0x${string}`>;
9653
9665
  /**
9654
9666
  * Set the Pyth oracle contract address. Diamond owner only.
9655
9667
  */
@@ -9731,9 +9743,15 @@ declare class PriceMarketModule extends BaseModule {
9731
9743
  private fetchPythHistoricalParsed;
9732
9744
  private fetchPythHistoricalRaw;
9733
9745
  /**
9734
- * Fetch a Hermes URL with exponential backoff on 429. Returns the response
9735
- * for 2xx, `null` for 404 (treated as "no VAA at this timestamp, try
9736
- * another"), and throws for other errors.
9746
+ * Fetch a Hermes URL with a short backoff on 429. Returns the response for
9747
+ * 2xx, `null` for 404 (treated as "no VAA at this timestamp, try another"),
9748
+ * and throws on persistent 429 or other non-OK statuses.
9749
+ *
9750
+ * Budget kept intentionally small (2 attempts) so callers that are already
9751
+ * iterating (e.g. multiple sample timestamps in `fetchPythHistoricalRaw`)
9752
+ * don't compound the rate-limit pressure. If Hermes is genuinely rate-
9753
+ * limiting us, retrying within the same request cycle won't help — better
9754
+ * to fail fast and let the caller back off until the next tick.
9737
9755
  */
9738
9756
  private hermesFetchWithBackoff;
9739
9757
  }
package/dist/index.js CHANGED
@@ -11665,6 +11665,29 @@ var PriceMarketModule = class extends BaseModule {
11665
11665
  functionName: "getPythContract"
11666
11666
  });
11667
11667
  }
11668
+ /**
11669
+ * Mark a stuck price market as Invalid and refund holders 50/50 via the CTF.
11670
+ * Permissionless: anyone can call this once `closeTime + 7 days` has elapsed.
11671
+ *
11672
+ * Use this for markets that never resolve via Pyth — e.g. the feed was
11673
+ * deprecated by the publisher, or Hermes had no in-window VAA at closeTime.
11674
+ * Reports payouts `[1, 1]` to the CTF, so every YES and every NO token
11675
+ * redeems for half the underlying collateral.
11676
+ *
11677
+ * Reverts on chain with `GracePeriodNotElapsed` if called too early.
11678
+ */
11679
+ async markInvalid(marketId) {
11680
+ const wallet = this.walletClient;
11681
+ const account = await this.getSignerAccount();
11682
+ const { request } = await this.publicClient.simulateContract({
11683
+ address: this.config.diamondAddress,
11684
+ abi: PythResolutionFacet_default,
11685
+ functionName: "markPriceMarketInvalid",
11686
+ args: [marketId],
11687
+ account
11688
+ });
11689
+ return wallet.writeContract(request);
11690
+ }
11668
11691
  /**
11669
11692
  * Set the Pyth oracle contract address. Diamond owner only.
11670
11693
  */
@@ -11890,13 +11913,19 @@ var PriceMarketModule = class extends BaseModule {
11890
11913
  return null;
11891
11914
  }
11892
11915
  /**
11893
- * Fetch a Hermes URL with exponential backoff on 429. Returns the response
11894
- * for 2xx, `null` for 404 (treated as "no VAA at this timestamp, try
11895
- * another"), and throws for other errors.
11916
+ * Fetch a Hermes URL with a short backoff on 429. Returns the response for
11917
+ * 2xx, `null` for 404 (treated as "no VAA at this timestamp, try another"),
11918
+ * and throws on persistent 429 or other non-OK statuses.
11919
+ *
11920
+ * Budget kept intentionally small (2 attempts) so callers that are already
11921
+ * iterating (e.g. multiple sample timestamps in `fetchPythHistoricalRaw`)
11922
+ * don't compound the rate-limit pressure. If Hermes is genuinely rate-
11923
+ * limiting us, retrying within the same request cycle won't help — better
11924
+ * to fail fast and let the caller back off until the next tick.
11896
11925
  */
11897
11926
  async hermesFetchWithBackoff(url, options = {}) {
11898
- const maxAttempts = options.maxAttempts ?? 4;
11899
- const initialDelayMs = options.initialDelayMs ?? 500;
11927
+ const maxAttempts = options.maxAttempts ?? 2;
11928
+ const initialDelayMs = options.initialDelayMs ?? 750;
11900
11929
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
11901
11930
  const response = await fetch(url);
11902
11931
  if (response.status === 429) {