This project contains two main projects:
- The graphql subgraph for the merchants data
http://localhost:4003/graphql
- A frontend component that consumes the graphql data via the Supergraph
http://localhost:4000/graphql
using the apollo client
me {
phone
merchants {
address
name
acceptsBitcoin
}
}
This allow separations of concerns and for sub-components. The plugins can be developed independently of the Galoy core banking application.
This enables a plugin/extension and microservice architecure.
make start
- This should start http://localhost:4003/graphql
- you can test this query
{
merchants {
id
name
address
acceptsBitcoin
}
}
Now we can install the component into galoy-mobile app.
- Add this to
galoy-mobile/tsconfig.json
(note that it's a relative link to the location you have the galoy-plugin-merchant code)
"paths": {
"@app/*": ["app/*"],
"react-native-galoy-merchant": ["../galoy-plugin-merchant/src/react-native-galoy-merchant/src"]
}
- Also add it to the package.json as a dependency
{
"dependencies": {
"react-native-galoy-merchant": "file:../galoy-plugin-merchant/src/react-native-galoy-merchant/src",
}
- Add this to the metro.config
extraNodeModules: {
"react-native-galoy-merchant": path.resolve(__dirname, "../galoy-plugin-merchant/src/react-native-galoy-merchant/src")
}
yarn install
- Live reload does not yet work (@todo) so run
yarn upgrade react-native-galoy-merchant
to reflect changes in the galoy-mobile app.
Usage
import { Merchants } from "react-native-galoy-merchant"
export const MerchantsComponenet = () => {
return (
<Merchants />
)
}
<Merchants>
If you deploy to npm or yarn you can, for example, run yarn add react-native-galoy-merchant
in your project.
This was created using this templating tool:
react-native-module-template
. See docs here: https://github.com/demchenkoalex/react-native-module-template