From 17baa748b4aa3555faefb7ef30315e6f9fb81ad0 Mon Sep 17 00:00:00 2001 From: sirpy Date: Thu, 27 Jun 2024 13:48:26 +0200 Subject: [PATCH] add: migrate subgraph to studio --- packages/app/.gitignore | 1 + packages/app/package.json | 4 ++-- .../app/src/hooks/apollo/useCreateSubgraphApolloClient.ts | 3 ++- packages/app/src/lib/env.native.ts | 3 +++ packages/app/src/lib/env.ts | 1 + packages/app/tsconfig.json | 4 +++- packages/app/web/vite.config.ts | 1 + yarn.lock | 8 ++++---- 8 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 packages/app/src/lib/env.native.ts create mode 100644 packages/app/src/lib/env.ts diff --git a/packages/app/.gitignore b/packages/app/.gitignore index b385892c..16a494a6 100644 --- a/packages/app/.gitignore +++ b/packages/app/.gitignore @@ -39,6 +39,7 @@ local.properties node_modules/ npm-debug.log yarn-error.log +.env # fastlane # diff --git a/packages/app/package.json b/packages/app/package.json index af2f70d6..2e709f35 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -20,7 +20,7 @@ "@celo-tools/celo-ethers-wrapper": "^0.4.0", "@ethersproject/shims": "^5.7.0", "@gooddollar/good-design": "^0.1.31", - "@gooddollar/goodcollective-sdk": "^1.0.15", + "@gooddollar/goodcollective-sdk": "^1.1.1", "@gooddollar/web3sdk-v2": "^0.2.2", "@nerdwallet/apollo-cache-policies": "^3.2.0", "@react-native-aria/interactions": "0.2.3", @@ -63,7 +63,7 @@ "react-native-get-random-values": "^1.9.0", "react-native-modal": "^13.0.1", "react-native-safe-area-context": "3.3.2", - "react-native-svg": "^13.9.0", + "react-native-svg": "^15.1.0", "react-native-svg-web": "^1.0.9", "react-native-web": "0.18.*", "react-router-dom": "^6.14.1", diff --git a/packages/app/src/hooks/apollo/useCreateSubgraphApolloClient.ts b/packages/app/src/hooks/apollo/useCreateSubgraphApolloClient.ts index a19904ec..f110e18f 100644 --- a/packages/app/src/hooks/apollo/useCreateSubgraphApolloClient.ts +++ b/packages/app/src/hooks/apollo/useCreateSubgraphApolloClient.ts @@ -4,8 +4,9 @@ import { AsyncStorageWrapper, persistCache } from 'apollo3-cache-persist'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { errorLink, retryLink } from '../../utils/apolloLinkUtils'; +import env from '../../lib/env'; -const subgraphUri = 'https://api.thegraph.com/subgraphs/name/gooddollar/goodcollective'; +const subgraphUri = env.REACT_APP_SUBGRAPH; export const useCreateSubgraphApolloClient = (): ApolloClient | undefined => { const [apolloClient, setApolloClient] = useState | undefined>(); diff --git a/packages/app/src/lib/env.native.ts b/packages/app/src/lib/env.native.ts new file mode 100644 index 00000000..34414f2c --- /dev/null +++ b/packages/app/src/lib/env.native.ts @@ -0,0 +1,3 @@ +export default { + ...process.env, +}; diff --git a/packages/app/src/lib/env.ts b/packages/app/src/lib/env.ts new file mode 100644 index 00000000..8876f85c --- /dev/null +++ b/packages/app/src/lib/env.ts @@ -0,0 +1 @@ +export default { ...process.env, ...import.meta.env }; diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json index fb523f02..a4e83489 100644 --- a/packages/app/tsconfig.json +++ b/packages/app/tsconfig.json @@ -2,6 +2,8 @@ "extends": "@tsconfig/react-native/tsconfig.json", "compilerOptions": { "jsx": "react-jsx", - "lib": ["DOM", "es2019"] + "lib": ["DOM", "es2019"], + "module": "ESNext", + "types": ["vite/client", "jest"] } } diff --git a/packages/app/web/vite.config.ts b/packages/app/web/vite.config.ts index 94c7d59e..0d9888e4 100644 --- a/packages/app/web/vite.config.ts +++ b/packages/app/web/vite.config.ts @@ -7,6 +7,7 @@ import * as path from 'path'; // https://vitejs.dev/config/ export default defineConfig({ + envPrefix: ['REACT_APP_'], plugins: [react(), dynamicImports(), nodePolyfills(), viteTsconfigPaths()], resolve: { alias: { diff --git a/yarn.lock b/yarn.lock index 067c0b45..1cf7d82d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4307,7 +4307,7 @@ __metadata: "@celo-tools/celo-ethers-wrapper": ^0.4.0 "@ethersproject/shims": ^5.7.0 "@gooddollar/good-design": ^0.1.31 - "@gooddollar/goodcollective-sdk": ^1.0.15 + "@gooddollar/goodcollective-sdk": ^1.1.1 "@gooddollar/web3sdk-v2": ^0.2.2 "@nerdwallet/apollo-cache-policies": ^3.2.0 "@react-native-aria/interactions": 0.2.3 @@ -4388,7 +4388,7 @@ __metadata: languageName: unknown linkType: soft -"@gooddollar/goodcollective-contracts@^1.0.4, @gooddollar/goodcollective-contracts@workspace:packages/contracts": +"@gooddollar/goodcollective-contracts@^1.1.0, @gooddollar/goodcollective-contracts@workspace:packages/contracts": version: 0.0.0-use.local resolution: "@gooddollar/goodcollective-contracts@workspace:packages/contracts" dependencies: @@ -4431,11 +4431,11 @@ __metadata: languageName: unknown linkType: soft -"@gooddollar/goodcollective-sdk@^1.0.15, @gooddollar/goodcollective-sdk@workspace:packages/sdk-js": +"@gooddollar/goodcollective-sdk@^1.1.1, @gooddollar/goodcollective-sdk@workspace:packages/sdk-js": version: 0.0.0-use.local resolution: "@gooddollar/goodcollective-sdk@workspace:packages/sdk-js" dependencies: - "@gooddollar/goodcollective-contracts": ^1.0.4 + "@gooddollar/goodcollective-contracts": ^1.1.0 "@superfluid-finance/sdk-core": ^0.6.12 "@types/eslint": ^8.40.2 "@typescript-eslint/eslint-plugin": ^5.60.0