-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to check whether bee api is available (#127)
* feat: add option to check whether bee api is available * chore: add missing definition
- Loading branch information
1 parent
2ce4f00
commit 34719b0
Showing
7 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
import { BeeDebug, PostageBatch } from '@ethersphere/bee-js' | ||
import { Bee, BeeDebug, PostageBatch } from '@ethersphere/bee-js' | ||
|
||
export function getPostageBatches(beeDebugApiUrl: string): Promise<PostageBatch[]> { | ||
const bee = new BeeDebug(beeDebugApiUrl) | ||
|
||
return bee.getAllPostageBatch() | ||
} | ||
|
||
export async function isBeeApiAvailable(beeApiAddress: string): Promise<boolean> { | ||
try { | ||
const bee = new Bee(beeApiAddress) | ||
|
||
await bee.checkConnection() | ||
|
||
return true | ||
} catch (error) { | ||
return false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters