@haven_ai/signer 0.2.1-alpha.0 → 0.3.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/dist/index.cjs CHANGED
@@ -508,7 +508,6 @@ async function loadSignerCredentials(path = process.env.HAVEN_CREDENTIALS) {
508
508
  delegateKey: envKey,
509
509
  agentId: stringField(process.env.HAVEN_AGENT_ID),
510
510
  accountAddress,
511
- safeAddress: accountAddress,
512
511
  chainId: chainIdField(process.env.HAVEN_CHAIN_ID, "HAVEN_CHAIN_ID"),
513
512
  network: stringField(process.env.HAVEN_NETWORK),
514
513
  x402BindingSigner: stringField(process.env.HAVEN_X402_BINDING_SIGNER)
@@ -543,7 +542,6 @@ async function loadFromFile(path) {
543
542
  delegateKey,
544
543
  agentId: stringField(raw.agent_id ?? raw.agentId),
545
544
  accountAddress,
546
- safeAddress: accountAddress,
547
545
  chainId: chainIdField(raw.chain_id ?? raw.chainId, "chain_id"),
548
546
  network: stringField(raw.network),
549
547
  x402BindingSigner: stringField(
@@ -556,7 +554,22 @@ function readAccountAddressField(raw) {
556
554
  return stringField(raw.account_address ?? raw.safe_address ?? raw.safeAddress);
557
555
  }
558
556
  function readAccountAddressEnv(env) {
559
- return stringField(env.HAVEN_ACCOUNT_ADDRESS ?? env.HAVEN_WALLET_ADDRESS ?? env.HAVEN_SAFE_ADDRESS);
557
+ const current = stringField(env.HAVEN_ACCOUNT_ADDRESS);
558
+ for (const name of ["HAVEN_WALLET_ADDRESS", "HAVEN_SAFE_ADDRESS"]) {
559
+ const retired = stringField(env[name]);
560
+ if (!retired) continue;
561
+ if (!current) {
562
+ throw new Error(
563
+ `${name} is retired (#2906) \u2014 Haven accounts are addressed as accounts, not Safes. Set HAVEN_ACCOUNT_ADDRESS to the same value. Refusing rather than ignoring it, because an unset account address silently skips the sweep-destination check.`
564
+ );
565
+ }
566
+ if (retired.toLowerCase() !== current.toLowerCase()) {
567
+ throw new Error(
568
+ `${name} and HAVEN_ACCOUNT_ADDRESS were both set to different addresses. Remove the retired name, or make them match \u2014 picking one silently would hide the mismatch.`
569
+ );
570
+ }
571
+ }
572
+ return current;
560
573
  }
561
574
  function stringField(value) {
562
575
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
@@ -613,7 +626,7 @@ function createSigningAuditEntry(tool, payloadHash, context, now = /* @__PURE__
613
626
  payload_hash: payloadHash,
614
627
  delegate_address: context.delegateAddress
615
628
  };
616
- if (context.safeAddress) entry.safe_address = context.safeAddress;
629
+ if (context.accountAddress) entry.safe_address = context.accountAddress;
617
630
  if (typeof context.chainId === "number") entry.chain_id = context.chainId;
618
631
  return entry;
619
632
  }
@@ -1080,7 +1093,7 @@ function createToolHandlers(signer, options = {}) {
1080
1093
  authorization: args.authorization,
1081
1094
  expectedAuth: args.expected_auth,
1082
1095
  // Cross-check `to` against the Safe in the local credential when present.
1083
- expectedSafe: options.audit?.safeAddress
1096
+ expectedSafe: options.audit?.accountAddress
1084
1097
  });
1085
1098
  await auditSigning(
1086
1099
  "haven_sign_sweep_delegate",
@@ -1205,7 +1218,7 @@ var SIGNER_CONSENT_SURFACE_VERSION = 2;
1205
1218
  function computeSignerConsentHash(input) {
1206
1219
  const identity = [
1207
1220
  input.delegateAddress.toLowerCase(),
1208
- (input.safeAddress ?? "").toLowerCase(),
1221
+ (input.accountAddress ?? "").toLowerCase(),
1209
1222
  input.agentId ?? "",
1210
1223
  input.chainId ?? "",
1211
1224
  input.network ?? ""
@@ -1224,7 +1237,7 @@ function renderSignerConsentBlock(input, hash) {
1224
1237
  "",
1225
1238
  `Delegate address: ${input.delegateAddress}`
1226
1239
  ];
1227
- lines.push(`Haven wallet: ${input.safeAddress ?? "not provided to this signer"}`);
1240
+ lines.push(`Haven wallet: ${input.accountAddress ?? "not provided to this signer"}`);
1228
1241
  if (input.agentId) lines.push(`Agent ID: ${input.agentId}`);
1229
1242
  if (typeof input.chainId === "number") lines.push(`Chain ID: ${input.chainId}`);
1230
1243
  if (input.network) lines.push(`Network: ${input.network}`);
@@ -1318,7 +1331,7 @@ async function writeAckFile(path$1, hash) {
1318
1331
  );
1319
1332
  }
1320
1333
  var SIGNER_NAME = "@haven_ai/signer";
1321
- var SIGNER_VERSION = "0.2.1-alpha.0";
1334
+ var SIGNER_VERSION = "0.3.0-alpha.0";
1322
1335
  async function resolveEdgeSigner(options = {}) {
1323
1336
  const { signer } = await resolveSignerRuntime(options);
1324
1337
  return signer;
@@ -1357,7 +1370,7 @@ function buildSignerMcpServer(signer, options = {}) {
1357
1370
  audit: {
1358
1371
  auditPath: options.auditPath ?? defaultSigningAuditPath(credentialsPath),
1359
1372
  delegateAddress: signer.delegateAddress,
1360
- safeAddress: options.credentials?.accountAddress ?? options.credentials?.safeAddress,
1373
+ accountAddress: options.credentials?.accountAddress,
1361
1374
  chainId: options.credentials?.chainId
1362
1375
  },
1363
1376
  // #1263: the payment_id signing path — the ONLY network call this server
@@ -1407,7 +1420,7 @@ async function runSignerConsentGate(signer, credentials, options) {
1407
1420
  return ensureSignerConsent(
1408
1421
  {
1409
1422
  delegateAddress: signer.delegateAddress,
1410
- safeAddress: credentials?.accountAddress ?? credentials?.safeAddress,
1423
+ accountAddress: credentials?.accountAddress,
1411
1424
  agentId: credentials?.agentId,
1412
1425
  chainId: credentials?.chainId,
1413
1426
  network: credentials?.network,