diff --git a/lib/wallet.js b/lib/wallet.js index 492f5da9..a83013ff 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -90,8 +90,7 @@ export function generateSchema (wallet) { if (field.validate.test) { validator = validator.test({ name: field.name, - test: field.validate.test, - message: field.validate.message + ...(typeof field.validate.test === 'function' ? { test: field.validate.test } : field.validate.test) }) } diff --git a/wallets/lightning-address/index.js b/wallets/lightning-address/index.js index 31618258..230fc814 100644 --- a/wallets/lightning-address/index.js +++ b/wallets/lightning-address/index.js @@ -9,8 +9,10 @@ export const fields = [ autoComplete: 'off', validate: { type: 'email', - test: addr => !addr.endsWith('@stacker.news'), - message: 'automated withdrawals must be external' + test: { + test: addr => !addr.endsWith('@stacker.news'), + message: 'automated withdrawals must be external' + } } } ] diff --git a/wallets/lnd/index.js b/wallets/lnd/index.js index 288250d4..eecc4fe4 100644 --- a/wallets/lnd/index.js +++ b/wallets/lnd/index.js @@ -27,8 +27,10 @@ export const fields = [ clear: true, validate: { type: 'hexOrBase64', - test: v => isInvoiceMacaroon(v) || isInvoicableMacaroon(v), - message: 'not an invoice macaroon or an invoicable macaroon' + test: { + test: v => isInvoiceMacaroon(v) || isInvoicableMacaroon(v), + message: 'not an invoice macaroon or an invoicable macaroon' + } } }, {