@haven_ai/sdk 0.0.0-dev.202609171245.99e72cd → 0.0.0-dev.202609180723.d49b927
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.cjs +40 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3079,7 +3079,18 @@ function mapCatalogEntry(entry) {
|
|
|
3079
3079
|
verifiedAt: entry.verified_at,
|
|
3080
3080
|
source: entry.source,
|
|
3081
3081
|
domainVerified: entry.domain_verified,
|
|
3082
|
-
verifiedPayable: entry.verified_payable
|
|
3082
|
+
verifiedPayable: entry.verified_payable,
|
|
3083
|
+
// #3078: absent (older backend) or null (unresolved join) both mean "no
|
|
3084
|
+
// merchant known" — the public field is then absent, never null.
|
|
3085
|
+
...entry.merchant ? {
|
|
3086
|
+
merchant: {
|
|
3087
|
+
id: entry.merchant.id,
|
|
3088
|
+
slug: entry.merchant.slug,
|
|
3089
|
+
name: entry.merchant.name,
|
|
3090
|
+
listingStatus: entry.merchant.listing_status,
|
|
3091
|
+
isTestMerchant: entry.merchant.is_test_merchant
|
|
3092
|
+
}
|
|
3093
|
+
} : {}
|
|
3083
3094
|
};
|
|
3084
3095
|
}
|
|
3085
3096
|
var HavenClient = class {
|
|
@@ -3461,6 +3472,34 @@ var HavenClient = class {
|
|
|
3461
3472
|
async getAllowances() {
|
|
3462
3473
|
return this.accountReads.getAllowances();
|
|
3463
3474
|
}
|
|
3475
|
+
/**
|
|
3476
|
+
* `POST /machine-payments/budget-precheck` (#3054): ask Haven to decide —
|
|
3477
|
+
* server-side — whether `amountAtomic` of `token` fits the agent's
|
|
3478
|
+
* remaining delegation budget, the same compare the guided prepare used to
|
|
3479
|
+
* run locally over its allowances read.
|
|
3480
|
+
*
|
|
3481
|
+
* On insufficiency Haven refuses (403, `delegation_budget_exceeded`) and
|
|
3482
|
+
* the refusal reaches the `payment_refusals` ledger with
|
|
3483
|
+
* `source: 'hosted_prepare'` — the point of the endpoint. This method
|
|
3484
|
+
* surfaces that decision as a thrown {@link HavenApiError}; it does NOT
|
|
3485
|
+
* swallow it, because swallowing would turn a decided refusal into the
|
|
3486
|
+
* degrade-to-warning path and the ledger row would still land while the
|
|
3487
|
+
* purchase proceeded.
|
|
3488
|
+
*
|
|
3489
|
+
* camelCase body like the route family; the response mirrors the wire
|
|
3490
|
+
* (`sufficient`, `remaining_atomic`). `resourceUrl` is the merchant
|
|
3491
|
+
* resource being bought — the ledger dedupe window's discriminating
|
|
3492
|
+
* column — never this request's own URL.
|
|
3493
|
+
*/
|
|
3494
|
+
async precheckBudget(input) {
|
|
3495
|
+
return this.post("/machine-payments/budget-precheck", {
|
|
3496
|
+
chainId: input.chainId,
|
|
3497
|
+
token: input.token,
|
|
3498
|
+
amountAtomic: input.amountAtomic,
|
|
3499
|
+
...input.merchantTo !== void 0 ? { merchantTo: input.merchantTo } : {},
|
|
3500
|
+
...input.resourceUrl !== void 0 ? { resourceUrl: input.resourceUrl } : {}
|
|
3501
|
+
});
|
|
3502
|
+
}
|
|
3464
3503
|
/**
|
|
3465
3504
|
* Post-purchase allowance/budget summary for a settled payment (#1310).
|
|
3466
3505
|
*
|