Skip to content

Commit

Permalink
style: adjust code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafe137 committed Dec 4, 2024
1 parent dbcddf2 commit 486a529
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/command/utility/get-bee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export class GetBee extends RootCommand implements LeafCommand {
const url = `https://github.com/ethersphere/bee/releases/download/v2.3.0/bee-${platformString}-${archString}${suffixString}`
this.console.info(`Downloading Bee from ${url}`)
await fetch(url)
.then(async x => x.arrayBuffer())
.then(x => x.arrayBuffer())
.then(x => writeFileSync(`bee${suffixString}`, Buffer.from(x)))
this.console.info('Bee downloaded successfully')

if (process.platform !== 'win32') {
this.console.info(`Running chmod +x bee`)
execSync('chmod +x bee')
Expand Down
3 changes: 3 additions & 0 deletions src/command/utility/redeem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class Redeem extends RootCommand implements LeafCommand {

public async run(): Promise<void> {
super.init()

if (!this.target) {
this.console.log('Fetching Bee wallet address...')
const { ethereum } = await this.bee.getNodeAddresses()
Expand All @@ -62,6 +63,7 @@ export class Redeem extends RootCommand implements LeafCommand {
}

const firstKnownxDAI = xDAI

if (xBZZ !== '0') {
this.console.log('Transferring xBZZ to Bee wallet...')
await Rpc.sendBzzTransaction(this.wallet, this.target, xBZZ, this.jsonRpcUrl)
Expand All @@ -79,6 +81,7 @@ export class Redeem extends RootCommand implements LeafCommand {

if (xDAI === firstKnownxDAI) {
this.console.log('xDAI balance did not change, skipping transfer')

return
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ interface TransferResponse {
receipt: providers.TransactionReceipt
}

interface TransferCost {
gasPrice: BN
totalCost: BN
}

export async function estimateNativeTransferTransactionCost(
privateKey: string,
jsonRpcProvider: string,
): Promise<{ gasPrice: BN; totalCost: BN }> {
): Promise<TransferCost> {
const signer = await makeReadySigner(privateKey, jsonRpcProvider)
const gasLimit = '21000'
const gasPrice = await signer.getGasPrice()
Expand Down

0 comments on commit 486a529

Please sign in to comment.