@zkp2p/cash 0.1.2 → 0.1.3
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/AGENTS.md +3 -2
- package/README.md +3 -1
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/skills/peer-cash-integration/SKILL.md +3 -2
package/dist/index.js
CHANGED
|
@@ -429,9 +429,10 @@ function buildCapabilities(environment) {
|
|
|
429
429
|
pricing: { kind: "oracle-market-rate", spreadBps: 0 }
|
|
430
430
|
};
|
|
431
431
|
}
|
|
432
|
-
var ETA_WINDOW_DAYS =
|
|
432
|
+
var ETA_WINDOW_DAYS = 30;
|
|
433
433
|
var ETA_WINDOW_SECONDS = ETA_WINDOW_DAYS * 24 * 60 * 60;
|
|
434
|
-
var
|
|
434
|
+
var ETA_PAGE_LIMIT = 250;
|
|
435
|
+
var ETA_MAX_DEPOSIT_SCAN = 2e3;
|
|
435
436
|
var FULFILLED = /* @__PURE__ */ new Set(["FULFILLED", "MANUALLY_RELEASED"]);
|
|
436
437
|
function toUnixSeconds2(value) {
|
|
437
438
|
if (value === null || value === void 0 || value === "") return void 0;
|
|
@@ -466,19 +467,27 @@ function matchesPayout(deposit, environment, platform, currency) {
|
|
|
466
467
|
deposit.currencies ?? [],
|
|
467
468
|
getPaymentMethodsCatalog(BASE_CHAIN_ID, environment)
|
|
468
469
|
);
|
|
469
|
-
if (payouts.length === 0) return true;
|
|
470
470
|
return payouts.some(
|
|
471
|
-
(payout) => (platform === void 0 || payout.platform === platform) && (currency === void 0 || payout.currency === currency)
|
|
471
|
+
(payout) => payout.pricing.marketRate && payout.pricing.spreadBps === 0 && (platform === void 0 || payout.platform === platform) && (currency === void 0 || payout.currency === currency)
|
|
472
472
|
);
|
|
473
473
|
}
|
|
474
474
|
async function readFillEta(client, input) {
|
|
475
475
|
const now = Math.floor(Date.now() / 1e3);
|
|
476
476
|
const windowStart = now - ETA_WINDOW_SECONDS;
|
|
477
|
-
const deposits =
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
477
|
+
const deposits = [];
|
|
478
|
+
for (let offset = 0; offset < ETA_MAX_DEPOSIT_SCAN; offset += ETA_PAGE_LIMIT) {
|
|
479
|
+
const page = await client.indexer.getDepositsWithRelations(
|
|
480
|
+
{ chainId: BASE_CHAIN_ID },
|
|
481
|
+
{ limit: ETA_PAGE_LIMIT, offset, orderBy: "timestamp", orderDirection: "desc" },
|
|
482
|
+
{ includeIntents: true, intentStatuses: ["FULFILLED", "MANUALLY_RELEASED"] }
|
|
483
|
+
);
|
|
484
|
+
deposits.push(...page);
|
|
485
|
+
if (page.length < ETA_PAGE_LIMIT) break;
|
|
486
|
+
const oldestCreatedAt = Math.min(
|
|
487
|
+
...page.map((deposit) => toUnixSeconds2(deposit.createdAt ?? deposit.timestamp) ?? Infinity)
|
|
488
|
+
);
|
|
489
|
+
if (oldestCreatedAt < windowStart) break;
|
|
490
|
+
}
|
|
482
491
|
const firstFillLatencies = [];
|
|
483
492
|
for (const deposit of deposits) {
|
|
484
493
|
const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
|