@dorafactory/maci-sdk 0.1.3-pre.32 → 0.1.3-pre.33
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 +34 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/api/client.ts +38 -0
- package/src/voter.ts +7 -7
package/dist/index.js
CHANGED
|
@@ -8822,6 +8822,39 @@ var MaciApiClient = class {
|
|
|
8822
8822
|
return await response.json();
|
|
8823
8823
|
} catch (error) {
|
|
8824
8824
|
clearTimeout(timeoutId);
|
|
8825
|
+
console.error("\u274C API Request Failed:");
|
|
8826
|
+
console.error(" Path:", path);
|
|
8827
|
+
console.error(" Method:", options?.method || "GET");
|
|
8828
|
+
if (error instanceof HttpError) {
|
|
8829
|
+
console.error(" Error Type: HttpError");
|
|
8830
|
+
console.error(" Status Code:", error.code);
|
|
8831
|
+
console.error(" Error Message:", error.message);
|
|
8832
|
+
} else if (error instanceof Error) {
|
|
8833
|
+
console.error(" Error Type:", error.name);
|
|
8834
|
+
console.error(" Error Message:", error.message);
|
|
8835
|
+
if (error.stack) {
|
|
8836
|
+
console.error(" Stack Trace:");
|
|
8837
|
+
console.error(error.stack);
|
|
8838
|
+
}
|
|
8839
|
+
} else {
|
|
8840
|
+
console.error(" Unknown Error:", error);
|
|
8841
|
+
}
|
|
8842
|
+
if (error && typeof error === "object") {
|
|
8843
|
+
const extraProps = Object.keys(error).filter(
|
|
8844
|
+
(key) => !["name", "message", "stack", "code", "type"].includes(key)
|
|
8845
|
+
);
|
|
8846
|
+
if (extraProps.length > 0) {
|
|
8847
|
+
console.error(
|
|
8848
|
+
" Additional Info:",
|
|
8849
|
+
JSON.stringify(
|
|
8850
|
+
Object.fromEntries(extraProps.map((key) => [key, error[key]])),
|
|
8851
|
+
null,
|
|
8852
|
+
2
|
|
8853
|
+
)
|
|
8854
|
+
);
|
|
8855
|
+
}
|
|
8856
|
+
}
|
|
8857
|
+
console.error("---");
|
|
8825
8858
|
if (error instanceof HttpError) {
|
|
8826
8859
|
throw error;
|
|
8827
8860
|
}
|
|
@@ -10529,14 +10562,8 @@ var VoterClient = class _VoterClient {
|
|
|
10529
10562
|
selectedOptions,
|
|
10530
10563
|
derivePathParams
|
|
10531
10564
|
}) {
|
|
10532
|
-
const stateIdx = await this.getStateIdx({
|
|
10533
|
-
contractAddress
|
|
10534
|
-
});
|
|
10535
|
-
if (stateIdx === -1) {
|
|
10536
|
-
throw new Error("State index is not set, Please signup or addNewKey first");
|
|
10537
|
-
}
|
|
10538
10565
|
const payload = this.buildVotePayload({
|
|
10539
|
-
stateIdx,
|
|
10566
|
+
stateIdx: 0,
|
|
10540
10567
|
operatorPubkey,
|
|
10541
10568
|
selectedOptions,
|
|
10542
10569
|
derivePathParams
|