Skip to content

Commit 1f1ecef

Browse files
committed
fix: restore InMemory storage for Ark wallet initialization
The revert in #3522 was based on a misdiagnosis — the actual cause of dev API downtime was a FK constraint violation in the sell-if-deficit migration, not the Ark InMemory imports. Without explicit storage config, the Ark SDK falls back to IndexedDB which is not available in Node.js, causing wallet initialization to fail.
1 parent d9f1832 commit 1f1ecef

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/integration/blockchain/ark/__tests__/ark-client.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import { Wallet } from '@arkade-os/sdk';
22
import { ArkClient } from '../ark-client';
33

4+
// Mock the SDK to provide InMemory repositories
5+
jest.mock('@arkade-os/sdk', () => {
6+
const actualSdk = jest.requireActual('@arkade-os/sdk');
7+
return {
8+
...actualSdk,
9+
InMemoryWalletRepository: class MockWalletRepository {},
10+
InMemoryContractRepository: class MockContractRepository {},
11+
};
12+
});
13+
414
// Mock config to provide ark credentials
515
jest.mock('src/config/config', () => ({
616
GetConfig: () => ({

src/integration/blockchain/ark/ark-client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Wallet, SingleKey } from '@arkade-os/sdk';
1+
import { Wallet, SingleKey, InMemoryWalletRepository, InMemoryContractRepository } from '@arkade-os/sdk';
22
import { Currency } from '@uniswap/sdk-core';
33
import { GetConfig } from 'src/config/config';
44
import { DfxLogger } from 'src/shared/services/dfx-logger';
@@ -102,6 +102,10 @@ export class ArkClient extends BlockchainClient {
102102
const wallet = await Wallet.create({
103103
identity,
104104
arkServerUrl,
105+
storage: {
106+
walletRepository: new InMemoryWalletRepository(),
107+
contractRepository: new InMemoryContractRepository(),
108+
},
105109
});
106110

107111
return wallet;

0 commit comments

Comments
 (0)