From a7eaa5511002434412fc38477f6eb57c6dfb12a8 Mon Sep 17 00:00:00 2001 From: John Rees Date: Sat, 5 Jun 2021 13:29:46 +0100 Subject: [PATCH 1/4] remove unused imports in web/src/actions --- js/packages/web/src/actions/closeVault.ts | 9 ++------- js/packages/web/src/actions/createAuctionManager.ts | 1 - js/packages/web/src/actions/nft.tsx | 1 - js/packages/web/src/actions/sendPlaceBid.ts | 3 +-- js/packages/web/src/actions/sendRedeemBid.ts | 5 +---- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/js/packages/web/src/actions/closeVault.ts b/js/packages/web/src/actions/closeVault.ts index 2ba40f9..36faf1a 100644 --- a/js/packages/web/src/actions/closeVault.ts +++ b/js/packages/web/src/actions/closeVault.ts @@ -9,13 +9,8 @@ import { utils, actions, models } from '@oyster/common'; import { AccountLayout } from '@solana/spl-token'; import BN from 'bn.js'; import { METAPLEX_PREFIX } from '../models/metaplex'; -const { - createTokenAccount, - activateVault, - combineVault, - VAULT_PREFIX, - AUCTION_PREFIX, -} = actions; +const { createTokenAccount, activateVault, combineVault, AUCTION_PREFIX } = + actions; const { approve } = models; // This command "closes" the vault, by activating & combining it in one go, handing it over to the auction manager diff --git a/js/packages/web/src/actions/createAuctionManager.ts b/js/packages/web/src/actions/createAuctionManager.ts index fa8bbba..555c3c3 100644 --- a/js/packages/web/src/actions/createAuctionManager.ts +++ b/js/packages/web/src/actions/createAuctionManager.ts @@ -18,7 +18,6 @@ import { programIds, Creator, getSafetyDepositBoxAddress, - TokenAccount, createAssociatedTokenAccountInstruction, sendTransactionWithRetry, } from '@oyster/common'; diff --git a/js/packages/web/src/actions/nft.tsx b/js/packages/web/src/actions/nft.tsx index dc5100e..590c643 100644 --- a/js/packages/web/src/actions/nft.tsx +++ b/js/packages/web/src/actions/nft.tsx @@ -8,7 +8,6 @@ import { updateMetadata, createMasterEdition, sendTransactionWithRetry, - createTokenAccount, Data, Creator, } from '@oyster/common'; diff --git a/js/packages/web/src/actions/sendPlaceBid.ts b/js/packages/web/src/actions/sendPlaceBid.ts index b46cb5c..bf2f34e 100644 --- a/js/packages/web/src/actions/sendPlaceBid.ts +++ b/js/packages/web/src/actions/sendPlaceBid.ts @@ -14,11 +14,10 @@ import { ensureWrappedAccount, toLamports, ParsedAccount, - AuctionState, } from '@oyster/common'; import { AccountLayout, MintInfo } from '@solana/spl-token'; -import { AuctionView, AuctionViewState } from '../hooks'; +import { AuctionView } from '../hooks'; import BN from 'bn.js'; import { setupCancelBid } from './cancelBid'; const { createTokenAccount } = actions; diff --git a/js/packages/web/src/actions/sendRedeemBid.ts b/js/packages/web/src/actions/sendRedeemBid.ts index 7561213..ae15ae0 100644 --- a/js/packages/web/src/actions/sendRedeemBid.ts +++ b/js/packages/web/src/actions/sendRedeemBid.ts @@ -22,7 +22,6 @@ import { getMetadata, getReservationList, AuctionState, - placeBid, } from '@oyster/common'; import { AccountLayout, MintLayout, Token } from '@solana/spl-token'; @@ -33,7 +32,6 @@ import { redeemBid, redeemFullRightsTransferBid, redeemParticipationBid, - WinningConfig, WinningConstraint, WinningConfigItem, WinningConfigStateItem, @@ -41,8 +39,7 @@ import { import { claimBid } from '../models/metaplex/claimBid'; import { setupCancelBid } from './cancelBid'; import { populateParticipationPrintingAccount } from '../models/metaplex/populateParticipationPrintingAccount'; -import BN from 'bn.js'; -import { sendPlaceBid, setupPlaceBid } from './sendPlaceBid'; +import { setupPlaceBid } from './sendPlaceBid'; const { createTokenAccount } = actions; const { approve } = models; From 549ffe907f27c07b12a223932e6b013b7bfa3422 Mon Sep 17 00:00:00 2001 From: John Rees Date: Sat, 5 Jun 2021 13:31:30 +0100 Subject: [PATCH 2/4] remove inaccessible code in AppBar/searchBox --- js/packages/web/src/components/AppBar/searchBox.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/js/packages/web/src/components/AppBar/searchBox.tsx b/js/packages/web/src/components/AppBar/searchBox.tsx index 152ac06..df7676f 100644 --- a/js/packages/web/src/components/AppBar/searchBox.tsx +++ b/js/packages/web/src/components/AppBar/searchBox.tsx @@ -1,18 +1,9 @@ import React from 'react'; -import { Input } from 'antd'; import { SearchOutlined } from '@ant-design/icons'; import { Button } from 'antd'; import './searchBox.less'; -const { Search } = Input; - export const SearchBox = ({}) => { return ; - - const onSearch = (value: string) => console.log(value); - - return ; } From e35e8eab898bbf097db4e5ae69c4ca3bf0130a17 Mon Sep 17 00:00:00 2001 From: John Rees Date: Sat, 5 Jun 2021 13:33:57 +0100 Subject: [PATCH 3/4] remove unused imports/code from web/src/components --- js/packages/web/src/components/ArtCard/index.tsx | 2 +- js/packages/web/src/components/ArtistCard/index.tsx | 5 ++--- js/packages/web/src/components/AuctionCard/index.tsx | 11 +++-------- .../web/src/components/AuctionNumbers/index.tsx | 1 - .../web/src/components/AuctionRenderCard/index.tsx | 8 +++----- js/packages/web/src/components/Confetti/index.tsx | 3 +-- .../web/src/components/PreSaleBanner/index.tsx | 5 ++--- js/packages/web/src/components/Settings/index.tsx | 2 +- 8 files changed, 13 insertions(+), 24 deletions(-) diff --git a/js/packages/web/src/components/ArtCard/index.tsx b/js/packages/web/src/components/ArtCard/index.tsx index 2f24b90..f3b8cbc 100644 --- a/js/packages/web/src/components/ArtCard/index.tsx +++ b/js/packages/web/src/components/ArtCard/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from 'react'; +import React from 'react'; import { Card, CardProps, Button, Badge } from 'antd'; import { MetadataCategory } from '@oyster/common'; import { ArtContent } from './../ArtContent'; diff --git a/js/packages/web/src/components/ArtistCard/index.tsx b/js/packages/web/src/components/ArtistCard/index.tsx index 34a0896..1282287 100644 --- a/js/packages/web/src/components/ArtistCard/index.tsx +++ b/js/packages/web/src/components/ArtistCard/index.tsx @@ -1,14 +1,13 @@ import React, { useState } from 'react' -import { Card, Avatar } from 'antd' +import { Card } from 'antd' import { Artist } from '../../types' import './index.less' -import { Identicon, shortenAddress } from '@oyster/common' +import { shortenAddress } from '@oyster/common' import { MetaAvatar } from '../MetaAvatar'; export const ArtistCard = ({artist}: {artist: Artist}) => { - const [noImage, setNoImage] = useState(false); return ( ( export const ConfettiProvider = ({ children = null as any }) => { const canvasRef = useRef(); const confettiRef = useRef(); - const [visible, setVisible] = useState(false); const dropConfetti = useMemo(() => (() => { if(confettiRef.current && canvasRef.current){ diff --git a/js/packages/web/src/components/PreSaleBanner/index.tsx b/js/packages/web/src/components/PreSaleBanner/index.tsx index 57d1583..76f6bfe 100644 --- a/js/packages/web/src/components/PreSaleBanner/index.tsx +++ b/js/packages/web/src/components/PreSaleBanner/index.tsx @@ -1,12 +1,11 @@ -import React, { useEffect, useMemo, useState } from 'react'; +import React from 'react'; import { Col, Row, Button } from 'antd'; import './index.less'; -import { AuctionView, useAuctions, useArt } from '../../hooks'; +import { AuctionView, useArt } from '../../hooks'; import { ArtContent } from '../ArtContent'; import { AuctionCard } from '../AuctionCard'; import { Link } from 'react-router-dom'; -import moment from 'moment'; import { MetaAvatar } from '../MetaAvatar'; interface IPreSaleBanner { diff --git a/js/packages/web/src/components/Settings/index.tsx b/js/packages/web/src/components/Settings/index.tsx index 542881d..0d2d3c3 100644 --- a/js/packages/web/src/components/Settings/index.tsx +++ b/js/packages/web/src/components/Settings/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Button, Select } from 'antd'; import { contexts } from '@oyster/common'; -const { useWallet, WALLET_PROVIDERS } = contexts.Wallet; +const { useWallet } = contexts.Wallet; const { ENDPOINTS, useConnectionConfig } = contexts.Connection; export const Settings = () => { From 199c40a90591c6cfca505cd7e50273974a288b38 Mon Sep 17 00:00:00 2001 From: John Rees Date: Sat, 5 Jun 2021 13:35:41 +0100 Subject: [PATCH 4/4] remove unused code from web/src/hooks --- js/packages/web/src/contexts/meta.tsx | 13 ++----------- js/packages/web/src/hooks/useArt.ts | 1 - js/packages/web/src/hooks/useAuction.ts | 7 +------ js/packages/web/src/hooks/useAuctions.ts | 1 - js/packages/web/src/hooks/useBidsForAuction.ts | 2 -- js/packages/web/src/hooks/useCreatorArts.ts | 2 -- js/packages/web/src/hooks/useUserArts.ts | 6 ++---- 7 files changed, 5 insertions(+), 27 deletions(-) diff --git a/js/packages/web/src/contexts/meta.tsx b/js/packages/web/src/contexts/meta.tsx index 53d832d..bdd07f6 100644 --- a/js/packages/web/src/contexts/meta.tsx +++ b/js/packages/web/src/contexts/meta.tsx @@ -28,20 +28,11 @@ import { setProgramIds, useConnectionConfig, } from '@oyster/common'; -import { MintInfo, Token, TOKEN_PROGRAM_ID } from '@solana/spl-token'; -import { - NAME_PROGRAM_ID, - VERIFICATION_AUTHORITY_OFFSET, - TWITTER_VERIFICATION_AUTHORITY, - TWITTER_ACCOUNT_LENGTH, - NameRegistryState, -} from '@solana/spl-name-service'; +import { MintInfo } from '@solana/spl-token'; import { Connection, PublicKey, - PublicKeyAndAccount, - Transaction, - TransactionInstruction, + PublicKeyAndAccount } from '@solana/web3.js'; import BN from 'bn.js'; import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; diff --git a/js/packages/web/src/hooks/useArt.ts b/js/packages/web/src/hooks/useArt.ts index 527b56c..1c7d115 100644 --- a/js/packages/web/src/hooks/useArt.ts +++ b/js/packages/web/src/hooks/useArt.ts @@ -3,7 +3,6 @@ import { PublicKey } from '@solana/web3.js'; import { useMeta } from '../contexts'; import { Art, Artist, ArtType } from '../types'; import { - Creator, Edition, MasterEdition, Metadata, diff --git a/js/packages/web/src/hooks/useAuction.ts b/js/packages/web/src/hooks/useAuction.ts index 891d392..eee10a7 100644 --- a/js/packages/web/src/hooks/useAuction.ts +++ b/js/packages/web/src/hooks/useAuction.ts @@ -1,9 +1,4 @@ -import { - TokenAccount, - useConnection, - useUserAccounts, - useWallet, -} from '@oyster/common'; +import { useWallet } from '@oyster/common'; import { PublicKey } from '@solana/web3.js'; import { useEffect, useState } from 'react'; import { diff --git a/js/packages/web/src/hooks/useAuctions.ts b/js/packages/web/src/hooks/useAuctions.ts index 668ad96..5bf3056 100644 --- a/js/packages/web/src/hooks/useAuctions.ts +++ b/js/packages/web/src/hooks/useAuctions.ts @@ -10,7 +10,6 @@ import { MasterEdition, useWallet, } from '@oyster/common'; -import { WalletAdapter } from '@solana/wallet-base'; import { PublicKey } from '@solana/web3.js'; import BN from 'bn.js'; import { useEffect, useState } from 'react'; diff --git a/js/packages/web/src/hooks/useBidsForAuction.ts b/js/packages/web/src/hooks/useBidsForAuction.ts index 78cd095..151558a 100644 --- a/js/packages/web/src/hooks/useBidsForAuction.ts +++ b/js/packages/web/src/hooks/useBidsForAuction.ts @@ -1,13 +1,11 @@ import React, { useMemo } from 'react'; import { PublicKey } from '@solana/web3.js'; import { - AuctionData, BidderMetadata, BidderMetadataParser, cache, ParsedAccount, } from '@oyster/common'; -import { useAuction } from './useAuction'; export const useHighestBidForAuction = (auctionPubkey: PublicKey | string) => { const bids = useBidsForAuction(auctionPubkey); diff --git a/js/packages/web/src/hooks/useCreatorArts.ts b/js/packages/web/src/hooks/useCreatorArts.ts index c190803..ca10ec9 100644 --- a/js/packages/web/src/hooks/useCreatorArts.ts +++ b/js/packages/web/src/hooks/useCreatorArts.ts @@ -1,5 +1,3 @@ -import { TokenAccount, useUserAccounts, useWallet } from '@oyster/common'; -import { SafetyDepositDraft } from '../actions/createAuctionManager'; import { useMeta } from '../contexts'; import { PublicKey } from '@solana/web3.js'; diff --git a/js/packages/web/src/hooks/useUserArts.ts b/js/packages/web/src/hooks/useUserArts.ts index 33bbd5e..939c76c 100644 --- a/js/packages/web/src/hooks/useUserArts.ts +++ b/js/packages/web/src/hooks/useUserArts.ts @@ -1,12 +1,10 @@ -import { TokenAccount, useUserAccounts, useWallet } from '@oyster/common'; +import { TokenAccount, useUserAccounts } from '@oyster/common'; import { SafetyDepositDraft } from '../actions/createAuctionManager'; import { useMeta } from './../contexts'; export const useUserArts = (): SafetyDepositDraft[] => { - const { metadata, masterEditions, editions, whitelistedCreatorsByCreator } = - useMeta(); + const { metadata, masterEditions, editions } = useMeta(); const { userAccounts } = useUserAccounts(); - const { wallet } = useWallet(); const accountByMint = userAccounts.reduce((prev, acc) => { prev.set(acc.info.mint.toBase58(), acc);