@gvnrdao/dh-sdk 0.0.273 → 0.0.274

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.
@@ -5,7 +5,7 @@
5
5
  * @license MIT
6
6
  */
7
7
 
8
- /*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
8
+ /*! Axios v1.17.0 Copyright (c) 2026 Matt Zabriskie and contributors */
9
9
 
10
10
  /*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
11
11
 
package/dist/index.js CHANGED
@@ -31391,17 +31391,17 @@ var require_pkg_src = __commonJS({
31391
31391
  hash: "b7e4abec403555d85e2b0eaabed0fdd95640b5f0d068c67bba63afaa2cd200d0"
31392
31392
  },
31393
31393
  ucdMintValidator: {
31394
- cid: "QmdfotNWFe9at78piu4zKqN1Hk6GDY97ofC8YWABoRxNTz",
31394
+ cid: "QmUtDgwYFqbLhhBkhRfHRTN51SyHm1CHcCQU2qUvpCzpfc",
31395
31395
  authorizedCidHex: cidToHex(
31396
- "QmdfotNWFe9at78piu4zKqN1Hk6GDY97ofC8YWABoRxNTz"
31396
+ "QmUtDgwYFqbLhhBkhRfHRTN51SyHm1CHcCQU2qUvpCzpfc"
31397
31397
  ),
31398
31398
  name: "Ucd Mint Validator",
31399
31399
  description: "Production Ucd Mint Validator",
31400
31400
  version: "1.0.0",
31401
31401
  deployed: true,
31402
- deployedAt: 1780420101129,
31403
- size: 67513,
31404
- hash: "6918134d5daa56f01e3077e0716976103bd2d4ff3efddc8c2e388484953eb1fa",
31402
+ deployedAt: 1780485728736,
31403
+ size: 67380,
31404
+ hash: "901f0ec80a04cb9daad84c35c69bcf0dc8892a05ae9431a23c1855e1ab9aed9d",
31405
31405
  validatorWalletAddress: "0x36f3dd61c4c08a56d29ed2fd6d5f111b67b6a7a1",
31406
31406
  pkp: {
31407
31407
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -31523,17 +31523,17 @@ var require_pkg_src = __commonJS({
31523
31523
  // Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
31524
31524
  // on each target chain (the action decrypts registry slots). No OAR entry.
31525
31525
  btcAddressBalance: {
31526
- cid: "QmdF7eMxEc4UxFYPXhzyZ9dLkLeVwQNCfPrmirP1BGdSvT",
31526
+ cid: "QmdBMy7Niz4Vsgbmh1Pm3aXK8PL3uJwS7GDeoCKd8Yuua6",
31527
31527
  authorizedCidHex: cidToHex(
31528
- "QmdF7eMxEc4UxFYPXhzyZ9dLkLeVwQNCfPrmirP1BGdSvT"
31528
+ "QmdBMy7Niz4Vsgbmh1Pm3aXK8PL3uJwS7GDeoCKd8Yuua6"
31529
31529
  ),
31530
31530
  name: "Btc Address Balance",
31531
31531
  description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
31532
31532
  version: "0.1.0",
31533
31533
  deployed: true,
31534
- deployedAt: 1780425819676,
31535
- size: 21664,
31536
- hash: "89936009f1de066e41234de5a28a75ca31ce0b2ae9c7f47f299c995b8e112599",
31534
+ deployedAt: 1780485650442,
31535
+ size: 21864,
31536
+ hash: "8369701c40e742ec54d34fec373f21cfd75f5dfd3ece4bc5358c7566032e7605",
31537
31537
  validatorWalletAddress: "0xf0bf5e3f864b87283a05d1e4a85ee0fa40493fb5",
31538
31538
  pkp: {
31539
31539
  publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
@@ -34722,7 +34722,13 @@ function getSepoliaConfig() {
34722
34722
  // env missing; browser: always), so downstream validateServiceModeConfig throws.
34723
34723
  // Node consumers must set LIT_OPS_ENDPOINT; browser apps pass serviceEndpoint
34724
34724
  // explicitly from decrypted /v1/init (user config still wins over this).
34725
- serviceEndpoint: readInitBackedEnv("LIT_OPS_ENDPOINT"),
34725
+ // Lazy getter — resolved at access time, NOT captured at module-init.
34726
+ // Reading the env var once at module load would freeze it empty when
34727
+ // LIT_OPS_ENDPOINT is set after import (late-loaded dotenv, test setup),
34728
+ // leaving Sepolia serviceEndpoint permanently "".
34729
+ get serviceEndpoint() {
34730
+ return readInitBackedEnv("LIT_OPS_ENDPOINT");
34731
+ },
34726
34732
  chainId: 11155111,
34727
34733
  name: "sepolia",
34728
34734
  rpcUrls: [],
@@ -34750,7 +34756,10 @@ function getSepoliaConfig() {
34750
34756
  positionDelegateRegistry: SEPOLIA_CONTRACTS.PositionDelegateRegistry || ""
34751
34757
  },
34752
34758
  subgraphs: {
34753
- diamondHandsUrl: readInitBackedEnv("SUBGRAPH_URL")
34759
+ // Lazy getter for the same module-init snapshot reason as serviceEndpoint.
34760
+ get diamondHandsUrl() {
34761
+ return readInitBackedEnv("SUBGRAPH_URL");
34762
+ }
34754
34763
  },
34755
34764
  debug: true
34756
34765
  };
@@ -34883,13 +34892,13 @@ function getAllNetworkConfigs() {
34883
34892
  function isNetworkSupported(chainId) {
34884
34893
  return chainId in NETWORK_CONFIGS;
34885
34894
  }
34886
- var isBrowser, isNode2, fs, path, CONTRACTS_PATH, DEPLOYMENTS_PATH, NETWORK_CONFIGS, DEFAULT_NETWORK_CONFIG;
34895
+ var isNode2, isBrowser, fs, path, CONTRACTS_PATH, DEPLOYMENTS_PATH, NETWORK_CONFIGS, DEFAULT_NETWORK_CONFIG;
34887
34896
  var init_network_configs = __esm({
34888
34897
  "src/constants/chunks/network-configs.ts"() {
34889
34898
  "use strict";
34890
34899
  init_deployment_addresses();
34891
- isBrowser = typeof window !== "undefined" || typeof global === "undefined" && typeof process === "undefined" || typeof navigator !== "undefined" && navigator.userAgent;
34892
- isNode2 = typeof process !== "undefined" && process.versions && process.versions.node && !isBrowser;
34900
+ isNode2 = !!(typeof process !== "undefined" && process.versions && process.versions.node);
34901
+ isBrowser = !isNode2 && (typeof window !== "undefined" || typeof global === "undefined" && typeof process === "undefined" || typeof navigator !== "undefined" && !!navigator.userAgent);
34893
34902
  fs = void 0;
34894
34903
  path = void 0;
34895
34904
  if (isNode2 && !isBrowser) {
@@ -110755,6 +110764,19 @@ function createLoanCreator(config) {
110755
110764
  }
110756
110765
  }
110757
110766
 
110767
+ // src/types/loanStatus.ts
110768
+ var LoanStatus = /* @__PURE__ */ ((LoanStatus2) => {
110769
+ LoanStatus2[LoanStatus2["PENDING_DEPOSIT"] = 0] = "PENDING_DEPOSIT";
110770
+ LoanStatus2[LoanStatus2["PENDING_MINT"] = 1] = "PENDING_MINT";
110771
+ LoanStatus2[LoanStatus2["ACTIVE"] = 2] = "ACTIVE";
110772
+ LoanStatus2[LoanStatus2["EXPIRED"] = 3] = "EXPIRED";
110773
+ LoanStatus2[LoanStatus2["LIQUIDATABLE"] = 4] = "LIQUIDATABLE";
110774
+ LoanStatus2[LoanStatus2["LIQUIDATED"] = 5] = "LIQUIDATED";
110775
+ LoanStatus2[LoanStatus2["REPAID"] = 6] = "REPAID";
110776
+ LoanStatus2[LoanStatus2["CLOSED"] = 7] = "CLOSED";
110777
+ return LoanStatus2;
110778
+ })(LoanStatus || {});
110779
+
110758
110780
  // src/modules/loan/loan-query.module.ts
110759
110781
  var POSITION_CORE_ABI = [
110760
110782
  "function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status, uint40 previousExpiryAt, uint16 totalTerm))"
@@ -111117,44 +111139,22 @@ var LoanQuery = class {
111117
111139
  * Map numeric status to string for subgraph queries
111118
111140
  */
111119
111141
  mapStatusToString(status) {
111120
- const statusMap = {
111121
- 0: "PENDING_DEPOSIT",
111122
- 1: "ACTIVE",
111123
- 2: "EXPIRED",
111124
- 3: "REPAID",
111125
- 4: "LIQUIDATED",
111126
- 5: "EXTENDED"
111127
- };
111128
- return statusMap[status] || "ACTIVE";
111142
+ return LoanStatus[status] ?? "ACTIVE";
111129
111143
  }
111130
111144
  /**
111131
111145
  * Map string status to numeric for filtering
111132
111146
  */
111133
111147
  mapStringToStatus(statusString) {
111134
- const statusMap = {
111135
- PENDING_DEPOSIT: 0,
111136
- ACTIVE: 1,
111137
- EXPIRED: 2,
111138
- REPAID: 3,
111139
- LIQUIDATED: 4,
111140
- EXTENDED: 5
111141
- };
111142
- return statusMap[statusString.toUpperCase()] ?? null;
111148
+ const key = statusString.toUpperCase();
111149
+ const value = LoanStatus[key];
111150
+ return typeof value === "number" ? value : null;
111143
111151
  }
111144
111152
  /**
111145
111153
  * Validate if a string is a valid loan status
111146
111154
  */
111147
111155
  isValidStatus(statusString) {
111148
- const validStatuses = [
111149
- "PENDING_DEPOSIT",
111150
- "ACTIVE",
111151
- "EXPIRED",
111152
- "REPAID",
111153
- "LIQUIDATED",
111154
- "EXTENDED",
111155
- "CLOSED"
111156
- ];
111157
- return validStatuses.includes(statusString.toUpperCase());
111156
+ const key = statusString.toUpperCase();
111157
+ return typeof LoanStatus[key] === "number";
111158
111158
  }
111159
111159
  /**
111160
111160
  * Get loans for a borrower
@@ -111167,18 +111167,18 @@ var LoanQuery = class {
111167
111167
  return this.getLoans({ borrower, orderBy, orderDirection }, pagination);
111168
111168
  }
111169
111169
  /**
111170
- * Get active loans (status = 0)
111170
+ * Get active loans (status = ACTIVE)
111171
111171
  *
111172
111172
  * @param pagination - Pagination parameters
111173
111173
  * @returns Paginated active loans
111174
111174
  */
111175
111175
  async getActiveLoans(pagination) {
111176
- return this.getLoans({ status: 0 }, pagination);
111176
+ return this.getLoans({ status: 2 /* ACTIVE */ }, pagination);
111177
111177
  }
111178
111178
  /**
111179
111179
  * Get loans by state/status
111180
111180
  *
111181
- * @param state - Loan state (PENDING_DEPOSIT, ACTIVE, EXPIRED, REPAID, LIQUIDATED, EXTENDED, CLOSED)
111181
+ * @param state - Loan state (PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED)
111182
111182
  * @param pagination - Pagination parameters
111183
111183
  * @returns Paginated loans matching the specified state
111184
111184
  */
@@ -111186,7 +111186,7 @@ var LoanQuery = class {
111186
111186
  if (!this.isValidStatus(state)) {
111187
111187
  return failure(
111188
111188
  new SDKError({
111189
- message: `Invalid loan state: ${state}. Valid states are: PENDING_DEPOSIT, ACTIVE, EXPIRED, REPAID, LIQUIDATED, EXTENDED, CLOSED`,
111189
+ message: `Invalid loan state: ${state}. Valid states are: PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED`,
111190
111190
  category: "VALIDATION" /* VALIDATION */,
111191
111191
  severity: "LOW" /* LOW */,
111192
111192
  context: { state }
@@ -117169,19 +117169,6 @@ async function safeWaitForTransaction(tx, confirmations = 1, timeout = 6e4) {
117169
117169
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
117170
117170
  }
117171
117171
 
117172
- // src/types/loanStatus.ts
117173
- var LoanStatus = /* @__PURE__ */ ((LoanStatus2) => {
117174
- LoanStatus2[LoanStatus2["PENDING_DEPOSIT"] = 0] = "PENDING_DEPOSIT";
117175
- LoanStatus2[LoanStatus2["PENDING_MINT"] = 1] = "PENDING_MINT";
117176
- LoanStatus2[LoanStatus2["ACTIVE"] = 2] = "ACTIVE";
117177
- LoanStatus2[LoanStatus2["EXPIRED"] = 3] = "EXPIRED";
117178
- LoanStatus2[LoanStatus2["LIQUIDATABLE"] = 4] = "LIQUIDATABLE";
117179
- LoanStatus2[LoanStatus2["LIQUIDATED"] = 5] = "LIQUIDATED";
117180
- LoanStatus2[LoanStatus2["REPAID"] = 6] = "REPAID";
117181
- LoanStatus2[LoanStatus2["CLOSED"] = 7] = "CLOSED";
117182
- return LoanStatus2;
117183
- })(LoanStatus || {});
117184
-
117185
117172
  // src/modules/diamond-hands-sdk.ts
117186
117173
  var DiamondHandsSDK = class _DiamondHandsSDK {
117187
117174
  config;
package/dist/index.mjs CHANGED
@@ -31397,17 +31397,17 @@ var require_pkg_src = __commonJS({
31397
31397
  hash: "b7e4abec403555d85e2b0eaabed0fdd95640b5f0d068c67bba63afaa2cd200d0"
31398
31398
  },
31399
31399
  ucdMintValidator: {
31400
- cid: "QmdfotNWFe9at78piu4zKqN1Hk6GDY97ofC8YWABoRxNTz",
31400
+ cid: "QmUtDgwYFqbLhhBkhRfHRTN51SyHm1CHcCQU2qUvpCzpfc",
31401
31401
  authorizedCidHex: cidToHex(
31402
- "QmdfotNWFe9at78piu4zKqN1Hk6GDY97ofC8YWABoRxNTz"
31402
+ "QmUtDgwYFqbLhhBkhRfHRTN51SyHm1CHcCQU2qUvpCzpfc"
31403
31403
  ),
31404
31404
  name: "Ucd Mint Validator",
31405
31405
  description: "Production Ucd Mint Validator",
31406
31406
  version: "1.0.0",
31407
31407
  deployed: true,
31408
- deployedAt: 1780420101129,
31409
- size: 67513,
31410
- hash: "6918134d5daa56f01e3077e0716976103bd2d4ff3efddc8c2e388484953eb1fa",
31408
+ deployedAt: 1780485728736,
31409
+ size: 67380,
31410
+ hash: "901f0ec80a04cb9daad84c35c69bcf0dc8892a05ae9431a23c1855e1ab9aed9d",
31411
31411
  validatorWalletAddress: "0x36f3dd61c4c08a56d29ed2fd6d5f111b67b6a7a1",
31412
31412
  pkp: {
31413
31413
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -31529,17 +31529,17 @@ var require_pkg_src = __commonJS({
31529
31529
  // Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
31530
31530
  // on each target chain (the action decrypts registry slots). No OAR entry.
31531
31531
  btcAddressBalance: {
31532
- cid: "QmdF7eMxEc4UxFYPXhzyZ9dLkLeVwQNCfPrmirP1BGdSvT",
31532
+ cid: "QmdBMy7Niz4Vsgbmh1Pm3aXK8PL3uJwS7GDeoCKd8Yuua6",
31533
31533
  authorizedCidHex: cidToHex(
31534
- "QmdF7eMxEc4UxFYPXhzyZ9dLkLeVwQNCfPrmirP1BGdSvT"
31534
+ "QmdBMy7Niz4Vsgbmh1Pm3aXK8PL3uJwS7GDeoCKd8Yuua6"
31535
31535
  ),
31536
31536
  name: "Btc Address Balance",
31537
31537
  description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
31538
31538
  version: "0.1.0",
31539
31539
  deployed: true,
31540
- deployedAt: 1780425819676,
31541
- size: 21664,
31542
- hash: "89936009f1de066e41234de5a28a75ca31ce0b2ae9c7f47f299c995b8e112599",
31540
+ deployedAt: 1780485650442,
31541
+ size: 21864,
31542
+ hash: "8369701c40e742ec54d34fec373f21cfd75f5dfd3ece4bc5358c7566032e7605",
31543
31543
  validatorWalletAddress: "0xf0bf5e3f864b87283a05d1e4a85ee0fa40493fb5",
31544
31544
  pkp: {
31545
31545
  publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
@@ -34728,7 +34728,13 @@ function getSepoliaConfig() {
34728
34728
  // env missing; browser: always), so downstream validateServiceModeConfig throws.
34729
34729
  // Node consumers must set LIT_OPS_ENDPOINT; browser apps pass serviceEndpoint
34730
34730
  // explicitly from decrypted /v1/init (user config still wins over this).
34731
- serviceEndpoint: readInitBackedEnv("LIT_OPS_ENDPOINT"),
34731
+ // Lazy getter — resolved at access time, NOT captured at module-init.
34732
+ // Reading the env var once at module load would freeze it empty when
34733
+ // LIT_OPS_ENDPOINT is set after import (late-loaded dotenv, test setup),
34734
+ // leaving Sepolia serviceEndpoint permanently "".
34735
+ get serviceEndpoint() {
34736
+ return readInitBackedEnv("LIT_OPS_ENDPOINT");
34737
+ },
34732
34738
  chainId: 11155111,
34733
34739
  name: "sepolia",
34734
34740
  rpcUrls: [],
@@ -34756,7 +34762,10 @@ function getSepoliaConfig() {
34756
34762
  positionDelegateRegistry: SEPOLIA_CONTRACTS.PositionDelegateRegistry || ""
34757
34763
  },
34758
34764
  subgraphs: {
34759
- diamondHandsUrl: readInitBackedEnv("SUBGRAPH_URL")
34765
+ // Lazy getter for the same module-init snapshot reason as serviceEndpoint.
34766
+ get diamondHandsUrl() {
34767
+ return readInitBackedEnv("SUBGRAPH_URL");
34768
+ }
34760
34769
  },
34761
34770
  debug: true
34762
34771
  };
@@ -34889,13 +34898,13 @@ function getAllNetworkConfigs() {
34889
34898
  function isNetworkSupported(chainId) {
34890
34899
  return chainId in NETWORK_CONFIGS;
34891
34900
  }
34892
- var isBrowser, isNode2, fs, path, CONTRACTS_PATH, DEPLOYMENTS_PATH, NETWORK_CONFIGS, DEFAULT_NETWORK_CONFIG;
34901
+ var isNode2, isBrowser, fs, path, CONTRACTS_PATH, DEPLOYMENTS_PATH, NETWORK_CONFIGS, DEFAULT_NETWORK_CONFIG;
34893
34902
  var init_network_configs = __esm({
34894
34903
  "src/constants/chunks/network-configs.ts"() {
34895
34904
  "use strict";
34896
34905
  init_deployment_addresses();
34897
- isBrowser = typeof window !== "undefined" || typeof global === "undefined" && typeof process === "undefined" || typeof navigator !== "undefined" && navigator.userAgent;
34898
- isNode2 = typeof process !== "undefined" && process.versions && process.versions.node && !isBrowser;
34906
+ isNode2 = !!(typeof process !== "undefined" && process.versions && process.versions.node);
34907
+ isBrowser = !isNode2 && (typeof window !== "undefined" || typeof global === "undefined" && typeof process === "undefined" || typeof navigator !== "undefined" && !!navigator.userAgent);
34899
34908
  fs = void 0;
34900
34909
  path = void 0;
34901
34910
  if (isNode2 && !isBrowser) {
@@ -110679,6 +110688,19 @@ function createLoanCreator(config) {
110679
110688
  }
110680
110689
  }
110681
110690
 
110691
+ // src/types/loanStatus.ts
110692
+ var LoanStatus = /* @__PURE__ */ ((LoanStatus2) => {
110693
+ LoanStatus2[LoanStatus2["PENDING_DEPOSIT"] = 0] = "PENDING_DEPOSIT";
110694
+ LoanStatus2[LoanStatus2["PENDING_MINT"] = 1] = "PENDING_MINT";
110695
+ LoanStatus2[LoanStatus2["ACTIVE"] = 2] = "ACTIVE";
110696
+ LoanStatus2[LoanStatus2["EXPIRED"] = 3] = "EXPIRED";
110697
+ LoanStatus2[LoanStatus2["LIQUIDATABLE"] = 4] = "LIQUIDATABLE";
110698
+ LoanStatus2[LoanStatus2["LIQUIDATED"] = 5] = "LIQUIDATED";
110699
+ LoanStatus2[LoanStatus2["REPAID"] = 6] = "REPAID";
110700
+ LoanStatus2[LoanStatus2["CLOSED"] = 7] = "CLOSED";
110701
+ return LoanStatus2;
110702
+ })(LoanStatus || {});
110703
+
110682
110704
  // src/modules/loan/loan-query.module.ts
110683
110705
  var POSITION_CORE_ABI = [
110684
110706
  "function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status, uint40 previousExpiryAt, uint16 totalTerm))"
@@ -111041,44 +111063,22 @@ var LoanQuery = class {
111041
111063
  * Map numeric status to string for subgraph queries
111042
111064
  */
111043
111065
  mapStatusToString(status) {
111044
- const statusMap = {
111045
- 0: "PENDING_DEPOSIT",
111046
- 1: "ACTIVE",
111047
- 2: "EXPIRED",
111048
- 3: "REPAID",
111049
- 4: "LIQUIDATED",
111050
- 5: "EXTENDED"
111051
- };
111052
- return statusMap[status] || "ACTIVE";
111066
+ return LoanStatus[status] ?? "ACTIVE";
111053
111067
  }
111054
111068
  /**
111055
111069
  * Map string status to numeric for filtering
111056
111070
  */
111057
111071
  mapStringToStatus(statusString) {
111058
- const statusMap = {
111059
- PENDING_DEPOSIT: 0,
111060
- ACTIVE: 1,
111061
- EXPIRED: 2,
111062
- REPAID: 3,
111063
- LIQUIDATED: 4,
111064
- EXTENDED: 5
111065
- };
111066
- return statusMap[statusString.toUpperCase()] ?? null;
111072
+ const key = statusString.toUpperCase();
111073
+ const value = LoanStatus[key];
111074
+ return typeof value === "number" ? value : null;
111067
111075
  }
111068
111076
  /**
111069
111077
  * Validate if a string is a valid loan status
111070
111078
  */
111071
111079
  isValidStatus(statusString) {
111072
- const validStatuses = [
111073
- "PENDING_DEPOSIT",
111074
- "ACTIVE",
111075
- "EXPIRED",
111076
- "REPAID",
111077
- "LIQUIDATED",
111078
- "EXTENDED",
111079
- "CLOSED"
111080
- ];
111081
- return validStatuses.includes(statusString.toUpperCase());
111080
+ const key = statusString.toUpperCase();
111081
+ return typeof LoanStatus[key] === "number";
111082
111082
  }
111083
111083
  /**
111084
111084
  * Get loans for a borrower
@@ -111091,18 +111091,18 @@ var LoanQuery = class {
111091
111091
  return this.getLoans({ borrower, orderBy, orderDirection }, pagination);
111092
111092
  }
111093
111093
  /**
111094
- * Get active loans (status = 0)
111094
+ * Get active loans (status = ACTIVE)
111095
111095
  *
111096
111096
  * @param pagination - Pagination parameters
111097
111097
  * @returns Paginated active loans
111098
111098
  */
111099
111099
  async getActiveLoans(pagination) {
111100
- return this.getLoans({ status: 0 }, pagination);
111100
+ return this.getLoans({ status: 2 /* ACTIVE */ }, pagination);
111101
111101
  }
111102
111102
  /**
111103
111103
  * Get loans by state/status
111104
111104
  *
111105
- * @param state - Loan state (PENDING_DEPOSIT, ACTIVE, EXPIRED, REPAID, LIQUIDATED, EXTENDED, CLOSED)
111105
+ * @param state - Loan state (PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED)
111106
111106
  * @param pagination - Pagination parameters
111107
111107
  * @returns Paginated loans matching the specified state
111108
111108
  */
@@ -111110,7 +111110,7 @@ var LoanQuery = class {
111110
111110
  if (!this.isValidStatus(state)) {
111111
111111
  return failure(
111112
111112
  new SDKError({
111113
- message: `Invalid loan state: ${state}. Valid states are: PENDING_DEPOSIT, ACTIVE, EXPIRED, REPAID, LIQUIDATED, EXTENDED, CLOSED`,
111113
+ message: `Invalid loan state: ${state}. Valid states are: PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED`,
111114
111114
  category: "VALIDATION" /* VALIDATION */,
111115
111115
  severity: "LOW" /* LOW */,
111116
111116
  context: { state }
@@ -117093,19 +117093,6 @@ async function safeWaitForTransaction(tx, confirmations = 1, timeout = 6e4) {
117093
117093
  throw new Error(`Transaction ${txHash} confirmation timed out after ${timeout}ms`);
117094
117094
  }
117095
117095
 
117096
- // src/types/loanStatus.ts
117097
- var LoanStatus = /* @__PURE__ */ ((LoanStatus2) => {
117098
- LoanStatus2[LoanStatus2["PENDING_DEPOSIT"] = 0] = "PENDING_DEPOSIT";
117099
- LoanStatus2[LoanStatus2["PENDING_MINT"] = 1] = "PENDING_MINT";
117100
- LoanStatus2[LoanStatus2["ACTIVE"] = 2] = "ACTIVE";
117101
- LoanStatus2[LoanStatus2["EXPIRED"] = 3] = "EXPIRED";
117102
- LoanStatus2[LoanStatus2["LIQUIDATABLE"] = 4] = "LIQUIDATABLE";
117103
- LoanStatus2[LoanStatus2["LIQUIDATED"] = 5] = "LIQUIDATED";
117104
- LoanStatus2[LoanStatus2["REPAID"] = 6] = "REPAID";
117105
- LoanStatus2[LoanStatus2["CLOSED"] = 7] = "CLOSED";
117106
- return LoanStatus2;
117107
- })(LoanStatus || {});
117108
-
117109
117096
  // src/modules/diamond-hands-sdk.ts
117110
117097
  var DiamondHandsSDK = class _DiamondHandsSDK {
117111
117098
  config;
@@ -134,7 +134,7 @@ export declare class LoanQuery {
134
134
  */
135
135
  getLoansByBorrower(borrower: string, pagination?: PaginationParams, orderBy?: "createdAt" | "lastUpdatedAt" | "ucdDebt", orderDirection?: "asc" | "desc"): Promise<Result<PaginatedLoansResponse, SDKError>>;
136
136
  /**
137
- * Get active loans (status = 0)
137
+ * Get active loans (status = ACTIVE)
138
138
  *
139
139
  * @param pagination - Pagination parameters
140
140
  * @returns Paginated active loans
@@ -143,7 +143,7 @@ export declare class LoanQuery {
143
143
  /**
144
144
  * Get loans by state/status
145
145
  *
146
- * @param state - Loan state (PENDING_DEPOSIT, ACTIVE, EXPIRED, REPAID, LIQUIDATED, EXTENDED, CLOSED)
146
+ * @param state - Loan state (PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED)
147
147
  * @param pagination - Pagination parameters
148
148
  * @returns Paginated loans matching the specified state
149
149
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.273",
3
+ "version": "0.0.274",
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",
@@ -81,8 +81,8 @@
81
81
  },
82
82
  "sideEffects": false,
83
83
  "dependencies": {
84
- "@gvnrdao/dh-lit-actions": "^0.0.305",
85
- "@gvnrdao/dh-lit-ops": "^0.0.292",
84
+ "@gvnrdao/dh-lit-actions": "^0.0.306",
85
+ "@gvnrdao/dh-lit-ops": "^0.0.293",
86
86
  "@noble/hashes": "^1.5.0",
87
87
  "axios": "^1.15.2",
88
88
  "bech32": "^2.0.0",