interledgerjs / ilp-connector

Reference implementation of an Interledger connector.
Other
135 stars 53 forks source link

Feat: add admin info interface to accounts #460

Closed sharafian closed 6 years ago

sharafian commented 6 years ago

Right now, the kinds of things that the Moneyd GUI can view at are pretty limited. We can only see the internals of the connector.

This feature allows us to look inside of the plugin and allow it to expose additional info and admin operations. It adds two optional functions to the plugin interface.

getAdminInfo (): Promise<object>
setAdminInfo (object): Promise<object> 

It also adds two endpoints to the connector's admin API.

GET /accounts/:account_id
POST /accounts/:account_id

getAdminInfo resolves an object with information about the plugin's state. For an XRP plugin, for instance, it might return channel IDs and channel balances, along with overall XRP balance. You can get this information from the admin API. Moneyd GUI could display a nicely formatted interface for plugins it knows about, and could dump the raw JSON for plugins it doesn't recognize.

setAdminInfo allows a JSON object to be passed into the plugin, and comes back with a result. For an XRP plugin, you could use this to manually trigger a channel fund or a settlement to a child (in the case of asym-server). It would make server plugins in general a lot less opaque. Moneyd GUI could display forms and buttons for plugins it knows about, or allow users to write raw JSON to send to plugins that Moneyd GUI doesn't recognize.

This change is non-breaking, but adds fields to existing admin API responses.

codecov-io commented 6 years ago

Codecov Report

Merging #460 into master will increase coverage by 0.17%. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #460      +/-   ##
========================================
+ Coverage   74.82%    75%   +0.17%     
========================================
  Files          47     47              
  Lines        2367   2384      +17     
  Branches      387    392       +5     
========================================
+ Hits         1771   1788      +17     
  Misses        596    596
Impacted Files Coverage Δ
src/services/accounts.ts 66.07% <ø> (ø) :arrow_up:
src/services/admin-api.ts 61.83% <100%> (+5.69%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8df718d...9993764. Read the comment docs.

sharafian commented 6 years ago

Maybe postAdminInfo?

sharafian commented 6 years ago

changed to sendAdminInfo after discussion in order to be most consistent with sendData and sendMoney