@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 +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +34 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11664,6 +11664,29 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
11664
11664
|
functionName: "getPythContract"
|
|
11665
11665
|
});
|
|
11666
11666
|
}
|
|
11667
|
+
/**
|
|
11668
|
+
* Mark a stuck price market as Invalid and refund holders 50/50 via the CTF.
|
|
11669
|
+
* Permissionless: anyone can call this once `closeTime + 7 days` has elapsed.
|
|
11670
|
+
*
|
|
11671
|
+
* Use this for markets that never resolve via Pyth — e.g. the feed was
|
|
11672
|
+
* deprecated by the publisher, or Hermes had no in-window VAA at closeTime.
|
|
11673
|
+
* Reports payouts `[1, 1]` to the CTF, so every YES and every NO token
|
|
11674
|
+
* redeems for half the underlying collateral.
|
|
11675
|
+
*
|
|
11676
|
+
* Reverts on chain with `GracePeriodNotElapsed` if called too early.
|
|
11677
|
+
*/
|
|
11678
|
+
async markInvalid(marketId) {
|
|
11679
|
+
const wallet = this.walletClient;
|
|
11680
|
+
const account = await this.getSignerAccount();
|
|
11681
|
+
const { request } = await this.publicClient.simulateContract({
|
|
11682
|
+
address: this.config.diamondAddress,
|
|
11683
|
+
abi: PythResolutionFacet_default,
|
|
11684
|
+
functionName: "markPriceMarketInvalid",
|
|
11685
|
+
args: [marketId],
|
|
11686
|
+
account
|
|
11687
|
+
});
|
|
11688
|
+
return wallet.writeContract(request);
|
|
11689
|
+
}
|
|
11667
11690
|
/**
|
|
11668
11691
|
* Set the Pyth oracle contract address. Diamond owner only.
|
|
11669
11692
|
*/
|
|
@@ -11889,13 +11912,19 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
11889
11912
|
return null;
|
|
11890
11913
|
}
|
|
11891
11914
|
/**
|
|
11892
|
-
* Fetch a Hermes URL with
|
|
11893
|
-
*
|
|
11894
|
-
*
|
|
11915
|
+
* Fetch a Hermes URL with a short backoff on 429. Returns the response for
|
|
11916
|
+
* 2xx, `null` for 404 (treated as "no VAA at this timestamp, try another"),
|
|
11917
|
+
* and throws on persistent 429 or other non-OK statuses.
|
|
11918
|
+
*
|
|
11919
|
+
* Budget kept intentionally small (2 attempts) so callers that are already
|
|
11920
|
+
* iterating (e.g. multiple sample timestamps in `fetchPythHistoricalRaw`)
|
|
11921
|
+
* don't compound the rate-limit pressure. If Hermes is genuinely rate-
|
|
11922
|
+
* limiting us, retrying within the same request cycle won't help — better
|
|
11923
|
+
* to fail fast and let the caller back off until the next tick.
|
|
11895
11924
|
*/
|
|
11896
11925
|
async hermesFetchWithBackoff(url, options = {}) {
|
|
11897
|
-
const maxAttempts = options.maxAttempts ??
|
|
11898
|
-
const initialDelayMs = options.initialDelayMs ??
|
|
11926
|
+
const maxAttempts = options.maxAttempts ?? 2;
|
|
11927
|
+
const initialDelayMs = options.initialDelayMs ?? 750;
|
|
11899
11928
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
11900
11929
|
const response = await fetch(url);
|
|
11901
11930
|
if (response.status === 429) {
|