diff --git a/Cargo.lock b/Cargo.lock index 89433fb12..dec19fef9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -996,6 +996,7 @@ dependencies = [ "interledger-http", "interledger-ildcp", "interledger-packet", + "interledger-rates", "interledger-router", "interledger-service", "interledger-service-util", @@ -1020,6 +1021,7 @@ dependencies = [ "interledger-http", "interledger-ildcp", "interledger-packet", + "interledger-rates", "interledger-router", "interledger-service", "interledger-service-util", @@ -1166,6 +1168,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "interledger-rates" +version = "0.4.0" +dependencies = [ + "async-trait", + "futures 0.3.3", + "interledger-errors", + "log 0.4.8", + "once_cell", + "reqwest", + "secrecy", + "serde", + "tokio 0.2.11", +] + [[package]] name = "interledger-router" version = "0.4.0" @@ -1212,6 +1229,7 @@ dependencies = [ "hex", "interledger-errors", "interledger-packet", + "interledger-rates", "interledger-service", "interledger-settlement", "log 0.4.8", @@ -1271,6 +1289,7 @@ dependencies = [ "futures 0.3.4", "hyper 0.13.2", "interledger-packet", + "interledger-rates", "interledger-service", "interledger-stream", "log 0.4.8", @@ -1296,6 +1315,7 @@ dependencies = [ "interledger-errors", "interledger-http", "interledger-packet", + "interledger-rates", "interledger-router", "interledger-service", "interledger-service-util", @@ -1333,11 +1353,13 @@ dependencies = [ "futures 0.3.4", "hex", "interledger-errors", - "interledger-ildcp", "interledger-packet", + "interledger-rates", "interledger-router", "interledger-service", + "interledger-service-util", "log 0.4.8", + "num", "once_cell", "parking_lot 0.10.0", "pin-project", @@ -1672,6 +1694,20 @@ dependencies = [ "version_check 0.1.5", ] +[[package]] +name = "num" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.2.6" @@ -1683,6 +1719,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg 1.0.0", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.42" @@ -1693,6 +1739,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00" +dependencies = [ + "autocfg 1.0.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3" +dependencies = [ + "autocfg 1.0.0", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.11" diff --git a/Cargo.toml b/Cargo.toml index 4dd5cbfab..f17baed37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "./crates/interledger-ildcp", "./crates/interledger-packet", "./crates/interledger-router", + "./crates/interledger-rates", "./crates/interledger-service", "./crates/interledger-service-util", "./crates/interledger-settlement", diff --git a/crates/ilp-node/src/node.rs b/crates/ilp-node/src/node.rs index f836fd951..5ec3c6990 100644 --- a/crates/ilp-node/src/node.rs +++ b/crates/ilp-node/src/node.rs @@ -38,15 +38,15 @@ use interledger::{ ildcp::IldcpService, packet::Address, packet::{ErrorCode, RejectBuilder}, + rates::{ExchangeRateFetcher, ExchangeRateStore}, router::{Router, RouterStore}, service::{ outgoing_service_fn, Account as AccountTrait, AccountStore, AddressStore, OutgoingRequest, Username, }, service_util::{ - BalanceStore, EchoService, ExchangeRateFetcher, ExchangeRateService, ExchangeRateStore, - ExpiryShortenerService, MaxPacketAmountService, RateLimitService, RateLimitStore, - ValidatorService, + BalanceStore, EchoService, ExchangeRateService, ExpiryShortenerService, + MaxPacketAmountService, RateLimitService, RateLimitStore, ValidatorService, }, settlement::{ api::{create_settlements_filter, SettlementMessageService}, @@ -74,7 +74,7 @@ use crate::redis_store::*; use interledger::service_util::BalanceService; #[doc(hidden)] -pub use interledger::service_util::ExchangeRateProvider; +pub use interledger::rates::ExchangeRateProvider; static DEFAULT_ILP_ADDRESS: Lazy
= Lazy::new(|| Address::from_str("local.host").unwrap()); @@ -474,7 +474,7 @@ impl InterledgerNode { bytes05::Bytes::copy_from_slice(secret_seed.as_ref()), admin_auth_token, store.clone(), - incoming_service_api.clone(), + incoming_service_api, outgoing_service.clone(), btp.clone(), // btp client service! ); diff --git a/crates/ilp-node/tests/redis/test_helpers.rs b/crates/ilp-node/tests/redis/test_helpers.rs index aea1407c9..d2d594cb4 100644 --- a/crates/ilp-node/tests/redis/test_helpers.rs +++ b/crates/ilp-node/tests/redis/test_helpers.rs @@ -85,6 +85,7 @@ pub async fn send_money_to_username