@@ -22,7 +22,7 @@ import walletDefs from '@/wallets/server'
22
22
import { generateResolverName , generateTypeDefName } from '@/wallets/graphql'
23
23
import { lnAddrOptions } from '@/lib/lnurl'
24
24
import { GqlAuthenticationError , GqlAuthorizationError , GqlInputError } from '@/lib/error'
25
- import { getNodeSockets , getOurPubkey } from '../lnd'
25
+ import { getNodeSockets } from '../lnd'
26
26
import validateWallet from '@/wallets/validate'
27
27
import { canReceive , getWalletByType } from '@/wallets/common'
28
28
import performPaidAction from '../paidAction'
@@ -987,7 +987,7 @@ export async function createWithdrawal (parent, { invoice, maxFee }, { me, model
987
987
return await performPayingAction ( { bolt11 : invoice , maxFee, walletId : wallet ?. id } , { me, models, lnd } )
988
988
}
989
989
990
- export async function sendToLnAddr ( parent , { addr, amount, maxFee, comment, ...payer } ,
990
+ async function sendToLnAddr ( parent , { addr, amount, maxFee, comment, ...payer } ,
991
991
{ me, models, lnd, headers } ) {
992
992
if ( ! me ) {
993
993
throw new GqlAuthenticationError ( )
@@ -1005,11 +1005,9 @@ export async function sendToLnAddr (parent, { addr, amount, maxFee, comment, ...
1005
1005
return await createWithdrawal ( parent , { invoice : res . pr , maxFee } , { me, models, lnd, headers } )
1006
1006
}
1007
1007
1008
- export async function fetchLnAddrInvoice (
1008
+ async function fetchLnAddrInvoice (
1009
1009
{ addr, amount, maxFee, comment, ...payer } ,
1010
- {
1011
- me, models, lnd, autoWithdraw = false
1012
- } ) {
1010
+ { me, models, lnd } ) {
1013
1011
const options = await lnAddrOptions ( addr )
1014
1012
await validateSchema ( lnAddrSchema , { addr, amount, maxFee, comment, ...payer } , options )
1015
1013
@@ -1046,14 +1044,6 @@ export async function fetchLnAddrInvoice (
1046
1044
// decode invoice
1047
1045
try {
1048
1046
const decoded = await parsePaymentRequest ( { request : res . pr } )
1049
- const ourPubkey = await getOurPubkey ( { lnd } )
1050
- if ( autoWithdraw && decoded . destination === ourPubkey && process . env . NODE_ENV === 'production' ) {
1051
- // unset lnaddr so we don't trigger another withdrawal with same destination
1052
- await models . wallet . deleteMany ( {
1053
- where : { userId : me . id , type : 'LIGHTNING_ADDRESS' }
1054
- } )
1055
- throw new Error ( 'automated withdrawals to other stackers are not allowed' )
1056
- }
1057
1047
if ( ! decoded . mtokens || BigInt ( decoded . mtokens ) !== BigInt ( milliamount ) ) {
1058
1048
throw new Error ( 'invoice has incorrect amount' )
1059
1049
}
0 commit comments