fix: always consider user input when performing swap (#572)

* fix: always consider user input when performing swap

* refactor: extract decimal places constants

* refactor: extract minimumOptimalValue

* fix: handle bzz precision and tweak message
This commit is contained in:
Cafe137
2022-11-09 14:21:34 +01:00
committed by GitHub
parent a4b8e7ca25
commit ec8fdf0315
5 changed files with 98 additions and 47 deletions
+2 -2
View File
@@ -1,13 +1,13 @@
import axios from 'axios'
import { BEE_DESKTOP_LATEST_RELEASE_PAGE_API } from '../constants'
import { DaiToken } from '../models/DaiToken'
import { Token } from '../models/Token'
import { postJson } from './net'
import { BEE_DESKTOP_LATEST_RELEASE_PAGE_API } from '../constants'
export async function getBzzPriceAsDai(desktopUrl: string): Promise<Token> {
const response = await axios.get(`${desktopUrl}/price`)
return DaiToken.fromDecimal(response.data, 18)
return DaiToken.fromDecimal(response.data)
}
export async function upgradeToLightNode(desktopUrl: string, rpcProvider: string): Promise<void> {