5.0.0 • Published 2 months ago

web3-stream-provider v5.0.0

Weekly downloads
416
License
ISC
Repository
github
Last release
2 months ago

web3-stream-provider

Utility for creating an Ethereum web3 provider that forwards payloads through a stream. Only works for async payloads.

For connecting to a remote eth rpc handler

const StreamProvider = require('web3-stream-provider')

var streamProvider = new StreamProvider()
var web3 = new Web3(streamProvider)

streamProvider.pipe(remoteRpcHandler).pipe(streamProvider)

For handling incoming rpc payloads

const handleRequestsFromStream = require('web3-stream-provider/handler')

handleRequestsFromStream(remoteStream, provider, /* optional */ onRequest, onResponse)

function onRequest(request){
  // can modify the request if needed
  console.log(arguments)
}

function onResponse(err, request, response){
  console.log(arguments)
}
5.0.0

2 months ago

4.0.1

6 months ago

4.0.0

5 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago