Skip to content

Commit 94f35d3

Browse files
authored
Use "util" from KeetaNet Client package to support multiple environments (#79)
This change fixes a bug where NodeJS "util" is imported in JSON conversion, which breaks when used within the browser. Instead use the "util" export from the KeetaNet Client package to provide this in all environments. Additionally, it releases Keeta Anchor v0.0.20 Currently blocks KeetaNetwork/explorer#6
2 parents db0fec7 + 7a576d9 commit 94f35d3

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@keetanetwork/anchor",
3-
"version": "0.0.19",
3+
"version": "0.0.20",
44
"description": "KeetaNetwork Network Anchor",
55
"main": "client/index.js",
66
"scripts": {

src/lib/utils/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { types as nodeUtilsTypes } from 'util';
1+
import { types as nodeUtilsTypes } from './util.js';
22
import { Buffer } from './buffer.js';
33
import type { JSONSerializable, ToJSONSerializable } from '@keetanetwork/keetanet-client/lib/utils/conversion.js';
44
export type { JSONSerializable, ToJSONSerializable };

src/lib/utils/util.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
2+
3+
const util: typeof KeetaNetLib.Utils.Helper.util = KeetaNetLib.Utils.Helper.util;
4+
5+
const types: typeof util.types = util.types;
6+
const inspect: typeof util.inspect = util.inspect;
7+
8+
export {
9+
types,
10+
inspect
11+
}
12+
13+
export default util;

0 commit comments

Comments
 (0)