anza-xyz / anza-xyz/kit

Add a local storage state sync function for use in SelectedWalletAccountContextProvider

Aberta
#1,184 5 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
695
Forks
210
Merge médio
21h 33min
PRs com merge (30d)
90

Descrição

The provider added in #1154 uses an object with the following functions to sync the selected wallet/account:

```ts
{
storeSelectedWallet: (walletId: string) => void,
getSelectedWallet: () => string | null,
deleteSelectedWallet: () => void,
}
```

We could add a function to create this for a given localstorage key:

```ts
storeSelectedWallet(walletId) {
localStorage.setItem(STORAGE_KEY, walletId);
},
getSelectedWallet() {
return localStorage.getItem(STORAGE_KEY);
},
deleteSelectedWallet() {
return localStorage.removeItem(STORAGE_KEY);
}
```

Then the provider would be very easy to use with a sensible storage default, while allowing this to be customised if necessary.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.