From f8ee58389ecceb9c8b20e1464f71db1fc648b620 Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 24 Sep 2024 11:30:53 +0200 Subject: [PATCH 1/5] chore: Add @ts-ignore for process.env values. See the PR. Signed-off-by: Jeff Thompson --- mobile/app/_layout.tsx | 4 ++++ mobile/redux/features/signupSlice.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/mobile/app/_layout.tsx b/mobile/app/_layout.tsx index fbfdac8..3b3604d 100644 --- a/mobile/app/_layout.tsx +++ b/mobile/app/_layout.tsx @@ -8,15 +8,19 @@ import { NotificationProvider } from "@gno/provider/notification-provider"; import { ReduxProvider } from "redux/redux-provider"; const gnoDefaultConfig = { + // @ts-ignore remote: process.env.EXPO_PUBLIC_GNO_REMOTE!, + // @ts-ignore chain_id: process.env.EXPO_PUBLIC_GNO_CHAIN_ID!, }; const indexerDefaultConfig = { + // @ts-ignore remote: process.env.EXPO_PUBLIC_INDEXER_REMOTE!, }; const notificationDefaultConfig = { + // @ts-ignore remote: process.env.EXPO_PUBLIC_NOTIFICATION_REMOTE!, }; diff --git a/mobile/redux/features/signupSlice.ts b/mobile/redux/features/signupSlice.ts index 05e7df9..e745dfa 100644 --- a/mobile/redux/features/signupSlice.ts +++ b/mobile/redux/features/signupSlice.ts @@ -263,6 +263,7 @@ const sendCoins = async (address: string) => { reactNative: { textStreaming: true }, }; + // @ts-ignore const faucetRemote = process.env.EXPO_PUBLIC_FAUCET_REMOTE; if (!faucetRemote) { throw new Error("faucet remote address is undefined"); From 65311297c6c88d78db10c929802b42dfe28d955e Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 24 Sep 2024 12:32:52 +0200 Subject: [PATCH 2/5] chore: In types.ts, add NetworkMetainfo and GnoAccount. Fix imports. See the PR. Signed-off-by: Jeff Thompson --- .../change-network/network-list-item/index.tsx | 2 +- .../change-network/network-list/index.tsx | 2 +- mobile/components/feed/post-row.tsx | 2 +- mobile/components/feed/repost-row.tsx | 2 +- .../components/list/account/account-item.tsx | 3 ++- mobile/types.ts | 18 ++++++++++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/mobile/components/change-network/network-list-item/index.tsx b/mobile/components/change-network/network-list-item/index.tsx index 96642ca..cdb17da 100644 --- a/mobile/components/change-network/network-list-item/index.tsx +++ b/mobile/components/change-network/network-list-item/index.tsx @@ -1,7 +1,7 @@ import Icons from '@gno/components/icons'; import Text from '@gno/components/text'; import { colors } from '@gno/styles/colors'; -import { NetworkMetainfo } from '@gnolang/gnonative/build/hooks/types'; +import { NetworkMetainfo } from "@gno/types"; import styled from 'styled-components/native'; export interface Props { diff --git a/mobile/components/change-network/network-list/index.tsx b/mobile/components/change-network/network-list/index.tsx index 79a24b6..da6943a 100644 --- a/mobile/components/change-network/network-list/index.tsx +++ b/mobile/components/change-network/network-list/index.tsx @@ -1,7 +1,7 @@ import NetworkListItem from "../network-list-item"; import styled from "styled-components/native"; import Text from "components/text"; -import { NetworkMetainfo } from "@gnolang/gnonative/build/hooks/types"; +import { NetworkMetainfo } from "@gno/types"; interface Props { currentChainId: string | undefined; diff --git a/mobile/components/feed/post-row.tsx b/mobile/components/feed/post-row.tsx index bf789a5..03984fe 100644 --- a/mobile/components/feed/post-row.tsx +++ b/mobile/components/feed/post-row.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Image, Pressable, StyleSheet, View } from "react-native"; -import { Post } from "../../types"; +import { Post } from "@gno/types"; import Text from "@gno/components/text"; import RepliesLabel from "./replies-label"; import TimeStampLabel from "./timestamp-label"; diff --git a/mobile/components/feed/repost-row.tsx b/mobile/components/feed/repost-row.tsx index de8eaf5..baa7385 100644 --- a/mobile/components/feed/repost-row.tsx +++ b/mobile/components/feed/repost-row.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Image, Pressable, StyleSheet, View } from "react-native"; -import { Post } from "../../types"; +import { Post } from "@gno/types"; import Text from "@gno/components/text"; import RepliesLabel from "./replies-label"; import TimeStampLabel from "./timestamp-label"; diff --git a/mobile/components/list/account/account-item.tsx b/mobile/components/list/account/account-item.tsx index 53dfc08..a03bc88 100644 --- a/mobile/components/list/account/account-item.tsx +++ b/mobile/components/list/account/account-item.tsx @@ -1,6 +1,7 @@ import Button from "@gno/components/button"; import Spacer from "@gno/components/spacer"; -import { GnoAccount } from "@gnolang/gnonative/build/hooks/types"; +import { GnoAccount } from "@gno/types"; + interface SideMenuAccountItemProps { account: GnoAccount; diff --git a/mobile/types.ts b/mobile/types.ts index 3ff8795..03ecaa4 100644 --- a/mobile/types.ts +++ b/mobile/types.ts @@ -35,3 +35,21 @@ export interface GetJsonFollowingResult { following: Following[]; n_following: number; } + +export type GnoConfig = { + Remote: string; + ChainID: string; + KeyName: string; + Password: string; + GasFee: string; + GasWanted: bigint; + Mnemonic: string; +}; + +export type NetworkMetainfo = { + chainId: string; + chainName: string; + gnoAddress: string; +}; + +export type GnoAccount = KeyInfo; From 8d9e559275424d14d4ea591db3358eea25be3aac Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 24 Sep 2024 12:34:52 +0200 Subject: [PATCH 3/5] chore: In transport_web, ignore ts:check errors for declaration file in imported modules Signed-off-by: Jeff Thompson --- mobile/src/grpc/transport_web.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/src/grpc/transport_web.ts b/mobile/src/grpc/transport_web.ts index 13b39e0..2fe26ed 100644 --- a/mobile/src/grpc/transport_web.ts +++ b/mobile/src/grpc/transport_web.ts @@ -1,5 +1,7 @@ +// @ts-ignore import { polyfill as polyfillReadableStream } from "react-native-polyfill-globals/src/readable-stream"; polyfillReadableStream(); +// @ts-ignore import { fetch as fetchPolyfill, Headers as HeadersPolyfill } from "react-native-fetch-api"; import type { AnyMessage, MethodInfo, PartialMessage, ServiceType } from "@bufbuild/protobuf"; From c39c9bd1033ca11c2cd4c5e95bce68743d0ce24b Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 24 Sep 2024 12:35:55 +0200 Subject: [PATCH 4/5] chore: In transport_web forEach, declare "any" type of key, value to make ts:check happy Signed-off-by: Jeff Thompson --- mobile/src/grpc/transport_web.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/grpc/transport_web.ts b/mobile/src/grpc/transport_web.ts index 2fe26ed..ba864c6 100644 --- a/mobile/src/grpc/transport_web.ts +++ b/mobile/src/grpc/transport_web.ts @@ -243,7 +243,7 @@ export function createXHRGrpcWebTransport(options: GrpcWebTransportOptions): Tra throw endStream.error; } - endStream.metadata.forEach((value, key) => trailerTarget.set(key, value)); + endStream.metadata.forEach((value:any, key:any) => trailerTarget.set(key, value)); continue; } From 3361dfafb87baafe4809704eb6bf2a0afd3d694a Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 24 Sep 2024 12:36:29 +0200 Subject: [PATCH 5/5] chore: In Makefile, add target ts_check. Use it to make node_modules. See the PR. Signed-off-by: Jeff Thompson --- mobile/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mobile/Makefile b/mobile/Makefile index 723788a..1ae40af 100644 --- a/mobile/Makefile +++ b/mobile/Makefile @@ -1,7 +1,10 @@ check-program = $(foreach exec,$(1),$(if $(shell PATH="$(PATH)" which $(exec)),,$(error "Missing deps: no '$(exec)' in PATH"))) check-file = $(foreach file,$(1),$(if $(wildcard $(file)),,$(error "Missing file: $(file)"))) -node_modules: package.json package-lock.json +ts_check: + npm run ts:check + +node_modules: ts_check package.json package-lock.json $(call check-program, npm) (npm install && touch $@) || true .PHONY: node_modules