interledger / interledger-rs

An easy-to-use, high-performance Interledger implementation written in Rust
http://interledger.rs
Other
201 stars 70 forks source link

ilp-cli testnet setup command error #725

Open omertoast opened 3 years ago

omertoast commented 3 years ago

Deprecated Xpring API had an endpoint https://xpring.io/api/accounts/<assetCode> to create accounts on Xpring's side. ilp-cli testnet setup command was using this endpoint to create an account and peer with it to connect the testnet easily.

But since Xpring rebranded as RippleX, API endpoints and responses changed with it. For now, I find out three things that need to change, in order to ilp-cli testnet setup command work.

1) API endpoint, which changed from https://xpring.io/api/accounts/<assetCode> to https://ripplex.io/portal/ilp/hermes/accounts/. Also, you should send a POST request instead of a GET request.

2) The method to change the account asset. You should send a POST request to https://ripplex.io/portal/ilp/hermes/accounts/ with a JSON payload, an object named assetCode in it to use an asset other than XRP. You can see the old method here: https://github.com/omrtozd/interledger-rs/blob/master/docs/manual-config.md#get-your-own-credentials

3) The XpringResponse struct, due to the change in the response format.

sappenin commented 3 years ago

Hi @omrtozd,

I maintain the Xpring/RippleX testnet nodes, and can help answer any questions you might have. Some notes/comments from me about what you wrote above are below.

1. API endpoint

RippleX is going to be moving our ILP Testnet over to the https://ilpv4.dev domain in the not too distant future, so I would use that URL if you're writing new code for your CLI. The endpoint should work as you indicated, but here's an updated URL:

curl --location --request POST 'https://hermes-rest.ilpv4.dev/accounts' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw ''

2. Create New Account (different currency)

The system will auto-generate a new account username if you execute the call above, so (as you discovered) if you instead want to change these details, you can do something like this instead (assuming the username isn't taken):

curl --location --request POST 'https://hermes-rest.ilpv4.dev/accounts' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
 "accountId": "test-david2",
 "assetCode": "XRP",
 "assetScale": 9
}'

3. The XpringResponse struct

Yes, the old response was coming from maybe the JS Connector. However, the Ripple Testnet is now powered by the Java Connector, with a peering relationship to rafiki, which is JS.

I think that Java, JS, and Rust each have a slightly different admin API, however, so you'll maybe instead want to make clients based upon the language implementation as opposed to any particular testnet.

Happy to answer any other questions you might have here.

omertoast commented 3 years ago

Thanks for the notes. I noticed that API doesn't return a BTP endpoint, is this intentional, or RippleX nodes don't support BTP?

sappenin commented 3 years ago

I noticed that API doesn't return a BTP endpoint, is this intentional, or RippleX nodes don't support BTP?

Yes, this is intentional. At first it was because I didn't have time to implement BTP, but in practice, ILP-over-HTTP works very well, so we haven't had a need or request to implement BTP in the Java Connector (I suspect we never will).

onaks3 commented 1 year ago

is there a way to send a curl post request to fund the wallet account