Storage adapters are a new feature in v0.3. They provide persistent storage for wallet data across different platforms.
Overview
By default, the Arkade SDK usesInMemoryStorageAdapter which stores data in memory and loses it when the application restarts. For production applications, you should use a persistent storage adapter appropriate for your environment.
Available Storage Adapters
LocalStorage
Browser/PWA persistent storage using localStorage API
IndexedDB
Browser/PWA/Service Worker advanced storage with IndexedDB
AsyncStorage
React Native persistent storage
FileSystem
Node.js file-based storage
Storage Adapter Interface
All storage adapters implement the same interface:Browser LocalStorage
For browser applications, useLocalStorageAdapter for simple persistent storage:
Browser IndexedDB
For more advanced browser applications or service workers, useIndexedDBStorageAdapter:
React Native AsyncStorage
For React Native applications, useAsyncStorageAdapter:
Node.js FileSystem
For Node.js applications, useFileSystemStorageAdapter:
Example: Identity Management
Here’s a complete example showing how to manage identity across sessions:Repository Pattern
v0.3 introduces repositories for low-level data management:Next Steps
- Service Worker - Run your wallet in a background service worker
- Expo/React Native - Set up Arkade in React Native applications