@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.cjs CHANGED
@@ -105287,17 +105287,17 @@ var RpcClient = class {
105287
105287
  method: request.method,
105288
105288
  params: request.params
105289
105289
  };
105290
- const res = await this.client.post(
105291
- this.baseUrl,
105292
- rpcRequest,
105293
- {
105294
- needsAccessToken: true
105290
+ const res = await this.client.post(this.baseUrl, rpcRequest, {
105291
+ needsAccessToken: true
105292
+ });
105293
+ if (res && typeof res.result === "string") {
105294
+ const t5 = res.result.trim();
105295
+ if (t5.startsWith("{") && t5.endsWith("}") || t5.startsWith("[") && t5.endsWith("]")) {
105296
+ try {
105297
+ res.result = JSON.parse(t5);
105298
+ } catch {
105299
+ }
105295
105300
  }
105296
- );
105297
- if (res?.error) {
105298
- const err = res.error;
105299
- const msg = err?.message || "RPC error";
105300
- throw new SDKError(msg, "REQUEST_FAILED" /* REQUEST_FAILED */, err);
105301
105301
  }
105302
105302
  return res;
105303
105303
  }