feat: add real price calculation to swap page (#459)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import { DaiToken } from '../models/DaiToken'
|
||||
import { Token } from '../models/Token'
|
||||
import { getJson, postJson, sendRequest } from './net'
|
||||
|
||||
interface DesktopStatus {
|
||||
@@ -15,6 +18,12 @@ export async function getDesktopStatus(): Promise<DesktopStatus> {
|
||||
return response as DesktopStatus
|
||||
}
|
||||
|
||||
export async function getBzzPriceAsDai(): Promise<Token> {
|
||||
const response = await axios.get(`${getDesktopHost()}/price`)
|
||||
|
||||
return DaiToken.fromDecimal(response.data, 18)
|
||||
}
|
||||
|
||||
export async function upgradeToLightNode(rpcProvider: string): Promise<void> {
|
||||
await updateDesktopConfiguration({
|
||||
'chain-enable': true,
|
||||
|
||||
Reference in New Issue
Block a user