feat: integrate LNBits wallet schema and configuration
- Added LNBits wallet schema to the admin UI, including validation and input components. - Updated the services index to include LNBits in the available wallet options. - Enhanced the wallet selection component to handle LNBits configuration input.
This commit is contained in:
parent
0f64df1d69
commit
ee625a91e9
4 changed files with 53 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import inforu from './inforu'
|
||||||
import infura from './infura'
|
import infura from './infura'
|
||||||
import _itbit from './itbit'
|
import _itbit from './itbit'
|
||||||
import _kraken from './kraken'
|
import _kraken from './kraken'
|
||||||
|
import lnbits from './lnbits'
|
||||||
import mailgun from './mailgun'
|
import mailgun from './mailgun'
|
||||||
import scorechain from './scorechain'
|
import scorechain from './scorechain'
|
||||||
import sumsub from './sumsub'
|
import sumsub from './sumsub'
|
||||||
|
|
@ -31,6 +32,7 @@ const schemas = (markets = {}) => {
|
||||||
return {
|
return {
|
||||||
[bitgo.code]: bitgo,
|
[bitgo.code]: bitgo,
|
||||||
[galoy.code]: galoy,
|
[galoy.code]: galoy,
|
||||||
|
[lnbits.code]: lnbits,
|
||||||
[bitstamp.code]: bitstamp,
|
[bitstamp.code]: bitstamp,
|
||||||
[blockcypher.code]: blockcypher,
|
[blockcypher.code]: blockcypher,
|
||||||
[elliptic.code]: elliptic,
|
[elliptic.code]: elliptic,
|
||||||
|
|
|
||||||
36
packages/admin-ui/src/pages/Services/schemas/lnbits.js
Normal file
36
packages/admin-ui/src/pages/Services/schemas/lnbits.js
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
|
import {
|
||||||
|
SecretInput,
|
||||||
|
TextInput,
|
||||||
|
} from '../../../components/inputs/formik'
|
||||||
|
|
||||||
|
import { secretTest } from './helper'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
code: 'lnbits',
|
||||||
|
name: 'LNBits',
|
||||||
|
title: 'LNBits (Wallet)',
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
code: 'endpoint',
|
||||||
|
display: 'LNBits Server URL',
|
||||||
|
component: TextInput,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'adminKey',
|
||||||
|
display: 'Admin Key',
|
||||||
|
component: SecretInput,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
getValidationSchema: account => {
|
||||||
|
return Yup.object().shape({
|
||||||
|
endpoint: Yup.string('The endpoint must be a string')
|
||||||
|
.max(200, 'The endpoint is too long')
|
||||||
|
.required('The endpoint is required'),
|
||||||
|
adminKey: Yup.string('The Admin Key must be a string')
|
||||||
|
.max(200, 'The Admin Key is too long')
|
||||||
|
.test(secretTest(account?.adminKey)),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -36,7 +36,7 @@ const SAVE_ACCOUNTS = gql`
|
||||||
`
|
`
|
||||||
|
|
||||||
const isConfigurable = it =>
|
const isConfigurable = it =>
|
||||||
R.includes(it)(['infura', 'bitgo', 'trongrid', 'galoy'])
|
R.includes(it)(['infura', 'bitgo', 'trongrid', 'galoy', 'lnbits'])
|
||||||
|
|
||||||
const isLocalHosted = it =>
|
const isLocalHosted = it =>
|
||||||
R.includes(it)([
|
R.includes(it)([
|
||||||
|
|
@ -178,6 +178,19 @@ const ChooseWallet = ({ data: currentData, addData }) => {
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{selected === 'lnbits' && (
|
||||||
|
<>
|
||||||
|
<H4 noMargin>Enter wallet information</H4>
|
||||||
|
<FormRenderer
|
||||||
|
value={accounts.lnbits}
|
||||||
|
save={saveWallet(selected)}
|
||||||
|
elements={schema.lnbits.elements}
|
||||||
|
validationSchema={schema.lnbits.getValidationSchema(accounts.lnbits)}
|
||||||
|
buttonLabel={'Continue'}
|
||||||
|
buttonClass={classes.formButton}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ const ALL_ACCOUNTS = [
|
||||||
cryptos: [BTC, ZEC, LTC, BCH, DASH],
|
cryptos: [BTC, ZEC, LTC, BCH, DASH],
|
||||||
},
|
},
|
||||||
{ code: 'galoy', display: 'Galoy', class: WALLET, cryptos: [LN] },
|
{ code: 'galoy', display: 'Galoy', class: WALLET, cryptos: [LN] },
|
||||||
|
{ code: 'lnbits', display: 'LNBits', class: WALLET, cryptos: [LN] },
|
||||||
{
|
{
|
||||||
code: 'bitstamp',
|
code: 'bitstamp',
|
||||||
display: 'Bitstamp',
|
display: 'Bitstamp',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue