machinomy / machinomy

Node.js library for micropayments in Ether and ERC20 tokens over HTTP

Home Page:http://machinomy.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add method to preemptively open payment channel

emschwartz opened this issue · comments

For my use case I'd like to ensure that a payment channel is opened to the receiver when the sender starts up (and I can get the receiver's address before I actually want to load content from them). It would be nice if there were an easy way to open a payment channel without actually paying the receiver.

There is a (hacky) way for doing this:

  1. Instantiate Machinomy object, setting minimumChannelAmount to an expected channel amount (https://github.com/machinomy/machinomy/blob/master/index.ts#L48 and https://github.com/machinomy/machinomy/blob/master/index.ts#L109).
  2. Do machinomy.buy with price set to 0. (https://github.com/machinomy/machinomy/blob/master/index.ts#L21)

Would that fit the case?

Yup, that worked. Thanks!

Yay! Cool.