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

Function json_add_payer_proof

plugins/offers.c:1506–1613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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