-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f203d6
commit bd071c1
Showing
7 changed files
with
109 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import OButton from "@/components/OButton/OButton"; | ||
import React from "react"; | ||
|
||
const AccountListBtn = ({ | ||
monetizeId, | ||
onList, | ||
onUnlist, | ||
}: { | ||
// monetizeId should be -1 when it is non existence | ||
monetizeId: bigint; | ||
onList: () => void; | ||
onUnlist: () => void; | ||
}) => { | ||
return ( | ||
<OButton | ||
color={(monetizeId ?? -1) > -1 ? "gray" : "yellow"} | ||
btnType="fill" | ||
className="w-full mt-2" | ||
onClick={() => { | ||
(monetizeId ?? -1) > -1 ? onUnlist() : onList(); | ||
}} | ||
> | ||
{(monetizeId ?? -1) > -1 ? "Unlist" : "List"} | ||
</OButton> | ||
); | ||
}; | ||
|
||
export default AccountListBtn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Octav3Addr } from "../../env"; | ||
import { PublicClient, WalletClient, getContract } from "viem"; | ||
import Octave from "@/contracts/abis/Octave"; | ||
|
||
export const unmonetize = async (monetizeId: bigint, publicClient: PublicClient, walletClient: WalletClient) => { | ||
if (!walletClient.account) { | ||
//TODO error | ||
return | ||
} | ||
try { | ||
// connect to market smart-contract | ||
const adNft = getContract({ | ||
address: Octav3Addr, | ||
abi: Octave, | ||
publicClient, | ||
walletClient, | ||
}); | ||
|
||
// invoke contract func and mint ad nft | ||
await adNft.write. | ||
closedForMonetize([monetizeId], { account: walletClient.account, chain: walletClient.chain }) | ||
|
||
// end minting | ||
} catch (err: unknown) { | ||
console.log(err); | ||
} | ||
}; |