generated from Borodutch/frontend-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CNAME and package.json, delete unused files and dependencies
- Loading branch information
1 parent
efeadd9
commit 026c596
Showing
44 changed files
with
4,010 additions
and
210 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,2 @@ | ||
VITE_CONTRACT=0x357b4Ef40A5cF049114B4566773e8A6a57F8E862 | ||
VITE_ALCHEMY_BASE=123 |
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
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
google.com | ||
ameno.lol |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square150x150logo src="/img/mstile-150x150.png"/> | ||
<TileColor>#2b5797</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,19 @@ | ||
{ | ||
"name": "", | ||
"short_name": "", | ||
"icons": [ | ||
{ | ||
"src": "/img/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/img/android-chrome-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import { Suspense } from 'preact/compat' | ||
import UserCount from 'components/UserCount' | ||
import CrucialActions from 'components/CrucialActions' | ||
import Description from 'components/Description' | ||
import Mint from 'components/Mint' | ||
import Wallet from 'components/Wallet' | ||
|
||
export default function () { | ||
return ( | ||
<div className="container mx-auto max-w-prose p-10 prose"> | ||
<h1>Frontend template</h1> | ||
<Suspense fallback={<p>Loading...</p>}> | ||
<UserCount /> | ||
</Suspense> | ||
</div> | ||
<Wallet> | ||
<div className="container mx-auto max-w-prose p-10 prose"> | ||
<h1>$AMENO</h1> | ||
<Description /> | ||
<Mint /> | ||
<CrucialActions /> | ||
</div> | ||
</Wallet> | ||
) | ||
} |
This file was deleted.
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,19 @@ | ||
export default function () { | ||
return ( | ||
<> | ||
<div className="flex flex-col items-stretch gap-4 mt-8"> | ||
<button | ||
class="btn btn-primary btn-lg" | ||
onClick={() => { | ||
window.open( | ||
'https://dexscreener.com/base/0x357b4Ef40A5cF049114B4566773e8A6a57F8E862', | ||
'_blank' | ||
) | ||
}} | ||
> | ||
π Buy $AMENO π | ||
</button> | ||
</div> | ||
</> | ||
) | ||
} |
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,54 @@ | ||
import { ConnectButton } from '@rainbow-me/rainbowkit' | ||
import { useAccount } from 'wagmi' | ||
import { useEthersSigner } from 'hooks/useEthers' | ||
import { useState } from 'preact/hooks' | ||
import ClaimDashboard from 'components/ClaimDashboard' | ||
import getVerificationMessage from 'helpers/getVerificationMessage' | ||
|
||
export default function () { | ||
const signer = useEthersSigner() | ||
const [signature, setSignature] = useState('') | ||
const { address, isConnected } = useAccount() | ||
|
||
async function authorize() { | ||
try { | ||
if (!signer) { | ||
throw new Error('No signer') | ||
} | ||
if (!address) { | ||
throw new Error('No address') | ||
} | ||
const signature = await signer.signMessage( | ||
getVerificationMessage(address) | ||
) | ||
setSignature(signature) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col items-stetch gap-4"> | ||
<h2>NEW π± CLAIM $SPAM FOR FARCASTER ACTIVITY!</h2> | ||
<ul> | ||
<li>You get 5 $SPAM for every unique cast containing "$SPAM"</li> | ||
<li>Casts that only contain the word $SPAM don't count</li> | ||
<li>Every like on a cast increases the claim for the cast by 1%</li> | ||
<li>So does every recast</li> | ||
<li>Go use $SPAM in your casts!</li> | ||
<li>You can claim every 24 hours π«¦</li> | ||
</ul> | ||
<ConnectButton /> | ||
{isConnected && ( | ||
<> | ||
{!signature && ( | ||
<button class="btn btn-primary btn-lg" onClick={authorize}> | ||
Authorize $SPAM | ||
</button> | ||
)} | ||
{signature && <ClaimDashboard signature={signature} />} | ||
</> | ||
)} | ||
</div> | ||
) | ||
} |
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,110 @@ | ||
import { Spam__factory } from '@borodutch/spam-contract' | ||
import { ethers } from 'ethers' | ||
import { useAccount } from 'wagmi' | ||
import { useEthersSigner } from 'hooks/useEthers' | ||
import { useState } from 'preact/hooks' | ||
import GeneratedTicket from 'models/GeneratedTIcket' | ||
import env from 'helpers/env' | ||
import generateTicket from 'helpers/api' | ||
|
||
export default function ({ signature }: { signature: string }) { | ||
const [loading, setLoading] = useState(false) | ||
const [error, setError] = useState('') | ||
const [success, setSuccess] = useState(false) | ||
const [ticket, setTicket] = useState<GeneratedTicket | null>(null) | ||
|
||
const { address } = useAccount() | ||
const signer = useEthersSigner() | ||
|
||
async function getTicket() { | ||
setSuccess(false) | ||
setLoading(true) | ||
setError('') | ||
try { | ||
if (!address) throw new Error('No address found') | ||
const ticket = await generateTicket(address, signature) | ||
setTicket(ticket) | ||
} catch (error) { | ||
console.error(error) | ||
setError(error instanceof Error ? error.message : `${error}`) | ||
} finally { | ||
setLoading(false) | ||
} | ||
} | ||
|
||
async function claimSpam() { | ||
setLoading(true) | ||
setSuccess(false) | ||
try { | ||
if (!ticket) { | ||
throw new Error('No ticket found') | ||
} | ||
const contract = Spam__factory.connect(env.VITE_CONTRACT, signer) | ||
const { r, yParityAndS } = ethers.Signature.from( | ||
ticket.signature.signature | ||
) | ||
const tx = await contract.claimSpam( | ||
new Uint8Array(ticket.signature.message), | ||
r, | ||
yParityAndS | ||
) | ||
await tx.wait() | ||
setSuccess(true) | ||
} catch (error) { | ||
console.error(error) | ||
setError(error instanceof Error ? error.message : `${error}`) | ||
} finally { | ||
setLoading(false) | ||
} | ||
} | ||
|
||
return ( | ||
<> | ||
<div role="alert" class="alert alert-success"> | ||
You have authorized $SPAM! Now let's see if you have any $SPAM to claim | ||
𫦠| ||
</div> | ||
{!ticket && ( | ||
<button | ||
class="btn btn-primary btn-lg" | ||
onClick={getTicket} | ||
disabled={loading} | ||
> | ||
{loading ? ' π€' : ''}Get ticket to claim $SPAM ππ€² | ||
</button> | ||
)} | ||
{ticket && ( | ||
<div class="alert alert-success flex flex-col gap-4 items-stretch"> | ||
<p> | ||
You have a ticket to claim {ticket.total} $SPAM! It consists of{' '} | ||
{ticket.baseAmount} $SPAM for unique casts containing $SPAM,{' '} | ||
{ticket.additionalForLikes} $SPAM for likes, and{' '} | ||
{ticket.additionalForRecasts} $SPAM for recasts. Do not reload this | ||
page or you will lose this ticket! | ||
</p> | ||
<button | ||
class="btn btn-primary btn-lg" | ||
onClick={() => { | ||
void claimSpam() | ||
}} | ||
> | ||
Claim $SPAM ππ€² | ||
</button> | ||
</div> | ||
)} | ||
{success && ( | ||
<div role="alert" class="alert alert-success"> | ||
<span role="img" aria-label="success"> | ||
π | ||
</span>{' '} | ||
You successfully claimed $SPAM! Check your wallet for details π | ||
</div> | ||
)} | ||
{error && ( | ||
<div role="alert" class="alert alert-error break-all"> | ||
{error} | ||
</div> | ||
)} | ||
</> | ||
) | ||
} |
Oops, something went wrong.