Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed Jun 22, 2021
0 parents commit a439282
Show file tree
Hide file tree
Showing 36 changed files with 6,030 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
}
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
plugins: ['react', 'react-hooks'],
root: true,
env: {
node: true
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 0,
},
}
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
npm install
- name: yarn build
run: |
yarn build
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint

on: push

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
npm install
- name: yarn lint
run: |
yarn lint
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on: push

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
npm install
- name: npm run build
run: |
npm run build
- name: Run Tests
run: |
yarn test
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dependencies
/node_modules

# Jest
/coverage

# Cypress
/cypress/videos
/cypress/screenshots

# IDE - VSCode
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Various
npm-debug.log*
yarn-error.log
24 changes: 24 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# source code
src
index.html

# compiler
tsconfig.json
webpack.config.js
postcss.config.js


# tests
test
jest.config.js
coverage

# lint
.eslintrc.js
.prettierrc

# IDE - VSCode
.vscode

# git
.git
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
semi: false,
trailingComma: 'all',
singleQuote: true,
printWidth: 100,
tabWidth: 2,
bracketSpacing: true,
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 DePay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
## Quickstart

```
yarn add depay-decentralized-exchanges
```

or

```
npm install --save depay-decentralized-exchanges
```

```javascript
import { DEX } from 'depay-decentralized-exchanges'

DEX.all
// [
// { name: 'uniswap_v3', label: 'Uniswap v3', logo: '...' }
// { name: 'pancakeswap_v2', label: 'PancakeSwap v2', logo: '...' }
// ...
// ]

DEX.findByName('uniswap_v3')
// { name: 'uniswap_v3', label: 'Uniswap v3', logo: '...' }
```

## Support

This library supports the following decentralized exchanges:

- [Uniswap v3](https://uniswap.org)
- [Uniswap v2](https://uniswap.org)
- [PancakeSwap v2](https://pancakeswap.info)
- [SushiSwap](https://sushi.com)
- [Curve](https://curve.fi)

## Data Structure

Decentralized exchange data is provided in the following structure:

```
{
name: String,
alternativeNames: Array,
label: String,
logo: String (base64 encoded PNG)
}
```

## Functionalities

### all: Retreive all information for all blockchains

```javascript
import { DEX } from 'depay-decentralized-exchanges'

DEX.all
// [
// { name: 'uniswap_v3', label: 'Uniswap v3', logo: '...' }
// { name: 'pancakeswap_v2', label: 'PancakeSwap v2', logo: '...' }
// ...
// ]

```

### findByName: Get decentralized exchanged by name (name usually contains version, too)

```javascript
import { DEX } from 'depay-decentralized-exchanges'

DEX.findByName('uniswap_v3')
// { name: 'uniswap_v3', label: 'Uniswap v3', logo: '...' }

DEX.findByName('pancakeswap_v2')
// { name: 'pancakeswap_v2', label: 'PancakeSwap v2', logo: '...' }
```

## Development

### Get started

```
yarn install
yarn start
```

### Release

```
npm publish
```
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
};
5 changes: 5 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"pluginsFile": false,
"supportFile": false,
"fixturesFolder": false
}
18 changes: 18 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="https://depay.fi/favicon.png"/>
<title>Demo</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="dist/umd/index.js"></script>
</head>
<body>
<div class="container">



</div>
</body>
</html>
56 changes: 56 additions & 0 deletions dist/cjs/index.js

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions dist/es/index.js

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions dist/umd/index.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['/node_modules/', '.git'],
setupFiles: ['./tests/setup.js'],
automock: false,
modulePaths: ['<rootDir>']
};
Loading

0 comments on commit a439282

Please sign in to comment.