| 2263 | } |
| 2264 | |
| 2265 | static struct command_result * |
| 2266 | bip353_fetched(struct command *cmd, |
| 2267 | const char *method, |
| 2268 | const char *buf, |
| 2269 | const jsmntok_t *result, |
| 2270 | struct xpay_params *xparams) |
| 2271 | { |
| 2272 | const jsmntok_t *instructions, *t, *offertok; |
| 2273 | const char *offerstr; |
| 2274 | struct command_result *ret; |
| 2275 | size_t i; |
| 2276 | |
| 2277 | instructions = json_get_member(buf, result, "instructions"); |
| 2278 | json_for_each_arr(i, t, instructions) { |
| 2279 | offertok = json_get_member(buf, t, "offer"); |
| 2280 | if (offertok) |
| 2281 | break; |
| 2282 | } |
| 2283 | |
| 2284 | if (!offertok) |
| 2285 | return command_fail(cmd, PAY_UNSPECIFIED_ERROR, |
| 2286 | "BIP353 response did not contain an offer (%.*s)", |
| 2287 | json_tok_full_len(result), |
| 2288 | json_tok_full(buf, result)); |
| 2289 | offerstr = json_strdup(tmpctx, buf, offertok); |
| 2290 | |
| 2291 | if (xparams->includefees_msat) |
| 2292 | ret = check_offer_sendamount_payable(cmd, offerstr); |
| 2293 | else |
| 2294 | ret = check_offer_payable(cmd, offerstr, xparams->msat); |
| 2295 | |
| 2296 | if (ret) |
| 2297 | return ret; |
| 2298 | |
| 2299 | return do_fetchinvoice(cmd, offerstr, xparams); |
| 2300 | } |
| 2301 | |
| 2302 | static struct command_result *json_xpay_params(struct command *cmd, |
| 2303 | const char *buffer, |
nothing calls this directly
no test coverage detected