import { Box, Button, Center, HStack, Icon, Modal, ModalBody, ModalOverlay, ModalContent, ModalProps, Text, useColorModeValue, VStack, useRadioGroup, Stack, Flex, Divider, } from "@chakra-ui/react"; import { useWallet } from "@solana/wallet-adapter-react"; import { useErrorHandler, useSolOwnedAmount } from "@strata-foundation/react"; import React, { useState } from "react"; import { AiOutlinePlus } from "react-icons/ai"; import { useAnalyticsEventTracker } from "../hooks/useAnalyticsEventTracker"; import { useLoadDelegate } from "../hooks/useLoadDelegate"; import { RadioCardWithAffordance } from "./form/RadioCard"; import { StrataIcon } from "../svg/Strata"; import { WalletIcon } from "../svg/Wallet"; import { LitProtocolWarning } from "./LitProtocolWarning"; const options: { value: string; heading: string; subHeading: string; }[] = [ { value: "0.02", heading: "~200", subHeading: "Messages", }, { value: "0.05", heading: "~10,000", subHeading: "Messages", }, { value: "0.1", heading: "~20,000", subHeading: "Messages", }, ]; export const LoadWalletModal = ( props: Partial & { onLoaded: () => void } ) => { const { delegateWallet, loading: loadingDelegate, loadDelegate, error: delegateError, needsInit, needsTopOff, } = useLoadDelegate(); const [selectedOption, setSelectedOption] = useState( options[0].value ); const { publicKey } = useWallet(); const { amount: solAmount } = useSolOwnedAmount(publicKey || undefined); const { getRootProps, getRadioProps } = useRadioGroup({ name: "options", defaultValue: options[0].value, onChange: setSelectedOption, }); const group = getRootProps(); const gaEventTracker = useAnalyticsEventTracker(); const { handleErrors } = useErrorHandler(); handleErrors(delegateError); const exec = async () => { await loadDelegate(+selectedOption); props.onLoaded(); gaEventTracker({ action: "Load Delegate Wallet", value: +selectedOption, }); }; const labelStyles = { mt: "2", ml: "-2.5", fontSize: "sm", }; return ( {}} isCentered {...props}>
Let's load up your Chat Wallet strata.im loads a hot wallet that acts as a delegate for your main wallet. This helps us avoid asking for approval for every message. Load it up with as many messages as you want now, you can always top it off later! {options.map(({ value, heading, subHeading }) => { const radio = getRadioProps({ value, }); return ( //@ts-ignore {heading} {subHeading} ◎ {value} SOL ); })}
); };