Interface: StorageAdapter
gSwap SDK 2.0.0-rc.4 / StorageAdapter
Interface: StorageAdapter
Defined in: packages/gswap-sdk/dist/index.d.ts:3607
Async key/value storage the pending-swap store persists through. It stores STRUCTURED VALUES (the store never serializes), so each platform decides how a value lands on disk:
chrome.storage.local:get: async (k) => (await chrome.storage.local.get(k))[k],set: (k, v) => chrome.storage.local.set({ [k]: v }). This is the wallet's stored shape. storageAdapterFromChromeStorage builds it.localStorage(a web app): JSON text under the key. webStorageAdapter builds it, and returns CORRUPT JSON as a value (the raw string), not as a rejection: a value that is not an array reads as "no entries" and the next write repairs it, whereas agetthat rejects forever makes everyremembera no-op.- React Native: AsyncStorage with the same JSON wrapping and the same corrupt-JSON rule.
get resolves undefined for a missing key. Either method may reject; the store treats that
as "storage unavailable" and never lets it surface (see PendingSwapStore).
This module imports nothing, so an app shell that only builds an adapter pays for the adapter.
Methods
get()
get(
key):Promise<unknown>
Defined in: packages/gswap-sdk/dist/index.d.ts:3608
Parameters
key
string
Returns
Promise<unknown>
set()
set(
key,value):Promise<void>
Defined in: packages/gswap-sdk/dist/index.d.ts:3609
Parameters
key
string
value
unknown
Returns
Promise<void>