diff --git a/.eslintignore b/.eslintignore index a6fc364f..a8ef954b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ -/lib/ -/node_modules/ -/.nyc_output/ +/android/src/main/assets/edge-exchange-plugins/ /coverage/ +/dist/ +/lib/ diff --git a/.gitignore b/.gitignore index 64d2d58e..5c246c11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,19 @@ -# Javascript: -lib/ +# Build output: +/.nyc_output/ +/android/.gradle +/android/*.jar +/android/src/main/assets/edge-exchange-plugins/ +/coverage/ +/dist/ +/lib/ + +# Package managers: node_modules/ +npm-debug.log package-lock.json +yarn-error.log # Editors: +.DS_Store .idea/ .vscode/ - -# Test results: -.nyc_output/ -/coverage/ diff --git a/.mocharc.json b/.mocharc.json deleted file mode 100644 index 1e6cb659..00000000 --- a/.mocharc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extension": ["ts"], - "spec": "test/**/*.spec.ts", - "require": "sucrase/register", - "colors": true, - "reporter":"mocha-multi-reporters", - "reporterOption": "configFile=.mocharc.json", - "reporterEnabled": "mochawesome,mocha-junit-reporter", - "mochaJunitReporterReporterOptions": { - "mochaFile": "./coverage/junit.xml" - }, - "mochawesomeReporterOptions": { - "reportDir": "coverage", - "reportName": "mochawesome" - } -} diff --git a/.nycrc.json b/.nycrc.json index b0feb5d4..d72f9809 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,6 +1,5 @@ { - "include": ["src/**/*.ts"], "extension": [".ts"], - "require": ["sucrase/register"], - "all": true -} \ No newline at end of file + "include": ["src/**/*.ts"], + "require": ["sucrase/register"] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4715a0..992efc81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- changed: Simplify our React Native integration. +- removed: Delete all rate plugins. + ## 0.22.0 (2023-10-24) - changed: Thorchain quotes to estimate rate diff --git a/README.md b/README.md index 6a6a1fb1..5fc32a70 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 +yarn add 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 +