adrienemery / lnd-grpc-client

A python grpc client/async client for LND ⚡⚡⚡
MIT License
34 stars 20 forks source link

How to make a payment with many parameters #29

Open kornpow opened 3 years ago

kornpow commented 3 years ago

I am confused by the send_payment method, I am trying to use it similarly to other methods, but it says the argument does not exist.

>>> lnd.send_payment(
...     mypk,
...     outgoing_chan_ids=[112342341234],
...     last_hop_pubkey=base64.b64encode(getChannelRemotePK("22446688101010").encode("UTF-8")),
...     amt=12345,
...     payment_request=pr,
...     timeout_seconds=60,
...     fee_limit_msat=10000,
...     allow_self_payment=True,
...     max_parts=1,
...     no_inflight_updates=True,
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/skorn/Documents/env/lib/python3.8/site-packages/lndgrpc/errors.py", line 19, in wrapper
    return fnc(*args, **kwargs)
TypeError: send_payment() got an unexpected keyword argument 'outgoing_chan_ids'

>>> lnd.send_payment(
...     mypk,
...     outgoing_chan_id=112342341234,
...     last_hop_pubkey=base64.b64encode(getChannelRemotePK("22446688101010").encode("UTF-8")),
...     amt=12345,
...     payment_request=pr,
...     timeout_seconds=60,
...     fee_limit_msat=10000,
...     allow_self_payment=True,
...     max_parts=1,
...     no_inflight_updates=True,
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/skorn/Documents/env/lib/python3.8/site-packages/lndgrpc/errors.py", line 19, in wrapper
    return fnc(*args, **kwargs)
TypeError: send_payment() got an unexpected keyword argument 'outgoing_chan_id'

>>> lnd.send_payment(
...     dest=mypk,
...     outgoing_chan_id=112342341234,
...     last_hop_pubkey=base64.b64encode(getChannelRemotePK("22446688101010").encode("UTF-8")),
...     amt=12345,
...     payment_request=pr,
...     timeout_seconds=60,
...     fee_limit_msat=10000,
...     allow_self_payment=True,
...     max_parts=1,
...     no_inflight_updates=True,
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/skorn/Documents/env/lib/python3.8/site-packages/lndgrpc/errors.py", line 19, in wrapper
    return fnc(*args, **kwargs)
TypeError: send_payment() got an unexpected keyword argument 'dest'

Any idea what am I doing wrong, I am trying to do a circular rebalance?

Do you know if this is using paymentV1 or PaymentV2?

alexander-koval commented 3 years ago

Hello. I have the same problem. I'm trying to set a fee limit and do not understand how to do it? Does any one now?

alexander-koval commented 3 years ago

So. You don't should use method directly. You should construct SendRequest by yourself.

limit = ln.FeeLimit(fixed=<amount_msat>)
request = ln.SendRequest(payment_request=<pay_req>, fee_limit=limit)
resp = self.rpc._ln_stub.SendPaymentSync(request)
kornpow commented 3 years ago

If you want, you can make a PR to my fork, Ive been doing regular commits, and would like to hide away some of that complexity. https://github.com/sako0938/lnd-grpc-client