@gvnrdao/dh-sdk 0.0.118 → 0.0.119
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 +71 -4
- package/dist/index.mjs +71 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43525,12 +43525,28 @@ var PKPAuthorization = class {
|
|
|
43525
43525
|
* @returns LIT Action response
|
|
43526
43526
|
*/
|
|
43527
43527
|
async executeLitAction(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp = true) {
|
|
43528
|
+
console.log("[PKP-AUTH] executeLitAction called", {
|
|
43529
|
+
executionMode: this.config.executionMode,
|
|
43530
|
+
hasServiceEndpoint: !!this.config.serviceEndpoint,
|
|
43531
|
+
serviceEndpoint: this.config.serviceEndpoint || "NOT PROVIDED",
|
|
43532
|
+
hasOverrideCid: !!overrideCid,
|
|
43533
|
+
overrideCid: overrideCid || "NOT PROVIDED",
|
|
43534
|
+
hasPkpTokenId: !!pkpTokenId,
|
|
43535
|
+
hasPkpEthAddress: !!pkpEthAddress,
|
|
43536
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43537
|
+
hasContracts: !!jsParams.contracts,
|
|
43538
|
+
hasContractAddresses: !!jsParams.contractAddresses
|
|
43539
|
+
});
|
|
43528
43540
|
if (overrideCid) {
|
|
43541
|
+
console.log("[PKP-AUTH] Using IPFS execution (overrideCid provided)");
|
|
43529
43542
|
return this.executeLitActionFromIpfs(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp);
|
|
43530
43543
|
}
|
|
43531
43544
|
if (this.config.executionMode === "code") {
|
|
43545
|
+
console.log("[PKP-AUTH] Using SERVICE execution (code mode)");
|
|
43546
|
+
console.log("[PKP-AUTH] Service endpoint:", this.config.serviceEndpoint);
|
|
43532
43547
|
return this.executeLitActionFromCode(pkpPublicKey, jsParams);
|
|
43533
43548
|
} else {
|
|
43549
|
+
console.log("[PKP-AUTH] Using IPFS execution (ipfs mode)");
|
|
43534
43550
|
return this.executeLitActionFromIpfs(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp);
|
|
43535
43551
|
}
|
|
43536
43552
|
}
|
|
@@ -43556,6 +43572,16 @@ var PKPAuthorization = class {
|
|
|
43556
43572
|
}
|
|
43557
43573
|
const pkpTokenId = jsParams["pkpTokenId"];
|
|
43558
43574
|
const url = `${this.config.serviceEndpoint}/api/lit/action/execute-from-ipfs`;
|
|
43575
|
+
console.log("[PKP-AUTH] executeLitActionFromCode - Preparing service request", {
|
|
43576
|
+
url,
|
|
43577
|
+
cid: this.config.litActionCid,
|
|
43578
|
+
pkpTokenId: pkpTokenId || "NOT PROVIDED",
|
|
43579
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43580
|
+
hasContracts: !!jsParams.contracts,
|
|
43581
|
+
hasContractAddresses: !!jsParams.contractAddresses,
|
|
43582
|
+
contractsKeys: jsParams.contracts ? Object.keys(jsParams.contracts) : [],
|
|
43583
|
+
contractAddressesKeys: jsParams.contractAddresses ? Object.keys(jsParams.contractAddresses) : []
|
|
43584
|
+
});
|
|
43559
43585
|
if (this.config.debug) {
|
|
43560
43586
|
log.info("\u{1F310} Executing LIT Action via service from IPFS", {
|
|
43561
43587
|
url,
|
|
@@ -43620,6 +43646,18 @@ var PKPAuthorization = class {
|
|
|
43620
43646
|
// Include formatted pkpTokenId if available (required for burned PKPs)
|
|
43621
43647
|
...formattedPkpTokenId ? { pkpTokenId: formattedPkpTokenId } : {}
|
|
43622
43648
|
};
|
|
43649
|
+
console.log("[PKP-AUTH] \u{1F4E4} SENDING request to service endpoint", {
|
|
43650
|
+
url,
|
|
43651
|
+
requestBodyKeys: Object.keys(requestBody),
|
|
43652
|
+
ipfsId: requestBody.ipfsId,
|
|
43653
|
+
pkpPublicKey: formattedPkpPublicKey.substring(0, 20) + "...",
|
|
43654
|
+
pkpTokenId: formattedPkpTokenId || "NOT PROVIDED",
|
|
43655
|
+
paramsKeys: Object.keys(jsParams),
|
|
43656
|
+
paramsContracts: jsParams.contracts ? Object.keys(jsParams.contracts) : [],
|
|
43657
|
+
paramsContractAddresses: jsParams.contractAddresses ? Object.keys(jsParams.contractAddresses) : [],
|
|
43658
|
+
paramsPositionManager: jsParams.contracts ? jsParams.contracts?.PositionManager || "MISSING" : "NOT IN CONTRACTS",
|
|
43659
|
+
paramsContractAddressesPositionManager: jsParams.contractAddresses ? jsParams.contractAddresses?.PositionManager || "MISSING" : "NOT IN CONTRACTADDRESSES"
|
|
43660
|
+
});
|
|
43623
43661
|
if (this.config.debug) {
|
|
43624
43662
|
log.info("\u{1F4E4} Service request body (summary):", {
|
|
43625
43663
|
ipfsId: requestBody.ipfsId,
|
|
@@ -43675,14 +43713,43 @@ var PKPAuthorization = class {
|
|
|
43675
43713
|
}
|
|
43676
43714
|
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
43677
43715
|
}
|
|
43678
|
-
|
|
43716
|
+
console.log("[PKP-AUTH] \u{1F310} About to fetch service endpoint", {
|
|
43717
|
+
url,
|
|
43679
43718
|
method: "POST",
|
|
43680
|
-
|
|
43681
|
-
|
|
43682
|
-
|
|
43719
|
+
hasBody: !!requestBody,
|
|
43720
|
+
bodySize: JSON.stringify(requestBody).length,
|
|
43721
|
+
bodyContracts: requestBody.params?.contracts ? Object.keys(requestBody.params.contracts) : [],
|
|
43722
|
+
bodyContractAddresses: requestBody.params?.contractAddresses ? Object.keys(requestBody.params.contractAddresses) : []
|
|
43683
43723
|
});
|
|
43724
|
+
let response;
|
|
43725
|
+
try {
|
|
43726
|
+
response = await fetch(url, {
|
|
43727
|
+
method: "POST",
|
|
43728
|
+
headers,
|
|
43729
|
+
body: JSON.stringify(requestBody),
|
|
43730
|
+
signal: controller.signal
|
|
43731
|
+
});
|
|
43732
|
+
console.log("[PKP-AUTH] \u{1F4E5} Service response received", {
|
|
43733
|
+
status: response.status,
|
|
43734
|
+
statusText: response.statusText,
|
|
43735
|
+
ok: response.ok,
|
|
43736
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
43737
|
+
});
|
|
43738
|
+
} catch (fetchError) {
|
|
43739
|
+
console.error("[PKP-AUTH] \u274C Fetch error (request did not reach server)", {
|
|
43740
|
+
error: fetchError.message,
|
|
43741
|
+
errorType: fetchError.constructor?.name,
|
|
43742
|
+
url,
|
|
43743
|
+
stack: fetchError.stack
|
|
43744
|
+
});
|
|
43745
|
+
throw fetchError;
|
|
43746
|
+
}
|
|
43684
43747
|
clearTimeout(timeout);
|
|
43685
43748
|
if (!response.ok) {
|
|
43749
|
+
console.error("[PKP-AUTH] \u274C Service returned error response", {
|
|
43750
|
+
status: response.status,
|
|
43751
|
+
statusText: response.statusText
|
|
43752
|
+
});
|
|
43686
43753
|
let errorText;
|
|
43687
43754
|
let errorDetails = {};
|
|
43688
43755
|
try {
|
package/dist/index.mjs
CHANGED
|
@@ -43430,12 +43430,28 @@ var PKPAuthorization = class {
|
|
|
43430
43430
|
* @returns LIT Action response
|
|
43431
43431
|
*/
|
|
43432
43432
|
async executeLitAction(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp = true) {
|
|
43433
|
+
console.log("[PKP-AUTH] executeLitAction called", {
|
|
43434
|
+
executionMode: this.config.executionMode,
|
|
43435
|
+
hasServiceEndpoint: !!this.config.serviceEndpoint,
|
|
43436
|
+
serviceEndpoint: this.config.serviceEndpoint || "NOT PROVIDED",
|
|
43437
|
+
hasOverrideCid: !!overrideCid,
|
|
43438
|
+
overrideCid: overrideCid || "NOT PROVIDED",
|
|
43439
|
+
hasPkpTokenId: !!pkpTokenId,
|
|
43440
|
+
hasPkpEthAddress: !!pkpEthAddress,
|
|
43441
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43442
|
+
hasContracts: !!jsParams.contracts,
|
|
43443
|
+
hasContractAddresses: !!jsParams.contractAddresses
|
|
43444
|
+
});
|
|
43433
43445
|
if (overrideCid) {
|
|
43446
|
+
console.log("[PKP-AUTH] Using IPFS execution (overrideCid provided)");
|
|
43434
43447
|
return this.executeLitActionFromIpfs(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp);
|
|
43435
43448
|
}
|
|
43436
43449
|
if (this.config.executionMode === "code") {
|
|
43450
|
+
console.log("[PKP-AUTH] Using SERVICE execution (code mode)");
|
|
43451
|
+
console.log("[PKP-AUTH] Service endpoint:", this.config.serviceEndpoint);
|
|
43437
43452
|
return this.executeLitActionFromCode(pkpPublicKey, jsParams);
|
|
43438
43453
|
} else {
|
|
43454
|
+
console.log("[PKP-AUTH] Using IPFS execution (ipfs mode)");
|
|
43439
43455
|
return this.executeLitActionFromIpfs(pkpPublicKey, jsParams, pkpTokenId, pkpEthAddress, overrideCid, requirePkp);
|
|
43440
43456
|
}
|
|
43441
43457
|
}
|
|
@@ -43461,6 +43477,16 @@ var PKPAuthorization = class {
|
|
|
43461
43477
|
}
|
|
43462
43478
|
const pkpTokenId = jsParams["pkpTokenId"];
|
|
43463
43479
|
const url = `${this.config.serviceEndpoint}/api/lit/action/execute-from-ipfs`;
|
|
43480
|
+
console.log("[PKP-AUTH] executeLitActionFromCode - Preparing service request", {
|
|
43481
|
+
url,
|
|
43482
|
+
cid: this.config.litActionCid,
|
|
43483
|
+
pkpTokenId: pkpTokenId || "NOT PROVIDED",
|
|
43484
|
+
jsParamsKeys: Object.keys(jsParams),
|
|
43485
|
+
hasContracts: !!jsParams.contracts,
|
|
43486
|
+
hasContractAddresses: !!jsParams.contractAddresses,
|
|
43487
|
+
contractsKeys: jsParams.contracts ? Object.keys(jsParams.contracts) : [],
|
|
43488
|
+
contractAddressesKeys: jsParams.contractAddresses ? Object.keys(jsParams.contractAddresses) : []
|
|
43489
|
+
});
|
|
43464
43490
|
if (this.config.debug) {
|
|
43465
43491
|
log.info("\u{1F310} Executing LIT Action via service from IPFS", {
|
|
43466
43492
|
url,
|
|
@@ -43525,6 +43551,18 @@ var PKPAuthorization = class {
|
|
|
43525
43551
|
// Include formatted pkpTokenId if available (required for burned PKPs)
|
|
43526
43552
|
...formattedPkpTokenId ? { pkpTokenId: formattedPkpTokenId } : {}
|
|
43527
43553
|
};
|
|
43554
|
+
console.log("[PKP-AUTH] \u{1F4E4} SENDING request to service endpoint", {
|
|
43555
|
+
url,
|
|
43556
|
+
requestBodyKeys: Object.keys(requestBody),
|
|
43557
|
+
ipfsId: requestBody.ipfsId,
|
|
43558
|
+
pkpPublicKey: formattedPkpPublicKey.substring(0, 20) + "...",
|
|
43559
|
+
pkpTokenId: formattedPkpTokenId || "NOT PROVIDED",
|
|
43560
|
+
paramsKeys: Object.keys(jsParams),
|
|
43561
|
+
paramsContracts: jsParams.contracts ? Object.keys(jsParams.contracts) : [],
|
|
43562
|
+
paramsContractAddresses: jsParams.contractAddresses ? Object.keys(jsParams.contractAddresses) : [],
|
|
43563
|
+
paramsPositionManager: jsParams.contracts ? jsParams.contracts?.PositionManager || "MISSING" : "NOT IN CONTRACTS",
|
|
43564
|
+
paramsContractAddressesPositionManager: jsParams.contractAddresses ? jsParams.contractAddresses?.PositionManager || "MISSING" : "NOT IN CONTRACTADDRESSES"
|
|
43565
|
+
});
|
|
43528
43566
|
if (this.config.debug) {
|
|
43529
43567
|
log.info("\u{1F4E4} Service request body (summary):", {
|
|
43530
43568
|
ipfsId: requestBody.ipfsId,
|
|
@@ -43580,14 +43618,43 @@ var PKPAuthorization = class {
|
|
|
43580
43618
|
}
|
|
43581
43619
|
log.info("\u{1F4E4} Complete jsParams (sanitized JSON):", JSON.stringify(sanitizedParams, null, 2));
|
|
43582
43620
|
}
|
|
43583
|
-
|
|
43621
|
+
console.log("[PKP-AUTH] \u{1F310} About to fetch service endpoint", {
|
|
43622
|
+
url,
|
|
43584
43623
|
method: "POST",
|
|
43585
|
-
|
|
43586
|
-
|
|
43587
|
-
|
|
43624
|
+
hasBody: !!requestBody,
|
|
43625
|
+
bodySize: JSON.stringify(requestBody).length,
|
|
43626
|
+
bodyContracts: requestBody.params?.contracts ? Object.keys(requestBody.params.contracts) : [],
|
|
43627
|
+
bodyContractAddresses: requestBody.params?.contractAddresses ? Object.keys(requestBody.params.contractAddresses) : []
|
|
43588
43628
|
});
|
|
43629
|
+
let response;
|
|
43630
|
+
try {
|
|
43631
|
+
response = await fetch(url, {
|
|
43632
|
+
method: "POST",
|
|
43633
|
+
headers,
|
|
43634
|
+
body: JSON.stringify(requestBody),
|
|
43635
|
+
signal: controller.signal
|
|
43636
|
+
});
|
|
43637
|
+
console.log("[PKP-AUTH] \u{1F4E5} Service response received", {
|
|
43638
|
+
status: response.status,
|
|
43639
|
+
statusText: response.statusText,
|
|
43640
|
+
ok: response.ok,
|
|
43641
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
43642
|
+
});
|
|
43643
|
+
} catch (fetchError) {
|
|
43644
|
+
console.error("[PKP-AUTH] \u274C Fetch error (request did not reach server)", {
|
|
43645
|
+
error: fetchError.message,
|
|
43646
|
+
errorType: fetchError.constructor?.name,
|
|
43647
|
+
url,
|
|
43648
|
+
stack: fetchError.stack
|
|
43649
|
+
});
|
|
43650
|
+
throw fetchError;
|
|
43651
|
+
}
|
|
43589
43652
|
clearTimeout(timeout);
|
|
43590
43653
|
if (!response.ok) {
|
|
43654
|
+
console.error("[PKP-AUTH] \u274C Service returned error response", {
|
|
43655
|
+
status: response.status,
|
|
43656
|
+
statusText: response.statusText
|
|
43657
|
+
});
|
|
43591
43658
|
let errorText;
|
|
43592
43659
|
let errorDetails = {};
|
|
43593
43660
|
try {
|
package/package.json
CHANGED