Skip to content

Commit

Permalink
fix(nfts): taikoon-ui error reporting improved (#17683)
Browse files Browse the repository at this point in the history
  • Loading branch information
bearni95 authored Jun 28, 2024
1 parent eebb9df commit 116d3f4
Show file tree
Hide file tree
Showing 37 changed files with 361 additions and 383 deletions.
4 changes: 1 addition & 3 deletions packages/taikoon-ui/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
PUBLIC_WALLETCONNECT_PROJECT_ID=fake
PUBLIC_IPFS_GATEWAY=https://taikoons.4everland.link/ipfs/
PUBLIC_LAUNCH_DATE=2024-05-26T00:00:00
export PUBLIC_WALLETCONNECT_PROJECT_ID=""
2 changes: 1 addition & 1 deletion packages/taikoon-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"minidenticons": "^4.2.1",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"viem": "^2.9.29",
"viem": "^2.15.1",
"@taiko/ui-lib": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions packages/taikoon-ui/src/components/Header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
return;
}
const canMint = await Token.canMint();
const totalMintCount = await User.totalWhitelistMintCount();
const canMint = await Token.canMint(address);
const totalMintCount = await User.totalWhitelistMintCount(address);
displayYourTaikoonsButton = !canMint && totalMintCount > 0;
isChecking = false;
Expand Down
29 changes: 19 additions & 10 deletions packages/taikoon-ui/src/components/Mint/Mint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@
async function calculateGasCost() {
isCalculating = true;
gasCost = await Token.estimateMintGasCost();
gasCost = await Token.estimateMintGasCost($mintState.address);
isCalculating = false;
}
function reset() {
canMint = false;
mintState.set({ ...$mintState, address: zeroAddress });
mintState.set({ ...$mintState, address: zeroAddress, totalMintCount: -1 });
}
async function load() {
Expand All @@ -88,16 +87,19 @@
hasAlreadyMinted = balance > 0;
if (totalMintCount < 0) {
totalMintCount = await User.totalWhitelistMintCount();
await calculateGasCost();
totalMintCount = await User.totalWhitelistMintCount(address);
}
await calculateGasCost();
mintState.set({ ...$mintState, totalMintCount });
if (!hasAlreadyMinted) {
canMint = await Token.canMint();
canMint = await Token.canMint(address);
}
if (!canMint) {
mintState.set({ ...$mintState, address: address.toLowerCase() as IAddress });
if (!canMint) {
mintState.set({ ...$mintState, totalMintCount, address: address.toLowerCase() as IAddress });
isReady = true;
return;
}
Expand Down Expand Up @@ -131,9 +133,16 @@
});
mintState.set({ ...$mintState, tokenIds });
} catch (e: any) {
console.warn(e);
//showMintConfirmationModal = false
console.error(e);
mintState.set({ ...$mintState, isModalOpen: false });
if (
e.shortMessage &&
e.shortMessage ===
'The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.'
) {
e.shortMessage = 'You do not have enough ETH to cover the minting cost, please bridge some ETH to Taiko.';
}
console.error('mint error', e.name);
errorToast({
title: 'Mint Error',
message: e.shortMessage || e.message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import { switchChain } from '@wagmi/core';
import { t } from 'svelte-i18n';
import { type Chain, SwitchChainError, UserRejectedRequestError } from 'viem';
import { taiko, taikoHekla } from 'viem/chains';
import { config, taiko } from '$wagmi-config';
import { isDevelopmentEnv } from '$lib/util/isDevelopmentEnv';
import { config } from '$wagmi-config';
import { chains, getChainImage } from '../../lib/chain';
import { switchChainModal } from '../../stores/modal';
Expand All @@ -25,7 +27,7 @@
let switchingNetwork = false;
$: selectedChains = [taiko];
$: selectedChains = [isDevelopmentEnv ? taikoHekla : taiko];
function closeModal() {
$switchChainModal = false;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/taikoon-ui/src/components/sections/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { default as CollapsibleSection } from './Collapsible.section.svelte';
export { default as CountdownSection } from './Countdown.section.svelte';
export { default as FaqSection } from './Faq.section.svelte';
export { default as FooterSection } from './Footer.section.svelte';
export { default as HeadingSection } from './Heading.section.svelte';
Expand Down
12 changes: 4 additions & 8 deletions packages/taikoon-ui/src/generated/abi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
* - [__View Contract on Holesky Etherscan__](https://holesky.etherscan.io/address/0xe0c018615A074967db263abD4a98B4862dB4101f)
* -
* - [__View Contract on Taiko Mainnet Taikoscan__](https://taikoscan.network/address/0x4A045C5016B200F7E08a4caBB2cdA6E85bF53295)
* - [__View Contract on Taiko Hekla L2 Taikoscan__](https://hekla.taikoscan.network/address/0xB6Dfbbc4d1074e214d144cb6aD31a30e4F0DCD1A)
*/
export const taikoonTokenAbi = [
{
Expand Down Expand Up @@ -603,20 +602,17 @@ export const taikoonTokenAbi = [
] as const;

/**
* - [__View Contract on Holesky Etherscan__](https://holesky.etherscan.io/address/0xe0c018615A074967db263abD4a98B4862dB4101f)
* -
* - [__View Contract on Taiko Mainnet Taikoscan__](https://taikoscan.network/address/0x4A045C5016B200F7E08a4caBB2cdA6E85bF53295)
* - [__View Contract on Taiko Hekla L2 Taikoscan__](https://hekla.taikoscan.network/address/0xB6Dfbbc4d1074e214d144cb6aD31a30e4F0DCD1A)
*/
export const taikoonTokenAddress = {
17000: '0xe0c018615A074967db263abD4a98B4862dB4101f',
31337: '0xa513E6E4b8f2a923D98304ec87F64353C4D5C853',
167000: '0x4A045C5016B200F7E08a4caBB2cdA6E85bF53295',
167009: '0xB6Dfbbc4d1074e214d144cb6aD31a30e4F0DCD1A',
} as const;

/**
* - [__View Contract on Holesky Etherscan__](https://holesky.etherscan.io/address/0xe0c018615A074967db263abD4a98B4862dB4101f)
* -
* - [__View Contract on Taiko Mainnet Taikoscan__](https://taikoscan.network/address/0x4A045C5016B200F7E08a4caBB2cdA6E85bF53295)
* - [__View Contract on Taiko Hekla L2 Taikoscan__](https://hekla.taikoscan.network/address/0xB6Dfbbc4d1074e214d144cb6aD31a30e4F0DCD1A)
*/
export const taikoonTokenConfig = {
address: taikoonTokenAddress,
Expand Down
67 changes: 67 additions & 0 deletions packages/taikoon-ui/src/generated/whitelist/hekla.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"format": "standard-v1",
"tree": [
"0x3ef68af24a0113b354ddcfcdf3479a7948847d9a97fb87b07ff560843f7118bc",
"0xb0bd9bfeaf58288fb1723a92daa4791abf328c732ab91da7e8d67987edbbbdf4",
"0x5b66179d07fbdf65657248cae6476c9964eb19fa61c15df17d9db924a074c884",
"0xb29fa98d9e85a98b085fb8831143a5ffe70e96245fb523a9d195963b76d8cc0b",
"0x5406cb9aa8f450c6702c6bcddcdb19077baaab45fd536a21c8e91cfd628343f7",
"0xaaa5072acbca877abbad0ad35c2e9742a5c826aedeb2517550beeb319ae8c911",
"0x761afa50edb0e77c4a68e268ace2d310f31dec658ed16bdb83b1b7232a2768bd",
"0x7eeeb1cb3bb43fa2c2e0b50fb043859ffff066610f9dbf89b4704e773f24a3c4",
"0x127b97cebbdc3cc5e8ed1c8c14d9b61f4de9a2301d5d10988322f71155308873",
"0xee3d903875927a1fd767e1fc8b850a5840596a21a00df4c2bec30a8f5d58d16d",
"0xafc473ef5147f5d39d32d4e4b466f4beea4e859f397980156d0470bb80900373",
"0xaf53707ab893501840153fc5f05a3a24c7d185d8bcfcc44ece20f8bd2f012339",
"0x921a6e0470293d600eead14aeb046dad51a5620ee1eb5e72b95112dbbe9b245a",
"0x7358742a31cea3f1d62dc77c7d63389fbd8a194073ad04ea25e4aa0071c7b4f3",
"0x630da9f66464f1194efd874ce95e65e7bf86b556cc479cf33820325eca6415fd",
"0x4c3456dc29191b3b77a77c904ea70867a20007fe2d73f7547e42b0dc5200c1f4",
"0x456e44977c40b6df1bcb531feb67a5857454ad14ef1a4c2dd80834d19b339d0a",
"0x2f70a518d7de1c625ba6bde8144aaf8d288b49240bae6a473fb85b800b52f6bd",
"0x1ca70bee94ece504eb73f7f0fa3af861b6243f580d3915daa19047facde9871d"
],
"values": [
{
"value": ["0x8f63e3cD0D14cAef993E59B4e01e3D404cF3c1B7", "10"],
"treeIndex": 13
},
{
"value": ["0x2E2989015f5818A256EB967940454EfE8a0B4b5d", "10"],
"treeIndex": 9
},
{
"value": ["0x927a146e18294efb36edCacC99D9aCEA6aB16b95", "10"],
"treeIndex": 16
},
{
"value": ["0x4757D97449acA795510b9f3152C6a9019A3545c3", "10"],
"treeIndex": 10
},
{
"value": ["0x424bFb32f78731252a6BCeDc828E38e2701DAAEf", "10"],
"treeIndex": 11
},
{
"value": ["0xC66fAdfFeb6DA3b9A7FA3C71130F881e3a9B13fb", "10"],
"treeIndex": 12
},
{
"value": ["0xFE5124f99f544a84C3C6D0A26339a04937cD2Ff4", "10"],
"treeIndex": 14
},
{
"value": ["0xeA1688488BE7D2E1fC259ceef2b9b514A701f1D2", "12"],
"treeIndex": 15
},
{
"value": ["0x4100a9B680B1Be1F10Cb8b5a57fE59eA77A8184e", "12"],
"treeIndex": 17
},
{
"value": ["0xCe433Dd6f23333799C11199104AA6986333b7B0b", "12"],
"treeIndex": 18
}
],
"leafEncoding": ["address", "uint256"]
}
Loading

0 comments on commit 116d3f4

Please sign in to comment.