File tree 3 files changed +39
-3
lines changed
3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 216
216
//!
217
217
//! Set a deposit for a Channel and depositor (the authenticated address) in the Dummy adapter.
218
218
//!
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!
220
221
//!
221
222
//! The route is handled by [`channel::channel_dummy_deposit()`].
222
223
//!
223
224
//! Request body (json): [`ChannelDummyDeposit`](crate::routes::channel::ChannelDummyDeposit)
224
225
//!
225
226
//! Response: [`SuccessResponse`](primitives::sentry::SuccessResponse)
226
227
//!
228
+ //! ##### Examples
229
+ //!
230
+ //! Request:
231
+ //!
232
+ //! ```
233
+ #![ doc = include_str ! ( "../examples/channel_dummy_deposit.rs" ) ]
234
+ //! ```
235
+ //!
227
236
//! ## Campaign
228
237
//!
229
238
//! All routes are implemented under the module [campaign].
245
254
//!
246
255
//! The route is handled by [`campaign::campaign_list()`].
247
256
//!
248
- //! Request query parameters: [`CampaignListQuery`][ primitives::sentry::campaign_list::CampaignListQuery]
257
+ //! Request query parameters: [`CampaignListQuery`]( primitives::sentry::campaign_list::CampaignListQuery)
249
258
//!
250
259
//! - `page=[integer]` (optional) default: `0`
251
260
//! - `creator=[0x....]` (optional) - address of the creator to be filtered by
255
264
//! - `leader=[0x...]` - it will return all `Campaign`s where this address is `Channel.leader`
256
265
//!
257
266
//!
258
- //! Response: [`CampaignListResponse`][ primitives::sentry::campaign_list::CampaignListResponse]
267
+ //! Response: [`CampaignListResponse`]( primitives::sentry::campaign_list::CampaignListResponse)
259
268
//!
260
269
//! ##### Examples
261
270
//!
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ pub async fn last_approved<C: Locked + 'static>(
113
113
let query = serde_qs:: from_str :: < LastApprovedQuery > ( req. uri ( ) . query ( ) . unwrap_or ( "" ) ) ?;
114
114
let validators = vec ! [ channel. leader, channel. follower] ;
115
115
let channel_id = channel. id ( ) ;
116
+
116
117
let heartbeats = if query. with_heartbeat . unwrap_or_default ( ) {
117
118
let result = try_join_all (
118
119
validators
@@ -558,6 +559,8 @@ pub async fn channel_payout<C: Locked + 'static>(
558
559
559
560
/// POST `/v5/channel/dummy-deposit` request
560
561
///
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
+ ///
561
564
/// Request body (json): [`ChannelDummyDeposit`]
562
565
///
563
566
/// Response: [`SuccessResponse`]
You can’t perform that action at this time.
0 commit comments