Skip to content

Commit

Permalink
chore: apply linting
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleSamtoshi committed Nov 16, 2023
1 parent 455dec5 commit f21ea22
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 57 deletions.
34 changes: 17 additions & 17 deletions core/api/src/debug/migrate-ln-payments-trackpaymentsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,23 @@ const migrateLnPayment = async (
payment.status === PaymentStatus.Pending
? partialLnPayment
: payment.status === PaymentStatus.Failed
? {
...partialLnPayment,
status: PaymentStatus.Failed,
confirmedDetails: undefined,
attempts: undefined,
isCompleteRecord: true,
}
: {
...partialLnPayment,
createdAt: payment.createdAt,
status: payment.status,
milliSatsAmount: payment.milliSatsAmount,
roundedUpAmount: payment.roundedUpAmount,
confirmedDetails: payment.confirmedDetails,
attempts: payment.attempts, // will be null, only comes from getPayments
isCompleteRecord: true,
}
? {
...partialLnPayment,
status: PaymentStatus.Failed,
confirmedDetails: undefined,
attempts: undefined,
isCompleteRecord: true,
}
: {
...partialLnPayment,
createdAt: payment.createdAt,
status: payment.status,
milliSatsAmount: payment.milliSatsAmount,
roundedUpAmount: payment.roundedUpAmount,
confirmedDetails: payment.confirmedDetails,
attempts: payment.attempts, // will be null, only comes from getPayments
isCompleteRecord: true,
}

const updatedPaymentLookup = await LnPaymentsRepository().persistNew(newLnPayment)
if (updatedPaymentLookup instanceof Error) {
Expand Down
8 changes: 4 additions & 4 deletions core/api/src/domain/payments/payment-flow-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const LightningPaymentFlowBuilder = <S extends WalletCurrency>(
destination === undefined
? SettlementMethod.IntraLedger
: config.localNodeIds.includes(destination)
? SettlementMethod.IntraLedger
: SettlementMethod.Lightning
? SettlementMethod.IntraLedger
: SettlementMethod.Lightning
return {
settlementMethod,
btcProtocolAndBankFee:
Expand Down Expand Up @@ -533,8 +533,8 @@ const LPFBWithConversion = <S extends WalletCurrency, R extends WalletCurrency>(
const hash = state.paymentHash
? { paymentHash: state.paymentHash }
: state.intraLedgerHash
? { intraLedgerHash: state.intraLedgerHash }
: new InvalidLightningPaymentFlowStateError()
? { intraLedgerHash: state.intraLedgerHash }
: new InvalidLightningPaymentFlowStateError()
if (hash instanceof Error) return hash

return PaymentFlow({
Expand Down
8 changes: 4 additions & 4 deletions core/api/src/domain/shared/error-parsers-unknown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const parseUnknownDomainErrorFromUnknown = (error: unknown): DomainError
error instanceof Error
? error
: typeof error === "string"
? new UnknownDomainError(error)
: error instanceof Object
? new UnknownDomainError(JSON.stringify(error))
: new UnknownDomainError("Unknown error")
? new UnknownDomainError(error)
: error instanceof Object
? new UnknownDomainError(JSON.stringify(error))
: new UnknownDomainError("Unknown error")
return err
}
16 changes: 8 additions & 8 deletions core/api/src/domain/shared/error-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ export const parseErrorMessageFromUnknown = (error: unknown): string => {
error instanceof Error
? error.message
: typeof error === "string"
? error
: error instanceof Object
? JSON.stringify(error)
: "Unknown error"
? error
: error instanceof Object
? JSON.stringify(error)
: "Unknown error"
return errMsg
}

Expand All @@ -15,9 +15,9 @@ export const parseErrorFromUnknown = (error: unknown): Error => {
error instanceof Error
? error
: typeof error === "string"
? new Error(error)
: error instanceof Object
? new Error(JSON.stringify(error))
: new Error("Unknown error")
? new Error(error)
: error instanceof Object
? new Error(JSON.stringify(error))
: new Error("Unknown error")
return err
}
4 changes: 2 additions & 2 deletions core/api/src/graphql/admin/root/query/lightning-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const LightningPaymentQuery = GT.Field({
const paymentRequest = !(lightningPayment instanceof Error)
? lightningPayment.paymentRequest
: "paymentRequest" in lightningPaymentFromLnd
? lightningPaymentFromLnd.paymentRequest
: undefined
? lightningPaymentFromLnd.paymentRequest
: undefined

return {
...lightningPaymentFromLnd,
Expand Down
28 changes: 14 additions & 14 deletions core/api/src/services/mongoose/payment-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const PaymentFlowStateRepository = (
const hash = paymentHash
? { paymentHash }
: intraLedgerHash
? { intraLedgerHash }
: new BadInputsForFindError(JSON.stringify(args))
? { intraLedgerHash }
: new BadInputsForFindError(JSON.stringify(args))
if (hash instanceof Error) return hash

try {
Expand Down Expand Up @@ -192,10 +192,10 @@ const paymentFlowFromRaw = <S extends WalletCurrency, R extends WalletCurrency>(
const hash = paymentHash
? { paymentHash: paymentHash as PaymentHash }
: intraLedgerHash
? { intraLedgerHash: intraLedgerHash as IntraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
? { intraLedgerHash: intraLedgerHash as IntraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
if (hash instanceof Error) return hash

const btcPaymentAmount = paymentAmountFromNumber({
Expand Down Expand Up @@ -262,10 +262,10 @@ const rawFromPaymentFlow = <S extends WalletCurrency, R extends WalletCurrency>(
const hash = paymentHash
? { paymentHash }
: intraLedgerHash
? { intraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
? { intraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
if (hash instanceof Error) return hash

return {
Expand Down Expand Up @@ -307,10 +307,10 @@ const rawIndexFromPaymentFlowIndex = (
const hash = paymentHash
? { paymentHash }
: intraLedgerHash
? { intraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
? { intraLedgerHash }
: new InvalidLightningPaymentFlowStateError(
"Missing valid 'paymentHash' or 'intraLedgerHash'",
)
if (hash instanceof Error) return hash

return {
Expand Down
16 changes: 8 additions & 8 deletions core/api/test/unit/payments/onchain-payment-flow-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,10 @@ describe("OnChainPaymentFlowBuilder", () => {
amountCurrency === WalletCurrency.Usd
? (sendAmount as UsdPaymentAmount)
: sendAmount.amount === 1n
? ONE_CENT
: await convertForUsdWalletToUsdWallet.usdFromBtc(
sendAmount as BtcPaymentAmount,
)
? ONE_CENT
: await convertForUsdWalletToUsdWallet.usdFromBtc(
sendAmount as BtcPaymentAmount,
)

checkAddress(payment)
checkSettlementMethod(payment)
Expand Down Expand Up @@ -1180,10 +1180,10 @@ describe("OnChainPaymentFlowBuilder", () => {
amountCurrency === WalletCurrency.Usd
? (sendAmount as UsdPaymentAmount)
: sendAmount.amount === 1n
? ONE_CENT
: await convertForUsdWalletToUsdWallet.usdFromBtc(
sendAmount as BtcPaymentAmount,
)
? ONE_CENT
: await convertForUsdWalletToUsdWallet.usdFromBtc(
sendAmount as BtcPaymentAmount,
)

checkAddress(payment)
checkSettlementMethod(payment)
Expand Down

0 comments on commit f21ea22

Please sign in to comment.