Skip to content

Commit

Permalink
Merge remote-tracking branch 'teritori/main' into feat/p2e-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
n0izn0iz committed Jan 23, 2024
2 parents a4c7cba + 06598db commit 37a7435
Show file tree
Hide file tree
Showing 132 changed files with 4,440 additions and 2,453 deletions.
80 changes: 43 additions & 37 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
ignores: [
"buffer",
"tsx",
"ts-proto",
"ts-unused-exports",
"postinstall-postinstall",
"expo-doctor",
"expo-dev-client",
"@cosmwasm/ts-codegen",
"commander",
"lottie-ios",
"@types/node",
"@improbable-eng/grpc-web-node-http-transport",
"babel-loader",
"react-native-web",
"cors-anywhere",
"depcheck",
"dotenv",
"@inline-svg-unique-id/react",
"babel-plugin-react-inline-svg-unique-id",
"@pinata/sdk",
"expo-optimize",
"sharp-cli",
"cross-env",
"electron",
"rimraf",
"assert",
"webpack-bundle-analyzer",
"listr2",
"typescript",
]
ignorePatterns: [
"/cache",
"/.yarn",
"/electron-webpack.js",
"/electron/webpack.config.js",
]
{
"ignores": [
"buffer",
"tsx",
"ts-proto",
"ts-unused-exports",
"postinstall-postinstall",
"expo-doctor",
"expo-dev-client",
"@cosmwasm/ts-codegen",
"commander",
"lottie-ios",
"@types/node",
"@improbable-eng/grpc-web-node-http-transport",
"babel-loader",
"react-native-web",
"cors-anywhere",
"depcheck",
"dotenv",
"@inline-svg-unique-id/react",
"babel-plugin-react-inline-svg-unique-id",
"@pinata/sdk",
"expo-optimize",
"sharp-cli",
"cross-env",
"electron",
"rimraf",
"assert",
"listr2",
"typescript",
"@dotlottie/react-player",
"@lottiefiles/react-lottie-player",
"crypto",
"expo-constants",
"metro-config"
],
"ignorePatterns": [
"/cache",
"/.yarn",
"/electron-webpack.js",
"/electron/webpack.config.js"
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ web-build/
.idea/
.vscode/
/cache/
/ios
/android
/modules/wesh/ios/WeshFramework.xcframework
/modules/weshd/android/libs

# macOS
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.1.0
12 changes: 12 additions & 0 deletions .yarn/patches/multiformats-npm-12.1.3-dbaa26037a.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/package.json b/package.json
index 3843b15fe499bc682d81ad0680ec364b820406d6..b17cdccd376126cfdcbaa44976655964f094ecc7 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"author": "Mikeal Rogers <[email protected]> (https://www.mikealrogers.com/)",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/multiformats/js-multiformats#readme",
+ "main": "dist/index.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/multiformats/js-multiformats.git"
18 changes: 18 additions & 0 deletions App.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { grpc } from "@improbable-eng/grpc-web";
import { ReactNativeTransport } from "@improbable-eng/grpc-web-react-native-transport";
import "node-libs-react-native/globals";
import "@react-native-anywhere/polyfill-base64";
import "text-encoding-polyfill";
import "react-native-url-polyfill/auto";
import "react-native-get-random-values";
import "react-native-gesture-handler";
import Constants from "expo-constants";

import Root from "./Root";

Object.entries(Constants.expoConfig?.extra?.env).forEach(([key, value]) => {
process.env[key] = `${value}`;
});

grpc.setDefaultTransport(ReactNativeTransport({}));
export default Root;
205 changes: 2 additions & 203 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,204 +1,3 @@
import {
useFonts,
Exo_600SemiBold,
Exo_500Medium,
Exo_700Bold,
} from "@expo-google-fonts/exo";
import { NavigationContainer } from "@react-navigation/native";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { StatusBar } from "expo-status-bar";
import { MetaMaskProvider } from "metamask-react";
import Plausible from "plausible-tracker";
import React, { ReactNode, memo, useEffect } from "react";
import { useForm, FormProvider } from "react-hook-form";
import { Platform, View, Text, TextStyle } from "react-native";
import { enableLegacyWebImplementation } from "react-native-gesture-handler";
import { MenuProvider } from "react-native-popup-menu";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { Provider as ReduxProvider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import Root from "./Root";

import { MultisigDeauth } from "./packages/components/multisig/MultisigDeauth";
import { Navigator } from "./packages/components/navigation/Navigator";
import { DropdownsContextProvider } from "./packages/context/DropdownsProvider";
import { FeedbacksContextProvider } from "./packages/context/FeedbacksProvider";
import { MediaPlayerContextProvider } from "./packages/context/MediaPlayerProvider";
import { MessageContextProvider } from "./packages/context/MessageProvider";
import { SearchBarContextProvider } from "./packages/context/SearchBarProvider";
import { TNSMetaDataListContextProvider } from "./packages/context/TNSMetaDataListProvider";
import { TNSContextProvider } from "./packages/context/TNSProvider";
import { TransactionModalsProvider } from "./packages/context/TransactionModalsProvider";
import { WalletControlContextProvider } from "./packages/context/WalletControlProvider";
import {
WalletsProvider,
useWallets,
} from "./packages/context/WalletsProvider";
import { useSelectedNetworkId } from "./packages/hooks/useSelectedNetwork";
import useSelectedWallet from "./packages/hooks/useSelectedWallet";
import { getAvailableApps } from "./packages/screens/DAppStore/query/getFromFile";
import { setAvailableApps } from "./packages/store/slices/dapps-store";
import { setSelectedWalletId } from "./packages/store/slices/settings";
import { persistor, store, useAppDispatch } from "./packages/store/store";
import { linking } from "./packages/utils/navigation";

const plausible = Plausible({
domain: "app.teritori.com",
});
plausible.enableAutoPageviews();

const queryClient = new QueryClient();

// it's here just to fix a TS2589 error
type DefaultForm = {
novalue: string;
};
// this is required for react-native-gesture-handler to work on web
enableLegacyWebImplementation(true);
// ^ required for drog and drop on the dAppStore

export default function App() {
const methods = useForm<DefaultForm>();
const [fontsLoaded] = useFonts({
Exo_500Medium,
Exo_600SemiBold,
Exo_700Bold,
});

// FIXME: Fonts don't load on electron
if (Platform.OS !== "web" && !fontsLoaded) {
return null;
}

return (
<ErrorBoundary>
<ReduxProvider store={store}>
<PersistGate
loading={
<View
style={{
width: "100%",
height: "100%",
backgroundColor: "black",
}}
/>
}
persistor={persistor}
>
<QueryClientProvider client={queryClient}>
<FormProvider<DefaultForm> {...methods}>
<MetaMaskProvider>
<NavigationContainer linking={linking}>
<SafeAreaProvider>
<FeedbacksContextProvider>
<DropdownsContextProvider>
<WalletsProvider>
<WalletSyncer />
<DappStoreApps />
<MultisigDeauth />
<WalletControlContextProvider>
<SearchBarContextProvider>
<TransactionModalsProvider>
<TNSContextProvider>
<TNSMetaDataListContextProvider>
<MenuProvider>
<MessageContextProvider>
<MediaPlayerContextProvider>
<StatusBar style="inverted" />
<Navigator />
</MediaPlayerContextProvider>
</MessageContextProvider>
</MenuProvider>
</TNSMetaDataListContextProvider>
</TNSContextProvider>
</TransactionModalsProvider>
</SearchBarContextProvider>
</WalletControlContextProvider>
</WalletsProvider>
</DropdownsContextProvider>
</FeedbacksContextProvider>
</SafeAreaProvider>
</NavigationContainer>
</MetaMaskProvider>
</FormProvider>
</QueryClientProvider>
</PersistGate>
</ReduxProvider>
</ErrorBoundary>
);
}

class ErrorBoundary extends React.Component<{ children: ReactNode }> {
state: {
hasError: boolean;
error?: unknown;
catchError?: unknown;
catchInfo?: React.ErrorInfo;
};

constructor(props: { children: ReactNode }) {
super(props);
this.state = { hasError: false };
}

static getDerivedStateFromError(error: unknown) {
console.log("derived state from error");
return { hasError: true, error };
}

componentDidCatch(error: unknown, info: React.ErrorInfo) {
console.log("did catch");
console.error(error, info);
this.setState({ catchError: error, catchInfo: info });
}

render() {
if (this.state.hasError) {
console.log("rendering error boundary");
// You can render any custom fallback UI
return (
<View style={{ backgroundColor: "black", height: "100%" }}>
<Text style={errorBoundaryTextCStyle}>{`${this.state.error}`}</Text>
{this.state.error !== this.state.catchError && (
<Text
style={errorBoundaryTextCStyle}
>{`${this.state.catchError}`}</Text>
)}
<Text style={errorBoundaryTextCStyle}>
{this.state.catchInfo?.componentStack}
</Text>
</View>
);
}

return this.props.children;
}
}

const errorBoundaryTextCStyle: TextStyle = { color: "white" };

const WalletSyncer: React.FC = memo(() => {
const selectedWallet = useSelectedWallet();
const selectedNetworkId = useSelectedNetworkId();
const { wallets } = useWallets();
const dispatch = useAppDispatch();
useEffect(() => {
if (!selectedWallet || selectedWallet.networkId !== selectedNetworkId) {
const newWallet = wallets.find((w) => w.networkId === selectedNetworkId);
console.log("syncing wallet", newWallet);
dispatch(setSelectedWalletId(newWallet?.id));
}
}, [dispatch, selectedNetworkId, selectedWallet, wallets]);
return null;
});

const DappStoreApps: React.FC = () => {
const dispatch = useAppDispatch();

useEffect(() => {
const dAppStoreValues = getAvailableApps();

dispatch(setAvailableApps(dAppStoreValues));
}, [dispatch]);

return null;
};
export default Root;
Loading

0 comments on commit 37a7435

Please sign in to comment.