Upgrading from SDK 0.4? Read Upgrade Storage to SDK 0.5 first. SDK 0.5 removes the storage adapters, and its IndexedDB upgrade is one way.
- The wallet repository stores virtual outputs, onchain outputs, transaction history, and wallet settings.
- The contract repository stores the contracts that the wallet watches.
Wallet.create in the storage option. If you omit storage, the wallet uses IndexedDB. Node.js and React Native don’t provide IndexedDB, so pass storage there.
Repositories don’t store the wallet identity. Keep the mnemonic or seed in your platform’s secure storage.
Choose a repository
The examples on this page assume that you set up
identity and the providers as in Create your Wallet, or as in Expo/React Native for React Native apps.
storage also accepts intentRepository, which tracks your batch registration requests, and virtualTxRepository. Both are optional and experimental. Only one wallet instance may settle with an intent repository. When the wallet reconciles its requests, it deletes from the operator every pending batch registration that this instance did not submit.
IndexedDB
The IndexedDB repositories use a database namedarkade-service-worker by default. To use a different database, pass its name to each repository:
SQLite
The SQLite repositories work with any SQLite driver. You connect your driver through aSQLExecutor: an object with three async methods, run, get, and all. The SDK creates its tables on first use. You own the database connection, and the SDK never closes it. Give both repositories the same executor object: the SDK runs one transaction at a time for each executor, and SQLite can’t nest transactions on one connection.
The Node.js example uses the built-in node:sqlite module, which is stable from Node.js 22.13.0. The Expo example uses expo-sqlite.
In Node.js, also do these two steps, whichever repository you use:
- Call
configureEventSourcebeforeWallet.create. Node.js has noEventSourceby default. Without one, boarding, renewal, and offboarding throwEventSourceUnavailableError. The example gets anEventSourcefrom theeventsourcepackage (pnpm add eventsource). - Call
await wallet.dispose()when you are done with the wallet. It stops the wallet’s background work, so the process can exit.
Table prefix
The SQLite repositories add the prefixark_ to every table name. To keep more than one wallet in the same database, give each wallet its own prefix. A prefix can contain only letters, digits, and underscores, and it can’t start with a digit.
Realm
The Realm repositories take an open Realm instance. When you open the Realm:- Add
ArkRealmSchemasto the schema list. - Set
schemaVersiontoARK_REALM_SCHEMA_VERSIONor higher. - Call
runArkRealmMigrationsinonMigration.
In-memory
The in-memory repositories keep data only in memory. The data is lost when the process exits. Use them for tests and short-lived scripts.Next Steps
- Service Worker - Run your wallet in a background service worker
- Expo/React Native - Set up Arkade in React Native applications