interledger-rs icon indicating copy to clipboard operation
interledger-rs copied to clipboard

ilp-cli testnet setup command error

Open omertoast opened this issue 3 years ago • 4 comments

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.

  • https://github.com/omrtozd/interledger-rs/blob/0fcaf5d0a9b34d52bde08250a5f52f5398f6c7ab/crates/ilp-cli/src/interpreter.rs#L326-L335

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.

  • XpringResponse Struct: https://github.com/omrtozd/interledger-rs/blob/0fcaf5d0a9b34d52bde08250a5f52f5398f6c7ab/crates/ilp-cli/src/interpreter.rs#L394-L403

  • Example response:

"accountId": "user_w0vzjgqc",
"accountRelationship": "CHILD",
"assetCode": "XRP",
"assetScale": 9,
"maximumPacketAmount": null,
"linkType": {},
"connectionInitiator": true,
"isInternal": false,
"sendRoutes": true,
"receiveRoutes": false,
"balanceSettings": {
    "minBalance": null,
    "settleThreshold": null,
    "settleTo": 0
},
"rateLimitSettings": {
    "maxPacketsPerSecond": null
},
"settlementEngineDetails": null,
"customSettings": {
    "ilpOverHttp.outgoing.url": "https://rxprod.wc.wallet.ripplex.io./ilp",
    "ilpOverHttp.incoming.auth_type": "SIMPLE",
    "ilpOverHttp.incoming.simple.auth_token": "ygV47wq8mvI0b",
    "ilpOverHttp.outgoing.simple.auth_token": "enc:gcpkms:connector:secret0:1:gs:CiQAxw4QhykCtBPYDxd7n91yo3FGmiIGbDQE8bN1c6Ft_4tYvRUSWACjdIaO5ZBq-W9sN7OiSr3o9Hb8uQBv68QTmd61EMCXMHuEa6uxrJZNM2ZHwkvhMEPgBfTH13EGUGkeSQfLMVlp9ZXyluiP-m0t1OJbDfUAE4qv0LBIhRY=",
    "ilpOverHttp.outgoing.auth_type": "SIMPLE"
},
"parentAccount": false,
"childAccount": true,
"peerAccount": false,
"peerOrParentAccount": false,
"paymentPointer": "$rxprod.wc.wallet.ripplex.io./user_w0vzjgqc"

omertoast avatar May 26 '21 09:05 omertoast

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.

sappenin avatar Jun 01 '21 22:06 sappenin

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

omertoast avatar Jun 01 '21 22:06 omertoast

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).

sappenin avatar Jul 02 '21 19:07 sappenin

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

onaks3 avatar Mar 05 '23 00:03 onaks3