Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/Send.js
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | import { | ||||
WalletInfoCtn, | WalletInfoCtn, | ||||
SidePaddingCtn, | SidePaddingCtn, | ||||
FormLabel, | FormLabel, | ||||
} from 'components/Common/Atoms'; | } from 'components/Common/Atoms'; | ||||
import { | import { | ||||
getWalletState, | getWalletState, | ||||
convertToEcashPrefix, | convertToEcashPrefix, | ||||
toLegacyCash, | toLegacyCash, | ||||
toLegacyCashArray, | |||||
fromSmallestDenomination, | fromSmallestDenomination, | ||||
} from 'utils/cashMethods'; | } from 'utils/cashMethods'; | ||||
import ApiError from 'components/Common/ApiError'; | import ApiError from 'components/Common/ApiError'; | ||||
import { formatFiatBalance, formatBalance } from 'utils/formatting'; | import { formatFiatBalance, formatBalance } from 'utils/formatting'; | ||||
import { | import { | ||||
TokenParamLabel, | TokenParamLabel, | ||||
MessageVerificationParamLabel, | MessageVerificationParamLabel, | ||||
} from 'components/Common/Atoms'; | } from 'components/Common/Atoms'; | ||||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | async function send() { | ||||
passLoadingStatus(true); | passLoadingStatus(true); | ||||
const { address } = formData; | const { address } = formData; | ||||
//convert each line from TextArea input | //convert each line from TextArea input | ||||
let addressAndValueArray = address.split('\n'); | let addressAndValueArray = address.split('\n'); | ||||
try { | try { | ||||
// construct array of XEC->BCH addresses due to bch-api constraint | |||||
let cleanAddressAndValueArray = | |||||
toLegacyCashArray(addressAndValueArray); | |||||
const link = await sendXec( | const link = await sendXec( | ||||
bchObj, | bchObj, | ||||
wallet, | wallet, | ||||
slpBalancesAndUtxos.nonSlpUtxos, | slpBalancesAndUtxos.nonSlpUtxos, | ||||
currency.defaultFee, | currency.defaultFee, | ||||
opReturnMsg, | opReturnMsg, | ||||
true, // indicate send mode is one to many | true, // indicate send mode is one to many | ||||
cleanAddressAndValueArray, | addressAndValueArray, | ||||
null, | null, | ||||
null, | null, | ||||
false, // one to many tx msg can't be encrypted | false, // one to many tx msg can't be encrypted | ||||
airdropFlag, | airdropFlag, | ||||
formData.airdropTokenId, | formData.airdropTokenId, | ||||
); | ); | ||||
sendXecNotification(link); | sendXecNotification(link); | ||||
clearInputForms(); | clearInputForms(); | ||||
Show All 19 Lines | async function send() { | ||||
passLoadingStatus(true); | passLoadingStatus(true); | ||||
const { address, value } = formData; | const { address, value } = formData; | ||||
// Get the param-free address | // Get the param-free address | ||||
let cleanAddress = address.split('?')[0]; | let cleanAddress = address.split('?')[0]; | ||||
// Ensure address has bitcoincash: prefix and checksum | // Ensure address has bitcoincash: prefix and checksum | ||||
cleanAddress = toLegacyCash(cleanAddress); | // cleanAddress = toLegacyCash(cleanAddress); | ||||
// Calculate the amount in BCH | // Calculate the amount in BCH | ||||
let bchValue = value; | let bchValue = value; | ||||
if (selectedCurrency !== 'XEC') { | if (selectedCurrency !== 'XEC') { | ||||
bchValue = fiatToCrypto(value, fiatPrice); | bchValue = fiatToCrypto(value, fiatPrice); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 896 Lines • Show Last 20 Lines |