@gvnrdao/dh-sdk 0.0.21 → 0.0.22
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.
|
@@ -458,11 +458,42 @@ class DiamondHandsSDK {
|
|
|
458
458
|
// Step 1: Create PKP via LitOps service mode (just like the test does)
|
|
459
459
|
if (this.config.debug) {
|
|
460
460
|
console.log("📝 Step 1: Creating PKP via LitOps.getNewDiamondHandsLoanPkp()");
|
|
461
|
+
console.log(`🔍 PKP Service Details:`);
|
|
462
|
+
console.log(` Service endpoint: ${this.serviceEndpoint}`);
|
|
463
|
+
console.log(` API endpoint: ${this.serviceEndpoint}/api/lit/pkp/create-diamond-hands-loan`);
|
|
464
|
+
console.log(` LitOps mode: service`);
|
|
461
465
|
}
|
|
462
466
|
if (!this.litOps) {
|
|
463
467
|
throw new Error("LitOps not initialized for service mode");
|
|
464
468
|
}
|
|
465
|
-
|
|
469
|
+
let pkpResult;
|
|
470
|
+
try {
|
|
471
|
+
pkpResult = await this.litOps.getNewDiamondHandsLoanPkp();
|
|
472
|
+
}
|
|
473
|
+
catch (error) {
|
|
474
|
+
if (this.config.debug) {
|
|
475
|
+
console.error(`❌ PKP Service Call Failed:`);
|
|
476
|
+
console.error(` Error message: ${error instanceof Error ? error.message : String(error)}`);
|
|
477
|
+
// Try to extract more details from axios error or similar
|
|
478
|
+
const axiosError = error;
|
|
479
|
+
if (axiosError.response) {
|
|
480
|
+
console.error(` HTTP Status: ${axiosError.response.status} ${axiosError.response.statusText}`);
|
|
481
|
+
console.error(` Response headers:`, axiosError.response.headers);
|
|
482
|
+
console.error(` Response body:`, axiosError.response.data);
|
|
483
|
+
}
|
|
484
|
+
if (axiosError.request) {
|
|
485
|
+
console.error(` Request URL: ${axiosError.config?.url || 'unknown'}`);
|
|
486
|
+
console.error(` Request method: ${axiosError.config?.method || 'unknown'}`);
|
|
487
|
+
console.error(` Request headers:`, axiosError.config?.headers);
|
|
488
|
+
console.error(` Request data:`, axiosError.config?.data);
|
|
489
|
+
}
|
|
490
|
+
console.error(` Full error object:`, error);
|
|
491
|
+
}
|
|
492
|
+
// Re-throw with enhanced error message
|
|
493
|
+
const enhancedMessage = error instanceof Error ? error.message : String(error);
|
|
494
|
+
const statusInfo = error.response ? ` (HTTP ${error.response.status})` : '';
|
|
495
|
+
throw new Error(`PKP service call failed${statusInfo}: ${enhancedMessage}`);
|
|
496
|
+
}
|
|
466
497
|
if (!pkpResult.success) {
|
|
467
498
|
throw new Error(`LitOps PKP creation failed: ${pkpResult.error || "Unknown error"}`);
|
|
468
499
|
}
|
package/package.json
CHANGED