fix: handle auth and server error during swap (#593)

* fix: change execution order for light node upgrade

* refactor: grab new configuration from post config request

* fix: only print successful light node upgrade when it really happens

* fix: log full desktop side swap error (#596)

* refactor: try to make the auth error in swap nicer

* refactor: make error instruction consistent

* fix: avoid overwriting daiToSwap when it is set manually
This commit is contained in:
Cafe137
2022-12-01 12:36:15 +01:00
committed by GitHub
parent dc04e26db4
commit 665ae063fa
8 changed files with 71 additions and 26 deletions
+4 -4
View File
@@ -26,8 +26,8 @@ export async function getBzzPriceAsDai(desktopUrl: string): Promise<Token> {
return DaiToken.fromDecimal(response.data)
}
export async function upgradeToLightNode(desktopUrl: string, rpcProvider: string): Promise<void> {
await updateDesktopConfiguration(desktopUrl, {
export function upgradeToLightNode(desktopUrl: string, rpcProvider: string): Promise<BeeConfig> {
return updateDesktopConfiguration(desktopUrl, {
'swap-enable': true,
'swap-endpoint': rpcProvider,
})
@@ -43,8 +43,8 @@ export function getDesktopConfiguration(desktopUrl: string): Promise<BeeConfig>
return getJson(`${desktopUrl}/config`)
}
async function updateDesktopConfiguration(desktopUrl: string, values: Record<string, unknown>): Promise<void> {
await postJson(`${desktopUrl}/config`, values)
function updateDesktopConfiguration(desktopUrl: string, values: Record<string, unknown>): Promise<BeeConfig> {
return postJson(`${desktopUrl}/config`, values)
}
export async function restartBeeNode(desktopUrl: string): Promise<void> {