@haven_ai/sdk 0.7.0-alpha.0 → 0.8.1-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.
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk3SVPI4LS_cjs = require('./chunk-3SVPI4LS.cjs');
3
+ var chunkHX34HOW4_cjs = require('./chunk-HX34HOW4.cjs');
4
4
  var viem = require('viem');
5
5
 
6
6
  var ZERO_BYTES32 = `0x${"00".repeat(32)}`;
7
7
  var ROOT_AUTHORITY = `0x${"ff".repeat(32)}`;
8
8
  var DEFAULT_DELEGATOR = "0x98989898989898989898989898989898989898De";
9
9
  var DELEGATION_ARRAY_PARAM = [
10
- { type: "tuple[]", components: chunk3SVPI4LS_cjs.DELEGATION_TUPLE_COMPONENTS }
10
+ { type: "tuple[]", components: chunkHX34HOW4_cjs.DELEGATION_TUPLE_COMPONENTS }
11
11
  ];
12
12
  var EXECUTE_ABI = [
13
13
  {
@@ -83,16 +83,16 @@ function buildBoundRedeemDelegationsCallData(options) {
83
83
  10000n
84
84
  );
85
85
  return viem.encodeFunctionData({
86
- abi: chunk3SVPI4LS_cjs.REDEEM_DELEGATIONS_ABI,
86
+ abi: chunkHX34HOW4_cjs.REDEEM_DELEGATIONS_ABI,
87
87
  functionName: "redeemDelegations",
88
- args: [[permissionContext], [chunk3SVPI4LS_cjs.SINGLE_DEFAULT_MODE], [executionCallData]]
88
+ args: [[permissionContext], [chunkHX34HOW4_cjs.SINGLE_DEFAULT_MODE], [executionCallData]]
89
89
  });
90
90
  }
91
91
  function buildEmptyPermissionContextRedemption(selfCallCallData) {
92
92
  return viem.encodeFunctionData({
93
- abi: chunk3SVPI4LS_cjs.REDEEM_DELEGATIONS_ABI,
93
+ abi: chunkHX34HOW4_cjs.REDEEM_DELEGATIONS_ABI,
94
94
  functionName: "redeemDelegations",
95
- args: [[buildEmptyPermissionContext()], [chunk3SVPI4LS_cjs.SINGLE_DEFAULT_MODE], [selfCallCallData]]
95
+ args: [[buildEmptyPermissionContext()], [chunkHX34HOW4_cjs.SINGLE_DEFAULT_MODE], [selfCallCallData]]
96
96
  });
97
97
  }
98
98
  function buildExecuteCallData(target, value, innerCallData) {
@@ -104,20 +104,20 @@ function buildExecuteCallData(target, value, innerCallData) {
104
104
  }
105
105
  function buildBoundDirectUserOp(options) {
106
106
  const chainId = options.chainId ?? 84532;
107
- const sender = options.sender ?? chunk3SVPI4LS_cjs.deriveDelegateAccountAddress(options.delegate);
107
+ const sender = options.sender ?? chunkHX34HOW4_cjs.deriveDelegateAccountAddress(options.delegate);
108
108
  const callData = options.callData ?? buildExecuteCallData(
109
- options.target ?? chunk3SVPI4LS_cjs.DELEGATION_MANAGER,
109
+ options.target ?? chunkHX34HOW4_cjs.DELEGATION_MANAGER,
110
110
  options.value ?? 0n,
111
111
  buildBoundRedeemDelegationsCallData({ delegate: sender, delegator: options.delegator })
112
112
  );
113
113
  const typedData = {
114
114
  domain: {
115
- name: chunk3SVPI4LS_cjs.HYBRID_DELEGATOR_DOMAIN_NAME,
116
- version: chunk3SVPI4LS_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION,
115
+ name: chunkHX34HOW4_cjs.HYBRID_DELEGATOR_DOMAIN_NAME,
116
+ version: chunkHX34HOW4_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION,
117
117
  chainId,
118
118
  verifyingContract: sender
119
119
  },
120
- types: { PackedUserOperation: chunk3SVPI4LS_cjs.PACKED_USER_OPERATION_FIELDS.map((field) => ({ ...field })) },
120
+ types: { PackedUserOperation: chunkHX34HOW4_cjs.PACKED_USER_OPERATION_FIELDS.map((field) => ({ ...field })) },
121
121
  primaryType: "PackedUserOperation",
122
122
  message: {
123
123
  sender,
@@ -128,10 +128,10 @@ function buildBoundDirectUserOp(options) {
128
128
  preVerificationGas: "0",
129
129
  gasFees: ZERO_BYTES32,
130
130
  paymasterAndData: "0x",
131
- entryPoint: chunk3SVPI4LS_cjs.ENTRY_POINT_V07
131
+ entryPoint: chunkHX34HOW4_cjs.ENTRY_POINT_V07
132
132
  }
133
133
  };
134
- const payloadHash = chunk3SVPI4LS_cjs.packedUserOperationHash(typedData);
134
+ const payloadHash = chunkHX34HOW4_cjs.packedUserOperationHash(typedData);
135
135
  return { typedData, payloadHash, sender };
136
136
  }
137
137
  function buildSelfCallCallData(sender) {
@@ -149,7 +149,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
149
149
  const originalCallData = fixtureTypedData.message.callData;
150
150
  const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: originalCallData });
151
151
  const execution = executeArgs[0];
152
- const { args: redeemArgs } = viem.decodeFunctionData({ abi: chunk3SVPI4LS_cjs.REDEEM_DELEGATIONS_ABI, data: execution.callData });
152
+ const { args: redeemArgs } = viem.decodeFunctionData({ abi: chunkHX34HOW4_cjs.REDEEM_DELEGATIONS_ABI, data: execution.callData });
153
153
  const [permissionContexts, modes, executionCallDatas] = redeemArgs;
154
154
  const [delegations] = viem.decodeAbiParameters(DELEGATION_ARRAY_PARAM, permissionContexts[0]);
155
155
  const adjustedDelegations = delegations.map(
@@ -157,7 +157,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
157
157
  );
158
158
  const adjustedPermissionContext = viem.encodeAbiParameters(DELEGATION_ARRAY_PARAM, [adjustedDelegations]);
159
159
  const adjustedRedeemCallData = viem.encodeFunctionData({
160
- abi: chunk3SVPI4LS_cjs.REDEEM_DELEGATIONS_ABI,
160
+ abi: chunkHX34HOW4_cjs.REDEEM_DELEGATIONS_ABI,
161
161
  functionName: "redeemDelegations",
162
162
  args: [[adjustedPermissionContext], modes, executionCallDatas]
163
163
  });
@@ -171,13 +171,13 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
171
171
  domain: { ...fixtureTypedData.domain, verifyingContract: newSender },
172
172
  message: { ...fixtureTypedData.message, sender: newSender, callData: adjustedCallData }
173
173
  };
174
- const payloadHash = chunk3SVPI4LS_cjs.packedUserOperationHash(typedData);
174
+ const payloadHash = chunkHX34HOW4_cjs.packedUserOperationHash(typedData);
175
175
  return { typedData, payloadHash };
176
176
  }
177
177
  function buildFundingLegUserOp(options) {
178
- const sender = chunk3SVPI4LS_cjs.deriveDelegateAccountAddress(options.delegate);
178
+ const sender = chunkHX34HOW4_cjs.deriveDelegateAccountAddress(options.delegate);
179
179
  const callData = buildExecuteCallData(
180
- chunk3SVPI4LS_cjs.DELEGATION_MANAGER,
180
+ chunkHX34HOW4_cjs.DELEGATION_MANAGER,
181
181
  0n,
182
182
  buildBoundRedeemDelegationsCallData({
183
183
  delegate: sender,
@@ -1,4 +1,4 @@
1
- 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-NNIT7WAI.js';
1
+ 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-H4APV67M.js';
2
2
  import { encodeAbiParameters, encodePacked, encodeFunctionData, decodeFunctionData, decodeAbiParameters, hashTypedData } from 'viem';
3
3
 
4
4
  var ZERO_BYTES32 = `0x${"00".repeat(32)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven_ai/sdk",
3
- "version": "0.7.0-alpha.0",
3
+ "version": "0.8.1-alpha.0",
4
4
  "description": "TypeScript SDK for Haven — give AI agents budgeted, non-custodial payment ability. Pay x402 (HTTP 402) APIs in USDC within on-chain-enforced spending limits; the agent never holds funds or keys.",
5
5
  "engines": {
6
6
  "node": ">=22"