File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,7 @@ import {
12
12
paidActionCanceling
13
13
} from './paidAction'
14
14
import { payingActionConfirmed , payingActionFailed } from './payingAction'
15
- import { canReceive , getWalletByType } from '@/wallets/common'
16
15
import { notifyNewStreak , notifyStreakLost } from '@/lib/webPush'
17
- import { hasVault , vaultPrismaFragments } from '@/wallets/vault'
18
16
19
17
export async function subscribeToWallet ( args ) {
20
18
await subscribeToDeposits ( args )
@@ -292,19 +290,20 @@ export async function checkWallet ({ data: { userId }, models }) {
292
290
const pushNotifications = [ ]
293
291
294
292
await models . $transaction ( async tx => {
295
- // TODO: use UserWallet instead of Wallet table
296
- const wallets = await tx . wallet . findMany ( {
293
+ const wallets = await tx . userWallet . findMany ( {
297
294
where : {
298
295
userId,
299
296
enabled : true
300
297
} ,
301
- include : vaultPrismaFragments . include ( )
298
+ include : {
299
+ protocols : true
300
+ }
302
301
} )
303
302
304
303
const { hasRecvWallet : oldHasRecvWallet , hasSendWallet : oldHasSendWallet } = await tx . user . findUnique ( { where : { id : userId } } )
305
304
306
- const newHasRecvWallet = wallets . some ( ( { type , wallet } ) => canReceive ( { def : getWalletByType ( type ) , config : wallet } ) )
307
- const newHasSendWallet = wallets . some ( hasVault )
305
+ const newHasRecvWallet = wallets . some ( ( { protocols } ) => protocols . some ( proto => ! proto . send ) )
306
+ const newHasSendWallet = wallets . some ( ( { protocols } ) => protocols . some ( proto => proto . send ) )
308
307
309
308
await tx . user . update ( {
310
309
where : { id : userId } ,
You can’t perform that action at this time.
0 commit comments