@gvnrdao/dh-sdk 0.0.297 → 0.0.299

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.
@@ -136,9 +136,9 @@ var SEPOLIA_DEPLOYMENT = {
136
136
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
137
137
  },
138
138
  CollateralManagerModule: {
139
- previousImplementation: "0xd47FE9126daE9A1e0fFdaCf539BE7345D3642bcb",
140
- newImplementation: "0xC232E95951303828CF66eaf76181A7956144d27a",
141
- upgradedAt: "2026-07-03T20:00:13.567Z",
139
+ previousImplementation: "0xCf5d2b210C8e30bE8e05bFC79593b9439b8b9670",
140
+ newImplementation: "0xF57BBbb4818371605e308228A04F8Ec4Dcc5E7Ba",
141
+ upgradedAt: "2026-07-07T16:59:13.883Z",
142
142
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
143
143
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
144
144
  },
@@ -214,6 +214,13 @@ var SEPOLIA_DEPLOYMENT = {
214
214
  upgradedAt: "2026-05-27T12:16:13.356Z",
215
215
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
216
216
  reason: "Audit C-7: BitcoinProviderRegistry v1.0.0 \u2192 v1.1.0 \u2014 per-chainId CID allowlist (addAllowedCid / removeAllowedCid / isAllowedCid views). Storage gap 46 \u2192 43."
217
+ },
218
+ BitcoinWithdrawalAddressRegistry: {
219
+ previousImplementation: "0xFF270BC4470dBA80430Bd1a3a66EB691599354fA",
220
+ newImplementation: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
221
+ upgradedAt: "2026-07-07T16:56:49.844Z",
222
+ upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
223
+ reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
217
224
  }
218
225
  },
219
226
  history: {
@@ -262,6 +269,7 @@ var SEPOLIA_DEPLOYMENT = {
262
269
  UCD_CONTROLLER: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
263
270
  POSITION_MANAGER: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
264
271
  PKP_VALIDATION_REGISTRY: "0x8a1365A974F91e92D2dF5C51216EFCD408e209A8",
272
+ PKP_VALIDATION_REGISTRY_IMPL: "0x4f752c8c00b75d925CC9C7e693e1D9E45B6D195d",
265
273
  PKP_VALIDATION_CID_V1: "0x1220246b43f71828ed1cfdc455b6bd4fd9e7382251ea634589f8da9b12f61d40cd51",
266
274
  PKP_ETH_ADDRESS: "0x9624C46073E1d1F5AB975c67Fc899536d599bb57",
267
275
  OPERATION_AUTHORIZATION_REGISTRY: "0x75f36E772df9616d40b02092642744D6fd702Df8",
@@ -103,9 +103,9 @@ var SEPOLIA_DEPLOYMENT = {
103
103
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
104
104
  },
105
105
  CollateralManagerModule: {
106
- previousImplementation: "0xd47FE9126daE9A1e0fFdaCf539BE7345D3642bcb",
107
- newImplementation: "0xC232E95951303828CF66eaf76181A7956144d27a",
108
- upgradedAt: "2026-07-03T20:00:13.567Z",
106
+ previousImplementation: "0xCf5d2b210C8e30bE8e05bFC79593b9439b8b9670",
107
+ newImplementation: "0xF57BBbb4818371605e308228A04F8Ec4Dcc5E7Ba",
108
+ upgradedAt: "2026-07-07T16:59:13.883Z",
109
109
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
110
110
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
111
111
  },
@@ -181,6 +181,13 @@ var SEPOLIA_DEPLOYMENT = {
181
181
  upgradedAt: "2026-05-27T12:16:13.356Z",
182
182
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
183
183
  reason: "Audit C-7: BitcoinProviderRegistry v1.0.0 \u2192 v1.1.0 \u2014 per-chainId CID allowlist (addAllowedCid / removeAllowedCid / isAllowedCid views). Storage gap 46 \u2192 43."
184
+ },
185
+ BitcoinWithdrawalAddressRegistry: {
186
+ previousImplementation: "0xFF270BC4470dBA80430Bd1a3a66EB691599354fA",
187
+ newImplementation: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
188
+ upgradedAt: "2026-07-07T16:56:49.844Z",
189
+ upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
190
+ reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
184
191
  }
185
192
  },
186
193
  history: {
@@ -229,6 +236,7 @@ var SEPOLIA_DEPLOYMENT = {
229
236
  UCD_CONTROLLER: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
230
237
  POSITION_MANAGER: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
231
238
  PKP_VALIDATION_REGISTRY: "0x8a1365A974F91e92D2dF5C51216EFCD408e209A8",
239
+ PKP_VALIDATION_REGISTRY_IMPL: "0x4f752c8c00b75d925CC9C7e693e1D9E45B6D195d",
232
240
  PKP_VALIDATION_CID_V1: "0x1220246b43f71828ed1cfdc455b6bd4fd9e7382251ea634589f8da9b12f61d40cd51",
233
241
  PKP_ETH_ADDRESS: "0x9624C46073E1d1F5AB975c67Fc899536d599bb57",
234
242
  OPERATION_AUTHORIZATION_REGISTRY: "0x75f36E772df9616d40b02092642744D6fd702Df8",
package/dist/index.js CHANGED
@@ -161,9 +161,9 @@ var init_deployment_addresses = __esm({
161
161
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
162
162
  },
163
163
  CollateralManagerModule: {
164
- previousImplementation: "0xd47FE9126daE9A1e0fFdaCf539BE7345D3642bcb",
165
- newImplementation: "0xC232E95951303828CF66eaf76181A7956144d27a",
166
- upgradedAt: "2026-07-03T20:00:13.567Z",
164
+ previousImplementation: "0xCf5d2b210C8e30bE8e05bFC79593b9439b8b9670",
165
+ newImplementation: "0xF57BBbb4818371605e308228A04F8Ec4Dcc5E7Ba",
166
+ upgradedAt: "2026-07-07T16:59:13.883Z",
167
167
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
168
168
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
169
169
  },
@@ -239,6 +239,13 @@ var init_deployment_addresses = __esm({
239
239
  upgradedAt: "2026-05-27T12:16:13.356Z",
240
240
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
241
241
  reason: "Audit C-7: BitcoinProviderRegistry v1.0.0 \u2192 v1.1.0 \u2014 per-chainId CID allowlist (addAllowedCid / removeAllowedCid / isAllowedCid views). Storage gap 46 \u2192 43."
242
+ },
243
+ BitcoinWithdrawalAddressRegistry: {
244
+ previousImplementation: "0xFF270BC4470dBA80430Bd1a3a66EB691599354fA",
245
+ newImplementation: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
246
+ upgradedAt: "2026-07-07T16:56:49.844Z",
247
+ upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
248
+ reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
242
249
  }
243
250
  },
244
251
  history: {
@@ -287,6 +294,7 @@ var init_deployment_addresses = __esm({
287
294
  UCD_CONTROLLER: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
288
295
  POSITION_MANAGER: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
289
296
  PKP_VALIDATION_REGISTRY: "0x8a1365A974F91e92D2dF5C51216EFCD408e209A8",
297
+ PKP_VALIDATION_REGISTRY_IMPL: "0x4f752c8c00b75d925CC9C7e693e1D9E45B6D195d",
290
298
  PKP_VALIDATION_CID_V1: "0x1220246b43f71828ed1cfdc455b6bd4fd9e7382251ea634589f8da9b12f61d40cd51",
291
299
  PKP_ETH_ADDRESS: "0x9624C46073E1d1F5AB975c67Fc899536d599bb57",
292
300
  OPERATION_AUTHORIZATION_REGISTRY: "0x75f36E772df9616d40b02092642744D6fd702Df8",
@@ -15957,8 +15965,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
15957
15965
  };
15958
15966
  }
15959
15967
  }
15960
- const network2 = await this.getProviderOrThrow().getNetwork();
15961
- const chainId = Number(network2.chainId);
15968
+ const network = await this.getProviderOrThrow().getNetwork();
15969
+ const chainId = Number(network.chainId);
15962
15970
  const signer2 = this.getSignerOrThrow();
15963
15971
  const contracts = {
15964
15972
  PositionManager: this.config.contractAddresses?.positionManager || "",
@@ -15986,10 +15994,10 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
15986
15994
  ` UCDController: ${contracts?.UCDController || "MISSING"}`
15987
15995
  );
15988
15996
  }
15989
- const chain = this.config.chain || (Number(network2.chainId) === 1 ? "ethereum" : "sepolia");
15997
+ const chain = this.config.chain || (Number(network.chainId) === 1 ? "ethereum" : "sepolia");
15990
15998
  const devBitcoinProviderUrl = request.customBitcoinRpcUrl || this.config.bitcoinProviders?.[0]?.url;
15991
15999
  if (this.config.debug) {
15992
- log.info(` Network: ${chain} (chainId: ${network2.chainId})`);
16000
+ log.info(` Network: ${chain} (chainId: ${network.chainId})`);
15993
16001
  }
15994
16002
  const MAX_RETRIES = 3;
15995
16003
  const RETRY_DELAY_MS = 2e3;
@@ -16612,10 +16620,6 @@ Position: ${request.positionId}`
16612
16620
  if (!signerProvider) {
16613
16621
  throw new Error("Signer must have a provider attached");
16614
16622
  }
16615
- const network = await signerProvider.getNetwork();
16616
- const networkChainIdNum = Number(network.chainId);
16617
- const isSepolia = networkChainIdNum === 11155111;
16618
- const isLocalhost = networkChainIdNum === 1337 || networkChainIdNum === 31337;
16619
16623
  const MAX_SKEW_SECONDS = 300;
16620
16624
  const FINAL_SAFETY_MARGIN = 60;
16621
16625
  const QUANTUM_WINDOW_SECONDS2 = 60;
@@ -16818,24 +16822,18 @@ Message: ${errorMessage}`
16818
16822
  Error data: ${errorData || "none"}`
16819
16823
  );
16820
16824
  }
16821
- if (isSepolia || isLocalhost) {
16822
- if (this.config.debug) {
16823
- log.info(
16824
- "\u2705 Static call OK \u2014 broadcasting mintUCD with gas ceiling (Sepolia)",
16825
- {}
16826
- );
16827
- }
16828
- tx = await sendEip1559Transaction({
16829
- signer,
16830
- to: positionManagerAddress,
16831
- data: mintCalldata,
16832
- gasLimit: MINT_UCD_GAS_CEILING
16833
- });
16834
- } else {
16835
- throw new Error(
16836
- `mintUCD: eth_estimateGas failed (chainId ${network.chainId}). Static call succeeded; fixed gas ceiling fallback is only supported on Sepolia (11155111) and localhost.`
16825
+ if (this.config.debug) {
16826
+ log.info(
16827
+ "\u2705 Static call OK \u2014 broadcasting mintUCD with fixed gas ceiling",
16828
+ {}
16837
16829
  );
16838
16830
  }
16831
+ tx = await sendEip1559Transaction({
16832
+ signer,
16833
+ to: positionManagerAddress,
16834
+ data: mintCalldata,
16835
+ gasLimit: MINT_UCD_GAS_CEILING
16836
+ });
16839
16837
  }
16840
16838
  const receipt = await signerProvider.waitForTransaction(
16841
16839
  tx.hash,
package/dist/index.mjs CHANGED
@@ -167,9 +167,9 @@ var init_deployment_addresses = __esm({
167
167
  reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
168
168
  },
169
169
  CollateralManagerModule: {
170
- previousImplementation: "0xd47FE9126daE9A1e0fFdaCf539BE7345D3642bcb",
171
- newImplementation: "0xC232E95951303828CF66eaf76181A7956144d27a",
172
- upgradedAt: "2026-07-03T20:00:13.567Z",
170
+ previousImplementation: "0xCf5d2b210C8e30bE8e05bFC79593b9439b8b9670",
171
+ newImplementation: "0xF57BBbb4818371605e308228A04F8Ec4Dcc5E7Ba",
172
+ upgradedAt: "2026-07-07T16:59:13.883Z",
173
173
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
174
174
  reason: "Shared upgrade script: CollateralManagerModule implementation update"
175
175
  },
@@ -245,6 +245,13 @@ var init_deployment_addresses = __esm({
245
245
  upgradedAt: "2026-05-27T12:16:13.356Z",
246
246
  upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
247
247
  reason: "Audit C-7: BitcoinProviderRegistry v1.0.0 \u2192 v1.1.0 \u2014 per-chainId CID allowlist (addAllowedCid / removeAllowedCid / isAllowedCid views). Storage gap 46 \u2192 43."
248
+ },
249
+ BitcoinWithdrawalAddressRegistry: {
250
+ previousImplementation: "0xFF270BC4470dBA80430Bd1a3a66EB691599354fA",
251
+ newImplementation: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
252
+ upgradedAt: "2026-07-07T16:56:49.844Z",
253
+ upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
254
+ reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
248
255
  }
249
256
  },
250
257
  history: {
@@ -293,6 +300,7 @@ var init_deployment_addresses = __esm({
293
300
  UCD_CONTROLLER: "0x360Bde4e489ee94E26601B206932De09EE60FF04",
294
301
  POSITION_MANAGER: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
295
302
  PKP_VALIDATION_REGISTRY: "0x8a1365A974F91e92D2dF5C51216EFCD408e209A8",
303
+ PKP_VALIDATION_REGISTRY_IMPL: "0x4f752c8c00b75d925CC9C7e693e1D9E45B6D195d",
296
304
  PKP_VALIDATION_CID_V1: "0x1220246b43f71828ed1cfdc455b6bd4fd9e7382251ea634589f8da9b12f61d40cd51",
297
305
  PKP_ETH_ADDRESS: "0x9624C46073E1d1F5AB975c67Fc899536d599bb57",
298
306
  OPERATION_AUTHORIZATION_REGISTRY: "0x75f36E772df9616d40b02092642744D6fd702Df8",
@@ -15885,8 +15893,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
15885
15893
  };
15886
15894
  }
15887
15895
  }
15888
- const network2 = await this.getProviderOrThrow().getNetwork();
15889
- const chainId = Number(network2.chainId);
15896
+ const network = await this.getProviderOrThrow().getNetwork();
15897
+ const chainId = Number(network.chainId);
15890
15898
  const signer2 = this.getSignerOrThrow();
15891
15899
  const contracts = {
15892
15900
  PositionManager: this.config.contractAddresses?.positionManager || "",
@@ -15914,10 +15922,10 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
15914
15922
  ` UCDController: ${contracts?.UCDController || "MISSING"}`
15915
15923
  );
15916
15924
  }
15917
- const chain = this.config.chain || (Number(network2.chainId) === 1 ? "ethereum" : "sepolia");
15925
+ const chain = this.config.chain || (Number(network.chainId) === 1 ? "ethereum" : "sepolia");
15918
15926
  const devBitcoinProviderUrl = request.customBitcoinRpcUrl || this.config.bitcoinProviders?.[0]?.url;
15919
15927
  if (this.config.debug) {
15920
- log.info(` Network: ${chain} (chainId: ${network2.chainId})`);
15928
+ log.info(` Network: ${chain} (chainId: ${network.chainId})`);
15921
15929
  }
15922
15930
  const MAX_RETRIES = 3;
15923
15931
  const RETRY_DELAY_MS = 2e3;
@@ -16540,10 +16548,6 @@ Position: ${request.positionId}`
16540
16548
  if (!signerProvider) {
16541
16549
  throw new Error("Signer must have a provider attached");
16542
16550
  }
16543
- const network = await signerProvider.getNetwork();
16544
- const networkChainIdNum = Number(network.chainId);
16545
- const isSepolia = networkChainIdNum === 11155111;
16546
- const isLocalhost = networkChainIdNum === 1337 || networkChainIdNum === 31337;
16547
16551
  const MAX_SKEW_SECONDS = 300;
16548
16552
  const FINAL_SAFETY_MARGIN = 60;
16549
16553
  const QUANTUM_WINDOW_SECONDS2 = 60;
@@ -16746,24 +16750,18 @@ Message: ${errorMessage}`
16746
16750
  Error data: ${errorData || "none"}`
16747
16751
  );
16748
16752
  }
16749
- if (isSepolia || isLocalhost) {
16750
- if (this.config.debug) {
16751
- log.info(
16752
- "\u2705 Static call OK \u2014 broadcasting mintUCD with gas ceiling (Sepolia)",
16753
- {}
16754
- );
16755
- }
16756
- tx = await sendEip1559Transaction({
16757
- signer,
16758
- to: positionManagerAddress,
16759
- data: mintCalldata,
16760
- gasLimit: MINT_UCD_GAS_CEILING
16761
- });
16762
- } else {
16763
- throw new Error(
16764
- `mintUCD: eth_estimateGas failed (chainId ${network.chainId}). Static call succeeded; fixed gas ceiling fallback is only supported on Sepolia (11155111) and localhost.`
16753
+ if (this.config.debug) {
16754
+ log.info(
16755
+ "\u2705 Static call OK \u2014 broadcasting mintUCD with fixed gas ceiling",
16756
+ {}
16765
16757
  );
16766
16758
  }
16759
+ tx = await sendEip1559Transaction({
16760
+ signer,
16761
+ to: positionManagerAddress,
16762
+ data: mintCalldata,
16763
+ gasLimit: MINT_UCD_GAS_CEILING
16764
+ });
16767
16765
  }
16768
16766
  const receipt = await signerProvider.waitForTransaction(
16769
16767
  tx.hash,
@@ -8,8 +8,9 @@ import { type Provider, type Signer, type TransactionResponse } from "ethers";
8
8
  * estimateContractCallGasWithMargin() (real eth_estimateGas + 25% margin) on
9
9
  * mainnet, so this value is NOT normally what gets submitted -- it only
10
10
  * becomes the literal gasLimit if (a) the estimate comes back anomalously
11
- * high, or (b) eth_estimateGas itself fails, which is a hard error on
12
- * mainnet and only falls back to this raw value on Sepolia/localhost.
11
+ * high, or (b) eth_estimateGas itself fails (some RPCs return bare 0x even
12
+ * for valid txs), in which case after a static call proves the tx valid —
13
+ * this raw value is used as the gasLimit on any chain.
13
14
  * Previously 10,000,000 with a comment claiming "mintUCD + LIT validation
14
15
  * can exceed 7M gas" -- no evidence of that was found across 16 real mint
15
16
  * transactions checked (1 mainnet, 15 recent Sepolia, 2026-07-02): the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.297",
3
+ "version": "0.0.299",
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",
@@ -9,8 +9,11 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "browser": "./browser/dist/browser.js",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js"
12
+ "node": {
13
+ "import": "./dist/index.mjs",
14
+ "require": "./dist/index.js"
15
+ },
16
+ "default": "./browser/dist/browser.js"
14
17
  },
15
18
  "./browser": {
16
19
  "types": "./dist/index.d.ts",
@@ -48,7 +51,7 @@
48
51
  "typecheck:strict": "tsc --noEmit -p tsconfig.strict.json",
49
52
  "test:types": "tsc --noEmit -p tsconfig.types.json",
50
53
  "prepublishOnly": "npm run sync:deployments && npm run validate:contracts && npm run build:all",
51
- "postbuild:browser": "grep -qE 'require\\(\"http\"\\)|require\\(\"https\"\\)|require\\(\"fs\"\\)' browser/dist/browser.js && echo 'ERROR: Node built-ins found in browser bundle' && exit 1 || true",
54
+ "postbuild:browser": "grep -qE 'require\\(\"[^\"]+\"\\)|typeof require' browser/dist/browser.js && echo 'ERROR: unresolved runtime require() in browser bundle - it must be fully self-contained (a typeof-require hit means esbuild __require escape hatch leaked through; see browser/require-rewrite-loader.js)' && exit 1 || true",
52
55
  "test": "jest",
53
56
  "test:unit": "jest tests/shared/unit",
54
57
  "test:integration": "jest tests/shared/integration",