The smart thing to do would be make the NPM that is a general purpose Trade Channel suite, include all the app functionality needed to connect two wallets:
1) Express server that listens on endpoints, design this like an API:
a) query dealers by: fidelity & volume (default), extend server API route to use SQL, SQL maintains the long-term meta-data around dealers, becomes a public API extension.
b) request dealer quote
c) initiate channel creation handshake (submit new pubkey)
d) complete channel creation handshake
e) request trade
f) relay trade string
g) relay partially signed string
h) broadcast tx (could be a generalized relay service also
Fun enough, this large app with relay callback operations is only about half of the work.
The smart thing to do would be make the NPM that is a general purpose Trade Channel suite, include all the app functionality needed to connect two wallets:
1) Express server that listens on endpoints, design this like an API:
a) query dealers by: fidelity & volume (default), extend server API route to use SQL, SQL maintains the long-term meta-data around dealers, becomes a public API extension.
b) request dealer quote
c) initiate channel creation handshake (submit new pubkey)
d) complete channel creation handshake
e) request trade
f) relay trade string
g) relay partially signed string
h) broadcast tx (could be a generalized relay service also
Fun enough, this large app with relay callback operations is only about half of the work.