diff --git a/apps/mobile/src/app/Router.tsx b/apps/mobile/src/app/Router.tsx index 0d26e872..fa75f1f1 100644 --- a/apps/mobile/src/app/Router.tsx +++ b/apps/mobile/src/app/Router.tsx @@ -111,25 +111,48 @@ const HomeBottomTabNavigator: React.FC = () => { }} /> - ( - - - {focused && } - - ), - }} - /> + {publicKey && + ( + + + {focused && } + + ), + }} + /> + } + + {!publicKey && + ( + + + {focused && } + + ), + }} + /> + } ); }; @@ -205,6 +228,9 @@ const MainNavigator: React.FC = () => { + + + ); }; @@ -264,6 +290,7 @@ const RootNavigator: React.FC = () => { return ( + {/* */} {publicKey ? ( ) : ( diff --git a/apps/mobile/src/app/Wrapper.tsx b/apps/mobile/src/app/Wrapper.tsx index ba9693d6..f0f96502 100644 --- a/apps/mobile/src/app/Wrapper.tsx +++ b/apps/mobile/src/app/Wrapper.tsx @@ -17,6 +17,7 @@ import { StarknetProvider } from './StarknetProvider'; import { TanstackProvider } from 'afk_nostr_sdk'; import { NostrProvider } from 'afk_nostr_sdk'; import { TipModalStarknetProvider } from '../context/TipModalStarknet'; +import { TokenCreateModalProvider } from '../context/TokenCreateModal'; const queryClient = new QueryClient({ defaultOptions: { queries: { retry: 2 } }, }); @@ -28,7 +29,9 @@ const ModalProviders = ({ children }: { children: React.ReactNode }) => { - {children} + + {children} + diff --git a/apps/mobile/src/context/TokenCreateModal.tsx b/apps/mobile/src/context/TokenCreateModal.tsx new file mode 100644 index 00000000..5c7293ec --- /dev/null +++ b/apps/mobile/src/context/TokenCreateModal.tsx @@ -0,0 +1,68 @@ +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {createContext, useCallback, useMemo, useRef, useState} from 'react'; + +import { KeyModalAction} from '../modules/KeyModal'; +import {TipSuccessModal, TipSuccessModalProps} from '../modules/TipSuccessModal'; +import { TokenCreateModal } from '../modules/TokenCreatedModal'; +import { Modalize } from 'react-native-modalize'; + +export type TokenCreateModal = Modalize; + +export type TokenCreatedContextType = { + show: (event?: NDKEvent, starknetAddress?: string) => void; + hide?: () => void; + + showSuccess?: (props: TipSuccessModalProps) => void; + hideSuccess?: () => void; +}; + +export const TokenModalContext = createContext(null); + +export const TokenCreateModalProvider: React.FC = ({children}) => { + const tokenModalRef = useRef(null); + + const [event, setEvent] = useState(); + const [starknetAddress, setStarknetAddress] = useState(); + const [action, setAction] = useState(); + const [successModal, setSuccessModal] = useState(null); + + const show = useCallback((event?: NDKEvent, starknetAddress?: string, action?: KeyModalAction) => { + setEvent(event); + setStarknetAddress(starknetAddress); + tokenModalRef.current?.open(); + }, []); + + const hide = useCallback(() => { + tokenModalRef.current?.close(); + setEvent(undefined); + }, []); + + const showSuccess = useCallback((props: TipSuccessModalProps) => { + setSuccessModal(props); + }, []); + + const hideSuccess = useCallback(() => { + setSuccessModal(null); + }, []); + + const context = useMemo( + () => ({show, hide, showSuccess, hideSuccess}), + [show, hide, showSuccess, hideSuccess], + ); + return ( + + {children} + + + {successModal && } + + ); +}; diff --git a/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts b/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts index f56d9e8f..4802d8ae 100644 --- a/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts +++ b/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts @@ -13,7 +13,7 @@ export const useGetTokenLaunch = () => { queryKey: ['token_launch'], queryFn: async () => { const res = await ApiIndexerInstance.get('/deploy-launch'); - console.log("res get launch",res) + // console.log("res get launch",res) return res }, }); diff --git a/apps/mobile/src/hooks/modals/useTokenCreateModal.ts b/apps/mobile/src/hooks/modals/useTokenCreateModal.ts new file mode 100644 index 00000000..493a7521 --- /dev/null +++ b/apps/mobile/src/hooks/modals/useTokenCreateModal.ts @@ -0,0 +1,13 @@ +import {useContext} from 'react'; + +import {TokenModalContext} from '../../context/TokenCreateModal'; + +export const useTokenCreatedModal = () => { + const context = useContext(TokenModalContext); + + if (!context) { + throw new Error('useTokenCreatedModal error with TokenModalContext'); + } + + return context; +}; diff --git a/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx b/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx index 70374947..99797cb2 100644 --- a/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx +++ b/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx @@ -15,6 +15,8 @@ import { useAuth } from 'afk_nostr_sdk'; import { MainStackNavigationProps } from '../../types'; import { useAccount } from '@starknet-react/core'; import { useCreateToken, DeployTokenFormValues } from '../../hooks/launchpad/useCreateToken'; +import { TipSuccessModalProps } from '../TipSuccessModal'; +import { NDKEvent } from '@nostr-dev-kit/ndk'; const UsernameInputLeft = ( @@ -27,15 +29,23 @@ enum TypeCreate { CREATE, CREATE_AND_LAUNCH } +export type FormTokenCreatedProps = { + event?: NDKEvent; + starknetAddress?: string; + hide?: () => void; + showSuccess?: (props: TipSuccessModalProps) => void; + hideSuccess?: () => void; +}; + + type FormValues = DeployTokenFormValues; -export const FormLaunchToken: React.FC = () => { +export const FormLaunchToken: React.FC = () => { const formikRef = useRef>(null); const styles = useStyles(stylesheet); const publicKey = useAuth((state) => state.publicKey); const profile = useProfile({ publicKey }); const queryClient = useQueryClient(); const { showToast } = useToast(); - const navigation = useNavigation(); const account = useAccount() const waitConnection = useWaitConnection() const { deployToken, deployTokenAndLaunch } = useCreateToken() @@ -58,7 +68,6 @@ export const FormLaunchToken: React.FC = () => { const validateForm = (values: FormValues) => { const errors = {} as Partial; - // TODO: Do validation return errors; @@ -144,14 +153,10 @@ export const FormLaunchToken: React.FC = () => { diff --git a/apps/mobile/src/modules/Layout/sidebar/index.tsx b/apps/mobile/src/modules/Layout/sidebar/index.tsx index 48b5942c..8bede9a2 100644 --- a/apps/mobile/src/modules/Layout/sidebar/index.tsx +++ b/apps/mobile/src/modules/Layout/sidebar/index.tsx @@ -6,29 +6,34 @@ import { Icon } from '../../../components/Icon'; import { useNavigation } from '@react-navigation/native'; import { DrawerStackNavigationProps, MainStackNavigationProps } from '../../../types'; // import { useAuth } from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; +import { useAuth, useNostrContext } from 'afk_nostr_sdk'; import { DrawerNavigationHelpers } from '@react-navigation/drawer/lib/typescript/src/types'; interface SidebarInterface { // navigation:MainStackNavigationProps | DrawerNavigationHelpers - navigation:any + navigation: any } const Sidebar = ( - {navigation}:SidebarInterface + { navigation }: SidebarInterface ) => { const styles = useStyles(stylesheet); const publicKey = useAuth((state) => state.publicKey); + const ndk = useNostrContext() // const navigation = useNavigation() // const navigation = useNavigation() const handleNavigateProfile = () => { navigation.navigate("Profile", { publicKey: publicKey }); }; + + const handleAuth = () => { + navigation.navigate("Auth"); + }; const theme = useTheme() // const handleNavigateHome = () => { // navigation.navigate("Home"); // }; - const handleDefiScreen = () => { + const handleDefiScreen = () => { navigation.navigate("Defi"); }; const handleGameScreen = () => { @@ -41,13 +46,13 @@ const Sidebar = ( const handleTipsScreen = () => { navigation.navigate("Tips"); }; - useEffect(() => { - const unsubscribe = navigation.addListener('drawerClose', () => { - // Code to handle drawer closing - }); + useEffect(() => { + const unsubscribe = navigation.addListener('drawerClose', () => { + // Code to handle drawer closing + }); - return unsubscribe; - }, [navigation]); + return unsubscribe; + }, [navigation]); return ( @@ -103,7 +108,6 @@ const Sidebar = ( - @@ -118,7 +122,6 @@ const Sidebar = ( - @@ -129,25 +132,37 @@ const Sidebar = ( Onramp & DeFI - - - - - - Profile - - - - - - + {publicKey && + + + + Profile + + + + } + + {!publicKey && !ndk?.ndk?.signer && + + + + Login + + + } ); diff --git a/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx new file mode 100644 index 00000000..6c5605f7 --- /dev/null +++ b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx @@ -0,0 +1,234 @@ +import { NDKEvent } from '@nostr-dev-kit/ndk'; +import { useAccount } from '@starknet-react/core'; +import { useEffect, useState } from 'react'; +import React from 'react'; +import { View } from 'react-native'; +import { CallData, constants } from 'starknet'; + +import { Button, Text } from '../../components'; +import { KEYS_ADDRESS } from '../../constants/contracts'; +import { TokenSymbol } from '../../constants/tokens'; +import { useStyles, useWaitConnection } from '../../hooks'; +import { useDataKeys } from '../../hooks/keys/useDataKeys'; +import { + useProfile, +} from "afk_nostr_sdk" +import { useInstantiateKeys } from '../../hooks/keys/useInstantiateKeys'; +import { useTransactionModal } from '../../hooks/modals'; +import { useDialog } from '../../hooks/modals/useDialog'; +import { useTransaction } from '../../hooks/modals/useTransaction'; +import { useWalletModal } from '../../hooks/modals/useWalletModal'; +import { KeysUser } from '../../types/keys'; +import { feltToAddress } from '../../utils/format'; +import { TipSuccessModalProps } from '../TipSuccessModal'; +import { KeyModalAction } from '.'; +import stylesheet from './styles'; + +export type FormInstantiateKeyProps = { + event?: NDKEvent; + starknetAddress?: string; + action?: KeyModalAction; + + hide: () => void; + showSuccess: (props: TipSuccessModalProps) => void; + hideSuccess: () => void; +}; + +export const FormInstantiateKey = ({ + event, + starknetAddress, + hide, + hideSuccess, + showSuccess, + action, +}: FormInstantiateKeyProps) => { + const styles = useStyles(stylesheet); + + const [token, setToken] = useState(TokenSymbol.ETH); + const [amount, setAmount] = useState(''); + + const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const [myKey, setMyKey] = useState(); + const [keySelected, setKeySelected] = useState(); + const [isCanInstantiateKey, setCanInstantiateKey] = useState(false); + + const account = useAccount(); + const walletModal = useWalletModal(); + const sendTransaction = useTransaction(); + const { hide: hideTransactionModal } = useTransactionModal(); + const waitConnection = useWaitConnection(); + const { handleInstantiateKeys } = useInstantiateKeys(); + const { getAllKeys, getKeyByAddress } = useDataKeys(); + const { showDialog, hideDialog } = useDialog(); + const isActive = !!amount && !!token; + + useEffect(() => { + const getKeyByUserConnected = async () => { + if (!account?.address) return; + const myOwnKey = await getKeyByAddress(account?.address); + console.log('myOwnKey', myOwnKey); + setMyKey(myOwnKey); + }; + + const getKeyOfParams = async () => { + if (!starknetAddress) return; + const key = await getKeyByAddress(starknetAddress); + // console.log('key', key); + setKeySelected(key); + }; + + getKeyOfParams(); + getKeyByUserConnected(); + }, [account?.address, starknetAddress]); + + const onConnect = async () => { + if (!account.address) { + walletModal.show(); + + const result = await waitConnection(); + if (!result) return; + } + }; + + const onInstantiateKeys = async () => { + const contractAddress = KEYS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const call = { + contractAddress, + entrypoint: 'instantiate_keys', + calldata: CallData.compile({}), + }; + if (!account || !account?.account) return; + + + const receipt = await sendTransaction({ + calls: [ + call + // { + // contractAddress: ESCROW_ADDRESSES[CHAIN_ID], + // entrypoint: Entrypoint.DEPOSIT, + // calldata: depositCallData, + // }, + ], + }); + // const tx = await account?.account?.execute([call], undefined, {}); + // console.log('tx hash', tx?.transaction_hash); + // if (tx?.transaction_hash) { + // const wait_tx = await account?.account?.waitForTransaction(tx?.transaction_hash); + // // await handleInstantiateKeys(account?.account); + // } + + if (receipt?.isSuccess()) { + hideTransactionModal(); + showSuccess({ + amount: Number(amount), + symbol: token, + user: + (profile?.nip05 && `@${profile.nip05}`) ?? + profile?.displayName ?? + profile?.name ?? + event?.pubkey, + children:(<> + Your key is instantiate! + ), + hide: hideSuccess, + }); + } else { + let description = 'Please Try Again Later.'; + if (receipt?.isRejected()) { + description = receipt.transaction_failure_reason.error_message; + } + + showDialog({ + title: 'Failed to send the tip', + description, + buttons: [{ type: 'secondary', label: 'Close', onPress: () => hideDialog() }], + }); + } + + }; + + return ( + + + + + + + {profile?.displayName ?? profile?.name ?? event?.pubkey} + + + {profile?.nip05 && ( + + @{profile?.nip05} + + )} + + + + + + {event?.content} + + + + {!account?.address && } + + + + Instantiate your key + + + + + + {account?.address && + Connect: {account?.address} + } + + + {(myKey && BigInt(myKey?.owner) == BigInt(0)) || + (!myKey && )} + {/* {myKey && ( + + {feltToAddress(BigInt(myKey?.owner))} + + )} + + {keySelected && ( + + {feltToAddress(BigInt(keySelected?.owner))} + + )} */} + + + + + + + + Instantiate key + + + ); +}; diff --git a/apps/mobile/src/modules/TokenCreatedModal/index.tsx b/apps/mobile/src/modules/TokenCreatedModal/index.tsx new file mode 100644 index 00000000..31b76689 --- /dev/null +++ b/apps/mobile/src/modules/TokenCreatedModal/index.tsx @@ -0,0 +1,97 @@ +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {forwardRef, useEffect, useState} from 'react'; + +import {Modalize, Text} from '../../components'; +import {TokenSymbol} from '../../constants/tokens'; +import {useStyles, useWaitConnection} from '../../hooks'; +import {useProfile} from "afk_nostr_sdk" +import {useDataKeys} from '../../hooks/keys/useDataKeys'; +import {useInstantiateKeys} from '../../hooks/keys/useInstantiateKeys'; +import {useTransactionModal} from '../../hooks/modals'; +import {useDialog} from '../../hooks/modals/useDialog'; +import {useTransaction} from '../../hooks/modals/useTransaction'; +import {useWalletModal} from '../../hooks/modals/useWalletModal'; +import {KeysUser} from '../../types/keys'; +import {TipSuccessModalProps} from '../TipSuccessModal'; +import {FormInstantiateKey} from './FormInstantiateKey'; +import stylesheet from './styles'; +import { FormLaunchToken } from '../LaunchTokenPump/FormLaunchToken'; + +export type KeyModal = Modalize; + +export enum KeyModalAction { + INSTANTIATE, + BUY, + SELL, +} +export type TokenCreateModalProps = { + event?: NDKEvent; + starknetAddress?: string; + action?: KeyModalAction; + + show?: (event?: NDKEvent, starknetAddress?: string, action?: KeyModalAction) => void; + hide?: () => void; + showSuccess?: (props: TipSuccessModalProps) => void; + hideSuccess?: () => void; +}; + +export const TokenCreateModal = forwardRef( + ({event, hide: hideKeyModal, showSuccess, hideSuccess, starknetAddress, action}, ref) => { + const styles = useStyles(stylesheet); + const [token, setToken] = useState(TokenSymbol.ETH); + const [amount, setAmount] = useState(''); + const {data: profile} = useProfile({publicKey: event?.pubkey}); + const [myKey, setMyKey] = useState(); + const account = useAccount(); + const walletModal = useWalletModal(); + const {showDialog, hideDialog} = useDialog(); + const isActive = !!amount && !!token; + + + return ( + + + {/* + {!action || (action == KeyModalAction?.INSTANTIATE) + // || account?.address == starknetAddress && + && + + } */} + + + Launch & pump the coins! + + + ); + }, +); +TokenCreateModal.displayName = 'TokenCreateModal'; diff --git a/apps/mobile/src/modules/TokenCreatedModal/styles.ts b/apps/mobile/src/modules/TokenCreatedModal/styles.ts new file mode 100644 index 00000000..098c0ef2 --- /dev/null +++ b/apps/mobile/src/modules/TokenCreatedModal/styles.ts @@ -0,0 +1,111 @@ +import {Platform} from 'react-native'; + +import {Spacing, ThemedStyleSheet} from '../../styles'; + +export default ThemedStyleSheet((theme) => ({ + modal: { + paddingBottom: Spacing.xxlarge, + }, + + header: { + width: '100%', + marginBottom: Spacing.medium, + paddingTop: Spacing.small, + paddingLeft: Spacing.small, + paddingBottom: Spacing.medium, + paddingRight: Spacing.small, + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + icon: { + color: theme.colors.primary, + }, + + cardHeader: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + cardContent: { + flex: 1, + flexDirection: 'row', + gap: 5, + alignItems: 'center', + }, + cardInfo: { + flex: 1, + paddingRight: Spacing.small, + }, + + title: { + marginBottom: Spacing.xsmall, + }, + + cardContentText: { + paddingTop: Spacing.small, + paddingRight: Spacing.small, + color: theme.colors.text, + }, + likes: { + flexDirection: 'row', + gap: 3, + alignItems: 'center', + }, + + sending: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + }, + sendingText: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + gap: Spacing.xsmall, + }, + + recipient: { + flex: 1, + flexDirection: 'row', + gap: 4, + alignItems: 'center', + justifyContent: 'flex-end', + }, + card: { + width: '100%', + backgroundColor: theme.colors.primaryLight, + borderRadius: 16, + padding: Spacing.medium, + }, + + comment: { + paddingTop: Spacing.small, + }, + + pickerContainer: { + flex: 1, + gap: 20, + paddingTop: Spacing.xxlarge, + paddingBottom: Spacing.xxlarge, + }, + + more: { + paddingLeft: Spacing.small, + color: theme.colors.primary, + }, + + likeIcon: { + color: theme.colors.primary, + }, + + content: { + padding: Spacing.xlarge, + paddingTop: Platform.OS === 'ios' ? Spacing.xlarge : Spacing.xsmall, + }, + + submitButton: { + paddingTop: Spacing.xlarge, + }, +})); diff --git a/apps/mobile/src/screens/Auth/Login.tsx b/apps/mobile/src/screens/Auth/Login.tsx index 4d861e0f..e5fc78d6 100644 --- a/apps/mobile/src/screens/Auth/Login.tsx +++ b/apps/mobile/src/screens/Auth/Login.tsx @@ -10,13 +10,14 @@ import {Auth} from '../../modules/Auth'; // import {useAuth} from '../../store/auth'; import { useAuth } from 'afk_nostr_sdk'; -import {AuthLoginScreenProps} from '../../types'; +import {AuthLoginScreenProps, MainStackNavigationProps, MainStackParams} from '../../types'; import {getPublicKeyFromSecret} from '../../utils/keypair'; import { retrieveAndDecryptPrivateKey, retrievePassword, retrievePublicKey, } from '../../utils/storage'; +import { useNavigation } from '@react-navigation/native'; export const Login: React.FC = ({navigation}) => { const {theme} = useTheme(); @@ -27,6 +28,8 @@ export const Login: React.FC = ({navigation}) => { const {showToast} = useToast(); const {showDialog, hideDialog} = useDialog(); + const navigationMain = useNavigation() + useEffect(() => { (async () => { const biometrySupported = Platform.OS !== 'web' && canUseBiometricAuthentication?.(); @@ -60,6 +63,11 @@ export const Login: React.FC = ({navigation}) => { } setAuth(publicKey, privateKeyHex); + + + if(publicKey && privateKeyHex ) { + navigationMain.navigate("Feed"); + } }; const handleCreateAccount = () => { diff --git a/apps/mobile/src/screens/LaunchDetail/LaunchpadComponent.tsx b/apps/mobile/src/screens/LaunchDetail/LaunchpadComponent.tsx deleted file mode 100644 index 07b90020..00000000 --- a/apps/mobile/src/screens/LaunchDetail/LaunchpadComponent.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { useMemo, useState } from 'react'; -import { ActivityIndicator, FlatList, RefreshControl, View, Text, Platform, Dimensions } from 'react-native'; -import { Button, Divider, IconButton, Menu } from '../../components'; -import { useStyles, useTheme, useWindowDimensions } from '../../hooks'; -import stylesheet from './styles'; -import { useQueryAllKeys } from '../../hooks/keys/useQueryAllKeys'; -import { KeyCardUser } from '../../components/KeyCardUser'; -import { useKeyModal } from '../../hooks/modals/useKeyModal'; -import { KeyModalAction } from '../../modules/KeyModal'; -import { useAccount } from '@starknet-react/core'; -import { useAuth } from 'afk_nostr_sdk'; -import { TokenLaunchCard } from '../../components/TokenLaunchCard'; -import { useQueryAllCoins } from '../../hooks/launchpad/useQueryAllCoins'; -import { useQueryAllLaunch } from '../../hooks/launchpad/useQueryAllLaunch'; -import { FormLaunchToken } from '../../modules/LaunchTokenPump/FormLaunchToken'; -import { useGetTokenLaunch } from '../../hooks/api/indexer/useLaunchTokens'; -import { useDimensions } from '../../hooks/useWindowDimensions'; - - -interface AllKeysComponentInterface { - isButtonInstantiateEnable?: boolean -} -export const LaunchpadComponent: React.FC = ({ isButtonInstantiateEnable }) => { - const { theme } = useTheme(); - const styles = useStyles(stylesheet); - const account = useAccount() - const [loading, setLoading] = useState(false); - const queryDataLaunch = useQueryAllLaunch() - const { show: showKeyModal } = useKeyModal(); - const [menuOpen, setMenuOpen] = useState(false); - const { data: launchs } = useGetTokenLaunch() - // console.log("Launchs", launchs) - const { publicKey } = useAuth() - // const width = Dimensions.get("window").width - // const isDesktop = width >= 1024 - const {width} = useWindowDimensions() - console.log("width",width) - // const isDesktop = width>= 1024 ? true : false - // console.log("isDesktop",isDesktop) - - const dimensions = useWindowDimensions(); - const isDesktop = useMemo(() => { - return dimensions.width >= 1024 - }, [dimensions]); // Adjust based on your breakpoint for desktop - return ( - - {queryDataLaunch?.isLoading && } - - {isButtonInstantiateEnable && - - } - {menuOpen && - - } - - } - // keyExtractor={(item, i) => {`${item.owner + item?.created_at}`}} - keyExtractor={(item, i) => i.toString()} - numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { - // console.log("key item", item) - return ( - - ); - }} - refreshControl={} - // onEndReached={() => queryDataLaunch.fetchNextPage()} - - /> - - {/* } - keyExtractor={(item) => item.event.transaction_hash} - renderItem={({ item }) => { - return ( - - - - - - - - - - - ); - }} - refreshControl={} - /> */} - - ); -}; diff --git a/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx b/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx index 3cee7a60..7cd35996 100644 --- a/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx +++ b/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx @@ -15,6 +15,7 @@ import { useQueryAllLaunch } from '../../hooks/launchpad/useQueryAllLaunch'; import { FormLaunchToken } from '../../modules/LaunchTokenPump/FormLaunchToken'; import { useGetTokenLaunch } from '../../hooks/api/indexer/useLaunchTokens'; import { useDimensions } from '../../hooks/useWindowDimensions'; +import { useTokenCreatedModal } from '../../hooks/modals/useTokenCreateModal'; interface AllKeysComponentInterface { @@ -27,9 +28,11 @@ export const LaunchpadComponent: React.FC = ({ isButt const [loading, setLoading] = useState(false); const queryDataLaunch = useQueryAllLaunch() const { show: showKeyModal } = useKeyModal(); + const { show: showModal } = useTokenCreatedModal(); const [menuOpen, setMenuOpen] = useState(false); const { data: launchs } = useGetTokenLaunch() // console.log("Launchs", launchs) + const { publicKey } = useAuth() // const width = Dimensions.get("window").width // const isDesktop = width >= 1024 @@ -45,7 +48,8 @@ export const LaunchpadComponent: React.FC = ({ isButt diff --git a/apps/mobile/src/types/routes.ts b/apps/mobile/src/types/routes.ts index 0d69337c..787c7c6c 100644 --- a/apps/mobile/src/types/routes.ts +++ b/apps/mobile/src/types/routes.ts @@ -41,6 +41,15 @@ export type MainStackParams = { Settings:undefined; Launchpad:undefined; LaunchDetail: {coinAddress:string, launch?:TokenLaunchInterface}; + Login: undefined; + CreateAccount: undefined; + SaveKeys: { + privateKey: string; + publicKey: string; + }; + ImportKeys:undefined; + Auth:NavigatorScreenParams + }; @@ -57,8 +66,15 @@ export type HomeBottomStackParams = { Profile:{publicKey:string}; Launchpad:undefined; LaunchDetail: {coinAddress:string, launch?:TokenLaunchInterface}; - - + Login: undefined; + CreateAccount: undefined; + SaveKeys: { + privateKey: string; + publicKey: string; + }; + ImportKeys:undefined; + Auth:NavigatorScreenParams; + Main:NavigatorScreenParams; // ChannelsFeed:undefined; // CreateChannel:undefined; }; @@ -69,20 +85,20 @@ export type RootStackScreenProps = NativeStackScreenProps; // Auth export type AuthLoginScreenProps = CompositeScreenProps< - NativeStackScreenProps, + NativeStackScreenProps, NativeStackScreenProps >; export type AuthCreateAccountScreenProps = CompositeScreenProps< - NativeStackScreenProps, + NativeStackScreenProps, NativeStackScreenProps >; export type AuthSaveKeysScreenProps = CompositeScreenProps< - NativeStackScreenProps, + NativeStackScreenProps, NativeStackScreenProps >; export type AuthImportKeysScreenProps = CompositeScreenProps< - NativeStackScreenProps, + NativeStackScreenProps, NativeStackScreenProps >;