Handle browser/node envs

Signed-off-by: James Zuccon <zuccon@gmail.com>
This commit is contained in:
James Zuccon
2024-09-13 07:54:24 +10:00
parent 2c9812200d
commit d9609e5b9f
14 changed files with 1211 additions and 307 deletions
+22 -1
View File
@@ -1,5 +1,10 @@
import { Transaction } from '@xo/primitives';
import { BlockchainLocal, WalletP2PKH } from '@xo/wallet';
import {
BlockchainLocal,
StorageMemory,
WalletP2PKH,
StorageSQLite,
} from '@xo/wallet';
const blockchainLocal = new BlockchainLocal();
await blockchainLocal.start();
@@ -52,3 +57,19 @@ console.log(
);
console.log(blockchainLocal.deriveUtxoSet());
const storageMemory = new StorageMemory();
await storageMemory.start();
await storageMemory.set('test', {
isItWorking: true,
});
console.log(storageMemory.storage);
const storageIDB = new StorageSQLite();
await storageIDB.start();
await storageIDB.set('test', {
thisShouldNotWork: true,
});