DIRNGClient
@buff-beacon-project/curby-client • Docs
@buff-beacon-project/curby-client / DIRNGClient
Class: DIRNGClient
A client for the Device Independent Randomness Generation (DIRNG) chain
Example
import { DIRNGClient } from '@buff-beacon-project/curby-client'
const client = DIRNGClient.create()
const randomness = await client.randomness()
console.log(randomness)
Constructors
new DIRNGClient()
new DIRNGClient(
options
?):DIRNGClient
Create a new client
Parameters
Returns
Defined in
Methods
fetchRound()
fetchRound(
round
?):Promise
<RoundData
>
Fetch and validate the round data for a round
Parameters
round
?
number
| "latest"
| "pending"
Returns
Promise
<RoundData
>
Defined in
fetchRoundData()
fetchRoundData(
round
):Promise
<string
>
Fetch the raw bell data for a round
Will validate the hash of the data
Parameters
round
Returns
Promise
<string
>
Defined in
fetchRoundParams()
fetchRoundParams(
round
):Promise
<any
>
Fetch the parameters for a round
Will validate the hash of the parameters
Parameters
round
Returns
Promise
<any
>
Defined in
latest()
latest():
Promise
<RoundData
>
Get the latest round data
Returns
Promise
<RoundData
>
Defined in
randomness()
randomness():
Promise
<ByteHelper
>
Get the latest randomness
Returns
Promise
<ByteHelper
>
Defined in
refresh()
refresh():
Promise
<void
>
Refresh the internal state of the client
Returns
Promise
<void
>
Defined in
waitForNext()
waitForNext(
__namedParameters
):Promise
<undefined
|RoundData
>
Wait for the next round
Parameters
__namedParameters
Returns
Promise
<undefined
| RoundData
>
Defined in
watch()
watch(
options
?):AsyncGenerator
<RoundData
,void
,unknown
>
Watch for new rounds
Parameters
Returns
AsyncGenerator
<RoundData
, void
, unknown
>
Example
const client = DIRNGClient.create()
for await (const round of client.watch()){
console.log(round)
}
#### Defined in
[src/dirng.ts:568](https://github.com/buff-beacon-project/curby-js-client/blob/95397f5e9fcc8ad57ef410c54473862e0b83bc59/src/dirng.ts#L568)
***
### create()
> `static` **create**(`options`?): [`DIRNGClient`](DIRNGClient.md)
Create a new client
#### Parameters
| Parameter | Type |
| ------ | ------ |
| `options`? | [`DIRNGClientOptions`](../type-aliases/DIRNGClientOptions.md) |
#### Returns
[`DIRNGClient`](DIRNGClient.md)
#### Defined in
[src/dirng.ts:399](https://github.com/buff-beacon-project/curby-js-client/blob/95397f5e9fcc8ad57ef410c54473862e0b83bc59/src/dirng.ts#L399)
Last updated