Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createOrder = async ({ fromPeer, order, ...rest }) => {
console.log('rest', ...rest)
// TODO add check exchange rate and format order
const createdOrder = await actions.core.createOrder(order)
actions.core.requestToPeer('accept request', fromPeer, { orderId: createdOrder.id })
}
if (declineSwap) {
const itemState = declineSwap.flow.state
const values = itemState.btcScriptValues
|| itemState.bchScriptValues
|| itemState.ltcScriptValues
// || itemState.usdtOmniScriptValues
|| itemState.scriptValues
if (values) {
const { isFinished, isRefunded, isStoppedSwap } = itemState
const lockTime = moment.unix(values.lockTime || date)._i / 1000
const timeSinceLock = date - lockTime
if (isFinished || isRefunded || isStoppedSwap || timeSinceLock > 259200) { // 259200 3 дня в секундах
actions.core.forgetOrders(decline[i])
} else if (declineSwap.sellCurrency === currency.toUpperCase()
&& !declineSwap.isSwapExist
&& !declineSwap.isMy) {
return i
}
}
}
}
}
return false
}
metaTitle: {
id: 'CurrencyWalletWidgetBuildTitle',
defaultMessage: '{fullName} ({currency}) Web Wallet with Atomic Swap.',
},
})
const title = (isWidgetBuild) ? titleWidgetBuild : titleSwapOnline
const description = defineMessages({
metaDescription: {
id: 'CurrencyWallet154',
defaultMessage: 'Atomic Swap Wallet allows you to manage and securely exchange ${fullName} (${currency}) with 0% fees. Based on Multi-Sig and Atomic Swap technologies.',
},
})
if (hiddenCoinsList.includes(currency)) {
actions.core.markCoinAsVisible(currency)
}
const isBlockedCoin = config.noExchangeCoins
.map(item => item.toLowerCase())
.includes(currency.toLowerCase())
return (
<div>
</div>
createOrder = () => {
const { offer: { buyAmount, sellAmount, buyCurrency, sellCurrency, exchangeRate, isPartialClosure } } = this.props
const data = {
buyCurrency: `${buyCurrency}`,
sellCurrency: `${sellCurrency}`,
buyAmount: Number(buyAmount),
sellAmount: Number(sellAmount),
exchangeRate: Number(exchangeRate),
isPartialClosure,
}
actions.analytics.dataEvent('orderbook-addoffer-click-confirm-button')
actions.core.createOrder(data)
actions.core.updateCore()
}
saveThisSwap = (orderId) => {
actions.core.rememberOrder(orderId)
}
removeOrder = (orderId) => {
if (confirm('Are your sure ?')) {
actions.core.removeOrder(orderId)
actions.core.updateCore()
}
}
deleteThisSwap = (orderId) => {
actions.core.saveDeletedOrder(orderId)
actions.core.forgetOrders(orderId)
window.swap = null
}
const getSwapByIdSafe = (swapID) => {
try {
const returnedSwap = actions.core.getSwapById(swapID)
return returnedSwap
} catch (noFlowError) {
return false
}
}
const getDeclinedExistedSwapIndex = ({ currency, decline }) => {
.forEach(name => {
if (!hiddenCoinsList.includes(name.toUpperCase())) {
actions.core.markCoinAsVisible(name.toUpperCase())
}
})
}
const removeOrder = (orderId) => {
actions.feed.deleteItemToFeed(orderId)
SwapApp.shared().services.orders.remove(orderId)
actions.core.updateCore()
}