Skip to content

Commit

Permalink
feat: support swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseRFelix committed Jan 20, 2025
1 parent d263318 commit 4bf3491
Show file tree
Hide file tree
Showing 12 changed files with 525 additions and 147 deletions.
11 changes: 6 additions & 5 deletions packages/mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ThemeProvider } from "@react-navigation/native";
import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { persistQueryClient } from "@tanstack/react-query-persist-client";
import { loggerLink } from "@trpc/client";
import { useFonts } from "expo-font";
import { Redirect, Stack } from "expo-router";
import * as SplashScreen from "expo-splash-screen";
Expand Down Expand Up @@ -101,11 +102,11 @@ export default function RootLayout() {
api.createClient({
transformer: superjson,
links: [
// loggerLink({
// enabled: (opts) =>
// process.env.NODE_ENV === "development" ||
// (opts.direction === "down" && opts.result instanceof Error),
// }),
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
(runtime) => {
const removeLastSlash = (url: string) => url.replace(/\/$/, "");
const servers = {
Expand Down
6 changes: 2 additions & 4 deletions packages/mobile/app/asset/[coinMinimalDenom].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Dec } from "@osmosis-labs/unit";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import React from "react";
import {
Expand All @@ -18,7 +17,6 @@ import { AssetDetails } from "~/components/asset/asset-details";
import { RouteHeader } from "~/components/route-header";
import { Button } from "~/components/ui/button";
import { Text } from "~/components/ui/text";
import { getChangeColor } from "~/utils/price";
import { api } from "~/utils/trpc";

const TRADE_BUTTON_HEIGHT = 100;
Expand Down Expand Up @@ -98,7 +96,7 @@ const AssetContent = ({ coinMinimalDenom }: { coinMinimalDenom: string }) => {
<AssetChartHeader asset={asset} />
<AssetChart asset={asset} />

{false && (
{/* {false && (
<View style={styles.balanceContainer}>
<Text type="subtitle">Your Balance:</Text>
<View style={styles.balanceRow}>
Expand All @@ -117,7 +115,7 @@ const AssetContent = ({ coinMinimalDenom }: { coinMinimalDenom: string }) => {
{asset.currentPrice?.toDec().toString()}
</Text>
</View>
)}
)} */}

{asset && <AssetDetails asset={asset} />}
</ScrollView>
Expand Down
37 changes: 3 additions & 34 deletions packages/mobile/app/trade.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { Stack, useLocalSearchParams } from "expo-router";
import React from "react";
import { StyleSheet, View } from "react-native";
import { View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";

import { RouteHeader } from "~/components/route-header";
import { TradeInterface } from "~/components/trade/trade-interface";
import { Button } from "~/components/ui/button";
import { Text } from "~/components/ui/text";

type Props = {};

const PREVIEW_BUTTON_HEIGHT = 100;

const TradeScreen = (props: Props) => {
const TradeScreen = () => {
const { toToken } = useLocalSearchParams<{
toToken: string;
}>();
Expand All @@ -39,35 +34,9 @@ const TradeScreen = (props: Props) => {
</RouteHeader>
</View>

<TradeInterface />

<View style={styles.previewButtonContainer}>
<Button
title="Preview Trade"
onPress={() => {}}
buttonStyle={styles.previewButton}
/>
</View>
<TradeInterface initialToDenom={toToken} showGlobalSubmitButton />
</SafeAreaView>
);
};

const styles = StyleSheet.create({
previewButtonContainer: {
position: "absolute",
height: PREVIEW_BUTTON_HEIGHT,
bottom: 0,
width: "100%",
paddingTop: 10,
borderTopWidth: 1,
alignItems: "center",
borderTopColor: "rgba(255, 255, 255, 0.2)",
},
previewButton: {
paddingHorizontal: 15,
paddingVertical: 15,
width: "80%",
},
});

export default TradeScreen;
Loading

0 comments on commit 4bf3491

Please sign in to comment.