UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

23 lines (20 loc) 588 B
const { isValidAddress } = require('ethereumjs-util'); const getColor = require('./getColor'); const makeTransfer = require('../../txHelpers/makeTransfer'); module.exports = async (bridgeState, from, to, colorOrAddress, value) => { let color = colorOrAddress; if (isValidAddress(colorOrAddress)) { color = await getColor(bridgeState, colorOrAddress); } const tx = await makeTransfer( { balances: bridgeState.currentState.balances, unspent: bridgeState.currentState.unspent, }, from, to, value, Number(color) ); return tx.toJSON(); };