aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-15 16:58:08 -0800
committerAdam Soltys <[email protected]>2026-02-15 16:58:08 -0800
commitba2fbfe2901db35bb0cc688757f7e88dc52ff7b6 (patch)
tree372e2911aeeb0e770a749e37d818a55a9e79cad3 /routes
parent4d3377ba1d37147b194c1fb0504edee3c73211a5 (diff)
downloadcoinos-server-ba2fbfe2901db35bb0cc688757f7e88dc52ff7b6.tar.gz
coinos-server-ba2fbfe2901db35bb0cc688757f7e88dc52ff7b6.zip
fix custodial bitcoin sends
Diffstat (limited to 'routes')
-rw-r--r--routes/payments.ts24
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({