@@ -1075,40 +1075,62 @@ namespace hive { namespace protocol {
10751075 */
10761076 struct recurrent_transfer_operation : public base_operation
10771077 {
1078- struct recurrent_transfer_extension_visitor
1079- {
1080- uint8_t pair_id = 0 ; // default recurrent transfer id is 0
1081- bool was_pair_id = false ;
1078+ private:
1079+ struct recurrent_transfer_extension_visitor
1080+ {
1081+ uint8_t pair_id = 0 ; // default recurrent transfer id is 0
1082+ bool was_pair_id = false ;
10821083
1083- typedef void result_type;
1084+ typedef void result_type;
10841085
1085- void operator ()( const recurrent_transfer_pair_id& recurrent_transfer_pair_id )
1086- {
1087- was_pair_id = true ;
1088- pair_id = recurrent_transfer_pair_id.pair_id ;
1089- }
1086+ void operator ()( const recurrent_transfer_pair_id& recurrent_transfer_pair_id )
1087+ {
1088+ was_pair_id = true ;
1089+ pair_id = recurrent_transfer_pair_id.pair_id ;
1090+ }
10901091
1091- void operator ()( const hive::void_t & ) {}
1092- };
1092+ void operator ()( const hive::void_t & ) {}
1093+ };
10931094
1094- account_name_type from;
1095- // / Account to transfer asset to
1096- account_name_type to;
1097- // / The amount of asset to transfer from @ref from to @ref to
1098- asset amount;
1095+ public:
10991096
1100- string memo;
1101- // / How often will the payment be triggered, unit: hours
1102- uint16_t recurrence = 0 ;
1097+ account_name_type from;
1098+ // / Account to transfer asset to
1099+ account_name_type to;
1100+ // / The amount of asset to transfer from @ref from to @ref to
1101+ asset amount;
11031102
1104- // How many times the recurrent payment will be executed
1105- uint16_t executions = 0 ;
1103+ string memo;
1104+ // / How often will the payment be triggered, unit: hours
1105+ uint16_t recurrence = 0 ;
11061106
1107- // / Extensions, only recurrent_transfer_pair_id is supported so far
1108- recurrent_transfer_extensions_type extensions ;
1107+ // How many times the recurrent payment will be executed
1108+ uint16_t executions = 0 ;
11091109
1110- void validate ()const ;
1111- void get_required_active_authorities ( flat_set<account_name_type>& a )const { a.insert (from); }
1110+ // / Extensions, only recurrent_transfer_pair_id is supported so far
1111+ recurrent_transfer_extensions_type extensions;
1112+
1113+ void validate ()const ;
1114+ void get_required_active_authorities ( flat_set<account_name_type>& a )const { a.insert (from); }
1115+
1116+ // / Returns pair id specific to given operation. explicitValue if not null will be set to true if pair_id was explicitly specified in the operation.
1117+ uint8_t get_pair_id ( const recurrent_transfer_extensions_type& _extensions, bool * explicitValue = nullptr ) const
1118+ {
1119+ recurrent_transfer_extension_visitor _vtor;
1120+
1121+ for ( const auto & e : _extensions )
1122+ e.visit ( _vtor );
1123+
1124+ if ( explicitValue )
1125+ *explicitValue = _vtor.was_pair_id ;
1126+
1127+ return _vtor.pair_id ;
1128+ }
1129+
1130+ uint8_t get_pair_id ( bool * explicitValue = nullptr ) const
1131+ {
1132+ return get_pair_id ( extensions, explicitValue );
1133+ }
11121134 };
11131135
11141136 struct witness_block_approve_operation : public base_operation
0 commit comments