@xyo-network/xl1-rpc 1.26.49 → 1.27.0
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/neutral/index.mjs +4 -5
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/node/index-node.mjs +4 -5
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/transport/HttpRpcTransport.d.ts.map +1 -1
- package/package.json +20 -20
package/dist/neutral/index.mjs
CHANGED
|
@@ -1519,13 +1519,12 @@ import {
|
|
|
1519
1519
|
} from "@xyo-network/xl1-protocol-sdk";
|
|
1520
1520
|
|
|
1521
1521
|
// src/transport/HttpRpcTransport.ts
|
|
1522
|
+
import { FetchClientError, FetchJsonClient } from "@xylabs/fetch";
|
|
1522
1523
|
import {
|
|
1523
|
-
axiosJsonConfig,
|
|
1524
1524
|
isDefined,
|
|
1525
1525
|
isError,
|
|
1526
1526
|
isUndefinedOrNull
|
|
1527
1527
|
} from "@xylabs/sdk-js";
|
|
1528
|
-
import { Axios, isAxiosError } from "axios";
|
|
1529
1528
|
import { v4 } from "uuid";
|
|
1530
1529
|
import { z as z24 } from "zod";
|
|
1531
1530
|
var HttpRpcTransport = class {
|
|
@@ -1556,7 +1555,7 @@ var HttpRpcTransport = class {
|
|
|
1556
1555
|
}
|
|
1557
1556
|
}
|
|
1558
1557
|
body.params ??= [];
|
|
1559
|
-
const res = await new
|
|
1558
|
+
const res = await new FetchJsonClient().post(url, body);
|
|
1560
1559
|
const json = res.data;
|
|
1561
1560
|
if (isUndefinedOrNull(json)) {
|
|
1562
1561
|
throw new Error(`[callRpc] empty response body (status ${res.status})`);
|
|
@@ -1568,8 +1567,8 @@ var HttpRpcTransport = class {
|
|
|
1568
1567
|
return result;
|
|
1569
1568
|
} catch (ex) {
|
|
1570
1569
|
let message = isError(ex) ? ex.message : String(ex);
|
|
1571
|
-
if (
|
|
1572
|
-
message = `Http error occurred [${ex.status}
|
|
1570
|
+
if (ex instanceof FetchClientError) {
|
|
1571
|
+
message = `Http error occurred [${ex.response.status}]: ${ex.message}`;
|
|
1573
1572
|
}
|
|
1574
1573
|
throw new Error(`Error occurred while calling RPC method ${String(method)}: ${message}`, { cause: ex });
|
|
1575
1574
|
}
|