mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
common: json_to_msat and json_to_sat helpers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <bitcoin/pubkey.h>
|
||||
#include <bitcoin/short_channel_id.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/json_helpers.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -38,6 +39,19 @@ bool json_to_pubkey(const char *buffer, const jsmntok_t *tok,
|
||||
tok->end - tok->start, pubkey);
|
||||
}
|
||||
|
||||
bool json_to_msat(const char *buffer, const jsmntok_t *tok,
|
||||
struct amount_msat *msat)
|
||||
{
|
||||
return parse_amount_msat(msat,
|
||||
buffer + tok->start, tok->end - tok->start);
|
||||
}
|
||||
|
||||
bool json_to_sat(const char *buffer, const jsmntok_t *tok,
|
||||
struct amount_sat *sat)
|
||||
{
|
||||
return parse_amount_sat(sat, buffer + tok->start, tok->end - tok->start);
|
||||
}
|
||||
|
||||
bool json_to_short_channel_id(const char *buffer, const jsmntok_t *tok,
|
||||
struct short_channel_id *scid,
|
||||
bool may_be_deprecated_form)
|
||||
|
||||
Reference in New Issue
Block a user