--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import { Worker } from 'node:worker_threads'
+
+globalThis.Worker ??= Worker
+globalThis.Worker.onmessage ??= (handler) => Worker.prototype.on('message', handler)
+globalThis.onmessage ??= (handler) => EventTarget.prototype.addEventListener('message', handler)
+
+if (globalThis.sessionStorage == null) {
+ const _sessionStorage = {}
+ Object.defineProperty(globalThis, 'sessionStorage', {
+ value: {
+ length: Object.entries(_sessionStorage).length,
+ setItem: (key, value) => _sessionStorage[key] = value,
+ getItem: (key) => _sessionStorage[key],
+ removeItem: (key) => delete _sessionStorage[key],
+ clear: () => _sessionStorage = {}
+ },
+ configurable: true,
+ enumerable: true
+ })
+}
// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
// SPDX-License-Identifier: GPL-3.0-or-later
-export const STORAGE = (() => {
- if (globalThis.sessionStorage == null) {
- const _sessionStorage = {}
- Object.defineProperty(globalThis, 'sessionStorage', {
- value: {
- length: Object.entries(_sessionStorage).length,
- setItem: (key, value) => _sessionStorage[key] = value,
- getItem: (key) => _sessionStorage[key],
- removeItem: (key) => delete _sessionStorage[key],
- clear: () => _sessionStorage = {}
- },
- configurable: true,
- enumerable: true
- })
- }
-})()
-
export const GENESIS_ADDRESS = 'nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3'
export const RAW_MAX = '340282366920938463463374607431768211455'
export const SUPPLY_MAX = '133248297920938463463374607431768211455'
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { NANO_TEST_VECTORS, STORAGE, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
+import { NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
import { Account, Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js'\r
\r
// WARNING: Do not send any funds to the test vectors below\r
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { NANO_TEST_VECTORS, STORAGE } from './TEST_VECTORS.js'\r
+import { NANO_TEST_VECTORS } from './TEST_VECTORS.js'\r
import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js'\r
\r
const skip = true\r
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { BIP32_TEST_VECTORS, CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, STORAGE, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
+import { BIP32_TEST_VECTORS, CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
import { Account, Bip44Wallet, Blake2bWallet } from '../dist/main.js'\r
\r
// WARNING: Do not send any funds to the test vectors below\r
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { NANO_TEST_VECTORS, STORAGE, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
+import { NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js'\r
import { Bip44Wallet, Blake2bWallet } from '../dist/main.js'\r
\r
const skip = false\r
'use strict'
+import './GLOBALS.js'
import { describe, it } from 'node:test'
import { strict as assert } from 'assert'
import { Rolodex, Tools } from '../dist/main.js'
'use strict'
+import './GLOBALS.js'
import { describe, it } from 'node:test'
import { strict as assert } from 'assert'
-import { NANO_TEST_VECTORS, STORAGE } from './TEST_VECTORS.js'
+import { NANO_TEST_VECTORS } from './TEST_VECTORS.js'
import { Account, Bip44Wallet, Rpc } from '../dist/main.js'
// WARNING: Do not send any funds to the test vectors below
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { SendBlock, ReceiveBlock, ChangeBlock } from '../dist/main.js'\r
import { NANO_TEST_VECTORS } from './TEST_VECTORS.js'\r
+import { SendBlock, ReceiveBlock, ChangeBlock } from '../dist/main.js'\r
\r
// WARNING: Do not send any funds to the test vectors below\r
// Test vectors from https://docs.nano.org/integration-guides/key-management/\r
\r
'use strict'\r
\r
+import './GLOBALS.js'\r
import { describe, it } from 'node:test'\r
import { strict as assert } from 'assert'\r
-import { RAW_MAX, NANO_TEST_VECTORS, STORAGE } from './TEST_VECTORS.js'\r
+import { RAW_MAX, NANO_TEST_VECTORS } from './TEST_VECTORS.js'\r
import { Bip44Wallet, Account, SendBlock, Rpc, Tools } from '../dist/main.js'\r
\r
const skip = true\r