mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
offer: allow offers in other currencies if we can convert.
This avoids a footgun where they create an offer then we can't create the invoice because they don't have a converter plugin. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
2de467274e
commit
9681d491df
18
tests/plugins/currencyUSDAUD5000.py
Executable file
18
tests/plugins/currencyUSDAUD5000.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
This plugin is used to test the currency command
|
||||
"""
|
||||
from pyln.client import Plugin, Millisatoshi
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.method("currencyconvert")
|
||||
def currencyconvert(plugin, amount, currency):
|
||||
"""Converts currency using given APIs."""
|
||||
if currency in ('USD', 'AUD'):
|
||||
return {"msat": Millisatoshi(round(amount * 5000))}
|
||||
raise Exception("No values available for currency {}".format(currency.upper()))
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user