@haven_ai/sdk 0.0.0-dev.202609241737.2d2b91b → 0.0.0-dev.202609241957.179f300

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 CHANGED
@@ -257,7 +257,7 @@ const data = await response.json()
257
257
 
258
258
  Merchant-verified x402 retries use the official EIP-3009 `exact` scheme on Base USDC (`base` / `eip155:8453`). `haven.fetch()` sends the payment under `PAYMENT-SIGNATURE` (the x402 v2 name), and on the EIP-3009 bridge also under `X-PAYMENT` (v1), so a merchant on either version reads it. **On erc7710 it sends the v2 name ALONE**: that payload is always x402 v2, and its header carries a whole delegation chain, so duplicating it overflows the merchant's header limit and the request is refused with HTTP 431. If you build the retry yourself, follow the same rule. Haven's older tx-hash proof helper remains exported for Haven-native integrations; it is a different payload that happens to have shared the v2 name, and it is not what `haven.fetch()` sends.
259
259
 
260
- For standard x402, the `x402-wallet` identity is the agent delegate wallet, because that is the wallet that signs and settles the merchant payment. Integrations that scope access by Haven wallet/Safe address should use a Haven-native flow instead of standard merchant x402.
260
+ For standard x402, the `x402-wallet` identity is the agent delegate wallet, because that is the wallet that signs and settles the merchant payment. Integrations that scope access by Haven wallet address should use a Haven-native flow instead of standard merchant x402.
261
261
 
262
262
  ## AI Agent Integration
263
263
 
@@ -34,7 +34,7 @@ interface HavenClientConfig {
34
34
  * JSON-RPC RPC URLs keyed by EIP-155 chain ID.
35
35
  *
36
36
  * When provided for a chain, the SDK waits for ≥1 on-chain confirmation of
37
- * the AllowanceModule funding tx before retrying the merchant. This prevents
37
+ * the funding tx (account → delegate EOA) before retrying the merchant. This prevents
38
38
  * the race where the merchant's `balanceOf(delegate)` call runs before the
39
39
  * funding block has propagated to the merchant's RPC node.
40
40
  *
@@ -259,10 +259,10 @@ interface X402AuthorizationOptions {
259
259
  * Keyless x402 construct result.
260
260
  *
261
261
  * Returned by `createX402Intent` — the non-custodial half of an x402 payment.
262
- * It carries the unsigned funding hash (`signData.hash`, Safe → delegate EOA)
262
+ * It carries the unsigned funding payload (`signData`, account → delegate EOA)
263
263
  * plus everything the *edge* needs to build and sign the EIP-3009 merchant
264
264
  * header itself. The construct path never signs; both delegate signatures
265
- * (funding hash + merchant header) happen on the machine that holds the key.
265
+ * (funding payload + merchant header) happen on the machine that holds the key.
266
266
  */
267
267
  interface X402Intent {
268
268
  /** Haven payment id for the funding transfer. */
@@ -272,7 +272,7 @@ interface X402Intent {
272
272
  status: 'pending_signature';
273
273
  /** ISO 8601 expiry of the funding intent, if returned. */
274
274
  expiresAt?: string;
275
- /** The unsigned funding hash to sign with the delegate key (Safe → delegate EOA). */
275
+ /** The unsigned funding payload to sign with the delegate key (account → delegate EOA). */
276
276
  signData: SignData;
277
277
  /** The selected x402 option — the edge needs this to build the EIP-3009 header. */
278
278
  accepted: X402PaymentOption;
@@ -323,6 +323,11 @@ interface X402ExpectedContext {
323
323
  * which is NOT what the account validates — binding it alone would leave the
324
324
  * edge signer unable to verify the payload it is being asked to sign. Binding
325
325
  * this digest makes Haven's declaration cover the real payload.
326
+ *
327
+ * Absent ⇒ the retired version-1 bare-hash context. Since #3272 the backend
328
+ * never emits one (`signX402ExpectedContext` requires this field) and
329
+ * `@haven_ai/signer` refuses it with its version-mismatch refusal; the field
330
+ * stays optional here only because the type also describes older payloads.
326
331
  */
327
332
  typedDataHash?: string;
328
333
  /**
@@ -338,8 +343,9 @@ interface X402ExpectedContext {
338
343
  }
339
344
  interface X402ExpectedAuth {
340
345
  /**
341
- * 1 = hash-only (legacy rail). 2 = carries `typedDataHash` (delegation rail,
342
- * #1138).
346
+ * 2 = carries `typedDataHash` (delegation rail, #1138). 3 = additionally binds
347
+ * the payer identity (#1690). 1 (hash-only, retired Safe rail) is never
348
+ * emitted since #3272 and the signer refuses it.
343
349
  *
344
350
  * Deliberately `number`, not a literal union (#1143). This is an **inbound**
345
351
  * value: a signer parses a context Haven produced, and a signer older than the
@@ -619,12 +625,12 @@ interface HavenBalanceCoverage {
619
625
  /**
620
626
  * Affirmative spend-readiness for the authenticated agent, derived from the raw
621
627
  * agent status plus the remaining spend authority the backend reports per rail
622
- * (the on-chain AllowanceModule on the legacy rail; the active budget
623
- * delegation on the delegation rail — #1135):
628
+ * (the active budget delegation on the delegation rail — #1135; the retired
629
+ * AllowanceModule rail used an on-chain allowance instead):
624
630
  * - `ready` — active and at least one token has remaining spend authority.
625
631
  * - `needs_approval`— active but no remaining spend authority to auto-spend.
626
- * The over-budget outcome differs by rail: on the legacy
627
- * AllowanceModule rail the payment is queued for the wallet
632
+ * The over-budget outcome differs by rail: on the retired
633
+ * AllowanceModule rail the payment was queued for the wallet
628
634
  * owner to approve in Haven; on the delegation rail there is
629
635
  * NO approval queue — an over-budget redemption reverts
630
636
  * on-chain, so the owner must grant or raise the budget in
@@ -836,7 +842,7 @@ declare const DEFAULT_CONFIRMATION_TIMEOUT_MS = 90000;
836
842
  * done, or as failed, are the same defect in opposite directions.
837
843
  */
838
844
  type SweepConfirmation =
839
- /** A receipt was observed. The funds are in the Safe. */
845
+ /** A receipt was observed. The funds are in the agent's Haven account. */
840
846
  'confirmed'
841
847
  /**
842
848
  * Broadcast, but no receipt within `DEFAULT_CONFIRMATION_TIMEOUT_MS` (or the
@@ -877,7 +883,7 @@ interface SweepEntry {
877
883
  interface SweepResult {
878
884
  /** Address funds were swept FROM */
879
885
  fromAddress: string;
880
- /** Address funds were swept TO (always the originating Safe) */
886
+ /** Address funds were swept TO (always the agent's Haven account) */
881
887
  toAddress: string;
882
888
  /** Chain the sweep occurred on */
883
889
  chainId: number;
@@ -985,9 +991,9 @@ declare const AgentPaymentNextAction: {
985
991
  */
986
992
  readonly FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance";
987
993
  /**
988
- * The delegate wallet may hold funds that were sent from the Safe but never
989
- * settled to the merchant. The wallet owner should initiate a sweep to
990
- * return those funds to the originating Safe.
994
+ * The delegate wallet may hold funds that were sent from the agent's Haven
995
+ * account but never settled to the merchant. The wallet owner should initiate
996
+ * a sweep to return those funds to that account.
991
997
  */
992
998
  readonly SweepStrandedFunds: "sweep_stranded_funds";
993
999
  /**
@@ -1083,7 +1089,7 @@ type AgentPaymentFailureCode = (typeof AgentPaymentFailureCode)[keyof typeof Age
1083
1089
  * historical `mpp_demo` rows, which remain readable.
1084
1090
  */
1085
1091
  declare const AgentPaymentRail: {
1086
- /** Standard Haven payment from the user's Safe through an approved delegate allowance. */
1092
+ /** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
1087
1093
  readonly Direct: "direct";
1088
1094
  /** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
1089
1095
  readonly X402: "x402";
@@ -1645,7 +1651,7 @@ interface SweepEip712Domain {
1645
1651
  interface SweepAuthorization {
1646
1652
  /** Delegate EOA the funds are swept FROM. */
1647
1653
  from: string;
1648
- /** Originating Safe the funds are swept TO. */
1654
+ /** The agent's Haven account the funds are swept TO. */
1649
1655
  to: string;
1650
1656
  /** Atomic USDC amount (decimal string). */
1651
1657
  value: string;
@@ -2214,7 +2220,7 @@ declare function x402FacilitatorAddresses(option: X402PaymentOption): string[] |
2214
2220
  * positional match and never look at `extra.assetTransferMethod`, so a merchant
2215
2221
  * that listed its erc7710 entry first made a Haven client echo that option
2216
2222
  * while signing a standard EIP-3009 authorization. The merchant rejects the
2217
- * mismatch cleanly — but on the legacy two-leg the Safe→delegate funding
2223
+ * mismatch cleanly — but on the two-leg bridge the account→delegate funding
2218
2224
  * transfer has already executed, so the visible result is a stranded delegate
2219
2225
  * balance for the sweep to reclaim. Only our own demo merchant's ordering was
2220
2226
  * holding that shut, and that pin binds our merchant, not the ones we do not
@@ -34,7 +34,7 @@ interface HavenClientConfig {
34
34
  * JSON-RPC RPC URLs keyed by EIP-155 chain ID.
35
35
  *
36
36
  * When provided for a chain, the SDK waits for ≥1 on-chain confirmation of
37
- * the AllowanceModule funding tx before retrying the merchant. This prevents
37
+ * the funding tx (account → delegate EOA) before retrying the merchant. This prevents
38
38
  * the race where the merchant's `balanceOf(delegate)` call runs before the
39
39
  * funding block has propagated to the merchant's RPC node.
40
40
  *
@@ -259,10 +259,10 @@ interface X402AuthorizationOptions {
259
259
  * Keyless x402 construct result.
260
260
  *
261
261
  * Returned by `createX402Intent` — the non-custodial half of an x402 payment.
262
- * It carries the unsigned funding hash (`signData.hash`, Safe → delegate EOA)
262
+ * It carries the unsigned funding payload (`signData`, account → delegate EOA)
263
263
  * plus everything the *edge* needs to build and sign the EIP-3009 merchant
264
264
  * header itself. The construct path never signs; both delegate signatures
265
- * (funding hash + merchant header) happen on the machine that holds the key.
265
+ * (funding payload + merchant header) happen on the machine that holds the key.
266
266
  */
267
267
  interface X402Intent {
268
268
  /** Haven payment id for the funding transfer. */
@@ -272,7 +272,7 @@ interface X402Intent {
272
272
  status: 'pending_signature';
273
273
  /** ISO 8601 expiry of the funding intent, if returned. */
274
274
  expiresAt?: string;
275
- /** The unsigned funding hash to sign with the delegate key (Safe → delegate EOA). */
275
+ /** The unsigned funding payload to sign with the delegate key (account → delegate EOA). */
276
276
  signData: SignData;
277
277
  /** The selected x402 option — the edge needs this to build the EIP-3009 header. */
278
278
  accepted: X402PaymentOption;
@@ -323,6 +323,11 @@ interface X402ExpectedContext {
323
323
  * which is NOT what the account validates — binding it alone would leave the
324
324
  * edge signer unable to verify the payload it is being asked to sign. Binding
325
325
  * this digest makes Haven's declaration cover the real payload.
326
+ *
327
+ * Absent ⇒ the retired version-1 bare-hash context. Since #3272 the backend
328
+ * never emits one (`signX402ExpectedContext` requires this field) and
329
+ * `@haven_ai/signer` refuses it with its version-mismatch refusal; the field
330
+ * stays optional here only because the type also describes older payloads.
326
331
  */
327
332
  typedDataHash?: string;
328
333
  /**
@@ -338,8 +343,9 @@ interface X402ExpectedContext {
338
343
  }
339
344
  interface X402ExpectedAuth {
340
345
  /**
341
- * 1 = hash-only (legacy rail). 2 = carries `typedDataHash` (delegation rail,
342
- * #1138).
346
+ * 2 = carries `typedDataHash` (delegation rail, #1138). 3 = additionally binds
347
+ * the payer identity (#1690). 1 (hash-only, retired Safe rail) is never
348
+ * emitted since #3272 and the signer refuses it.
343
349
  *
344
350
  * Deliberately `number`, not a literal union (#1143). This is an **inbound**
345
351
  * value: a signer parses a context Haven produced, and a signer older than the
@@ -619,12 +625,12 @@ interface HavenBalanceCoverage {
619
625
  /**
620
626
  * Affirmative spend-readiness for the authenticated agent, derived from the raw
621
627
  * agent status plus the remaining spend authority the backend reports per rail
622
- * (the on-chain AllowanceModule on the legacy rail; the active budget
623
- * delegation on the delegation rail — #1135):
628
+ * (the active budget delegation on the delegation rail — #1135; the retired
629
+ * AllowanceModule rail used an on-chain allowance instead):
624
630
  * - `ready` — active and at least one token has remaining spend authority.
625
631
  * - `needs_approval`— active but no remaining spend authority to auto-spend.
626
- * The over-budget outcome differs by rail: on the legacy
627
- * AllowanceModule rail the payment is queued for the wallet
632
+ * The over-budget outcome differs by rail: on the retired
633
+ * AllowanceModule rail the payment was queued for the wallet
628
634
  * owner to approve in Haven; on the delegation rail there is
629
635
  * NO approval queue — an over-budget redemption reverts
630
636
  * on-chain, so the owner must grant or raise the budget in
@@ -836,7 +842,7 @@ declare const DEFAULT_CONFIRMATION_TIMEOUT_MS = 90000;
836
842
  * done, or as failed, are the same defect in opposite directions.
837
843
  */
838
844
  type SweepConfirmation =
839
- /** A receipt was observed. The funds are in the Safe. */
845
+ /** A receipt was observed. The funds are in the agent's Haven account. */
840
846
  'confirmed'
841
847
  /**
842
848
  * Broadcast, but no receipt within `DEFAULT_CONFIRMATION_TIMEOUT_MS` (or the
@@ -877,7 +883,7 @@ interface SweepEntry {
877
883
  interface SweepResult {
878
884
  /** Address funds were swept FROM */
879
885
  fromAddress: string;
880
- /** Address funds were swept TO (always the originating Safe) */
886
+ /** Address funds were swept TO (always the agent's Haven account) */
881
887
  toAddress: string;
882
888
  /** Chain the sweep occurred on */
883
889
  chainId: number;
@@ -985,9 +991,9 @@ declare const AgentPaymentNextAction: {
985
991
  */
986
992
  readonly FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance";
987
993
  /**
988
- * The delegate wallet may hold funds that were sent from the Safe but never
989
- * settled to the merchant. The wallet owner should initiate a sweep to
990
- * return those funds to the originating Safe.
994
+ * The delegate wallet may hold funds that were sent from the agent's Haven
995
+ * account but never settled to the merchant. The wallet owner should initiate
996
+ * a sweep to return those funds to that account.
991
997
  */
992
998
  readonly SweepStrandedFunds: "sweep_stranded_funds";
993
999
  /**
@@ -1083,7 +1089,7 @@ type AgentPaymentFailureCode = (typeof AgentPaymentFailureCode)[keyof typeof Age
1083
1089
  * historical `mpp_demo` rows, which remain readable.
1084
1090
  */
1085
1091
  declare const AgentPaymentRail: {
1086
- /** Standard Haven payment from the user's Safe through an approved delegate allowance. */
1092
+ /** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
1087
1093
  readonly Direct: "direct";
1088
1094
  /** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
1089
1095
  readonly X402: "x402";
@@ -1645,7 +1651,7 @@ interface SweepEip712Domain {
1645
1651
  interface SweepAuthorization {
1646
1652
  /** Delegate EOA the funds are swept FROM. */
1647
1653
  from: string;
1648
- /** Originating Safe the funds are swept TO. */
1654
+ /** The agent's Haven account the funds are swept TO. */
1649
1655
  to: string;
1650
1656
  /** Atomic USDC amount (decimal string). */
1651
1657
  value: string;
@@ -2214,7 +2220,7 @@ declare function x402FacilitatorAddresses(option: X402PaymentOption): string[] |
2214
2220
  * positional match and never look at `extra.assetTransferMethod`, so a merchant
2215
2221
  * that listed its erc7710 entry first made a Haven client echo that option
2216
2222
  * while signing a standard EIP-3009 authorization. The merchant rejects the
2217
- * mismatch cleanly — but on the legacy two-leg the Safe→delegate funding
2223
+ * mismatch cleanly — but on the two-leg bridge the account→delegate funding
2218
2224
  * transfer has already executed, so the visible result is a stranded delegate
2219
2225
  * balance for the sweep to reclaim. Only our own demo merchant's ordering was
2220
2226
  * holding that shut, and that pin binds our merchant, not the ones we do not
@@ -115,9 +115,9 @@ var AgentPaymentNextAction = {
115
115
  */
116
116
  FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance",
117
117
  /**
118
- * The delegate wallet may hold funds that were sent from the Safe but never
119
- * settled to the merchant. The wallet owner should initiate a sweep to
120
- * return those funds to the originating Safe.
118
+ * The delegate wallet may hold funds that were sent from the agent's Haven
119
+ * account but never settled to the merchant. The wallet owner should initiate
120
+ * a sweep to return those funds to that account.
121
121
  */
122
122
  SweepStrandedFunds: "sweep_stranded_funds",
123
123
  /**
@@ -191,7 +191,7 @@ var AgentPaymentFailureCode = {
191
191
  MerchantNotReady: "MERCHANT_NOT_READY"
192
192
  };
193
193
  var AgentPaymentRail = {
194
- /** Standard Haven payment from the user's Safe through an approved delegate allowance. */
194
+ /** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
195
195
  Direct: "direct",
196
196
  /** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
197
197
  X402: "x402",
@@ -1394,5 +1394,5 @@ exports.x402FacilitatorAddresses = x402FacilitatorAddresses;
1394
1394
  exports.x402PaymentHeaderNamesFor = x402PaymentHeaderNamesFor;
1395
1395
  exports.x402PaymentHeaderNamesSent = x402PaymentHeaderNamesSent;
1396
1396
  exports.x402V2PaymentEnvelope = x402V2PaymentEnvelope;
1397
- //# sourceMappingURL=chunk-CSWZXQ2L.cjs.map
1398
- //# sourceMappingURL=chunk-CSWZXQ2L.cjs.map
1397
+ //# sourceMappingURL=chunk-64ACOOIE.cjs.map
1398
+ //# sourceMappingURL=chunk-64ACOOIE.cjs.map