The SDK should support a wallet storage adapter without the enduser having to wrap it, see:
So locaforage butchers objects it stores, and returns not what was passed to it. To make it work, there's a small wrapper needed
Here's the wrapper code:
constructor() {
this.forage = localforage;
this.isConfig = false;
}
config() {
this.isConfig = true;
}
async setItem(key, item) {
console.log('setItem', key, item);
if (typeof item === 'object') {
await this.forage.setItem(key, JSON.stringify(item));
} else {
await this.forage.setItem(key, item);
}
return item;
}
async getItem(key) {
console.log('get item', key);
const item = await this.forage.getItem(key);
let res;
try {
res = JSON.parse(item);
} catch (e) {
res = item;
}
return res || null;
}
}
The SDK should support a wallet storage adapter without the enduser having to wrap it, see:
So locaforage butchers objects it stores, and returns not what was passed to it. To make it work, there's a small wrapper needed
Here's the wrapper code: