Skip to content

Commit

Permalink
Merge pull request #129 from SweetmanTech/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
sweetmantech authored Aug 6, 2024
2 parents 89e7ae8 + 0e723b1 commit e993fab
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 28 deletions.
26 changes: 26 additions & 0 deletions src/components/CollectHydro/CollectHydro.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { toast } from "react-toastify"
import useHydroCollect from "@/hooks/useHydroCollect"

const CollectHydro = ({ className = "" }) => {
const { collect, loading } = useHydroCollect()

const handleClick = async () => {
const response = await collect()
if (!response) return
toast.success("Collected!")
}

return (
<button
type="button"
onTouchStart={handleClick}
onClick={handleClick}
className={`${className} bg-darkgray py-[3px] w-full`}
disabled={loading}
>
{loading ? `Collecting...` : "Collect"}
</button>
)
}

export default CollectHydro
3 changes: 3 additions & 0 deletions src/components/CollectHydro/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import CollectHydro from "./CollectHydro"

export default CollectHydro
28 changes: 1 addition & 27 deletions src/components/Pages/AboutPage/AboutContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,7 @@ const AboutContent = ({ isPopup = false }) => (
px-[15px] flex flex-col gap-y-[5px] md:gap-y-[20px]`}
>
<p>
{` Heno. is a true trailblazer of the music industry, boasting a plethora of talents as an
artist, producer, engineer, community organizer, and Web3 builder. Notably, Heno. has been
recognized as an "early innovator" in Web3 by Fortune Mag, while COLORS have praised his
"hard-hitting and powerful aesthetic." Heno. has carved a unique and hybrid role in the
music industry, simultaneously disrupting both the Web3 space and traditional music world.`}
</p>
<p>
{`Hailing from Takoma Park, Maryland, as a first-generation Ethiopian-Eritrean artist, Heno.
uses his art and music to tell intentional and impactful stories, finding comfort within
uncomfortable conversations. With an impressive roster of collaborators including Mick
Jenkins, JPEGMAFIA, Chaz Bear (Toro Y Moi) just to name a few, Heno. has proven his
versatility as an artist. Heno.'s recently released the anticipated video for his track
"Neybors" that has gained popularity, hitting over 3 million streams & continuing to grow.
The track has been well-received by audiences in 2023 & had earned Heno. top ten spots on
Spotify's Mellow Bars & Alternative Hip Hop playlists - not to mention performing the
record at Coachella this year & being the first music artist to ever mint Coachella
footage onchain.`}
</p>
<p>
{`"Neybors" is the first single from Heno.'s forthcoming concept album "I'm Tired of Being
Hypersurveilled" set to release in January 2024. Heno. speaks to his exhaustion with the
oppressive & all encompassing nature of surveillance by using personal experience & world
building to have universal conversations. This record is a part of a multi-hyphenate media
experience that includes a pixel arcade game, a VR world built in Unreal Engine, a short
film, + full length music album with features like Mick Jenkins, Elujay, Felix! & more.
"Neybors" is on the lighter side of surveillance however the music further explores how
surveillance affects all of us in a myriad of ways & why Heno. is tired of it.`}
{`Heno. is an artist and producer who experiments across different mediums, hailed by Fortune as an "early innovator" & praised by COLORS for his "hard-hitting and powerful aesthetic." A first-generation Ethiopian-Eritrean based in Los Angeles, CA by way of Takoma Park, Maryland, Heno. uses his music and love for art to explore impactful stories & build worlds bridging the traditional music industry & the Web3 space. Sonically, Heno.'s versatility knows no bounds with collaborations from Mick Jenkins, JPEGMAFIA, Chaz Bear (Toro Y Moi), Elujay, J.Robb & many more that have amassed millions of plays. Heno. has a lot in the queue this year with new music on the horizon, stay tuned for more.`}
</p>
</div>
<RecBar cctvNumber={1} />
Expand Down
23 changes: 23 additions & 0 deletions src/components/Pages/Web3Page/HydroplaningSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import CollectHydro from "@/components/CollectHydro"
import data from "@/lib/zora-drops"

const HydroplaningSection = ({ isPopup }) => (
<div className="w-full flex flex-col gap-1.5">
<video
src="https://ipfs.decentralized-content.com/ipfs/bafybeibifnzka6oqs77ascf5fuhtxtv4mc56jc47rb4fqbjz644byzu72q"
preload="auto"
controls
playsInline
webkit-playsinline
x5-playsinline
muted
className={`${isPopup ? "h-[200px]" : "h-[300px]"}`}
/>
<CollectHydro />
<span className={`uppercase text-[12px] ${isPopup ? "md:text-[14px]" : "md:text-[16px]"}`}>
{data[11].title} By {data[11].artist}
</span>
</div>
)

export default HydroplaningSection
2 changes: 2 additions & 0 deletions src/components/Pages/Web3Page/Trailer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import ArcadeSection from "./ArcadeSection"
import DropSection from "./DropSection"
import HydroplaningSection from "./HydroplaningSection"
import NeyborsSection from "./NeyborsSection"
import TopArbitrumSection from "./TopArbitrumSection"

const Trailer = ({ isPopup = false }) => (
<div className="h-full overflow-y-auto w-full">
<div className={`flex flex-col items-center gap-y-[10px] ${!isPopup && "md:gap-y-[20px]"}`}>
<div className="flex flex-col gap-y-[10px] h-full overflow-y-auto pr-2">
<HydroplaningSection isPopup={isPopup} />
<TopArbitrumSection isPopup={isPopup} />
<DropSection isPopup={isPopup} />
<ArcadeSection isPopup={isPopup} />
Expand Down
74 changes: 74 additions & 0 deletions src/hooks/useHydroCollect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import {
HYDROPLANING_DROP_ADDRESS,
IS_TESTNET,
ZORA_FEE,
HYDROPLANING_REWARDS_RECIPIENT,
} from "@/lib/consts"
import handleTxError from "@/lib/handleTxError"
import { useState } from "react"
import { BigNumber } from "ethers"
import { base, baseSepolia } from "viem/chains"
import getEncodedMinterArgs from "@/lib/zora/getEncodedMinterArgs"
import {
zoraCreator1155ImplABI,
zoraCreatorFixedPriceSaleStrategyAddress,
} from "@zoralabs/protocol-deployments"
import get1155SaleStatus from "@/lib/get1155SaleStatus"
import usePrivySendTransaction from "./usePrivySendTransaction"
import useConnectedWallet from "./useConnectedWallet"
import usePreparePrivyWallet from "./usePreparePrivyWallet"

const useHydroCollect = () => {
const { prepare } = usePreparePrivyWallet()
const { connectedWallet } = useConnectedWallet()
const { sendTransaction } = usePrivySendTransaction()
const [loading, setLoading] = useState(false)
const chainId = IS_TESTNET ? baseSepolia.id : base.id

const collect = async () => {
try {
if (!(await prepare(chainId))) return false
if (!connectedWallet) return false

setLoading(true)
const saleDetails = await get1155SaleStatus(HYDROPLANING_DROP_ADDRESS, 1, chainId)
const totalFee = BigNumber.from(saleDetails?.pricePerToken).add(ZORA_FEE).toHexString()

const minterArguments = getEncodedMinterArgs(connectedWallet, "!!!")

const response = await sendTransaction(
HYDROPLANING_DROP_ADDRESS,
chainId,
zoraCreator1155ImplABI,
"mint",
[
zoraCreatorFixedPriceSaleStrategyAddress[chainId],
1,
1,
[HYDROPLANING_REWARDS_RECIPIENT],
minterArguments,
],
totalFee,
"HENO.WEB3",
"COLLECT",
)
const { error } = response as any
if (error) {
setLoading(false)
return false
}
setLoading(false)
return response
} catch (error) {
handleTxError(error)
return { error }
}
}

return {
collect,
loading,
}
}

export default useHydroCollect
22 changes: 21 additions & 1 deletion src/lib/consts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { sepolia, base, zora, arbitrumSepolia, arbitrum, mainnet, zoraSepolia } from "viem/chains"
import {
sepolia,
base,
zora,
arbitrumSepolia,
arbitrum,
mainnet,
zoraSepolia,
baseSepolia,
} from "viem/chains"

export const IS_TESTNET = process.env.NEXT_PUBLIC_TESTNET === "true"
export const CHAIN = process.env.NEXT_PUBLIC_TESTNET ? sepolia : base
Expand All @@ -24,6 +33,12 @@ export const HYPERSURVEILLED_ART = IS_TESTNET
export const SXSW_BTS = IS_TESTNET
? "0x6a080D831CDEe15263CC6Db32E0F888d9ec11392"
: "0x0837ced4a124a0f766c2974bc0bdeb4232abb9a1"
export const HYDROPLANING_DROP_ADDRESS = IS_TESTNET
? "0x9700ea060d43ff3c7ed14b859ea6108a7ef7c2f7"
: "0x5c0fd2ceb2fb1799116514d29b9956097eaa8c87"
export const HYDROPLANING_REWARDS_RECIPIENT = IS_TESTNET
? "0x52d91e960e52641ee7142e2942378dda357b8685"
: "0x61edd3496d5FF1b84F36be0922a9197f8AAC486e"
export const SPOTIFY_STATE_KEY = "spotify_auth_state"
export const RELIEF_TRACK_ID = "5aDNHHNXc16VktqV1gSq23"
export const HENO_ARTIST_ID = "3mr6jeVpPIXBp8IMMb60aD"
Expand Down Expand Up @@ -82,4 +97,9 @@ export const COLLECTIONS = [
chain: IS_TESTNET ? zoraSepolia : zora,
type: "ERC721",
},
{
collectionAddress: HYDROPLANING_DROP_ADDRESS,
chain: IS_TESTNET ? baseSepolia : base,
type: "ERC1155",
},
]
25 changes: 25 additions & 0 deletions src/lib/get1155SaleStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Contract } from "ethers"
import {
zoraCreatorFixedPriceSaleStrategyABI,
zoraCreatorFixedPriceSaleStrategyAddress,
} from "@zoralabs/protocol-deployments"
import getDefaultProvider from "./getDefaultProvider"

const get1155SaleStatus = async (collectionAddress, tokenId, chainId) => {
try {
const fixedPriceSaleStrategry = new Contract(
zoraCreatorFixedPriceSaleStrategyAddress[chainId],
zoraCreatorFixedPriceSaleStrategyABI,
getDefaultProvider(chainId),
)
const saleDetails = await fixedPriceSaleStrategry.sale(collectionAddress, tokenId)

return saleDetails
} catch (err) {
// eslint-disable-next-line no-console
console.error(err)
return null
}
}

export default get1155SaleStatus
6 changes: 6 additions & 0 deletions src/lib/zora-drops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const data = [
title: "NEYBORS Music Video - Heno. featuring Elujay & J.Robb",
startedAt: "March 29, 2023",
},
{
ipfs: "https://ipfs.decentralized-content.com/ipfs/bafybeieaq7nqlv5j2wndfkxwlodqddelahlmuwczbrzei7py5enzftuska",
artist: "heno",
title: "Hydroplaning Music Video (Heno. x Mick Jenkins)",
startedAt: "August 06, 2024",
},
]

export default data

0 comments on commit e993fab

Please sign in to comment.