fix: put back external wallet balance context (#704)

* fix: put back external wallet balance context

* fix: include top up index page

* fix: include gift code index page

* fix: add BalanceProvider
This commit is contained in:
Cafe137
2025-11-13 19:00:35 +01:00
committed by GitHub
parent 5fdcdfb444
commit 096522aa8a
8 changed files with 180 additions and 65 deletions
+23
View File
@@ -2,6 +2,29 @@ import { BZZ, DAI, EthAddress } from '@ethersphere/bee-js'
import { providers, Wallet } from 'ethers'
import { estimateNativeTransferTransactionCost, Rpc } from './rpc'
export class WalletAddress {
private constructor(
public address: string,
public bzz: BZZ,
public dai: DAI,
public provider: providers.JsonRpcProvider,
) {}
static async make(address: string, provider: providers.JsonRpcProvider): Promise<WalletAddress> {
const bzz = await Rpc._eth_getBalanceERC20(address, provider)
const dai = await Rpc._eth_getBalance(address, provider)
return new WalletAddress(address, bzz, dai, provider)
}
public async refresh(): Promise<WalletAddress> {
this.bzz = await Rpc._eth_getBalanceERC20(this.address, this.provider)
this.dai = await Rpc._eth_getBalance(this.address, this.provider)
return this
}
}
export class ResolvedWallet {
public address: string
public privateKey: string