Skip to content

Commit

Permalink
feat: success and pending notifications for nft transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
donnyquixotic committed Oct 23, 2023
1 parent 748cd97 commit 3dc9fe1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/pages/evm/nfts/NftDetailsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import NftDetailsCard from 'pages/evm/nfts/NftDetailsCard.vue';
import ExternalLink from 'components/ExternalLink.vue';
import AddressInput from 'components/evm/inputs/AddressInput.vue';
import UserInfo from 'components/evm/UserInfo.vue';
import { CURRENT_CONTEXT, useChainStore, useAccountStore } from 'src/antelope';
import { CURRENT_CONTEXT, useChainStore, useAccountStore, getAntelope } from 'src/antelope';
import EVMChainSettings from 'src/antelope/chains/EVMChainSettings';
import NumberedList from 'components/NumberedList.vue';
import { isValidAddressFormat } from 'src/antelope/stores/utils';
Expand All @@ -18,6 +18,7 @@ import { useI18n } from 'vue-i18n';
const route = useRoute();
const { t: $t } = useI18n();
const ant = getAntelope();
const nftStore = useNftsStore();
const chainStore = useChainStore();
const accountStore = useAccountStore();
Expand Down Expand Up @@ -79,7 +80,20 @@ const loggedAccount = computed(() =>
);
async function startTransfer(){
await nftStore.transferNft(CURRENT_CONTEXT, contractAddress, nftId, nftType, loggedAccount.value.address, address.value);
const nameString = `${nft.value.contractPrettyName || nft.value.contractAddress} #${nft.value.id}`;
const dismiss = ant.config.notifyNeutralMessageHandler(
$t('notification.neutral_message_sending', { quantity: nameString, address: address.value }),
);
try{
const trx = await nftStore.transferNft(CURRENT_CONTEXT, contractAddress, nftId, nftType, loggedAccount.value.address, address.value);
const chain_settings = ant.stores.chain.loggedEvmChain?.settings;
dismiss();
ant.config.notifySuccessfulTrxHandler(
`${chain_settings.getExplorerUrl()}/tx/${trx.hash}`,
);
}catch(e){
console.error(e); // tx error notification handled in store
}
}
</script>
Expand Down

0 comments on commit 3dc9fe1

Please sign in to comment.