Skip to content

Commit

Permalink
fix(nfts): taikoon-ui whitelist update (#17491)
Browse files Browse the repository at this point in the history
  • Loading branch information
bearni95 authored Jun 17, 2024
1 parent 5d7b256 commit 403c18f
Show file tree
Hide file tree
Showing 6 changed files with 1,380 additions and 1,074 deletions.
27 changes: 10 additions & 17 deletions packages/taikoon-ui/src/components/Mint/Mint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@
function reset() {
canMint = false;
totalMintCount = 0;
gasCost = 0;
mintState.set({ ...$mintState, totalMintCount, address: zeroAddress });
isReady = true;
mintState.set({ ...$mintState, address: zeroAddress });
}
async function load() {
if (isReady && (!$account || ($account && !$account.isConnected))) {
return reset();
}
isReady = false;
if (totalSupply < 0 && mintMax < 0) {
totalSupply = await Token.totalSupply();
Expand All @@ -80,13 +78,19 @@
}
if (!$account || !$account.address || $account.address === zeroAddress) {
isReady = true;
return reset();
}
const address = $account.address as IAddress;
const balance = await Token.balanceOf(address);
hasAlreadyMinted = balance > 0;
if (totalMintCount < 0) {
totalMintCount = await User.totalWhitelistMintCount();
await calculateGasCost();
}
if (!hasAlreadyMinted) {
canMint = await Token.canMint();
}
Expand All @@ -97,11 +101,6 @@
return;
}
if (totalMintCount < 0) {
totalMintCount = await User.totalWhitelistMintCount();
await calculateGasCost();
}
mintState.set({ ...$mintState, totalMintCount, address: address.toLowerCase() as IAddress });
isReady = true;
Expand Down Expand Up @@ -201,7 +200,7 @@

<Button class={buttonClasses} on:click={connectWallet} wide block type="primary">
{$t('buttons.connectWallet')}</Button>
{:else if !canMint || $mintState.totalMintCount === 0}
{:else if !canMint && $mintState.totalMintCount === 0}
<Divider />

<div class={classNames('text-xl', 'text-center')}>
Expand All @@ -223,13 +222,7 @@
<InfoRow label="Gas fee" loading={isCalculating} value={`Ξ ${gasCost}`} />
</div>

<Button
disabled={!canMint || $mintState.totalMintCount === 0}
on:click={mint}
class={buttonClasses}
wide
block
type="primary">
<Button on:click={mint} class={buttonClasses} wide block type="primary">
{$t('buttons.mint')}</Button>
{/if}
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>
<div>
<div class={textClasses}>Waiting for confirmation</div>
<a href={`https://taikoscan.network/tx/${$mintState.txHash}`} target="_blank" class={linkClasses}
<a href={`https://taikoscan.io/tx/${$mintState.txHash}`} target="_blank" class={linkClasses}
>{$t('buttons.etherscan')}
<UpRightArrow size="10" />
</a>
Expand Down
Loading

0 comments on commit 403c18f

Please sign in to comment.