mtok-relay 0.1.9 → 0.1.10
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/mtok-relay.mjs +14 -8
- package/package.json +1 -1
package/dist/mtok-relay.mjs
CHANGED
|
@@ -5090,16 +5090,22 @@ function createOnchainVerifier({
|
|
|
5090
5090
|
const maxAge = Number(maxPaidAgeMs);
|
|
5091
5091
|
if (Number.isFinite(maxAge) && maxAge > 0) {
|
|
5092
5092
|
const bn = matchedLog?.blockNumber;
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
try {
|
|
5093
|
+
let paidAtMs = null;
|
|
5094
|
+
if (bn != null) {
|
|
5096
5095
|
const blockTag = typeof bn === "string" && bn.startsWith("0x") ? bn : "0x" + BigInt(bn).toString(16);
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5096
|
+
for (let i = 0; i <= receiptRetries; i++) {
|
|
5097
|
+
try {
|
|
5098
|
+
const block = await rpc("eth_getBlockByNumber", [blockTag, false]);
|
|
5099
|
+
if (block?.timestamp != null) {
|
|
5100
|
+
paidAtMs = Number(BigInt(block.timestamp)) * 1e3;
|
|
5101
|
+
break;
|
|
5102
|
+
}
|
|
5103
|
+
} catch {
|
|
5104
|
+
}
|
|
5105
|
+
if (i < receiptRetries) await sleepImpl(receiptRetryMs);
|
|
5106
|
+
}
|
|
5101
5107
|
}
|
|
5102
|
-
if (nowMs() - paidAtMs > maxAge) return { ok: false, reason: "payment_too_old" };
|
|
5108
|
+
if (paidAtMs != null && nowMs() - paidAtMs > maxAge) return { ok: false, reason: "payment_too_old" };
|
|
5103
5109
|
}
|
|
5104
5110
|
const consumed = /* @__PURE__ */ new Set();
|
|
5105
5111
|
let sellerTransfer = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mtok-relay",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Reference seller relay for mtok.market — accepts on-chain-prepaid chunk draws and serves inference from an upstream you control. Run with: npx mtok-relay --offer <id> --model <id> --upstream <url>.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|