chore: reformat code
This commit is contained in:
parent
3d930aa73b
commit
aedabcbdee
509 changed files with 6030 additions and 4266 deletions
|
|
@ -14,11 +14,10 @@ const FormRenderer = ({
|
|||
save,
|
||||
buttonLabel = 'Save changes',
|
||||
buttonClass,
|
||||
xs = 12
|
||||
}) => {
|
||||
const initialValues = R.compose(
|
||||
R.mergeAll,
|
||||
R.map(({ code }) => ({ [code]: (value && value[code]) ?? '' }))
|
||||
R.map(({ code }) => ({ [code]: (value && value[code]) ?? '' })),
|
||||
)(elements)
|
||||
|
||||
const values = R.merge(initialValues, value)
|
||||
|
|
@ -31,10 +30,10 @@ const FormRenderer = ({
|
|||
R.filter(
|
||||
elem =>
|
||||
R.prop('component', elem) === SecretInput &&
|
||||
R.isEmpty(it[R.prop('code', elem)])
|
||||
)
|
||||
R.isEmpty(it[R.prop('code', elem)]),
|
||||
),
|
||||
)(elements)
|
||||
return save(R.omit(emptySecretFields, it)).catch(s => {
|
||||
return save(R.omit(emptySecretFields, it)).catch(() => {
|
||||
setSaveError({ save: 'Failed to save changes' })
|
||||
})
|
||||
}
|
||||
|
|
@ -62,7 +61,7 @@ const FormRenderer = ({
|
|||
fullWidth={true}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-row mt-auto mb-8">
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const Services = () => {
|
|||
const { data: marketsData, loading: marketsLoading } = useQuery(GET_MARKETS)
|
||||
const [saveAccount] = useMutation(SAVE_ACCOUNT, {
|
||||
onCompleted: () => setEditingSchema(null),
|
||||
refetchQueries: ['getData']
|
||||
refetchQueries: ['getData'],
|
||||
})
|
||||
|
||||
const markets = marketsData?.getMarkets
|
||||
|
|
@ -52,7 +52,7 @@ const Services = () => {
|
|||
const values = accounts[code] || {}
|
||||
return R.map(({ display, code, long }) => ({
|
||||
label: display,
|
||||
value: long ? formatLong(values[code]) : values[code]
|
||||
value: long ? formatLong(values[code]) : values[code],
|
||||
}))(faceElements)
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +75,8 @@ const Services = () => {
|
|||
inputProps: {
|
||||
isPasswordFilled:
|
||||
!R.isNil(accounts[code]) &&
|
||||
!R.isNil(R.path([elem.code], accounts[code]))
|
||||
}
|
||||
!R.isNil(R.path([elem.code], accounts[code])),
|
||||
},
|
||||
}
|
||||
}, elements)
|
||||
}
|
||||
|
|
@ -87,11 +87,11 @@ const Services = () => {
|
|||
const mapToCode = R.map(R.prop(['code']))
|
||||
const passwordFields = R.compose(
|
||||
mapToCode,
|
||||
filterBySecretComponent
|
||||
filterBySecretComponent,
|
||||
)(elements)
|
||||
return R.mapObjIndexed(
|
||||
(value, key) => (R.includes(key, passwordFields) ? '' : value),
|
||||
account
|
||||
account,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ const Services = () => {
|
|||
<FormRenderer
|
||||
save={it =>
|
||||
saveAccount({
|
||||
variables: { accounts: { [editingSchema.code]: it } }
|
||||
variables: { accounts: { [editingSchema.code]: it } },
|
||||
})
|
||||
}
|
||||
elements={getElements(editingSchema)}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,12 +19,12 @@ const schema = markets => {
|
|||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'privateKey',
|
||||
display: 'Private key',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -33,10 +33,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -47,10 +47,10 @@ const schema = markets => {
|
|||
.max(100, 'The private key is too long')
|
||||
.test(secretTest(account?.privateKey, 'private key')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,12 +19,12 @@ const schema = markets => {
|
|||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'privateKey',
|
||||
display: 'Private key',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -33,10 +33,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -47,10 +47,10 @@ const schema = markets => {
|
|||
.max(100, 'The private key is too long')
|
||||
.test(secretTest(account?.privateKey, 'private key')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,12 +19,12 @@ const schema = markets => {
|
|||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'secret',
|
||||
display: 'API secret',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -33,10 +33,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -47,10 +47,10 @@ const schema = markets => {
|
|||
.max(100, 'The API secret is too long')
|
||||
.test(secretTest(account?.secret, 'API secret')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
TextInput,
|
||||
SecretInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest } from './helper'
|
||||
|
|
@ -15,7 +15,7 @@ const buildTestValidation = (id, passphrase) => {
|
|||
.max(100, 'Too long')
|
||||
.when(id, {
|
||||
is: isDefined,
|
||||
then: schema => schema.test(secretTest(passphrase))
|
||||
then: schema => schema.test(secretTest(passphrase)),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ export default {
|
|||
display: 'API token',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'environment',
|
||||
|
|
@ -38,63 +38,63 @@ export default {
|
|||
inputProps: {
|
||||
options: [
|
||||
{ code: 'prod', display: 'prod' },
|
||||
{ code: 'test', display: 'test' }
|
||||
{ code: 'test', display: 'test' },
|
||||
],
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'BTCWalletId',
|
||||
display: 'BTC wallet ID',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'BTCWalletPassphrase',
|
||||
display: 'BTC wallet passphrase',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'LTCWalletId',
|
||||
display: 'LTC wallet ID',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'LTCWalletPassphrase',
|
||||
display: 'LTC wallet passphrase',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'ZECWalletId',
|
||||
display: 'ZEC wallet ID',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'ZECWalletPassphrase',
|
||||
display: 'ZEC wallet passphrase',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'BCHWalletId',
|
||||
display: 'BCH wallet ID',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'BCHWalletPassphrase',
|
||||
display: 'BCH wallet passphrase',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'DASHWalletId',
|
||||
display: 'DASH wallet ID',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'DASHWalletPassphrase',
|
||||
display: 'DASH wallet passphrase',
|
||||
component: SecretInput
|
||||
}
|
||||
component: SecretInput,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -103,47 +103,47 @@ export default {
|
|||
.required('The token is required'),
|
||||
BTCWalletId: Yup.string('The BTC wallet ID must be a string').max(
|
||||
100,
|
||||
'The BTC wallet ID is too long'
|
||||
'The BTC wallet ID is too long',
|
||||
),
|
||||
BTCWalletPassphrase: buildTestValidation(
|
||||
'BTCWalletId',
|
||||
account?.BTCWalletPassphrase
|
||||
account?.BTCWalletPassphrase,
|
||||
),
|
||||
LTCWalletId: Yup.string('The LTC wallet ID must be a string').max(
|
||||
100,
|
||||
'The LTC wallet ID is too long'
|
||||
'The LTC wallet ID is too long',
|
||||
),
|
||||
LTCWalletPassphrase: buildTestValidation(
|
||||
'LTCWalletId',
|
||||
account?.LTCWalletPassphrase
|
||||
account?.LTCWalletPassphrase,
|
||||
),
|
||||
ZECWalletId: Yup.string('The ZEC wallet ID must be a string').max(
|
||||
100,
|
||||
'The ZEC wallet ID is too long'
|
||||
'The ZEC wallet ID is too long',
|
||||
),
|
||||
ZECWalletPassphrase: buildTestValidation(
|
||||
'ZECWalletId',
|
||||
account?.ZECWalletPassphrase
|
||||
account?.ZECWalletPassphrase,
|
||||
),
|
||||
BCHWalletId: Yup.string('The BCH wallet ID must be a string').max(
|
||||
100,
|
||||
'The BCH wallet ID is too long'
|
||||
'The BCH wallet ID is too long',
|
||||
),
|
||||
BCHWalletPassphrase: buildTestValidation(
|
||||
'BCHWalletId',
|
||||
account?.BCHWalletPassphrase
|
||||
account?.BCHWalletPassphrase,
|
||||
),
|
||||
DASHWalletId: Yup.string('The DASH wallet ID must be a string').max(
|
||||
100,
|
||||
'The DASH wallet ID is too long'
|
||||
'The DASH wallet ID is too long',
|
||||
),
|
||||
DASHWalletPassphrase: buildTestValidation(
|
||||
'DASHWalletId',
|
||||
account?.DASHWalletPassphrase
|
||||
account?.DASHWalletPassphrase,
|
||||
),
|
||||
environment: Yup.string('The environment must be a string')
|
||||
.matches(/(prod|test)/)
|
||||
.required('The environment is required')
|
||||
});
|
||||
}
|
||||
.required('The environment is required'),
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,19 +19,19 @@ const schema = markets => {
|
|||
display: 'Client ID',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'key',
|
||||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'secret',
|
||||
display: 'API secret',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -40,10 +40,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -57,10 +57,10 @@ const schema = markets => {
|
|||
.max(100, 'The API secret is too long')
|
||||
.test(secretTest(account?.secret, 'API secret')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ export default {
|
|||
display: 'API token',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'confidenceFactor',
|
||||
display: 'Confidence factor',
|
||||
component: NumberInput,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'rbf',
|
||||
|
|
@ -30,10 +30,10 @@ export default {
|
|||
'Lower the confidence of RBF transactions (Available when using bitcoind.)',
|
||||
label: 'Lower the confidence of RBF transactions',
|
||||
requirement: 'bitcoind',
|
||||
rightSideLabel: true
|
||||
rightSideLabel: true,
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: () => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -44,7 +44,7 @@ export default {
|
|||
.integer('The confidence factor must be an integer')
|
||||
.min(0, 'The confidence factor must be between 0 and 100')
|
||||
.max(100, 'The confidence factor must be between 0 and 100')
|
||||
.required('The confidence factor is required')
|
||||
.required('The confidence factor is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,19 +19,19 @@ const schema = markets => {
|
|||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'uid',
|
||||
display: 'User ID',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'privateKey',
|
||||
display: 'Private key',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -40,10 +40,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -57,10 +57,10 @@ const schema = markets => {
|
|||
.max(100, 'The private key is too long')
|
||||
.test(secretTest(account?.privateKey, 'private key')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ export default {
|
|||
{
|
||||
code: 'apiKey',
|
||||
display: 'API Key',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'apiSecret',
|
||||
display: 'API Secret',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'scoreThreshold',
|
||||
display: 'Score threshold',
|
||||
component: NumberInputFormik,
|
||||
face: true,
|
||||
long: false
|
||||
long: false,
|
||||
},
|
||||
{
|
||||
code: 'enabled',
|
||||
|
|
@ -35,10 +35,10 @@ export default {
|
|||
disabledMessage: 'This plugin is disabled',
|
||||
label: 'Enabled',
|
||||
requirement: null,
|
||||
rightSideLabel: true
|
||||
rightSideLabel: true,
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -56,8 +56,8 @@ export default {
|
|||
.test(
|
||||
'no-leading-zeros',
|
||||
'The score threshold must not have leading zeros',
|
||||
leadingZerosTest
|
||||
)
|
||||
leadingZerosTest,
|
||||
),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest } from './helper'
|
||||
|
|
@ -16,7 +16,7 @@ export default {
|
|||
{
|
||||
code: 'apiSecret',
|
||||
display: 'API Secret',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'environment',
|
||||
|
|
@ -25,23 +25,23 @@ export default {
|
|||
inputProps: {
|
||||
options: [
|
||||
{ code: 'main', display: 'prod' },
|
||||
{ code: 'test', display: 'test' }
|
||||
{ code: 'test', display: 'test' },
|
||||
],
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'endpoint',
|
||||
display: 'Endpoint',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'walletId',
|
||||
display: 'Wallet ID',
|
||||
component: SecretInput
|
||||
}
|
||||
component: SecretInput,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -56,7 +56,7 @@ export default {
|
|||
.required('The environment is required'),
|
||||
endpoint: Yup.string('The endpoint must be a string')
|
||||
.max(100, 'The endpoint is too long')
|
||||
.required('The endpoint is required')
|
||||
});
|
||||
}
|
||||
.required('The endpoint is required'),
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import * as R from 'ramda'
|
|||
const WARNING_LEVELS = {
|
||||
CLEAN: 'clean',
|
||||
PARTIAL: 'partial',
|
||||
IMPORTANT: 'important'
|
||||
IMPORTANT: 'important',
|
||||
}
|
||||
|
||||
const secretTest = (secret, message) => ({
|
||||
|
|
@ -16,7 +16,7 @@ const secretTest = (secret, message) => ({
|
|||
return this.createError()
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const leadingZerosTest = (value, context) => {
|
||||
|
|
@ -39,7 +39,7 @@ const buildCurrencyOptions = markets => {
|
|||
R.length(unavailableCryptosFiltered) > 1
|
||||
? `${R.join(
|
||||
', ',
|
||||
R.slice(0, -1, unavailableCryptosFiltered)
|
||||
R.slice(0, -1, unavailableCryptosFiltered),
|
||||
)} and ${R.last(unavailableCryptosFiltered)}`
|
||||
: unavailableCryptosFiltered[0]
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ const buildCurrencyOptions = markets => {
|
|||
warning: warningLevel,
|
||||
warningMessage: !R.isEmpty(unavailableCryptosFiltered)
|
||||
? `No market pairs available for ${unavailableMarketsStr}`
|
||||
: `All market pairs are available`
|
||||
: `All market pairs are available`,
|
||||
}
|
||||
}, R.keys(markets))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ const schemas = (markets = {}) => {
|
|||
[trongrid.code]: trongrid,
|
||||
[binance.code]: binance,
|
||||
[bitfinex.code]: bitfinex,
|
||||
[sumsub.code]: sumsub
|
||||
[sumsub.code]: sumsub,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,25 +13,25 @@ export default {
|
|||
code: 'username',
|
||||
display: 'InforU username',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'apiKey',
|
||||
display: 'API Key',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'fromNumber',
|
||||
display: 'InforU sender',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'toNumber',
|
||||
display: 'Notifications Number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -46,7 +46,7 @@ export default {
|
|||
.required('The InforU sender is required'),
|
||||
toNumber: Yup.string('The notifications number must be a string')
|
||||
.max(100, 'The notifications number is too long')
|
||||
.required('The notifications number is required')
|
||||
.required('The notifications number is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ export default {
|
|||
code: 'endpoint',
|
||||
display: 'Endpoint',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: () => {
|
||||
return Yup.object().shape({
|
||||
endpoint: Yup.string('The endpoint must be a string')
|
||||
.max(100, 'The endpoint is too long')
|
||||
.required('The endpoint is required')
|
||||
.required('The endpoint is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { buildCurrencyOptions, secretTest } from './helper'
|
||||
|
|
@ -19,24 +19,24 @@ const schema = markets => {
|
|||
display: 'User ID',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'walletId',
|
||||
display: 'Wallet ID',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'clientKey',
|
||||
display: 'Client key',
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: 'clientSecret',
|
||||
display: 'Client secret',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -45,10 +45,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -65,10 +65,10 @@ const schema = markets => {
|
|||
.max(100, 'The client secret is too long')
|
||||
.test(secretTest(account?.clientSecret, 'client secret')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
SecretInput,
|
||||
TextInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
import { secretTest, buildCurrencyOptions } from './helper'
|
||||
|
|
@ -19,12 +19,12 @@ const schema = markets => {
|
|||
display: 'API key',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'privateKey',
|
||||
display: 'Private key',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'currencyMarket',
|
||||
|
|
@ -33,10 +33,10 @@ const schema = markets => {
|
|||
inputProps: {
|
||||
options: buildCurrencyOptions(markets),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -47,10 +47,10 @@ const schema = markets => {
|
|||
.max(100, 'The private key is too long')
|
||||
.test(secretTest(account?.privateKey, 'private key')),
|
||||
currencyMarket: Yup.string(
|
||||
'The currency market must be a string'
|
||||
).required('The currency market is required')
|
||||
'The currency market must be a string',
|
||||
).required('The currency market is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,25 +9,25 @@ export default {
|
|||
{
|
||||
code: 'apiKey',
|
||||
display: 'API key',
|
||||
component: TextInputFormik
|
||||
component: TextInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'domain',
|
||||
display: 'Domain',
|
||||
component: TextInputFormik
|
||||
component: TextInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'fromEmail',
|
||||
display: 'From email',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'toEmail',
|
||||
display: 'To email',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: () => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -44,7 +44,7 @@ export default {
|
|||
toEmail: Yup.string('The to email must be a string')
|
||||
.max(100, 'The to email is too long')
|
||||
.email('The to email must be a valid email address')
|
||||
.required('The to email is required')
|
||||
.required('The to email is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ export default {
|
|||
{
|
||||
code: 'apiKey',
|
||||
display: 'API Key',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'scoreThreshold',
|
||||
display: 'Score threshold',
|
||||
component: NumberInputFormik,
|
||||
face: true,
|
||||
long: false
|
||||
long: false,
|
||||
},
|
||||
{
|
||||
code: 'enabled',
|
||||
|
|
@ -30,10 +30,10 @@ export default {
|
|||
disabledMessage: 'This plugin is disabled',
|
||||
label: 'Enabled',
|
||||
requirement: null,
|
||||
rightSideLabel: true
|
||||
rightSideLabel: true,
|
||||
},
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -48,8 +48,8 @@ export default {
|
|||
.test(
|
||||
'no-leading-zeros',
|
||||
'The score threshold must not have leading zeros',
|
||||
leadingZerosTest
|
||||
)
|
||||
leadingZerosTest,
|
||||
),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as Yup from 'yup'
|
|||
import {
|
||||
TextInput,
|
||||
SecretInput,
|
||||
Autocomplete
|
||||
Autocomplete,
|
||||
} from 'src/components/inputs/formik'
|
||||
|
||||
const singleBitgo = code => ({
|
||||
|
|
@ -16,7 +16,7 @@ const singleBitgo = code => ({
|
|||
display: 'API token',
|
||||
component: TextInput,
|
||||
face: true,
|
||||
long: true
|
||||
long: true,
|
||||
},
|
||||
{
|
||||
code: 'environment',
|
||||
|
|
@ -25,23 +25,23 @@ const singleBitgo = code => ({
|
|||
inputProps: {
|
||||
options: [
|
||||
{ code: 'prod', display: 'prod' },
|
||||
{ code: 'test', display: 'test' }
|
||||
{ code: 'test', display: 'test' },
|
||||
],
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
valueProp: 'code',
|
||||
},
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: `${code}WalletId`,
|
||||
display: `${code} wallet ID`,
|
||||
component: TextInput
|
||||
component: TextInput,
|
||||
},
|
||||
{
|
||||
code: `${code}WalletPassphrase`,
|
||||
display: `${code} wallet passphrase`,
|
||||
component: SecretInput
|
||||
}
|
||||
component: SecretInput,
|
||||
},
|
||||
],
|
||||
validationSchema: Yup.object().shape({
|
||||
token: Yup.string('The token must be a string')
|
||||
|
|
@ -54,11 +54,11 @@ const singleBitgo = code => ({
|
|||
.max(100, `The ${code} wallet ID is too long`)
|
||||
.required(`The ${code} wallet ID is required`),
|
||||
[`${code}WalletPassphrase`]: Yup.string(
|
||||
`The ${code} passphrase must be a string`
|
||||
`The ${code} passphrase must be a string`,
|
||||
)
|
||||
.max(100, `The ${code} wallet passphrase is too long`)
|
||||
.required(`The ${code} wallet passphrase is required`)
|
||||
})
|
||||
.required(`The ${code} wallet passphrase is required`),
|
||||
}),
|
||||
})
|
||||
|
||||
export default singleBitgo
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ const schema = {
|
|||
{
|
||||
code: 'apiToken',
|
||||
display: 'API Token',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'secretKey',
|
||||
display: 'Secret Key',
|
||||
component: SecretInput
|
||||
component: SecretInput,
|
||||
},
|
||||
{
|
||||
code: 'applicantLevel',
|
||||
display: 'Applicant Level',
|
||||
component: TextInput,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -36,9 +36,9 @@ const schema = {
|
|||
.test(secretTest(account?.secretKey, 'secret key')),
|
||||
applicantLevel: Yup.string('The applicant level must be a string')
|
||||
.max(100, 'The applicant level is too long')
|
||||
.required('The applicant level is required')
|
||||
.required('The applicant level is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default schema
|
||||
|
|
|
|||
|
|
@ -12,20 +12,20 @@ export default {
|
|||
{
|
||||
code: 'apiKey',
|
||||
display: 'API Key',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'fromNumber',
|
||||
display: 'Telnyx Number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'toNumber',
|
||||
display: 'Notifications Number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -37,7 +37,7 @@ export default {
|
|||
.required('The Telnyx number is required'),
|
||||
toNumber: Yup.string('The notifications number must be a string')
|
||||
.max(100, 'The notifications number is too long')
|
||||
.required('The notifications number is required')
|
||||
.required('The notifications number is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ export default {
|
|||
display: 'API Key',
|
||||
component: TextInputFormik,
|
||||
face: true,
|
||||
long: true
|
||||
}
|
||||
long: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
getValidationSchema: () => {
|
||||
return Yup.object().shape({
|
||||
apiKey: Yup.string('The project ID must be a string')
|
||||
.max(100, 'The project ID is too long')
|
||||
.required('The project ID is required')
|
||||
.required('The project ID is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,25 +12,25 @@ export default {
|
|||
{
|
||||
code: 'accountSid',
|
||||
display: 'Account SID',
|
||||
component: TextInputFormik
|
||||
component: TextInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'authToken',
|
||||
display: 'Auth token',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'fromNumber',
|
||||
display: 'Twilio number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'toNumber',
|
||||
display: 'Notifications number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -45,7 +45,7 @@ export default {
|
|||
.required('The Twilio number is required'),
|
||||
toNumber: Yup.string('The notifications number must be a string')
|
||||
.max(100, 'The notifications number is too long')
|
||||
.required('The notifications number is required')
|
||||
.required('The notifications number is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,25 +12,25 @@ export default {
|
|||
{
|
||||
code: 'apiKey',
|
||||
display: 'API Key',
|
||||
component: TextInputFormik
|
||||
component: TextInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'apiSecret',
|
||||
display: 'API Secret',
|
||||
component: SecretInputFormik
|
||||
component: SecretInputFormik,
|
||||
},
|
||||
{
|
||||
code: 'fromNumber',
|
||||
display: 'Vonage Number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
face: true,
|
||||
},
|
||||
{
|
||||
code: 'toNumber',
|
||||
display: 'Notifications Number (international format)',
|
||||
component: TextInputFormik,
|
||||
face: true
|
||||
}
|
||||
face: true,
|
||||
},
|
||||
],
|
||||
getValidationSchema: account => {
|
||||
return Yup.object().shape({
|
||||
|
|
@ -45,7 +45,7 @@ export default {
|
|||
.required('The Vonage number is required'),
|
||||
toNumber: Yup.string('The notifications number must be a string')
|
||||
.max(100, 'The notifications number is too long')
|
||||
.required('The notifications number is required')
|
||||
.required('The notifications number is required'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue