4.8.0 • Published 3 days ago

@ceramicnetwork/anchor-listener v4.8.0

Weekly downloads
-
License
(Apache-2.0 OR MI...
Repository
-
Last release
3 days ago

Ceramic Anchor listener

ceramicnetwork MIT license npm.io Twitter

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

4.8.0

4 days ago

4.9.0-rc.0

4 days ago

4.7.0

11 days ago

4.8.0-rc.0

11 days ago

4.7.0-rc.0

18 days ago

4.6.0

18 days ago

4.6.0-rc.0

1 month ago

4.5.0

1 month ago

4.4.0

1 month ago

4.5.0-rc.0

1 month ago

4.3.0

1 month ago

4.4.0-rc.0

1 month ago

4.3.0-rc.0

2 months ago

4.2.0

2 months ago

4.2.0-rc.0

2 months ago

4.0.1-rc.1

2 months ago

4.1.0

2 months ago

4.0.1-rc.0

3 months ago

4.0.0

3 months ago

2.4.1

3 months ago

3.1.1-nightly.0

3 months ago

3.1.0-nightly.0

3 months ago

3.1.0

3 months ago

3.1.0-rc.0

3 months ago

2.4.0

3 months ago

2.4.1-nightly.0

3 months ago

2.4.0-rc.1

3 months ago

2.4.0-nightly.0

3 months ago

2.4.0-nightly.9

3 months ago

2.4.0-nightly.5

3 months ago

2.4.0-nightly.6

3 months ago

2.4.0-rc.0

3 months ago

2.3.0

3 months ago

2.2.0-nightly.41

3 months ago

2.3.0-rc.2

3 months ago

2.3.0-rc.1

3 months ago

2.3.0-rc.0

4 months ago

2.2.0

5 months ago

2.2.0-rc.0

5 months ago

2.1.0

5 months ago

2.1.0-rc.0

5 months ago

2.0.5

5 months ago

1.14.0

10 months ago

1.18.0

8 months ago

1.16.1

9 months ago

1.16.0

9 months ago

2.0.4

6 months ago

1.22.0-rc.0

7 months ago

1.20.0-rc.0

8 months ago

1.21.0

7 months ago

1.23.0

6 months ago

1.24.0-rc.0

6 months ago

1.15.0

9 months ago

1.19.0

8 months ago

2.0.0-rc.0

6 months ago

1.17.0

8 months ago

1.23.0-rc.0

7 months ago

1.21.0-rc.0

8 months ago

1.22.0

7 months ago

1.20.0

8 months ago

1.24.0

6 months ago

1.16.0-rc.0

9 months ago

1.15.0-rc.0

10 months ago

1.16.0-rc.1

9 months ago

1.15.0-rc.1

9 months ago

1.17.0-rc.1

9 months ago

1.19.0-rc.0

8 months ago

1.17.0-rc.0

9 months ago

1.19.0-rc.1

8 months ago

1.18.0-rc.1

8 months ago

1.18.0-rc.0

8 months ago

1.14.0-rc.0

11 months ago

1.13.0-rc.0

11 months ago

1.12.0-rc.0

11 months ago

1.11.0

11 months ago

1.11.0-rc.0

12 months ago

1.10.0

1 year ago

1.10.0-rc.0

1 year ago

1.9.0

1 year ago

1.9.0-rc.0

1 year ago

1.8.0

1 year ago

1.7.0-rc.0

1 year ago

1.8.0-rc.0

1 year ago

1.5.0-rc.0

1 year ago

1.6.0-rc.0

1 year ago

1.4.0

1 year ago

1.4.0-rc.0

1 year ago

1.3.0-rc.0

1 year ago

1.2.0

1 year ago

1.2.0-rc.1

1 year ago

1.2.0-rc.0

1 year ago

1.1.0-rc.0

1 year ago