Skip to content

Batch interface suggestion #9

@fanatid

Description

@fanatid

Now batch call look like:

rpc.batch(function() { /* add some request to rpc */ }, function() { /* request callback */ })

I think it's not good, why I must write yet one function for filling rpc.batchedCalls?

And what really important, what happened if we get an exception in first function? When we try make new request (getInfo for example), batchedCalls not be null and rpc instance will be considered that we fill batch request... so, it's broke all rpc instance!

I suggest replaced batch request by something like this:

rpc.createBatch() // create copy of rpc instance and set batchedCalls as empty array
  .getRawTransaction(txid1) // put request to batchedCalls
  .getRawTransaction(txid2) // put request to batchedCalls
  .call(function() { /* request callback */ }) // make request

I'm not sure about createBatch, call and hope somebody offer more suitable names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions