@haven_ai/sdk 0.1.23-alpha.0 → 0.1.23-alpha.2
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/README.md +8 -6
- package/dist/index.cjs +30 -519
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -154
- package/dist/index.d.ts +16 -154
- package/dist/index.js +31 -516
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -701,73 +701,6 @@ function stableStringify(value) {
|
|
|
701
701
|
const object = value;
|
|
702
702
|
return `{${Object.keys(object).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(object[key])}`).join(",")}}`;
|
|
703
703
|
}
|
|
704
|
-
function normalizeChallenge(value) {
|
|
705
|
-
const candidate = value;
|
|
706
|
-
if (!candidate || typeof candidate !== "object" || candidate.rail !== "mpp_demo" || typeof candidate.version !== "string" || typeof candidate.challengeId !== "string" || typeof candidate.resource !== "string" || typeof candidate.description !== "string" || // TODO: relax these checks when non-demo machine payment rails are added.
|
|
707
|
-
candidate.network?.chainId !== 8453 || candidate.network?.name !== "base" || candidate.asset?.symbol !== "USDC" || typeof candidate.asset?.address !== "string" || candidate.asset.decimals !== 6 || typeof candidate.amount?.display !== "string" || typeof candidate.amount?.atomic !== "string" || typeof candidate.recipient !== "string" || typeof candidate.expiresAt !== "string") {
|
|
708
|
-
return null;
|
|
709
|
-
}
|
|
710
|
-
return {
|
|
711
|
-
rail: candidate.rail,
|
|
712
|
-
version: candidate.version,
|
|
713
|
-
challengeId: candidate.challengeId,
|
|
714
|
-
resource: candidate.resource,
|
|
715
|
-
description: candidate.description,
|
|
716
|
-
network: candidate.network,
|
|
717
|
-
asset: candidate.asset,
|
|
718
|
-
amount: candidate.amount,
|
|
719
|
-
recipient: candidate.recipient,
|
|
720
|
-
expiresAt: candidate.expiresAt,
|
|
721
|
-
metadata: candidate.metadata
|
|
722
|
-
};
|
|
723
|
-
}
|
|
724
|
-
function parseMachinePaymentChallenge(response) {
|
|
725
|
-
const header = response.headers.get("MACHINE-PAYMENT-CHALLENGE");
|
|
726
|
-
if (!header) {
|
|
727
|
-
throw new Error("No MACHINE-PAYMENT-CHALLENGE header found in 402 response.");
|
|
728
|
-
}
|
|
729
|
-
const parsed = normalizeChallenge(
|
|
730
|
-
decodeBase64Json(header, "MACHINE-PAYMENT-CHALLENGE header")
|
|
731
|
-
);
|
|
732
|
-
if (!parsed) throw new Error("Invalid machine payment challenge");
|
|
733
|
-
return parsed;
|
|
734
|
-
}
|
|
735
|
-
async function parseMachinePaymentChallengeResponse(response) {
|
|
736
|
-
try {
|
|
737
|
-
return parseMachinePaymentChallenge(response);
|
|
738
|
-
} catch (headerErr) {
|
|
739
|
-
try {
|
|
740
|
-
const body = await response.clone().json();
|
|
741
|
-
const parsed = normalizeChallenge(body.challenge);
|
|
742
|
-
if (parsed) return parsed;
|
|
743
|
-
} catch {
|
|
744
|
-
}
|
|
745
|
-
throw headerErr;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
function buildMachinePaymentIdempotencyKey(challenge) {
|
|
749
|
-
const material = [
|
|
750
|
-
challenge.rail,
|
|
751
|
-
challenge.challengeId,
|
|
752
|
-
challenge.resource,
|
|
753
|
-
challenge.recipient.toLowerCase(),
|
|
754
|
-
challenge.asset.address.toLowerCase(),
|
|
755
|
-
challenge.amount.atomic,
|
|
756
|
-
challenge.network.chainId
|
|
757
|
-
].join("|");
|
|
758
|
-
return `${challenge.rail}:${createHash("sha256").update(material).digest("hex").slice(0, 16)}`;
|
|
759
|
-
}
|
|
760
|
-
function encodeMachinePaymentProof(receipt) {
|
|
761
|
-
return encodeBase64Json({
|
|
762
|
-
rail: receipt.rail,
|
|
763
|
-
challengeId: receipt.challengeId,
|
|
764
|
-
paymentId: receipt.paymentId,
|
|
765
|
-
txHash: receipt.txHash,
|
|
766
|
-
settledVia: "haven",
|
|
767
|
-
payer: receipt.payer,
|
|
768
|
-
chainId: receipt.chainId
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
704
|
function createJsonRpcProvider(url) {
|
|
772
705
|
return new ethers.JsonRpcProvider(url);
|
|
773
706
|
}
|
|
@@ -888,9 +821,6 @@ function messageForState(label, status, paymentId, nextAction) {
|
|
|
888
821
|
function sameAddress(a, b) {
|
|
889
822
|
return Boolean(a && b && a.toLowerCase() === b.toLowerCase());
|
|
890
823
|
}
|
|
891
|
-
function isMppRail(rail) {
|
|
892
|
-
return rail === "mpp" || Boolean(rail?.startsWith("mpp_"));
|
|
893
|
-
}
|
|
894
824
|
function decimalFromUsdcAtomic(value) {
|
|
895
825
|
const amount = BigInt(value);
|
|
896
826
|
const whole = amount / 1000000n;
|
|
@@ -992,7 +922,6 @@ var HavenClient = class {
|
|
|
992
922
|
chainRpcs;
|
|
993
923
|
inFlightX402 = /* @__PURE__ */ new Map();
|
|
994
924
|
x402ReceiptCache = /* @__PURE__ */ new Map();
|
|
995
|
-
inFlightMachinePayments = /* @__PURE__ */ new Map();
|
|
996
925
|
/**
|
|
997
926
|
* Setup-time headers configured via `HavenClientConfig.defaultHeaders`.
|
|
998
927
|
* Read-only after construction — use `withRequestContext` for per-call
|
|
@@ -1606,10 +1535,11 @@ var HavenClient = class {
|
|
|
1606
1535
|
return { receipt, verification: verifyPaymentReceipt(receipt) };
|
|
1607
1536
|
}
|
|
1608
1537
|
/**
|
|
1609
|
-
* Rehydrate the x402
|
|
1538
|
+
* Rehydrate the x402 resume-state bundle for a payment id (#1328: the MPP
|
|
1539
|
+
* resume-state variant retired along with the rest of the mpp_demo surface).
|
|
1610
1540
|
*
|
|
1611
1541
|
* The server returns stored protocol context only. The client still signs the
|
|
1612
|
-
* merchant proof locally when resumeX402Payment()
|
|
1542
|
+
* merchant proof locally when resumeX402Payment() runs.
|
|
1613
1543
|
*/
|
|
1614
1544
|
async getResumeState(paymentId) {
|
|
1615
1545
|
return this.get(`/payments/${paymentId}/resume_state`);
|
|
@@ -1880,22 +1810,11 @@ var HavenClient = class {
|
|
|
1880
1810
|
if (response.status !== 402) {
|
|
1881
1811
|
return mcpSessionId ? this.surfaceMcpResult(response) : response;
|
|
1882
1812
|
}
|
|
1883
|
-
const machineChallengeHeader = response.headers.get("MACHINE-PAYMENT-CHALLENGE");
|
|
1884
|
-
if (machineChallengeHeader) {
|
|
1885
|
-
const challenge = await parseMachinePaymentChallengeResponse(response);
|
|
1886
|
-
return this.fetchWithMachinePayment(url, requestInit, challenge);
|
|
1887
|
-
}
|
|
1888
1813
|
let paymentRequired;
|
|
1889
1814
|
try {
|
|
1890
1815
|
paymentRequired = await parsePaymentRequiredResponse(response);
|
|
1891
1816
|
} catch {
|
|
1892
|
-
|
|
1893
|
-
try {
|
|
1894
|
-
challenge = await parseMachinePaymentChallengeResponse(response);
|
|
1895
|
-
} catch {
|
|
1896
|
-
return response;
|
|
1897
|
-
}
|
|
1898
|
-
return this.fetchWithMachinePayment(url, requestInit, challenge);
|
|
1817
|
+
return response;
|
|
1899
1818
|
}
|
|
1900
1819
|
if (!mcpSessionId && await responseHasBazaarExtension(response)) {
|
|
1901
1820
|
mcpSessionId = await this.mcpInitialize(url, init);
|
|
@@ -2038,49 +1957,6 @@ var HavenClient = class {
|
|
|
2038
1957
|
headers
|
|
2039
1958
|
});
|
|
2040
1959
|
}
|
|
2041
|
-
/**
|
|
2042
|
-
* Probe a paid MPP endpoint or inspect an existing challenge without creating
|
|
2043
|
-
* a Haven payment or approval request.
|
|
2044
|
-
*/
|
|
2045
|
-
async quoteMpp(challengeOrUrl, init, options = {}) {
|
|
2046
|
-
if (typeof challengeOrUrl !== "string") {
|
|
2047
|
-
const request2 = this.snapshotX402Request(challengeOrUrl.resource, init);
|
|
2048
|
-
return this.buildMppQuote(challengeOrUrl, request2, options.idempotencyKey);
|
|
2049
|
-
}
|
|
2050
|
-
const request = this.snapshotX402Request(challengeOrUrl, init);
|
|
2051
|
-
const response = await this.merchantFetch(challengeOrUrl, init);
|
|
2052
|
-
if (response.status !== 402) {
|
|
2053
|
-
throw new HavenApiError(
|
|
2054
|
-
`Expected an MPP quote response with HTTP 402, got HTTP ${response.status}.`,
|
|
2055
|
-
response.status || 400
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
const challenge = await parseMachinePaymentChallengeResponse(response);
|
|
2059
|
-
return this.buildMppQuote(challenge, request, options.idempotencyKey);
|
|
2060
|
-
}
|
|
2061
|
-
/**
|
|
2062
|
-
* Pay a previously inspected MPP quote and retry the exact captured request.
|
|
2063
|
-
*/
|
|
2064
|
-
async payMppChallenge(quote, options = {}) {
|
|
2065
|
-
const idempotencyKey = options.idempotencyKey ?? quote.idempotencyKey;
|
|
2066
|
-
try {
|
|
2067
|
-
const receipt = await this.authorizeMachinePayment(quote.challenge, { idempotencyKey });
|
|
2068
|
-
return this.retryMppRequest(
|
|
2069
|
-
quote.request.url,
|
|
2070
|
-
this.requestInitFromSnapshot(quote.request),
|
|
2071
|
-
quote.challenge,
|
|
2072
|
-
receipt
|
|
2073
|
-
);
|
|
2074
|
-
} catch (err) {
|
|
2075
|
-
this.attachResumeState(err, {
|
|
2076
|
-
rail: "mpp",
|
|
2077
|
-
challenge: quote.challenge,
|
|
2078
|
-
idempotencyKey,
|
|
2079
|
-
request: quote.request
|
|
2080
|
-
});
|
|
2081
|
-
throw err;
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
1960
|
async retryX402Request(url, initialInit, paymentRequired, receipt) {
|
|
2085
1961
|
if (!receipt.accepted) {
|
|
2086
1962
|
throw new HavenApiError("No accepted x402 option was recorded for payment retry", 500);
|
|
@@ -2345,151 +2221,13 @@ var HavenClient = class {
|
|
|
2345
2221
|
return void 0;
|
|
2346
2222
|
}
|
|
2347
2223
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
throw new HavenApiError(`Unsupported machine payment rail: ${challenge.rail}`, 400);
|
|
2356
|
-
}
|
|
2357
|
-
const idempotencyKey = options.idempotencyKey ?? buildMachinePaymentIdempotencyKey(challenge);
|
|
2358
|
-
const inFlight = this.inFlightMachinePayments.get(idempotencyKey);
|
|
2359
|
-
if (inFlight) return inFlight;
|
|
2360
|
-
const promise = this.authorizeMppDemoPayment(challenge, idempotencyKey);
|
|
2361
|
-
this.inFlightMachinePayments.set(idempotencyKey, promise);
|
|
2362
|
-
try {
|
|
2363
|
-
return await promise;
|
|
2364
|
-
} catch (err) {
|
|
2365
|
-
this.attachResumeState(err, {
|
|
2366
|
-
rail: "mpp",
|
|
2367
|
-
challenge,
|
|
2368
|
-
idempotencyKey
|
|
2369
|
-
});
|
|
2370
|
-
throw err;
|
|
2371
|
-
} finally {
|
|
2372
|
-
this.inFlightMachinePayments.delete(idempotencyKey);
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
async authorizeMppDemoPayment(challenge, idempotencyKey) {
|
|
2376
|
-
const raw = await this.post(
|
|
2377
|
-
"/machine-payments/authorize",
|
|
2378
|
-
{ challenge, idempotencyKey }
|
|
2379
|
-
);
|
|
2380
|
-
if (raw.success && raw.tx_hash) {
|
|
2381
|
-
return this.mapMachinePaymentReceipt(challenge, raw, raw.tx_hash);
|
|
2382
|
-
}
|
|
2383
|
-
this.throwIfNonSignableAuthorizationState("Machine payment", raw);
|
|
2384
|
-
if (!raw.sign_data?.hash) {
|
|
2385
|
-
throw new HavenApiError("No sign_hash returned from machine payment authorization", 500, raw);
|
|
2386
|
-
}
|
|
2387
|
-
const sig = await this.signForData(raw.sign_data);
|
|
2388
|
-
const execResult = await this.post(
|
|
2389
|
-
`/payments/${raw.payment_id}/sign`,
|
|
2390
|
-
{ signature: sig }
|
|
2391
|
-
);
|
|
2392
|
-
if (execResult.status !== "confirmed" || !execResult.tx_hash) {
|
|
2393
|
-
this.throwPaymentStateError("Machine payment", execResult);
|
|
2394
|
-
}
|
|
2395
|
-
return this.mapMachinePaymentReceipt(challenge, raw, execResult.tx_hash, execResult);
|
|
2396
|
-
}
|
|
2397
|
-
async resumeAuthorizedMpp(input) {
|
|
2398
|
-
if (!this.delegateKey) {
|
|
2399
|
-
throw new HavenSigningError(
|
|
2400
|
-
"delegateKey is required for machine payments. Pass it in the HavenClient config."
|
|
2401
|
-
);
|
|
2402
|
-
}
|
|
2403
|
-
const status = await this.getPaymentStatus(input.paymentId);
|
|
2404
|
-
this.assertCanResumeMpp(status, input.challenge);
|
|
2405
|
-
return this.mapMachinePaymentReceiptFromStatus(input.challenge, status);
|
|
2406
|
-
}
|
|
2407
|
-
async resumeMppPayment(input) {
|
|
2408
|
-
const inputInit = "init" in input ? input.init : void 0;
|
|
2409
|
-
const initialInit = inputInit ?? (input.request ? this.requestInitFromSnapshot(input.request) : void 0);
|
|
2410
|
-
let challenge = input.challenge;
|
|
2411
|
-
const url = input.url ?? input.request?.url;
|
|
2412
|
-
if (!challenge) {
|
|
2413
|
-
if (!url) {
|
|
2414
|
-
throw new HavenApiError("MPP resume requires the original URL or a captured request snapshot.", 400);
|
|
2415
|
-
}
|
|
2416
|
-
const response = await this.merchantFetch(url, initialInit);
|
|
2417
|
-
if (response.status !== 402) {
|
|
2418
|
-
throw new HavenApiError("Expected the original MPP request to return HTTP 402 before resuming.", 400);
|
|
2419
|
-
}
|
|
2420
|
-
challenge = await parseMachinePaymentChallengeResponse(response);
|
|
2421
|
-
}
|
|
2422
|
-
const receipt = await this.resumeAuthorizedMpp({
|
|
2423
|
-
paymentId: input.paymentId,
|
|
2424
|
-
challenge,
|
|
2425
|
-
idempotencyKey: input.idempotencyKey
|
|
2426
|
-
});
|
|
2427
|
-
return this.retryMppRequest(url ?? challenge.resource, initialInit, challenge, receipt);
|
|
2428
|
-
}
|
|
2429
|
-
async fetchWithMachinePayment(url, initialInit, challenge) {
|
|
2430
|
-
const request = this.snapshotX402Request(url, initialInit);
|
|
2431
|
-
const idempotencyKey = buildMachinePaymentIdempotencyKey(challenge);
|
|
2432
|
-
let receipt;
|
|
2433
|
-
try {
|
|
2434
|
-
receipt = await this.authorizeMachinePayment(challenge, { idempotencyKey });
|
|
2435
|
-
} catch (err) {
|
|
2436
|
-
this.attachResumeState(err, {
|
|
2437
|
-
rail: "mpp",
|
|
2438
|
-
challenge,
|
|
2439
|
-
idempotencyKey,
|
|
2440
|
-
request
|
|
2441
|
-
});
|
|
2442
|
-
throw err;
|
|
2443
|
-
}
|
|
2444
|
-
return this.retryMppRequest(url, initialInit, challenge, receipt);
|
|
2445
|
-
}
|
|
2446
|
-
async retryMppRequest(url, initialInit, challenge, receipt) {
|
|
2447
|
-
const retryHeaders = new Headers(initialInit?.headers);
|
|
2448
|
-
retryHeaders.set("MACHINE-PAYMENT-PROOF", receipt.proofHeader);
|
|
2449
|
-
const retryResponse = await this.merchantFetch(url, {
|
|
2450
|
-
...initialInit,
|
|
2451
|
-
headers: retryHeaders
|
|
2452
|
-
});
|
|
2453
|
-
if (!retryResponse.ok) {
|
|
2454
|
-
const merchant = await captureMerchantResponse(retryResponse);
|
|
2455
|
-
await this.recordMerchantRetryRejected({
|
|
2456
|
-
rail: receipt.rail,
|
|
2457
|
-
paymentId: receipt.paymentId,
|
|
2458
|
-
txHash: receipt.txHash,
|
|
2459
|
-
resourceUrl: receipt.resourceUrl,
|
|
2460
|
-
merchant,
|
|
2461
|
-
details: {
|
|
2462
|
-
challenge_id: receipt.challengeId
|
|
2463
|
-
}
|
|
2464
|
-
});
|
|
2465
|
-
throw new HavenApiError(
|
|
2466
|
-
"Machine payment retry failed after Haven sent the payment.",
|
|
2467
|
-
merchant.merchant_status,
|
|
2468
|
-
{
|
|
2469
|
-
marker: "machine_payment_retry_rejected_after_payment",
|
|
2470
|
-
payment_id: receipt.paymentId,
|
|
2471
|
-
tx_hash: receipt.txHash,
|
|
2472
|
-
resource_url: receipt.resourceUrl,
|
|
2473
|
-
rail: receipt.rail,
|
|
2474
|
-
...merchant
|
|
2475
|
-
}
|
|
2476
|
-
);
|
|
2477
|
-
}
|
|
2478
|
-
await this.reportMachinePaymentEvidence({
|
|
2479
|
-
paymentId: receipt.paymentId,
|
|
2480
|
-
rail: receipt.rail,
|
|
2481
|
-
txHash: receipt.txHash,
|
|
2482
|
-
resourceUrl: receipt.resourceUrl,
|
|
2483
|
-
merchantStatus: retryResponse.status,
|
|
2484
|
-
challengePayload: challenge,
|
|
2485
|
-
paymentProofHeaderName: "MACHINE-PAYMENT-PROOF",
|
|
2486
|
-
paymentProofHeader: receipt.proofHeader,
|
|
2487
|
-
protocolReceiptHeaderName: retryResponse.headers.has("Payment-Receipt") ? "Payment-Receipt" : retryResponse.headers.has("MACHINE-PAYMENT-RESPONSE") ? "MACHINE-PAYMENT-RESPONSE" : void 0,
|
|
2488
|
-
protocolReceiptHeader: retryResponse.headers.get("Payment-Receipt") ?? retryResponse.headers.get("MACHINE-PAYMENT-RESPONSE") ?? void 0
|
|
2489
|
-
});
|
|
2490
|
-
await this.reportMerchantReceipt(receipt.paymentId, retryResponse);
|
|
2491
|
-
return retryResponse;
|
|
2492
|
-
}
|
|
2224
|
+
// #1328: authorizeMachinePayment / authorizeMppDemoPayment / resumeAuthorizedMpp
|
|
2225
|
+
// / resumeMppPayment / fetchWithMachinePayment / retryMppRequest (the
|
|
2226
|
+
// MACHINE-PAYMENT-CHALLENGE / mpp_demo client surface) are retired — the
|
|
2227
|
+
// backend's POST /machine-payments/authorize refuses unconditionally now,
|
|
2228
|
+
// and MACHINE-PAYMENT-CHALLENGE was never produced by any other Haven
|
|
2229
|
+
// surface. Use the x402 flow (authorizeX402 / fetch / quoteX402 / payX402Quote)
|
|
2230
|
+
// for agent-to-merchant payments.
|
|
2493
2231
|
assertCanResumeX402(status, paymentRequired, option) {
|
|
2494
2232
|
if (status.rail !== "x402") {
|
|
2495
2233
|
throw new HavenPaymentStateError(
|
|
@@ -2553,68 +2291,6 @@ var HavenClient = class {
|
|
|
2553
2291
|
);
|
|
2554
2292
|
}
|
|
2555
2293
|
}
|
|
2556
|
-
assertCanResumeMpp(status, challenge) {
|
|
2557
|
-
if (!isMppRail(status.rail)) {
|
|
2558
|
-
throw new HavenPaymentStateError(
|
|
2559
|
-
`Payment ${status.paymentId} is ${status.rail}, not MPP.`,
|
|
2560
|
-
409,
|
|
2561
|
-
status
|
|
2562
|
-
);
|
|
2563
|
-
}
|
|
2564
|
-
if (status.nextAction !== AgentPaymentNextAction.RetryOriginalX402Request) {
|
|
2565
|
-
throw new HavenPaymentStateError(status.message, PAYMENT_STATE_STATUS_CODES[status.status] ?? 409, status);
|
|
2566
|
-
}
|
|
2567
|
-
if (!status.txHash) {
|
|
2568
|
-
throw new HavenApiError(
|
|
2569
|
-
`MPP payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
2570
|
-
502,
|
|
2571
|
-
status,
|
|
2572
|
-
status.paymentId
|
|
2573
|
-
);
|
|
2574
|
-
}
|
|
2575
|
-
if (status.resourceUrl && status.resourceUrl !== challenge.resource) {
|
|
2576
|
-
throw new HavenApiError(
|
|
2577
|
-
"MPP resume request does not match the approved resource URL.",
|
|
2578
|
-
409,
|
|
2579
|
-
{ status, challenge },
|
|
2580
|
-
status.paymentId
|
|
2581
|
-
);
|
|
2582
|
-
}
|
|
2583
|
-
if (status.merchantAddress && !sameAddress(status.merchantAddress, challenge.recipient)) {
|
|
2584
|
-
throw new HavenApiError(
|
|
2585
|
-
"MPP resume request does not match the approved merchant.",
|
|
2586
|
-
409,
|
|
2587
|
-
{ status, challenge },
|
|
2588
|
-
status.paymentId
|
|
2589
|
-
);
|
|
2590
|
-
}
|
|
2591
|
-
if (status.chainId && status.chainId !== challenge.network.chainId) {
|
|
2592
|
-
throw new HavenApiError(
|
|
2593
|
-
"MPP resume request does not match the approved network.",
|
|
2594
|
-
409,
|
|
2595
|
-
{ status, challenge },
|
|
2596
|
-
status.paymentId
|
|
2597
|
-
);
|
|
2598
|
-
}
|
|
2599
|
-
if (status.token && status.token !== challenge.asset.symbol) {
|
|
2600
|
-
throw new HavenApiError(
|
|
2601
|
-
"MPP resume request does not match the approved token.",
|
|
2602
|
-
409,
|
|
2603
|
-
{ status, challenge },
|
|
2604
|
-
status.paymentId
|
|
2605
|
-
);
|
|
2606
|
-
}
|
|
2607
|
-
const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
|
|
2608
|
-
const requestedAmount = normalizeDecimal(challenge.amount.display);
|
|
2609
|
-
if (approvedAmount && approvedAmount !== requestedAmount) {
|
|
2610
|
-
throw new HavenApiError(
|
|
2611
|
-
"MPP resume request does not match the approved amount.",
|
|
2612
|
-
409,
|
|
2613
|
-
{ status, challenge },
|
|
2614
|
-
status.paymentId
|
|
2615
|
-
);
|
|
2616
|
-
}
|
|
2617
|
-
}
|
|
2618
2294
|
mapX402ReceiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
|
|
2619
2295
|
const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
|
|
2620
2296
|
const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
|
|
@@ -2721,53 +2397,6 @@ var HavenClient = class {
|
|
|
2721
2397
|
this.x402ReceiptCache.set(idempotencyKey, { expiresAt, receipt });
|
|
2722
2398
|
}
|
|
2723
2399
|
}
|
|
2724
|
-
mapMachinePaymentReceipt(challenge, raw, txHash, execResult) {
|
|
2725
|
-
const receiptWithoutHeader = {
|
|
2726
|
-
success: true,
|
|
2727
|
-
rail: challenge.rail,
|
|
2728
|
-
paymentId: raw.payment_id,
|
|
2729
|
-
challengeId: challenge.challengeId,
|
|
2730
|
-
txHash,
|
|
2731
|
-
token: execResult?.token ?? raw.token ?? challenge.asset.symbol,
|
|
2732
|
-
amount: execResult?.amount ?? raw.amount ?? challenge.amount.display,
|
|
2733
|
-
to: execResult?.to ?? raw.to ?? challenge.recipient,
|
|
2734
|
-
resourceUrl: raw.resource_url ?? challenge.resource,
|
|
2735
|
-
explorerUrl: execResult?.explorer_url ?? raw.explorer_url ?? buildExplorerUrl(execResult?.chain_id ?? raw.chain_id ?? challenge.network.chainId, txHash),
|
|
2736
|
-
payer: raw.payer ?? raw.safe_address,
|
|
2737
|
-
chainId: execResult?.chain_id ?? raw.chain_id ?? challenge.network.chainId
|
|
2738
|
-
};
|
|
2739
|
-
return {
|
|
2740
|
-
...receiptWithoutHeader,
|
|
2741
|
-
proofHeader: encodeMachinePaymentProof(receiptWithoutHeader)
|
|
2742
|
-
};
|
|
2743
|
-
}
|
|
2744
|
-
mapMachinePaymentReceiptFromStatus(challenge, status) {
|
|
2745
|
-
if (!status.txHash) {
|
|
2746
|
-
throw new HavenApiError(
|
|
2747
|
-
`MPP payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
2748
|
-
502,
|
|
2749
|
-
status,
|
|
2750
|
-
status.paymentId
|
|
2751
|
-
);
|
|
2752
|
-
}
|
|
2753
|
-
const receiptWithoutHeader = {
|
|
2754
|
-
success: true,
|
|
2755
|
-
rail: challenge.rail,
|
|
2756
|
-
paymentId: status.paymentId,
|
|
2757
|
-
challengeId: challenge.challengeId,
|
|
2758
|
-
txHash: status.txHash,
|
|
2759
|
-
token: status.token || challenge.asset.symbol,
|
|
2760
|
-
amount: status.amount || challenge.amount.display,
|
|
2761
|
-
to: status.merchantAddress ?? challenge.recipient,
|
|
2762
|
-
resourceUrl: status.resourceUrl ?? challenge.resource,
|
|
2763
|
-
explorerUrl: explorerUrlOrEmpty(status.chainId || challenge.network.chainId, status.txHash),
|
|
2764
|
-
chainId: status.chainId || challenge.network.chainId
|
|
2765
|
-
};
|
|
2766
|
-
return {
|
|
2767
|
-
...receiptWithoutHeader,
|
|
2768
|
-
proofHeader: encodeMachinePaymentProof(receiptWithoutHeader)
|
|
2769
|
-
};
|
|
2770
|
-
}
|
|
2771
2400
|
async recordMerchantRetryRejected(input) {
|
|
2772
2401
|
try {
|
|
2773
2402
|
await this.post("/machine-payments/reconciliation-events", {
|
|
@@ -3010,63 +2639,18 @@ var HavenClient = class {
|
|
|
3010
2639
|
merchantAddress: input.accepted.payTo
|
|
3011
2640
|
};
|
|
3012
2641
|
}
|
|
3013
|
-
buildMppQuote
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
idempotencyKey: idempotencyKey ?? buildMachinePaymentIdempotencyKey(challenge),
|
|
3018
|
-
challenge,
|
|
3019
|
-
request,
|
|
3020
|
-
resourceUrl: challenge.resource,
|
|
3021
|
-
description: challenge.description ?? null,
|
|
3022
|
-
amountAtomic: challenge.amount.atomic,
|
|
3023
|
-
amount: challenge.amount.display,
|
|
3024
|
-
token: challenge.asset.symbol,
|
|
3025
|
-
asset: challenge.asset.address,
|
|
3026
|
-
network: challenge.network.name,
|
|
3027
|
-
chainId: challenge.network.chainId,
|
|
3028
|
-
merchantAddress: challenge.recipient,
|
|
3029
|
-
expiresAt: challenge.expiresAt
|
|
3030
|
-
};
|
|
3031
|
-
}
|
|
3032
|
-
buildMppResumeState(input) {
|
|
3033
|
-
const quote = this.buildMppQuote(
|
|
3034
|
-
input.challenge,
|
|
3035
|
-
input.request ?? this.snapshotX402Request(input.challenge.resource),
|
|
3036
|
-
input.idempotencyKey
|
|
3037
|
-
);
|
|
3038
|
-
return {
|
|
3039
|
-
rail: "mpp",
|
|
3040
|
-
paymentRail: quote.paymentRail,
|
|
3041
|
-
paymentId: input.paymentId,
|
|
3042
|
-
idempotencyKey: quote.idempotencyKey,
|
|
3043
|
-
challenge: input.challenge,
|
|
3044
|
-
url: input.request?.url ?? input.challenge.resource,
|
|
3045
|
-
request: input.request,
|
|
3046
|
-
resourceUrl: quote.resourceUrl,
|
|
3047
|
-
description: quote.description,
|
|
3048
|
-
amountAtomic: quote.amountAtomic,
|
|
3049
|
-
amount: quote.amount,
|
|
3050
|
-
token: quote.token,
|
|
3051
|
-
asset: quote.asset,
|
|
3052
|
-
network: quote.network,
|
|
3053
|
-
chainId: quote.chainId,
|
|
3054
|
-
merchantAddress: quote.merchantAddress,
|
|
3055
|
-
expiresAt: quote.expiresAt
|
|
3056
|
-
};
|
|
3057
|
-
}
|
|
2642
|
+
// #1328: attachResumeState's 'mpp' branch (buildMppQuote / buildMppResumeState
|
|
2643
|
+
// / attachMppResumeState) is retired along with the rest of the MPP-demo
|
|
2644
|
+
// client surface — every remaining caller passes rail: 'x402' only, so this
|
|
2645
|
+
// is now a direct alias for attachX402ResumeState rather than a dispatcher.
|
|
3058
2646
|
attachResumeState(err, input) {
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
);
|
|
3067
|
-
return;
|
|
3068
|
-
}
|
|
3069
|
-
this.attachMppResumeState(err, input.challenge, input.idempotencyKey, input.request);
|
|
2647
|
+
this.attachX402ResumeState(
|
|
2648
|
+
err,
|
|
2649
|
+
input.paymentRequired,
|
|
2650
|
+
input.accepted,
|
|
2651
|
+
input.idempotencyKey,
|
|
2652
|
+
input.request
|
|
2653
|
+
);
|
|
3070
2654
|
}
|
|
3071
2655
|
attachX402ResumeState(err, paymentRequired, accepted, idempotencyKey, request) {
|
|
3072
2656
|
if (!(err instanceof HavenPaymentStateError)) return;
|
|
@@ -3079,16 +2663,6 @@ var HavenClient = class {
|
|
|
3079
2663
|
request
|
|
3080
2664
|
});
|
|
3081
2665
|
}
|
|
3082
|
-
attachMppResumeState(err, challenge, idempotencyKey, request) {
|
|
3083
|
-
if (!(err instanceof HavenPaymentStateError)) return;
|
|
3084
|
-
if (!isMppRail(err.state.rail)) return;
|
|
3085
|
-
err.resumeState = this.buildMppResumeState({
|
|
3086
|
-
paymentId: err.state.paymentId,
|
|
3087
|
-
challenge,
|
|
3088
|
-
idempotencyKey,
|
|
3089
|
-
request
|
|
3090
|
-
});
|
|
3091
|
-
}
|
|
3092
2666
|
// ── Tool Execution (for agent frameworks) ────────────────────────
|
|
3093
2667
|
/**
|
|
3094
2668
|
* Execute a tool call by name and input.
|
|
@@ -3147,29 +2721,6 @@ var HavenClient = class {
|
|
|
3147
2721
|
return this.toolError(err);
|
|
3148
2722
|
}
|
|
3149
2723
|
}
|
|
3150
|
-
if (toolName === "authorize_machine_payment") {
|
|
3151
|
-
const { challenge, idempotencyKey } = input;
|
|
3152
|
-
try {
|
|
3153
|
-
const receipt = await this.authorizeMachinePayment(challenge, { idempotencyKey });
|
|
3154
|
-
return {
|
|
3155
|
-
success: true,
|
|
3156
|
-
payment_id: receipt.paymentId,
|
|
3157
|
-
tx_hash: receipt.txHash,
|
|
3158
|
-
token: receipt.token,
|
|
3159
|
-
amount: receipt.amount,
|
|
3160
|
-
to: receipt.to,
|
|
3161
|
-
resource_url: receipt.resourceUrl,
|
|
3162
|
-
explorer_url: receipt.explorerUrl,
|
|
3163
|
-
proof_header: receipt.proofHeader,
|
|
3164
|
-
rail: receipt.rail,
|
|
3165
|
-
challenge_id: receipt.challengeId,
|
|
3166
|
-
payer: receipt.payer,
|
|
3167
|
-
chain_id: receipt.chainId
|
|
3168
|
-
};
|
|
3169
|
-
} catch (err) {
|
|
3170
|
-
return this.toolError(err);
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
2724
|
if (toolName === "get_payment_status") {
|
|
3174
2725
|
const { payment_id } = input;
|
|
3175
2726
|
const result = await this.getPaymentStatus(payment_id);
|
|
@@ -3517,7 +3068,7 @@ var toolDescriptions = {
|
|
|
3517
3068
|
payX402OneShot: {
|
|
3518
3069
|
summary: "Fetch an x402 paid HTTP resource in a single call. Handles the full probe -> pay -> retry round trip and returns the merchant response.",
|
|
3519
3070
|
selectionGuidance: "Prefer this over the quote+pay split when the agent just wants the paid resource and does not need to inspect the price first. If you already have a quote from haven_quote_x402, use haven_pay_x402_quote instead. Do not use for read-only allowance, budget, spend-limit, remaining-amount, reset-period, or what-can-I-spend questions; use the allowance lookup tool instead.",
|
|
3520
|
-
behavior: "Calls the URL, parses any HTTP 402 x402 challenge, signs the EIP-3009 payment from the delegate wallet, asks Haven for a Safe AllowanceModule top-up if needed, then retries the original request with the X-PAYMENT header and returns the merchant response. If the resource returns
|
|
3071
|
+
behavior: "Calls the URL, parses any HTTP 402 x402 challenge, signs the EIP-3009 payment from the delegate wallet, asks Haven for a Safe AllowanceModule top-up if needed, then retries the original request with the X-PAYMENT header and returns the merchant response. If the resource returns a non-402 status, returns it unchanged without contacting Haven.",
|
|
3521
3072
|
nextActionGuidance: "If approval is needed, preserve the returned resume_state or paymentId and call the resume tool once nextAction=retry_original_x402_request. If the response carries phase=insufficient_funds and nextAction=fund_safe_or_raise_allowance, the payment cannot be retried until the originating Safe is funded or the agent allowance raised \u2014 stop and tell the user the shortfall reported on the response."
|
|
3522
3073
|
},
|
|
3523
3074
|
resumeX402: {
|
|
@@ -3525,29 +3076,17 @@ var toolDescriptions = {
|
|
|
3525
3076
|
behavior: "Accepts either resume_state or payment_id, validates the original x402 details against the approved Haven funding, and retries the merchant request with the X-PAYMENT header. No new Haven approval is created.",
|
|
3526
3077
|
nextActionGuidance: "Only use when get_payment_status returns nextAction=retry_original_x402_request; do not start a new merchant session."
|
|
3527
3078
|
},
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
},
|
|
3533
|
-
payMpp: {
|
|
3534
|
-
summary: "Pay an inspected MPP challenge. The delegate key signs locally; Haven only validates and relays signed, on-chain-constrained payment transactions.",
|
|
3535
|
-
selectionGuidance: "Do not use this for read-only allowance, budget, spend-limit, remaining-amount, reset-period, or what-can-I-spend questions; use the allowance lookup tool instead.",
|
|
3536
|
-
behavior: "Authorizes the payment through Haven within the on-chain allowance, signs the challenge proof, and returns the proof header for retrying the original paid resource.",
|
|
3537
|
-
nextActionGuidance: "If approval is needed, preserve resume_state or payment_id and wait for nextAction=retry_original_x402_request before resuming."
|
|
3538
|
-
},
|
|
3539
|
-
resumeMpp: {
|
|
3540
|
-
summary: "Resume an MPP payment after the Haven wallet owner approved the funding step.",
|
|
3541
|
-
behavior: "Accepts either resume_state or payment_id and retries the original paid resource with the MPP proof header. No new Haven approval is created.",
|
|
3542
|
-
nextActionGuidance: ""
|
|
3543
|
-
},
|
|
3079
|
+
// #1328: quoteMpp / payMpp / resumeMpp (the mpp_demo challenge/quote/resume
|
|
3080
|
+
// fragments) are retired along with the client surface they described —
|
|
3081
|
+
// MACHINE-PAYMENT-CHALLENGE was never produced by anything besides the now
|
|
3082
|
+
// deleted `/demo/mpp/*` route. Use the x402 fragments above instead.
|
|
3544
3083
|
getPaymentStatus: {
|
|
3545
3084
|
summary: "Fetch structured Haven payment status, including phase and nextAction taxonomy for agent recovery.",
|
|
3546
3085
|
behavior: "Accepts a payment intent or approval request id and returns the full state taxonomy (phase, nextAction, rail, amount, merchant, resource url, idempotency key, message).",
|
|
3547
3086
|
nextActionGuidance: ""
|
|
3548
3087
|
},
|
|
3549
3088
|
getResumeState: {
|
|
3550
|
-
summary: "Rehydrate stored x402
|
|
3089
|
+
summary: "Rehydrate stored x402 resume_state by payment_id.",
|
|
3551
3090
|
behavior: "Returns the context that the agent originally received in a pending-approval response, reconstructed from Haven's database. This is context only; signing still happens locally when a resume tool is called.",
|
|
3552
3091
|
nextActionGuidance: ""
|
|
3553
3092
|
},
|
|
@@ -3589,13 +3128,13 @@ var toolDescriptions = {
|
|
|
3589
3128
|
},
|
|
3590
3129
|
sweep_delegate: {
|
|
3591
3130
|
summary: "Sweep stranded USDC and/or ETH from the delegate wallet back to the originating Safe.",
|
|
3592
|
-
selectionGuidance: "Use this when the user instructs you to recover stranded funds on the delegate wallet, or when a payment status returns nextAction=sweep_stranded_funds. Do NOT use for normal payments \u2014 use haven_pay_x402
|
|
3131
|
+
selectionGuidance: "Use this when the user instructs you to recover stranded funds on the delegate wallet, or when a payment status returns nextAction=sweep_stranded_funds. Do NOT use for normal payments \u2014 use haven_pay_x402. Do NOT use to read balances only \u2014 use haven_get_allowances.",
|
|
3593
3132
|
behavior: "Reads the delegate EOA's on-chain USDC and ETH balances. For each non-zero balance, signs and submits a transfer from the delegate EOA to the originating Safe (hardcoded destination). The delegate key signs locally \u2014 Haven never sees it and the backend never constructs signed transactions (CASP/MiCA Red Line #2). Returns tx hashes and recovered amounts. Returns an empty transfers list when nothing is stranded.",
|
|
3594
3133
|
nextActionGuidance: "If transfers is non-empty, confirm the amounts with the user. No further action required \u2014 funds are on their way back to the Safe."
|
|
3595
3134
|
},
|
|
3596
3135
|
send: {
|
|
3597
3136
|
summary: "Send ETH or USDC directly from the agent's Haven wallet to a recipient address.",
|
|
3598
|
-
selectionGuidance: "Use this for plain transfers \u2014 refunding a user, paying a freelancer, topping up a co-agent's wallet, or moving funds between addresses. Do NOT use for x402 paid endpoints
|
|
3137
|
+
selectionGuidance: "Use this for plain transfers \u2014 refunding a user, paying a freelancer, topping up a co-agent's wallet, or moving funds between addresses. Do NOT use for x402 paid endpoints \u2014 use haven_pay_x402 instead. Do NOT use for read-only allowance, budget, or what-can-I-spend questions \u2014 use haven_get_allowances.",
|
|
3599
3138
|
behavior: "Sends the requested amount through the Safe AllowanceModule. Amounts within the remaining on-chain allowance for the asset execute automatically; amounts that exceed the allowance are queued as pending_approval for the wallet owner to approve in Haven. The agent's signing key signs the AllowanceModule transfer hash; Haven never receives the key.",
|
|
3600
3139
|
nextActionGuidance: "If pending_approval is returned, preserve the payment_id and wait for the wallet owner to approve in Haven. Poll haven_get_payment_status until nextAction=none."
|
|
3601
3140
|
}
|
|
@@ -3711,22 +3250,11 @@ var resumeX402Schema = {
|
|
|
3711
3250
|
},
|
|
3712
3251
|
required: ["payment_id", "url", "payTo", "amount", "asset", "network"]
|
|
3713
3252
|
};
|
|
3714
|
-
var authorizeMachinePaymentSchema = {
|
|
3715
|
-
type: "object",
|
|
3716
|
-
properties: {
|
|
3717
|
-
challenge: {
|
|
3718
|
-
type: "object",
|
|
3719
|
-
description: "Machine payment challenge returned by a Haven demo endpoint"
|
|
3720
|
-
}
|
|
3721
|
-
},
|
|
3722
|
-
required: ["challenge"]
|
|
3723
|
-
};
|
|
3724
3253
|
var MAKE_PAYMENT_DESCRIPTION = "Request and sign a payment from the user-controlled Safe within approved on-chain limits. For read-only allowance, budget, spend-limit, remaining-amount, or reset-period questions, use get_allowances instead of making a payment. Haven authenticates the agent, validates the signed intent, and relays the Safe AllowanceModule transaction; it does not hold keys or control funds. Gnosis Chain tokens: EURe, USDC.e, xDAI. Base tokens: USDC, ETH.";
|
|
3725
3254
|
var GET_STATUS_DESCRIPTION = toolDescriptions.getPaymentStatus.summary + " Accepts payment intent IDs and approval request IDs. Returns the current status, phase, next_action, transaction hash if available, and payment details.";
|
|
3726
3255
|
var GET_ALLOWANCES_DESCRIPTION = composeDescription(toolDescriptions.getAllowances);
|
|
3727
3256
|
var AUTHORIZE_X402_DESCRIPTION = composeDescription(toolDescriptions.payX402) + " In this SDK tool set, the allowance lookup tool is get_allowances. When a paid API returns x402 payment requirements, use this tool to sign with the agent-owned delegate key and request a policy-limited Safe AllowanceModule top-up when needed. Haven relays signed transactions only; the agent key authorizes payment and on-chain limits enforce spend. If this returns pending_approval, tell the user it is waiting in Haven, preserve the original merchant/MCP session and x402 details, call get_payment_status later, and use resume_x402_payment only when next_action is retry_original_x402_request. Do not start a new merchant session or loop retries while approval is pending. Use the returned payment_header as the X-PAYMENT header on the retry request when doing a manual HTTP retry.";
|
|
3728
3257
|
var RESUME_X402_DESCRIPTION = toolDescriptions.resumeX402.summary + " Use this only after get_payment_status returns next_action=retry_original_x402_request. It checks the approved payment, validates the original x402 details, and returns a merchant X-PAYMENT header without creating a new approval request or merchant session.";
|
|
3729
|
-
var AUTHORIZE_MACHINE_PAYMENT_DESCRIPTION = composeDescription(toolDescriptions.payMpp) + " In this SDK tool set, the allowance lookup tool is get_allowances. Currently scoped to the internal MPP demo rail. The agent signs the payment, Haven relays it within the on-chain allowance, and the tool returns a proof header for the retry request.";
|
|
3730
3258
|
var SWEEP_DELEGATE_DESCRIPTION = composeDescription(toolDescriptions.sweep_delegate);
|
|
3731
3259
|
var sweepDelegateSchema = {
|
|
3732
3260
|
type: "object",
|
|
@@ -3760,11 +3288,6 @@ function claudeTools() {
|
|
|
3760
3288
|
description: RESUME_X402_DESCRIPTION,
|
|
3761
3289
|
input_schema: resumeX402Schema
|
|
3762
3290
|
},
|
|
3763
|
-
{
|
|
3764
|
-
name: "authorize_machine_payment",
|
|
3765
|
-
description: AUTHORIZE_MACHINE_PAYMENT_DESCRIPTION,
|
|
3766
|
-
input_schema: authorizeMachinePaymentSchema
|
|
3767
|
-
},
|
|
3768
3291
|
{
|
|
3769
3292
|
name: "haven_sweep_delegate",
|
|
3770
3293
|
description: SWEEP_DELEGATE_DESCRIPTION,
|
|
@@ -3814,14 +3337,6 @@ function openaiTools() {
|
|
|
3814
3337
|
parameters: resumeX402Schema
|
|
3815
3338
|
}
|
|
3816
3339
|
},
|
|
3817
|
-
{
|
|
3818
|
-
type: "function",
|
|
3819
|
-
function: {
|
|
3820
|
-
name: "authorize_machine_payment",
|
|
3821
|
-
description: AUTHORIZE_MACHINE_PAYMENT_DESCRIPTION,
|
|
3822
|
-
parameters: authorizeMachinePaymentSchema
|
|
3823
|
-
}
|
|
3824
|
-
},
|
|
3825
3340
|
{
|
|
3826
3341
|
type: "function",
|
|
3827
3342
|
function: {
|
|
@@ -4214,6 +3729,6 @@ function sameUrl(a, b) {
|
|
|
4214
3729
|
}
|
|
4215
3730
|
}
|
|
4216
3731
|
|
|
4217
|
-
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, DISCOVERY_MAX_BYTES, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey,
|
|
3732
|
+
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, DISCOVERY_MAX_BYTES, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isSupportedNodeVersion, isSweepableChain, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectPaymentOption, selectStandardPaymentOption, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, verifyPaymentReceipt, verifySignature, x402AuthorizationAmount };
|
|
4218
3733
|
//# sourceMappingURL=index.js.map
|
|
4219
3734
|
//# sourceMappingURL=index.js.map
|