Skip to content

Commit 9a7d6ac

Browse files
am1r021holgerd77acolytec3
authored
statemanager: Fix statemanager Browser Example (#3197)
* Use hexToBytes instead of hexStringToBytes * Make debug check safe for browsers --------- Co-authored-by: Holger Drewes <[email protected]> Co-authored-by: acolytec3 <[email protected]>
1 parent a0ef459 commit 9a7d6ac

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/statemanager/examples/browser.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
const run = async () => {
1212
const stateManager = new DefaultStateManager()
13-
const address = new Address(hexStringToBytes('a94f5374fce5edbc8e2a8697c15331677e6ebf0b'))
13+
const address = new Address(hexToBytes('0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b'))
1414
const account = new Account(BigInt(0), BigInt(1000))
1515
await stateManager.checkpoint()
1616
await stateManager.putAccount(address, account)

packages/trie/src/trie.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ export class Trie {
102102
valueEncoding = ValueEncoding.Bytes
103103
}
104104

105-
this.DEBUG = process.env.DEBUG?.includes('ethjs') === true
105+
this.DEBUG =
106+
typeof window === 'undefined' ? process?.env?.DEBUG?.includes('ethjs') ?? false : false
106107
this.debug = this.DEBUG
107108
? (message: string, namespaces: string[] = []) => {
108109
let log = this._debug

0 commit comments

Comments
 (0)