UNPKG

@elevenyellow.com/ark-switchain-plugin

Version:

Switchain plugin on Ark Desktop Wallet

38 lines (33 loc) 820 B
const currenciesRules = require("./currencies-regex.json"); const valiateAddress = (currency, address) => { if (currenciesRules[currency.toLowerCase()]) { const matches = address.match( currenciesRules[currency.toLowerCase()].regEx ); if (matches) { return true; } return false; } return true; }; const valiateExternalId = (currency, id) => { const ticker = currency.toLowerCase(); if (currenciesRules[ticker] && currenciesRules[ticker].regExTag) { const matches = id.match(currenciesRules[ticker].regExTag); if (matches) { return true; } return false; } return true; }; const pairToObject = ({ pair }) => { const [from, to] = pair.split("-"); return { from, to }; }; module.exports = { valiateAddress, valiateExternalId, pairToObject };