From 75d2d0b0a582713cf4754da64911078014fabaf6 Mon Sep 17 00:00:00 2001 From: William Swanson Date: Thu, 19 Oct 2023 15:43:54 -0700 Subject: [PATCH] fixup! Simplify our React Native integration --- CHANGELOG.md | 2 ++ README.md | 72 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fbb0ee6..b14da663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- changed: Simplify our React Native integration. + ## 0.21.10 (2023-10-09) - changed: Restrict ChangeHero trading to whitelisted plugins diff --git a/README.md b/README.md index 6a6a1fb1..82eba31f 100644 --- a/README.md +++ b/README.md @@ -2,32 +2,63 @@ This library exports a collection of exchange-rate & swap plugins for use with [`edge-core-js`](https://github.com/EdgeApp/edge-core-js). -Use it like this: +Please see [index.js](./src/index.js) for the list of plugins in this repo. These are compatible with edge-core-js v0.19.31 or later. + +## Installing + +Fist, add this library to your project: + +```sh +npm i -s edge-exchange-plugins +``` + +### Node.js + +For Node.js, you should call `addEdgeCorePlugins` to register these plugins with edge-core-js: ```js -import { - addEdgeCorePlugins, - lockEdgeCorePlugins, - makeEdgeContext -} from 'edge-core-js' -import exchangePlugins from 'edge-exchange-plugins' - -addEdgeCorePlugins(exchangePlugins) +const { addEdgeCorePlugins, lockEdgeCorePlugins } = require('edge-core-js') +const plugins = require('edge-exchange-plugins') + +addEdgeCorePlugins(plugins) + +// Once you are done adding plugins, call this: lockEdgeCorePlugins() +``` -makeEdgeContext({ - apiKey: '', - appId: '', - plugins: { - // Plugin names from edge-exchange-plugins: - coinbase: true, - shapeshift: true - } +You can also add plugins individually if you want to be more picky: + +```js +addEdgeCorePlugins({ + thorchain: plugins.thorchain }) +``` + +### Browser + +The bundle located in `dist/edge-exchange-plugins.js` will automatically register itself with edge-core-js. Just serve the entire `dist` directory along with your app, and then load the script: +```html +