New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify invoice amount in lightning address withdrawal #501
Conversation
You would need to setup local lnd as explained here. But I can take a look at this today :) edit: Oh, I see, this uses lightning addresses ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this by sending to another SN account via its LN address on my local instance.
I've noticed that num_msat
is undefined. decodePaymentRequest
returned this for a 1 sat invoice:
app | {
app | chain_address: undefined,
app | cltv_delta: 80,
app | created_at: '2023-09-20T15:19:05.000Z',
app | description: '',
app | description_hash: '3642f0f74ffb44596b4be110fefa2ebfe5cedc209e8e376d9b41e1ad0938d3a5',
app | destination: '0229ad2b79601ca9831128a10398aa4fc8a0bcfb568bdddb5955c9259834baf7d8',
app | expires_at: '2023-09-20T15:20:05.000Z',
app | features: [
app | { bit: 9, is_known: true, is_required: false, type: 'tlv_onion' },
app | {
app | bit: 14,
app | is_known: true,
app | is_required: true,
app | type: 'payment_identifier'
app | },
app | {
app | bit: 17,
app | is_known: true,
app | is_required: false,
app | type: 'multipath_payments_v0'
app | }
app | ],
app | id: '4e7194285ea4955cc7aad374873a97f8775bfa6c141bae203727bd4adbadf6b1',
app | is_expired: false,
app | mtokens: '1000',
app | payment: '07a6d31bca2b6aeaeece0a2baedd75976f119d66c58e2aafef2c7ff0eab9ee14',
app | routes: [],
app | safe_tokens: 1,
app | tokens: 1
app | }
I also looked at the docs and I see no num_msat
. I think we need to use BigInt(decoded.mtokens)
as we do in other parts of the code like here.
(While doing this, I realized we also need to document LNWITH_URL
in .env.sample
)
Thanks @ekzyis! I was looking at the wrong docs I guess 😅 https://lightning.engineering/api-docs/api/lnd/lightning/decode-pay-req |
Ahh, I figured but I wasn't able to find this documentation, haha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to have "verified stacker.news contributor" in your SN profile, you can add your SN nym to contributors.txt
in this PR :)
7688296
to
bf3068b
Compare
Cleaned up commits + added to list! |
I'll likely deploy this monday. 😉 |
Not sure how to test, but looking at the
decodePaymentRequest
docs this looks correct.