| 1888 | } |
| 1889 | |
| 1890 | static const char *init(struct command *init_cmd, |
| 1891 | const char *buf UNUSED, |
| 1892 | const jsmntok_t *config UNUSED) |
| 1893 | { |
| 1894 | struct offers_data *od = get_offers_data(init_cmd->plugin); |
| 1895 | |
| 1896 | rpc_scan(init_cmd, "getinfo", |
| 1897 | take(json_out_obj(NULL, NULL, NULL)), |
| 1898 | "{id:%}", JSON_SCAN(json_to_pubkey, &od->id)); |
| 1899 | |
| 1900 | rpc_scan(init_cmd, "getchaininfo", |
| 1901 | take(json_out_obj(NULL, "last_height", NULL)), |
| 1902 | "{headercount:%}", JSON_SCAN(json_to_u32, &od->blockheight)); |
| 1903 | |
| 1904 | rpc_scan(init_cmd, "listconfigs", |
| 1905 | take(json_out_obj(NULL, NULL, NULL)), |
| 1906 | "{configs:" |
| 1907 | "{cltv-final:{value_int:%}," |
| 1908 | "payment-fronting-node?:{values_str:%}}}", |
| 1909 | JSON_SCAN(json_to_u16, &od->cltv_final), |
| 1910 | JSON_SCAN_TAL(od, json_to_pubkeys, &od->fronting_nodes)); |
| 1911 | /* Keep it simple if no fronting nodes */ |
| 1912 | if (tal_count(od->fronting_nodes) == 0) |
| 1913 | od->fronting_nodes = tal_free(od->fronting_nodes); |
| 1914 | |
| 1915 | rpc_scan(init_cmd, "makesecret", |
| 1916 | take(json_out_obj(NULL, "string", BOLT12_ID_BASE_STRING)), |
| 1917 | "{secret:%}", |
| 1918 | JSON_SCAN(json_to_secret, &od->invoicesecret_base)); |
| 1919 | |
| 1920 | rpc_scan(init_cmd, "makesecret", |
| 1921 | take(json_out_obj(NULL, "string", "offer-blinded-path")), |
| 1922 | "{secret:%}", |
| 1923 | JSON_SCAN(json_to_secret, &od->offerblinding_base)); |
| 1924 | |
| 1925 | rpc_scan(init_cmd, "makesecret", |
| 1926 | take(json_out_obj(NULL, "string", NODE_ALIAS_BASE_STRING)), |
| 1927 | "{secret:%}", |
| 1928 | JSON_SCAN(json_to_secret, &od->nodealias_base)); |
| 1929 | |
| 1930 | return NULL; |
| 1931 | } |
| 1932 | |
| 1933 | static const struct plugin_command commands[] = { |
| 1934 | { |
nothing calls this directly
no test coverage detected