-
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.
feat: implement useSendSol hook for sending SOL transactions and add …
…AboutSection component
- Loading branch information
Showing
5 changed files
with
165 additions
and
16 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,41 @@ | ||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; | ||
|
||
export const AboutSection = () => { | ||
return ( | ||
<div className="grid w-full grid-cols-2 bg-[url('/about.png')] bg-repeat font-inknut *:pb-[60px] *:pt-[80px]"> | ||
<div className="flex h-full min-h-full w-full flex-col justify-between border-r border-black pl-[140px] pr-[100px]"> | ||
<div className="space-y-8"> | ||
<p className="text-[60px] font-light leading-[72px]">About Tarot</p> | ||
<p className="text-[20px] font-light leading-[28px]"> | ||
Lorem ipsum dolor sit amet consectetur. Posuere auctor vivamus sed leo non pellentesque. Massa sed eget est | ||
porta facilisis rhoncus mauris. Pellentesque malesuada morbi volutpat dictum. Sollicitudin suspendisse | ||
aliquam imperdiet rutrum interdum. Dignissim in diam vestibulum sodales nibh nec scelerisque id. Sit | ||
facilisi vestibulum etiam nunc a. Ullamcorper amet sed etiam ac adipiscing mauris cursus blandit vitae. | ||
Lacus eget gravida morbi condimentum lobortis a. Blandit gravida dictum mollis scelerisque feugiat dis. | ||
</p> | ||
</div> | ||
|
||
<img src="/sun.png" alt="tarot1" className="!mt-auto ml-auto h-[320px] w-[305px]" /> | ||
</div> | ||
|
||
<div className="w-full space-y-8 pl-[100px] pr-[140px]"> | ||
<p className="text-[60px] font-light leading-[72px]">Rules</p> | ||
|
||
<div className="flex w-full max-w-full flex-row justify-between overflow-x-hidden *:h-[310px] *:w-[217px]"> | ||
<img src="/libra-card.png" alt="tarot1" /> | ||
<img src="/libra-card.png" alt="tarot2" /> | ||
<img src="/libra-card.png" alt="tarot3" /> | ||
</div> | ||
|
||
<Accordion type="single" defaultValue="item-0"> | ||
{new Array(6).fill(0).map((_, i) => ( | ||
<AccordionItem value={`item-${i}`} key={i}> | ||
<AccordionTrigger>Is it accessible?</AccordionTrigger> | ||
<AccordionContent>Yes. It adheres to the WAI-ARIA design pattern.</AccordionContent> | ||
</AccordionItem> | ||
))} | ||
</Accordion> | ||
</div> | ||
</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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useWallet } from '@solana/wallet-adapter-react'; | ||
import { SystemProgram, Transaction } from '@solana/web3.js'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import { OwnerAddress } from '@/constants/addresses'; | ||
import { network } from '@/lib/solana'; | ||
import { sendAndConfirmTransaction } from '@/lib/solana/utils'; | ||
import { showTxToast } from '@/lib/utils'; | ||
|
||
const useSendSol = () => { | ||
const { publicKey, sendTransaction } = useWallet(); | ||
|
||
return useMutation({ | ||
async mutationFn(amount: number) { | ||
if (!publicKey) { | ||
return; | ||
} | ||
|
||
await showTxToast('Tipping the Oracle', async () => { | ||
const rawTx = new Transaction(); | ||
|
||
rawTx.add( | ||
SystemProgram.transfer({ | ||
fromPubkey: publicKey, | ||
toPubkey: OwnerAddress[network], | ||
lamports: Number(amount) * 1e9, | ||
}), | ||
); | ||
|
||
await sendAndConfirmTransaction(publicKey, rawTx, sendTransaction); | ||
}); | ||
}, | ||
onError(error) { | ||
console.trace(error); | ||
}, | ||
}); | ||
}; | ||
|
||
export default useSendSol; |
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