Client
@buff-beacon-project/curby-client • Docs
@buff-beacon-project/curby-client / Client
Class: Client
A client for fetching randomness from the CURBy RNG chain
Example
import { Client } from '@buff-beacon-project/curby-client'
const client = Client.create()
const randomness = await client.randomness()
console.log(randomness)
Constructors
new Client()
new Client(
options
?):Client
Parameters
Returns
Defined in
Methods
fetchPulsePair()
fetchPulsePair(
indexOrCid
?):Promise
<PulsePair
>
Fetch the a pulse and its predecessor by index or CID
Parameters
indexOrCid
?
number
| IntoCid
Returns
Promise
<PulsePair
>
Defined in
latest()
latest():
Promise
<undefined
|RandomnessRound
>
Get the latest round data
Returns
Promise
<undefined
| RandomnessRound
>
Defined in
pair()
pair():
Promise
<LatestPulsePair
>
Get the latest and previous pulse
Returns
Promise
<LatestPulsePair
>
Defined in
prev()
prev():
Promise
<undefined
|null
|Pulse
>
Get the previous pulse
Returns
Promise
<undefined
| null
| Pulse
>
Defined in
randomness()
randomness(
round
?):Promise
<null
|ByteHelper
>
Get the latest randomness or the randomness for a specific round
Parameters
round
?
number
Returns
Promise
<null
| ByteHelper
>
Defined in
refresh()
refresh():
Promise
<undefined
|RandomnessRound
>
Refresh the internal state of the client
Returns
Promise
<undefined
| RandomnessRound
>
Defined in
waitForNext()
waitForNext(
__namedParameters
):Promise
<undefined
|RandomnessRound
>
Wait for the next pulse
Parameters
__namedParameters
Returns
Promise
<undefined
| RandomnessRound
>
Defined in
watch()
watch(
options
?):AsyncGenerator
<undefined
|RandomnessRound
,void
,unknown
>
Poll for the latest randomness
Parameters
Returns
AsyncGenerator
<undefined
| RandomnessRound
, void
, unknown
>
Example
const client = Client.create()
for await (const round of client.watch()){
console.log(round.randomness)
}
Defined in
create()
static
create(options
?):Client
Create a new client
Parameters
Returns
Defined in
Last updated