opencrowd 0.13.3 → 0.13.4
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/bundle/opencrowd.js +15 -4
- package/package.json +1 -1
package/bundle/opencrowd.js
CHANGED
|
@@ -81488,9 +81488,20 @@ var init_hosted_economy = __esm({
|
|
|
81488
81488
|
return this.discovery.inspect(input2);
|
|
81489
81489
|
}
|
|
81490
81490
|
async fetch(request2) {
|
|
81491
|
-
const
|
|
81491
|
+
const theirs = /* @__PURE__ */ new Set([
|
|
81492
|
+
// They answered 402 and sent no payment challenge at all. Nothing to
|
|
81493
|
+
// misparse, and nothing we could have got wrong.
|
|
81494
|
+
"payment_required_header_missing"
|
|
81495
|
+
]);
|
|
81496
|
+
const refuse = (error53, code) => ({
|
|
81497
|
+
ok: false,
|
|
81498
|
+
ambiguous: false,
|
|
81499
|
+
data: void 0,
|
|
81500
|
+
error: error53,
|
|
81501
|
+
...code && theirs.has(code) ? {} : { callerError: true }
|
|
81502
|
+
});
|
|
81492
81503
|
if (!HOSTED_RAILS.includes(request2.rail)) {
|
|
81493
|
-
return refuse(`this service settles on a payment network hosted agents cannot pay; hosted agents pay ${describeRails(HOSTED_RAILS)}
|
|
81504
|
+
return refuse(`this service settles on a payment network hosted agents cannot pay; hosted agents pay ${describeRails(HOSTED_RAILS)}`);
|
|
81494
81505
|
}
|
|
81495
81506
|
const serviceId = await this.directory.resolveServiceId(request2.url) ?? `url:${createHash4("sha256").update(request2.url).digest("hex")}`;
|
|
81496
81507
|
const method = request2.method.toUpperCase();
|
|
@@ -81554,7 +81565,7 @@ var init_hosted_economy = __esm({
|
|
|
81554
81565
|
return this.fetchUnpaid(request2.url, method, body, request2.headers);
|
|
81555
81566
|
}
|
|
81556
81567
|
if (reply.code === "funding_required") {
|
|
81557
|
-
return refuse(`${reply.error ?? "not enough USDC on this service's networks"} (funding_required)${await this.fundingHint(request2)}
|
|
81568
|
+
return refuse(`${reply.error ?? "not enough USDC on this service's networks"} (funding_required)${await this.fundingHint(request2)}`);
|
|
81558
81569
|
}
|
|
81559
81570
|
if (reply.code === "payment_unknown") {
|
|
81560
81571
|
return {
|
|
@@ -81565,7 +81576,7 @@ var init_hosted_economy = __esm({
|
|
|
81565
81576
|
error: timedOut ? `the paid call did not answer within ${Math.round(timeoutMs / 1e3)}s and its stored purchase has no final result yet` : reply.error ?? "the supervisor could not determine whether the payment settled"
|
|
81566
81577
|
};
|
|
81567
81578
|
}
|
|
81568
|
-
return refuse(reply.code ? `${reply.error ?? "payment refused"} (${reply.code})` : reply.error ?? "payment refused");
|
|
81579
|
+
return refuse(reply.code ? `${reply.error ?? "payment refused"} (${reply.code})` : reply.error ?? "payment refused", reply.code);
|
|
81569
81580
|
}
|
|
81570
81581
|
/**
|
|
81571
81582
|
* Re-post the same purchase once. A finished attempt replays from the ledger;
|
package/package.json
CHANGED