Skip to content

Commit d816335

Browse files
authored
Merge pull request #5 from weaveVM/dev
feat: v0.1.2
2 parents 8f9dc33 + bf2e2c0 commit d816335

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bundler"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55

66
[lib]

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ WeaveVM Bundler is a data protocol specification and library that introduces the
2323
- **Bundler**: Refers to the data protocol specification of the EVM bundled transactions on WeaveVM.
2424
- **Envelope**: A legacy EVM transaction that serves as the fundamental building block and composition unit of a Bundle.
2525
- **Bundle**: An EIP-1559 transaction that groups multiple envelopes (`n > 0`), enabling efficient transaction batching and processing.
26+
- **Superbundle**: A transaction that carries multiple bundles.
2627
- **Bundler Lib**: Refers to the Bundler Rust library that facilitates composing and propagating Bundler's bundles.
2728

2829
### 1. Bundle Format
@@ -216,10 +217,15 @@ For more examples, check the tests in [lib.rs](./src/lib.rs) and have a look ove
216217

217218
- Base endpoint: https://bundler.wvm.network/
218219

219-
### Retrieve envelopes
220+
### Retrieve full envelopes data of a given bundle
220221

221222
```bash
222-
GET /v1/envelopes/:txid
223+
GET /v1/envelopes/:bundle_txid
224+
```
225+
### Retrieve envelopes ids of a given bundle
226+
227+
```bash
228+
GET /v1/envelopes/ids/:bundle_txid
223229
```
224230

225231
## Cost Efficiency: some comparisons

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::server::api::{get_envelopes_of, get_greet};
1+
use crate::utils::server::api::{get_envelopes_id_of, get_envelopes_of, get_greet};
22
use axum::{routing::get, Router};
33

44
pub mod utils;
@@ -8,7 +8,8 @@ async fn main() -> shuttle_axum::ShuttleAxum {
88
// server routes
99
let router = Router::new()
1010
.route("/", get(get_greet))
11-
.route("/v1/envelopes/:txid", get(get_envelopes_of));
11+
.route("/v1/envelopes/:bundle_txid", get(get_envelopes_of))
12+
.route("/v1/envelopes/ids/:bundle_txid", get(get_envelopes_id_of));
1213

1314
Ok(router.into())
1415
}

src/utils/server/api.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::utils::core::bundle::Bundle;
21
use crate::utils::core::bundle_data::BundleData;
2+
use crate::utils::core::{bundle::Bundle, envelope};
33
use axum::{extract::Path, response::Json};
44
use serde_json::Value;
55

@@ -11,3 +11,9 @@ pub async fn get_envelopes_of(Path(id): Path<String>) -> Json<Value> {
1111
let envelopes: BundleData = Bundle::retrieve_envelopes(id).await.unwrap();
1212
Json(serde_json::to_value(&envelopes).unwrap())
1313
}
14+
15+
pub async fn get_envelopes_id_of(Path(id): Path<String>) -> Json<Value> {
16+
let envelopes: BundleData = Bundle::retrieve_envelopes(id).await.unwrap();
17+
let envelopes_ids: Vec<String> = envelopes.envelopes.into_iter().map(|tx| tx.hash).collect();
18+
Json(serde_json::to_value(&envelopes_ids).unwrap())
19+
}

0 commit comments

Comments
 (0)