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