diff --git a/components/Modal/ConfirmTeleportModal.tsx b/components/Modal/ConfirmTeleportModal.tsx index bf00f351..2bac08b7 100644 --- a/components/Modal/ConfirmTeleportModal.tsx +++ b/components/Modal/ConfirmTeleportModal.tsx @@ -94,12 +94,12 @@ export const ConfirmTeleportModal = (): JSX.Element => { const claimNFT = async () => { setIsLoading(true); if (ethToProton) { - const txPreHash = await claimNfts( - tokenContract, - tokenIds, - library.getSigner() - ); try { + const txPreHash = await claimNfts( + tokenContract, + tokenIds, + library.getSigner() + ); await txPreHash.wait(); addToast('Claimed successfully!', { appearance: 'success', @@ -108,8 +108,6 @@ export const ConfirmTeleportModal = (): JSX.Element => { } catch (err) { addToast('Claim failed.', { appearance: 'error', autoDismiss: true }); console.log('claim error', err); - setIsLoading(false); - return; } } else { const claimbackRes = await protonSDK.claimbackTeleport({ @@ -148,7 +146,7 @@ export const ConfirmTeleportModal = (): JSX.Element => { Are you sure you will teleport NFTs?
- Claim + Cancel Teleport Teleport
diff --git a/components/NftBridge/Nft.tsx b/components/NftBridge/Nft.tsx index 67e0322c..dca445a1 100644 --- a/components/NftBridge/Nft.tsx +++ b/components/NftBridge/Nft.tsx @@ -70,7 +70,7 @@ export const ProtonNft = (props: ProtonNftProps): JSX.Element => { }> { library.getSigner() ); await txPreHash.wait(); - const temp = depositList.filter( + const list = depositList.filter( (el) => el.contract != contract && el.tokenId.toHexString() != tokenId ); - setDepositList(temp); + setDepositList(list); addToast('Claimed successfully!', { appearance: 'success', autoDismiss: true, @@ -93,6 +94,28 @@ export const TrackingTables = (props: Props): JSX.Element => { } }; + const claimProton = async (assetId: string) => { + const claimbackRes = await protonSDK.claimbackTeleport({ + asset_id: assetId, + }); + + if (!claimbackRes.success) { + addToast('Claim back failed.', { + appearance: 'error', + autoDismiss: true, + }); + setIsLoading(false); + return; + } else { + const list = mintedList.filter(_ => _.asset_id != assetId); + setMintedList(list); + addToast('Claimed successfully!', { + appearance: 'success', + autoDismiss: true, + }); + } + }; + return ( <> {isLoading && } @@ -106,7 +129,7 @@ export const TrackingTables = (props: Props): JSX.Element => { OWNER COLLECTION TOKEN ID - ACTIONS + ACTION @@ -134,7 +157,7 @@ export const TrackingTables = (props: Props): JSX.Element => { onClick={() => claimEth(el.collection, el.tokenId.toHexString()) }> - Claim + Back to owner @@ -153,6 +176,7 @@ export const TrackingTables = (props: Props): JSX.Element => { # Asset ID Owner + @@ -166,6 +190,15 @@ export const TrackingTables = (props: Props): JSX.Element => { {mintedList.length - idx} {el.asset_id} {el.owner} + + + ))} diff --git a/components/NftBridge/index.tsx b/components/NftBridge/index.tsx index a64a3cd0..4147dda1 100644 --- a/components/NftBridge/index.tsx +++ b/components/NftBridge/index.tsx @@ -502,12 +502,12 @@ const NftBridge = (): JSX.Element => { From swap_button - Ethereum + Polygon { onClick={() => setNftType(NftType.ATOMIC)}> Atomic Assets - setNftType(NftType.MINTED_LIST)} align="right"> Minted List - + */} )} @@ -677,57 +677,6 @@ const NftBridge = (): JSX.Element => { + Add NFT - - {/* -
- Fee Balance:   - - {displayNumberAsAmount( - feesBalance?.balance - feesBalance?.reserved, - 4, - true - )}{' '} - XPR - -
-
- Fee:   - {transDir == TRANSFER_DIR.ETH_TO_PROTON && ( - - {displayNumberAsAmount( - filteredFees?.port_in_fee, - 4, - true - )}{' '} - XPR - - )} - {transDir == TRANSFER_DIR.PROTON_TO_ETH && ( - - {displayNumberAsAmount( - filteredFees?.port_out_fee, - 4, - true - )}{' '} - XPR - - )} -
-
*/} - Transfer diff --git a/public/polygon-matic-logo.png b/public/polygon-matic-logo.png new file mode 100644 index 00000000..7f549334 Binary files /dev/null and b/public/polygon-matic-logo.png differ diff --git a/services/ethereum.ts b/services/ethereum.ts index c58cb9d1..41f14cbc 100644 --- a/services/ethereum.ts +++ b/services/ethereum.ts @@ -47,6 +47,7 @@ export type ETH_ASSET = { export type NFT_ATTR = { name: string; image: string; + img?: string; description: string; }; @@ -79,7 +80,7 @@ export const getNfts = async (owner: string): Promise => { } while (page); const reqs = ownedNfts.map(async (nft) => { - let attributes = { + let attributes: NFT_ATTR = { name: nft.metadata.name, description: nft.metadata.description, image: nft.metadata.image, @@ -221,11 +222,9 @@ export const getDepositList = async ( const res = await nftBridgeContract.tokensByUser(owner); return res; } catch (e) { - const message = e.message[0].toUpperCase() + e.message.slice(1); - return { - success: false, - error: message || 'An error has occurred while trying to teleport.', - }; + console.log(e) + // const message = e.message[0].toUpperCase() + e.message.slice(1); + return []; } }; @@ -243,10 +242,7 @@ export const approvedNFT = async ( const res = await nftBridgeContract.approvedNFT(contract); return res; } catch (e) { - const message = e.message[0].toUpperCase() + e.message.slice(1); - return { - success: false, - error: message || 'An error has occurred while calling approvedNFT.', - }; + console.log(e) + return false; } };