Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE - Async networking #67

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7acf7dc
get changes from networking branch and use dev branch as base so all …
Apr 13, 2023
bd7d44b
make GitHub workflows work with dev branch instead of develop
May 28, 2023
5d777c7
refactor websocket client
Jun 30, 2023
6406bbc
refactor integration websocket client test
Jun 30, 2023
b60613e
fix tests
Jun 30, 2023
464e776
fix tests
Jun 30, 2023
316a122
fix cargo clippy
Jul 1, 2023
3ae950e
add code examples
Aug 3, 2023
0d7f9e9
fix model constructor to public; wallet scope public
Aug 3, 2023
e68ae4e
add changes to changelog
Aug 3, 2023
aacb322
add changes to changelog
Aug 3, 2023
f651a0f
implement new async_websocket_client
Aug 9, 2023
dc45474
tests for async_websocket_client
Aug 9, 2023
1e134c9
Add Examples
LimpidCrypto Aug 9, 2023
e556441
run tests on pull requests to the dev branch
Aug 9, 2023
b2355c5
get changes from networking branch and use dev branch as base so all …
Apr 13, 2023
0c6c450
refactor websocket client
Jun 30, 2023
412d989
refactor integration websocket client test
Jun 30, 2023
4aa4aa5
fix tests
Jun 30, 2023
e2ec599
fix tests
Jun 30, 2023
8c566e2
fix cargo clippy
Jul 1, 2023
54947d4
implement new async_websocket_client
Aug 9, 2023
6520cc1
tests for async_websocket_client
Aug 9, 2023
54aa509
Merge remote-tracking branch 'origin/async-net' into async-net
Aug 10, 2023
b7f8311
use nightly to allow unstable features
Aug 10, 2023
57ef449
remove unneeded features
Aug 10, 2023
15f3bf4
rename AsyncWebsocketClientEmbeddedWebsocketTokio -> AsyncWebsocketCl…
Aug 10, 2023
2452c68
remove client base files
Aug 10, 2023
b8d8b83
rename AsyncWebsocketClientEmbeddedWebsocketTokio -> AsyncWebsocketCl…
Aug 10, 2023
557ee65
update dependencies
Aug 10, 2023
30776d3
add dev dependencies
Aug 10, 2023
e898989
add dev dependencies
Aug 10, 2023
8cf4122
change clients export
Aug 14, 2023
1496592
change clients export
Aug 14, 2023
3ba3acb
add .DS_STORE to gitignore
Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/audit_test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
branches:
- develop
- dev
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality_test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
branches:
- develop
- dev
pull_request:
branches:
- main
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
on:
push:
branches:
- develop
- dev
pull_request:
branches:
- main
- dev

name: Unit

Expand All @@ -16,20 +17,20 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --no-default-features --features core,models
args: --release --no-default-features --features core,models,net
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features core,models
args: --no-default-features --features core,models,net
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Cargo.lock

# Additional
src/main.rs

.DS_Store
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Performance Benchmarks

## [[Unreleased]]
- Examples
- Wallet from seed
- New wallet generation
- make `new` methods of models public

## [[v0.2.0-beta]]
### Added
Expand Down
54 changes: 44 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ ed25519-dalek = "1.0.1"
secp256k1 = { version = "0.27.0", default-features = false, features = [
"alloc",
] }
bs58 = { version = "0.4.0", default-features = false, features = [
bs58 = { version = "0.5.0", default-features = false, features = [
"check",
"alloc",
] }
indexmap = { version = "1.7.0", features = ["serde"] }
indexmap = { version = "2.0.0", features = ["serde"] }
regex = { version = "1.5.4", default-features = false }
strum = { version = "0.24.1", default-features = false }
strum_macros = { version = "0.24.2", default-features = false }
strum = { version = "0.25.0", default-features = false }
strum_macros = { version = "0.25.2", default-features = false }
crypto-bigint = { version = "0.5.1" }
rust_decimal = { version = "1.17.0", default-features = false, features = [
"serde",
Expand All @@ -46,38 +46,72 @@ chrono = { version = "0.4.19", default-features = false, features = [
"clock",
] }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
rand = { version = "0.8.4", default-features = false, features = ["getrandom"] }
rand = { version = "0.8.5", default-features = false, features = ["getrandom"] }
serde = { version = "1.0.130", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.68", default-features = false, features = [
"alloc",
] }
serde_with = "2.3.1"
serde_with = "3.2.0"
serde_repr = "0.1"
zeroize = "1.5.7"
hashbrown = { version = "0.13.2", default-features = false, features = ["serde"] }
hashbrown = { version = "0.14.0", default-features = false, features = ["serde"] }
fnv = { version = "1.0.7", default-features = false }
derive-new = { version = "0.5.9", default-features = false }
thiserror-no-std = "2.0.2"
anyhow = { version ="1.0.69", default-features = false }
tokio = { version = "1.28.0", default-features = false, optional = true }
url = { version = "2.2.2", default-features = false, optional = true }
futures = { version = "0.3.28", default-features = false, optional = true }
rand_core = { version = "0.6.3", default-features = false }
tokio-tungstenite = { version = "0.20.0", optional = true }

[dependencies.embedded-websocket]
# git version needed to use `framer_async`
git = "https://github.com/ninjasource/embedded-websocket"
version = "0.9.2"
rev = "8d87d46f46fa0c75e099ca8aad37e8d00c8854f8"
default-features = false

[dev-dependencies]
criterion = "0.4.0"
xrpl-rust = { path = "." }
criterion = "0.5.1"
cargo-husky = { version = "1.5.0", default-features = false, features = [
"user-hooks",
] }
tokio = { version = "1.28.2", features = ["full"] }
tokio-util = { version = "0.7.7", features = ["codec"] }
bytes = { version = "1.4.0", default-features = false }
futures = "0.3.28"
rand = "0.8.5"

[[bench]]
name = "benchmarks"
harness = false

[features]
default = ["std", "core", "models", "utils"]
default = ["std", "core", "models", "utils", "net"]
models = ["core", "transactions", "requests", "ledger"]
transactions = ["core", "amounts", "currencies"]
requests = ["core", "amounts", "currencies"]
ledger = ["core", "amounts", "currencies"]
amounts = ["core"]
currencies = ["core"]
net = ["url", "futures"]
core = ["utils"]
utils = []
std = ["rand/std", "regex/std", "chrono/std", "rand/std_rng", "hex/std", "rust_decimal/std", "bs58/std", "serde/std", "indexmap/std", "secp256k1/std"]
std = [
"embedded-websocket/std",
"tokio-tungstenite/native-tls",
"tokio/full",
"futures/std",
"rand/std",
"regex/std",
"chrono/std",
"rand/std_rng",
"hex/std",
"rust_decimal/std",
"bs58/std",
"serde/std",
"indexmap/std",
"secp256k1/std",
]
20 changes: 20 additions & 0 deletions examples/std/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# Added by cargo
/target

# VSCode
.vscode
.idea

# Additional
src/main.rs
33 changes: 33 additions & 0 deletions examples/std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "std"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
xrpl-rust = { path = "../.." }

[[bin]]
name = "wallet_from_seed"
path = "src/bin/wallet/wallet_from_seed.rs"
required-features = [
]

[[bin]]
name = "generate_wallet"
path = "src/bin/wallet/generate_wallet.rs"
required-features = [
]

[[bin]]
name = "send_request"
path = "src/bin/tokio/net/send_request.rs"
required-features = [
]

[[bin]]
name = "send_request"
path = "src/bin/transaction/sign_transaction.rs"
required-features = [
]
4 changes: 4 additions & 0 deletions examples/std/src/bin/tokio/net/send_request.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// TODO: add as soon as `AsyncWebsocketClient` is implemented
fn main() {
todo!()
}
4 changes: 4 additions & 0 deletions examples/std/src/bin/transaction/sign_transaction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// TODO: add as soon as `sign` is implemented
fn main() {
todo!()
}
7 changes: 7 additions & 0 deletions examples/std/src/bin/wallet/generate_wallet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use xrpl::wallet::Wallet;

fn main() {
let wallet = Wallet::create(None).expect("Failed to generate new wallet");

println!("Wallet: {:?}", wallet);
}
9 changes: 9 additions & 0 deletions examples/std/src/bin/wallet/wallet_from_seed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use xrpl::wallet::Wallet;

fn main() {
let wallet = Wallet::new("sEdVWgwiHxBmFoMGJBoPZf6H1XSLLGd", 0)
.expect("Failed to create wallet from seed");

assert_eq!(wallet.classic_address, "rsAhdjbE7YXqQtubcaSwb6xHn6mU2bSFHY");
println!("Wallet: {:?}", wallet);
}
2 changes: 2 additions & 0 deletions src/_anyhow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#[macro_export]
macro_rules! Err {
($err:expr $(,)?) => {{
use alloc::string::ToString;

let error = $err.to_string().replace("\"", "");
let boxed_error = ::alloc::boxed::Box::new(error);
let leaked_error: &'static str = ::alloc::boxed::Box::leak(boxed_error);
Expand Down
2 changes: 2 additions & 0 deletions src/asynch/clients/async_json_rpc_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// /// An async client for interacting with the rippled JSON RPC.
// pub struct AsyncJsonRpcClient {}