@gvnrdao/dh-sdk 0.0.221 → 0.0.222

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14325,16 +14325,16 @@ var init_deployment_addresses = __esm({
14325
14325
  },
14326
14326
  upgraded: {
14327
14327
  PositionManager: {
14328
- previousImplementation: "0x1b854fE920AC409b5f407b3ABCd556C998F889E5",
14329
- newImplementation: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
14330
- upgradedAt: "2026-04-30T08:33:24.883Z",
14328
+ previousImplementation: "0x0e40B4D1708f49319f32d51AF01674c26acACeBF",
14329
+ newImplementation: "0x94096F14f58Cb427B36f2a5aeE24348a26534C74",
14330
+ upgradedAt: "2026-04-30T16:23:00.805Z",
14331
14331
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14332
14332
  reason: "Shared upgrade script: PositionManager implementation update"
14333
14333
  },
14334
14334
  LoanOperationsManagerModule: {
14335
- previousImplementation: "0x448Fb59Cad99FFe3d0766F6943E4B579A824d46b",
14336
- newImplementation: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
14337
- upgradedAt: "2026-04-30T08:34:13.649Z",
14335
+ previousImplementation: "0xCf8998a639cC48139C4c61C8B1005EaC40419b88",
14336
+ newImplementation: "0xF79384d5186B6081124a560e181dC5E0Cf0444dD",
14337
+ upgradedAt: "2026-04-30T16:40:12.746Z",
14338
14338
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14339
14339
  reason: "Shared upgrade script: LoanOperationsManagerModule implementation update"
14340
14340
  },
@@ -14346,25 +14346,25 @@ var init_deployment_addresses = __esm({
14346
14346
  reason: "Shared upgrade script: UCDController implementation update"
14347
14347
  },
14348
14348
  TermManagerModule: {
14349
- previousImplementation: "0x1D5E5A93215E49aA7260dA8d3B3de9faA686C087",
14350
- newImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14351
- upgradedAt: "2026-04-30T08:26:37.176Z",
14349
+ previousImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14350
+ newImplementation: "0xcc3D2dD7aAfaE5DE923dfd53833a40077178dd75",
14351
+ upgradedAt: "2026-04-30T16:06:36.895Z",
14352
14352
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14353
14353
  reason: "Shared upgrade script: TermManagerModule implementation update"
14354
14354
  },
14355
14355
  CircuitBreakerModule: {
14356
- previousImplementation: "0xa4940082a7b58c45C3885C4B59714C0dD048cDdC",
14357
- newImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14358
- upgradedAt: "2026-04-30T08:29:37.131Z",
14356
+ previousImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14357
+ newImplementation: "0x485F5E93E479830698Ffdc36957edfcf0084E4c6",
14358
+ upgradedAt: "2026-04-30T16:11:25.723Z",
14359
14359
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14360
14360
  reason: "Shared upgrade script: CircuitBreakerModule implementation update"
14361
14361
  },
14362
14362
  AdminModule: {
14363
- previousImplementation: "0x8bDe850573a947b816D1EC5C5Ca177853bDfD049",
14364
- newImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14365
- upgradedAt: "2026-04-30T08:31:13.444Z",
14363
+ previousImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14364
+ newImplementation: "0xaC7c227EddCE4F03590Ad10e773219Ffc07f9277",
14365
+ upgradedAt: "2026-04-30T16:24:49.030Z",
14366
14366
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14367
- reason: "Shared upgrade script: AdminModule implementation update"
14367
+ reason: "Bulk-pause functions and network-aware operationDelay"
14368
14368
  },
14369
14369
  PositionManagerViews: {
14370
14370
  previousImplementation: "0xE8b4D4b6E3163EdfF8958da4cF8267ACa369D486",
@@ -14388,30 +14388,30 @@ var init_deployment_addresses = __esm({
14388
14388
  reason: "Shared upgrade script: UCDToken implementation update"
14389
14389
  },
14390
14390
  PositionManagerCoreModule: {
14391
- previousImplementation: "0xeA5234c8E3a5F61c660db529d9d6f91fd989B56E",
14392
- newImplementation: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
14393
- upgradedAt: "2026-04-30T09:32:01.570Z",
14391
+ previousImplementation: "0xED380dDdc919b94924cCd5697bEEfdc347Daa9A6",
14392
+ newImplementation: "0x9c7EF89F1F66F78522AA9D45F894f75583edEC3d",
14393
+ upgradedAt: "2026-04-30T16:21:05.763Z",
14394
14394
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14395
14395
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
14396
14396
  },
14397
14397
  CollateralManagerModule: {
14398
- previousImplementation: "0x84C5B89f60415F8df3Fee46Ef1a10a6484aa8e0A",
14399
- newImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
14400
- upgradedAt: "2026-04-30T08:27:24.702Z",
14398
+ previousImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
14399
+ newImplementation: "0x920e4f52c251B758e351c0d14c4418ad4E5B77ed",
14400
+ upgradedAt: "2026-04-30T16:03:49.056Z",
14401
14401
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14402
14402
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
14403
14403
  },
14404
14404
  LiquidationManagerModule: {
14405
- previousImplementation: "0xBb625E44d72f3F1acDCbB08F73AFdAc38fCE3F64",
14406
- newImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
14407
- upgradedAt: "2026-04-30T08:29:01.327Z",
14405
+ previousImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
14406
+ newImplementation: "0xcdd426D27bB2f54Dba76dF60EF3D14fD5776CEc7",
14407
+ upgradedAt: "2026-04-30T16:09:01.899Z",
14408
14408
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14409
14409
  reason: "Shared upgrade script: LiquidationManagerModule implementation update"
14410
14410
  },
14411
14411
  BTCSpendAuthorizer: {
14412
- previousImplementation: "0x0B46DCdB63CB9928789ef1979C367da6ef04beAf",
14413
- newImplementation: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
14414
- upgradedAt: "2026-04-30T08:32:02.761Z",
14412
+ previousImplementation: "0xe7337422e2A4AE7709EFc01fB6C681C8899e673C",
14413
+ newImplementation: "0x605bf1C988bb307AFA07326954D593A71580e99d",
14414
+ upgradedAt: "2026-04-30T20:22:12.956Z",
14415
14415
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14416
14416
  reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
14417
14417
  },
@@ -14423,9 +14423,9 @@ var init_deployment_addresses = __esm({
14423
14423
  reason: "Shared upgrade script: SimplePSMV2 implementation update"
14424
14424
  },
14425
14425
  UpgradeValidator: {
14426
- previousImplementation: "0xE410d1028Cdf2D94E3F5049F2D04B573703A2804",
14427
- newImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14428
- upgradedAt: "2026-04-30T09:32:25.094Z",
14426
+ previousImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14427
+ newImplementation: "0xEFf189e5872bC7158191eD39d31E745aF2A6FDa7",
14428
+ upgradedAt: "2026-04-30T16:47:01.406Z",
14429
14429
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14430
14430
  reason: "Shared upgrade script: UpgradeValidator implementation update"
14431
14431
  },
@@ -14503,12 +14503,12 @@ var init_deployment_addresses = __esm({
14503
14503
  CIRCUIT_BREAKER_MODULE: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
14504
14504
  ADMIN_MODULE: "0xAcd1f07915b17CA3727e7fE89BdF618A1545a1ed",
14505
14505
  UCD_CONTROLLER_IMPL: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
14506
- LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
14507
- TERM_MANAGER_MODULE_IMPL: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14506
+ LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0xF79384d5186B6081124a560e181dC5E0Cf0444dD",
14507
+ TERM_MANAGER_MODULE_IMPL: "0xcc3D2dD7aAfaE5DE923dfd53833a40077178dd75",
14508
14508
  CIRCUIT_BREAKER_MODULE_IMPL: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14509
14509
  ADMIN_MODULE_IMPL: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14510
14510
  POSITION_MANAGER_VIEWS_IMPL: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
14511
- POSITION_MANAGER_IMPL: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
14511
+ POSITION_MANAGER_IMPL: "0x94096F14f58Cb427B36f2a5aeE24348a26534C74",
14512
14512
  SIMPLE_PSM_V2: "0x19EcF7BA26e054fd4Ff06009A03070103dbBB058",
14513
14513
  SIMPLE_PSM_V2_IMPL: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
14514
14514
  UCD_TOKEN_IMPL: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
@@ -14521,7 +14521,7 @@ var init_deployment_addresses = __esm({
14521
14521
  BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
14522
14522
  BTC_SPEND_AUTHORIZER_IMPL: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
14523
14523
  UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
14524
- UPGRADE_VALIDATOR_IMPL: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14524
+ UPGRADE_VALIDATOR_IMPL: "0xEFf189e5872bC7158191eD39d31E745aF2A6FDa7",
14525
14525
  BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
14526
14526
  BITCOIN_PROVIDER_REGISTRY_IMPL: "0x225309A4ae6D146ba93A3278A7b40224FfC81448",
14527
14527
  LIT_ACTION_VALIDATOR: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
@@ -37702,6 +37702,18 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
37702
37702
  * Check if SDK is ready for operations
37703
37703
  */
37704
37704
  async _relayNotification(message) {
37705
+ const handler = this.config.notificationHandler;
37706
+ if (typeof handler === "function") {
37707
+ try {
37708
+ await handler(message);
37709
+ } catch (err) {
37710
+ if (this.config.debug) {
37711
+ log.warn("notificationHandler threw", {
37712
+ error: err instanceof Error ? err.message : String(err)
37713
+ });
37714
+ }
37715
+ }
37716
+ }
37705
37717
  if (this.config.mode !== "service")
37706
37718
  return;
37707
37719
  const endpoint = this.config.serviceEndpoint;
@@ -40299,7 +40311,14 @@ Error data: ${errorData || "none"}`
40299
40311
  LoanOperationsManagerModule: this.config.contractAddresses?.loanOperationsManager || "",
40300
40312
  TermManagerModule: this.config.contractAddresses?.termManager || "",
40301
40313
  LiquidationManagerModule: this.config.contractAddresses?.liquidationManager || "",
40302
- ...this.config.contractAddresses?.btcSpendAuthorizer ? { BTCSpendAuthorizer: this.config.contractAddresses.btcSpendAuthorizer } : {}
40314
+ ...this.config.contractAddresses?.btcSpendAuthorizer ? { BTCSpendAuthorizer: this.config.contractAddresses.btcSpendAuthorizer } : {},
40315
+ // Required on non-hardhat chains by Lit Actions after audit C-1/H-6:
40316
+ // the Bitcoin provider whitelist now lives on-chain. Other SDK paths
40317
+ // (mintUCD, extendPosition, withdrawBTC) already forward this; keep
40318
+ // confirmBalance aligned so Sepolia behaves identically to Hardhat.
40319
+ ...this.config.contractAddresses?.bitcoinProviderRegistry ? {
40320
+ BitcoinProviderRegistry: this.config.contractAddresses.bitcoinProviderRegistry
40321
+ } : {}
40303
40322
  };
40304
40323
  const chainId = await this.config.provider?.getNetwork().then((n) => n.chainId) || 11155111;
40305
40324
  const chain = chainId === 11155111 ? "sepolia" : chainId === 1337 ? "hardhat" : "sepolia";
@@ -42023,13 +42042,37 @@ Error data: ${errorData || "none"}`
42023
42042
  if (utxoListResponse.ok) {
42024
42043
  const utxoList = await utxoListResponse.json();
42025
42044
  if (Array.isArray(utxoList)) {
42026
- allUTXOs = utxoList.filter((u) => u.status?.confirmed === true).map((u) => ({
42027
- txid: u.txid,
42028
- vout: u.vout,
42029
- value: u.value,
42030
- // satoshis
42031
- scriptPubKey: derivedScriptPubKey
42032
- }));
42045
+ const confirmed = utxoList.filter((u) => u.status?.confirmed === true);
42046
+ const verified = [];
42047
+ for (const u of confirmed) {
42048
+ try {
42049
+ const txResp = await fetch(`${bitcoinRpcUrl}/tx/${u.txid}`);
42050
+ if (!txResp.ok)
42051
+ continue;
42052
+ const txData = await txResp.json();
42053
+ if (!Array.isArray(txData.vout))
42054
+ continue;
42055
+ let voutIdx = u.vout;
42056
+ const voutData = txData.vout[voutIdx];
42057
+ const spk = voutData?.scriptpubkey || voutData?.scriptPubKey || voutData?.scriptpubkey_hex;
42058
+ if (spk !== derivedScriptPubKey) {
42059
+ const correctIdx = txData.vout.findIndex(
42060
+ (v) => (v.scriptpubkey || v.scriptPubKey || v.scriptpubkey_hex) === derivedScriptPubKey
42061
+ );
42062
+ if (correctIdx < 0)
42063
+ continue;
42064
+ voutIdx = correctIdx;
42065
+ }
42066
+ verified.push({
42067
+ txid: u.txid,
42068
+ vout: voutIdx,
42069
+ value: txData.vout[voutIdx].value,
42070
+ scriptPubKey: derivedScriptPubKey
42071
+ });
42072
+ } catch {
42073
+ }
42074
+ }
42075
+ allUTXOs = verified;
42033
42076
  if (this.config.debug) {
42034
42077
  log.info(`\u2705 Fetched ${allUTXOs.length} confirmed UTXO(s) for consolidation`, {
42035
42078
  vaultAddress,
package/dist/index.mjs CHANGED
@@ -14331,16 +14331,16 @@ var init_deployment_addresses = __esm({
14331
14331
  },
14332
14332
  upgraded: {
14333
14333
  PositionManager: {
14334
- previousImplementation: "0x1b854fE920AC409b5f407b3ABCd556C998F889E5",
14335
- newImplementation: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
14336
- upgradedAt: "2026-04-30T08:33:24.883Z",
14334
+ previousImplementation: "0x0e40B4D1708f49319f32d51AF01674c26acACeBF",
14335
+ newImplementation: "0x94096F14f58Cb427B36f2a5aeE24348a26534C74",
14336
+ upgradedAt: "2026-04-30T16:23:00.805Z",
14337
14337
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14338
14338
  reason: "Shared upgrade script: PositionManager implementation update"
14339
14339
  },
14340
14340
  LoanOperationsManagerModule: {
14341
- previousImplementation: "0x448Fb59Cad99FFe3d0766F6943E4B579A824d46b",
14342
- newImplementation: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
14343
- upgradedAt: "2026-04-30T08:34:13.649Z",
14341
+ previousImplementation: "0xCf8998a639cC48139C4c61C8B1005EaC40419b88",
14342
+ newImplementation: "0xF79384d5186B6081124a560e181dC5E0Cf0444dD",
14343
+ upgradedAt: "2026-04-30T16:40:12.746Z",
14344
14344
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14345
14345
  reason: "Shared upgrade script: LoanOperationsManagerModule implementation update"
14346
14346
  },
@@ -14352,25 +14352,25 @@ var init_deployment_addresses = __esm({
14352
14352
  reason: "Shared upgrade script: UCDController implementation update"
14353
14353
  },
14354
14354
  TermManagerModule: {
14355
- previousImplementation: "0x1D5E5A93215E49aA7260dA8d3B3de9faA686C087",
14356
- newImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14357
- upgradedAt: "2026-04-30T08:26:37.176Z",
14355
+ previousImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14356
+ newImplementation: "0xcc3D2dD7aAfaE5DE923dfd53833a40077178dd75",
14357
+ upgradedAt: "2026-04-30T16:06:36.895Z",
14358
14358
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14359
14359
  reason: "Shared upgrade script: TermManagerModule implementation update"
14360
14360
  },
14361
14361
  CircuitBreakerModule: {
14362
- previousImplementation: "0xa4940082a7b58c45C3885C4B59714C0dD048cDdC",
14363
- newImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14364
- upgradedAt: "2026-04-30T08:29:37.131Z",
14362
+ previousImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14363
+ newImplementation: "0x485F5E93E479830698Ffdc36957edfcf0084E4c6",
14364
+ upgradedAt: "2026-04-30T16:11:25.723Z",
14365
14365
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14366
14366
  reason: "Shared upgrade script: CircuitBreakerModule implementation update"
14367
14367
  },
14368
14368
  AdminModule: {
14369
- previousImplementation: "0x8bDe850573a947b816D1EC5C5Ca177853bDfD049",
14370
- newImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14371
- upgradedAt: "2026-04-30T08:31:13.444Z",
14369
+ previousImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14370
+ newImplementation: "0xaC7c227EddCE4F03590Ad10e773219Ffc07f9277",
14371
+ upgradedAt: "2026-04-30T16:24:49.030Z",
14372
14372
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14373
- reason: "Shared upgrade script: AdminModule implementation update"
14373
+ reason: "Bulk-pause functions and network-aware operationDelay"
14374
14374
  },
14375
14375
  PositionManagerViews: {
14376
14376
  previousImplementation: "0xE8b4D4b6E3163EdfF8958da4cF8267ACa369D486",
@@ -14394,30 +14394,30 @@ var init_deployment_addresses = __esm({
14394
14394
  reason: "Shared upgrade script: UCDToken implementation update"
14395
14395
  },
14396
14396
  PositionManagerCoreModule: {
14397
- previousImplementation: "0xeA5234c8E3a5F61c660db529d9d6f91fd989B56E",
14398
- newImplementation: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
14399
- upgradedAt: "2026-04-30T09:32:01.570Z",
14397
+ previousImplementation: "0xED380dDdc919b94924cCd5697bEEfdc347Daa9A6",
14398
+ newImplementation: "0x9c7EF89F1F66F78522AA9D45F894f75583edEC3d",
14399
+ upgradedAt: "2026-04-30T16:21:05.763Z",
14400
14400
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14401
14401
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
14402
14402
  },
14403
14403
  CollateralManagerModule: {
14404
- previousImplementation: "0x84C5B89f60415F8df3Fee46Ef1a10a6484aa8e0A",
14405
- newImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
14406
- upgradedAt: "2026-04-30T08:27:24.702Z",
14404
+ previousImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
14405
+ newImplementation: "0x920e4f52c251B758e351c0d14c4418ad4E5B77ed",
14406
+ upgradedAt: "2026-04-30T16:03:49.056Z",
14407
14407
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14408
14408
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
14409
14409
  },
14410
14410
  LiquidationManagerModule: {
14411
- previousImplementation: "0xBb625E44d72f3F1acDCbB08F73AFdAc38fCE3F64",
14412
- newImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
14413
- upgradedAt: "2026-04-30T08:29:01.327Z",
14411
+ previousImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
14412
+ newImplementation: "0xcdd426D27bB2f54Dba76dF60EF3D14fD5776CEc7",
14413
+ upgradedAt: "2026-04-30T16:09:01.899Z",
14414
14414
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14415
14415
  reason: "Shared upgrade script: LiquidationManagerModule implementation update"
14416
14416
  },
14417
14417
  BTCSpendAuthorizer: {
14418
- previousImplementation: "0x0B46DCdB63CB9928789ef1979C367da6ef04beAf",
14419
- newImplementation: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
14420
- upgradedAt: "2026-04-30T08:32:02.761Z",
14418
+ previousImplementation: "0xe7337422e2A4AE7709EFc01fB6C681C8899e673C",
14419
+ newImplementation: "0x605bf1C988bb307AFA07326954D593A71580e99d",
14420
+ upgradedAt: "2026-04-30T20:22:12.956Z",
14421
14421
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14422
14422
  reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
14423
14423
  },
@@ -14429,9 +14429,9 @@ var init_deployment_addresses = __esm({
14429
14429
  reason: "Shared upgrade script: SimplePSMV2 implementation update"
14430
14430
  },
14431
14431
  UpgradeValidator: {
14432
- previousImplementation: "0xE410d1028Cdf2D94E3F5049F2D04B573703A2804",
14433
- newImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14434
- upgradedAt: "2026-04-30T09:32:25.094Z",
14432
+ previousImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14433
+ newImplementation: "0xEFf189e5872bC7158191eD39d31E745aF2A6FDa7",
14434
+ upgradedAt: "2026-04-30T16:47:01.406Z",
14435
14435
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
14436
14436
  reason: "Shared upgrade script: UpgradeValidator implementation update"
14437
14437
  },
@@ -14509,12 +14509,12 @@ var init_deployment_addresses = __esm({
14509
14509
  CIRCUIT_BREAKER_MODULE: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
14510
14510
  ADMIN_MODULE: "0xAcd1f07915b17CA3727e7fE89BdF618A1545a1ed",
14511
14511
  UCD_CONTROLLER_IMPL: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
14512
- LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
14513
- TERM_MANAGER_MODULE_IMPL: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
14512
+ LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0xF79384d5186B6081124a560e181dC5E0Cf0444dD",
14513
+ TERM_MANAGER_MODULE_IMPL: "0xcc3D2dD7aAfaE5DE923dfd53833a40077178dd75",
14514
14514
  CIRCUIT_BREAKER_MODULE_IMPL: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
14515
14515
  ADMIN_MODULE_IMPL: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
14516
14516
  POSITION_MANAGER_VIEWS_IMPL: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
14517
- POSITION_MANAGER_IMPL: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
14517
+ POSITION_MANAGER_IMPL: "0x94096F14f58Cb427B36f2a5aeE24348a26534C74",
14518
14518
  SIMPLE_PSM_V2: "0x19EcF7BA26e054fd4Ff06009A03070103dbBB058",
14519
14519
  SIMPLE_PSM_V2_IMPL: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
14520
14520
  UCD_TOKEN_IMPL: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
@@ -14527,7 +14527,7 @@ var init_deployment_addresses = __esm({
14527
14527
  BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
14528
14528
  BTC_SPEND_AUTHORIZER_IMPL: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
14529
14529
  UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
14530
- UPGRADE_VALIDATOR_IMPL: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
14530
+ UPGRADE_VALIDATOR_IMPL: "0xEFf189e5872bC7158191eD39d31E745aF2A6FDa7",
14531
14531
  BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
14532
14532
  BITCOIN_PROVIDER_REGISTRY_IMPL: "0x225309A4ae6D146ba93A3278A7b40224FfC81448",
14533
14533
  LIT_ACTION_VALIDATOR: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
@@ -37630,6 +37630,18 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
37630
37630
  * Check if SDK is ready for operations
37631
37631
  */
37632
37632
  async _relayNotification(message) {
37633
+ const handler = this.config.notificationHandler;
37634
+ if (typeof handler === "function") {
37635
+ try {
37636
+ await handler(message);
37637
+ } catch (err) {
37638
+ if (this.config.debug) {
37639
+ log.warn("notificationHandler threw", {
37640
+ error: err instanceof Error ? err.message : String(err)
37641
+ });
37642
+ }
37643
+ }
37644
+ }
37633
37645
  if (this.config.mode !== "service")
37634
37646
  return;
37635
37647
  const endpoint = this.config.serviceEndpoint;
@@ -40227,7 +40239,14 @@ Error data: ${errorData || "none"}`
40227
40239
  LoanOperationsManagerModule: this.config.contractAddresses?.loanOperationsManager || "",
40228
40240
  TermManagerModule: this.config.contractAddresses?.termManager || "",
40229
40241
  LiquidationManagerModule: this.config.contractAddresses?.liquidationManager || "",
40230
- ...this.config.contractAddresses?.btcSpendAuthorizer ? { BTCSpendAuthorizer: this.config.contractAddresses.btcSpendAuthorizer } : {}
40242
+ ...this.config.contractAddresses?.btcSpendAuthorizer ? { BTCSpendAuthorizer: this.config.contractAddresses.btcSpendAuthorizer } : {},
40243
+ // Required on non-hardhat chains by Lit Actions after audit C-1/H-6:
40244
+ // the Bitcoin provider whitelist now lives on-chain. Other SDK paths
40245
+ // (mintUCD, extendPosition, withdrawBTC) already forward this; keep
40246
+ // confirmBalance aligned so Sepolia behaves identically to Hardhat.
40247
+ ...this.config.contractAddresses?.bitcoinProviderRegistry ? {
40248
+ BitcoinProviderRegistry: this.config.contractAddresses.bitcoinProviderRegistry
40249
+ } : {}
40231
40250
  };
40232
40251
  const chainId = await this.config.provider?.getNetwork().then((n) => n.chainId) || 11155111;
40233
40252
  const chain = chainId === 11155111 ? "sepolia" : chainId === 1337 ? "hardhat" : "sepolia";
@@ -41951,13 +41970,37 @@ Error data: ${errorData || "none"}`
41951
41970
  if (utxoListResponse.ok) {
41952
41971
  const utxoList = await utxoListResponse.json();
41953
41972
  if (Array.isArray(utxoList)) {
41954
- allUTXOs = utxoList.filter((u) => u.status?.confirmed === true).map((u) => ({
41955
- txid: u.txid,
41956
- vout: u.vout,
41957
- value: u.value,
41958
- // satoshis
41959
- scriptPubKey: derivedScriptPubKey
41960
- }));
41973
+ const confirmed = utxoList.filter((u) => u.status?.confirmed === true);
41974
+ const verified = [];
41975
+ for (const u of confirmed) {
41976
+ try {
41977
+ const txResp = await fetch(`${bitcoinRpcUrl}/tx/${u.txid}`);
41978
+ if (!txResp.ok)
41979
+ continue;
41980
+ const txData = await txResp.json();
41981
+ if (!Array.isArray(txData.vout))
41982
+ continue;
41983
+ let voutIdx = u.vout;
41984
+ const voutData = txData.vout[voutIdx];
41985
+ const spk = voutData?.scriptpubkey || voutData?.scriptPubKey || voutData?.scriptpubkey_hex;
41986
+ if (spk !== derivedScriptPubKey) {
41987
+ const correctIdx = txData.vout.findIndex(
41988
+ (v) => (v.scriptpubkey || v.scriptPubKey || v.scriptpubkey_hex) === derivedScriptPubKey
41989
+ );
41990
+ if (correctIdx < 0)
41991
+ continue;
41992
+ voutIdx = correctIdx;
41993
+ }
41994
+ verified.push({
41995
+ txid: u.txid,
41996
+ vout: voutIdx,
41997
+ value: txData.vout[voutIdx].value,
41998
+ scriptPubKey: derivedScriptPubKey
41999
+ });
42000
+ } catch {
42001
+ }
42002
+ }
42003
+ allUTXOs = verified;
41961
42004
  if (this.config.debug) {
41962
42005
  log.info(`\u2705 Fetched ${allUTXOs.length} confirmed UTXO(s) for consolidation`, {
41963
42006
  vaultAddress,
@@ -138,6 +138,19 @@ interface BaseSDKConfig {
138
138
  };
139
139
  defaultSelectedTermMonths?: number;
140
140
  temperSignaturesTest?: boolean;
141
+ /**
142
+ * Optional in-process notification sink invoked alongside the existing service-mode
143
+ * HTTP relay. Fires in BOTH `standalone` and `service` mode so consumers can observe
144
+ * lifecycle events (e.g. loan renewal, mint, payment, withdrawal) without depending
145
+ * on `lit-ops-server`. The SDK already emits messages via `formatLoan*Message` helpers
146
+ * — this hook just exposes them locally. Errors thrown by the handler are swallowed
147
+ * so notification failures cannot break business operations.
148
+ *
149
+ * @example
150
+ * const notifications: string[] = [];
151
+ * sdkConfig.notificationHandler = (msg) => { notifications.push(msg); };
152
+ */
153
+ notificationHandler?: (message: string) => void | Promise<void>;
141
154
  }
142
155
  /**
143
156
  * Service Mode Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.221",
3
+ "version": "0.0.222",
4
4
  "description": "TypeScript SDK for Diamond Hands Protocol - Bitcoin-backed lending with LIT Protocol PKPs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",