@orbinum/sdk 0.4.1 → 0.4.2

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
@@ -401,11 +401,18 @@ var SubstrateClient = class _SubstrateClient {
401
401
  if (v === null || v === void 0) return v;
402
402
  if (typeof v === "bigint") return v.toString();
403
403
  if (v instanceof Uint8Array)
404
- return Array.from(v).map((b) => b.toString(16).padStart(2, "0")).join("");
404
+ return `0x${Array.from(v).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
405
405
  if (Array.isArray(v)) return v.map(jsonifyValue);
406
406
  if (typeof v === "object") {
407
+ const obj = v;
408
+ if (typeof obj["asHex"] === "function") {
409
+ try {
410
+ return obj["asHex"]();
411
+ } catch {
412
+ }
413
+ }
407
414
  return Object.fromEntries(
408
- Object.entries(v).filter(([, val]) => typeof val !== "function").map(([k, val]) => [k, jsonifyValue(val)])
415
+ Object.entries(obj).filter(([, val]) => typeof val !== "function").map(([k, val]) => [k, jsonifyValue(val)])
409
416
  );
410
417
  }
411
418
  return v;
package/dist/index.mjs CHANGED
@@ -299,11 +299,18 @@ var SubstrateClient = class _SubstrateClient {
299
299
  if (v === null || v === void 0) return v;
300
300
  if (typeof v === "bigint") return v.toString();
301
301
  if (v instanceof Uint8Array)
302
- return Array.from(v).map((b) => b.toString(16).padStart(2, "0")).join("");
302
+ return `0x${Array.from(v).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
303
303
  if (Array.isArray(v)) return v.map(jsonifyValue);
304
304
  if (typeof v === "object") {
305
+ const obj = v;
306
+ if (typeof obj["asHex"] === "function") {
307
+ try {
308
+ return obj["asHex"]();
309
+ } catch {
310
+ }
311
+ }
305
312
  return Object.fromEntries(
306
- Object.entries(v).filter(([, val]) => typeof val !== "function").map(([k, val]) => [k, jsonifyValue(val)])
313
+ Object.entries(obj).filter(([, val]) => typeof val !== "function").map(([k, val]) => [k, jsonifyValue(val)])
307
314
  );
308
315
  }
309
316
  return v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbinum/sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Official TypeScript SDK for Orbinum.",
5
5
  "author": "Orbinum",
6
6
  "license": "ISC",