feat: add light node upgrade top up methods (#372)

* feat: add top up

* chore: remove console.log

* build: add pseudo-missing dependency

* feat: add missing top up components

* fix: crypto route

* feat(wip): add gift wallet logic

* fix: fix gift wallet flows

* feat: simplify flow without fund step

* feat: add loading screens

* fix: remove alert

* fix: prepend http if needed

* fix: fix bug that was reintroduced with merge

* refactor: rename minusEther to minusBaseUnits

* fix: remove unused setStartedAt

* build: remove unused dependency
This commit is contained in:
Cafe137
2022-06-02 09:28:43 +02:00
committed by GitHub
parent 026783924f
commit a768b4ea06
35 changed files with 1196 additions and 215 deletions
+14
View File
@@ -26,6 +26,12 @@ export async function upgradeToLightNode(rpcProvider: string): Promise<void> {
})
}
export async function setJsonRpcInDesktop(value: string): Promise<void> {
await updateDesktopConfiguration({
'swap-endpoint': value,
})
}
async function updateDesktopConfiguration(values: Record<string, unknown>): Promise<void> {
await postJson(`http://${getDesktopHost()}/config`, values)
}
@@ -34,6 +40,14 @@ export async function restartBeeNode(): Promise<void> {
await postJson(`http://${getDesktopHost()}/restart`)
}
export async function createGiftWallet(address: string): Promise<void> {
await postJson(`http://${getDesktopHost()}/gift-wallet/${address}`)
}
export async function performSwap(daiAmount: string): Promise<void> {
await postJson(`http://${getDesktopHost()}/swap`, { dai: daiAmount })
}
function getDesktopHost(): string {
return window.location.host
}