XO wallet integration

This commit is contained in:
Jim Hamill
2025-05-05 03:19:47 +00:00
parent f9fe792542
commit e0a554e897
14 changed files with 745 additions and 213 deletions
+16 -17
View File
@@ -2,16 +2,15 @@ import { describe, test, expect, beforeEach } from 'vitest';
import { Activities, StoreInMemory } from '../../src/storage';
describe('Activities', () => {
let store: StoreInMemory;
let activities: Activities;
beforeEach(async () => {
activities = await Activities.fromStores(StoreInMemory.from());
activities = await Activities.from();
});
test('should add activity with auto-generated timestamp', async () => {
const activity = {
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Test Wallet',
};
@@ -28,7 +27,7 @@ describe('Activities', () => {
const timestamp = BigInt(1234567890000);
const activity = {
timestamp,
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Test Wallet',
};
@@ -45,14 +44,14 @@ describe('Activities', () => {
await activities.add({
timestamp: oldTimestamp,
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Old Name',
});
await activities.add({
timestamp: newTimestamp,
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'New Name',
});
@@ -73,14 +72,14 @@ describe('Activities', () => {
await activities.add({
timestamp: oldTimestamp,
name: 'TransactionFirstSeen',
key: 'TransactionFirstSeen',
entityId: 'tx1',
value: 'First Value',
});
await activities.add({
timestamp: newTimestamp,
name: 'TransactionFirstSeen',
key: 'TransactionFirstSeen',
entityId: 'tx1',
value: 'Second Value',
});
@@ -100,14 +99,14 @@ describe('Activities', () => {
await activities.add({
timestamp: BigInt(1000),
name: 'CustomType',
key: 'CustomType',
entityId: 'custom1',
value: 50,
});
await activities.add({
timestamp: BigInt(2000),
name: 'CustomType',
key: 'CustomType',
entityId: 'custom1',
value: 30,
});
@@ -121,19 +120,19 @@ describe('Activities', () => {
const testActivities = [
{
timestamp: BigInt(3000),
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Name 3',
},
{
timestamp: BigInt(1000),
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Name 1',
},
{
timestamp: BigInt(2000),
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Name 2',
},
@@ -151,14 +150,14 @@ describe('Activities', () => {
test('should handle multiple activity types independently', async () => {
await activities.add({
timestamp: BigInt(1000),
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'My Wallet',
});
await activities.add({
timestamp: BigInt(2000),
name: 'WalletDescription',
key: 'WalletDescription',
entityId: 'wallet1',
value: 'My Description',
});
@@ -172,7 +171,7 @@ describe('Activities', () => {
test('should update snapshot immediately when activity is added', async () => {
const activity = {
timestamp: BigInt(1000),
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Test Wallet',
};
@@ -186,7 +185,7 @@ describe('Activities', () => {
test('should handle missing timestamp gracefully', async () => {
const activity = {
name: 'WalletName',
key: 'WalletName',
entityId: 'wallet1',
value: 'Test Wallet',
};