@@ -95,28 +95,6 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
9595 method = " address" ;
9696 params[" hash" ] = hash;
9797 }
98- else if (target == " inputs" )
99- {
100- if (segment == segments.size ())
101- return error::missing_hash;
102-
103- const auto hash = to_hash (segments[segment++]);
104- if (!hash) return error::invalid_hash;
105-
106- method = " inputs" ;
107- params[" hash" ] = hash;
108- }
109- else if (target == " outputs" )
110- {
111- if (segment == segments.size ())
112- return error::missing_hash;
113-
114- const auto hash = to_hash (segments[segment++]);
115- if (!hash) return error::invalid_hash;
116-
117- method = " outputs" ;
118- params[" hash" ] = hash;
119- }
12098 else if (target == " input" )
12199 {
122100 if (segment == segments.size ())
@@ -126,28 +104,32 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
126104 if (!hash) return error::invalid_hash;
127105
128106 params[" hash" ] = hash;
129- if (segment == segments.size ())
130- return error::missing_component;
131-
132- const auto component = segments[segment++];
133- uint32_t index{};
134- if (!to_number (index, component))
135- return error::invalid_number;
136-
137- params[" index" ] = index;
138107 if (segment == segments.size ())
139108 {
140- method = " input " ;
109+ method = " inputs " ;
141110 }
142111 else
143112 {
144- const auto subcomponent = segments[segment++];
145- if (subcomponent == " script" )
146- method = " input_script" ;
147- else if (subcomponent == " witness" )
148- method = " input_witness" ;
113+ const auto component = segments[segment++];
114+ uint32_t index{};
115+ if (!to_number (index, component))
116+ return error::invalid_number;
117+
118+ params[" index" ] = index;
119+ if (segment == segments.size ())
120+ {
121+ method = " input" ;
122+ }
149123 else
150- return error::invalid_subcomponent;
124+ {
125+ const auto subcomponent = segments[segment++];
126+ if (subcomponent == " script" )
127+ method = " input_script" ;
128+ else if (subcomponent == " witness" )
129+ method = " input_witness" ;
130+ else
131+ return error::invalid_subcomponent;
132+ }
151133 }
152134 }
153135 else if (target == " output" )
@@ -159,33 +141,37 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
159141 if (!hash) return error::invalid_hash;
160142
161143 params[" hash" ] = hash;
162- if (segment == segments.size ())
163- return error::missing_component;
164-
165- const auto component = segments[segment++];
166- uint32_t index{};
167- if (!to_number (index, component))
168- return error::invalid_number;
169-
170- params[" index" ] = index;
171144 if (segment == segments.size ())
172145 {
173- method = " output " ;
146+ method = " outputs " ;
174147 }
175148 else
176149 {
177- const auto subcomponent = segments[segment++];
178- if (subcomponent == " script" )
179- method = " output_script" ;
180- else if (subcomponent == " spender" )
181- method = " output_spender" ;
182- else if (subcomponent == " spenders" )
183- method = " output_spenders" ;
150+ const auto component = segments[segment++];
151+ uint32_t index{};
152+ if (!to_number (index, component))
153+ return error::invalid_number;
154+
155+ params[" index" ] = index;
156+ if (segment == segments.size ())
157+ {
158+ method = " output" ;
159+ }
184160 else
185- return error::invalid_subcomponent;
161+ {
162+ const auto subcomponent = segments[segment++];
163+ if (subcomponent == " script" )
164+ method = " output_script" ;
165+ else if (subcomponent == " spender" )
166+ method = " output_spender" ;
167+ else if (subcomponent == " spenders" )
168+ method = " output_spenders" ;
169+ else
170+ return error::invalid_subcomponent;
171+ }
186172 }
187173 }
188- else if (target == " transaction " )
174+ else if (target == " tx " )
189175 {
190176 if (segment == segments.size ())
191177 return error::missing_hash;
@@ -196,13 +182,15 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
196182 params[" hash" ] = hash;
197183 if (segment == segments.size ())
198184 {
199- method = " transaction " ;
185+ method = " tx " ;
200186 }
201187 else
202188 {
203189 const auto component = segments[segment++];
204190 if (component == " block" )
205191 method = " tx_block" ;
192+ else if (component == " fee" )
193+ method = " tx_fee" ;
206194 else
207195 return error::invalid_component;
208196 }
@@ -221,8 +209,6 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
221209 const auto hash = to_hash (segments[segment++]);
222210 if (!hash) return error::invalid_hash;
223211
224- // nullables can be implicit.
225- // //params["height"] = null_t{};
226212 params[" hash" ] = hash;
227213 }
228214 else if (by == " height" )
@@ -234,8 +220,6 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
234220 if (!to_number (height, segments[segment++]))
235221 return error::invalid_number;
236222
237- // nullables can be implicit.
238- // //params["hash"] = null_t{};
239223 params[" height" ] = height;
240224 }
241225 else
@@ -250,7 +234,7 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
250234 else
251235 {
252236 const auto component = segments[segment++];
253- if (component == " transaction " )
237+ if (component == " tx " )
254238 {
255239 if (segment == segments.size ())
256240 return error::missing_position;
@@ -263,9 +247,11 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
263247 method = " block_tx" ;
264248 }
265249 else if (component == " header" )
266- method = " header " ;
267- else if (component == " transactions " )
250+ method = " block_header " ;
251+ else if (component == " txs " )
268252 method = " block_txs" ;
253+ else if (component == " fees" )
254+ method = " block_fees" ;
269255 else if (component == " filter" )
270256 {
271257 if (segment == segments.size ())
@@ -278,15 +264,15 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
278264 params[" type" ] = type;
279265 if (segment == segments.size ())
280266 {
281- method = " filter " ;
267+ method = " block_filter " ;
282268 }
283269 else
284270 {
285271 const auto subcomponent = segments[segment++];
286272 if (subcomponent == " hash" )
287- method = " filter_hash " ;
273+ method = " block_filter_hash " ;
288274 else if (subcomponent == " header" )
289- method = " filter_header " ;
275+ method = " block_filter_header " ;
290276 else
291277 return error::invalid_subcomponent;
292278 }
0 commit comments