@gvnrdao/dh-sdk 0.0.331 → 0.0.332

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
@@ -10264,6 +10264,10 @@ function normalizePkpId(pkpId) {
10264
10264
  }
10265
10265
  return pkpId;
10266
10266
  }
10267
+ function isNormalizedChipotlePkpId(pkpId) {
10268
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
10269
+ return rawId.length === 40;
10270
+ }
10267
10271
  function padPkpIdForSubgraph(pkpId) {
10268
10272
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
10269
10273
  if (raw.length === 40) {
@@ -10548,7 +10552,7 @@ var LoanQuery = class {
10548
10552
  batch.map(async (loan) => {
10549
10553
  try {
10550
10554
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
10551
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
10555
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
10552
10556
  if (isChipotlePkpId2) {
10553
10557
  if (this.config.positionManagerCoreAddress && this.config.provider) {
10554
10558
  const pmContract = new import_ethers12.Contract(
package/dist/index.mjs CHANGED
@@ -10181,6 +10181,10 @@ function normalizePkpId(pkpId) {
10181
10181
  }
10182
10182
  return pkpId;
10183
10183
  }
10184
+ function isNormalizedChipotlePkpId(pkpId) {
10185
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
10186
+ return rawId.length === 40;
10187
+ }
10184
10188
  function padPkpIdForSubgraph(pkpId) {
10185
10189
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
10186
10190
  if (raw.length === 40) {
@@ -10465,7 +10469,7 @@ var LoanQuery = class {
10465
10469
  batch.map(async (loan) => {
10466
10470
  try {
10467
10471
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
10468
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
10472
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
10469
10473
  if (isChipotlePkpId2) {
10470
10474
  if (this.config.positionManagerCoreAddress && this.config.provider) {
10471
10475
  const pmContract = new Contract4(
@@ -17,6 +17,14 @@ import type { LoanData, LoanDataDetail, PaginatedLoansResponse } from "../../int
17
17
  import type { LoanEvents, LoanEventsFilter } from "../../types/event-types";
18
18
  import { DiamondHandsGraphClient } from "@graphs/diamond-hands";
19
19
  import { type Provider } from "ethers";
20
+ /**
21
+ * After `normalizePkpId`, a Chipotle PKP id is a plain 20-byte ETH address
22
+ * (40 hex). Length is the whole discriminator: legacy token ids and still-padded
23
+ * bytes32 ids are 64 hex, compressed keys 66, uncompressed keys 130. A leading
24
+ * `04` on a 40-hex id is an address byte, not the uncompressed-pubkey prefix —
25
+ * excluding it silently dropped the vault for every PKP address starting `0x04`.
26
+ */
27
+ export declare function isNormalizedChipotlePkpId(pkpId: string): boolean;
20
28
  /**
21
29
  * Loan query filters
22
30
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.331",
3
+ "version": "0.0.332",
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",