Skip to content
Permalink
Browse files

Update serde + dynamically fetch XRP credentials (#254)

* chore: update serde to 1.0.99

* docs: update repo location

* docs(run-md): run README.md if directory is provided

* test(xrp): get new testnet credentials each time

the test was failing because the testnet was reset
  • Loading branch information...
emschwartz authored and gakonst committed Aug 29, 2019
1 parent 19fbf52 commit 35a57f0bd1fab8915dc27f7471096fd70f786ecf
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "API for managing an Interledger node"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -21,13 +21,13 @@ interledger-service-util = { path = "../interledger-service-util", version = "0.
interledger-settlement = { path = "../interledger-settlement", version = "0.1.0" }
interledger-spsp = { path = "../interledger-spsp", version = "0.2.1" }
log = "0.4.6"
serde = "1.0.89"
serde = "1.0.99"
serde_json = "1.0.39"
tower-web = "0.3.7"
reqwest = "0.9.18"
url = "2.1.0"
tokio-retry = "0.2.0"

[badges]
circle-ci = { repository = "emschwartz/interledger-rs" }
codecov = { repository = "emschwartz/interledger-rs" }
circle-ci = { repository = "interledger-rs/interledger-rs" }
codecov = { repository = "interledger-rs/interledger-rs" }
@@ -1,4 +1,4 @@
# interledger-api

This crate defines HTTP endpoints for working with Interledger.
See also [the API documentation](https://github.com/emschwartz/interledger-rs/blob/master/docs/api.md).
See also [the API documentation](https://github.com/interledger-rs/interledger-rs/blob/master/docs/api.md).
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Bilateral Transfer Protocol (BTP) client and server services for Interledger.rs"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
base64 = "0.10.1"
@@ -7,4 +7,4 @@ of the Interledger Protocol stack, roughly analogous to [Ethernet](https://en.wi
BTP utilizes websockets, which makes it suitable for users who
do not have a public internet server.
Users who do not need such functionality may prefer the alternative,
simpler data link layer protocol provided by [the interledger-http crate](https://github.com/emschwartz/interledger-rs/tree/master/crates/interledger-http).
simpler data link layer protocol provided by [the interledger-http crate](https://github.com/interledger-rs/interledger-rs/tree/master/crates/interledger-http).
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Implementation of the Interledger Dynamic Configuration Protocol (ILDCP)"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -21,4 +21,4 @@ parking_lot = "0.7.1"
ring = "0.14.6"
tokio-executor = "0.1.7"
tokio-timer = "0.2.10"
serde = { version = "1.0.98", features = ["derive"] }
serde = { version = "1.0.99", features = ["derive"] }
@@ -4,4 +4,4 @@ information with peers. The `CcpRouteManager` processes Route Update and Route C
messages from accounts that we are configured to receive routes from and sends route
updates to accounts that we are configured to send updates to.

This populates the routing table implemented in [the interledger-router crate](https://github.com/emschwartz/interledger-rs/tree/master/crates/interledger-router).
This populates the routing table implemented in [the interledger-router crate](https://github.com/interledger-rs/interledger-rs/tree/master/crates/interledger-router).
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "HTTP client and server services for Interledger.rs"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Implementation of the Interledger Dynamic Configuration Protocol (ILDCP)"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -5,15 +5,15 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Interledger packet serialization/deserialization"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
byteorder = "1.3.1"
bytes = { version = "0.4.12", features = ["serde"] }
chrono = "0.4.6"
hex = "0.3.2"
quick-error = "1.2.2"
serde = { version = "1.0", features = ["derive"], optional = true }
serde = { version = "1.0.99", features = ["derive"], optional = true }
regex = "1.1.6"
lazy_static = "1.3"

@@ -22,7 +22,7 @@ criterion = "0.2.10"
lazy_static = "1.3"
# "serde" is both here and in `[dependencies]` to ensure it is included during
# testing, but optional otherwise.
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0.99", features = ["derive"] }
serde_test = "1.0"

[[bench]]
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Router for Interledger requests"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Small, commonly used Interledger services that don't really fit anywhere else"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -5,12 +5,12 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "The core abstraction for the Interledger.rs implementation"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
futures = "0.1.25"
interledger-packet = { path = "../interledger-packet", version = "0.2.1" }
serde = { version = "1.0.94", features = ["derive"] }
serde = { version = "1.0.99", features = ["derive"] }
base64 = "0.10.1"
regex = "1.2.1"
lazy_static = "1.3.0"
@@ -18,7 +18,7 @@ interledger-settlement = { path = "../interledger-settlement", version = "0.1.0"
interledger-service-util = { path = "../interledger-service-util", version = "0.2.1" }
interledger-ildcp = { path = "../interledger-ildcp", version = "0.2.1" }
ethabi = "8.0.1"
serde = "1.0.91"
serde = "1.0.99"
serde_json = "1.0.40"
json = "0.11.14"
bytes = "0.4.12"
@@ -59,19 +59,21 @@ fn eth_xrp_interoperable() {
let node3_redis_port = get_open_port(Some(6380));
let mut node2_engine_redis = RedisServer::spawn_with_port(node2_redis_port);
let mut node3_engine_redis = RedisServer::spawn_with_port(node3_redis_port);
let node2_xrp_credentials = test_helpers::get_xrp_credentials();
let mut node2_xrp_engine = start_xrp_engine(
&format!("http://localhost:{}", node2_settlement),
node2_redis_port,
node2_xrp_engine_port,
"rGCUgMH4omQV1PUuYFoMAnA7esWFhE7ZEV",
"sahVoeg97nuitefnzL9GHjp2Z6kpj",
&node2_xrp_credentials.address,
&node2_xrp_credentials.secret,
);
let node3_xrp_credentials = test_helpers::get_xrp_credentials();
let mut node3_xrp_engine = start_xrp_engine(
&format!("http://localhost:{}", node3_settlement),
node3_redis_port,
node3_xrp_engine_port,
"r3GDnYaYCk2XKzEDNYj59yMqDZ7zGih94K",
"ssnYUDNeNQrNij2EVJG6dDw258jA6",
&node3_xrp_credentials.address,
&node3_xrp_credentials.secret,
);

let node1_eth_key =
@@ -6,7 +6,8 @@ use interledger_settlement_engines::engines::ethereum_ledger::run_ethereum_engin
use interledger_store_redis::Account;
use interledger_store_redis::AccountId;
use redis::ConnectionInfo;
use serde::Serialize;
use reqwest;
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::collections::HashMap;
use std::fmt::{Debug, Display};
@@ -15,12 +16,15 @@ use std::str;
use std::thread::sleep;
use std::time::Duration;

#[derive(serde::Deserialize)]
#[allow(unused)]
static XRP_FAUCET_URL: &str = "https://faucet.altnet.rippletest.net/accounts";

#[derive(Deserialize)]
pub struct DeliveryData {
pub delivered_amount: u64,
}

#[derive(serde::Deserialize)]
#[derive(Deserialize)]
pub struct BalanceData {
pub balance: String,
}
@@ -187,3 +191,29 @@ pub fn get_balance<T: Display>(
Ok(ret.balance.parse().unwrap())
})
}

#[derive(Deserialize, Debug)]
struct FaucetResponse {
pub account: XrpCredentials,
pub balance: u64,
}

#[derive(Deserialize, Debug)]
pub struct XrpCredentials {
pub address: String,
pub secret: String,
}

#[allow(unused)]
pub fn get_xrp_credentials() -> XrpCredentials {
// TODO make this async
let client = reqwest::Client::new();
let mut res = client
.post(XRP_FAUCET_URL)
.send()
.expect("Unable to get new XRP testnet credentials");
let body: FaucetResponse = res
.json()
.expect("Got unexpected response from XRP testnet faucet");
body.account
}
@@ -54,19 +54,21 @@ fn xrp_ledger_settlement() {
let bob_redis_port = get_open_port(Some(6380));
let mut alice_engine_redis = RedisServer::spawn_with_port(alice_redis_port);
let mut bob_engine_redis = RedisServer::spawn_with_port(bob_redis_port);
let alice_xrp_credentials = test_helpers::get_xrp_credentials();
let mut engine_alice = start_xrp_engine(
"http://localhost:3011",
alice_redis_port,
node1_engine,
"rGCUgMH4omQV1PUuYFoMAnA7esWFhE7ZEV",
"sahVoeg97nuitefnzL9GHjp2Z6kpj",
&alice_xrp_credentials.address,
&alice_xrp_credentials.secret,
);
let bob_xrp_credentials = test_helpers::get_xrp_credentials();
let mut engine_bob = start_xrp_engine(
"http://localhost:3021",
bob_redis_port,
node2_engine,
"r3GDnYaYCk2XKzEDNYj59yMqDZ7zGih94K",
"ssnYUDNeNQrNij2EVJG6dDw258jA6",
&bob_xrp_credentials.address,
&bob_xrp_credentials.secret,
);

let mut runtime = RuntimeBuilder::new()
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Settlement-related components for Interledger.rs"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -16,7 +16,7 @@ interledger-service = { path = "../interledger-service", version = "0.2.1" }
interledger-ildcp = { path = "../interledger-ildcp", version = "0.2.1" }
log = "0.4.6"
reqwest = "0.9.17"
serde = "1.0.91"
serde = "1.0.99"
serde_json = "1.0.39"
tower-web = "0.3.7"
url = "2.1.0"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Client and server implementations of the Simple Payment Setup Protocol (SPSP)"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
base64 = "0.10.1"
@@ -19,6 +19,6 @@ interledger-service = { path = "../interledger-service", version = "0.2.1" }
interledger-stream = { path = "../interledger-stream", version = "0.2.1" }
log = "0.4.6"
reqwest = "0.9.11"
serde = "1.0.89"
serde = "1.0.99"
serde_derive = "1.0.89"
serde_json = "1.0.39"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "In-memory data store for Interledger.rs"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[dependencies]
bytes = "0.4.12"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Data store for Interledger.js using Redis"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[lib]
name = "interledger_store_redis"
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Client and server implementations of the STREAM transport protocol"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

# Optional feature to log connection statistics using a CSV file
[features]
@@ -5,7 +5,7 @@ authors = ["Evan Schwartz <evan@ripple.com>"]
description = "Interledger client library"
license = "Apache-2.0"
edition = "2018"
repository = "https://github.com/emschwartz/interledger-rs"
repository = "https://github.com/interledger-rs/interledger-rs"

[lib]
name = "interledger"
@@ -60,7 +60,7 @@ interledger-store-redis = { path = "../interledger-store-redis", version = "0.2.
log = "0.4.6"
parking_lot = "0.7.1"
ring = "0.14.6"
serde = "1.0.89"
serde = "1.0.99"
tokio = "0.1.20"
url = "2.1.0"
lazy_static = "1.3.0"
@@ -73,5 +73,5 @@ reqwest = "0.9.16"
serde_json = "1.0.39"

[badges]
circle-ci = { repository = "emschwartz/interledger-rs" }
codecov = { repository = "emschwartz/interledger-rs" }
circle-ci = { repository = "interledger-rs/interledger-rs" }
codecov = { repository = "interledger-rs/interledger-rs" }
@@ -10,9 +10,12 @@
# This is largely intended for commands that make the output more readable

{
# if the first argument is given, it is considered as a file input
if [ -n $1 ]; then
# if the first argument is a file, run it
if [ -f $1 ]; then
cat $1
elif [ -d $1 ]; then
# if the argument is a directory, run the README.md file in it
cat $1/README.md
else
cat -
fi

0 comments on commit 35a57f0

Please sign in to comment.
You can’t perform that action at this time.