@weblock-wallet/sdk 0.1.63 → 0.1.64

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
@@ -105246,17 +105246,17 @@ var RpcClient = class {
105246
105246
  method: request.method,
105247
105247
  params: request.params
105248
105248
  };
105249
- const res = await this.client.post(
105250
- this.baseUrl,
105251
- rpcRequest,
105252
- {
105253
- needsAccessToken: true
105249
+ const res = await this.client.post(this.baseUrl, rpcRequest, {
105250
+ needsAccessToken: true
105251
+ });
105252
+ if (res && typeof res.result === "string") {
105253
+ const t5 = res.result.trim();
105254
+ if (t5.startsWith("{") && t5.endsWith("}") || t5.startsWith("[") && t5.endsWith("]")) {
105255
+ try {
105256
+ res.result = JSON.parse(t5);
105257
+ } catch {
105258
+ }
105254
105259
  }
105255
- );
105256
- if (res?.error) {
105257
- const err = res.error;
105258
- const msg = err?.message || "RPC error";
105259
- throw new SDKError(msg, "REQUEST_FAILED" /* REQUEST_FAILED */, err);
105260
105260
  }
105261
105261
  return res;
105262
105262
  }