@haven_ai/sdk 0.11.0-alpha.0 → 0.12.0-alpha.0
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 +37 -4
- package/dist/{base64-D4VZhgUg.d.ts → base64-C5OrJLij.d.ts} +10 -2
- package/dist/{base64-DR4Gl8cD.d.cts → base64-COaV1Sis.d.cts} +10 -2
- package/dist/{chunk-DXBAN4SN.cjs → chunk-4JTLJVBS.cjs} +4 -4
- package/dist/chunk-4JTLJVBS.cjs.map +1 -0
- package/dist/{chunk-ZDJ55LR7.js → chunk-7M3CIW7W.js} +7 -6
- package/dist/chunk-7M3CIW7W.js.map +1 -0
- package/dist/{chunk-I7SL4A6X.js → chunk-UPEDQLAL.js} +55 -5
- package/dist/chunk-UPEDQLAL.js.map +1 -0
- package/dist/{chunk-IKQIIMM6.cjs → chunk-V2ODMLDD.cjs} +38 -37
- package/dist/chunk-V2ODMLDD.cjs.map +1 -0
- package/dist/{chunk-34YJQFCM.js → chunk-WFTGZS24.js} +3 -3
- package/dist/chunk-WFTGZS24.js.map +1 -0
- package/dist/{chunk-MZKLAHBK.cjs → chunk-ZA3NOSO2.cjs} +56 -4
- package/dist/chunk-ZA3NOSO2.cjs.map +1 -0
- package/dist/edge.cjs +93 -93
- package/dist/edge.d.cts +11 -8
- package/dist/edge.d.ts +11 -8
- package/dist/edge.js +4 -4
- package/dist/index.cjs +441 -355
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -15
- package/dist/index.d.ts +22 -15
- package/dist/index.js +125 -47
- package/dist/index.js.map +1 -1
- package/dist/{receipt-_bWCELEH.d.cts → receipt-Dy77vCea.d.cts} +5 -4
- package/dist/{receipt-CbD8L0WL.d.ts → receipt-DyUInpvF.d.ts} +5 -4
- package/dist/test-support.cjs +21 -21
- package/dist/test-support.d.cts +2 -2
- package/dist/test-support.d.ts +2 -2
- package/dist/test-support.js +2 -2
- package/dist/{types-DKmvjXK6.d.cts → types-CAvsjRKi.d.cts} +144 -2
- package/dist/{types-DKmvjXK6.d.ts → types-CAvsjRKi.d.ts} +144 -2
- package/package.json +1 -1
- package/dist/chunk-34YJQFCM.js.map +0 -1
- package/dist/chunk-DXBAN4SN.cjs.map +0 -1
- package/dist/chunk-I7SL4A6X.js.map +0 -1
- package/dist/chunk-IKQIIMM6.cjs.map +0 -1
- package/dist/chunk-MZKLAHBK.cjs.map +0 -1
- package/dist/chunk-ZDJ55LR7.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aZ as RawPaymentParties } from './types-CAvsjRKi.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Verifiable payment receipts.
|
|
@@ -56,7 +56,7 @@ interface PaymentReceipt {
|
|
|
56
56
|
* #2960: one party vocabulary for "who paid", additive alongside `account`
|
|
57
57
|
* above (which is `parties.treasury_account` only). Optional: a server
|
|
58
58
|
* from before #2960 emits neither. Ignored by `verifyPaymentReceipt`,
|
|
59
|
-
* which reads only `authorization`.
|
|
59
|
+
* which reads only the bundle's `authorization` and `onChain.chainId`.
|
|
60
60
|
*/
|
|
61
61
|
parties?: RawPaymentParties;
|
|
62
62
|
chainId: number;
|
|
@@ -67,8 +67,9 @@ interface PaymentReceipt {
|
|
|
67
67
|
* merchant DELIVERED (`ok` / `unusable` / `partial`, plus a bounded
|
|
68
68
|
* note). Additive and OPTIONAL: a server from before #3770 emits
|
|
69
69
|
* neither, and `null` means the agent has not reported. Ignored by
|
|
70
|
-
* `verifyPaymentReceipt`, which reads only `authorization`
|
|
71
|
-
* rule `parties` follows. Evidence
|
|
70
|
+
* `verifyPaymentReceipt`, which reads only the bundle's `authorization`
|
|
71
|
+
* and `onChain.chainId` — the same rule `parties` follows. Evidence
|
|
72
|
+
* only: it never changes what the
|
|
72
73
|
* payment itself is, and `settled`/amounts are untouched by a report.
|
|
73
74
|
*/
|
|
74
75
|
deliveryQuality?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aZ as RawPaymentParties } from './types-CAvsjRKi.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Verifiable payment receipts.
|
|
@@ -56,7 +56,7 @@ interface PaymentReceipt {
|
|
|
56
56
|
* #2960: one party vocabulary for "who paid", additive alongside `account`
|
|
57
57
|
* above (which is `parties.treasury_account` only). Optional: a server
|
|
58
58
|
* from before #2960 emits neither. Ignored by `verifyPaymentReceipt`,
|
|
59
|
-
* which reads only `authorization`.
|
|
59
|
+
* which reads only the bundle's `authorization` and `onChain.chainId`.
|
|
60
60
|
*/
|
|
61
61
|
parties?: RawPaymentParties;
|
|
62
62
|
chainId: number;
|
|
@@ -67,8 +67,9 @@ interface PaymentReceipt {
|
|
|
67
67
|
* merchant DELIVERED (`ok` / `unusable` / `partial`, plus a bounded
|
|
68
68
|
* note). Additive and OPTIONAL: a server from before #3770 emits
|
|
69
69
|
* neither, and `null` means the agent has not reported. Ignored by
|
|
70
|
-
* `verifyPaymentReceipt`, which reads only `authorization`
|
|
71
|
-
* rule `parties` follows. Evidence
|
|
70
|
+
* `verifyPaymentReceipt`, which reads only the bundle's `authorization`
|
|
71
|
+
* and `onChain.chainId` — the same rule `parties` follows. Evidence
|
|
72
|
+
* only: it never changes what the
|
|
72
73
|
* payment itself is, and `settled`/amounts are untouched by a report.
|
|
73
74
|
*/
|
|
74
75
|
deliveryQuality?: {
|
package/dist/test-support.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4JTLJVBS_cjs = require('./chunk-4JTLJVBS.cjs');
|
|
4
|
+
var chunkZA3NOSO2_cjs = require('./chunk-ZA3NOSO2.cjs');
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ var ZERO_BYTES32 = `0x${"00".repeat(32)}`;
|
|
|
9
9
|
var ROOT_AUTHORITY = `0x${"ff".repeat(32)}`;
|
|
10
10
|
var DEFAULT_DELEGATOR = "0x98989898989898989898989898989898989898De";
|
|
11
11
|
var DELEGATION_ARRAY_PARAM = [
|
|
12
|
-
{ type: "tuple[]", components:
|
|
12
|
+
{ type: "tuple[]", components: chunkZA3NOSO2_cjs.DELEGATION_TUPLE_COMPONENTS }
|
|
13
13
|
];
|
|
14
14
|
var EXECUTE_ABI = [
|
|
15
15
|
{
|
|
@@ -85,16 +85,16 @@ function buildBoundRedeemDelegationsCallData(options) {
|
|
|
85
85
|
10000n
|
|
86
86
|
);
|
|
87
87
|
return viem.encodeFunctionData({
|
|
88
|
-
abi:
|
|
88
|
+
abi: chunkZA3NOSO2_cjs.REDEEM_DELEGATIONS_ABI,
|
|
89
89
|
functionName: "redeemDelegations",
|
|
90
|
-
args: [[permissionContext], [
|
|
90
|
+
args: [[permissionContext], [chunkZA3NOSO2_cjs.SINGLE_DEFAULT_MODE], [executionCallData]]
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function buildEmptyPermissionContextRedemption(selfCallCallData) {
|
|
94
94
|
return viem.encodeFunctionData({
|
|
95
|
-
abi:
|
|
95
|
+
abi: chunkZA3NOSO2_cjs.REDEEM_DELEGATIONS_ABI,
|
|
96
96
|
functionName: "redeemDelegations",
|
|
97
|
-
args: [[buildEmptyPermissionContext()], [
|
|
97
|
+
args: [[buildEmptyPermissionContext()], [chunkZA3NOSO2_cjs.SINGLE_DEFAULT_MODE], [selfCallCallData]]
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
function buildExecuteCallData(target, value, innerCallData) {
|
|
@@ -106,20 +106,20 @@ function buildExecuteCallData(target, value, innerCallData) {
|
|
|
106
106
|
}
|
|
107
107
|
function buildBoundDirectUserOp(options) {
|
|
108
108
|
const chainId = options.chainId ?? 84532;
|
|
109
|
-
const sender = options.sender ??
|
|
109
|
+
const sender = options.sender ?? chunkZA3NOSO2_cjs.deriveDelegateAccountAddress(options.delegate);
|
|
110
110
|
const callData = options.callData ?? buildExecuteCallData(
|
|
111
|
-
options.target ??
|
|
111
|
+
options.target ?? chunkZA3NOSO2_cjs.DELEGATION_MANAGER,
|
|
112
112
|
options.value ?? 0n,
|
|
113
113
|
buildBoundRedeemDelegationsCallData({ delegate: sender, delegator: options.delegator })
|
|
114
114
|
);
|
|
115
115
|
const typedData = {
|
|
116
116
|
domain: {
|
|
117
|
-
name:
|
|
118
|
-
version:
|
|
117
|
+
name: chunkZA3NOSO2_cjs.HYBRID_DELEGATOR_DOMAIN_NAME,
|
|
118
|
+
version: chunkZA3NOSO2_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION,
|
|
119
119
|
chainId,
|
|
120
120
|
verifyingContract: sender
|
|
121
121
|
},
|
|
122
|
-
types: { PackedUserOperation:
|
|
122
|
+
types: { PackedUserOperation: chunkZA3NOSO2_cjs.PACKED_USER_OPERATION_FIELDS.map((field) => ({ ...field })) },
|
|
123
123
|
primaryType: "PackedUserOperation",
|
|
124
124
|
message: {
|
|
125
125
|
sender,
|
|
@@ -130,10 +130,10 @@ function buildBoundDirectUserOp(options) {
|
|
|
130
130
|
preVerificationGas: "0",
|
|
131
131
|
gasFees: ZERO_BYTES32,
|
|
132
132
|
paymasterAndData: "0x",
|
|
133
|
-
entryPoint:
|
|
133
|
+
entryPoint: chunkZA3NOSO2_cjs.ENTRY_POINT_V07
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
const payloadHash =
|
|
136
|
+
const payloadHash = chunkZA3NOSO2_cjs.packedUserOperationHash(typedData);
|
|
137
137
|
return { typedData, payloadHash, sender };
|
|
138
138
|
}
|
|
139
139
|
function buildSelfCallCallData(sender) {
|
|
@@ -151,7 +151,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
|
|
|
151
151
|
const originalCallData = fixtureTypedData.message.callData;
|
|
152
152
|
const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: originalCallData });
|
|
153
153
|
const execution = executeArgs[0];
|
|
154
|
-
const { args: redeemArgs } = viem.decodeFunctionData({ abi:
|
|
154
|
+
const { args: redeemArgs } = viem.decodeFunctionData({ abi: chunkZA3NOSO2_cjs.REDEEM_DELEGATIONS_ABI, data: execution.callData });
|
|
155
155
|
const [permissionContexts, modes, executionCallDatas] = redeemArgs;
|
|
156
156
|
const [delegations] = viem.decodeAbiParameters(DELEGATION_ARRAY_PARAM, permissionContexts[0]);
|
|
157
157
|
const adjustedDelegations = delegations.map(
|
|
@@ -159,7 +159,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
|
|
|
159
159
|
);
|
|
160
160
|
const adjustedPermissionContext = viem.encodeAbiParameters(DELEGATION_ARRAY_PARAM, [adjustedDelegations]);
|
|
161
161
|
const adjustedRedeemCallData = viem.encodeFunctionData({
|
|
162
|
-
abi:
|
|
162
|
+
abi: chunkZA3NOSO2_cjs.REDEEM_DELEGATIONS_ABI,
|
|
163
163
|
functionName: "redeemDelegations",
|
|
164
164
|
args: [[adjustedPermissionContext], modes, executionCallDatas]
|
|
165
165
|
});
|
|
@@ -173,13 +173,13 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
|
|
|
173
173
|
domain: { ...fixtureTypedData.domain, verifyingContract: newSender },
|
|
174
174
|
message: { ...fixtureTypedData.message, sender: newSender, callData: adjustedCallData }
|
|
175
175
|
};
|
|
176
|
-
const payloadHash =
|
|
176
|
+
const payloadHash = chunkZA3NOSO2_cjs.packedUserOperationHash(typedData);
|
|
177
177
|
return { typedData, payloadHash };
|
|
178
178
|
}
|
|
179
179
|
function buildFundingLegUserOp(options) {
|
|
180
|
-
const sender =
|
|
180
|
+
const sender = chunkZA3NOSO2_cjs.deriveDelegateAccountAddress(options.delegate);
|
|
181
181
|
const callData = buildExecuteCallData(
|
|
182
|
-
|
|
182
|
+
chunkZA3NOSO2_cjs.DELEGATION_MANAGER,
|
|
183
183
|
0n,
|
|
184
184
|
buildBoundRedeemDelegationsCallData({
|
|
185
185
|
delegate: sender,
|
|
@@ -212,7 +212,7 @@ function delegationDigest(signHash, chainId) {
|
|
|
212
212
|
viem.keccak256(viem.toBytes("DelegationManager")),
|
|
213
213
|
viem.keccak256(viem.toBytes("1")),
|
|
214
214
|
BigInt(chainId),
|
|
215
|
-
|
|
215
|
+
chunkZA3NOSO2_cjs.DELEGATION_MANAGER
|
|
216
216
|
]
|
|
217
217
|
)
|
|
218
218
|
);
|
|
@@ -224,7 +224,7 @@ function signedErc7710Receipt(options = {}) {
|
|
|
224
224
|
const delegate = new ethers.Wallet(options.delegateKey ?? RECEIPT_DELEGATE_KEY);
|
|
225
225
|
const signature = delegate.signingKey.sign(delegationDigest(signHash, chainId)).serialized;
|
|
226
226
|
return {
|
|
227
|
-
version:
|
|
227
|
+
version: chunk4JTLJVBS_cjs.RECEIPT_VERSION,
|
|
228
228
|
paymentId: options.paymentId ?? "pay_3723",
|
|
229
229
|
payment: {
|
|
230
230
|
token: "USDC",
|
package/dist/test-support.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
|
-
import { P as PaymentReceipt } from './receipt-
|
|
3
|
-
import './types-
|
|
2
|
+
import { P as PaymentReceipt } from './receipt-Dy77vCea.cjs';
|
|
3
|
+
import './types-CAvsjRKi.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* #3272 — a real-shaped, BOUND direct-payment `PackedUserOperation` for
|
package/dist/test-support.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
|
-
import { P as PaymentReceipt } from './receipt-
|
|
3
|
-
import './types-
|
|
2
|
+
import { P as PaymentReceipt } from './receipt-DyUInpvF.js';
|
|
3
|
+
import './types-CAvsjRKi.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* #3272 — a real-shaped, BOUND direct-payment `PackedUserOperation` for
|
package/dist/test-support.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RECEIPT_VERSION } from './chunk-
|
|
2
|
-
import { DELEGATION_TUPLE_COMPONENTS, SINGLE_DEFAULT_MODE, REDEEM_DELEGATIONS_ABI, deriveDelegateAccountAddress, DELEGATION_MANAGER, PACKED_USER_OPERATION_FIELDS, packedUserOperationHash, ENTRY_POINT_V07, HYBRID_DELEGATOR_DOMAIN_VERSION, HYBRID_DELEGATOR_DOMAIN_NAME } from './chunk-
|
|
1
|
+
import { RECEIPT_VERSION } from './chunk-WFTGZS24.js';
|
|
2
|
+
import { DELEGATION_TUPLE_COMPONENTS, SINGLE_DEFAULT_MODE, REDEEM_DELEGATIONS_ABI, deriveDelegateAccountAddress, DELEGATION_MANAGER, PACKED_USER_OPERATION_FIELDS, packedUserOperationHash, ENTRY_POINT_V07, HYBRID_DELEGATOR_DOMAIN_VERSION, HYBRID_DELEGATOR_DOMAIN_NAME } from './chunk-UPEDQLAL.js';
|
|
3
3
|
import { keccak256, toBytes, encodeAbiParameters, encodePacked, encodeFunctionData, decodeFunctionData, decodeAbiParameters, hashTypedData, concatHex } from 'viem';
|
|
4
4
|
import { Wallet } from 'ethers';
|
|
5
5
|
|
|
@@ -787,6 +787,14 @@ interface HavenAllowance {
|
|
|
787
787
|
* compared alone — they do not add up. Never a balance figure.
|
|
788
788
|
*/
|
|
789
789
|
fundsCoverRemaining: boolean | null;
|
|
790
|
+
/**
|
|
791
|
+
* #4355: when THIS budget next refills — the end of its current period
|
|
792
|
+
* (ISO 8601), or its start for a budget not yet started. `null` when it
|
|
793
|
+
* never refills again (it ends first), and on a backend that predates the
|
|
794
|
+
* field. With a remaining of 0 it says the budget is spent for this period
|
|
795
|
+
* and when it comes back — not that nobody approved one.
|
|
796
|
+
*/
|
|
797
|
+
nextRefillAt: string | null;
|
|
790
798
|
/**
|
|
791
799
|
* #3518: this budget's SCOPE, so an agent holding more than one budget
|
|
792
800
|
* for a token can name the merchant-locked one before paying. The
|
|
@@ -841,6 +849,14 @@ interface HavenAllowanceSummary {
|
|
|
841
849
|
delegateAddress: string;
|
|
842
850
|
chainId: number;
|
|
843
851
|
allowances: HavenAllowance[];
|
|
852
|
+
/**
|
|
853
|
+
* #4352 (additive, decision 5): when the agent's only budgets for this
|
|
854
|
+
* chain have ENDED, the latest ended budget's expiry (ISO 8601) — read by
|
|
855
|
+
* the same narrow expired-row query the refusal answers use. `null` when no
|
|
856
|
+
* expired row exists; the field NEVER reports a live budget. `null` on a
|
|
857
|
+
* backend that predates the field.
|
|
858
|
+
*/
|
|
859
|
+
budgetEndedAt: string | null;
|
|
844
860
|
/** #3772: see {@link HavenAgent.supersededBy}. */
|
|
845
861
|
supersededBy: HavenAgentSupersession | null;
|
|
846
862
|
}
|
|
@@ -1040,6 +1056,8 @@ interface HavenAgentAllowanceSummary {
|
|
|
1040
1056
|
* read: any non-boolean wire value maps to `null`, never `undefined`.
|
|
1041
1057
|
*/
|
|
1042
1058
|
fundsCoverRemaining: boolean | null;
|
|
1059
|
+
/** #4355: the {@link HavenAllowance.nextRefillAt} projection. */
|
|
1060
|
+
nextRefillAt: string | null;
|
|
1043
1061
|
}
|
|
1044
1062
|
/**
|
|
1045
1063
|
* One-shot "am I ready?" bootstrap: identity + live spend authority + a
|
|
@@ -1063,6 +1081,27 @@ interface HavenAgentSummary extends HavenAgent {
|
|
|
1063
1081
|
* renders from `HAVEN_CONNECTOR_CHANNEL` — see `connector-channel.ts`).
|
|
1064
1082
|
*/
|
|
1065
1083
|
spend_authority_readiness: HavenAgentReadiness;
|
|
1084
|
+
/**
|
|
1085
|
+
* #4355 (additive; the readiness values are unchanged — #4349 decision 5):
|
|
1086
|
+
* set only when readiness is `needs_approval` BECAUSE every live budget is
|
|
1087
|
+
* spent for its period — `allowances[]` has rows, all at remaining 0. It is
|
|
1088
|
+
* the earliest {@link HavenAgentAllowanceSummary.nextRefillAt} among them:
|
|
1089
|
+
* wait until then, or ask the owner to raise the budget. `null` otherwise:
|
|
1090
|
+
* ready, revoked, no budget approved (`allowances[]` empty), or a spent
|
|
1091
|
+
* budget that ends before it would refill.
|
|
1092
|
+
*/
|
|
1093
|
+
budgetRefillsAt: string | null;
|
|
1094
|
+
/**
|
|
1095
|
+
* #4352 (additive; the readiness values are unchanged — #4349 decision 5):
|
|
1096
|
+
* set only when readiness is `needs_approval` BECAUSE the agent's only
|
|
1097
|
+
* budget(s) have ENDED — `allowances[]` is empty and the server's
|
|
1098
|
+
* expired-row read found one. The ended budget's expiry (ISO 8601): waiting
|
|
1099
|
+
* will not help; ask the owner to set a new one. `null` otherwise — ready,
|
|
1100
|
+
* revoked, no budget approved at all, live rows present (whether spendable
|
|
1101
|
+
* or all spent — the latter is {@link HavenAgentSummary.budgetRefillsAt}'s
|
|
1102
|
+
* case), or a backend that predates the field.
|
|
1103
|
+
*/
|
|
1104
|
+
budgetEndedAt: string | null;
|
|
1066
1105
|
allowances: HavenAgentAllowanceSummary[];
|
|
1067
1106
|
/**
|
|
1068
1107
|
* #3329: open, unexpired task budgets — a derived VIEW, same discipline as
|
|
@@ -1389,6 +1428,23 @@ interface HavenPaymentReceipt {
|
|
|
1389
1428
|
paymentId: string;
|
|
1390
1429
|
paymentIntentId?: string | null;
|
|
1391
1430
|
approvalRequestId?: string | null;
|
|
1431
|
+
/**
|
|
1432
|
+
* #4469: which settlement branch moved the money (`eip3009` | `erc7710`),
|
|
1433
|
+
* from the intent (#946). The receipts wire declares this as raw text with
|
|
1434
|
+
* no enum (`packages/backend/src/openapi/spec.ts`), so it is typed
|
|
1435
|
+
* `string | null` here rather than narrowed: a value this SDK does not know
|
|
1436
|
+
* is still the backend's record, and narrowing it to `null` would erase it.
|
|
1437
|
+
* Absent on an older backend; `null` when the backend states no scheme
|
|
1438
|
+
* (legacy-rail receipts).
|
|
1439
|
+
*/
|
|
1440
|
+
settlementScheme?: string | null;
|
|
1441
|
+
/**
|
|
1442
|
+
* #4469: the budget delegation that METERED this payment (#3518), uniform
|
|
1443
|
+
* across schemes. `string | null` on receipts — the backend sends
|
|
1444
|
+
* `?? null` — unlike {@link PaymentStatusResult.budgetDelegationHash}, which
|
|
1445
|
+
* is `string` and absent when unknown. Absent on an older backend.
|
|
1446
|
+
*/
|
|
1447
|
+
budgetDelegationHash?: string | null;
|
|
1392
1448
|
/**
|
|
1393
1449
|
* #3134: the payment protocol this receipt settled on — one of the
|
|
1394
1450
|
* evidence-eligible rails (`x402`, `mpp_demo`, `mpp_crypto`, `spt`) — under the
|
|
@@ -1464,6 +1520,23 @@ interface HavenPaymentReceipt {
|
|
|
1464
1520
|
*/
|
|
1465
1521
|
protocolReceiptPayload?: Record<string, unknown> | null;
|
|
1466
1522
|
merchantStatus: number | null;
|
|
1523
|
+
/**
|
|
1524
|
+
* #4469: the paying agent's own delivery verdict (#3770), when it reported
|
|
1525
|
+
* one — `ok` | `unusable` | `partial`. Evidence only: it never gates
|
|
1526
|
+
* anything and the payment itself is unchanged. Absent on an older backend;
|
|
1527
|
+
* `null` when the backend states "not reported".
|
|
1528
|
+
*/
|
|
1529
|
+
deliveryQuality?: 'ok' | 'unusable' | 'partial' | null;
|
|
1530
|
+
/** #4469: the agent's optional note (max 2000 chars) saying what was wrong. Absent on an older backend. */
|
|
1531
|
+
deliveryNote?: string | null;
|
|
1532
|
+
/** #4469: when the agent reported the verdict (ISO 8601). Absent on an older backend. */
|
|
1533
|
+
deliveryReportedAt?: string | null;
|
|
1534
|
+
/**
|
|
1535
|
+
* #4469: the NON-SECRET pointer to a delivered good (#3778) — merchant,
|
|
1536
|
+
* product, value, order id. Never a redemption code or other credential:
|
|
1537
|
+
* those are refused at write. Absent on an older backend.
|
|
1538
|
+
*/
|
|
1539
|
+
deliveryReference?: string | null;
|
|
1467
1540
|
confirmedAt: string | null;
|
|
1468
1541
|
createdAt: string;
|
|
1469
1542
|
updatedAt: string;
|
|
@@ -1839,6 +1912,18 @@ declare const AgentPaymentWarningCode: {
|
|
|
1839
1912
|
* remains the actual gate either way.
|
|
1840
1913
|
*/
|
|
1841
1914
|
readonly QuoteExceedsRemainingBudget: "QUOTE_EXCEEDS_REMAINING_BUDGET";
|
|
1915
|
+
/**
|
|
1916
|
+
* #4458: the agent's only budget for the token has ENDED — the quote-time
|
|
1917
|
+
* pre-check answered the typed 403 `delegation_expired`, not an over-budget
|
|
1918
|
+
* compare. Travels beside `budget_check.sufficient: false` and, on
|
|
1919
|
+
* `haven_quote_x402`, `safe_to_continue: false` with no prefilled cap. The
|
|
1920
|
+
* remedy is the owner setting a NEW budget: waiting for a period to reset
|
|
1921
|
+
* cannot help, which is why this is its own code rather than
|
|
1922
|
+
* {@link AgentPaymentWarningCode.QuoteExceedsRemainingBudget}. Additive: an
|
|
1923
|
+
* older backend never emits it, and the on-chain policy remains the actual
|
|
1924
|
+
* gate either way.
|
|
1925
|
+
*/
|
|
1926
|
+
readonly QuoteBudgetEnded: "QUOTE_BUDGET_ENDED";
|
|
1842
1927
|
/**
|
|
1843
1928
|
* #3967: the MERCHANT reported a denial on one of its x402 payment options —
|
|
1844
1929
|
* a known denial key (starting with `issuanceDenied`) in `accepts[].extra`.
|
|
@@ -2172,9 +2257,66 @@ declare class HavenError extends Error {
|
|
|
2172
2257
|
readonly paymentId?: string | undefined;
|
|
2173
2258
|
constructor(message: string, code: string, statusCode?: number | undefined, paymentId?: string | undefined);
|
|
2174
2259
|
}
|
|
2260
|
+
/**
|
|
2261
|
+
* #4470: why a `HavenApiError` happened, where its status alone cannot say.
|
|
2262
|
+
*
|
|
2263
|
+
* - `no_answer` — the transport got no usable answer: the request timed out
|
|
2264
|
+
* (status 408), `fetch` threw, or the body was not JSON (status 0). Whether
|
|
2265
|
+
* the call took effect is unknown, so a `GET` may be retried and a `POST`
|
|
2266
|
+
* must not be; `method` says which it was.
|
|
2267
|
+
* - `deterministic` — the SDK refused an answer it cannot use (a missing
|
|
2268
|
+
* field, the wrong shape). Repeating the same call gets the same answer,
|
|
2269
|
+
* whatever the status says.
|
|
2270
|
+
*
|
|
2271
|
+
* Absent on every other error, which keeps the status rule. A readonly field
|
|
2272
|
+
* rather than a subclass, so `name`, `code` and `statusCode` stay what
|
|
2273
|
+
* consumers already match on.
|
|
2274
|
+
*/
|
|
2275
|
+
type HavenApiFailureCause = {
|
|
2276
|
+
readonly kind: 'no_answer';
|
|
2277
|
+
readonly method: 'GET' | 'POST';
|
|
2278
|
+
} | {
|
|
2279
|
+
readonly kind: 'deterministic';
|
|
2280
|
+
};
|
|
2175
2281
|
declare class HavenApiError extends HavenError {
|
|
2176
2282
|
readonly body?: unknown | undefined;
|
|
2177
|
-
|
|
2283
|
+
readonly failureCause?: HavenApiFailureCause | undefined;
|
|
2284
|
+
constructor(message: string, statusCode: number, body?: unknown | undefined, paymentId?: string, failureCause?: HavenApiFailureCause | undefined);
|
|
2285
|
+
/**
|
|
2286
|
+
* #4470: an error a retry cannot change. The census in
|
|
2287
|
+
* `haven-api-error-census.test.ts` requires every literal 5xx site to use
|
|
2288
|
+
* this or be allowlisted there with a reason.
|
|
2289
|
+
*/
|
|
2290
|
+
static deterministic(message: string, statusCode: number, body?: unknown, paymentId?: string): HavenApiError;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* #4470: the funding transaction's confirmation could not be read — ethers'
|
|
2294
|
+
* `waitForTransaction` rejected (its `TIMEOUT`, or an RPC failure). Haven had
|
|
2295
|
+
* already submitted the funding leg, so funds may have reached the delegate:
|
|
2296
|
+
* the answer is check-status, never "tell the user it failed" and never a new
|
|
2297
|
+
* payment. The merchant was not called.
|
|
2298
|
+
*
|
|
2299
|
+
* Deliberately carries no `failureCause`: it is not a transport non-answer
|
|
2300
|
+
* (no Haven request went unanswered) and not deterministic (a later read may
|
|
2301
|
+
* see the receipt). Callers answer the class itself — the hosted delivery
|
|
2302
|
+
* step does in `ensureFundingConfirmedOrRefuse`; unwrapped, its 504 reads
|
|
2303
|
+
* "re-call once", which re-runs the same wait.
|
|
2304
|
+
*/
|
|
2305
|
+
declare class FundingConfirmationUnknownError extends HavenApiError {
|
|
2306
|
+
readonly txHash: string;
|
|
2307
|
+
readonly chainId: number;
|
|
2308
|
+
readonly fundingErrorCode: "funding_confirmation_unknown";
|
|
2309
|
+
constructor(txHash: string, chainId: number, reason: string);
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* #4470: the funding transaction was mined and reverted, so nothing reached
|
|
2313
|
+
* the delegate. Repeating the wait gets the same receipt.
|
|
2314
|
+
*/
|
|
2315
|
+
declare class FundingRevertedError extends HavenApiError {
|
|
2316
|
+
readonly txHash: string;
|
|
2317
|
+
readonly chainId: number;
|
|
2318
|
+
readonly fundingErrorCode: "funding_reverted";
|
|
2319
|
+
constructor(txHash: string, chainId: number);
|
|
2178
2320
|
}
|
|
2179
2321
|
/**
|
|
2180
2322
|
* #1300: quoteX402 hit a URL that answered something other than 402 — the
|
|
@@ -2380,4 +2522,4 @@ declare class HavenTimeoutError extends HavenError {
|
|
|
2380
2522
|
constructor(paymentId: string);
|
|
2381
2523
|
}
|
|
2382
2524
|
|
|
2383
|
-
export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type
|
|
2525
|
+
export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type MerchantEgressTimeouts as aA, type MerchantEgressUse as aB, MerchantTimeoutError as aC, type PaymentFee as aD, type PaymentNextAction as aE, type PaymentPhase as aF, type PaymentStatus as aG, SIGNER_UPDATE_FALLBACK as aH, SignerRefusalCode as aI, type SweepConfirmation as aJ, type SweepEntry as aK, X402AlreadySettledError as aL, X402Erc7710AlreadySettledError as aM, type X402ExpectedAuth as aN, type X402ExpectedContext as aO, type X402PaymentOption as aP, type X402RequestSnapshot as aQ, X402TaskBudgetMismatchError as aR, X402UnexpectedStatusError as aS, assertPublicHttpsMerchantUrl as aT, isPublicHttpsMerchantUrl as aU, publicHttpsMerchantUrlRefusal as aV, readBodyCapped as aW, signerUpdateFallback as aX, strictMerchantEgressPolicy as aY, type RawPaymentParties as aZ, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, FundingConfirmationUnknownError as ab, FundingRevertedError as ac, HOSTED_DISCOVERY_TIMEOUT_MS as ad, HOSTED_EGRESS_TIMEOUTS as ae, HOSTED_MAX_GET_REDIRECTS as af, HOSTED_RESPONSE_BYTE_CAPS as ag, type HavenAgentAllowanceSummary as ah, type HavenAgentReadiness as ai, type HavenAgentSupersession as aj, type HavenAllowance as ak, HavenApiError as al, type HavenApiFailureCause as am, type HavenCatalogMerchant as an, type HavenListScope as ao, HavenPaymentStateError as ap, HavenSigningError as aq, HavenTimeoutError as ar, HavenUnsupportedSignerVersionError as as, HavenZeroSettlementHashError as at, MERCHANT_EGRESS_REFUSED_CODE as au, MERCHANT_EGRESS_RESPONSE_CAP_CODE as av, type MachinePaymentRail as aw, type MerchantEgressRefusalReason as ax, MerchantEgressRefusedError as ay, MerchantEgressResponseCapError as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
|
|
@@ -787,6 +787,14 @@ interface HavenAllowance {
|
|
|
787
787
|
* compared alone — they do not add up. Never a balance figure.
|
|
788
788
|
*/
|
|
789
789
|
fundsCoverRemaining: boolean | null;
|
|
790
|
+
/**
|
|
791
|
+
* #4355: when THIS budget next refills — the end of its current period
|
|
792
|
+
* (ISO 8601), or its start for a budget not yet started. `null` when it
|
|
793
|
+
* never refills again (it ends first), and on a backend that predates the
|
|
794
|
+
* field. With a remaining of 0 it says the budget is spent for this period
|
|
795
|
+
* and when it comes back — not that nobody approved one.
|
|
796
|
+
*/
|
|
797
|
+
nextRefillAt: string | null;
|
|
790
798
|
/**
|
|
791
799
|
* #3518: this budget's SCOPE, so an agent holding more than one budget
|
|
792
800
|
* for a token can name the merchant-locked one before paying. The
|
|
@@ -841,6 +849,14 @@ interface HavenAllowanceSummary {
|
|
|
841
849
|
delegateAddress: string;
|
|
842
850
|
chainId: number;
|
|
843
851
|
allowances: HavenAllowance[];
|
|
852
|
+
/**
|
|
853
|
+
* #4352 (additive, decision 5): when the agent's only budgets for this
|
|
854
|
+
* chain have ENDED, the latest ended budget's expiry (ISO 8601) — read by
|
|
855
|
+
* the same narrow expired-row query the refusal answers use. `null` when no
|
|
856
|
+
* expired row exists; the field NEVER reports a live budget. `null` on a
|
|
857
|
+
* backend that predates the field.
|
|
858
|
+
*/
|
|
859
|
+
budgetEndedAt: string | null;
|
|
844
860
|
/** #3772: see {@link HavenAgent.supersededBy}. */
|
|
845
861
|
supersededBy: HavenAgentSupersession | null;
|
|
846
862
|
}
|
|
@@ -1040,6 +1056,8 @@ interface HavenAgentAllowanceSummary {
|
|
|
1040
1056
|
* read: any non-boolean wire value maps to `null`, never `undefined`.
|
|
1041
1057
|
*/
|
|
1042
1058
|
fundsCoverRemaining: boolean | null;
|
|
1059
|
+
/** #4355: the {@link HavenAllowance.nextRefillAt} projection. */
|
|
1060
|
+
nextRefillAt: string | null;
|
|
1043
1061
|
}
|
|
1044
1062
|
/**
|
|
1045
1063
|
* One-shot "am I ready?" bootstrap: identity + live spend authority + a
|
|
@@ -1063,6 +1081,27 @@ interface HavenAgentSummary extends HavenAgent {
|
|
|
1063
1081
|
* renders from `HAVEN_CONNECTOR_CHANNEL` — see `connector-channel.ts`).
|
|
1064
1082
|
*/
|
|
1065
1083
|
spend_authority_readiness: HavenAgentReadiness;
|
|
1084
|
+
/**
|
|
1085
|
+
* #4355 (additive; the readiness values are unchanged — #4349 decision 5):
|
|
1086
|
+
* set only when readiness is `needs_approval` BECAUSE every live budget is
|
|
1087
|
+
* spent for its period — `allowances[]` has rows, all at remaining 0. It is
|
|
1088
|
+
* the earliest {@link HavenAgentAllowanceSummary.nextRefillAt} among them:
|
|
1089
|
+
* wait until then, or ask the owner to raise the budget. `null` otherwise:
|
|
1090
|
+
* ready, revoked, no budget approved (`allowances[]` empty), or a spent
|
|
1091
|
+
* budget that ends before it would refill.
|
|
1092
|
+
*/
|
|
1093
|
+
budgetRefillsAt: string | null;
|
|
1094
|
+
/**
|
|
1095
|
+
* #4352 (additive; the readiness values are unchanged — #4349 decision 5):
|
|
1096
|
+
* set only when readiness is `needs_approval` BECAUSE the agent's only
|
|
1097
|
+
* budget(s) have ENDED — `allowances[]` is empty and the server's
|
|
1098
|
+
* expired-row read found one. The ended budget's expiry (ISO 8601): waiting
|
|
1099
|
+
* will not help; ask the owner to set a new one. `null` otherwise — ready,
|
|
1100
|
+
* revoked, no budget approved at all, live rows present (whether spendable
|
|
1101
|
+
* or all spent — the latter is {@link HavenAgentSummary.budgetRefillsAt}'s
|
|
1102
|
+
* case), or a backend that predates the field.
|
|
1103
|
+
*/
|
|
1104
|
+
budgetEndedAt: string | null;
|
|
1066
1105
|
allowances: HavenAgentAllowanceSummary[];
|
|
1067
1106
|
/**
|
|
1068
1107
|
* #3329: open, unexpired task budgets — a derived VIEW, same discipline as
|
|
@@ -1389,6 +1428,23 @@ interface HavenPaymentReceipt {
|
|
|
1389
1428
|
paymentId: string;
|
|
1390
1429
|
paymentIntentId?: string | null;
|
|
1391
1430
|
approvalRequestId?: string | null;
|
|
1431
|
+
/**
|
|
1432
|
+
* #4469: which settlement branch moved the money (`eip3009` | `erc7710`),
|
|
1433
|
+
* from the intent (#946). The receipts wire declares this as raw text with
|
|
1434
|
+
* no enum (`packages/backend/src/openapi/spec.ts`), so it is typed
|
|
1435
|
+
* `string | null` here rather than narrowed: a value this SDK does not know
|
|
1436
|
+
* is still the backend's record, and narrowing it to `null` would erase it.
|
|
1437
|
+
* Absent on an older backend; `null` when the backend states no scheme
|
|
1438
|
+
* (legacy-rail receipts).
|
|
1439
|
+
*/
|
|
1440
|
+
settlementScheme?: string | null;
|
|
1441
|
+
/**
|
|
1442
|
+
* #4469: the budget delegation that METERED this payment (#3518), uniform
|
|
1443
|
+
* across schemes. `string | null` on receipts — the backend sends
|
|
1444
|
+
* `?? null` — unlike {@link PaymentStatusResult.budgetDelegationHash}, which
|
|
1445
|
+
* is `string` and absent when unknown. Absent on an older backend.
|
|
1446
|
+
*/
|
|
1447
|
+
budgetDelegationHash?: string | null;
|
|
1392
1448
|
/**
|
|
1393
1449
|
* #3134: the payment protocol this receipt settled on — one of the
|
|
1394
1450
|
* evidence-eligible rails (`x402`, `mpp_demo`, `mpp_crypto`, `spt`) — under the
|
|
@@ -1464,6 +1520,23 @@ interface HavenPaymentReceipt {
|
|
|
1464
1520
|
*/
|
|
1465
1521
|
protocolReceiptPayload?: Record<string, unknown> | null;
|
|
1466
1522
|
merchantStatus: number | null;
|
|
1523
|
+
/**
|
|
1524
|
+
* #4469: the paying agent's own delivery verdict (#3770), when it reported
|
|
1525
|
+
* one — `ok` | `unusable` | `partial`. Evidence only: it never gates
|
|
1526
|
+
* anything and the payment itself is unchanged. Absent on an older backend;
|
|
1527
|
+
* `null` when the backend states "not reported".
|
|
1528
|
+
*/
|
|
1529
|
+
deliveryQuality?: 'ok' | 'unusable' | 'partial' | null;
|
|
1530
|
+
/** #4469: the agent's optional note (max 2000 chars) saying what was wrong. Absent on an older backend. */
|
|
1531
|
+
deliveryNote?: string | null;
|
|
1532
|
+
/** #4469: when the agent reported the verdict (ISO 8601). Absent on an older backend. */
|
|
1533
|
+
deliveryReportedAt?: string | null;
|
|
1534
|
+
/**
|
|
1535
|
+
* #4469: the NON-SECRET pointer to a delivered good (#3778) — merchant,
|
|
1536
|
+
* product, value, order id. Never a redemption code or other credential:
|
|
1537
|
+
* those are refused at write. Absent on an older backend.
|
|
1538
|
+
*/
|
|
1539
|
+
deliveryReference?: string | null;
|
|
1467
1540
|
confirmedAt: string | null;
|
|
1468
1541
|
createdAt: string;
|
|
1469
1542
|
updatedAt: string;
|
|
@@ -1839,6 +1912,18 @@ declare const AgentPaymentWarningCode: {
|
|
|
1839
1912
|
* remains the actual gate either way.
|
|
1840
1913
|
*/
|
|
1841
1914
|
readonly QuoteExceedsRemainingBudget: "QUOTE_EXCEEDS_REMAINING_BUDGET";
|
|
1915
|
+
/**
|
|
1916
|
+
* #4458: the agent's only budget for the token has ENDED — the quote-time
|
|
1917
|
+
* pre-check answered the typed 403 `delegation_expired`, not an over-budget
|
|
1918
|
+
* compare. Travels beside `budget_check.sufficient: false` and, on
|
|
1919
|
+
* `haven_quote_x402`, `safe_to_continue: false` with no prefilled cap. The
|
|
1920
|
+
* remedy is the owner setting a NEW budget: waiting for a period to reset
|
|
1921
|
+
* cannot help, which is why this is its own code rather than
|
|
1922
|
+
* {@link AgentPaymentWarningCode.QuoteExceedsRemainingBudget}. Additive: an
|
|
1923
|
+
* older backend never emits it, and the on-chain policy remains the actual
|
|
1924
|
+
* gate either way.
|
|
1925
|
+
*/
|
|
1926
|
+
readonly QuoteBudgetEnded: "QUOTE_BUDGET_ENDED";
|
|
1842
1927
|
/**
|
|
1843
1928
|
* #3967: the MERCHANT reported a denial on one of its x402 payment options —
|
|
1844
1929
|
* a known denial key (starting with `issuanceDenied`) in `accepts[].extra`.
|
|
@@ -2172,9 +2257,66 @@ declare class HavenError extends Error {
|
|
|
2172
2257
|
readonly paymentId?: string | undefined;
|
|
2173
2258
|
constructor(message: string, code: string, statusCode?: number | undefined, paymentId?: string | undefined);
|
|
2174
2259
|
}
|
|
2260
|
+
/**
|
|
2261
|
+
* #4470: why a `HavenApiError` happened, where its status alone cannot say.
|
|
2262
|
+
*
|
|
2263
|
+
* - `no_answer` — the transport got no usable answer: the request timed out
|
|
2264
|
+
* (status 408), `fetch` threw, or the body was not JSON (status 0). Whether
|
|
2265
|
+
* the call took effect is unknown, so a `GET` may be retried and a `POST`
|
|
2266
|
+
* must not be; `method` says which it was.
|
|
2267
|
+
* - `deterministic` — the SDK refused an answer it cannot use (a missing
|
|
2268
|
+
* field, the wrong shape). Repeating the same call gets the same answer,
|
|
2269
|
+
* whatever the status says.
|
|
2270
|
+
*
|
|
2271
|
+
* Absent on every other error, which keeps the status rule. A readonly field
|
|
2272
|
+
* rather than a subclass, so `name`, `code` and `statusCode` stay what
|
|
2273
|
+
* consumers already match on.
|
|
2274
|
+
*/
|
|
2275
|
+
type HavenApiFailureCause = {
|
|
2276
|
+
readonly kind: 'no_answer';
|
|
2277
|
+
readonly method: 'GET' | 'POST';
|
|
2278
|
+
} | {
|
|
2279
|
+
readonly kind: 'deterministic';
|
|
2280
|
+
};
|
|
2175
2281
|
declare class HavenApiError extends HavenError {
|
|
2176
2282
|
readonly body?: unknown | undefined;
|
|
2177
|
-
|
|
2283
|
+
readonly failureCause?: HavenApiFailureCause | undefined;
|
|
2284
|
+
constructor(message: string, statusCode: number, body?: unknown | undefined, paymentId?: string, failureCause?: HavenApiFailureCause | undefined);
|
|
2285
|
+
/**
|
|
2286
|
+
* #4470: an error a retry cannot change. The census in
|
|
2287
|
+
* `haven-api-error-census.test.ts` requires every literal 5xx site to use
|
|
2288
|
+
* this or be allowlisted there with a reason.
|
|
2289
|
+
*/
|
|
2290
|
+
static deterministic(message: string, statusCode: number, body?: unknown, paymentId?: string): HavenApiError;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* #4470: the funding transaction's confirmation could not be read — ethers'
|
|
2294
|
+
* `waitForTransaction` rejected (its `TIMEOUT`, or an RPC failure). Haven had
|
|
2295
|
+
* already submitted the funding leg, so funds may have reached the delegate:
|
|
2296
|
+
* the answer is check-status, never "tell the user it failed" and never a new
|
|
2297
|
+
* payment. The merchant was not called.
|
|
2298
|
+
*
|
|
2299
|
+
* Deliberately carries no `failureCause`: it is not a transport non-answer
|
|
2300
|
+
* (no Haven request went unanswered) and not deterministic (a later read may
|
|
2301
|
+
* see the receipt). Callers answer the class itself — the hosted delivery
|
|
2302
|
+
* step does in `ensureFundingConfirmedOrRefuse`; unwrapped, its 504 reads
|
|
2303
|
+
* "re-call once", which re-runs the same wait.
|
|
2304
|
+
*/
|
|
2305
|
+
declare class FundingConfirmationUnknownError extends HavenApiError {
|
|
2306
|
+
readonly txHash: string;
|
|
2307
|
+
readonly chainId: number;
|
|
2308
|
+
readonly fundingErrorCode: "funding_confirmation_unknown";
|
|
2309
|
+
constructor(txHash: string, chainId: number, reason: string);
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* #4470: the funding transaction was mined and reverted, so nothing reached
|
|
2313
|
+
* the delegate. Repeating the wait gets the same receipt.
|
|
2314
|
+
*/
|
|
2315
|
+
declare class FundingRevertedError extends HavenApiError {
|
|
2316
|
+
readonly txHash: string;
|
|
2317
|
+
readonly chainId: number;
|
|
2318
|
+
readonly fundingErrorCode: "funding_reverted";
|
|
2319
|
+
constructor(txHash: string, chainId: number);
|
|
2178
2320
|
}
|
|
2179
2321
|
/**
|
|
2180
2322
|
* #1300: quoteX402 hit a URL that answered something other than 402 — the
|
|
@@ -2380,4 +2522,4 @@ declare class HavenTimeoutError extends HavenError {
|
|
|
2380
2522
|
constructor(paymentId: string);
|
|
2381
2523
|
}
|
|
2382
2524
|
|
|
2383
|
-
export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type
|
|
2525
|
+
export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type MerchantEgressTimeouts as aA, type MerchantEgressUse as aB, MerchantTimeoutError as aC, type PaymentFee as aD, type PaymentNextAction as aE, type PaymentPhase as aF, type PaymentStatus as aG, SIGNER_UPDATE_FALLBACK as aH, SignerRefusalCode as aI, type SweepConfirmation as aJ, type SweepEntry as aK, X402AlreadySettledError as aL, X402Erc7710AlreadySettledError as aM, type X402ExpectedAuth as aN, type X402ExpectedContext as aO, type X402PaymentOption as aP, type X402RequestSnapshot as aQ, X402TaskBudgetMismatchError as aR, X402UnexpectedStatusError as aS, assertPublicHttpsMerchantUrl as aT, isPublicHttpsMerchantUrl as aU, publicHttpsMerchantUrlRefusal as aV, readBodyCapped as aW, signerUpdateFallback as aX, strictMerchantEgressPolicy as aY, type RawPaymentParties as aZ, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, FundingConfirmationUnknownError as ab, FundingRevertedError as ac, HOSTED_DISCOVERY_TIMEOUT_MS as ad, HOSTED_EGRESS_TIMEOUTS as ae, HOSTED_MAX_GET_REDIRECTS as af, HOSTED_RESPONSE_BYTE_CAPS as ag, type HavenAgentAllowanceSummary as ah, type HavenAgentReadiness as ai, type HavenAgentSupersession as aj, type HavenAllowance as ak, HavenApiError as al, type HavenApiFailureCause as am, type HavenCatalogMerchant as an, type HavenListScope as ao, HavenPaymentStateError as ap, HavenSigningError as aq, HavenTimeoutError as ar, HavenUnsupportedSignerVersionError as as, HavenZeroSettlementHashError as at, MERCHANT_EGRESS_REFUSED_CODE as au, MERCHANT_EGRESS_RESPONSE_CAP_CODE as av, type MachinePaymentRail as aw, type MerchantEgressRefusalReason as ax, MerchantEgressRefusedError as ay, MerchantEgressResponseCapError as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
|