DIRNGClient

@buff-beacon-project/curby-clientDocs


@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

Parameter
Type
Description

options?

The options for the client

Returns

DIRNGClient

Defined in

src/dirng.ts:407arrow-up-right

Methods

fetchRound()

fetchRound(round?): Promise<RoundData>

Fetch and validate the round data for a round

Parameters

Parameter
Type

round?

number | "latest" | "pending"

Returns

Promise<RoundData>

Defined in

src/dirng.ts:470arrow-up-right


fetchRoundData()

fetchRoundData(round): Promise<string>

Fetch the raw bell data for a round

Will validate the hash of the data

Parameters

Parameter
Type

Returns

Promise<string>

Defined in

src/dirng.ts:446arrow-up-right


fetchRoundParams()

fetchRoundParams(round): Promise<any>

Fetch the parameters for a round

Will validate the hash of the parameters

Parameters

Parameter
Type

Returns

Promise<any>

Defined in

src/dirng.ts:422arrow-up-right


latest()

latest(): Promise<RoundData>

Get the latest round data

Returns

Promise<RoundData>

Defined in

src/dirng.ts:523arrow-up-right


randomness()

randomness(): Promise<ByteHelper>

Get the latest randomness

Returns

Promise<ByteHelper>

Defined in

src/dirng.ts:515arrow-up-right


refresh()

refresh(): Promise<void>

Refresh the internal state of the client

Returns

Promise<void>

Defined in

src/dirng.ts:502arrow-up-right


waitForNext()

waitForNext(__namedParameters): Promise<undefined | RoundData>

Wait for the next round

Parameters

Parameter
Type

__namedParameters

Returns

Promise<undefined | RoundData>

Defined in

src/dirng.ts:531arrow-up-right


watch()

watch(options?): AsyncGenerator<RoundData, void, unknown>

Watch for new rounds

Parameters

Parameter
Type
Description

options?

The options for waiting

Returns

AsyncGenerator<RoundData, void, unknown>

Example

Last updated