@gvnrdao/dh-mcp 0.5.19 → 0.5.20

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.
@@ -14571,113 +14571,113 @@ var require_pkg_src = __commonJS({
14571
14571
  deployedAt: 1784569687492,
14572
14572
  size: 4140,
14573
14573
  hash: "4c0d65bf1f33cdac22a78fd8c4764319cc3fe00650e0fe7fa8a6090d9a318a7b",
14574
- validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
14574
+ validatorWalletAddress: "0xefb258d455a31d061bbeb3de3d2143bdfcb67a6c",
14575
14575
  pkp: {
14576
14576
  publicKey: "0x04ec0e3acc40884e3f366ca469d08899eb640ad5259fa196b0238075086208a9f8732a3175704f35f0bcc28e07406cfb24c254efd1e7355640577330f0d2dd755f",
14577
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14577
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14578
14578
  }
14579
14579
  },
14580
14580
  btcTransactionSigner: {
14581
- cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
14581
+ cid: "QmULkz7hwwqsyLwY23U14dnartdVuSNMrykt69PaNiAq7U",
14582
14582
  authorizedCidHex: cidToHex(
14583
- "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
14583
+ "QmULkz7hwwqsyLwY23U14dnartdVuSNMrykt69PaNiAq7U"
14584
14584
  ),
14585
14585
  name: "Btc Transaction Signer",
14586
14586
  description: "Production Btc Transaction Signer",
14587
14587
  version: "1.1.1",
14588
14588
  deployed: true,
14589
- deployedAt: 1787923905597,
14590
- size: 70646,
14591
- hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
14589
+ deployedAt: 1790246185256,
14590
+ size: 73313,
14591
+ hash: "d8b6bc646ba33fee7d46c8e9b281de776081ea6f182f56fd15d4c52aaf3dd030"
14592
14592
  },
14593
14593
  ucdMintValidator: {
14594
- cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
14594
+ cid: "QmcxVSn9saEPGBS6mqPhNefgW83V2qeZjjXbhwYLP373xe",
14595
14595
  authorizedCidHex: cidToHex(
14596
- "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
14596
+ "QmcxVSn9saEPGBS6mqPhNefgW83V2qeZjjXbhwYLP373xe"
14597
14597
  ),
14598
14598
  name: "Ucd Mint Validator",
14599
14599
  description: "Production Ucd Mint Validator",
14600
- version: "1.2.1",
14600
+ version: "1.3.0",
14601
14601
  deployed: true,
14602
- deployedAt: 1787923919527,
14603
- size: 86197,
14604
- hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
14605
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14602
+ deployedAt: 1790246219868,
14603
+ size: 90022,
14604
+ hash: "65e8cb778c2b767ae6eb37cb5db7b4c5a3f2468d508463c847c83c1b6825fadd",
14605
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14606
14606
  pkp: {
14607
14607
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
14608
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14608
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14609
14609
  }
14610
14610
  },
14611
14611
  processPaymentValidator: {
14612
- cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
14612
+ cid: "QmWFbxJkfxhCtES4wrePWQkYtjhtrP1tohvn9d1r9N5Hd8",
14613
14613
  authorizedCidHex: cidToHex(
14614
- "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
14614
+ "QmWFbxJkfxhCtES4wrePWQkYtjhtrP1tohvn9d1r9N5Hd8"
14615
14615
  ),
14616
14616
  name: "Process Payment Validator",
14617
14617
  description: "Production Process Payment Validator",
14618
14618
  version: "1.2.1",
14619
14619
  deployed: true,
14620
- deployedAt: 1787923987153,
14621
- size: 82217,
14622
- hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
14623
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14620
+ deployedAt: 1790246225795,
14621
+ size: 85107,
14622
+ hash: "25ecf952c4c44c40b0920b92d57906e7010ed9a38e2ba41ccdee6d3377c2b596",
14623
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14624
14624
  pkp: {
14625
14625
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
14626
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14626
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14627
14627
  }
14628
14628
  },
14629
14629
  extendPositionValidator: {
14630
- cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
14630
+ cid: "QmZ3g7g5DkgU1gEYpFjprQf3sctUHtGjNQVYezw2bnPGEX",
14631
14631
  authorizedCidHex: cidToHex(
14632
- "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
14632
+ "QmZ3g7g5DkgU1gEYpFjprQf3sctUHtGjNQVYezw2bnPGEX"
14633
14633
  ),
14634
14634
  name: "Extend Position Validator",
14635
14635
  description: "Production Extend Position Validator",
14636
14636
  version: "1.2.1",
14637
14637
  deployed: true,
14638
- deployedAt: 1787923999294,
14639
- size: 79975,
14640
- hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
14641
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14638
+ deployedAt: 1790246231975,
14639
+ size: 82853,
14640
+ hash: "25d4887b7f646649db2bb7f2bfb77d039db83228a6c454377ca26c779b0903cc",
14641
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14642
14642
  pkp: {
14643
14643
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
14644
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14644
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14645
14645
  }
14646
14646
  },
14647
14647
  btcWithdrawal: {
14648
- cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
14648
+ cid: "QmbRaaMQr1jCctDGe8mPADsUz1rkb4frT1YqSKroiXjzyP",
14649
14649
  authorizedCidHex: cidToHex(
14650
- "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
14650
+ "QmbRaaMQr1jCctDGe8mPADsUz1rkb4frT1YqSKroiXjzyP"
14651
14651
  ),
14652
14652
  name: "Btc Withdrawal",
14653
14653
  description: "Production Btc Withdrawal",
14654
14654
  version: "1.2.7",
14655
14655
  deployed: true,
14656
- deployedAt: 1787924017769,
14657
- size: 100069,
14658
- hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
14659
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14656
+ deployedAt: 1790246239599,
14657
+ size: 101228,
14658
+ hash: "2ed25eca6cc80a43061b7ad119737af48158fdb61d59f10cd06cea51b607f112",
14659
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14660
14660
  pkp: {
14661
14661
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
14662
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14662
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14663
14663
  }
14664
14664
  },
14665
14665
  liquidationValidator: {
14666
- cid: "Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx",
14666
+ cid: "QmTs2w8gfAwWZLbzJZg2CZmiLhVXS5kbMgaj42Zuxfodpb",
14667
14667
  authorizedCidHex: cidToHex(
14668
- "Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx"
14668
+ "QmTs2w8gfAwWZLbzJZg2CZmiLhVXS5kbMgaj42Zuxfodpb"
14669
14669
  ),
14670
14670
  name: "Liquidation Validator",
14671
14671
  description: "Production Liquidation Validator",
14672
14672
  version: "1.2.1",
14673
14673
  deployed: true,
14674
- deployedAt: 1785173262533,
14675
- size: 66846,
14676
- hash: "b35ee7706d733d625faa4dbe37f73c8e20f0c1befa897cd7875e827de52003de",
14677
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14674
+ deployedAt: 1790246247904,
14675
+ size: 70308,
14676
+ hash: "582ccf0ec7f715195e20fdc885996743cb42125b64173424e360ee63db62bbd8",
14677
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14678
14678
  pkp: {
14679
14679
  publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
14680
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14680
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14681
14681
  }
14682
14682
  },
14683
14683
  priceOracle: {
@@ -14692,28 +14692,28 @@ var require_pkg_src = __commonJS({
14692
14692
  deployedAt: 1781116663270,
14693
14693
  size: 8695,
14694
14694
  hash: "ba20ade60a7fa5acd80dadfafa179c507388cfe6ce48a22a672d70b317ffcc74",
14695
- validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
14695
+ validatorWalletAddress: "0xefb258d455a31d061bbeb3de3d2143bdfcb67a6c",
14696
14696
  pkp: {
14697
14697
  publicKey: "0x043beaa1da47875601a8d6f430b1438ee2d4732eefd06e5c63a474bbdaf9e7df1797b1b951e041b627c2bf839788164825324c9cbd1e2d6f740fdd4bff69b1900b",
14698
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14698
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14699
14699
  }
14700
14700
  },
14701
14701
  loanVaultBtcBalance: {
14702
- cid: "QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4",
14702
+ cid: "QmZ27xCzuoaAhWxRsMPsUQkp45a8WPBb21uhxwchw3LG5W",
14703
14703
  authorizedCidHex: cidToHex(
14704
- "QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4"
14704
+ "QmZ27xCzuoaAhWxRsMPsUQkp45a8WPBb21uhxwchw3LG5W"
14705
14705
  ),
14706
14706
  name: "Loan Vault Btc Balance",
14707
14707
  description: "Production Loan Vault Btc Balance",
14708
14708
  version: "1.2.1",
14709
14709
  deployed: true,
14710
- deployedAt: 1785173271802,
14711
- size: 56800,
14712
- hash: "a059133214e6ba0a73d655a15600c4b33e361fb340c98f8eecaf8ab7b95aaf83",
14713
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14710
+ deployedAt: 1790179961079,
14711
+ size: 60046,
14712
+ hash: "922e86c0a667fe0c0945771f84aa6b9fe08be9c96dd2f73a9c5cb257d24e22b0",
14713
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14714
14714
  pkp: {
14715
14715
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
14716
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14716
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14717
14717
  }
14718
14718
  },
14719
14719
  // btc-address-balance (Option B) — address-only signed total balance via
@@ -14723,21 +14723,21 @@ var require_pkg_src = __commonJS({
14723
14723
  // Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
14724
14724
  // on each target chain (the action decrypts registry slots). No OAR entry.
14725
14725
  btcAddressBalance: {
14726
- cid: "QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj",
14726
+ cid: "QmVVjB6zCBiXFKffhQPYUAZhj7TXduuvcrPqKtHa3DMXhN",
14727
14727
  authorizedCidHex: cidToHex(
14728
- "QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj"
14728
+ "QmVVjB6zCBiXFKffhQPYUAZhj7TXduuvcrPqKtHa3DMXhN"
14729
14729
  ),
14730
14730
  name: "Btc Address Balance",
14731
14731
  description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
14732
14732
  version: "0.2.1",
14733
14733
  deployed: true,
14734
- deployedAt: 1785173280221,
14735
- size: 27309,
14736
- hash: "f0d08938713d9d89a56a3a386cacbc2b57afd5ad367ea82d827d40e1bfc70989",
14737
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14734
+ deployedAt: 1790179971315,
14735
+ size: 30295,
14736
+ hash: "2c67d9cfa4d50e835fbb28ae50e80217ceb2be3bb862c89290aadf43fdc739c9",
14737
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14738
14738
  pkp: {
14739
14739
  publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
14740
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14740
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14741
14741
  }
14742
14742
  },
14743
14743
  alwaysSigner: {
@@ -14767,48 +14767,48 @@ var require_pkg_src = __commonJS({
14767
14767
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
14768
14768
  },
14769
14769
  agentModuleExecutor: {
14770
- cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
14770
+ cid: "QmSwPPvQhT7UhcuVA2m3UxGhVj5WqMpDvYNKU1228QLFsX",
14771
14771
  authorizedCidHex: cidToHex(
14772
- "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
14772
+ "QmSwPPvQhT7UhcuVA2m3UxGhVj5WqMpDvYNKU1228QLFsX"
14773
14773
  ),
14774
14774
  name: "Agent Module Executor",
14775
14775
  description: "Production Agent Module Executor",
14776
14776
  version: "1.1.1",
14777
14777
  deployed: true,
14778
- deployedAt: 1787924032013,
14779
- size: 13878,
14780
- hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
14778
+ deployedAt: 1790179978959,
14779
+ size: 14688,
14780
+ hash: "8edb9b12c784c8d7d153cce97235584c24665a788767ae68713dce91109ab35e"
14781
14781
  },
14782
14782
  staleSpendRecoveryValidator: {
14783
- cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
14783
+ cid: "Qmarj59zdSSgivkimryrdvnyZqH5YpTimKj1LivXNBHmNz",
14784
14784
  authorizedCidHex: cidToHex(
14785
- "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
14785
+ "Qmarj59zdSSgivkimryrdvnyZqH5YpTimKj1LivXNBHmNz"
14786
14786
  ),
14787
14787
  name: "Stale Spend Recovery Validator",
14788
14788
  description: "Production Stale Spend Recovery Validator",
14789
14789
  version: "1.1.2",
14790
14790
  deployed: true,
14791
- deployedAt: 1787924048772,
14792
- size: 41424,
14793
- hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
14794
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14791
+ deployedAt: 1790246256280,
14792
+ size: 48143,
14793
+ hash: "ec9236bcbe0af24d3e1844791fc8fe37371bbecd8ce95d02e13f7c6e1fc7d94c",
14794
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
14795
14795
  pkp: {
14796
14796
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
14797
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
14797
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
14798
14798
  }
14799
14799
  },
14800
14800
  btcUtxoInvalidator: {
14801
- cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
14801
+ cid: "QmbS44bGcmKYF64Cu35qzsk9sxiU4Umde8Z3q24ZnEbQvX",
14802
14802
  authorizedCidHex: cidToHex(
14803
- "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
14803
+ "QmbS44bGcmKYF64Cu35qzsk9sxiU4Umde8Z3q24ZnEbQvX"
14804
14804
  ),
14805
14805
  name: "Btc Utxo Invalidator",
14806
14806
  description: "Production Btc Utxo Invalidator",
14807
14807
  version: "1.0.0",
14808
14808
  deployed: true,
14809
- deployedAt: 1787924133241,
14810
- size: 66026,
14811
- hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
14809
+ deployedAt: 1790246264563,
14810
+ size: 69219,
14811
+ hash: "bda048d8cd6b5a39c2774bcf1320e82d1eea935c2a521006fb8b887e13b6dd8d"
14812
14812
  }
14813
14813
  };
14814
14814
  function getDeploymentsForNetwork(network) {
@@ -15574,7 +15574,10 @@ ${errorReport}`);
15574
15574
  BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
15575
15575
  BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
15576
15576
  LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
15577
- PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
15577
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C",
15578
+ TermManagerModule: "0xDB99CdF883ffa38acD099bC39F8d1f4508c9239E",
15579
+ UCDController: "0x4b4f8063048bCD59D469219E3f07C6aaDF4f6157",
15580
+ LiquidationManagerModule: "0x74B28695352E7bf736D6c9F76ccb7B4439477De9"
15578
15581
  },
15579
15582
  11155111: {
15580
15583
  PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
@@ -15582,7 +15585,10 @@ ${errorReport}`);
15582
15585
  BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
15583
15586
  BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
15584
15587
  LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
15585
- PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
15588
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
15589
+ TermManagerModule: "0x94Adc6F9558368B1482197584f1fc7133Ecf835b",
15590
+ UCDController: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
15591
+ LiquidationManagerModule: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76"
15586
15592
  }
15587
15593
  };
15588
15594
  function getPinnedContractAddresses(chainId) {
@@ -15768,10 +15774,10 @@ ${errorReport}`);
15768
15774
  };
15769
15775
  }
15770
15776
  const ratioBigInt = collateralValueUsd * UCD_TOKEN_DECIMALS * 10000n / ucdDebt;
15771
- const collateralRatioBps = Number(ratioBigInt);
15777
+ const collateralRatioBps2 = Number(ratioBigInt);
15772
15778
  return {
15773
15779
  collateralValueUsd,
15774
- collateralRatioBps
15780
+ collateralRatioBps: collateralRatioBps2
15775
15781
  };
15776
15782
  }
15777
15783
  function hasSufficientCollateralForDebt(collateralValueUsd, currentDebt, additionalDebt, requiredRatioBps) {
@@ -16616,6 +16622,17 @@ ${auth.clientId}`;
16616
16622
  );
16617
16623
  }
16618
16624
  }
16625
+ var TIP_READ_FAILURE_PREFIX = "Bitcoin tip-height read failed";
16626
+ var BitcoinTipUnreadableError = class extends Error {
16627
+ constructor(message) {
16628
+ super(message);
16629
+ this.isBitcoinTipUnreadable = true;
16630
+ this.name = "BitcoinTipUnreadableError";
16631
+ }
16632
+ };
16633
+ function isBitcoinTipUnreadableError(error) {
16634
+ return typeof error === "object" && error !== null && error.isBitcoinTipUnreadable === true;
16635
+ }
16619
16636
  var BitcoinDataProvider = class {
16620
16637
  constructor(config) {
16621
16638
  this.config = config;
@@ -17067,27 +17084,12 @@ ${auth.clientId}`;
17067
17084
  if (!data.status.confirmed || !data.status.block_height) {
17068
17085
  return { txid: data.txid ?? txid, confirmations: 0 };
17069
17086
  }
17070
- try {
17071
- const tipResp = await fetch(
17072
- `${this.config.providerUrl}/blocks/tip/height`,
17073
- { signal: controller.signal, headers: await this.withAuth() }
17074
- );
17075
- if (!tipResp.ok) {
17076
- return { txid: data.txid ?? txid, confirmations: 1 };
17077
- }
17078
- const tipBody = (await tipResp.text()).trim();
17079
- const tipHeight = Number.parseInt(tipBody, 10);
17080
- if (!Number.isFinite(tipHeight) || tipHeight <= 0) {
17081
- return { txid: data.txid ?? txid, confirmations: 1 };
17082
- }
17083
- const depth = tipHeight - data.status.block_height + 1;
17084
- return {
17085
- txid: data.txid ?? txid,
17086
- confirmations: depth > 0 ? depth : 0
17087
- };
17088
- } catch {
17089
- return { txid: data.txid ?? txid, confirmations: 1 };
17090
- }
17087
+ const tipHeight = await this.fetchTipHeight(controller.signal);
17088
+ const depth = tipHeight - data.status.block_height + 1;
17089
+ return {
17090
+ txid: data.txid ?? txid,
17091
+ confirmations: depth > 0 ? depth : 0
17092
+ };
17091
17093
  }
17092
17094
  return null;
17093
17095
  } catch (error) {
@@ -17095,12 +17097,55 @@ ${auth.clientId}`;
17095
17097
  if (isAbortError(error)) {
17096
17098
  throw new Error(`Request timeout after ${this.timeout}ms`);
17097
17099
  }
17100
+ if (isBitcoinTipUnreadableError(error)) {
17101
+ throw error;
17102
+ }
17098
17103
  if (getUnknownErrorMessage(error).includes("404")) {
17099
17104
  return null;
17100
17105
  }
17101
17106
  throw error;
17102
17107
  }
17103
17108
  }
17109
+ /**
17110
+ * Current chain tip height from THIS provider — or throw.
17111
+ *
17112
+ * Every exit is a throw naming the provider and the precise failure, because
17113
+ * the only alternative is inventing a confirmation depth (see the call site).
17114
+ * The single `try` exists solely to attach that name to a transport-level
17115
+ * rejection (DNS, TLS, connection reset, abort); it re-throws the cause
17116
+ * verbatim inside the message and never substitutes a value — authorized for
17117
+ * this case by the Batch 2 plan, §C2.
17118
+ *
17119
+ * @param signal - The caller's AbortSignal, so this read shares the same
17120
+ * timeout budget as the transaction fetch it serves.
17121
+ */
17122
+ async fetchTipHeight(signal) {
17123
+ const endpoint = `${this.config.providerUrl}/blocks/tip/height`;
17124
+ let tipResp;
17125
+ try {
17126
+ tipResp = await fetch(endpoint, {
17127
+ signal,
17128
+ headers: await this.withAuth()
17129
+ });
17130
+ } catch (error) {
17131
+ throw new BitcoinTipUnreadableError(
17132
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} threw \u2014 ${getUnknownErrorMessage(error)}`
17133
+ );
17134
+ }
17135
+ if (!tipResp.ok) {
17136
+ throw new BitcoinTipUnreadableError(
17137
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} \u2192 ${tipResp.status} ${tipResp.statusText}`
17138
+ );
17139
+ }
17140
+ const tipBody = (await tipResp.text()).trim();
17141
+ const tipHeight = Number.parseInt(tipBody, 10);
17142
+ if (!Number.isFinite(tipHeight) || tipHeight <= 0) {
17143
+ throw new BitcoinTipUnreadableError(
17144
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} returned an unusable tip height "${tipBody.slice(0, 64)}"`
17145
+ );
17146
+ }
17147
+ return tipHeight;
17148
+ }
17104
17149
  /**
17105
17150
  * Get outputs (vouts) of a Bitcoin transaction
17106
17151
  *
@@ -17735,10 +17780,13 @@ ${auth.clientId}`;
17735
17780
  * only on unanimity. The confirmed-balance consensus the validators run
17736
17781
  * covers `chain_stats` only, so without this the primary provider alone
17737
17782
  * could fabricate an unconfirmed UTXO plus a self-consistent parent proof
17738
- * and inflate the signed balance. Any provider failure or verdict
17739
- * disagreement THROWS (fail-closed) — exclusion on a suppressed proof
17740
- * would deflate the balance and open a wrongful-liquidation window, so
17741
- * neither direction may proceed without agreement.
17783
+ * and inflate the signed balance. Any verdict disagreement THROWS
17784
+ * (fail-closed) — exclusion on a suppressed proof would deflate the balance
17785
+ * and open a wrongful-liquidation window, so neither direction may proceed
17786
+ * without agreement. A provider that cannot state the chain tip — and only
17787
+ * that failure — is dropped from the quorum rather than aborting the read (it
17788
+ * never counts as agreeing), and falling below `minConsensusProviders`
17789
+ * survivors throws — see `verifyParentIsSelfSpendConsensus`.
17742
17790
  *
17743
17791
  * The same per-provider `/tx` fetch also returns the parent's outputs, and
17744
17792
  * every provider must corroborate each claimed UTXO (index, vault address,
@@ -17833,10 +17881,26 @@ ${auth.clientId}`;
17833
17881
  }
17834
17882
  /**
17835
17883
  * Run the self-spend proof against every configured provider and require
17836
- * unanimity. Fail-closed: a provider request failure or a verdict
17837
- * disagreement throws and aborts the balance calculation — see
17884
+ * unanimity AMONG THE PROVIDERS THAT ANSWERED. Fail-closed on disagreement:
17885
+ * a verdict mismatch throws and aborts the balance calculation — see
17838
17886
  * classifySelfChange for why exclusion is not a safe fallback here.
17839
17887
  *
17888
+ * Quorum semantics (2026-09-23, plan C2). ONE failure class is tolerated: a
17889
+ * provider that could not state the chain tip (`BitcoinTipUnreadableError`).
17890
+ * It is ABSENT from the quorum — never counted as agreeing, never allowed to
17891
+ * decide the verdict — and the policy floor, not "at least one", decides when
17892
+ * that absence is fatal: below `minConsensusProviders` surviving readings
17893
+ * there is no cross-check left to trust, and the read fails loudly naming
17894
+ * every provider that dropped out.
17895
+ *
17896
+ * Why only that class. `getTransaction` now throws on an unreadable tip
17897
+ * instead of fabricating `confirmations: 1`; without this carve-out one flaky
17898
+ * `/blocks/tip/height` endpoint would take every balance and spend path down
17899
+ * with it. Every OTHER failure remains fatal, as before: a provider that
17900
+ * answers "I have never seen that transaction" is making a claim about the
17901
+ * chain rather than suffering an outage, and that shape is precisely the
17902
+ * fabricated-UTXO signature the fail-closed rule exists to catch.
17903
+ *
17840
17904
  * When the parent IS a unanimous self-spend, every provider's view of the
17841
17905
  * parent's OUTPUTS must additionally corroborate the primary's claimed
17842
17906
  * UTXOs (index exists, pays the vault, exact value). Without this, a
@@ -17861,32 +17925,52 @@ ${auth.clientId}`;
17861
17925
  )
17862
17926
  )
17863
17927
  );
17864
- const failures = settled.map((r, i) => ({ r, name: providerName(i) })).filter(
17865
- (x) => x.r.status === "rejected"
17866
- ).map(
17867
- ({ r, name }) => `${name} \u2192 ${r.reason?.message ?? String(r.reason)}`
17868
- );
17928
+ const answered = [];
17929
+ const absences = [];
17930
+ const failures = [];
17931
+ settled.forEach((result, i) => {
17932
+ if (result.status === "fulfilled") {
17933
+ answered.push({ index: i, evaluation: result.value });
17934
+ return;
17935
+ }
17936
+ const described = `${providerName(i)} \u2192 ${result.reason?.message ?? String(result.reason)}`;
17937
+ if (isBitcoinTipUnreadableError(result.reason)) {
17938
+ absences.push(described);
17939
+ return;
17940
+ }
17941
+ failures.push(described);
17942
+ });
17869
17943
  if (failures.length > 0) {
17870
17944
  throw new Error(
17871
17945
  `Self-change classification failed for tx ${parentTxid} on ${failures.length}/${providerConfigs.length} provider(s): ${failures.join("; ")}`
17872
17946
  );
17873
17947
  }
17874
- const evaluations = settled.map(
17875
- (r) => r.value
17876
- );
17877
- const votes = evaluations.map((e) => e.selfSpend);
17878
- const disagreements = votes.map((vote, i) => ({ vote, name: providerName(i) })).filter((x) => x.vote !== votes[0]).map(
17879
- (x) => `${providerName(0)}=${votes[0]} vs ${x.name}=${x.vote}`
17948
+ const floor = Math.max(1, this.minConsensusProviders);
17949
+ if (answered.length < floor) {
17950
+ throw new Error(
17951
+ `Self-change classification for tx ${parentTxid}: only ${answered.length}/${providerConfigs.length} provider(s) could state a confirmation depth, below this chain's floor of ${floor}. Unreadable tips: ${absences.join("; ")}`
17952
+ );
17953
+ }
17954
+ if (absences.length > 0) {
17955
+ litDebugLog(
17956
+ `[VaultBalance] self-change: tx ${parentTxid} classified on a reduced quorum \u2014 ${answered.length}/${providerConfigs.length} provider(s) answered (floor ${floor}); dropped for an unreadable chain tip: ${absences.join("; ")}`
17957
+ );
17958
+ }
17959
+ const first = answered[0];
17960
+ const disagreements = answered.slice(1).filter((a) => a.evaluation.selfSpend !== first.evaluation.selfSpend).map(
17961
+ (a) => `${providerName(first.index)}=${first.evaluation.selfSpend} vs ${providerName(a.index)}=${a.evaluation.selfSpend}`
17880
17962
  );
17881
17963
  if (disagreements.length > 0) {
17882
17964
  throw new Error(
17883
17965
  `Self-change consensus mismatch for tx ${parentTxid}: ${disagreements.join("; ")}. A provider may be compromised or out of sync; refusing to sign.`
17884
17966
  );
17885
17967
  }
17886
- if (!votes[0]) {
17968
+ if (!first.evaluation.selfSpend) {
17887
17969
  return false;
17888
17970
  }
17889
- const outputMismatches = evaluations.map((e, i) => e.outputMismatch ? `${providerName(i)} \u2192 ${e.outputMismatch}` : null).filter((m) => m !== null);
17971
+ const outputMismatches = answered.map(
17972
+ (a) => a.evaluation.outputMismatch ? `${providerName(a.index)} \u2192 ${a.evaluation.outputMismatch}` : null
17973
+ ).filter((m) => m !== null);
17890
17974
  if (outputMismatches.length > 0) {
17891
17975
  throw new Error(
17892
17976
  `Self-change output claim mismatch for tx ${parentTxid}: ${outputMismatches.join("; ")}. The reported UTXO set contradicts the parent transaction; refusing to sign.`
@@ -18129,16 +18213,6 @@ ${auth.clientId}`;
18129
18213
  minConfirmations
18130
18214
  );
18131
18215
  const authorizedSpends = await this.getAuthorizedSpendsFromContract(positionId);
18132
- for (const spend of authorizedSpends) {
18133
- const utxoStillExists = utxoSet.utxos.some(
18134
- (utxo) => utxo.txid === spend.txid && utxo.vout === spend.vout
18135
- );
18136
- if (utxoStillExists) {
18137
- throw new Error(
18138
- `Authorized UTXO ${spend.txid}:${spend.vout} not yet spent. Transaction was authorized in smart contract but not signed and broadcasted to Bitcoin network. Complete the transaction by signing and broadcasting it.`
18139
- );
18140
- }
18141
- }
18142
18216
  const authorizedBalance = authorizedSpends.reduce(
18143
18217
  (sum, spend) => sum + spend.satoshis,
18144
18218
  0n
@@ -18434,7 +18508,13 @@ ${auth.clientId}`;
18434
18508
  allowDevSinglePriceProvider: false,
18435
18509
  minBitcoinBalanceConfirmations: 1,
18436
18510
  minBitcoinSpendConfirmations: 1,
18437
- minConsensusProviders: 1
18511
+ // 2 since 2026-09-23. It was 1 because Sepolia ran a single faucet provider
18512
+ // "by design", so the consensus floor was documented as a mainnet-only
18513
+ // guarantee. The registry now holds two, and leaving the floor at 1 meant
18514
+ // Sepolia could never exercise the multi-provider agreement the stale-spend
18515
+ // and balance paths rely on — the one environment where that logic is
18516
+ // supposed to be proved before mainnet.
18517
+ minConsensusProviders: 2
18438
18518
  },
18439
18519
  [
18440
18520
  "ethereum"
@@ -24043,9 +24123,35 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
24043
24123
  return mod && mod.__esModule ? mod : { "default": mod };
24044
24124
  };
24045
24125
  Object.defineProperty(exports2, "__esModule", { value: true });
24126
+ exports2.computeCidV0 = computeCidV0;
24046
24127
  exports2.fetchLitActionCodeFromIpfs = fetchLitActionCodeFromIpfs;
24047
24128
  var axios_1 = __importDefault(require_axios());
24129
+ var ethers_1 = require("ethers");
24048
24130
  var ipfsCodeCache = /* @__PURE__ */ new Map();
24131
+ var CIDV0 = /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/;
24132
+ var SINGLE_BLOCK_MAX_BYTES = 262144;
24133
+ function varint(n) {
24134
+ const out = [];
24135
+ while (n >= 128) {
24136
+ out.push(n & 127 | 128);
24137
+ n >>>= 7;
24138
+ }
24139
+ out.push(n);
24140
+ return out;
24141
+ }
24142
+ function computeCidV0(content) {
24143
+ const n = varint(content.length);
24144
+ const unixfs = new Uint8Array([8, 2, 18, ...n, ...content, 24, ...n]);
24145
+ const node = new Uint8Array([10, ...varint(unixfs.length), ...unixfs]);
24146
+ return (0, ethers_1.encodeBase58)(new Uint8Array([18, 32, ...(0, ethers_1.getBytes)((0, ethers_1.sha256)(node))]));
24147
+ }
24148
+ function responseBytes(data) {
24149
+ if (data instanceof Uint8Array)
24150
+ return data;
24151
+ if (data instanceof ArrayBuffer)
24152
+ return new Uint8Array(data);
24153
+ return null;
24154
+ }
24049
24155
  var GATEWAY_TIMEOUT_MS = 2e4;
24050
24156
  var buildGatewayList = (cid, pinataJwt) => {
24051
24157
  const gateways = [];
@@ -24066,6 +24172,9 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
24066
24172
  }
24067
24173
  return cached;
24068
24174
  }
24175
+ if (!CIDV0.test(cid)) {
24176
+ throw new Error(`Refusing to fetch LIT Action for ${cid}: only CIDv0 (Qm\u2026) content can be verified`);
24177
+ }
24069
24178
  const pinataJwt = options.pinataJwt ?? process.env.PINATA_JWT;
24070
24179
  const extraGateways = options.extraGateways?.map((t) => ({ url: t.replace("{cid}", cid) })) ?? [];
24071
24180
  const gateways = [...extraGateways, ...buildGatewayList(cid, pinataJwt)];
@@ -24077,19 +24186,32 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
24077
24186
  }
24078
24187
  const response = await axios_1.default.get(gateway.url, {
24079
24188
  timeout: GATEWAY_TIMEOUT_MS,
24189
+ responseType: "arraybuffer",
24080
24190
  headers: {
24081
24191
  Accept: "text/plain, application/javascript, text/javascript",
24082
24192
  ...gateway.headers
24083
24193
  }
24084
24194
  });
24085
- if (response.data && typeof response.data === "string") {
24086
- if (options.debug) {
24087
- console.log(`\u2705 [fetchLitActionCodeFromIpfs] Fetched from ${gateway.url}`);
24088
- }
24089
- ipfsCodeCache.set(cid, response.data);
24090
- return response.data;
24195
+ const bytes = responseBytes(response.data);
24196
+ if (!bytes || bytes.length === 0) {
24197
+ failures.push(`${gateway.url}: HTTP ${response.status} returned ${bytes ? "an empty body" : typeof response.data}, expected bytes`);
24198
+ continue;
24091
24199
  }
24092
- failures.push(`${gateway.url}: HTTP ${response.status} returned ${typeof response.data}, expected string`);
24200
+ if (bytes.length > SINGLE_BLOCK_MAX_BYTES) {
24201
+ failures.push(`${gateway.url}: ${bytes.length} bytes exceeds the single-block CIDv0 limit (${SINGLE_BLOCK_MAX_BYTES}); content cannot be verified`);
24202
+ continue;
24203
+ }
24204
+ const actualCid = computeCidV0(bytes);
24205
+ if (actualCid !== cid) {
24206
+ failures.push(`${gateway.url}: content hashes to ${actualCid}, not the requested CID`);
24207
+ continue;
24208
+ }
24209
+ const code = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
24210
+ if (options.debug) {
24211
+ console.log(`\u2705 [fetchLitActionCodeFromIpfs] Fetched and verified from ${gateway.url}`);
24212
+ }
24213
+ ipfsCodeCache.set(cid, code);
24214
+ return code;
24093
24215
  } catch (error) {
24094
24216
  const message = error instanceof Error ? error.message : String(error);
24095
24217
  failures.push(`${gateway.url}: ${message}`);
@@ -25577,6 +25699,53 @@ var require_pkp_signer_module = __commonJS({
25577
25699
  }
25578
25700
  });
25579
25701
 
25702
+ // node_modules/@gvnrdao/dh-lit-ops/dist/modules/mainnet-validator-wallets.js
25703
+ var require_mainnet_validator_wallets = __commonJS({
25704
+ "node_modules/@gvnrdao/dh-lit-ops/dist/modules/mainnet-validator-wallets.js"(exports2) {
25705
+ "use strict";
25706
+ Object.defineProperty(exports2, "__esModule", { value: true });
25707
+ exports2.MAINNET_OP_VALIDATOR_WALLETS = exports2.SEPOLIA_DEFAULT_VALIDATOR_WALLET = exports2.NON_MAINNET_CHAIN_IDS = void 0;
25708
+ exports2.resolveMainnetValidatorWallet = resolveMainnetValidatorWallet;
25709
+ exports2.NON_MAINNET_CHAIN_IDS = /* @__PURE__ */ new Set([
25710
+ 11155111,
25711
+ // Sepolia
25712
+ 1337,
25713
+ // Hardhat (DH local deployment chainId)
25714
+ 31337
25715
+ // Hardhat (default)
25716
+ ]);
25717
+ exports2.SEPOLIA_DEFAULT_VALIDATOR_WALLET = "0xefb258d455a31d061bbeb3de3d2143bdfcb67a6c";
25718
+ exports2.MAINNET_OP_VALIDATOR_WALLETS = {
25719
+ ucdMintValidator: "0x19C8FeE0f8f4b6F9Aa8e521D4CC62F4697CF85af",
25720
+ processPaymentValidator: "0x01480725c1fA026fd4A6bfA3100c691aeC955135",
25721
+ extendPositionValidator: "0xcE08AF213D8d95ad3dD317276F9e93Ab2eD75030",
25722
+ btcWithdrawal: "0x69dCd1204CDB31437CaF7114f74422390b472d3A",
25723
+ loanVaultBtcBalance: "0xc3d549EEb62721750Ff6518f6730Ab0e8D0Fea97",
25724
+ liquidationValidator: "0x66B30C19173005A51f21e2e4180FD7BC8c1d485b",
25725
+ // Non-OAR: verified on-chain by BTCSpendAuthorizer.staleSpendValidatorAddress (set via
25726
+ // AdminModule to this PKP's derived signer). Self-deriving Safe-owned PKP; seed == signer.
25727
+ staleSpendRecoveryValidator: "0x58F9144cF9781c15C061ba86901905a5a19F7661",
25728
+ // Non-OAR: no on-chain consumer verifies these signatures. The Sepolia seed has no key
25729
+ // derivation registered on the mainnet Lit account, so they reuse the Safe-owned
25730
+ // pkp-validator PKP (live derivation, group 2). See
25731
+ // docs/INCIDENT_2026-09-21_MAINNET_PKP_DERIVATION_DECRYPT.md.
25732
+ btcAddressBalance: "0x19524aE4e514a0f08A542596c2DA0B2262c61f48",
25733
+ priceOracle: "0x19524aE4e514a0f08A542596c2DA0B2262c61f48"
25734
+ };
25735
+ function resolveMainnetValidatorWallet(args) {
25736
+ const { registryKey, chainId, wallet } = args;
25737
+ const isNonMainnetChain = Number.isFinite(chainId) && exports2.NON_MAINNET_CHAIN_IDS.has(chainId);
25738
+ if (isNonMainnetChain || !wallet || wallet.toLowerCase() !== exports2.SEPOLIA_DEFAULT_VALIDATOR_WALLET) {
25739
+ return wallet;
25740
+ }
25741
+ if (!registryKey || !Object.prototype.hasOwnProperty.call(exports2.MAINNET_OP_VALIDATOR_WALLETS, registryKey)) {
25742
+ return wallet;
25743
+ }
25744
+ return exports2.MAINNET_OP_VALIDATOR_WALLETS[registryKey];
25745
+ }
25746
+ }
25747
+ });
25748
+
25580
25749
  // node_modules/@gvnrdao/dh-lit-ops/dist/utils/async-request.util.js
25581
25750
  var require_async_request_util = __commonJS({
25582
25751
  "node_modules/@gvnrdao/dh-lit-ops/dist/utils/async-request.util.js"(exports2) {
@@ -25604,7 +25773,9 @@ var require_async_request_util = __commonJS({
25604
25773
  });
25605
25774
  if (!submitResponse.ok) {
25606
25775
  const errorText = await submitResponse.text();
25607
- throw new Error(`Failed to submit request (${submitResponse.status}): ${errorText}`);
25776
+ const retryAfter = submitResponse.status === 429 ? submitResponse.headers.get("retry-after") : null;
25777
+ const retryHint = retryAfter && /^\d+$/.test(retryAfter.trim()) ? ` Retry after ${retryAfter.trim()}s.` : "";
25778
+ throw new Error(`Failed to submit request (${submitResponse.status}): ${errorText}${retryHint}`);
25608
25779
  }
25609
25780
  const submitEnvelope = await submitResponse.json();
25610
25781
  if (!submitEnvelope.success || !submitEnvelope.data?.ticketId) {
@@ -25882,6 +26053,7 @@ var require_lit_ops_module = __commonJS({
25882
26053
  var pkp_manager_module_1 = require_pkp_manager_module();
25883
26054
  var pkp_minter_module_1 = require_pkp_minter_module();
25884
26055
  var pkp_signer_module_1 = require_pkp_signer_module();
26056
+ var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
25885
26057
  var async_request_util_1 = require_async_request_util();
25886
26058
  var crypto_1 = require("crypto");
25887
26059
  var lit_core_lit_action_client_1 = require_lit_core_lit_action_client();
@@ -25894,26 +26066,6 @@ var require_lit_ops_module = __commonJS({
25894
26066
  { name: "borrower", type: "address" }
25895
26067
  ]
25896
26068
  };
25897
- var NON_MAINNET_CHAIN_IDS = /* @__PURE__ */ new Set([
25898
- 11155111,
25899
- // Sepolia
25900
- 1337,
25901
- // Hardhat (DH local deployment chainId)
25902
- 31337
25903
- // Hardhat (default)
25904
- ]);
25905
- var SEPOLIA_DEFAULT_VALIDATOR_WALLET = "0x82db9f515957aa380b596c6ea2bd30cef181f236";
25906
- var MAINNET_OP_VALIDATOR_WALLETS = {
25907
- ucdMintValidator: "0x19C8FeE0f8f4b6F9Aa8e521D4CC62F4697CF85af",
25908
- processPaymentValidator: "0x01480725c1fA026fd4A6bfA3100c691aeC955135",
25909
- extendPositionValidator: "0xcE08AF213D8d95ad3dD317276F9e93Ab2eD75030",
25910
- btcWithdrawal: "0x69dCd1204CDB31437CaF7114f74422390b472d3A",
25911
- loanVaultBtcBalance: "0xc3d549EEb62721750Ff6518f6730Ab0e8D0Fea97",
25912
- liquidationValidator: "0x66B30C19173005A51f21e2e4180FD7BC8c1d485b",
25913
- // Non-OAR: verified on-chain by BTCSpendAuthorizer.staleSpendValidatorAddress (set via
25914
- // AdminModule to this PKP's derived signer). Self-deriving Safe-owned PKP; seed == signer.
25915
- staleSpendRecoveryValidator: "0x58F9144cF9781c15C061ba86901905a5a19F7661"
25916
- };
25917
26069
  function resolvePkpValidationRegistryAddress(config) {
25918
26070
  const fromConfig = config.pkpValidationRegistryAddress;
25919
26071
  return fromConfig || process.env.PKP_VALIDATION_REGISTRY_ADDRESS || process.env.PKP_VALIDATION_REGISTRY;
@@ -27154,17 +27306,18 @@ var require_lit_ops_module = __commonJS({
27154
27306
  let effectiveValidatorWallet = litActionInfo.validatorWalletAddress;
27155
27307
  const jp = jsParams;
27156
27308
  const resolvedChainId = Number(jp.chainId ?? jp.auth?.chainId ?? jp.authMessage?.chainId ?? this.config.chainId);
27157
- const isNonMainnetChain = Number.isFinite(resolvedChainId) && NON_MAINNET_CHAIN_IDS.has(resolvedChainId);
27158
- if (!isNonMainnetChain && effectiveValidatorWallet && effectiveValidatorWallet.toLowerCase() === SEPOLIA_DEFAULT_VALIDATOR_WALLET) {
27159
- const reg = (0, dh_lit_actions_1.getDeploymentsForNetwork)(this.config.network);
27160
- const registryKey = Object.keys(reg).find((k) => reg[k]?.cid === litActionInfo.cid);
27161
- const mainnetWallet = registryKey ? MAINNET_OP_VALIDATOR_WALLETS[registryKey] : void 0;
27162
- if (mainnetWallet) {
27163
- if (this.config.debug) {
27164
- console.log(`[${label}] mainnet validator remap (${registryKey}, chainId=${Number.isFinite(resolvedChainId) ? resolvedChainId : "unknown\u2192mainnet"}): ${effectiveValidatorWallet} -> ${mainnetWallet}`);
27165
- }
27166
- effectiveValidatorWallet = mainnetWallet;
27309
+ const reg = (0, dh_lit_actions_1.getDeploymentsForNetwork)(this.config.network);
27310
+ const registryKey = Object.keys(reg).find((k) => reg[k]?.cid === litActionInfo.cid);
27311
+ const mainnetWallet = (0, mainnet_validator_wallets_1.resolveMainnetValidatorWallet)({
27312
+ registryKey,
27313
+ chainId: resolvedChainId,
27314
+ wallet: effectiveValidatorWallet
27315
+ });
27316
+ if (mainnetWallet !== effectiveValidatorWallet) {
27317
+ if (this.config.debug) {
27318
+ console.log(`[${label}] mainnet validator remap (${registryKey}, chainId=${Number.isFinite(resolvedChainId) ? resolvedChainId : "unknown\u2192mainnet"}): ${effectiveValidatorWallet} -> ${mainnetWallet}`);
27167
27319
  }
27320
+ effectiveValidatorWallet = mainnetWallet;
27168
27321
  }
27169
27322
  if (process.env.LIT_LANE_VALIDATOR_WALLET_OVERRIDE) {
27170
27323
  if (process.env.LIT_LANE_GUARD !== "1") {
@@ -28331,7 +28484,11 @@ var require_lit_ops_module = __commonJS({
28331
28484
  error: "sign=true requires price oracle PKP in registry (ethAddress/publicKey) or options.pkpId (Lit jsParams pkpId)"
28332
28485
  };
28333
28486
  }
28334
- priceOracleParams.pkpId = resolvedPkpId;
28487
+ priceOracleParams.pkpId = (0, mainnet_validator_wallets_1.resolveMainnetValidatorWallet)({
28488
+ registryKey: "priceOracle",
28489
+ chainId: Number(this.config.chainId),
28490
+ wallet: resolvedPkpId
28491
+ });
28335
28492
  }
28336
28493
  if (this.config.debug) {
28337
28494
  console.log("\u{1F4B0} Calling Price Oracle LIT Action:");
@@ -40556,7 +40713,7 @@ var require_dist3 = __commonJS({
40556
40713
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
40557
40714
  };
40558
40715
  Object.defineProperty(exports2, "__esModule", { value: true });
40559
- exports2.default = exports2.broadcastSignedBitcoinTransaction = exports2.convertEthereumSignatureToBitcoinDER = exports2.CORE_API_TRANSPORT_FAILURE_MARKER = exports2.isCoreApiTransportError = exports2.describeErrorWithCause = exports2.normalizeCoreLitActionResult = exports2.executeLitActionViaCoreApi = exports2.fetchLitActionCodeFromIpfs = exports2.redactPositionIdForLog = exports2.asyncRequest = exports2.TaskQueue = exports2.TicketManager = exports2.PKPSigner = exports2.PKPAuthorizerUtils = exports2.PKPAuthorizer = exports2.PKPMinterUtils = exports2.PKPMinter = exports2.PKPManager = exports2.LitActionExecutor = exports2.LitAuthManager = exports2.LitOps = exports2.cidToHex = exports2.getDeploymentsForNetwork = void 0;
40716
+ exports2.default = exports2.broadcastSignedBitcoinTransaction = exports2.convertEthereumSignatureToBitcoinDER = exports2.CORE_API_TRANSPORT_FAILURE_MARKER = exports2.isCoreApiTransportError = exports2.describeErrorWithCause = exports2.normalizeCoreLitActionResult = exports2.executeLitActionViaCoreApi = exports2.fetchLitActionCodeFromIpfs = exports2.redactPositionIdForLog = exports2.asyncRequest = exports2.TaskQueue = exports2.TicketManager = exports2.PKPSigner = exports2.PKPAuthorizerUtils = exports2.PKPAuthorizer = exports2.PKPMinterUtils = exports2.PKPMinter = exports2.PKPManager = exports2.LitActionExecutor = exports2.LitAuthManager = exports2.resolveMainnetValidatorWallet = exports2.LitOps = exports2.cidToHex = exports2.getDeploymentsForNetwork = void 0;
40560
40717
  __exportStar(require_interfaces(), exports2);
40561
40718
  var dh_lit_actions_1 = require_pkg_src();
40562
40719
  Object.defineProperty(exports2, "getDeploymentsForNetwork", { enumerable: true, get: function() {
@@ -40569,6 +40726,10 @@ var require_dist3 = __commonJS({
40569
40726
  Object.defineProperty(exports2, "LitOps", { enumerable: true, get: function() {
40570
40727
  return lit_ops_module_1.LitOps;
40571
40728
  } });
40729
+ var mainnet_validator_wallets_1 = require_mainnet_validator_wallets();
40730
+ Object.defineProperty(exports2, "resolveMainnetValidatorWallet", { enumerable: true, get: function() {
40731
+ return mainnet_validator_wallets_1.resolveMainnetValidatorWallet;
40732
+ } });
40572
40733
  var auth_manager_module_1 = require_auth_manager_module();
40573
40734
  Object.defineProperty(exports2, "LitAuthManager", { enumerable: true, get: function() {
40574
40735
  return auth_manager_module_1.LitAuthManager;
@@ -40925,6 +41086,7 @@ function renderLandingPage(input) {
40925
41086
 
40926
41087
  // src/util/page-headers.ts
40927
41088
  var import_node_crypto = require("crypto");
41089
+ var STRICT_TRANSPORT_SECURITY = { name: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" };
40928
41090
  function htmlPageSecurityHeaders(extra) {
40929
41091
  const nonce = (0, import_node_crypto.randomBytes)(16).toString("base64");
40930
41092
  const base = [
@@ -40952,7 +41114,7 @@ function htmlPageSecurityHeaders(extra) {
40952
41114
  }
40953
41115
 
40954
41116
  // src/version.ts
40955
- var SERVER_VERSION = "0.5.19";
41117
+ var SERVER_VERSION = "0.5.20";
40956
41118
 
40957
41119
  // src/connector/siwe-oauth.ts
40958
41120
  var import_node_crypto2 = require("crypto");
@@ -41162,6 +41324,7 @@ var SiweOAuthProvider = class {
41162
41324
  this.flows.set(flowId, { clientId: client.client_id, params, createdAt: this.clock() });
41163
41325
  const page = htmlPageSecurityHeaders();
41164
41326
  for (const [name, value] of Object.entries(page.headers)) res.setHeader(name, value);
41327
+ res.setHeader(STRICT_TRANSPORT_SECURITY.name, STRICT_TRANSPORT_SECURITY.value);
41165
41328
  res.status(200).type("html").send(
41166
41329
  renderSiwePage({
41167
41330
  flowId,
@@ -41762,8 +41925,13 @@ function iso(sec) {
41762
41925
  return new Date(sec * 1e3).toISOString();
41763
41926
  }
41764
41927
  var PSM_FLOOR_TOLERANCE_BPS = 100;
41928
+ var CANONICAL_MAINNET_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
41929
+ function stablecoinKindFor(network, stablecoinAddress) {
41930
+ if (network !== "mainnet") return "mock";
41931
+ return stablecoinAddress.toLowerCase() === CANONICAL_MAINNET_USDC.toLowerCase() ? "circle" : "onchain";
41932
+ }
41765
41933
  function failureToError(f) {
41766
- const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
41934
+ const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "unsupported" ? "NOT_IMPLEMENTED" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
41767
41935
  const message = f.kind === "malformed" ? `${f.message} (upstream response failed integrity checks)` : f.message;
41768
41936
  return boundaryError(code, message, {
41769
41937
  source: f.source,
@@ -42239,7 +42407,7 @@ var BoundaryCore = class {
42239
42407
  tokenAddress: a.tokenAddress,
42240
42408
  spenderAddress: a.spenderAddress,
42241
42409
  spenderContract: a.spenderContract,
42242
- spenderReason: a.spenderContract === "SimplePSMV2" ? "the PSM contract itself pulls the USDC it converts (transferFrom), so the USDC allowance goes to the PSM" : "the PSM burns your UCD THROUGH the UCDController (controller.burnFromPsm), so the UCD allowance goes to the UCDController \u2014 a different contract than the PSM, by design",
42410
+ spenderReason: a.spenderContract === "SimplePSMV2" ? `the PSM contract itself pulls the ${a.tokenSymbol} it converts (transferFrom), so the ${a.tokenSymbol} allowance goes to the PSM` : "the PSM burns your UCD THROUGH the UCDController (controller.burnFromPsm), so the UCD allowance goes to the UCDController \u2014 a different contract than the PSM, by design",
42243
42411
  before: a.before,
42244
42412
  amountUnit: q.amountInUnit,
42245
42413
  basis: "approvals are planned against the allowance read before signing: none when it already covers the amount; an exact approve when it is 0; a partial allowance is reset to 0 first (some tokens refuse a non-zero \u2192 non-zero approve). Every approve is EXACTLY the input amount \u2014 never unlimited."
@@ -42298,9 +42466,10 @@ var BoundaryCore = class {
42298
42466
  chainId: this.deps.chainId,
42299
42467
  psmAddress: s.psmAddress,
42300
42468
  stablecoinAddress: s.stablecoinAddress,
42301
- // Only mainnet runs real Circle USDC; the mock world and sepolia both run a
42302
- // practice stablecoin with a public self-serve mint.
42303
- stablecoinKind: this.deps.network === "mainnet" ? "circle" : "mock",
42469
+ // Labelled by the ACTUAL coin, not the network (C-49): `circle` only for canonical
42470
+ // mainnet USDC, `mock` for the practice token, `onchain` for any other real coin
42471
+ // (e.g. mainnet USDT) — a USDT swap must never render as "real USDC".
42472
+ stablecoinKind: stablecoinKindFor(this.deps.network, s.stablecoinAddress),
42304
42473
  stablecoinSymbol: s.stablecoinSymbol,
42305
42474
  stablecoinDecimals: s.stablecoinDecimals,
42306
42475
  exchangeRate: s.exchangeRate,
@@ -45291,6 +45460,35 @@ var import_ethers10 = require("ethers");
45291
45460
  // src/boundary/upstream/shared/external-bridge/card.ts
45292
45461
  var import_ethers8 = require("ethers");
45293
45462
  init_tx_validator();
45463
+
45464
+ // src/boundary/upstream/shared/external-bridge/card-escape.ts
45465
+ var MAX_VALUE_CHARS = 200;
45466
+ function mustEscape(code) {
45467
+ if (code <= 31 || code === 127) return true;
45468
+ if (code >= 128 && code <= 159) return true;
45469
+ if (code === 8232 || code === 8233) return true;
45470
+ if (code >= 8234 && code <= 8238) return true;
45471
+ if (code >= 8294 && code <= 8297) return true;
45472
+ return false;
45473
+ }
45474
+ function safeValue(raw) {
45475
+ let out = "";
45476
+ for (const ch of String(raw)) {
45477
+ const code = ch.codePointAt(0);
45478
+ out += mustEscape(code) ? `\\u${code.toString(16).padStart(4, "0")}` : ch;
45479
+ if (out.length > MAX_VALUE_CHARS) return `${out.slice(0, MAX_VALUE_CHARS)}\u2026[truncated]`;
45480
+ }
45481
+ return out;
45482
+ }
45483
+
45484
+ // src/boundary/upstream/shared/external-bridge/card.ts
45485
+ function formatBtc(sats) {
45486
+ const negative = sats < 0n;
45487
+ const abs = negative ? -sats : sats;
45488
+ const whole = abs / 10n ** 8n;
45489
+ const frac = (abs % 10n ** 8n).toString().padStart(8, "0").replace(/0+$/, "");
45490
+ return `${negative ? "-" : ""}${whole}${frac ? "." + frac : ""}`;
45491
+ }
45294
45492
  function formatUcd(wei) {
45295
45493
  const negative = wei < 0n;
45296
45494
  const abs = negative ? -wei : wei;
@@ -45336,15 +45534,15 @@ function cardForTx(tx2) {
45336
45534
  "Operation: create a new borrowing position (your wallet is the borrower)",
45337
45535
  `Term: ${Number(args[4])} months`,
45338
45536
  `Position key (PKP id): ${String(args[0])}`,
45339
- `BTC vault (mainnet form): ${String(args[2])}`,
45340
- `BTC vault (regtest form): ${String(args[3])}`,
45537
+ `BTC vault (mainnet form): ${safeValue(args[2])}`,
45538
+ `BTC vault (regtest form): ${safeValue(args[3])}`,
45341
45539
  `Validator generation: ${Number(args[5])}`,
45342
45540
  ...head
45343
45541
  ];
45344
45542
  case "addAddress":
45345
45543
  return [
45346
45544
  "Operation: allowlist a Bitcoin withdrawal destination for YOUR account",
45347
- `BTC address to allowlist: ${String(args[0])}`,
45545
+ `BTC address to allowlist: ${safeValue(args[0])}`,
45348
45546
  "Withdrawals to this address become possible only after the registry's on-chain delay",
45349
45547
  ...head
45350
45548
  ];
@@ -45372,15 +45570,40 @@ function cardForTx(tx2) {
45372
45570
  `Minimum stablecoin out \u2014 the slippage floor (smallest units): ${String(args[2])}`,
45373
45571
  ...head
45374
45572
  ];
45573
+ case "withdrawBTC": {
45574
+ const p = args[0];
45575
+ return [
45576
+ "Operation: withdraw BTC from your vault \u2014 THIS MOVES BITCOIN OUT",
45577
+ `Position: ${safeValue(p.positionId)}`,
45578
+ // The destination is the whole security question of this card. It is a caller-
45579
+ // supplied string, hence safeValue: see the escaping note above.
45580
+ `BTC sent to: ${safeValue(p.withdrawalAddress)}`,
45581
+ `Leaves the vault (fee included): ${formatBtc(BigInt(p.totalDeduction))} BTC (${BigInt(p.totalDeduction)} sats)`,
45582
+ `Collateral remaining after this: ${formatBtc(BigInt(p.newCollateral))} BTC (${BigInt(p.newCollateral)} sats)`,
45583
+ `Spending vault UTXO: ${safeValue(p.utxoTxid)}:${Number(p.utxoVout)}`,
45584
+ ...head
45585
+ ];
45586
+ }
45587
+ case "setPositionDelegate":
45588
+ return [
45589
+ "Operation: set the DELEGATE for this position \u2014 this address may act on the position on your behalf",
45590
+ `Position: ${safeValue(args[0])}`,
45591
+ `Delegate address: ${safeValue(args[1])}`,
45592
+ "Setting the zero address removes the current delegate",
45593
+ ...head
45594
+ ];
45375
45595
  default:
45376
- return [`Operation: ${name}`, ...args.map((a, i) => `arg[${i}]: ${String(a)}`), ...head];
45596
+ throw new Error(
45597
+ `no approval card is defined for the signable function "${name}" \u2014 add a case to cardForTx before this operation can be approved`
45598
+ );
45377
45599
  }
45378
45600
  }
45379
45601
  function cardForTypedData(action, payload) {
45380
45602
  const m = payload.message;
45381
45603
  return [
45382
45604
  `Operation: ${action} \u2014 this signature AUTHORIZES the operation described below; the protocol executes it after your approval`,
45383
- ...Object.entries(m).map(([k, v]) => `${k}: ${String(v)}`),
45605
+ // `detail` here is a server-composed string — same escaping rule as the tx card.
45606
+ ...Object.entries(m).map(([k, v]) => `${safeValue(k)}: ${safeValue(v)}`),
45384
45607
  `Signing domain: ${String(payload.domain["name"])} v${String(payload.domain["version"])} \xB7 chain ${String(payload.domain["chainId"])}`
45385
45608
  ];
45386
45609
  }
@@ -45731,12 +45954,10 @@ init_tx_validator();
45731
45954
 
45732
45955
  // src/boundary/upstream/shared/quantum.ts
45733
45956
  var QUANTUM_WINDOW_SECONDS = 60;
45734
- var AUTH_VALIDITY_WINDOWS = 3;
45735
- function authValiditySec() {
45736
- return QUANTUM_WINDOW_SECONDS * AUTH_VALIDITY_WINDOWS;
45737
- }
45738
45957
  function isAuthFresh(issuedAtSec, nowSec) {
45739
- return issuedAtSec <= nowSec && nowSec - issuedAtSec < authValiditySec();
45958
+ const sq = Math.floor(issuedAtSec / QUANTUM_WINDOW_SECONDS) * QUANTUM_WINDOW_SECONDS;
45959
+ const cq = Math.floor(nowSec / QUANTUM_WINDOW_SECONDS) * QUANTUM_WINDOW_SECONDS;
45960
+ return sq === cq - QUANTUM_WINDOW_SECONDS || sq === cq || sq === cq + QUANTUM_WINDOW_SECONDS;
45740
45961
  }
45741
45962
  function isStrictCurrentQuantum(issuedAtSec, nowSec) {
45742
45963
  return issuedAtSec <= nowSec && Math.floor(issuedAtSec / QUANTUM_WINDOW_SECONDS) === Math.floor(nowSec / QUANTUM_WINDOW_SECONDS);
@@ -45777,7 +45998,7 @@ var SafeCeremony = class {
45777
45998
  if (!auth.ok) return auth.refusal;
45778
45999
  if (!isAuthFresh(issuedAtSec, surface.nowSec())) {
45779
46000
  return this.refuse(
45780
- `${p.action}: the owners' authorization expired \u2014 issued in a past quantum window (validity ${3 * QUANTUM_WINDOW_SECONDS}s); gather the owners and sign again`
46001
+ `${p.action}: the owners' authorization expired \u2014 issued outside the past/current/next quantum window (${QUANTUM_WINDOW_SECONDS}s quanta); gather the owners and sign again`
45781
46002
  );
45782
46003
  }
45783
46004
  const raw = await executor.signTransaction({
@@ -52496,7 +52717,6 @@ var init_deployment_addresses = __esm2({
52496
52717
  PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
52497
52718
  FeeRecipientRegistry: "0x95795F8403DDb629E8527B2934C4e71f5fC0C374",
52498
52719
  BitcoinWithdrawalAddressRegistry: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
52499
- CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
52500
52720
  AgentDelegationRegistry: "0x6AE7fc6bE0925126b9D25b1B7Ce5AD5d127ec025",
52501
52721
  DHAgentDelegate: "0xa5A14489ae883960df6E1463A41a47aBE9Ecc5AF",
52502
52722
  AgentModuleFactory: "0x1Fd3aCa2C030Cf77ce28Af9694D3Bb3034ACa2E5"
@@ -52766,8 +52986,6 @@ var init_deployment_addresses = __esm2({
52766
52986
  OPERATION_AUTHORIZATION_REGISTRY_IMPL: "0xe0D981B60351f0f8fFDA2b50C8180Fb37CeF3883",
52767
52987
  BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
52768
52988
  BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY_IMPL: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
52769
- CARRY_AGENT_REGISTRY: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
52770
- CARRY_AGENT_REGISTRY_IMPL: "0x1b11a3D5e46F3672E643c997f0d569DFf0b64a01",
52771
52989
  AGENT_DELEGATION_REGISTRY: "0x6AE7fc6bE0925126b9D25b1B7Ce5AD5d127ec025",
52772
52990
  AGENT_DELEGATION_REGISTRY_IMPL: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
52773
52991
  DH_AGENT_DELEGATE: "0xa5A14489ae883960df6E1463A41a47aBE9Ecc5AF"
@@ -52799,7 +53017,6 @@ var init_deployment_addresses = __esm2({
52799
53017
  PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
52800
53018
  FeeRecipientRegistry: "0x95795F8403DDb629E8527B2934C4e71f5fC0C374",
52801
53019
  BitcoinWithdrawalAddressRegistry: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
52802
- CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
52803
53020
  AgentDelegationRegistry: "0x6AE7fc6bE0925126b9D25b1B7Ce5AD5d127ec025",
52804
53021
  DHAgentDelegate: "0xa5A14489ae883960df6E1463A41a47aBE9Ecc5AF",
52805
53022
  AgentModuleFactory: "0x1Fd3aCa2C030Cf77ce28Af9694D3Bb3034ACa2E5"
@@ -53774,113 +53991,113 @@ var require_pkg_src2 = __commonJS2({
53774
53991
  deployedAt: 1784569687492,
53775
53992
  size: 4140,
53776
53993
  hash: "4c0d65bf1f33cdac22a78fd8c4764319cc3fe00650e0fe7fa8a6090d9a318a7b",
53777
- validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
53994
+ validatorWalletAddress: "0xefb258d455a31d061bbeb3de3d2143bdfcb67a6c",
53778
53995
  pkp: {
53779
53996
  publicKey: "0x04ec0e3acc40884e3f366ca469d08899eb640ad5259fa196b0238075086208a9f8732a3175704f35f0bcc28e07406cfb24c254efd1e7355640577330f0d2dd755f",
53780
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
53997
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53781
53998
  }
53782
53999
  },
53783
54000
  btcTransactionSigner: {
53784
- cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
54001
+ cid: "QmULkz7hwwqsyLwY23U14dnartdVuSNMrykt69PaNiAq7U",
53785
54002
  authorizedCidHex: cidToHex(
53786
- "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
54003
+ "QmULkz7hwwqsyLwY23U14dnartdVuSNMrykt69PaNiAq7U"
53787
54004
  ),
53788
54005
  name: "Btc Transaction Signer",
53789
54006
  description: "Production Btc Transaction Signer",
53790
54007
  version: "1.1.1",
53791
54008
  deployed: true,
53792
- deployedAt: 1787923905597,
53793
- size: 70646,
53794
- hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
54009
+ deployedAt: 1790246185256,
54010
+ size: 73313,
54011
+ hash: "d8b6bc646ba33fee7d46c8e9b281de776081ea6f182f56fd15d4c52aaf3dd030"
53795
54012
  },
53796
54013
  ucdMintValidator: {
53797
- cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
54014
+ cid: "QmcxVSn9saEPGBS6mqPhNefgW83V2qeZjjXbhwYLP373xe",
53798
54015
  authorizedCidHex: cidToHex(
53799
- "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
54016
+ "QmcxVSn9saEPGBS6mqPhNefgW83V2qeZjjXbhwYLP373xe"
53800
54017
  ),
53801
54018
  name: "Ucd Mint Validator",
53802
54019
  description: "Production Ucd Mint Validator",
53803
- version: "1.2.1",
54020
+ version: "1.3.0",
53804
54021
  deployed: true,
53805
- deployedAt: 1787923919527,
53806
- size: 86197,
53807
- hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
53808
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54022
+ deployedAt: 1790246219868,
54023
+ size: 90022,
54024
+ hash: "65e8cb778c2b767ae6eb37cb5db7b4c5a3f2468d508463c847c83c1b6825fadd",
54025
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53809
54026
  pkp: {
53810
54027
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
53811
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54028
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53812
54029
  }
53813
54030
  },
53814
54031
  processPaymentValidator: {
53815
- cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
54032
+ cid: "QmWFbxJkfxhCtES4wrePWQkYtjhtrP1tohvn9d1r9N5Hd8",
53816
54033
  authorizedCidHex: cidToHex(
53817
- "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
54034
+ "QmWFbxJkfxhCtES4wrePWQkYtjhtrP1tohvn9d1r9N5Hd8"
53818
54035
  ),
53819
54036
  name: "Process Payment Validator",
53820
54037
  description: "Production Process Payment Validator",
53821
54038
  version: "1.2.1",
53822
54039
  deployed: true,
53823
- deployedAt: 1787923987153,
53824
- size: 82217,
53825
- hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
53826
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54040
+ deployedAt: 1790246225795,
54041
+ size: 85107,
54042
+ hash: "25ecf952c4c44c40b0920b92d57906e7010ed9a38e2ba41ccdee6d3377c2b596",
54043
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53827
54044
  pkp: {
53828
54045
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
53829
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54046
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53830
54047
  }
53831
54048
  },
53832
54049
  extendPositionValidator: {
53833
- cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
54050
+ cid: "QmZ3g7g5DkgU1gEYpFjprQf3sctUHtGjNQVYezw2bnPGEX",
53834
54051
  authorizedCidHex: cidToHex(
53835
- "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
54052
+ "QmZ3g7g5DkgU1gEYpFjprQf3sctUHtGjNQVYezw2bnPGEX"
53836
54053
  ),
53837
54054
  name: "Extend Position Validator",
53838
54055
  description: "Production Extend Position Validator",
53839
54056
  version: "1.2.1",
53840
54057
  deployed: true,
53841
- deployedAt: 1787923999294,
53842
- size: 79975,
53843
- hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
53844
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54058
+ deployedAt: 1790246231975,
54059
+ size: 82853,
54060
+ hash: "25d4887b7f646649db2bb7f2bfb77d039db83228a6c454377ca26c779b0903cc",
54061
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53845
54062
  pkp: {
53846
54063
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
53847
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54064
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53848
54065
  }
53849
54066
  },
53850
54067
  btcWithdrawal: {
53851
- cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
54068
+ cid: "QmbRaaMQr1jCctDGe8mPADsUz1rkb4frT1YqSKroiXjzyP",
53852
54069
  authorizedCidHex: cidToHex(
53853
- "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
54070
+ "QmbRaaMQr1jCctDGe8mPADsUz1rkb4frT1YqSKroiXjzyP"
53854
54071
  ),
53855
54072
  name: "Btc Withdrawal",
53856
54073
  description: "Production Btc Withdrawal",
53857
54074
  version: "1.2.7",
53858
54075
  deployed: true,
53859
- deployedAt: 1787924017769,
53860
- size: 100069,
53861
- hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
53862
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54076
+ deployedAt: 1790246239599,
54077
+ size: 101228,
54078
+ hash: "2ed25eca6cc80a43061b7ad119737af48158fdb61d59f10cd06cea51b607f112",
54079
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53863
54080
  pkp: {
53864
54081
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
53865
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54082
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53866
54083
  }
53867
54084
  },
53868
54085
  liquidationValidator: {
53869
- cid: "Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx",
54086
+ cid: "QmTs2w8gfAwWZLbzJZg2CZmiLhVXS5kbMgaj42Zuxfodpb",
53870
54087
  authorizedCidHex: cidToHex(
53871
- "Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx"
54088
+ "QmTs2w8gfAwWZLbzJZg2CZmiLhVXS5kbMgaj42Zuxfodpb"
53872
54089
  ),
53873
54090
  name: "Liquidation Validator",
53874
54091
  description: "Production Liquidation Validator",
53875
54092
  version: "1.2.1",
53876
54093
  deployed: true,
53877
- deployedAt: 1785173262533,
53878
- size: 66846,
53879
- hash: "b35ee7706d733d625faa4dbe37f73c8e20f0c1befa897cd7875e827de52003de",
53880
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54094
+ deployedAt: 1790246247904,
54095
+ size: 70308,
54096
+ hash: "582ccf0ec7f715195e20fdc885996743cb42125b64173424e360ee63db62bbd8",
54097
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53881
54098
  pkp: {
53882
54099
  publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
53883
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54100
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53884
54101
  }
53885
54102
  },
53886
54103
  priceOracle: {
@@ -53895,28 +54112,28 @@ var require_pkg_src2 = __commonJS2({
53895
54112
  deployedAt: 1781116663270,
53896
54113
  size: 8695,
53897
54114
  hash: "ba20ade60a7fa5acd80dadfafa179c507388cfe6ce48a22a672d70b317ffcc74",
53898
- validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
54115
+ validatorWalletAddress: "0xefb258d455a31d061bbeb3de3d2143bdfcb67a6c",
53899
54116
  pkp: {
53900
54117
  publicKey: "0x043beaa1da47875601a8d6f430b1438ee2d4732eefd06e5c63a474bbdaf9e7df1797b1b951e041b627c2bf839788164825324c9cbd1e2d6f740fdd4bff69b1900b",
53901
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54118
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53902
54119
  }
53903
54120
  },
53904
54121
  loanVaultBtcBalance: {
53905
- cid: "QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4",
54122
+ cid: "QmZ27xCzuoaAhWxRsMPsUQkp45a8WPBb21uhxwchw3LG5W",
53906
54123
  authorizedCidHex: cidToHex(
53907
- "QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4"
54124
+ "QmZ27xCzuoaAhWxRsMPsUQkp45a8WPBb21uhxwchw3LG5W"
53908
54125
  ),
53909
54126
  name: "Loan Vault Btc Balance",
53910
54127
  description: "Production Loan Vault Btc Balance",
53911
54128
  version: "1.2.1",
53912
54129
  deployed: true,
53913
- deployedAt: 1785173271802,
53914
- size: 56800,
53915
- hash: "a059133214e6ba0a73d655a15600c4b33e361fb340c98f8eecaf8ab7b95aaf83",
53916
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54130
+ deployedAt: 1790179961079,
54131
+ size: 60046,
54132
+ hash: "922e86c0a667fe0c0945771f84aa6b9fe08be9c96dd2f73a9c5cb257d24e22b0",
54133
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53917
54134
  pkp: {
53918
54135
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
53919
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54136
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53920
54137
  }
53921
54138
  },
53922
54139
  // btc-address-balance (Option B) — address-only signed total balance via
@@ -53926,21 +54143,21 @@ var require_pkg_src2 = __commonJS2({
53926
54143
  // Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
53927
54144
  // on each target chain (the action decrypts registry slots). No OAR entry.
53928
54145
  btcAddressBalance: {
53929
- cid: "QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj",
54146
+ cid: "QmVVjB6zCBiXFKffhQPYUAZhj7TXduuvcrPqKtHa3DMXhN",
53930
54147
  authorizedCidHex: cidToHex(
53931
- "QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj"
54148
+ "QmVVjB6zCBiXFKffhQPYUAZhj7TXduuvcrPqKtHa3DMXhN"
53932
54149
  ),
53933
54150
  name: "Btc Address Balance",
53934
54151
  description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
53935
54152
  version: "0.2.1",
53936
54153
  deployed: true,
53937
- deployedAt: 1785173280221,
53938
- size: 27309,
53939
- hash: "f0d08938713d9d89a56a3a386cacbc2b57afd5ad367ea82d827d40e1bfc70989",
53940
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54154
+ deployedAt: 1790179971315,
54155
+ size: 30295,
54156
+ hash: "2c67d9cfa4d50e835fbb28ae50e80217ceb2be3bb862c89290aadf43fdc739c9",
54157
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53941
54158
  pkp: {
53942
54159
  publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
53943
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54160
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
53944
54161
  }
53945
54162
  },
53946
54163
  alwaysSigner: {
@@ -53970,48 +54187,48 @@ var require_pkg_src2 = __commonJS2({
53970
54187
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
53971
54188
  },
53972
54189
  agentModuleExecutor: {
53973
- cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
54190
+ cid: "QmSwPPvQhT7UhcuVA2m3UxGhVj5WqMpDvYNKU1228QLFsX",
53974
54191
  authorizedCidHex: cidToHex(
53975
- "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
54192
+ "QmSwPPvQhT7UhcuVA2m3UxGhVj5WqMpDvYNKU1228QLFsX"
53976
54193
  ),
53977
54194
  name: "Agent Module Executor",
53978
54195
  description: "Production Agent Module Executor",
53979
54196
  version: "1.1.1",
53980
54197
  deployed: true,
53981
- deployedAt: 1787924032013,
53982
- size: 13878,
53983
- hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
54198
+ deployedAt: 1790179978959,
54199
+ size: 14688,
54200
+ hash: "8edb9b12c784c8d7d153cce97235584c24665a788767ae68713dce91109ab35e"
53984
54201
  },
53985
54202
  staleSpendRecoveryValidator: {
53986
- cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
54203
+ cid: "Qmarj59zdSSgivkimryrdvnyZqH5YpTimKj1LivXNBHmNz",
53987
54204
  authorizedCidHex: cidToHex(
53988
- "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
54205
+ "Qmarj59zdSSgivkimryrdvnyZqH5YpTimKj1LivXNBHmNz"
53989
54206
  ),
53990
54207
  name: "Stale Spend Recovery Validator",
53991
54208
  description: "Production Stale Spend Recovery Validator",
53992
54209
  version: "1.1.2",
53993
54210
  deployed: true,
53994
- deployedAt: 1787924048772,
53995
- size: 41424,
53996
- hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
53997
- validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
54211
+ deployedAt: 1790246256280,
54212
+ size: 48143,
54213
+ hash: "ec9236bcbe0af24d3e1844791fc8fe37371bbecd8ce95d02e13f7c6e1fc7d94c",
54214
+ validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
53998
54215
  pkp: {
53999
54216
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
54000
- ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
54217
+ ethAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C"
54001
54218
  }
54002
54219
  },
54003
54220
  btcUtxoInvalidator: {
54004
- cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
54221
+ cid: "QmbS44bGcmKYF64Cu35qzsk9sxiU4Umde8Z3q24ZnEbQvX",
54005
54222
  authorizedCidHex: cidToHex(
54006
- "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
54223
+ "QmbS44bGcmKYF64Cu35qzsk9sxiU4Umde8Z3q24ZnEbQvX"
54007
54224
  ),
54008
54225
  name: "Btc Utxo Invalidator",
54009
54226
  description: "Production Btc Utxo Invalidator",
54010
54227
  version: "1.0.0",
54011
54228
  deployed: true,
54012
- deployedAt: 1787924133241,
54013
- size: 66026,
54014
- hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
54229
+ deployedAt: 1790246264563,
54230
+ size: 69219,
54231
+ hash: "bda048d8cd6b5a39c2774bcf1320e82d1eea935c2a521006fb8b887e13b6dd8d"
54015
54232
  }
54016
54233
  };
54017
54234
  function getDeploymentsForNetwork(network) {
@@ -54779,7 +54996,10 @@ ${errorReport}`);
54779
54996
  BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
54780
54997
  BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
54781
54998
  LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
54782
- PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
54999
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C",
55000
+ TermManagerModule: "0xDB99CdF883ffa38acD099bC39F8d1f4508c9239E",
55001
+ UCDController: "0x4b4f8063048bCD59D469219E3f07C6aaDF4f6157",
55002
+ LiquidationManagerModule: "0x74B28695352E7bf736D6c9F76ccb7B4439477De9"
54783
55003
  },
54784
55004
  11155111: {
54785
55005
  PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
@@ -54787,7 +55007,10 @@ ${errorReport}`);
54787
55007
  BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
54788
55008
  BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
54789
55009
  LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
54790
- PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
55010
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
55011
+ TermManagerModule: "0x94Adc6F9558368B1482197584f1fc7133Ecf835b",
55012
+ UCDController: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
55013
+ LiquidationManagerModule: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76"
54791
55014
  }
54792
55015
  };
54793
55016
  function getPinnedContractAddresses(chainId) {
@@ -54973,10 +55196,10 @@ ${errorReport}`);
54973
55196
  };
54974
55197
  }
54975
55198
  const ratioBigInt = collateralValueUsd * UCD_TOKEN_DECIMALS * 10000n / ucdDebt;
54976
- const collateralRatioBps = Number(ratioBigInt);
55199
+ const collateralRatioBps2 = Number(ratioBigInt);
54977
55200
  return {
54978
55201
  collateralValueUsd,
54979
- collateralRatioBps
55202
+ collateralRatioBps: collateralRatioBps2
54980
55203
  };
54981
55204
  }
54982
55205
  function hasSufficientCollateralForDebt(collateralValueUsd, currentDebt, additionalDebt, requiredRatioBps) {
@@ -55830,6 +56053,17 @@ ${auth.clientId}`;
55830
56053
  );
55831
56054
  }
55832
56055
  }
56056
+ var TIP_READ_FAILURE_PREFIX = "Bitcoin tip-height read failed";
56057
+ var BitcoinTipUnreadableError = class extends Error {
56058
+ constructor(message) {
56059
+ super(message);
56060
+ this.isBitcoinTipUnreadable = true;
56061
+ this.name = "BitcoinTipUnreadableError";
56062
+ }
56063
+ };
56064
+ function isBitcoinTipUnreadableError(error) {
56065
+ return typeof error === "object" && error !== null && error.isBitcoinTipUnreadable === true;
56066
+ }
55833
56067
  var BitcoinDataProvider = class {
55834
56068
  constructor(config) {
55835
56069
  this.config = config;
@@ -56281,27 +56515,12 @@ ${auth.clientId}`;
56281
56515
  if (!data.status.confirmed || !data.status.block_height) {
56282
56516
  return { txid: data.txid ?? txid, confirmations: 0 };
56283
56517
  }
56284
- try {
56285
- const tipResp = await fetch(
56286
- `${this.config.providerUrl}/blocks/tip/height`,
56287
- { signal: controller.signal, headers: await this.withAuth() }
56288
- );
56289
- if (!tipResp.ok) {
56290
- return { txid: data.txid ?? txid, confirmations: 1 };
56291
- }
56292
- const tipBody = (await tipResp.text()).trim();
56293
- const tipHeight = Number.parseInt(tipBody, 10);
56294
- if (!Number.isFinite(tipHeight) || tipHeight <= 0) {
56295
- return { txid: data.txid ?? txid, confirmations: 1 };
56296
- }
56297
- const depth = tipHeight - data.status.block_height + 1;
56298
- return {
56299
- txid: data.txid ?? txid,
56300
- confirmations: depth > 0 ? depth : 0
56301
- };
56302
- } catch {
56303
- return { txid: data.txid ?? txid, confirmations: 1 };
56304
- }
56518
+ const tipHeight = await this.fetchTipHeight(controller.signal);
56519
+ const depth = tipHeight - data.status.block_height + 1;
56520
+ return {
56521
+ txid: data.txid ?? txid,
56522
+ confirmations: depth > 0 ? depth : 0
56523
+ };
56305
56524
  }
56306
56525
  return null;
56307
56526
  } catch (error) {
@@ -56309,12 +56528,55 @@ ${auth.clientId}`;
56309
56528
  if (isAbortError(error)) {
56310
56529
  throw new Error(`Request timeout after ${this.timeout}ms`);
56311
56530
  }
56531
+ if (isBitcoinTipUnreadableError(error)) {
56532
+ throw error;
56533
+ }
56312
56534
  if (getUnknownErrorMessage(error).includes("404")) {
56313
56535
  return null;
56314
56536
  }
56315
56537
  throw error;
56316
56538
  }
56317
56539
  }
56540
+ /**
56541
+ * Current chain tip height from THIS provider — or throw.
56542
+ *
56543
+ * Every exit is a throw naming the provider and the precise failure, because
56544
+ * the only alternative is inventing a confirmation depth (see the call site).
56545
+ * The single `try` exists solely to attach that name to a transport-level
56546
+ * rejection (DNS, TLS, connection reset, abort); it re-throws the cause
56547
+ * verbatim inside the message and never substitutes a value — authorized for
56548
+ * this case by the Batch 2 plan, §C2.
56549
+ *
56550
+ * @param signal - The caller's AbortSignal, so this read shares the same
56551
+ * timeout budget as the transaction fetch it serves.
56552
+ */
56553
+ async fetchTipHeight(signal) {
56554
+ const endpoint = `${this.config.providerUrl}/blocks/tip/height`;
56555
+ let tipResp;
56556
+ try {
56557
+ tipResp = await fetch(endpoint, {
56558
+ signal,
56559
+ headers: await this.withAuth()
56560
+ });
56561
+ } catch (error) {
56562
+ throw new BitcoinTipUnreadableError(
56563
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} threw \u2014 ${getUnknownErrorMessage(error)}`
56564
+ );
56565
+ }
56566
+ if (!tipResp.ok) {
56567
+ throw new BitcoinTipUnreadableError(
56568
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} \u2192 ${tipResp.status} ${tipResp.statusText}`
56569
+ );
56570
+ }
56571
+ const tipBody = (await tipResp.text()).trim();
56572
+ const tipHeight = Number.parseInt(tipBody, 10);
56573
+ if (!Number.isFinite(tipHeight) || tipHeight <= 0) {
56574
+ throw new BitcoinTipUnreadableError(
56575
+ `${TIP_READ_FAILURE_PREFIX}: GET ${endpoint} returned an unusable tip height "${tipBody.slice(0, 64)}"`
56576
+ );
56577
+ }
56578
+ return tipHeight;
56579
+ }
56318
56580
  /**
56319
56581
  * Get outputs (vouts) of a Bitcoin transaction
56320
56582
  *
@@ -56952,10 +57214,13 @@ ${auth.clientId}`;
56952
57214
  * only on unanimity. The confirmed-balance consensus the validators run
56953
57215
  * covers `chain_stats` only, so without this the primary provider alone
56954
57216
  * could fabricate an unconfirmed UTXO plus a self-consistent parent proof
56955
- * and inflate the signed balance. Any provider failure or verdict
56956
- * disagreement THROWS (fail-closed) — exclusion on a suppressed proof
56957
- * would deflate the balance and open a wrongful-liquidation window, so
56958
- * neither direction may proceed without agreement.
57217
+ * and inflate the signed balance. Any verdict disagreement THROWS
57218
+ * (fail-closed) — exclusion on a suppressed proof would deflate the balance
57219
+ * and open a wrongful-liquidation window, so neither direction may proceed
57220
+ * without agreement. A provider that cannot state the chain tip — and only
57221
+ * that failure — is dropped from the quorum rather than aborting the read (it
57222
+ * never counts as agreeing), and falling below `minConsensusProviders`
57223
+ * survivors throws — see `verifyParentIsSelfSpendConsensus`.
56959
57224
  *
56960
57225
  * The same per-provider `/tx` fetch also returns the parent's outputs, and
56961
57226
  * every provider must corroborate each claimed UTXO (index, vault address,
@@ -57050,10 +57315,26 @@ ${auth.clientId}`;
57050
57315
  }
57051
57316
  /**
57052
57317
  * Run the self-spend proof against every configured provider and require
57053
- * unanimity. Fail-closed: a provider request failure or a verdict
57054
- * disagreement throws and aborts the balance calculation — see
57318
+ * unanimity AMONG THE PROVIDERS THAT ANSWERED. Fail-closed on disagreement:
57319
+ * a verdict mismatch throws and aborts the balance calculation — see
57055
57320
  * classifySelfChange for why exclusion is not a safe fallback here.
57056
57321
  *
57322
+ * Quorum semantics (2026-09-23, plan C2). ONE failure class is tolerated: a
57323
+ * provider that could not state the chain tip (`BitcoinTipUnreadableError`).
57324
+ * It is ABSENT from the quorum — never counted as agreeing, never allowed to
57325
+ * decide the verdict — and the policy floor, not "at least one", decides when
57326
+ * that absence is fatal: below `minConsensusProviders` surviving readings
57327
+ * there is no cross-check left to trust, and the read fails loudly naming
57328
+ * every provider that dropped out.
57329
+ *
57330
+ * Why only that class. `getTransaction` now throws on an unreadable tip
57331
+ * instead of fabricating `confirmations: 1`; without this carve-out one flaky
57332
+ * `/blocks/tip/height` endpoint would take every balance and spend path down
57333
+ * with it. Every OTHER failure remains fatal, as before: a provider that
57334
+ * answers "I have never seen that transaction" is making a claim about the
57335
+ * chain rather than suffering an outage, and that shape is precisely the
57336
+ * fabricated-UTXO signature the fail-closed rule exists to catch.
57337
+ *
57057
57338
  * When the parent IS a unanimous self-spend, every provider's view of the
57058
57339
  * parent's OUTPUTS must additionally corroborate the primary's claimed
57059
57340
  * UTXOs (index exists, pays the vault, exact value). Without this, a
@@ -57078,32 +57359,52 @@ ${auth.clientId}`;
57078
57359
  )
57079
57360
  )
57080
57361
  );
57081
- const failures = settled.map((r, i) => ({ r, name: providerName(i) })).filter(
57082
- (x) => x.r.status === "rejected"
57083
- ).map(
57084
- ({ r, name }) => `${name} \u2192 ${r.reason?.message ?? String(r.reason)}`
57085
- );
57362
+ const answered = [];
57363
+ const absences = [];
57364
+ const failures = [];
57365
+ settled.forEach((result, i) => {
57366
+ if (result.status === "fulfilled") {
57367
+ answered.push({ index: i, evaluation: result.value });
57368
+ return;
57369
+ }
57370
+ const described = `${providerName(i)} \u2192 ${result.reason?.message ?? String(result.reason)}`;
57371
+ if (isBitcoinTipUnreadableError(result.reason)) {
57372
+ absences.push(described);
57373
+ return;
57374
+ }
57375
+ failures.push(described);
57376
+ });
57086
57377
  if (failures.length > 0) {
57087
57378
  throw new Error(
57088
57379
  `Self-change classification failed for tx ${parentTxid} on ${failures.length}/${providerConfigs.length} provider(s): ${failures.join("; ")}`
57089
57380
  );
57090
57381
  }
57091
- const evaluations = settled.map(
57092
- (r) => r.value
57093
- );
57094
- const votes = evaluations.map((e) => e.selfSpend);
57095
- const disagreements = votes.map((vote, i) => ({ vote, name: providerName(i) })).filter((x) => x.vote !== votes[0]).map(
57096
- (x) => `${providerName(0)}=${votes[0]} vs ${x.name}=${x.vote}`
57382
+ const floor = Math.max(1, this.minConsensusProviders);
57383
+ if (answered.length < floor) {
57384
+ throw new Error(
57385
+ `Self-change classification for tx ${parentTxid}: only ${answered.length}/${providerConfigs.length} provider(s) could state a confirmation depth, below this chain's floor of ${floor}. Unreadable tips: ${absences.join("; ")}`
57386
+ );
57387
+ }
57388
+ if (absences.length > 0) {
57389
+ litDebugLog(
57390
+ `[VaultBalance] self-change: tx ${parentTxid} classified on a reduced quorum \u2014 ${answered.length}/${providerConfigs.length} provider(s) answered (floor ${floor}); dropped for an unreadable chain tip: ${absences.join("; ")}`
57391
+ );
57392
+ }
57393
+ const first = answered[0];
57394
+ const disagreements = answered.slice(1).filter((a) => a.evaluation.selfSpend !== first.evaluation.selfSpend).map(
57395
+ (a) => `${providerName(first.index)}=${first.evaluation.selfSpend} vs ${providerName(a.index)}=${a.evaluation.selfSpend}`
57097
57396
  );
57098
57397
  if (disagreements.length > 0) {
57099
57398
  throw new Error(
57100
57399
  `Self-change consensus mismatch for tx ${parentTxid}: ${disagreements.join("; ")}. A provider may be compromised or out of sync; refusing to sign.`
57101
57400
  );
57102
57401
  }
57103
- if (!votes[0]) {
57402
+ if (!first.evaluation.selfSpend) {
57104
57403
  return false;
57105
57404
  }
57106
- const outputMismatches = evaluations.map((e, i) => e.outputMismatch ? `${providerName(i)} \u2192 ${e.outputMismatch}` : null).filter((m) => m !== null);
57405
+ const outputMismatches = answered.map(
57406
+ (a) => a.evaluation.outputMismatch ? `${providerName(a.index)} \u2192 ${a.evaluation.outputMismatch}` : null
57407
+ ).filter((m) => m !== null);
57107
57408
  if (outputMismatches.length > 0) {
57108
57409
  throw new Error(
57109
57410
  `Self-change output claim mismatch for tx ${parentTxid}: ${outputMismatches.join("; ")}. The reported UTXO set contradicts the parent transaction; refusing to sign.`
@@ -57346,16 +57647,6 @@ ${auth.clientId}`;
57346
57647
  minConfirmations
57347
57648
  );
57348
57649
  const authorizedSpends = await this.getAuthorizedSpendsFromContract(positionId);
57349
- for (const spend of authorizedSpends) {
57350
- const utxoStillExists = utxoSet.utxos.some(
57351
- (utxo) => utxo.txid === spend.txid && utxo.vout === spend.vout
57352
- );
57353
- if (utxoStillExists) {
57354
- throw new Error(
57355
- `Authorized UTXO ${spend.txid}:${spend.vout} not yet spent. Transaction was authorized in smart contract but not signed and broadcasted to Bitcoin network. Complete the transaction by signing and broadcasting it.`
57356
- );
57357
- }
57358
- }
57359
57650
  const authorizedBalance = authorizedSpends.reduce(
57360
57651
  (sum, spend) => sum + spend.satoshis,
57361
57652
  0n
@@ -57651,7 +57942,13 @@ ${auth.clientId}`;
57651
57942
  allowDevSinglePriceProvider: false,
57652
57943
  minBitcoinBalanceConfirmations: 1,
57653
57944
  minBitcoinSpendConfirmations: 1,
57654
- minConsensusProviders: 1
57945
+ // 2 since 2026-09-23. It was 1 because Sepolia ran a single faucet provider
57946
+ // "by design", so the consensus floor was documented as a mainnet-only
57947
+ // guarantee. The registry now holds two, and leaving the floor at 1 meant
57948
+ // Sepolia could never exercise the multi-provider agreement the stale-spend
57949
+ // and balance paths rely on — the one environment where that logic is
57950
+ // supposed to be proved before mainnet.
57951
+ minConsensusProviders: 2
57655
57952
  },
57656
57953
  [
57657
57954
  "ethereum"
@@ -57960,7 +58257,6 @@ function getSepoliaConfig() {
57960
58257
  feeRecipientRegistry: SEPOLIA_CONTRACTS.FeeRecipientRegistry || "",
57961
58258
  positionDelegateRegistry: SEPOLIA_CONTRACTS.PositionDelegateRegistry || "",
57962
58259
  bitcoinWithdrawalAddressRegistry: SEPOLIA_CONTRACTS.BitcoinWithdrawalAddressRegistry || "",
57963
- carryAgentRegistry: SEPOLIA_CONTRACTS.CarryAgentRegistry || "",
57964
58260
  agentDelegationRegistry: SEPOLIA_CONTRACTS.AgentDelegationRegistry || "",
57965
58261
  dhAgentDelegate: SEPOLIA_CONTRACTS.DHAgentDelegate || "",
57966
58262
  agentModuleFactory: SEPOLIA_CONTRACTS.AgentModuleFactory || ""
@@ -58014,7 +58310,6 @@ function getMainnetConfig() {
58014
58310
  feeRecipientRegistry: MAINNET_CONTRACTS.FeeRecipientRegistry || "",
58015
58311
  positionDelegateRegistry: MAINNET_CONTRACTS.PositionDelegateRegistry || "",
58016
58312
  bitcoinWithdrawalAddressRegistry: MAINNET_CONTRACTS.BitcoinWithdrawalAddressRegistry || "",
58017
- carryAgentRegistry: MAINNET_CONTRACTS.CarryAgentRegistry || "",
58018
58313
  agentDelegationRegistry: MAINNET_CONTRACTS.AgentDelegationRegistry || "",
58019
58314
  dhAgentDelegate: MAINNET_CONTRACTS.DHAgentDelegate || "",
58020
58315
  // Empty on mainnet until the factory is deployed there — the ceremony is Sepolia-only.
@@ -59087,6 +59382,51 @@ async function resolveAuthorizationInput(provider, signer, ctx) {
59087
59382
  }
59088
59383
  return { timestamp: result.timestamp, signature: result.signature };
59089
59384
  }
59385
+ var BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
59386
+ function segwitProgramShape(address) {
59387
+ const lower2 = address.trim().toLowerCase();
59388
+ if (!/^(bc1|tb1|bcrt1)/.test(lower2))
59389
+ return null;
59390
+ const sep = lower2.lastIndexOf("1");
59391
+ const data = lower2.slice(sep + 1);
59392
+ if (data.length < 8)
59393
+ return null;
59394
+ const version2 = BECH32_CHARSET.indexOf(data[0]);
59395
+ if (version2 < 0)
59396
+ return null;
59397
+ const programChars = data.length - 1 - 6;
59398
+ return { version: version2, programBytes: Math.floor(programChars * 5 / 8) };
59399
+ }
59400
+ function dustLimitForAddress(address) {
59401
+ const shape = segwitProgramShape(address);
59402
+ if (shape === null)
59403
+ return 546;
59404
+ if (shape.version === 0 && shape.programBytes === 20)
59405
+ return 294;
59406
+ if (shape.version === 0 && shape.programBytes === 32)
59407
+ return 330;
59408
+ if (shape.version === 1 && shape.programBytes === 32)
59409
+ return 330;
59410
+ return 546;
59411
+ }
59412
+ function destinationDustShortfall(targetAmount, networkFee, destination) {
59413
+ const limit = dustLimitForAddress(destination);
59414
+ return targetAmount - networkFee < limit ? limit : null;
59415
+ }
59416
+ function calculateMintFee(params) {
59417
+ const { mintAmount, mintTimestamp, originationFeeBps, previousExpiryAt, selectedTerm, totalTerm } = params;
59418
+ let mintFee = mintAmount * BigInt(originationFeeBps) / 10000n;
59419
+ if (previousExpiryAt > 0 && mintTimestamp < previousExpiryAt) {
59420
+ const tailSeconds = BigInt(previousExpiryAt) - BigInt(mintTimestamp);
59421
+ const originalTermMonths = totalTerm - selectedTerm;
59422
+ const originalTermSeconds = BigInt(
59423
+ originalTermMonths === 12 ? 365 * 86400 : originalTermMonths * 30 * 86400
59424
+ );
59425
+ const tailFee = tailSeconds * BigInt(originationFeeBps) * mintAmount / (10000n * originalTermSeconds);
59426
+ mintFee = mintFee + tailFee;
59427
+ }
59428
+ return mintFee;
59429
+ }
59090
59430
  function baseMintFeeWei(mintAmountWei, originationFeeBps) {
59091
59431
  if (mintAmountWei < 0n)
59092
59432
  throw new Error("baseMintFeeWei: mintAmountWei cannot be negative");
@@ -59105,20 +59445,34 @@ function debtAfterMintExceedsLoanCap(params) {
59105
59445
  }
59106
59446
  return currentDebtWei + mintAmountWei + mintFeeWei > maxLoanWei;
59107
59447
  }
59108
- function maxPrincipalWithinLoanCap(params) {
59109
- const { maxLoanWei, currentDebtWei, originationFeeBps } = params;
59110
- if (maxLoanWei < 0n || currentDebtWei < 0n) {
59111
- throw new Error("maxPrincipalWithinLoanCap: amounts cannot be negative");
59448
+ function collateralRatioBps(sats, price8, debtWei) {
59449
+ if (sats < 0n || price8 < 0n) {
59450
+ throw new Error("collateralRatioBps: sats and price cannot be negative");
59112
59451
  }
59113
- if (!Number.isInteger(originationFeeBps) || originationFeeBps < 0 || originationFeeBps > 1e4) {
59114
- throw new Error(
59115
- `maxPrincipalWithinLoanCap: originationFeeBps must be an integer in [0, 10000] (got ${String(originationFeeBps)})`
59116
- );
59452
+ if (debtWei <= 0n) {
59453
+ throw new Error("collateralRatioBps: debt must be positive");
59117
59454
  }
59118
- const room = maxLoanWei - currentDebtWei;
59119
- if (room <= 0n)
59120
- return 0n;
59121
- return room * 10000n / (10000n + BigInt(originationFeeBps));
59455
+ return sats * price8 * 100n * 10000n / debtWei;
59456
+ }
59457
+ function collateralRatioPercentString(sats, price8, debtWei) {
59458
+ const bps = collateralRatioBps(sats, price8, debtWei);
59459
+ return `${bps / 100n}.${(bps % 100n).toString().padStart(2, "0")}`;
59460
+ }
59461
+ function maxPrincipalForFee(room, fee) {
59462
+ if (room < 0n)
59463
+ throw new Error("maxPrincipalForFee: room cannot be negative");
59464
+ if (fee(0n) !== 0n)
59465
+ throw new Error("maxPrincipalForFee: fee(0) must be 0");
59466
+ let lo = 0n;
59467
+ let hi = room;
59468
+ while (lo < hi) {
59469
+ const mid = (lo + hi + 1n) / 2n;
59470
+ if (mid + fee(mid) <= room)
59471
+ lo = mid;
59472
+ else
59473
+ hi = mid - 1n;
59474
+ }
59475
+ return lo;
59122
59476
  }
59123
59477
  function buildLoginDomain(chainId) {
59124
59478
  return {
@@ -71281,9 +71635,17 @@ async function mintAgentPkp(params) {
71281
71635
  }
71282
71636
  var AGENT_STATUS = { None: 0, Active: 1, Revoked: 2 };
71283
71637
  function planAgentBinding(params) {
71284
- const { isActive, record, nowSeconds } = params;
71638
+ const { isActive, paused, record, nowSeconds } = params;
71639
+ if (typeof paused !== "boolean") {
71640
+ throw new Error("planAgentBinding: `paused` must be read from the registry (boolean required)");
71641
+ }
71285
71642
  if (isActive)
71286
71643
  return { kind: "reuse", agent: record.agent };
71644
+ if (paused) {
71645
+ throw new Error(
71646
+ "AgentDelegationRegistry is paused \u2014 agent delegation cannot be changed until it is unpaused."
71647
+ );
71648
+ }
71287
71649
  const status = Number(record.status);
71288
71650
  if (status === AGENT_STATUS.None || status === AGENT_STATUS.Revoked) {
71289
71651
  return { kind: "register" };
@@ -71293,7 +71655,7 @@ function planAgentBinding(params) {
71293
71655
  }
71294
71656
  if (Number(record.validUntil) > nowSeconds) {
71295
71657
  throw new Error(
71296
- "AgentDelegationRegistry reports an unexpired agent as inactive \u2014 the registry is paused. Agent delegation cannot be changed until it is unpaused."
71658
+ "AgentDelegationRegistry returned an inconsistent read (an unexpired, unpaused Active agent reported inactive); retry."
71297
71659
  );
71298
71660
  }
71299
71661
  return { kind: "rotate" };
@@ -72462,7 +72824,7 @@ function normalizeBigNumberish(value) {
72462
72824
  }
72463
72825
  return value;
72464
72826
  }
72465
- if (typeof value === "object" && value !== null && "toString" in value && typeof value.toString === "function") {
72827
+ if (typeof value === "object" && value !== null && "toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
72466
72828
  const result = value.toString();
72467
72829
  if (typeof result === "object" && result !== null && "_hex" in result) {
72468
72830
  const resultObj = result;
@@ -73884,12 +74246,21 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
73884
74246
  maxLoanWei: maxLoanValueWei
73885
74247
  })) {
73886
74248
  const debtAfterWei = currentDebtWei + requestAmountWei + baseFeeWei;
74249
+ const suggestionStamp = calculateNextQuantumTimestamp();
74250
+ const room = maxLoanValueWei > currentDebtWei ? maxLoanValueWei - currentDebtWei : 0n;
73887
74251
  const maxPrincipalUcd = Number(
73888
- maxPrincipalWithinLoanCap({
73889
- maxLoanWei: maxLoanValueWei,
73890
- currentDebtWei,
73891
- originationFeeBps: positionTerm.originationFeeBps
73892
- }) / BigInt(10 ** 18)
74252
+ maxPrincipalForFee(
74253
+ room,
74254
+ (principal) => calculateMintFee({
74255
+ mintAmount: principal,
74256
+ mintTimestamp: suggestionStamp,
74257
+ originationFeeBps: positionTerm.originationFeeBps,
74258
+ expiryAt: Number(position2.expiryAt),
74259
+ previousExpiryAt: Number(position2.previousExpiryAt),
74260
+ selectedTerm: Number(position2.selectedTerm),
74261
+ totalTerm: Number(position2.totalTerm)
74262
+ })
74263
+ ) / BigInt(10 ** 18)
73893
74264
  );
73894
74265
  return {
73895
74266
  success: false,
@@ -74967,11 +75338,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
74967
75338
  const debt = positionDetails.debt || positionDetails.ucdDebt || "0";
74968
75339
  const btcPrice2 = litActionResult.btcPrice || "0";
74969
75340
  const btcVaultBalance = litActionResult.btcAmountSats || positionDetails.btcVaultBalance || "0";
74970
- const usdPricePerBTC = Number(btcPrice2) / 1e8;
74971
- const btcAmount = Number(btcVaultBalance) / 1e8;
74972
- const btcValueUSD = btcAmount * usdPricePerBTC;
74973
- const debtUSD = Number(debt) / 1e18;
74974
- const ratio = debtUSD > 0 ? (btcValueUSD / debtUSD * 100).toFixed(2) : "0.00";
75341
+ const ratio = BigInt(debt) > 0n ? collateralRatioPercentString(BigInt(btcVaultBalance), BigInt(btcPrice2), BigInt(debt)) : "0.00";
74975
75342
  const message = formatLiquidationSkippedMessage(
74976
75343
  request.positionId,
74977
75344
  ratio,
@@ -75460,14 +75827,15 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
75460
75827
  }
75461
75828
  const debt = positionDetails.debt || positionDetails.ucdDebt || "0";
75462
75829
  const btcPrice2 = litActionResult.btcPrice || "0";
75463
- const ratio = debt !== "0" ? (Number(positionDetails.btcVaultBalance || "0") * Number(btcPrice2) / Number(debt) * 100 / 1e8).toFixed(2) : "0.00";
75830
+ const btcVaultBalance = litActionResult.btcAmountSats || positionDetails.btcVaultBalance || "0";
75831
+ const ratio = BigInt(debt) > 0n ? collateralRatioPercentString(BigInt(btcVaultBalance), BigInt(btcPrice2), BigInt(debt)) : "0.00";
75464
75832
  const message = formatLiquidationSuccessMessage(
75465
75833
  request.positionId,
75466
75834
  ratio,
75467
75835
  `${liquidationThreshold / 100}`,
75468
75836
  // Convert to percentage
75469
75837
  positionDetails.btcVault || "unknown",
75470
- positionDetails.btcVaultBalance || "0",
75838
+ btcVaultBalance,
75471
75839
  debt,
75472
75840
  btcPrice2
75473
75841
  );
@@ -77951,6 +78319,17 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
77951
78319
  error: `networkFee=${request.networkFee} is \u2265 50% of targetAmount=${request.targetAmount}. Refusing to broadcast \u2014 real Bitcoin fees are typically <1% of value.`
77952
78320
  };
77953
78321
  }
78322
+ const destinationDustLimit = destinationDustShortfall(
78323
+ request.targetAmount,
78324
+ request.networkFee,
78325
+ request.destination
78326
+ );
78327
+ if (destinationDustLimit !== null) {
78328
+ return {
78329
+ success: false,
78330
+ error: `Destination would receive ${request.targetAmount - request.networkFee} sats (targetAmount=${request.targetAmount} \u2212 networkFee=${request.networkFee}), below the ${destinationDustLimit}-sat dust limit for ${request.destination}; the transaction would not relay.`
78331
+ };
78332
+ }
77954
78333
  const [txid, voutStr] = request.utxoIdentifier.split(":");
77955
78334
  const vout = parseInt(voutStr || "0", 10);
77956
78335
  if (!txid || isNaN(vout)) {
@@ -79426,8 +79805,9 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
79426
79805
  const user = await signer.getAddress();
79427
79806
  const registry = AgentDelegationRegistry__factory.connect(addr, signer);
79428
79807
  let agentAddress;
79429
- const [isActive, record, latestBlock] = await Promise.all([
79808
+ const [isActive, paused, record, latestBlock] = await Promise.all([
79430
79809
  registry.isAgentActive(user),
79810
+ registry.paused(),
79431
79811
  registry.agentOf(user),
79432
79812
  this.getProviderOrThrow().getBlock("latest")
79433
79813
  ]);
@@ -79439,7 +79819,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
79439
79819
  /* HIGH */
79440
79820
  });
79441
79821
  }
79442
- const plan = planAgentBinding({ isActive, record, nowSeconds: latestBlock.timestamp });
79822
+ const plan = planAgentBinding({ isActive, paused, record, nowSeconds: latestBlock.timestamp });
79443
79823
  if (plan.kind === "reuse") {
79444
79824
  agentAddress = plan.agent;
79445
79825
  } else {
@@ -82904,11 +83284,16 @@ var RealUpstreamPlugin = class {
82904
83284
  this.src("subgraph")
82905
83285
  );
82906
83286
  },
82907
- getPositionEvents: async () => upFail({
82908
- kind: "unavailable",
82909
- source: "subgraph",
82910
- message: "event history is not mapped in this delivery of the real adapter (indexer projection pending)"
82911
- })
83287
+ getPositionEvents: async () => (
83288
+ // PERMANENT capability gap, not a transient outage: the real adapter has no indexer
83289
+ // projection for event history, and this build never will. `unsupported` →
83290
+ // NOT_IMPLEMENTED so the guide does not tell the model to retry it (C-44).
83291
+ upFail({
83292
+ kind: "unsupported",
83293
+ source: "subgraph",
83294
+ message: "event history is not implemented on the real adapter in this build (no indexer projection) \u2014 this is a permanent capability gap, not a transient outage; do not retry"
83295
+ })
83296
+ )
82912
83297
  };
82913
83298
  this.chain = {
82914
83299
  getPositionDetails: (id) => this.chainRead(() => this.readPositionDetails(id)),
@@ -84323,6 +84708,8 @@ var SignatureBridge = class {
84323
84708
  wcTransport = null;
84324
84709
  /** True while a WalletConnect session is THE wallet — ceremonies route over WC. */
84325
84710
  wcActive = false;
84711
+ /** Page session that most recently asked for a pairing QR — see `serveWcPairing`. */
84712
+ pairingSessionId = null;
84326
84713
  keystoreUnlock;
84327
84714
  unlockToken = null;
84328
84715
  unlockSession = null;
@@ -84453,7 +84840,8 @@ var SignatureBridge = class {
84453
84840
  ...handlers?.finalize ? { finalize: handlers.finalize } : {},
84454
84841
  owner: this.wcActive ? "wc" : "page",
84455
84842
  dispatched: false,
84456
- lastAttachedMs: now
84843
+ lastAttachedMs: now,
84844
+ finalizedBy: null
84457
84845
  };
84458
84846
  this.pending.set(request.id, entry);
84459
84847
  if (entry.owner === "wc") {
@@ -84486,7 +84874,8 @@ var SignatureBridge = class {
84486
84874
  // ceremony could not reach quorum through the very pages it is broadcast to.
84487
84875
  owner: "both",
84488
84876
  dispatched: false,
84489
- lastAttachedMs: now
84877
+ lastAttachedMs: now,
84878
+ finalizedBy: null
84490
84879
  };
84491
84880
  this.pending.set(request.id, entry);
84492
84881
  this.pushEntry(entry);
@@ -84584,7 +84973,7 @@ var SignatureBridge = class {
84584
84973
  * receives nothing cannot show anything. Distinct from `attachedNow()`, which counts
84585
84974
  * WalletConnect and must stay global for the connector's eviction predicate. */
84586
84975
  pageAttached() {
84587
- for (const s of this.sessions.values()) if (!s.refused && s.sse) return true;
84976
+ for (const s of this.sessions.values()) if (s.sse && this.authorized(s)) return true;
84588
84977
  return false;
84589
84978
  }
84590
84979
  /** Attachment for ONE entry — the wallet that entry is actually waiting on. The global
@@ -84601,6 +84990,7 @@ var SignatureBridge = class {
84601
84990
  * the deadline is checked first so expiry semantics stay pinned (T-EXT-03). */
84602
84991
  sweep() {
84603
84992
  const now = this.clock();
84993
+ this.evictDeadSessions();
84604
84994
  for (const entry of this.pending.values()) {
84605
84995
  if (entry.settled) continue;
84606
84996
  if (now >= entry.deadlineMs) {
@@ -84713,12 +85103,13 @@ var SignatureBridge = class {
84713
85103
  this.deny(res, 403, "this approval link has expired \u2014 ask for a fresh one (signer_setup status) and reopen");
84714
85104
  return;
84715
85105
  }
85106
+ this.makeRoomForSession();
84716
85107
  if (this.sessions.size >= MAX_SESSIONS) {
84717
85108
  this.deny(res, 429, `too many open approval pages (${MAX_SESSIONS}) \u2014 close one and retry`);
84718
85109
  return;
84719
85110
  }
84720
85111
  const sessionId = (0, import_node_crypto8.randomBytes)(24).toString("hex");
84721
- this.sessions.set(sessionId, { wallet: null, sse: null, refused: null });
85112
+ this.sessions.set(sessionId, { wallet: null, sse: null, refused: null, lastSeenMs: this.clock(), wcPaired: false });
84722
85113
  const page = htmlPageSecurityHeaders();
84723
85114
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store", ...page.headers });
84724
85115
  res.end(renderApprovalPage(sessionId, page.nonce));
@@ -84733,6 +85124,7 @@ var SignatureBridge = class {
84733
85124
  * fresh pairing URI. A wallet approving the pairing becomes THE wallet. */
84734
85125
  async serveWcPairing(url2, res) {
84735
85126
  if (!this.checkSession(url2.searchParams.get("s"), res)) return;
85127
+ this.pairingSessionId = url2.searchParams.get("s");
84736
85128
  if (!this.wcConfig) {
84737
85129
  this.deny(res, 404, "WalletConnect is not configured (set DH_WC_PROJECT_ID)");
84738
85130
  return;
@@ -84756,6 +85148,10 @@ var SignatureBridge = class {
84756
85148
  }
84757
85149
  this.wcActive = info !== null;
84758
85150
  this.wallet = info ? { account: info.account, chainId: info.chainId } : null;
85151
+ if (info && this.pairingSessionId) {
85152
+ const paired = this.sessions.get(this.pairingSessionId);
85153
+ if (paired) paired.wcPaired = true;
85154
+ }
84759
85155
  if (info === null) {
84760
85156
  for (const entry of this.pending.values()) {
84761
85157
  if (!entry.settled && !entry.collect) {
@@ -84833,9 +85229,7 @@ var SignatureBridge = class {
84833
85229
  res.write(":connected\n\n");
84834
85230
  session.sse?.end();
84835
85231
  session.sse = res;
84836
- for (const entry of this.pending.values()) {
84837
- if (!entry.settled) res.write(this.wireFor(entry));
84838
- }
85232
+ this.replayPending(session);
84839
85233
  const keepAlive = setInterval(() => res.write(":ka\n\n"), 2e4);
84840
85234
  keepAlive.unref();
84841
85235
  res.on("close", () => {
@@ -84860,6 +85254,7 @@ var SignatureBridge = class {
84860
85254
  }
84861
85255
  session.wallet = { account, chainId };
84862
85256
  this.wallet = { account, chainId };
85257
+ this.replayPending(session);
84863
85258
  this.ok(res);
84864
85259
  }
84865
85260
  /** C-47: the single predicate every wallet account is admitted through. There are THREE
@@ -84943,7 +85338,9 @@ var SignatureBridge = class {
84943
85338
  /** Click-time re-stamp (A0.9): returns the FRESH personal-sign payload for a pending
84944
85339
  * request. Idempotent for requests without a finalize handler (payload as enqueued). */
84945
85340
  async onFinalize(body, res) {
84946
- if (!this.sessionOf(body["sessionId"], res)) return;
85341
+ const sessionId = String(body["sessionId"] ?? "");
85342
+ const session = this.decidingSessionOf(body["sessionId"], res);
85343
+ if (!session) return;
84947
85344
  const entry = this.pending.get(String(body["requestId"] ?? ""));
84948
85345
  if (!entry || entry.settled) {
84949
85346
  this.deny(res, 404, "unknown or already-settled requestId");
@@ -84957,6 +85354,12 @@ var SignatureBridge = class {
84957
85354
  this.deny(res, 409, "a mobile wallet is holding this approval \u2014 it is read-only here; approve or decline it in the wallet");
84958
85355
  return;
84959
85356
  }
85357
+ const holder = entry.finalizedBy ? this.sessions.get(entry.finalizedBy) : void 0;
85358
+ if (entry.finalizedBy && entry.finalizedBy !== sessionId && holder?.sse) {
85359
+ this.deny(res, 409, "another approval page is signing this request \u2014 approve it there, or close that page and retry");
85360
+ return;
85361
+ }
85362
+ entry.finalizedBy = sessionId;
84960
85363
  if (entry.finalize) {
84961
85364
  let fresh;
84962
85365
  try {
@@ -84976,7 +85379,7 @@ var SignatureBridge = class {
84976
85379
  res.end(JSON.stringify({ request: entry.request }));
84977
85380
  }
84978
85381
  onResult(body, res) {
84979
- if (!this.sessionOf(body["sessionId"], res)) return;
85382
+ if (!this.decidingSessionOf(body["sessionId"], res)) return;
84980
85383
  const entry = this.pending.get(String(body["requestId"] ?? ""));
84981
85384
  if (!entry || entry.settled) {
84982
85385
  this.deny(res, 404, "unknown or already-settled requestId");
@@ -85049,7 +85452,7 @@ var SignatureBridge = class {
85049
85452
  /** Broadcast a pending entry to EVERY open page (multi-owner links — plan 06 §1.5). */
85050
85453
  pushEntry(entry) {
85051
85454
  const data = this.wireFor(entry);
85052
- for (const s of this.sessions.values()) if (!s.refused) s.sse?.write(data);
85455
+ for (const s of this.sessions.values()) if (this.authorized(s)) s.sse?.write(data);
85053
85456
  }
85054
85457
  /** Progress goes out as a NAMED event so `es.onmessage` request handling never sees it. */
85055
85458
  pushProgress(payload) {
@@ -85057,7 +85460,51 @@ var SignatureBridge = class {
85057
85460
  data: ${JSON.stringify(payload)}
85058
85461
 
85059
85462
  `;
85060
- for (const s of this.sessions.values()) if (!s.refused) s.sse?.write(data);
85463
+ for (const s of this.sessions.values()) if (this.authorized(s)) s.sse?.write(data);
85464
+ }
85465
+ /** Replay every undecided card to ONE session — used when a session becomes authorized
85466
+ * (hello) after its stream was already open, which is the ordinary page order: the page
85467
+ * attaches its EventSource, then the wallet prompt resolves. Without this the newly
85468
+ * connected page would sit blank until the next push. */
85469
+ replayPending(session) {
85470
+ if (!session.sse || !this.authorized(session)) return;
85471
+ for (const entry of this.pending.values()) {
85472
+ if (!entry.settled) session.sse.write(this.wireFor(entry));
85473
+ }
85474
+ }
85475
+ /** Retire quarantined sessions that hold no stream. Always safe: a refused session is
85476
+ * denied on every route anyway, so keeping it costs a slot and buys nothing. */
85477
+ evictDeadSessions() {
85478
+ for (const [id, s] of this.sessions) if (s.refused && !s.sse) this.sessions.delete(id);
85479
+ }
85480
+ /**
85481
+ * Free a slot for an incoming page load when the ceiling is reached.
85482
+ *
85483
+ * MAX_SESSIONS was a ceiling with NO eviction — nothing but `close()` ever removed a
85484
+ * session — and every page load mints one (a reload is a new session). A long-lived
85485
+ * hosted bridge therefore reached 16 through ordinary use and 429'd the user out of
85486
+ * approving their own ceremonies, permanently, with "close one and retry" as the advice
85487
+ * for pages that were already closed.
85488
+ *
85489
+ * Eviction is ON DEMAND and never touches a session with a live SSE stream: that stream
85490
+ * is a page open in a browser right now, and the C1 contract is that live sessions
85491
+ * survive. Among the streamless it takes the least recently seen — the closed tab.
85492
+ */
85493
+ makeRoomForSession() {
85494
+ this.evictDeadSessions();
85495
+ while (this.sessions.size >= MAX_SESSIONS) {
85496
+ let oldestId = null;
85497
+ let oldestSeen = Infinity;
85498
+ for (const [id, s] of this.sessions) {
85499
+ if (s.sse) continue;
85500
+ if (s.lastSeenMs < oldestSeen) {
85501
+ oldestSeen = s.lastSeenMs;
85502
+ oldestId = id;
85503
+ }
85504
+ }
85505
+ if (oldestId === null) return;
85506
+ this.sessions.delete(oldestId);
85507
+ }
85061
85508
  }
85062
85509
  /**
85063
85510
  * C-47: `this.wallet` is DERIVED, never guessed.
@@ -85100,12 +85547,46 @@ data: ${JSON.stringify(payload)}
85100
85547
  }
85101
85548
  this.rebuildSharedWallet();
85102
85549
  }
85550
+ /**
85551
+ * A session that may SEE cards and DECIDE them — one where a PERSON has proven to be at
85552
+ * the page: `hello` with an admissible account, or a WalletConnect pairing a wallet
85553
+ * actually answered (`wcPaired`).
85554
+ *
85555
+ * `sessionOf` only ever asked "does this session id exist and is it un-quarantined". A
85556
+ * session id is minted by LOADING the page, and on the hosted tier the mount URL travels
85557
+ * through the conversation by design — so anyone holding it could mint a session, never
85558
+ * connect a wallet, and still receive every approval card on /events (the card is the
85559
+ * operation in readable form: position, destination, amounts) and still POST /result to
85560
+ * decline, or /finalize to re-stamp, someone else's ceremony. Quarantine never caught
85561
+ * them: it fires on an OFFERED account, and they offered none.
85562
+ *
85563
+ * Opening the stream without a wallet stays legal — that is how the real page bootstraps
85564
+ * before the user connects. It simply receives nothing and decides nothing until it has
85565
+ * connected. Requesting a pairing is likewise not enough: anyone with the link can ask
85566
+ * for a QR, so only a pairing a WALLET ANSWERED counts.
85567
+ */
85568
+ authorized(session) {
85569
+ if (session.refused) return false;
85570
+ if (session.wallet) return this.accountRefusal(session.wallet.account) === null;
85571
+ return session.wcPaired;
85572
+ }
85573
+ /** `sessionOf`, plus the wallet binding above — for the routes that decide a ceremony. */
85574
+ decidingSessionOf(candidate, res) {
85575
+ const session = this.sessionOf(candidate, res);
85576
+ if (!session) return null;
85577
+ if (!this.authorized(session)) {
85578
+ this.deny(res, 403, "connect your wallet on this page before approving, declining or finalizing a request");
85579
+ return null;
85580
+ }
85581
+ return session;
85582
+ }
85103
85583
  sessionOf(candidate, res) {
85104
85584
  const session = typeof candidate === "string" ? this.sessions.get(candidate) ?? null : null;
85105
85585
  if (!session) {
85106
85586
  this.deny(res, 403, "missing or wrong session");
85107
85587
  return null;
85108
85588
  }
85589
+ session.lastSeenMs = this.clock();
85109
85590
  if (session.refused) {
85110
85591
  this.deny(res, 403, session.refused);
85111
85592
  return null;
@@ -85798,8 +86279,13 @@ function authorizationModeBullets(d) {
85798
86279
  that one \u2014 say it before the popup. Walkthrough: \`guide connect-wallet\`.`);
85799
86280
  }
85800
86281
  if (offers(d, "keystore")) {
85801
- bullets.push(` - \`keystore\` \u2014 a local encrypted keystore signs automatically after each confirmation.
85802
- Real adapter and mock.`);
86282
+ bullets.push(` - \`keystore\` \u2014 a local encrypted keystore signs AUTOMATICALLY, with no per-operation
86283
+ human prompt. Real adapter and mock. Say this plainly when the user picks it: the
86284
+ password is asked ONCE, at unlock; after that the key signs every write this session
86285
+ without a popup, an approval page or any second human step. The \`confirmed: true\` gate
86286
+ is the ASSISTANT's \u2014 it is not the user seeing and approving the operation \u2014 so in this
86287
+ mode you must show the operation and get a real answer before you set it. A user who
86288
+ wants to inspect each operation as it signs wants \`external\`.`);
85803
86289
  }
85804
86290
  if (offers(d, "safe") || offers(d, "safe-module")) {
85805
86291
  bullets.push(` - \`safe\` / \`safe-module\` \u2014 PRACTICE-ONLY today: on the real adapter these modes
@@ -85810,6 +86296,9 @@ function authorizationModeBullets(d) {
85810
86296
  }
85811
86297
  return bullets.join("\n");
85812
86298
  }
86299
+ function readsNeedSignIn(d) {
86300
+ return offers(d, "keystore") ? "On the real adapter a read is NOT a free pass: `position_list {borrower}`, `protocol_status` and `protocol_terms` need a signing identity \u2014 the keystore (the env pair or `unlock-keystore`) or a wallet `connect` \u2014 and refuse on a fresh session until one is connected. Only the practice (mock) world reads without one; there is no signer-less public read on the real adapter." : "On this hosted connector a read is NOT a free pass: even `position_list {borrower}`, `protocol_status` and `protocol_terms` run only AFTER the wallet sign-in that connecting performs (`signer_setup` action `connect`) \u2014 a fresh session refuses them until then. There is no separate keystore step and no signer-less public read here.";
86301
+ }
85813
86302
  function keystoreAbsenceParagraph(d) {
85814
86303
  if (offers(d, "keystore")) return "";
85815
86304
  return `
@@ -85853,9 +86342,11 @@ install matrix. ${connectorInstallNote(d)}
85853
86342
 
85854
86343
  Nothing needs a config file. Three steps:
85855
86344
 
85856
- **1. Know your world.** Read \`boundary://info\` (its \`capabilities\` block) and
85857
- \`protocol_status\`, then tell the user what THIS deployment is: ${worldAxes(d)}; which
85858
- signer modes exist; current terms (\`protocol_terms\`).
86345
+ **1. Know your world.** Read \`boundary://info\` (its \`capabilities\` block) \u2014 that
86346
+ resource always answers, with no sign-in \u2014 and tell the user what THIS deployment is:
86347
+ ${worldAxes(d)}; which signer modes exist. ${readsNeedSignIn(d)} So the live reads
86348
+ (\`protocol_status\`, current terms via \`protocol_terms\`) come right after step 2, not
86349
+ before it.
85859
86350
 
85860
86351
  **2. Choose HOW to authorize operations** (the user's choice, made by talking):
85861
86352
  - **"Use my own wallet"** \u2192 call \`signer_setup\` action \`use\`, mode \`external\` \u2014 works
@@ -85875,8 +86366,9 @@ ${offers(d, "safe") || offers(d, "safe-module") ? `- **Safe / delegation modes (
85875
86366
  surface is the wallet ceremony and nothing else; \`signer_setup\` lists no other mode.
85876
86367
  \`guide safe\` and \`guide delegation\` state what exists elsewhere.`}
85877
86368
  - Not sure? \`signer_setup\` action \`status\` explains what is active and what is missing.
85878
- - **No signer is also a valid start:** every public read works without one \u2014
85879
- \`position_list {borrower}\` with the user's address needs no signer and no login.
86369
+ - **A read is not a signer-less shortcut:** the sign-in in step 2 is what turns reads ON.
86370
+ Until then \`position_list {borrower}\`, \`protocol_status\` and \`protocol_terms\` refuse
86371
+ on the real adapter \u2014 do step 2 first, then reads work.
85880
86372
  ${d.networks.length > 1 ? `- **Wrong network?** On the real adapter the user can switch sepolia \u2194 mainnet by
85881
86373
  talking (\`network_switch\`, human-confirmed) \u2014 see \`guide switch-network\`. State
85882
86374
  the money reality after any switch.` : `- **Wrong network?** This deployment is rolled out to ${d.networks[0]} alone \u2014
@@ -86365,7 +86857,12 @@ ${wrongNetworkTroubleshootingRow(d)}
86365
86857
  owed, wrong position state, or the USER DECLINED in the wallet. The message says which.
86366
86858
  A decline is not an error to fix \u2014 it is the user's decision.
86367
86859
  - **UPSTREAM_UNAVAILABLE** \u2014 a data source or the signature bridge is unreachable/expired.
86368
- Usually transient; re-check with \`protocol_status\` and retry once.
86860
+ Usually transient; re-check with \`protocol_status\` and retry once. (A PERMANENT gap
86861
+ answers \`NOT_IMPLEMENTED\`, below \u2014 that one is not retryable.)
86862
+ - **NOT_IMPLEMENTED** \u2014 a capability this adapter does NOT implement in this build, and never
86863
+ will \u2014 PERMANENT, not a transient outage, so do NOT retry it. \`position_events\` on the
86864
+ real adapter is the case: there is no indexer projection for event history here. Say the
86865
+ history is unavailable on this deployment and move on; the practice (mock) world has it.
86369
86866
  - **NOT_FOUND** \u2014 the position id doesn't exist in this world (check \`position_list\`).
86370
86867
  - **STATE_DIVERGENCE / STALE_DATA warnings** \u2014 sources disagree or lag; the envelope says
86371
86868
  which source and when from. Prefer chain-sourced values; re-read before acting.
@@ -86599,7 +87096,7 @@ function requireConfirmation(confirmed, actionLabel) {
86599
87096
  type: "text",
86600
87097
  text: `CONFIRMATION REQUIRED \u2014 refusing to run "${actionLabel}".
86601
87098
  This is an irreversible, fund-moving action. A human must explicitly authorize it.
86602
- Re-invoke with confirmed: true ONLY after a human has approved this exact operation. Do not set confirmed on your own.`
87099
+ Show the user what this operation does \u2014 amounts, destination, and that it cannot be undone \u2014 and re-invoke with confirmed: true ONLY after they answer. Do not set confirmed on your own, and do not treat an earlier approval of a different operation as covering this one. If the signer is a keystore, no wallet prompt will follow: this is the only place a human is asked.`
86603
87100
  }
86604
87101
  ],
86605
87102
  isError: true
@@ -87036,7 +87533,7 @@ function registerPositionTools(server, getB) {
87036
87533
  "position_events",
87037
87534
  {
87038
87535
  title: "Get a position's event history",
87039
- description: "Return mint, payment, withdrawal, renewal, and liquidation events for a position (indexer view).",
87536
+ description: "Return mint, payment, withdrawal, renewal, and liquidation events for a position (indexer view). NOT IMPLEMENTED on the real protocol adapter in this build \u2014 it answers NOT_IMPLEMENTED there (a PERMANENT gap, not a transient outage: do not retry). Available on the practice (mock) adapter.",
87040
87537
  inputSchema: {
87041
87538
  id: positionIdSchema2
87042
87539
  }
@@ -87582,7 +88079,7 @@ function registerGuidePrompts(server, deployment = LOCAL_GUIDE_DEPLOYMENT) {
87582
88079
  role: "user",
87583
88080
  content: {
87584
88081
  type: "text",
87585
- text: "I'm new to Diamond Hands. FIRST read boundary://info and its capabilities block \u2014 it is the truth about this session: the network, practice vs real money, whether writes are enabled (and the true reason when not), and which signer modes exist here. Never promise anything it does not list. Then read the guide topics 'getting-started' and 'first-setup' (guide tool), check protocol_status, and walk me through setup step by step IN MY LANGUAGE: tell me plainly whether this is practice or real money. BRANCH on capabilities: if no signer mode is available or writes are disabled, keep me on the read-only path (position_list with my address needs no signer) and say the true reason; " + onboardAuthorizationLine(deployment) + "Ask before every operation; never assume confirmation."
88082
+ text: "I'm new to Diamond Hands. FIRST read boundary://info and its capabilities block \u2014 it is the truth about this session: the network, practice vs real money, whether writes are enabled (and the true reason when not), and which signer modes exist here. Never promise anything it does not list. Then read the guide topics 'getting-started' and 'first-setup' (guide tool), check protocol_status, and walk me through setup step by step IN MY LANGUAGE: tell me plainly whether this is practice or real money. BRANCH on capabilities: if no signer mode is available or writes are disabled, say the true reason \u2014 and note that on the real adapter even a read (position_list, protocol_status, protocol_terms) needs the wallet sign-in that connecting performs first; there is no signer-less read path, so guide me to sign in before expecting any read to return; " + onboardAuthorizationLine(deployment) + "Ask before every operation; never assume confirmation."
87586
88083
  }
87587
88084
  }
87588
88085
  ]
@@ -87770,7 +88267,7 @@ function registerProtocolResources(server, getB) {
87770
88267
  "protocol://psm",
87771
88268
  {
87772
88269
  title: "PSM status (UCD \u2194 USDC exchange)",
87773
- description: "Live SimplePSMV2 state as {data, warnings, source}. `data` carries network + chainId + psmAddress (the money surface names its chain) and `stablecoins`: EVERY coin this PSM supports, each with its own stablecoinKind (mock = practice token with a public self-serve mint; circle = real USDC), pause + redeemEnabled switches, live reserves, and per-direction fees (WITH their token), min/max (WITH their units \u2014 to-ucd caps in the stablecoin's smallest units, from-ucd caps in UCD wei) and per-block volume caps ('uncapped' when the on-chain cap is 0). This is where a caller learns the coin names that `psm_quote` and `psm_swap` require.",
88270
+ description: "Live SimplePSMV2 state as {data, warnings, source}. `data` carries network + chainId + psmAddress (the money surface names its chain) and `stablecoins`: EVERY coin this PSM supports, each with its own stablecoinKind (mock = practice token with a public self-serve mint; circle = canonical mainnet USDC, i.e. real Circle USDC; onchain = any OTHER real coin such as mainnet USDT \u2014 real and on-chain, but NOT Circle USDC), pause + redeemEnabled switches, live reserves, and per-direction fees (WITH their token), min/max (WITH their units \u2014 to-ucd caps in the stablecoin's smallest units, from-ucd caps in UCD wei) and per-block volume caps ('uncapped' when the on-chain cap is 0). This is where a caller learns the coin names that `psm_quote` and `psm_swap` require.",
87774
88271
  mimeType: "application/json"
87775
88272
  },
87776
88273
  async (uri) => {
@@ -88254,6 +88751,10 @@ function composeConnector(opts, rawPublicOrigin) {
88254
88751
  }
88255
88752
  const app = (0, import_express.default)();
88256
88753
  app.set("trust proxy", trustProxyHops);
88754
+ app.use((_req, res, next) => {
88755
+ res.setHeader(STRICT_TRANSPORT_SECURITY.name, STRICT_TRANSPORT_SECURITY.value);
88756
+ next();
88757
+ });
88257
88758
  app.use((_req, res, next) => {
88258
88759
  if (!allowGlobal()) {
88259
88760
  deny(res, 429, `rate limit: this connector exceeded ${globalPerMin} requests/minute across all clients \u2014 a shared-capacity protection; wait for the minute window to pass and retry`);
@@ -88261,6 +88762,31 @@ function composeConnector(opts, rawPublicOrigin) {
88261
88762
  }
88262
88763
  next();
88263
88764
  });
88765
+ const expectedHost = opts.publicOrigin ? new URL(publicOrigin).host.toLowerCase() : null;
88766
+ app.use((req, res, next) => {
88767
+ if (expectedHost === null) {
88768
+ next();
88769
+ return;
88770
+ }
88771
+ const p = (req.originalUrl ?? req.url).split("?")[0].toLowerCase();
88772
+ const sensitive = ["/mcp", "/token", "/register", "/revoke", "/authorize"].some(
88773
+ (r) => p === r || p.startsWith(`${r}/`)
88774
+ );
88775
+ if (!sensitive) {
88776
+ next();
88777
+ return;
88778
+ }
88779
+ const host = (req.headers.host ?? "").toLowerCase();
88780
+ if (host !== expectedHost) {
88781
+ deny(
88782
+ res,
88783
+ 421,
88784
+ `misdirected request: this connector serves ${expectedHost} \u2014 the request arrived on Host '${req.headers.host ?? "(none)"}'. Use the canonical origin advertised in the discovery documents.`
88785
+ );
88786
+ return;
88787
+ }
88788
+ next();
88789
+ });
88264
88790
  app.use((req, res, next) => {
88265
88791
  const path5 = (req.originalUrl ?? req.url).split("?")[0];
88266
88792
  if (path5 === "/mcp" || path5.startsWith("/approval/")) {