@haven_ai/sdk 0.0.0-dev.202609252109.630b3c3 → 0.0.0-dev.202609252136.3257a06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{base64-CiPypuyx.d.cts → base64-BzdRl5gR.d.cts} +1 -9
- package/dist/{base64-CiPypuyx.d.ts → base64-BzdRl5gR.d.ts} +1 -9
- package/dist/{chunk-SEFA7MR2.cjs → chunk-34SL4YRK.cjs} +17 -17
- package/dist/{chunk-SEFA7MR2.cjs.map → chunk-34SL4YRK.cjs.map} +1 -1
- package/dist/{chunk-MRPENBYE.cjs → chunk-F3QKAW3B.cjs} +2 -2
- package/dist/{chunk-AVKWY6JC.js.map → chunk-F3QKAW3B.cjs.map} +1 -1
- package/dist/{chunk-VKT55WON.js → chunk-TJ7ECJZB.js} +4 -4
- package/dist/{chunk-VKT55WON.js.map → chunk-TJ7ECJZB.js.map} +1 -1
- package/dist/{chunk-AVKWY6JC.js → chunk-XS3XBR5G.js} +2 -2
- package/dist/chunk-XS3XBR5G.js.map +1 -0
- package/dist/edge.cjs +57 -57
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +3 -3
- package/dist/index.cjs +277 -281
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/dist/test-support.cjs +18 -18
- package/dist/test-support.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-MRPENBYE.cjs.map +0 -1
|
@@ -755,8 +755,6 @@ interface HavenPaymentReceipt {
|
|
|
755
755
|
* receipt analogue, because no protocol means no evidence row.
|
|
756
756
|
*/
|
|
757
757
|
source: string;
|
|
758
|
-
/** @deprecated (#3134) twin of {@link source}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
759
|
-
rail: string;
|
|
760
758
|
/**
|
|
761
759
|
* #3134: the evidence row's recorded proof status, under the transactions
|
|
762
760
|
* feed's name. Same name, different nullability: `string` here because a
|
|
@@ -764,8 +762,6 @@ interface HavenPaymentReceipt {
|
|
|
764
762
|
* LEFT JOIN to none (#3132) — do not share a non-null-asserting helper.
|
|
765
763
|
*/
|
|
766
764
|
paymentProofStatus: string;
|
|
767
|
-
/** @deprecated (#3134) twin of {@link paymentProofStatus}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
768
|
-
proofStatus: string;
|
|
769
765
|
/**
|
|
770
766
|
* @deprecated (#2998) meaning depends on the settlement scheme — the
|
|
771
767
|
* account → delegate funding transaction on eip3009, the (only) settlement
|
|
@@ -785,12 +781,8 @@ interface HavenPaymentReceipt {
|
|
|
785
781
|
chainId: number;
|
|
786
782
|
/** #3134: the paid resource, under the transactions feed's protocol-prefixed name (`string | null` there; a receipt always has one). */
|
|
787
783
|
x402ResourceUrl: string;
|
|
788
|
-
/** @deprecated (#3134) twin of {@link x402ResourceUrl}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
789
|
-
resourceUrl: string;
|
|
790
784
|
/** #3134: the merchant paid, under the transactions feed's protocol-prefixed name. */
|
|
791
785
|
x402MerchantAddress: string | null;
|
|
792
|
-
/** @deprecated (#3134) twin of {@link x402MerchantAddress}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
793
|
-
merchantAddress: string | null;
|
|
794
786
|
payerAddress: string;
|
|
795
787
|
/** #2960: additive alongside `payerAddress` above (`parties.treasury_account` only). */
|
|
796
788
|
parties?: PaymentParties;
|
|
@@ -1794,7 +1786,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1794
1786
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1795
1787
|
* it with the package version on every release — never hand-edit it.
|
|
1796
1788
|
*/
|
|
1797
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
1789
|
+
declare const SDK_VERSION = "0.0.0-dev.202609252136.3257a06";
|
|
1798
1790
|
/** The request header every published Haven client sends. */
|
|
1799
1791
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
1800
1792
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -755,8 +755,6 @@ interface HavenPaymentReceipt {
|
|
|
755
755
|
* receipt analogue, because no protocol means no evidence row.
|
|
756
756
|
*/
|
|
757
757
|
source: string;
|
|
758
|
-
/** @deprecated (#3134) twin of {@link source}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
759
|
-
rail: string;
|
|
760
758
|
/**
|
|
761
759
|
* #3134: the evidence row's recorded proof status, under the transactions
|
|
762
760
|
* feed's name. Same name, different nullability: `string` here because a
|
|
@@ -764,8 +762,6 @@ interface HavenPaymentReceipt {
|
|
|
764
762
|
* LEFT JOIN to none (#3132) — do not share a non-null-asserting helper.
|
|
765
763
|
*/
|
|
766
764
|
paymentProofStatus: string;
|
|
767
|
-
/** @deprecated (#3134) twin of {@link paymentProofStatus}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
768
|
-
proofStatus: string;
|
|
769
765
|
/**
|
|
770
766
|
* @deprecated (#2998) meaning depends on the settlement scheme — the
|
|
771
767
|
* account → delegate funding transaction on eip3009, the (only) settlement
|
|
@@ -785,12 +781,8 @@ interface HavenPaymentReceipt {
|
|
|
785
781
|
chainId: number;
|
|
786
782
|
/** #3134: the paid resource, under the transactions feed's protocol-prefixed name (`string | null` there; a receipt always has one). */
|
|
787
783
|
x402ResourceUrl: string;
|
|
788
|
-
/** @deprecated (#3134) twin of {@link x402ResourceUrl}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
789
|
-
resourceUrl: string;
|
|
790
784
|
/** #3134: the merchant paid, under the transactions feed's protocol-prefixed name. */
|
|
791
785
|
x402MerchantAddress: string | null;
|
|
792
|
-
/** @deprecated (#3134) twin of {@link x402MerchantAddress}; removed once all three release clocks have moved — see `mapPaymentReceipt`. */
|
|
793
|
-
merchantAddress: string | null;
|
|
794
786
|
payerAddress: string;
|
|
795
787
|
/** #2960: additive alongside `payerAddress` above (`parties.treasury_account` only). */
|
|
796
788
|
parties?: PaymentParties;
|
|
@@ -1794,7 +1786,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1794
1786
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1795
1787
|
* it with the package version on every release — never hand-edit it.
|
|
1796
1788
|
*/
|
|
1797
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
1789
|
+
declare const SDK_VERSION = "0.0.0-dev.202609252136.3257a06";
|
|
1798
1790
|
/** The request header every published Haven client sends. */
|
|
1799
1791
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
1800
1792
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkF3QKAW3B_cjs = require('./chunk-F3QKAW3B.cjs');
|
|
4
4
|
var viem = require('viem');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
|
|
7
7
|
var TYPED_DATA_NOT_ALLOWED = "TYPED_DATA_NOT_ALLOWED";
|
|
8
|
-
var HavenTypedDataRefusedError = class extends
|
|
8
|
+
var HavenTypedDataRefusedError = class extends chunkF3QKAW3B_cjs.HavenSigningError {
|
|
9
9
|
constructor(message) {
|
|
10
10
|
super(message);
|
|
11
11
|
this.code = TYPED_DATA_NOT_ALLOWED;
|
|
@@ -46,7 +46,7 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
46
46
|
`This signer only signs direct payments on chains the delegation rail has pinned contracts for (${[...DIRECT_PAYMENT_CHAIN_IDS].join(", ")}); this typed data names chain ${String(domain.chainId)}. Refusing.`
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
const ownAccount =
|
|
49
|
+
const ownAccount = chunkF3QKAW3B_cjs.deriveDelegateAccountAddress(delegateAddress);
|
|
50
50
|
const sender = typeof message.sender === "string" ? message.sender : "";
|
|
51
51
|
if (sender.toLowerCase() !== ownAccount.toLowerCase()) {
|
|
52
52
|
throw new HavenTypedDataRefusedError(
|
|
@@ -76,9 +76,9 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
76
76
|
"This UserOperation's execute() call does not re-encode to the exact callData bytes (trailing or non-canonical bytes). Refusing."
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
if (decoded.target.toLowerCase() !==
|
|
79
|
+
if (decoded.target.toLowerCase() !== chunkF3QKAW3B_cjs.DELEGATION_MANAGER.toLowerCase()) {
|
|
80
80
|
throw new HavenTypedDataRefusedError(
|
|
81
|
-
`This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${
|
|
81
|
+
`This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkF3QKAW3B_cjs.DELEGATION_MANAGER}). A direct payment only ever redeems the agent's own budget delegation \u2014 refusing what looks like a self-call (e.g. transferOwnership, updateSigners, upgradeToAndCall) or a call to an unrelated contract.`
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
if (decoded.value !== 0n) {
|
|
@@ -87,20 +87,20 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
try {
|
|
90
|
-
|
|
90
|
+
chunkF3QKAW3B_cjs.assertRedeemsOwnBudgetDelegation(decoded.callData, ownAccount);
|
|
91
91
|
} catch (err) {
|
|
92
92
|
throw new HavenTypedDataRefusedError(err instanceof Error ? err.message : String(err));
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
function assertOwnSettlementChild(typedData, expectation, delegateAddress) {
|
|
96
96
|
try {
|
|
97
|
-
|
|
97
|
+
chunkF3QKAW3B_cjs.verifySettlementChild(typedData, {
|
|
98
98
|
...expectation,
|
|
99
|
-
delegatorAccount:
|
|
99
|
+
delegatorAccount: chunkF3QKAW3B_cjs.deriveDelegateAccountAddress(delegateAddress)
|
|
100
100
|
});
|
|
101
101
|
} catch (err) {
|
|
102
102
|
if (err instanceof HavenTypedDataRefusedError) throw err;
|
|
103
|
-
if (err instanceof
|
|
103
|
+
if (err instanceof chunkF3QKAW3B_cjs.HavenSigningError) throw new HavenTypedDataRefusedError(err.message);
|
|
104
104
|
throw new HavenTypedDataRefusedError(
|
|
105
105
|
`Refusing to sign the x402 settlement child: it is malformed (${err instanceof Error ? err.message : String(err)}).`
|
|
106
106
|
);
|
|
@@ -129,7 +129,7 @@ function assertFundingLegPaysDelegate(typedData, expected) {
|
|
|
129
129
|
try {
|
|
130
130
|
const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: message.callData });
|
|
131
131
|
const inner = executeArgs[0].callData;
|
|
132
|
-
const { args } = viem.decodeFunctionData({ abi:
|
|
132
|
+
const { args } = viem.decodeFunctionData({ abi: chunkF3QKAW3B_cjs.REDEEM_DELEGATIONS_ABI, data: inner });
|
|
133
133
|
const executions = args[2];
|
|
134
134
|
executionCallData = executions[0];
|
|
135
135
|
} catch {
|
|
@@ -248,7 +248,7 @@ var TRANSFER_WITH_AUTHORIZATION_TYPES = {
|
|
|
248
248
|
function sweepUsdcAddress(chainId) {
|
|
249
249
|
const address = USDC_ADDRESS_BY_CHAIN[chainId];
|
|
250
250
|
if (!address) {
|
|
251
|
-
throw new
|
|
251
|
+
throw new chunkF3QKAW3B_cjs.HavenSigningError(
|
|
252
252
|
`Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
|
|
253
253
|
);
|
|
254
254
|
}
|
|
@@ -257,7 +257,7 @@ function sweepUsdcAddress(chainId) {
|
|
|
257
257
|
function sweepUsdcDomain(chainId) {
|
|
258
258
|
const domain = USDC_EIP712_DOMAIN_BY_CHAIN[chainId];
|
|
259
259
|
if (!domain) {
|
|
260
|
-
throw new
|
|
260
|
+
throw new chunkF3QKAW3B_cjs.HavenSigningError(
|
|
261
261
|
`Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
|
|
262
262
|
);
|
|
263
263
|
}
|
|
@@ -270,12 +270,12 @@ function buildSweepTypedData(auth) {
|
|
|
270
270
|
const domain = sweepUsdcDomain(auth.chainId);
|
|
271
271
|
const expectedToken = sweepUsdcAddress(auth.chainId);
|
|
272
272
|
if (!sameAddress(auth.token, expectedToken)) {
|
|
273
|
-
throw new
|
|
273
|
+
throw new chunkF3QKAW3B_cjs.HavenSigningError(
|
|
274
274
|
`Sweep token ${auth.token} is not the canonical USDC contract for chain ${auth.chainId}.`
|
|
275
275
|
);
|
|
276
276
|
}
|
|
277
277
|
if (!/^0x[0-9a-fA-F]{64}$/.test(auth.nonce)) {
|
|
278
|
-
throw new
|
|
278
|
+
throw new chunkF3QKAW3B_cjs.HavenSigningError("Sweep nonce must be a 0x-prefixed 32-byte hex string.");
|
|
279
279
|
}
|
|
280
280
|
return {
|
|
281
281
|
domain,
|
|
@@ -779,7 +779,7 @@ function stableStringify2(value) {
|
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
// src/client-identity.ts
|
|
782
|
-
var SDK_VERSION = "0.0.0-dev.
|
|
782
|
+
var SDK_VERSION = "0.0.0-dev.202609252136.3257a06";
|
|
783
783
|
var HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
784
784
|
function havenClientIdentity(pkg, version) {
|
|
785
785
|
return `${pkg}/${version}`;
|
|
@@ -966,5 +966,5 @@ exports.x402FacilitatorAddresses = x402FacilitatorAddresses;
|
|
|
966
966
|
exports.x402PaymentHeaderNamesFor = x402PaymentHeaderNamesFor;
|
|
967
967
|
exports.x402PaymentHeaderNamesSent = x402PaymentHeaderNamesSent;
|
|
968
968
|
exports.x402V2PaymentEnvelope = x402V2PaymentEnvelope;
|
|
969
|
-
//# sourceMappingURL=chunk-
|
|
970
|
-
//# sourceMappingURL=chunk-
|
|
969
|
+
//# sourceMappingURL=chunk-34SL4YRK.cjs.map
|
|
970
|
+
//# sourceMappingURL=chunk-34SL4YRK.cjs.map
|