diff options
| author | Adam Soltys <[email protected]> | 2026-02-15 16:58:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-15 16:58:08 -0800 |
| commit | ba2fbfe2901db35bb0cc688757f7e88dc52ff7b6 (patch) | |
| tree | 372e2911aeeb0e770a749e37d818a55a9e79cad3 /routes | |
| parent | 4d3377ba1d37147b194c1fb0504edee3c73211a5 (diff) | |
| download | coinos-server-ba2fbfe2901db35bb0cc688757f7e88dc52ff7b6.tar.gz coinos-server-ba2fbfe2901db35bb0cc688757f7e88dc52ff7b6.zip | |
fix custodial bitcoin sends
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.ts | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/routes/payments.ts b/routes/payments.ts index 6bed1309..4bdd0d30 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -89,13 +89,23 @@ export default { aid, }); } else { - p = await sendInternal({ - invoice, - amount, - memo, - recipient, - sender: user, - }); + // Check if recipient account is non-custodial (vault) + const recipientAccount = invoice?.aid ? await g(`account:${invoice.aid}`) : null; + if (recipientAccount?.pubkey || recipientAccount?.seed) { + p = await sendOnchain({ + amount: amount || invoice.amount, + address: invoice.hash, + user, + }); + } else { + p = await sendInternal({ + invoice, + amount, + memo, + recipient, + sender: user, + }); + } } } else if (fund) { p = await debit({ |
