Compare commits

...

2 Commits

Author SHA1 Message Date
k00b d1c770dbbc noop walletLogger if wallet isn't provided 2024-11-12 09:22:51 -06:00
k00b cb8cce77f0 don't let args overwrite withdrawal/deposit checking params 2024-11-12 08:50:54 -06:00
2 changed files with 12 additions and 2 deletions

View File

@ -675,6 +675,16 @@ const resolvers = {
export default injectResolvers(resolvers)
export const walletLogger = ({ wallet, models }) => {
// no-op logger if wallet is not provided
if (!wallet) {
return {
ok: () => {},
info: () => {},
error: () => {},
warn: () => {}
}
}
// server implementation of wallet logger interface on client
const log = (level) => async (message, context = {}) => {
try {

View File

@ -414,7 +414,7 @@ export async function checkPendingDeposits (args) {
const pendingDeposits = await models.invoice.findMany({ where: { confirmedAt: null, cancelled: false } })
for (const d of pendingDeposits) {
try {
await checkInvoice({ data: { hash: d.hash }, ...args })
await checkInvoice({ ...args, data: { hash: d.hash } })
await sleep(10)
} catch {
console.error('error checking invoice', d.hash)
@ -427,7 +427,7 @@ export async function checkPendingWithdrawals (args) {
const pendingWithdrawals = await models.withdrawl.findMany({ where: { status: null } })
for (const w of pendingWithdrawals) {
try {
await checkWithdrawal({ data: { hash: w.hash }, ...args })
await checkWithdrawal({ ...args, data: { hash: w.hash } })
await sleep(10)
} catch (err) {
console.error('error checking withdrawal', w.hash, err)