@haven_ai/sdk 0.0.0-dev.202609241737.2d2b91b → 0.0.0-dev.202609241802.ea320de
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 +1 -1
- package/dist/{base64-fVc9Cnn-.d.cts → base64-CPxbmyU9.d.cts} +16 -16
- package/dist/{base64-fVc9Cnn-.d.ts → base64-CPxbmyU9.d.ts} +16 -16
- package/dist/{chunk-YGSM2WRP.js → chunk-FR5R26V3.js} +6 -6
- package/dist/chunk-FR5R26V3.js.map +1 -0
- package/dist/{chunk-CSWZXQ2L.cjs → chunk-M57KOLAN.cjs} +6 -6
- package/dist/chunk-M57KOLAN.cjs.map +1 -0
- package/dist/edge.cjs +32 -32
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +2 -2
- package/dist/index.cjs +260 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CSWZXQ2L.cjs.map +0 -1
- package/dist/chunk-YGSM2WRP.js.map +0 -1
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -619,12 +619,12 @@ interface HavenBalanceCoverage {
|
|
|
619
619
|
/**
|
|
620
620
|
* Affirmative spend-readiness for the authenticated agent, derived from the raw
|
|
621
621
|
* agent status plus the remaining spend authority the backend reports per rail
|
|
622
|
-
* (the
|
|
623
|
-
*
|
|
622
|
+
* (the active budget delegation on the delegation rail — #1135; the retired
|
|
623
|
+
* AllowanceModule rail used an on-chain allowance instead):
|
|
624
624
|
* - `ready` — active and at least one token has remaining spend authority.
|
|
625
625
|
* - `needs_approval`— active but no remaining spend authority to auto-spend.
|
|
626
|
-
* The over-budget outcome differs by rail: on the
|
|
627
|
-
* AllowanceModule rail the payment
|
|
626
|
+
* The over-budget outcome differs by rail: on the retired
|
|
627
|
+
* AllowanceModule rail the payment was queued for the wallet
|
|
628
628
|
* owner to approve in Haven; on the delegation rail there is
|
|
629
629
|
* NO approval queue — an over-budget redemption reverts
|
|
630
630
|
* on-chain, so the owner must grant or raise the budget in
|
|
@@ -836,7 +836,7 @@ declare const DEFAULT_CONFIRMATION_TIMEOUT_MS = 90000;
|
|
|
836
836
|
* done, or as failed, are the same defect in opposite directions.
|
|
837
837
|
*/
|
|
838
838
|
type SweepConfirmation =
|
|
839
|
-
/** A receipt was observed. The funds are in the
|
|
839
|
+
/** A receipt was observed. The funds are in the agent's Haven account. */
|
|
840
840
|
'confirmed'
|
|
841
841
|
/**
|
|
842
842
|
* Broadcast, but no receipt within `DEFAULT_CONFIRMATION_TIMEOUT_MS` (or the
|
|
@@ -877,7 +877,7 @@ interface SweepEntry {
|
|
|
877
877
|
interface SweepResult {
|
|
878
878
|
/** Address funds were swept FROM */
|
|
879
879
|
fromAddress: string;
|
|
880
|
-
/** Address funds were swept TO (always the
|
|
880
|
+
/** Address funds were swept TO (always the agent's Haven account) */
|
|
881
881
|
toAddress: string;
|
|
882
882
|
/** Chain the sweep occurred on */
|
|
883
883
|
chainId: number;
|
|
@@ -985,9 +985,9 @@ declare const AgentPaymentNextAction: {
|
|
|
985
985
|
*/
|
|
986
986
|
readonly FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance";
|
|
987
987
|
/**
|
|
988
|
-
* The delegate wallet may hold funds that were sent from the
|
|
989
|
-
* settled to the merchant. The wallet owner should initiate
|
|
990
|
-
* return those funds to
|
|
988
|
+
* The delegate wallet may hold funds that were sent from the agent's Haven
|
|
989
|
+
* account but never settled to the merchant. The wallet owner should initiate
|
|
990
|
+
* a sweep to return those funds to that account.
|
|
991
991
|
*/
|
|
992
992
|
readonly SweepStrandedFunds: "sweep_stranded_funds";
|
|
993
993
|
/**
|
|
@@ -1083,7 +1083,7 @@ type AgentPaymentFailureCode = (typeof AgentPaymentFailureCode)[keyof typeof Age
|
|
|
1083
1083
|
* historical `mpp_demo` rows, which remain readable.
|
|
1084
1084
|
*/
|
|
1085
1085
|
declare const AgentPaymentRail: {
|
|
1086
|
-
/** Standard Haven payment from the user's
|
|
1086
|
+
/** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
|
|
1087
1087
|
readonly Direct: "direct";
|
|
1088
1088
|
/** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
|
|
1089
1089
|
readonly X402: "x402";
|
|
@@ -1645,7 +1645,7 @@ interface SweepEip712Domain {
|
|
|
1645
1645
|
interface SweepAuthorization {
|
|
1646
1646
|
/** Delegate EOA the funds are swept FROM. */
|
|
1647
1647
|
from: string;
|
|
1648
|
-
/**
|
|
1648
|
+
/** The agent's Haven account the funds are swept TO. */
|
|
1649
1649
|
to: string;
|
|
1650
1650
|
/** Atomic USDC amount (decimal string). */
|
|
1651
1651
|
value: string;
|
|
@@ -2214,7 +2214,7 @@ declare function x402FacilitatorAddresses(option: X402PaymentOption): string[] |
|
|
|
2214
2214
|
* positional match and never look at `extra.assetTransferMethod`, so a merchant
|
|
2215
2215
|
* that listed its erc7710 entry first made a Haven client echo that option
|
|
2216
2216
|
* while signing a standard EIP-3009 authorization. The merchant rejects the
|
|
2217
|
-
* mismatch cleanly — but on the
|
|
2217
|
+
* mismatch cleanly — but on the two-leg bridge the account→delegate funding
|
|
2218
2218
|
* transfer has already executed, so the visible result is a stranded delegate
|
|
2219
2219
|
* balance for the sweep to reclaim. Only our own demo merchant's ordering was
|
|
2220
2220
|
* 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
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -619,12 +619,12 @@ interface HavenBalanceCoverage {
|
|
|
619
619
|
/**
|
|
620
620
|
* Affirmative spend-readiness for the authenticated agent, derived from the raw
|
|
621
621
|
* agent status plus the remaining spend authority the backend reports per rail
|
|
622
|
-
* (the
|
|
623
|
-
*
|
|
622
|
+
* (the active budget delegation on the delegation rail — #1135; the retired
|
|
623
|
+
* AllowanceModule rail used an on-chain allowance instead):
|
|
624
624
|
* - `ready` — active and at least one token has remaining spend authority.
|
|
625
625
|
* - `needs_approval`— active but no remaining spend authority to auto-spend.
|
|
626
|
-
* The over-budget outcome differs by rail: on the
|
|
627
|
-
* AllowanceModule rail the payment
|
|
626
|
+
* The over-budget outcome differs by rail: on the retired
|
|
627
|
+
* AllowanceModule rail the payment was queued for the wallet
|
|
628
628
|
* owner to approve in Haven; on the delegation rail there is
|
|
629
629
|
* NO approval queue — an over-budget redemption reverts
|
|
630
630
|
* on-chain, so the owner must grant or raise the budget in
|
|
@@ -836,7 +836,7 @@ declare const DEFAULT_CONFIRMATION_TIMEOUT_MS = 90000;
|
|
|
836
836
|
* done, or as failed, are the same defect in opposite directions.
|
|
837
837
|
*/
|
|
838
838
|
type SweepConfirmation =
|
|
839
|
-
/** A receipt was observed. The funds are in the
|
|
839
|
+
/** A receipt was observed. The funds are in the agent's Haven account. */
|
|
840
840
|
'confirmed'
|
|
841
841
|
/**
|
|
842
842
|
* Broadcast, but no receipt within `DEFAULT_CONFIRMATION_TIMEOUT_MS` (or the
|
|
@@ -877,7 +877,7 @@ interface SweepEntry {
|
|
|
877
877
|
interface SweepResult {
|
|
878
878
|
/** Address funds were swept FROM */
|
|
879
879
|
fromAddress: string;
|
|
880
|
-
/** Address funds were swept TO (always the
|
|
880
|
+
/** Address funds were swept TO (always the agent's Haven account) */
|
|
881
881
|
toAddress: string;
|
|
882
882
|
/** Chain the sweep occurred on */
|
|
883
883
|
chainId: number;
|
|
@@ -985,9 +985,9 @@ declare const AgentPaymentNextAction: {
|
|
|
985
985
|
*/
|
|
986
986
|
readonly FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance";
|
|
987
987
|
/**
|
|
988
|
-
* The delegate wallet may hold funds that were sent from the
|
|
989
|
-
* settled to the merchant. The wallet owner should initiate
|
|
990
|
-
* return those funds to
|
|
988
|
+
* The delegate wallet may hold funds that were sent from the agent's Haven
|
|
989
|
+
* account but never settled to the merchant. The wallet owner should initiate
|
|
990
|
+
* a sweep to return those funds to that account.
|
|
991
991
|
*/
|
|
992
992
|
readonly SweepStrandedFunds: "sweep_stranded_funds";
|
|
993
993
|
/**
|
|
@@ -1083,7 +1083,7 @@ type AgentPaymentFailureCode = (typeof AgentPaymentFailureCode)[keyof typeof Age
|
|
|
1083
1083
|
* historical `mpp_demo` rows, which remain readable.
|
|
1084
1084
|
*/
|
|
1085
1085
|
declare const AgentPaymentRail: {
|
|
1086
|
-
/** Standard Haven payment from the user's
|
|
1086
|
+
/** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
|
|
1087
1087
|
readonly Direct: "direct";
|
|
1088
1088
|
/** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
|
|
1089
1089
|
readonly X402: "x402";
|
|
@@ -1645,7 +1645,7 @@ interface SweepEip712Domain {
|
|
|
1645
1645
|
interface SweepAuthorization {
|
|
1646
1646
|
/** Delegate EOA the funds are swept FROM. */
|
|
1647
1647
|
from: string;
|
|
1648
|
-
/**
|
|
1648
|
+
/** The agent's Haven account the funds are swept TO. */
|
|
1649
1649
|
to: string;
|
|
1650
1650
|
/** Atomic USDC amount (decimal string). */
|
|
1651
1651
|
value: string;
|
|
@@ -2214,7 +2214,7 @@ declare function x402FacilitatorAddresses(option: X402PaymentOption): string[] |
|
|
|
2214
2214
|
* positional match and never look at `extra.assetTransferMethod`, so a merchant
|
|
2215
2215
|
* that listed its erc7710 entry first made a Haven client echo that option
|
|
2216
2216
|
* while signing a standard EIP-3009 authorization. The merchant rejects the
|
|
2217
|
-
* mismatch cleanly — but on the
|
|
2217
|
+
* mismatch cleanly — but on the two-leg bridge the account→delegate funding
|
|
2218
2218
|
* transfer has already executed, so the visible result is a stranded delegate
|
|
2219
2219
|
* balance for the sweep to reclaim. Only our own demo merchant's ordering was
|
|
2220
2220
|
* holding that shut, and that pin binds our merchant, not the ones we do not
|
|
@@ -113,9 +113,9 @@ var AgentPaymentNextAction = {
|
|
|
113
113
|
*/
|
|
114
114
|
FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance",
|
|
115
115
|
/**
|
|
116
|
-
* The delegate wallet may hold funds that were sent from the
|
|
117
|
-
* settled to the merchant. The wallet owner should initiate
|
|
118
|
-
* return those funds to
|
|
116
|
+
* The delegate wallet may hold funds that were sent from the agent's Haven
|
|
117
|
+
* account but never settled to the merchant. The wallet owner should initiate
|
|
118
|
+
* a sweep to return those funds to that account.
|
|
119
119
|
*/
|
|
120
120
|
SweepStrandedFunds: "sweep_stranded_funds",
|
|
121
121
|
/**
|
|
@@ -189,7 +189,7 @@ var AgentPaymentFailureCode = {
|
|
|
189
189
|
MerchantNotReady: "MERCHANT_NOT_READY"
|
|
190
190
|
};
|
|
191
191
|
var AgentPaymentRail = {
|
|
192
|
-
/** Standard Haven payment from the user's
|
|
192
|
+
/** Standard Haven payment from the user's account, redeemed through the agent's budget delegation. */
|
|
193
193
|
Direct: "direct",
|
|
194
194
|
/** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
|
|
195
195
|
X402: "x402",
|
|
@@ -1292,5 +1292,5 @@ function major(version) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
1294
|
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, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DEFAULT_NEXT_TOOL_BY_ACTION, DIRECT_SIGN_CONTEXT_VERSION, ENTRY_POINT_V07, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_CONNECTOR_CHANNEL, HAVEN_MINIMUM_NODE_VERSION, HYBRID_DELEGATOR_DOMAIN_NAME, HYBRID_DELEGATOR_DOMAIN_VERSION, HavenApiError, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, HavenUserOpBindingError, HavenZeroSettlementHashError, MerchantTimeoutError, NEXT_TOOL_SERVER_NAMES, NEXT_TOOL_SERVER_ROLES, PACKED_USER_OPERATION_FIELDS, SIGNER_UPDATE_FALLBACK, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402AlreadySettledError, X402PaymentHeaderValidationError, X402UnexpectedStatusError, X402_LEGACY_PAYMENT_HEADER_NAME, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_PAYMENT_HEADER_NAME, X402_PAYMENT_HEADER_NAMES, X402_PAYMENT_HEADER_NAMES_SENT, X402_PAYMENT_REQUIRED_HEADER_NAME, X402_PAYMENT_RESPONSE_HEADER_NAME, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, assertUserOpTypedDataBinding, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, buildX402IdempotencyKey, compareNodeVersions, connectorRerunCommand, connectorSpec, createNextStepBuilder, decodeBase64Json, decodeBase64Utf8, defaultNextToolFor, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, isConnectorChannel, isErc7710Option, isPackedUserOperationTypedData, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, packedUserOperationHash, parseNextTool, parsePaymentRequired, parsePaymentRequiredResponse, renderNextTool, resolveConnectorChannel, resolveTokenFromAddress, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signerUpdateFallback, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses, x402PaymentHeaderNamesFor, x402PaymentHeaderNamesSent, x402V2PaymentEnvelope };
|
|
1295
|
-
//# sourceMappingURL=chunk-
|
|
1296
|
-
//# sourceMappingURL=chunk-
|
|
1295
|
+
//# sourceMappingURL=chunk-FR5R26V3.js.map
|
|
1296
|
+
//# sourceMappingURL=chunk-FR5R26V3.js.map
|