Skip to content

Commit 39a40a3

Browse files
committed
sentry - routes - channel dummy-deposit docs:
- sentry - examples - channel_dummy_deposit (request)
1 parent 630f898 commit 39a40a3

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use primitives::{unified_num::FromWhole, UnifiedNum};
2+
use sentry::routes::channel::ChannelDummyDeposit;
3+
use serde_json::{from_value, json};
4+
5+
fn main() {
6+
let request_json = json!({
7+
"channel": {
8+
"leader": "0x80690751969B234697e9059e04ed72195c3507fa",
9+
"follower": "0xf3f583AEC5f7C030722Fe992A5688557e1B86ef7",
10+
"guardian": "0xe061E1EB461EaBE512759aa18A201B20Fe90631D",
11+
"token": "0x2bcaf6968aec8a3b5126fbfab5fd419da6e8ad8e",
12+
"nonce": "0"
13+
},
14+
"deposit": {
15+
"total": "20000000000000"
16+
}
17+
});
18+
19+
let request: ChannelDummyDeposit = from_value(request_json).expect("Should deserialize");
20+
21+
assert_eq!(UnifiedNum::from_whole(200000.0), request.deposit.total);
22+
23+
println!("{request:#?}");
24+
}

sentry/src/routes.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,23 @@
216216
//!
217217
//! Set a deposit for a Channel and depositor (the authenticated address) in the Dummy adapter.
218218
//!
219-
//! **NOTE:** This route is available **only** when using the Dummy adapter.
219+
//! **NOTE:** This route is available **only** when using the Dummy adapter and it's not
220+
//! an official production route!
220221
//!
221222
//! The route is handled by [`channel::channel_dummy_deposit()`].
222223
//!
223224
//! Request body (json): [`ChannelDummyDeposit`](crate::routes::channel::ChannelDummyDeposit)
224225
//!
225226
//! Response: [`SuccessResponse`](primitives::sentry::SuccessResponse)
226227
//!
228+
//! ##### Examples
229+
//!
230+
//! Request:
231+
//!
232+
//! ```
233+
#![doc = include_str!("../examples/channel_dummy_deposit.rs")]
234+
//! ```
235+
//!
227236
//! ## Campaign
228237
//!
229238
//! All routes are implemented under the module [campaign].
@@ -245,7 +254,7 @@
245254
//!
246255
//! The route is handled by [`campaign::campaign_list()`].
247256
//!
248-
//! Request query parameters: [`CampaignListQuery`][primitives::sentry::campaign_list::CampaignListQuery]
257+
//! Request query parameters: [`CampaignListQuery`](primitives::sentry::campaign_list::CampaignListQuery)
249258
//!
250259
//! - `page=[integer]` (optional) default: `0`
251260
//! - `creator=[0x....]` (optional) - address of the creator to be filtered by
@@ -255,7 +264,7 @@
255264
//! - `leader=[0x...]` - it will return all `Campaign`s where this address is `Channel.leader`
256265
//!
257266
//!
258-
//! Response: [`CampaignListResponse`][primitives::sentry::campaign_list::CampaignListResponse]
267+
//! Response: [`CampaignListResponse`](primitives::sentry::campaign_list::CampaignListResponse)
259268
//!
260269
//! ##### Examples
261270
//!

sentry/src/routes/channel.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ pub async fn last_approved<C: Locked + 'static>(
113113
let query = serde_qs::from_str::<LastApprovedQuery>(req.uri().query().unwrap_or(""))?;
114114
let validators = vec![channel.leader, channel.follower];
115115
let channel_id = channel.id();
116+
116117
let heartbeats = if query.with_heartbeat.unwrap_or_default() {
117118
let result = try_join_all(
118119
validators
@@ -558,6 +559,8 @@ pub async fn channel_payout<C: Locked + 'static>(
558559

559560
/// POST `/v5/channel/dummy-deposit` request
560561
///
562+
/// Full details about the route's API and intend can be found in the [`routes`](crate::routes#post-v5channeldummy-deposit-auth-required) module
563+
///
561564
/// Request body (json): [`ChannelDummyDeposit`]
562565
///
563566
/// Response: [`SuccessResponse`]

0 commit comments

Comments
 (0)