@gvnrdao/dh-mcp 0.5.32 → 0.5.33

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/boundary.js CHANGED
@@ -14751,17 +14751,17 @@ var require_pkg_src = __commonJS({
14751
14751
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
14752
14752
  },
14753
14753
  backingAttestation: {
14754
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
14754
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
14755
14755
  authorizedCidHex: cidToHex(
14756
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
14756
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
14757
14757
  ),
14758
14758
  name: "Backing Attestation",
14759
14759
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
14760
- version: "1.1.0",
14760
+ version: "2.0.0",
14761
14761
  deployed: true,
14762
- deployedAt: 1795563887826,
14763
- size: 21207,
14764
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
14762
+ deployedAt: 1795632828899,
14763
+ size: 22464,
14764
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
14765
14765
  },
14766
14766
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
14767
14767
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -26649,6 +26649,24 @@ var require_async_request_util = __commonJS({
26649
26649
  }
26650
26650
  });
26651
26651
 
26652
+ // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js
26653
+ var require_lit_core_host = __commonJS({
26654
+ "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js"(exports2) {
26655
+ "use strict";
26656
+ Object.defineProperty(exports2, "__esModule", { value: true });
26657
+ exports2.DEFAULT_LIT_CORE_HOST = void 0;
26658
+ exports2.litCoreHost = litCoreHost;
26659
+ exports2.litCoreApiBase = litCoreApiBase;
26660
+ exports2.DEFAULT_LIT_CORE_HOST = "https://api2.chipotle.litprotocol.com";
26661
+ function litCoreHost(explicit) {
26662
+ return (explicit || process.env.LIT_CORE_API_BASE_URL || exports2.DEFAULT_LIT_CORE_HOST).replace(/\/+$/, "");
26663
+ }
26664
+ function litCoreApiBase(explicit) {
26665
+ return `${litCoreHost(explicit)}/core/v1`;
26666
+ }
26667
+ }
26668
+ });
26669
+
26652
26670
  // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js
26653
26671
  var require_lit_core_lit_action_client = __commonJS({
26654
26672
  "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js"(exports2) {
@@ -26660,6 +26678,7 @@ var require_lit_core_lit_action_client = __commonJS({
26660
26678
  exports2.isCoreApiTransportError = isCoreApiTransportError;
26661
26679
  exports2.executeLitActionViaCoreApi = executeLitActionViaCoreApi;
26662
26680
  var fetch_lit_action_from_ipfs_1 = require_fetch_lit_action_from_ipfs();
26681
+ var lit_core_host_1 = require_lit_core_host();
26663
26682
  function parseResponsePayload(raw) {
26664
26683
  if (raw == null)
26665
26684
  return raw;
@@ -26705,8 +26724,7 @@ var require_lit_core_lit_action_client = __commonJS({
26705
26724
  };
26706
26725
  }
26707
26726
  function resolveLitCoreBaseUrl(explicit) {
26708
- const fromEnv = process.env.LIT_CORE_API_BASE_URL;
26709
- return (explicit || fromEnv || "https://api.chipotle.litprotocol.com").replace(/\/$/, "");
26727
+ return (0, lit_core_host_1.litCoreHost)(explicit);
26710
26728
  }
26711
26729
  exports2.CORE_API_TRANSPORT_FAILURE_MARKER = "Lit Core lit_action transport failure";
26712
26730
  function describeErrorWithCause(e) {
@@ -26857,6 +26875,7 @@ var require_lit_ops_module = __commonJS({
26857
26875
  var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
26858
26876
  var lane_overrides_1 = require_lane_overrides();
26859
26877
  var async_request_util_1 = require_async_request_util();
26878
+ var lit_core_host_1 = require_lit_core_host();
26860
26879
  var crypto_1 = require("crypto");
26861
26880
  var lit_core_lit_action_client_1 = require_lit_core_lit_action_client();
26862
26881
  var PKP_VAULT_ATTESTATION_TYPES = {
@@ -29670,7 +29689,7 @@ var require_lit_ops_module = __commonJS({
29670
29689
  }
29671
29690
  };
29672
29691
  exports2.LitOps = LitOps2;
29673
- LitOps2.LIT_CORE_API_BASE = "https://api.chipotle.litprotocol.com/core/v1";
29692
+ LitOps2.LIT_CORE_API_BASE = (0, lit_core_host_1.litCoreApiBase)();
29674
29693
  }
29675
29694
  });
29676
29695
 
@@ -42106,6 +42125,9 @@ function boundaryError(code, message, extra) {
42106
42125
  // src/boundary/config.ts
42107
42126
  function carryEndpoints(config) {
42108
42127
  if (config.network === "mainnet") {
42128
+ if (config.servedNetworks !== void 0 && !config.servedNetworks.includes("sepolia")) {
42129
+ return { ok: false, reason: "Carry is not deployed on mainnet yet, and this connector serves mainnet only \u2014 Carry is not available on this connector" };
42130
+ }
42109
42131
  return { ok: false, reason: "Carry is not deployed on mainnet yet \u2014 the carry_* tools act on sepolia (switch with network_switch)" };
42110
42132
  }
42111
42133
  const apiBase = config.carryApiBase ?? "https://api-test.gvnr.xyz";
@@ -42654,6 +42676,20 @@ var CarryCore = class {
42654
42676
  }
42655
42677
  const auth = await this.deps.requireBorrower();
42656
42678
  if (!auth.ok) return errEnvelope(auth.error);
42679
+ const owned = await this.deps.plugin.chain.getPositionDetails(p.loanId);
42680
+ if (!owned.ok) return errEnvelope(this.deps.failureToError(owned.failure));
42681
+ if (owned.value === null) {
42682
+ return errEnvelope(boundaryError("NOT_FOUND", `Loan ${p.loanId} does not exist on the authoritative source \u2014 nothing was signed. Check the loan id with position_list.`, { source: owned.source.id }));
42683
+ }
42684
+ if (owned.value.borrower.toLowerCase() !== auth.borrower.toLowerCase()) {
42685
+ return errEnvelope(
42686
+ boundaryError(
42687
+ "UPSTREAM_REJECTED",
42688
+ `Loan ${p.loanId} does not belong to the connected wallet ${auth.borrower} \u2014 nothing was signed, and no UCD was sold. Check the loan id with position_list; Carry can only be funded for a loan you own.`,
42689
+ { source: owned.source.id }
42690
+ )
42691
+ );
42692
+ }
42657
42693
  let amountUcdWei;
42658
42694
  let quoteUsdc;
42659
42695
  if (p.amountUcd !== void 0) {
@@ -62597,17 +62633,17 @@ var require_pkg_src2 = __commonJS2({
62597
62633
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
62598
62634
  },
62599
62635
  backingAttestation: {
62600
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
62636
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
62601
62637
  authorizedCidHex: cidToHex(
62602
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
62638
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
62603
62639
  ),
62604
62640
  name: "Backing Attestation",
62605
62641
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
62606
- version: "1.1.0",
62642
+ version: "2.0.0",
62607
62643
  deployed: true,
62608
- deployedAt: 1795563887826,
62609
- size: 21207,
62610
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
62644
+ deployedAt: 1795632828899,
62645
+ size: 22464,
62646
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
62611
62647
  },
62612
62648
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
62613
62649
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -85134,6 +85170,10 @@ async function safeWaitForTransaction(tx2, confirmations = 1, timeout = 6e4) {
85134
85170
  }
85135
85171
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
85136
85172
  }
85173
+ var SAFE_IDENTITY_ABI = [
85174
+ "function getThreshold() view returns (uint256)",
85175
+ "function getOwners() view returns (address[])"
85176
+ ];
85137
85177
  var POSITION_NOT_FOUND_SELECTOR = "0x6ec9be11";
85138
85178
  var DiamondHandsSDK = class _DiamondHandsSDK {
85139
85179
  config;
@@ -92622,7 +92662,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
92622
92662
  /* HIGH */
92623
92663
  });
92624
92664
  }
92625
- const code = await this.getProviderOrThrow().getCode(borrower);
92665
+ const provider = this.getProviderOrThrow();
92666
+ const code = await provider.getCode(borrower);
92626
92667
  if (!code || code === "0x") {
92627
92668
  throw new SDKError({
92628
92669
  message: `Withdrawal delegation is only available to contract wallets. Borrower ${borrower} is an EOA, and the withdrawal validator has no delegate arm for one \u2014 an EOA can sign inside the withdrawal quantum window itself, so the grant would be recorded on-chain and never honoured.`,
@@ -92631,6 +92672,31 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
92631
92672
  /* MEDIUM */
92632
92673
  });
92633
92674
  }
92675
+ if (code.toLowerCase().startsWith("0xef0100")) {
92676
+ throw new SDKError({
92677
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} is an EIP-7702-delegated EOA (code ${code}), not a Safe \u2014 the withdrawal validator has no delegate arm for it, so the grant would be recorded on-chain and never honoured.`,
92678
+ category: "VALIDATION",
92679
+ severity: "MEDIUM"
92680
+ /* MEDIUM */
92681
+ });
92682
+ }
92683
+ const safe = new import_ethers25.Contract(borrower, SAFE_IDENTITY_ABI, provider);
92684
+ const answered = await Promise.all([safe.getThreshold(), safe.getOwners()]).then(
92685
+ () => true,
92686
+ (error) => {
92687
+ if ((0, import_ethers25.isError)(error, "CALL_EXCEPTION") || (0, import_ethers25.isError)(error, "BAD_DATA"))
92688
+ return false;
92689
+ throw error;
92690
+ }
92691
+ );
92692
+ if (!answered) {
92693
+ throw new SDKError({
92694
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} has contract code but does not answer getThreshold()/getOwners(), so it is not a Safe \u2014 the withdrawal validator has no delegate arm for it and the grant would never be honoured.`,
92695
+ category: "VALIDATION",
92696
+ severity: "MEDIUM"
92697
+ /* MEDIUM */
92698
+ });
92699
+ }
92634
92700
  }
92635
92701
  /**
92636
92702
  * Pre-flight the registry's `FloorBelowProtocolMin` guard with a message a user can act on.
@@ -100301,7 +100367,8 @@ function createBoundary(config, opts) {
100301
100367
  }
100302
100368
  };
100303
100369
  }
100304
- async function createRealBoundary(config, wallet, overrides) {
100370
+ async function createRealBoundary(bootConfig, wallet, overrides) {
100371
+ const config = overrides?.allowedNetworks ? { ...bootConfig, servedNetworks: overrides.allowedNetworks } : bootConfig;
100305
100372
  const externalOnly = overrides?.externalOnly === true;
100306
100373
  const keystore = externalOnly ? null : new KeystoreProvider({
100307
100374
  ...config.keystorePath ? { keystorePath: config.keystorePath } : {},
@@ -14751,17 +14751,17 @@ var require_pkg_src = __commonJS({
14751
14751
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
14752
14752
  },
14753
14753
  backingAttestation: {
14754
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
14754
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
14755
14755
  authorizedCidHex: cidToHex(
14756
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
14756
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
14757
14757
  ),
14758
14758
  name: "Backing Attestation",
14759
14759
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
14760
- version: "1.1.0",
14760
+ version: "2.0.0",
14761
14761
  deployed: true,
14762
- deployedAt: 1795563887826,
14763
- size: 21207,
14764
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
14762
+ deployedAt: 1795632828899,
14763
+ size: 22464,
14764
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
14765
14765
  },
14766
14766
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
14767
14767
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -26649,6 +26649,24 @@ var require_async_request_util = __commonJS({
26649
26649
  }
26650
26650
  });
26651
26651
 
26652
+ // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js
26653
+ var require_lit_core_host = __commonJS({
26654
+ "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js"(exports2) {
26655
+ "use strict";
26656
+ Object.defineProperty(exports2, "__esModule", { value: true });
26657
+ exports2.DEFAULT_LIT_CORE_HOST = void 0;
26658
+ exports2.litCoreHost = litCoreHost;
26659
+ exports2.litCoreApiBase = litCoreApiBase;
26660
+ exports2.DEFAULT_LIT_CORE_HOST = "https://api2.chipotle.litprotocol.com";
26661
+ function litCoreHost(explicit) {
26662
+ return (explicit || process.env.LIT_CORE_API_BASE_URL || exports2.DEFAULT_LIT_CORE_HOST).replace(/\/+$/, "");
26663
+ }
26664
+ function litCoreApiBase(explicit) {
26665
+ return `${litCoreHost(explicit)}/core/v1`;
26666
+ }
26667
+ }
26668
+ });
26669
+
26652
26670
  // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js
26653
26671
  var require_lit_core_lit_action_client = __commonJS({
26654
26672
  "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js"(exports2) {
@@ -26660,6 +26678,7 @@ var require_lit_core_lit_action_client = __commonJS({
26660
26678
  exports2.isCoreApiTransportError = isCoreApiTransportError;
26661
26679
  exports2.executeLitActionViaCoreApi = executeLitActionViaCoreApi;
26662
26680
  var fetch_lit_action_from_ipfs_1 = require_fetch_lit_action_from_ipfs();
26681
+ var lit_core_host_1 = require_lit_core_host();
26663
26682
  function parseResponsePayload(raw) {
26664
26683
  if (raw == null)
26665
26684
  return raw;
@@ -26705,8 +26724,7 @@ var require_lit_core_lit_action_client = __commonJS({
26705
26724
  };
26706
26725
  }
26707
26726
  function resolveLitCoreBaseUrl(explicit) {
26708
- const fromEnv = process.env.LIT_CORE_API_BASE_URL;
26709
- return (explicit || fromEnv || "https://api.chipotle.litprotocol.com").replace(/\/$/, "");
26727
+ return (0, lit_core_host_1.litCoreHost)(explicit);
26710
26728
  }
26711
26729
  exports2.CORE_API_TRANSPORT_FAILURE_MARKER = "Lit Core lit_action transport failure";
26712
26730
  function describeErrorWithCause(e) {
@@ -26857,6 +26875,7 @@ var require_lit_ops_module = __commonJS({
26857
26875
  var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
26858
26876
  var lane_overrides_1 = require_lane_overrides();
26859
26877
  var async_request_util_1 = require_async_request_util();
26878
+ var lit_core_host_1 = require_lit_core_host();
26860
26879
  var crypto_1 = require("crypto");
26861
26880
  var lit_core_lit_action_client_1 = require_lit_core_lit_action_client();
26862
26881
  var PKP_VAULT_ATTESTATION_TYPES = {
@@ -29670,7 +29689,7 @@ var require_lit_ops_module = __commonJS({
29670
29689
  }
29671
29690
  };
29672
29691
  exports2.LitOps = LitOps2;
29673
- LitOps2.LIT_CORE_API_BASE = "https://api.chipotle.litprotocol.com/core/v1";
29692
+ LitOps2.LIT_CORE_API_BASE = (0, lit_core_host_1.litCoreApiBase)();
29674
29693
  }
29675
29694
  });
29676
29695
 
@@ -43236,9 +43255,6 @@ function registerCarryTools(server, getB) {
43236
43255
  annotations: DESTRUCTIVE_WRITE_ANNOTATIONS3
43237
43256
  },
43238
43257
  async ({ loanId, credit, amountUcd, amountUsdc, confirmed }) => guardedWrite(getB, async () => {
43239
- const size = amountUcd !== void 0 ? `${amountUcd} UCD` : amountUsdc !== void 0 ? `UCD for ${amountUsdc} USDC` : "UCD for the recommended entry margin";
43240
- const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
43241
- if (gate) return gate;
43242
43258
  if (amountUcd !== void 0) {
43243
43259
  const problem = checkUcdAmount(amountUcd, "amountUcd");
43244
43260
  if (problem) return validationFailed(problem);
@@ -43247,6 +43263,9 @@ function registerCarryTools(server, getB) {
43247
43263
  const problem = checkUsdc(amountUsdc, "amountUsdc");
43248
43264
  if (problem) return validationFailed(problem);
43249
43265
  }
43266
+ const size = amountUcd !== void 0 ? `${amountUcd} UCD` : `the UCD that carry_quote loanId ${loanId} credit ${credit}${amountUsdc !== void 0 ? ` amountUsdc ${amountUsdc}` : ""} returns as ucdToSell (show the user that exact figure)`;
43267
+ const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
43268
+ if (gate) return gate;
43250
43269
  const b2 = getB();
43251
43270
  if (!b2.ok) return renderError(b2.error);
43252
43271
  return renderEnvelope(
@@ -44783,6 +44802,9 @@ var import_zod9 = require("zod");
44783
44802
  // src/boundary/config.ts
44784
44803
  function carryEndpoints(config) {
44785
44804
  if (config.network === "mainnet") {
44805
+ if (config.servedNetworks !== void 0 && !config.servedNetworks.includes("sepolia")) {
44806
+ return { ok: false, reason: "Carry is not deployed on mainnet yet, and this connector serves mainnet only \u2014 Carry is not available on this connector" };
44807
+ }
44786
44808
  return { ok: false, reason: "Carry is not deployed on mainnet yet \u2014 the carry_* tools act on sepolia (switch with network_switch)" };
44787
44809
  }
44788
44810
  const apiBase = config.carryApiBase ?? "https://api-test.gvnr.xyz";
@@ -45324,6 +45346,20 @@ var CarryCore = class {
45324
45346
  }
45325
45347
  const auth = await this.deps.requireBorrower();
45326
45348
  if (!auth.ok) return errEnvelope(auth.error);
45349
+ const owned = await this.deps.plugin.chain.getPositionDetails(p.loanId);
45350
+ if (!owned.ok) return errEnvelope(this.deps.failureToError(owned.failure));
45351
+ if (owned.value === null) {
45352
+ return errEnvelope(boundaryError("NOT_FOUND", `Loan ${p.loanId} does not exist on the authoritative source \u2014 nothing was signed. Check the loan id with position_list.`, { source: owned.source.id }));
45353
+ }
45354
+ if (owned.value.borrower.toLowerCase() !== auth.borrower.toLowerCase()) {
45355
+ return errEnvelope(
45356
+ boundaryError(
45357
+ "UPSTREAM_REJECTED",
45358
+ `Loan ${p.loanId} does not belong to the connected wallet ${auth.borrower} \u2014 nothing was signed, and no UCD was sold. Check the loan id with position_list; Carry can only be funded for a loan you own.`,
45359
+ { source: owned.source.id }
45360
+ )
45361
+ );
45362
+ }
45327
45363
  let amountUcdWei;
45328
45364
  let quoteUsdc;
45329
45365
  if (p.amountUcd !== void 0) {
@@ -65276,17 +65312,17 @@ var require_pkg_src2 = __commonJS2({
65276
65312
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
65277
65313
  },
65278
65314
  backingAttestation: {
65279
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
65315
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
65280
65316
  authorizedCidHex: cidToHex(
65281
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
65317
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
65282
65318
  ),
65283
65319
  name: "Backing Attestation",
65284
65320
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
65285
- version: "1.1.0",
65321
+ version: "2.0.0",
65286
65322
  deployed: true,
65287
- deployedAt: 1795563887826,
65288
- size: 21207,
65289
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
65323
+ deployedAt: 1795632828899,
65324
+ size: 22464,
65325
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
65290
65326
  },
65291
65327
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
65292
65328
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -87813,6 +87849,10 @@ async function safeWaitForTransaction(tx2, confirmations = 1, timeout = 6e4) {
87813
87849
  }
87814
87850
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
87815
87851
  }
87852
+ var SAFE_IDENTITY_ABI = [
87853
+ "function getThreshold() view returns (uint256)",
87854
+ "function getOwners() view returns (address[])"
87855
+ ];
87816
87856
  var POSITION_NOT_FOUND_SELECTOR = "0x6ec9be11";
87817
87857
  var DiamondHandsSDK = class _DiamondHandsSDK {
87818
87858
  config;
@@ -95301,7 +95341,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
95301
95341
  /* HIGH */
95302
95342
  });
95303
95343
  }
95304
- const code = await this.getProviderOrThrow().getCode(borrower);
95344
+ const provider = this.getProviderOrThrow();
95345
+ const code = await provider.getCode(borrower);
95305
95346
  if (!code || code === "0x") {
95306
95347
  throw new SDKError({
95307
95348
  message: `Withdrawal delegation is only available to contract wallets. Borrower ${borrower} is an EOA, and the withdrawal validator has no delegate arm for one \u2014 an EOA can sign inside the withdrawal quantum window itself, so the grant would be recorded on-chain and never honoured.`,
@@ -95310,6 +95351,31 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
95310
95351
  /* MEDIUM */
95311
95352
  });
95312
95353
  }
95354
+ if (code.toLowerCase().startsWith("0xef0100")) {
95355
+ throw new SDKError({
95356
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} is an EIP-7702-delegated EOA (code ${code}), not a Safe \u2014 the withdrawal validator has no delegate arm for it, so the grant would be recorded on-chain and never honoured.`,
95357
+ category: "VALIDATION",
95358
+ severity: "MEDIUM"
95359
+ /* MEDIUM */
95360
+ });
95361
+ }
95362
+ const safe = new import_ethers27.Contract(borrower, SAFE_IDENTITY_ABI, provider);
95363
+ const answered = await Promise.all([safe.getThreshold(), safe.getOwners()]).then(
95364
+ () => true,
95365
+ (error) => {
95366
+ if ((0, import_ethers27.isError)(error, "CALL_EXCEPTION") || (0, import_ethers27.isError)(error, "BAD_DATA"))
95367
+ return false;
95368
+ throw error;
95369
+ }
95370
+ );
95371
+ if (!answered) {
95372
+ throw new SDKError({
95373
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} has contract code but does not answer getThreshold()/getOwners(), so it is not a Safe \u2014 the withdrawal validator has no delegate arm for it and the grant would never be honoured.`,
95374
+ category: "VALIDATION",
95375
+ severity: "MEDIUM"
95376
+ /* MEDIUM */
95377
+ });
95378
+ }
95313
95379
  }
95314
95380
  /**
95315
95381
  * Pre-flight the registry's `FloorBelowProtocolMin` guard with a message a user can act on.
@@ -102981,7 +103047,8 @@ function createBoundary(config, opts) {
102981
103047
  }
102982
103048
  };
102983
103049
  }
102984
- async function createRealBoundary(config, wallet, overrides) {
103050
+ async function createRealBoundary(bootConfig, wallet, overrides) {
103051
+ const config = overrides?.allowedNetworks ? { ...bootConfig, servedNetworks: overrides.allowedNetworks } : bootConfig;
102985
103052
  const externalOnly = overrides?.externalOnly === true;
102986
103053
  const keystore = externalOnly ? null : new KeystoreProvider({
102987
103054
  ...config.keystorePath ? { keystorePath: config.keystorePath } : {},
@@ -103421,7 +103488,7 @@ function registerBoundaryInfoResource(server, getB) {
103421
103488
  }
103422
103489
 
103423
103490
  // src/version.ts
103424
- var SERVER_VERSION = "0.5.32";
103491
+ var SERVER_VERSION = "0.5.33";
103425
103492
 
103426
103493
  // src/server.ts
103427
103494
  var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
package/dist/connector.js CHANGED
@@ -14751,17 +14751,17 @@ var require_pkg_src = __commonJS({
14751
14751
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
14752
14752
  },
14753
14753
  backingAttestation: {
14754
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
14754
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
14755
14755
  authorizedCidHex: cidToHex(
14756
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
14756
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
14757
14757
  ),
14758
14758
  name: "Backing Attestation",
14759
14759
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
14760
- version: "1.1.0",
14760
+ version: "2.0.0",
14761
14761
  deployed: true,
14762
- deployedAt: 1795563887826,
14763
- size: 21207,
14764
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
14762
+ deployedAt: 1795632828899,
14763
+ size: 22464,
14764
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
14765
14765
  },
14766
14766
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
14767
14767
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -26649,6 +26649,24 @@ var require_async_request_util = __commonJS({
26649
26649
  }
26650
26650
  });
26651
26651
 
26652
+ // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js
26653
+ var require_lit_core_host = __commonJS({
26654
+ "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js"(exports2) {
26655
+ "use strict";
26656
+ Object.defineProperty(exports2, "__esModule", { value: true });
26657
+ exports2.DEFAULT_LIT_CORE_HOST = void 0;
26658
+ exports2.litCoreHost = litCoreHost;
26659
+ exports2.litCoreApiBase = litCoreApiBase;
26660
+ exports2.DEFAULT_LIT_CORE_HOST = "https://api2.chipotle.litprotocol.com";
26661
+ function litCoreHost(explicit) {
26662
+ return (explicit || process.env.LIT_CORE_API_BASE_URL || exports2.DEFAULT_LIT_CORE_HOST).replace(/\/+$/, "");
26663
+ }
26664
+ function litCoreApiBase(explicit) {
26665
+ return `${litCoreHost(explicit)}/core/v1`;
26666
+ }
26667
+ }
26668
+ });
26669
+
26652
26670
  // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js
26653
26671
  var require_lit_core_lit_action_client = __commonJS({
26654
26672
  "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js"(exports2) {
@@ -26660,6 +26678,7 @@ var require_lit_core_lit_action_client = __commonJS({
26660
26678
  exports2.isCoreApiTransportError = isCoreApiTransportError;
26661
26679
  exports2.executeLitActionViaCoreApi = executeLitActionViaCoreApi;
26662
26680
  var fetch_lit_action_from_ipfs_1 = require_fetch_lit_action_from_ipfs();
26681
+ var lit_core_host_1 = require_lit_core_host();
26663
26682
  function parseResponsePayload(raw) {
26664
26683
  if (raw == null)
26665
26684
  return raw;
@@ -26705,8 +26724,7 @@ var require_lit_core_lit_action_client = __commonJS({
26705
26724
  };
26706
26725
  }
26707
26726
  function resolveLitCoreBaseUrl(explicit) {
26708
- const fromEnv = process.env.LIT_CORE_API_BASE_URL;
26709
- return (explicit || fromEnv || "https://api.chipotle.litprotocol.com").replace(/\/$/, "");
26727
+ return (0, lit_core_host_1.litCoreHost)(explicit);
26710
26728
  }
26711
26729
  exports2.CORE_API_TRANSPORT_FAILURE_MARKER = "Lit Core lit_action transport failure";
26712
26730
  function describeErrorWithCause(e) {
@@ -26857,6 +26875,7 @@ var require_lit_ops_module = __commonJS({
26857
26875
  var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
26858
26876
  var lane_overrides_1 = require_lane_overrides();
26859
26877
  var async_request_util_1 = require_async_request_util();
26878
+ var lit_core_host_1 = require_lit_core_host();
26860
26879
  var crypto_1 = require("crypto");
26861
26880
  var lit_core_lit_action_client_1 = require_lit_core_lit_action_client();
26862
26881
  var PKP_VAULT_ATTESTATION_TYPES = {
@@ -29670,7 +29689,7 @@ var require_lit_ops_module = __commonJS({
29670
29689
  }
29671
29690
  };
29672
29691
  exports2.LitOps = LitOps2;
29673
- LitOps2.LIT_CORE_API_BASE = "https://api.chipotle.litprotocol.com/core/v1";
29692
+ LitOps2.LIT_CORE_API_BASE = (0, lit_core_host_1.litCoreApiBase)();
29674
29693
  }
29675
29694
  });
29676
29695
 
@@ -43230,9 +43249,6 @@ function registerCarryTools(server, getB) {
43230
43249
  annotations: DESTRUCTIVE_WRITE_ANNOTATIONS3
43231
43250
  },
43232
43251
  async ({ loanId, credit, amountUcd, amountUsdc, confirmed }) => guardedWrite(getB, async () => {
43233
- const size = amountUcd !== void 0 ? `${amountUcd} UCD` : amountUsdc !== void 0 ? `UCD for ${amountUsdc} USDC` : "UCD for the recommended entry margin";
43234
- const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
43235
- if (gate) return gate;
43236
43252
  if (amountUcd !== void 0) {
43237
43253
  const problem = checkUcdAmount(amountUcd, "amountUcd");
43238
43254
  if (problem) return validationFailed(problem);
@@ -43241,6 +43257,9 @@ function registerCarryTools(server, getB) {
43241
43257
  const problem = checkUsdc(amountUsdc, "amountUsdc");
43242
43258
  if (problem) return validationFailed(problem);
43243
43259
  }
43260
+ const size = amountUcd !== void 0 ? `${amountUcd} UCD` : `the UCD that carry_quote loanId ${loanId} credit ${credit}${amountUsdc !== void 0 ? ` amountUsdc ${amountUsdc}` : ""} returns as ucdToSell (show the user that exact figure)`;
43261
+ const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
43262
+ if (gate) return gate;
43244
43263
  const b2 = getB();
43245
43264
  if (!b2.ok) return renderError(b2.error);
43246
43265
  return renderEnvelope(
@@ -44777,6 +44796,9 @@ var import_zod9 = require("zod");
44777
44796
  // src/boundary/config.ts
44778
44797
  function carryEndpoints(config) {
44779
44798
  if (config.network === "mainnet") {
44799
+ if (config.servedNetworks !== void 0 && !config.servedNetworks.includes("sepolia")) {
44800
+ return { ok: false, reason: "Carry is not deployed on mainnet yet, and this connector serves mainnet only \u2014 Carry is not available on this connector" };
44801
+ }
44780
44802
  return { ok: false, reason: "Carry is not deployed on mainnet yet \u2014 the carry_* tools act on sepolia (switch with network_switch)" };
44781
44803
  }
44782
44804
  const apiBase = config.carryApiBase ?? "https://api-test.gvnr.xyz";
@@ -45318,6 +45340,20 @@ var CarryCore = class {
45318
45340
  }
45319
45341
  const auth = await this.deps.requireBorrower();
45320
45342
  if (!auth.ok) return errEnvelope(auth.error);
45343
+ const owned = await this.deps.plugin.chain.getPositionDetails(p.loanId);
45344
+ if (!owned.ok) return errEnvelope(this.deps.failureToError(owned.failure));
45345
+ if (owned.value === null) {
45346
+ return errEnvelope(boundaryError("NOT_FOUND", `Loan ${p.loanId} does not exist on the authoritative source \u2014 nothing was signed. Check the loan id with position_list.`, { source: owned.source.id }));
45347
+ }
45348
+ if (owned.value.borrower.toLowerCase() !== auth.borrower.toLowerCase()) {
45349
+ return errEnvelope(
45350
+ boundaryError(
45351
+ "UPSTREAM_REJECTED",
45352
+ `Loan ${p.loanId} does not belong to the connected wallet ${auth.borrower} \u2014 nothing was signed, and no UCD was sold. Check the loan id with position_list; Carry can only be funded for a loan you own.`,
45353
+ { source: owned.source.id }
45354
+ )
45355
+ );
45356
+ }
45321
45357
  let amountUcdWei;
45322
45358
  let quoteUsdc;
45323
45359
  if (p.amountUcd !== void 0) {
@@ -65270,17 +65306,17 @@ var require_pkg_src2 = __commonJS2({
65270
65306
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
65271
65307
  },
65272
65308
  backingAttestation: {
65273
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
65309
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
65274
65310
  authorizedCidHex: cidToHex(
65275
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
65311
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
65276
65312
  ),
65277
65313
  name: "Backing Attestation",
65278
65314
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
65279
- version: "1.1.0",
65315
+ version: "2.0.0",
65280
65316
  deployed: true,
65281
- deployedAt: 1795563887826,
65282
- size: 21207,
65283
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
65317
+ deployedAt: 1795632828899,
65318
+ size: 22464,
65319
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
65284
65320
  },
65285
65321
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
65286
65322
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -87807,6 +87843,10 @@ async function safeWaitForTransaction(tx2, confirmations = 1, timeout = 6e4) {
87807
87843
  }
87808
87844
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
87809
87845
  }
87846
+ var SAFE_IDENTITY_ABI = [
87847
+ "function getThreshold() view returns (uint256)",
87848
+ "function getOwners() view returns (address[])"
87849
+ ];
87810
87850
  var POSITION_NOT_FOUND_SELECTOR = "0x6ec9be11";
87811
87851
  var DiamondHandsSDK = class _DiamondHandsSDK {
87812
87852
  config;
@@ -95295,7 +95335,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
95295
95335
  /* HIGH */
95296
95336
  });
95297
95337
  }
95298
- const code = await this.getProviderOrThrow().getCode(borrower);
95338
+ const provider = this.getProviderOrThrow();
95339
+ const code = await provider.getCode(borrower);
95299
95340
  if (!code || code === "0x") {
95300
95341
  throw new SDKError({
95301
95342
  message: `Withdrawal delegation is only available to contract wallets. Borrower ${borrower} is an EOA, and the withdrawal validator has no delegate arm for one \u2014 an EOA can sign inside the withdrawal quantum window itself, so the grant would be recorded on-chain and never honoured.`,
@@ -95304,6 +95345,31 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
95304
95345
  /* MEDIUM */
95305
95346
  });
95306
95347
  }
95348
+ if (code.toLowerCase().startsWith("0xef0100")) {
95349
+ throw new SDKError({
95350
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} is an EIP-7702-delegated EOA (code ${code}), not a Safe \u2014 the withdrawal validator has no delegate arm for it, so the grant would be recorded on-chain and never honoured.`,
95351
+ category: "VALIDATION",
95352
+ severity: "MEDIUM"
95353
+ /* MEDIUM */
95354
+ });
95355
+ }
95356
+ const safe = new import_ethers27.Contract(borrower, SAFE_IDENTITY_ABI, provider);
95357
+ const answered = await Promise.all([safe.getThreshold(), safe.getOwners()]).then(
95358
+ () => true,
95359
+ (error) => {
95360
+ if ((0, import_ethers27.isError)(error, "CALL_EXCEPTION") || (0, import_ethers27.isError)(error, "BAD_DATA"))
95361
+ return false;
95362
+ throw error;
95363
+ }
95364
+ );
95365
+ if (!answered) {
95366
+ throw new SDKError({
95367
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} has contract code but does not answer getThreshold()/getOwners(), so it is not a Safe \u2014 the withdrawal validator has no delegate arm for it and the grant would never be honoured.`,
95368
+ category: "VALIDATION",
95369
+ severity: "MEDIUM"
95370
+ /* MEDIUM */
95371
+ });
95372
+ }
95307
95373
  }
95308
95374
  /**
95309
95375
  * Pre-flight the registry's `FloorBelowProtocolMin` guard with a message a user can act on.
@@ -102975,7 +103041,8 @@ function createBoundary(config, opts) {
102975
103041
  }
102976
103042
  };
102977
103043
  }
102978
- async function createRealBoundary(config, wallet, overrides) {
103044
+ async function createRealBoundary(bootConfig, wallet, overrides) {
103045
+ const config = overrides?.allowedNetworks ? { ...bootConfig, servedNetworks: overrides.allowedNetworks } : bootConfig;
102979
103046
  const externalOnly = overrides?.externalOnly === true;
102980
103047
  const keystore = externalOnly ? null : new KeystoreProvider({
102981
103048
  ...config.keystorePath ? { keystorePath: config.keystorePath } : {},
@@ -103415,7 +103482,7 @@ function registerBoundaryInfoResource(server, getB) {
103415
103482
  }
103416
103483
 
103417
103484
  // src/version.ts
103418
- var SERVER_VERSION = "0.5.32";
103485
+ var SERVER_VERSION = "0.5.33";
103419
103486
 
103420
103487
  // src/server.ts
103421
103488
  var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
package/dist/index.js CHANGED
@@ -14751,17 +14751,17 @@ var require_pkg_src = __commonJS({
14751
14751
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
14752
14752
  },
14753
14753
  backingAttestation: {
14754
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
14754
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
14755
14755
  authorizedCidHex: cidToHex(
14756
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
14756
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
14757
14757
  ),
14758
14758
  name: "Backing Attestation",
14759
14759
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
14760
- version: "1.1.0",
14760
+ version: "2.0.0",
14761
14761
  deployed: true,
14762
- deployedAt: 1795563887826,
14763
- size: 21207,
14764
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
14762
+ deployedAt: 1795632828899,
14763
+ size: 22464,
14764
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
14765
14765
  },
14766
14766
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
14767
14767
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -26649,6 +26649,24 @@ var require_async_request_util = __commonJS({
26649
26649
  }
26650
26650
  });
26651
26651
 
26652
+ // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js
26653
+ var require_lit_core_host = __commonJS({
26654
+ "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-host.js"(exports2) {
26655
+ "use strict";
26656
+ Object.defineProperty(exports2, "__esModule", { value: true });
26657
+ exports2.DEFAULT_LIT_CORE_HOST = void 0;
26658
+ exports2.litCoreHost = litCoreHost;
26659
+ exports2.litCoreApiBase = litCoreApiBase;
26660
+ exports2.DEFAULT_LIT_CORE_HOST = "https://api2.chipotle.litprotocol.com";
26661
+ function litCoreHost(explicit) {
26662
+ return (explicit || process.env.LIT_CORE_API_BASE_URL || exports2.DEFAULT_LIT_CORE_HOST).replace(/\/+$/, "");
26663
+ }
26664
+ function litCoreApiBase(explicit) {
26665
+ return `${litCoreHost(explicit)}/core/v1`;
26666
+ }
26667
+ }
26668
+ });
26669
+
26652
26670
  // node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js
26653
26671
  var require_lit_core_lit_action_client = __commonJS({
26654
26672
  "node_modules/@gvnrdao/dh-lit-ops/dist/utils/lit-core-lit-action-client.js"(exports2) {
@@ -26660,6 +26678,7 @@ var require_lit_core_lit_action_client = __commonJS({
26660
26678
  exports2.isCoreApiTransportError = isCoreApiTransportError;
26661
26679
  exports2.executeLitActionViaCoreApi = executeLitActionViaCoreApi;
26662
26680
  var fetch_lit_action_from_ipfs_1 = require_fetch_lit_action_from_ipfs();
26681
+ var lit_core_host_1 = require_lit_core_host();
26663
26682
  function parseResponsePayload(raw) {
26664
26683
  if (raw == null)
26665
26684
  return raw;
@@ -26705,8 +26724,7 @@ var require_lit_core_lit_action_client = __commonJS({
26705
26724
  };
26706
26725
  }
26707
26726
  function resolveLitCoreBaseUrl(explicit) {
26708
- const fromEnv = process.env.LIT_CORE_API_BASE_URL;
26709
- return (explicit || fromEnv || "https://api.chipotle.litprotocol.com").replace(/\/$/, "");
26727
+ return (0, lit_core_host_1.litCoreHost)(explicit);
26710
26728
  }
26711
26729
  exports2.CORE_API_TRANSPORT_FAILURE_MARKER = "Lit Core lit_action transport failure";
26712
26730
  function describeErrorWithCause(e) {
@@ -26857,6 +26875,7 @@ var require_lit_ops_module = __commonJS({
26857
26875
  var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
26858
26876
  var lane_overrides_1 = require_lane_overrides();
26859
26877
  var async_request_util_1 = require_async_request_util();
26878
+ var lit_core_host_1 = require_lit_core_host();
26860
26879
  var crypto_1 = require("crypto");
26861
26880
  var lit_core_lit_action_client_1 = require_lit_core_lit_action_client();
26862
26881
  var PKP_VAULT_ATTESTATION_TYPES = {
@@ -29670,7 +29689,7 @@ var require_lit_ops_module = __commonJS({
29670
29689
  }
29671
29690
  };
29672
29691
  exports2.LitOps = LitOps2;
29673
- LitOps2.LIT_CORE_API_BASE = "https://api.chipotle.litprotocol.com/core/v1";
29692
+ LitOps2.LIT_CORE_API_BASE = (0, lit_core_host_1.litCoreApiBase)();
29674
29693
  }
29675
29694
  });
29676
29695
 
@@ -42096,6 +42115,9 @@ function boundaryError(code, message, extra) {
42096
42115
  // src/boundary/config.ts
42097
42116
  function carryEndpoints(config) {
42098
42117
  if (config.network === "mainnet") {
42118
+ if (config.servedNetworks !== void 0 && !config.servedNetworks.includes("sepolia")) {
42119
+ return { ok: false, reason: "Carry is not deployed on mainnet yet, and this connector serves mainnet only \u2014 Carry is not available on this connector" };
42120
+ }
42099
42121
  return { ok: false, reason: "Carry is not deployed on mainnet yet \u2014 the carry_* tools act on sepolia (switch with network_switch)" };
42100
42122
  }
42101
42123
  const apiBase = config.carryApiBase ?? "https://api-test.gvnr.xyz";
@@ -42667,6 +42689,20 @@ var CarryCore = class {
42667
42689
  }
42668
42690
  const auth = await this.deps.requireBorrower();
42669
42691
  if (!auth.ok) return errEnvelope(auth.error);
42692
+ const owned = await this.deps.plugin.chain.getPositionDetails(p.loanId);
42693
+ if (!owned.ok) return errEnvelope(this.deps.failureToError(owned.failure));
42694
+ if (owned.value === null) {
42695
+ return errEnvelope(boundaryError("NOT_FOUND", `Loan ${p.loanId} does not exist on the authoritative source \u2014 nothing was signed. Check the loan id with position_list.`, { source: owned.source.id }));
42696
+ }
42697
+ if (owned.value.borrower.toLowerCase() !== auth.borrower.toLowerCase()) {
42698
+ return errEnvelope(
42699
+ boundaryError(
42700
+ "UPSTREAM_REJECTED",
42701
+ `Loan ${p.loanId} does not belong to the connected wallet ${auth.borrower} \u2014 nothing was signed, and no UCD was sold. Check the loan id with position_list; Carry can only be funded for a loan you own.`,
42702
+ { source: owned.source.id }
42703
+ )
42704
+ );
42705
+ }
42670
42706
  let amountUcdWei;
42671
42707
  let quoteUsdc;
42672
42708
  if (p.amountUcd !== void 0) {
@@ -62610,17 +62646,17 @@ var require_pkg_src2 = __commonJS2({
62610
62646
  hash: "5edef681e87905ef2e580aa0c29cb2bcd20dc0d9e9fe9cd668d9a61dcb596e2e"
62611
62647
  },
62612
62648
  backingAttestation: {
62613
- cid: "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME",
62649
+ cid: "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj",
62614
62650
  authorizedCidHex: cidToHex(
62615
- "QmZpt3P2jMQYtvLEt5serWUnGPS1bZj4gXuNAAR7rTdcME"
62651
+ "Qma2CvUCvCfPxpskFwCac9ngfRZRnnTvTtSVi5BMLKaYxj"
62616
62652
  ),
62617
62653
  name: "Backing Attestation",
62618
62654
  description: "BackingOracle report: BTC collateral over loan UCD at a pinned block, from a keeper snapshot the action verifies",
62619
- version: "1.1.0",
62655
+ version: "2.0.0",
62620
62656
  deployed: true,
62621
- deployedAt: 1795563887826,
62622
- size: 21207,
62623
- hash: "0ed0de3d7b41a48fe02f1e79d796241bc34460b3533bd6e2cfb3ad20f11b38fb"
62657
+ deployedAt: 1795632828899,
62658
+ size: 22464,
62659
+ hash: "79abbd41198c38a5d22cab235ef8d372699d1f4606b0be093c78d6d41a19b8bc"
62624
62660
  },
62625
62661
  // Carry capital lock plan, Step 4: its own wallet in the Sepolia carry group (8), registered in OAR for the
62626
62662
  // makePaymentFrom selector. 1.0.1 (audit 2026-11-14: the RPC must report the policy chain) pinned and attached to
@@ -85147,6 +85183,10 @@ async function safeWaitForTransaction(tx2, confirmations = 1, timeout = 6e4) {
85147
85183
  }
85148
85184
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
85149
85185
  }
85186
+ var SAFE_IDENTITY_ABI = [
85187
+ "function getThreshold() view returns (uint256)",
85188
+ "function getOwners() view returns (address[])"
85189
+ ];
85150
85190
  var POSITION_NOT_FOUND_SELECTOR = "0x6ec9be11";
85151
85191
  var DiamondHandsSDK = class _DiamondHandsSDK {
85152
85192
  config;
@@ -92635,7 +92675,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
92635
92675
  /* HIGH */
92636
92676
  });
92637
92677
  }
92638
- const code = await this.getProviderOrThrow().getCode(borrower);
92678
+ const provider = this.getProviderOrThrow();
92679
+ const code = await provider.getCode(borrower);
92639
92680
  if (!code || code === "0x") {
92640
92681
  throw new SDKError({
92641
92682
  message: `Withdrawal delegation is only available to contract wallets. Borrower ${borrower} is an EOA, and the withdrawal validator has no delegate arm for one \u2014 an EOA can sign inside the withdrawal quantum window itself, so the grant would be recorded on-chain and never honoured.`,
@@ -92644,6 +92685,31 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
92644
92685
  /* MEDIUM */
92645
92686
  });
92646
92687
  }
92688
+ if (code.toLowerCase().startsWith("0xef0100")) {
92689
+ throw new SDKError({
92690
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} is an EIP-7702-delegated EOA (code ${code}), not a Safe \u2014 the withdrawal validator has no delegate arm for it, so the grant would be recorded on-chain and never honoured.`,
92691
+ category: "VALIDATION",
92692
+ severity: "MEDIUM"
92693
+ /* MEDIUM */
92694
+ });
92695
+ }
92696
+ const safe = new import_ethers25.Contract(borrower, SAFE_IDENTITY_ABI, provider);
92697
+ const answered = await Promise.all([safe.getThreshold(), safe.getOwners()]).then(
92698
+ () => true,
92699
+ (error) => {
92700
+ if ((0, import_ethers25.isError)(error, "CALL_EXCEPTION") || (0, import_ethers25.isError)(error, "BAD_DATA"))
92701
+ return false;
92702
+ throw error;
92703
+ }
92704
+ );
92705
+ if (!answered) {
92706
+ throw new SDKError({
92707
+ message: `Withdrawal delegation is only available to Safe wallets. Borrower ${borrower} has contract code but does not answer getThreshold()/getOwners(), so it is not a Safe \u2014 the withdrawal validator has no delegate arm for it and the grant would never be honoured.`,
92708
+ category: "VALIDATION",
92709
+ severity: "MEDIUM"
92710
+ /* MEDIUM */
92711
+ });
92712
+ }
92647
92713
  }
92648
92714
  /**
92649
92715
  * Pre-flight the registry's `FloorBelowProtocolMin` guard with a message a user can act on.
@@ -100314,7 +100380,8 @@ function createBoundary(config, opts) {
100314
100380
  }
100315
100381
  };
100316
100382
  }
100317
- async function createRealBoundary(config, wallet, overrides) {
100383
+ async function createRealBoundary(bootConfig, wallet, overrides) {
100384
+ const config = overrides?.allowedNetworks ? { ...bootConfig, servedNetworks: overrides.allowedNetworks } : bootConfig;
100318
100385
  const externalOnly = overrides?.externalOnly === true;
100319
100386
  const keystore = externalOnly ? null : new KeystoreProvider({
100320
100387
  ...config.keystorePath ? { keystorePath: config.keystorePath } : {},
@@ -102444,9 +102511,6 @@ function registerCarryTools(server, getB) {
102444
102511
  annotations: DESTRUCTIVE_WRITE_ANNOTATIONS3
102445
102512
  },
102446
102513
  async ({ loanId, credit, amountUcd, amountUsdc, confirmed }) => guardedWrite(getB, async () => {
102447
- const size = amountUcd !== void 0 ? `${amountUcd} UCD` : amountUsdc !== void 0 ? `UCD for ${amountUsdc} USDC` : "UCD for the recommended entry margin";
102448
- const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
102449
- if (gate) return gate;
102450
102514
  if (amountUcd !== void 0) {
102451
102515
  const problem = checkUcdAmount(amountUcd, "amountUcd");
102452
102516
  if (problem) return validationFailed(problem);
@@ -102455,6 +102519,9 @@ function registerCarryTools(server, getB) {
102455
102519
  const problem = checkUsdc(amountUsdc, "amountUsdc");
102456
102520
  if (problem) return validationFailed(problem);
102457
102521
  }
102522
+ const size = amountUcd !== void 0 ? `${amountUcd} UCD` : `the UCD that carry_quote loanId ${loanId} credit ${credit}${amountUsdc !== void 0 ? ` amountUsdc ${amountUsdc}` : ""} returns as ucdToSell (show the user that exact figure)`;
102523
+ const gate = requireConfirmation(confirmed, `sell ${size} to the desk and bridge the USDC to loan ${loanId}'s Carry ${credit} (exact-amount approval if needed, then sellAndFund)`);
102524
+ if (gate) return gate;
102458
102525
  const b2 = getB();
102459
102526
  if (!b2.ok) return renderError(b2.error);
102460
102527
  return renderEnvelope(
@@ -103173,7 +103240,7 @@ function registerBoundaryInfoResource(server, getB) {
103173
103240
  }
103174
103241
 
103175
103242
  // src/version.ts
103176
- var SERVER_VERSION = "0.5.32";
103243
+ var SERVER_VERSION = "0.5.33";
103177
103244
 
103178
103245
  // src/server.ts
103179
103246
  var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-mcp",
3
- "version": "0.5.32",
3
+ "version": "0.5.33",
4
4
  "description": "MCP server for the Diamond Hands protocol",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
  "@anthropic-ai/mcpb": "2.1.2",
58
58
  "@google-cloud/firestore": "9.3.1",
59
59
  "@gvnrdao/dh-carry-sdk": "0.0.22",
60
- "@gvnrdao/dh-sdk": "^0.0.358",
60
+ "@gvnrdao/dh-sdk": "^0.0.359",
61
61
  "@types/express": "5.0.3",
62
62
  "@types/jest": "29.5.12",
63
63
  "@types/node": "20.14.10",