Skip to content

Commit

Permalink
Update token balance in local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumGrindle committed Jun 27, 2022
1 parent 3adaeaf commit 02883bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/OwnedCreationComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ const emit = defineEmits(['remove-asset']);
async function handleTokensSent() {
await refreshToken();
if (!parseInt(balanceOf.value) && localStorage.getItem('receivedAssets')) {
const LSP5ReceivedAssets = JSON.parse(localStorage.getItem('receivedAssets'));
LSP5ReceivedAssets.value = LSP5ReceivedAssets.value.filter(function (assetAddress) {
return assetAddress !== props.address;
});
localStorage.setItem('receivedAssets', JSON.stringify(LSP5ReceivedAssets));
}
}
const handleModalClose = () => {
Expand Down
10 changes: 10 additions & 0 deletions src/components/SendModalComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ async function sendAsset() {
await sendLSP7Token(account, props.assetAddress);
} else if (props.isLsp8) {
await sendLSP8Token(account, props.assetAddress);
if (localStorage.getItem('receivedAssets')) {
const LSP5ReceivedAssets = JSON.parse(localStorage.getItem('receivedAssets'));
LSP5ReceivedAssets.value = LSP5ReceivedAssets.value.filter(function (assetAddress) {
return assetAddress !== props.assetAddress;
});
localStorage.setItem('receivedAssets', JSON.stringify(LSP5ReceivedAssets));
}
}
wasAssetSent.value = true;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CreateNFTCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function onSubmit(e) {
// Show EOA local storage warning
if (bytecode === '0x') {
this.isEOA = true;
isEOA.value = true;
}
isSuccess.value = true;
Expand Down

0 comments on commit 02883bd

Please sign in to comment.