-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1669 from RafaelTaranto/feat/bitfinex-implementation
LAM-1087 feat: bitfinex implementation
- Loading branch information
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { COINS } = require('@lamassu/coins') | ||
const _ = require('lodash/fp') | ||
|
||
const { ORDER_TYPES } = require('./consts') | ||
|
||
const ORDER_TYPE = ORDER_TYPES.MARKET | ||
const { BTC, ETH, LTC, BCH, USDT, LN } = COINS | ||
const CRYPTO = [BTC, ETH, LTC, BCH, USDT, LN] | ||
const FIAT = ['USD', 'EUR'] | ||
const AMOUNT_PRECISION = 8 | ||
const REQUIRED_CONFIG_FIELDS = ['key', 'secret'] | ||
|
||
const loadConfig = (account) => { | ||
const mapper = { | ||
'key': 'apiKey', | ||
} | ||
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(account) | ||
return { ...mapped, timeout: 3000 } | ||
} | ||
|
||
module.exports = { loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE, AMOUNT_PRECISION } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as Yup from 'yup' | ||
|
||
import SecretInputFormik from 'src/components/inputs/formik/SecretInput' | ||
import TextInputFormik from 'src/components/inputs/formik/TextInput' | ||
|
||
import { secretTest } from './helper' | ||
|
||
export default { | ||
code: 'bitfinex', | ||
name: 'Bitfinex', | ||
title: 'Bitfinex (Exchange)', | ||
elements: [ | ||
{ | ||
code: 'key', | ||
display: 'API Key', | ||
component: TextInputFormik, | ||
face: true, | ||
long: true | ||
}, | ||
{ | ||
code: 'secret', | ||
display: 'API Secret', | ||
component: SecretInputFormik | ||
} | ||
], | ||
getValidationSchema: account => { | ||
return Yup.object().shape({ | ||
key: Yup.string('The API key must be a string') | ||
.max(100, 'The API key is too long') | ||
.required('The API key is required'), | ||
secret: Yup.string('The API secret must be a string') | ||
.max(100, 'The API secret is too long') | ||
.test(secretTest(account?.secret, 'API secret')) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters