Skip to content

Commit

Permalink
rm totalProfit
Browse files Browse the repository at this point in the history
  • Loading branch information
iskysun96 committed May 25, 2024
1 parent 68392a2 commit af121b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export function Header() {
const [openSellModal, setOpenSellModal] = useState(false)
const [openWithdrawModal, setOpenWithdrawModal] = useState(false)
// const [openMintModal, setOpenMintModal] = useState(false)
const [totalProfit, setTotalProfit] = useState<bigint>(0n)

const toggleWalletModal = () => {
setOpenWalletModal((prev) => !prev)
Expand All @@ -38,7 +37,6 @@ export function Header() {
{/* <button className="font-bold disabled:text-gray-200" onClick={toggleMintModal} disabled={!activeAddress}>
Mint NFT
</button> */}
{/* <span className="font-bold">Total Profit: {Number(totalProfit) / 1e6} ALGOs</span> */}
</div>
<div className="flex flex-row items-center gap-8 text-white px-4">
<button
Expand All @@ -54,7 +52,7 @@ export function Header() {
</div>
<ConnectWallet openModal={openWalletModal} closeModal={toggleWalletModal} />
<Sell openModal={openSellModal} setModalState={setOpenSellModal} />
<Withdraw setTotalProfit={setTotalProfit} openModal={openWithdrawModal} setModalState={setOpenWithdrawModal} />
<Withdraw openModal={openWithdrawModal} setModalState={setOpenWithdrawModal} />
{/* <MintNft openModal={openMintModal} setModalState={setOpenMintModal} /> */}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import * as methods from '../methods'
interface WithdrawInterface {
openModal: boolean
setModalState: (value: boolean) => void
setTotalProfit: (value: bigint) => void
}

const Withdraw = ({ openModal, setModalState, setTotalProfit }: WithdrawInterface) => {
const Withdraw = ({ openModal, setModalState }: WithdrawInterface) => {
const [loading, setLoading] = useState<boolean>(false)

const { enqueueSnackbar } = useSnackbar()
Expand Down Expand Up @@ -66,7 +65,7 @@ const Withdraw = ({ openModal, setModalState, setTotalProfit }: WithdrawInterfac
}

try {
await methods.deleteApp(algorandClient, nftmClient, listClient, activeAddress, Number(myAppId), setTotalProfit)()
await methods.deleteApp(algorandClient, nftmClient, listClient, activeAddress, Number(myAppId))()
} catch (error) {
enqueueSnackbar('Error deleting the app', { variant: 'error' })
setLoading(false)
Expand Down
6 changes: 1 addition & 5 deletions projects/orakle-nft-marketplace-app-frontend/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,11 @@ export function deleteApp(
listClient: NftMarketplaceListClient,
sender: string,
appId: number,
setTotalProfit: (profit: bigint) => void,
) {
return async () => {
console.log('deleting app')

const result = await algorand
await algorand
.newGroup()
.addMethodCall({
sender: sender,
Expand All @@ -130,8 +129,5 @@ export function deleteApp(
args: [appId],
})
.execute()

const totalProfit = result.returns![0].returnValue
setTotalProfit(totalProfit?.valueOf() as bigint)
}
}

0 comments on commit af121b0

Please sign in to comment.