@ceramicnetwork/anchor-listener v4.8.0
Ceramic Anchor listener
Getting started
Installation
$ npm install @ceramicnetwork/anchor-listener
Usage
import {
createBlockProofsListener,
createBlocksProofsLoader,
createAncestorBlocksProofsLoader,
} from '@ceramicnetwork/anchor-listener'
import { take, timeout } from 'rxjs'
// Listen to new block events on the provider and load anchor proofs
const subsription = createBlockProofsListener({ chainId: 'eip155:1', confirmations: 20, provider: ... }).subscribe({
next(event) {
// event contains the `block` and `proofs`
}
})
// Unsubscribe to stop listening
subscription.unsubscribe()
// Load proofs for a range of blocks
createBlocksProofsLoader({ chainId: 'eip155:1', fromBlock: 100, toBlock: 120, provider: ... }).subscribe({
next(event) {
// event contains the `block` and `proofs`
}
})
// Load proofs for blocks, walking up the parents until the expected ancestor hash is found
createAncestorBlocksProofsLoader({ chainId: 'eip155:1', initialBlock: 'latest', targetAncestorHash: '...', provider: ... }).pipe(
// Operators can be used to add stopping conditions
take(50), // attempt to load maximum 50 blocks
timeout(300_000), // timeout after 5 minutes
).subscribe({
next(event) {
// event contains the `block` and `proofs`
// unless interrupted, `block.parentHash` will be `targetAncestorHash` in the last event
}
})
Development
Run tests:
npm test
Run linter:
npm run lint
Contributing
We are happy to accept small and large contributions. Make sure to check out the Ceramic specifications for details of how the protocol works.
License
MIT or Apache-2.0
3 days ago
4 days ago
4 days ago
4 days ago
5 days ago
6 days ago
7 days ago
8 days ago
9 days ago
10 days ago
11 days ago
11 days ago
11 days ago
12 days ago
13 days ago
14 days ago
15 days ago
16 days ago
17 days ago
18 days ago
18 days ago
18 days ago
19 days ago
20 days ago
21 days ago
22 days ago
23 days ago
24 days ago
25 days ago
26 days ago
27 days ago
28 days ago
29 days ago
1 month ago
30 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
10 months ago
8 months ago
9 months ago
9 months ago
6 months ago
7 months ago
8 months ago
7 months ago
6 months ago
6 months ago
9 months ago
8 months ago
6 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
6 months ago
9 months ago
10 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago