fix: added missing code from various LN PRs

This commit is contained in:
Rafael Taranto 2023-10-31 18:27:42 +00:00
parent 3fe3fed203
commit a3eb44bda2
9 changed files with 241 additions and 509 deletions

View file

@ -1,7 +1,10 @@
import * as Yup from 'yup'
import SecretInputFormik from 'src/components/inputs/formik/SecretInput'
import TextInputFormik from 'src/components/inputs/formik/TextInput'
import {
SecretInput,
TextInput,
Autocomplete
} from 'src/components/inputs/formik'
import { secretTest } from './helper'
@ -11,26 +14,49 @@ export default {
title: 'Galoy (Wallet)',
elements: [
{
code: 'apiKey',
display: 'API Key',
component: TextInputFormik,
face: true,
long: true
code: 'apiSecret',
display: 'API Secret',
component: SecretInput
},
{
code: 'environment',
display: 'Environment',
component: Autocomplete,
inputProps: {
options: [
{ code: 'main', display: 'prod' },
{ code: 'test', display: 'test' }
],
labelProp: 'display',
valueProp: 'code'
},
face: true
},
{
code: 'endpoint',
display: 'Endpoint',
component: TextInput
},
{
code: 'walletId',
display: 'Wallet ID',
component: SecretInputFormik
component: SecretInput
}
],
getValidationSchema: account => {
return Yup.object().shape({
apiKey: Yup.string('The API key must be a string')
.max(200, 'The API key is too long')
.required('The API key is required'),
apiSecret: Yup.string('The API Secret must be a string')
.max(200, 'The API Secret is too long')
.test(secretTest(account?.apiSecret)),
walletId: Yup.string('The wallet id must be a string')
.max(100, 'The wallet id is too long')
.test(secretTest(account?.walletId))
.test(secretTest(account?.walletId)),
environment: Yup.string('The environment must be a string')
.matches(/(main|test)/)
.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')
})
}
}