mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-22 14:22:33 +01:00
chore: 🔧 remove logger param
This commit is contained in:
parent
88d4a86ab7
commit
dc4f329ed3
38 changed files with 44 additions and 45 deletions
|
@ -1,7 +1,6 @@
|
|||
import { GraphQLNonNull, GraphQLBoolean } from 'graphql';
|
||||
import { GraphQLNonNull } from 'graphql';
|
||||
import { AuthType } from '../schemas/types/GeneralType';
|
||||
|
||||
export const defaultParams = {
|
||||
auth: { type: new GraphQLNonNull(AuthType) },
|
||||
logger: { type: GraphQLBoolean },
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ export const closeChannel = {
|
|||
transactionOutputIndex: info.transaction_vout,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error closing channel: %o', error);
|
||||
logger.error('Error closing channel: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -43,7 +43,7 @@ export const openChannel = {
|
|||
transactionOutputIndex: info.transaction_vout,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error opening channel: %o', error);
|
||||
logger.error('Error opening channel: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -37,7 +37,7 @@ export const updateFees = {
|
|||
await updateRoutingFees(props);
|
||||
return true;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error updating routing fees: %o', error);
|
||||
logger.error('Error updating routing fees: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -43,7 +43,7 @@ export const createInvoice = {
|
|||
tokens: invoice.tokens,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error creating invoice: %o', error);
|
||||
logger.error('Error creating invoice: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@ export const parsePayment = {
|
|||
tokens: request.tokens,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error decoding request: %o', error);
|
||||
logger.error('Error decoding request: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -67,7 +67,7 @@ export const pay = {
|
|||
});
|
||||
isRequest = true;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error decoding request: %o', error);
|
||||
logger.error('Error decoding request: %o', error);
|
||||
}
|
||||
|
||||
if (isRequest) {
|
||||
|
@ -78,7 +78,7 @@ export const pay = {
|
|||
});
|
||||
return payment;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error paying request: %o', error);
|
||||
logger.error('Error paying request: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ export const pay = {
|
|||
});
|
||||
return payment;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error paying request: %o', error);
|
||||
logger.error('Error paying request: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ export const payViaRoute = {
|
|||
try {
|
||||
route = JSON.parse(params.route);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Corrupt route json: %o', error);
|
||||
logger.error('Corrupt route json: %o', error);
|
||||
throw new Error('Corrupt Route JSON');
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,12 @@ export const payViaRoute = {
|
|||
tokens: params.tokens,
|
||||
description: 'Balancing Channel',
|
||||
}).catch((error: any) => {
|
||||
params.logger && logger.error('Error getting invoice: %o', error);
|
||||
logger.error('Error getting invoice: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
});
|
||||
|
||||
await payViaRoutes({ lnd, routes: [route], id }).catch((error: any) => {
|
||||
params.logger && logger.error('Error making payment: %o', error);
|
||||
logger.error('Error making payment: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ export const createAddress = {
|
|||
|
||||
return address.address;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error creating address: %o', error);
|
||||
logger.error('Error creating address: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@ export const sendToAddress = {
|
|||
tokens: send.tokens,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error creating address: %o', error);
|
||||
logger.error('Error creating address: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const addPeer = {
|
|||
});
|
||||
return success;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error adding peer: %o', error);
|
||||
logger.error('Error adding peer: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -23,7 +23,7 @@ export const removePeer = {
|
|||
});
|
||||
return success;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error removing peer: %o', error);
|
||||
logger.error('Error removing peer: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ export const getBackups = {
|
|||
});
|
||||
return JSON.stringify(backups);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting backups: %o', error);
|
||||
logger.error('Error getting backups: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@ export const recoverFunds = {
|
|||
try {
|
||||
backupObj = JSON.parse(params.backup);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Corrupt backup file: %o', error);
|
||||
logger.error('Corrupt backup file: %o', error);
|
||||
throw new Error('Corrupt backup file');
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ export const verifyBackups = {
|
|||
try {
|
||||
backupObj = JSON.parse(params.backup);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Corrupt backup file: %o', error);
|
||||
logger.error('Corrupt backup file: %o', error);
|
||||
throw new Error('Corrupt backup file');
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ export const verifyBackups = {
|
|||
});
|
||||
return is_valid;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error verifying backups: %o', error);
|
||||
logger.error('Error verifying backups: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ export const getChainBalance = {
|
|||
});
|
||||
return value.chain_balance;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting chain balance: %o', error);
|
||||
logger.error('Error getting chain balance: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -36,7 +36,7 @@ export const getUtxos = {
|
|||
|
||||
return utxos;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting utxos: %o', error);
|
||||
logger.error('Error getting utxos: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const getChannelBalance = {
|
|||
pendingBalance: channelBalance.pending_balance,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting channel balance: %o', error);
|
||||
logger.error('Error getting channel balance: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -80,7 +80,7 @@ export const getChannelFees = {
|
|||
|
||||
return consolidated;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting channel fees: %o', error);
|
||||
logger.error('Error getting channel fees: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,7 +57,7 @@ export const getChannelReport = {
|
|||
maxOut: maxOutgoing,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting channel report: %o', error);
|
||||
logger.error('Error getting channel report: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -74,7 +74,7 @@ export const getChannels = {
|
|||
const channels = await getChannelList();
|
||||
return channels;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting channels: %o', error);
|
||||
logger.error('Error getting channels: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@ export const getClosedChannels = {
|
|||
});
|
||||
return channels;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting closed channels: %o', error);
|
||||
logger.error('Error getting closed channels: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const getBitcoinFees = {
|
|||
}
|
||||
throw new Error('Problem getting Bitcoin fees.');
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting bitcoin fees: %o', error);
|
||||
logger.error('Error getting bitcoin fees: %o', error);
|
||||
throw new Error('Problem getting Bitcoin fees.');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@ export const getBitcoinPrice = {
|
|||
|
||||
return JSON.stringify(json);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting bitcoin price: %o', error);
|
||||
logger.error('Error getting bitcoin price: %o', error);
|
||||
throw new Error('Problem getting Bitcoin price.');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -46,7 +46,7 @@ export const getInOut = {
|
|||
lnd,
|
||||
});
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting invoices: %o', error);
|
||||
logger.error('Error getting invoices: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export const adminCheck = {
|
|||
request: 'admin check',
|
||||
});
|
||||
} catch (error) {
|
||||
params.logger && logger.error('%o', error);
|
||||
logger.info('%o', error);
|
||||
if (error.length >= 2) {
|
||||
if (error[2]?.err?.details?.indexOf('permission denied') >= 0) {
|
||||
throw new Error('PermissionDenied');
|
||||
|
|
|
@ -45,7 +45,7 @@ export const decodeRequest = {
|
|||
|
||||
return decode;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error paying request: %o', error);
|
||||
logger.error('Error paying request: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const getNode = {
|
|||
});
|
||||
return nodeInfo;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting closed channels: %o', error);
|
||||
logger.error('Error getting closed channels: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -39,7 +39,7 @@ export const getNetworkInfo = {
|
|||
totalCapacity: info.total_capacity,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting network info: %o', error);
|
||||
logger.error('Error getting network info: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -42,7 +42,7 @@ export const getNodeInfo = {
|
|||
closed_channels_count: closedChannels.channels.length,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting node info: %o', error);
|
||||
logger.error('Error getting node info: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -48,7 +48,7 @@ export const getOffers = {
|
|||
}
|
||||
throw new Error('Problem getting HodlHodl offers.');
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting HodlHodl offers: %o', error);
|
||||
logger.error('Error getting HodlHodl offers: %o', error);
|
||||
throw new Error('Problem getting HodlHodl offers.');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@ export const signMessage = {
|
|||
|
||||
return message.signature;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error signing message: %o', error);
|
||||
logger.error('Error signing message: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -26,7 +26,7 @@ export const verifyMessage = {
|
|||
|
||||
return message.signed_by;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error verifying message: %o', error);
|
||||
logger.error('Error verifying message: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,7 +57,7 @@ export const getPeers = {
|
|||
const peerList = await getPeerList();
|
||||
return peerList;
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting peers: %o', error);
|
||||
logger.error('Error getting peers: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -64,7 +64,7 @@ export const getForwardReport = {
|
|||
|
||||
return JSON.stringify(reducedOrderedHour);
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting forward report: %o', error);
|
||||
logger.error('Error getting forward report: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -29,7 +29,7 @@ export const getRoutes = {
|
|||
tokens: params.tokens,
|
||||
...(params.maxFee && { max_fee: params.maxFee }),
|
||||
}).catch((error: any) => {
|
||||
params.logger && logger.error('Error getting routes: %o', error);
|
||||
logger.error('Error getting routes: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
});
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ export const getForwards = {
|
|||
forwards,
|
||||
};
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting forwards: %o', error);
|
||||
logger.error('Error getting forwards: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -51,7 +51,7 @@ export const getResume = {
|
|||
);
|
||||
payments = await getMappedPayments();
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting payments: %o', error);
|
||||
logger.error('Error getting payments: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ export const getResume = {
|
|||
token = invoiceList.next;
|
||||
}
|
||||
} catch (error) {
|
||||
params.logger && logger.error('Error getting invoices: %o', error);
|
||||
logger.error('Error getting invoices: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue