MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_add_payer_proof

Function json_add_payer_proof

plugins/offers.c:1504–1611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1502}
1503
1504static void json_add_payer_proof(struct json_stream *js,
1505 const struct tlv_payer_proof *proof)
1506{
1507 /* Selectively-disclosed offer fields */
1508 if (proof->offer_chains)
1509 json_add_chains(js, "offer_chains", proof->offer_chains);
1510 if (proof->offer_metadata)
1511 json_add_hex_talarr(js, "offer_metadata", proof->offer_metadata);
1512 if (proof->offer_currency) {
1513 const struct iso4217_name_and_divisor *iso4217;
1514 json_add_utf8(js, "offer_currency", proof->offer_currency);
1515 if (proof->offer_amount)
1516 json_add_u64(js, "offer_amount", *proof->offer_amount);
1517 iso4217 = find_iso4217(proof->offer_currency,
1518 tal_bytelen(proof->offer_currency));
1519 if (iso4217)
1520 json_add_num(js, "currency_minor_unit", iso4217->minor_unit);
1521 } else if (proof->offer_amount)
1522 json_add_amount_msat(js, "offer_amount_msat",
1523 amount_msat(*proof->offer_amount));
1524 if (proof->offer_description)
1525 json_add_utf8(js, "offer_description", proof->offer_description);
1526 if (proof->offer_features)
1527 json_add_hex_talarr(js, "offer_features", proof->offer_features);
1528 if (proof->offer_absolute_expiry)
1529 json_add_u64(js, "offer_absolute_expiry",
1530 *proof->offer_absolute_expiry);
1531 if (proof->offer_paths)
1532 json_add_blinded_paths(NULL, js, "offer_paths",
1533 proof->offer_paths, NULL);
1534 if (proof->offer_issuer)
1535 json_add_utf8(js, "offer_issuer", proof->offer_issuer);
1536 if (proof->offer_quantity_max)
1537 json_add_u64(js, "offer_quantity_max", *proof->offer_quantity_max);
1538 if (proof->offer_issuer_id)
1539 json_add_pubkey(js, "offer_issuer_id", proof->offer_issuer_id);
1540
1541 /* Selectively-disclosed invreq fields */
1542 if (proof->invreq_chain)
1543 json_add_sha256(js, "invreq_chain",
1544 &proof->invreq_chain->shad.sha);
1545 if (proof->invreq_amount)
1546 json_add_amount_msat(js, "invreq_amount_msat",
1547 amount_msat(*proof->invreq_amount));
1548 if (proof->invreq_features)
1549 json_add_hex_talarr(js, "invreq_features",
1550 proof->invreq_features);
1551 if (proof->invreq_quantity)
1552 json_add_u64(js, "invreq_quantity", *proof->invreq_quantity);
1553 if (proof->invreq_payer_id)
1554 json_add_pubkey(js, "invreq_payer_id", proof->invreq_payer_id);
1555 if (proof->invreq_payer_note)
1556 json_add_utf8(js, "invreq_payer_note", proof->invreq_payer_note);
1557 if (proof->invreq_paths)
1558 json_add_blinded_paths(NULL, js, "invreq_paths",
1559 proof->invreq_paths, NULL);
1560 if (proof->invreq_bip_353_name) {
1561 json_object_start(js, "invreq_bip_353_name");

Callers 1

json_decodeFunction · 0.85

Calls 15

json_add_chainsFunction · 0.85
json_add_hex_talarrFunction · 0.85
json_add_utf8Function · 0.85
json_add_u64Function · 0.85
find_iso4217Function · 0.85
tal_bytelenFunction · 0.85
json_add_numFunction · 0.85
json_add_amount_msatFunction · 0.85
json_add_blinded_pathsFunction · 0.85
json_add_pubkeyFunction · 0.85
json_add_sha256Function · 0.85
json_object_startFunction · 0.85

Tested by

no test coverage detected