refactor: replace custom field function with const and move update trade logic inside a function
This commit is contained in:
parent
f45c783876
commit
8567b7887c
6 changed files with 25 additions and 19 deletions
|
|
@ -19,7 +19,8 @@ function fetchExchange (settings, cryptoCode) {
|
|||
})
|
||||
}
|
||||
|
||||
function buy (settings, cryptoAtoms, fiatCode, cryptoCode, tradeId) {
|
||||
function buy (settings, tradeEntry, tradeId) {
|
||||
const { cryptoAtoms, fiatCode, cryptoCode } = tradeEntry
|
||||
return fetchExchange(settings, cryptoCode)
|
||||
.then(r => {
|
||||
if (r.exchangeName === 'mock-exchange') {
|
||||
|
|
@ -29,7 +30,8 @@ function buy (settings, cryptoAtoms, fiatCode, cryptoCode, tradeId) {
|
|||
})
|
||||
}
|
||||
|
||||
function sell (settings, cryptoAtoms, fiatCode, cryptoCode, tradeId) {
|
||||
function sell (settings, tradeEntry, tradeId) {
|
||||
const { cryptoAtoms, fiatCode, cryptoCode } = tradeEntry
|
||||
return fetchExchange(settings, cryptoCode)
|
||||
.then(r => {
|
||||
if (r.exchangeName === 'mock-exchange') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue