Compare commits
No commits in common. "5cfefc1ca84a95c434c4b441793f11652de8ef35" and "467a9d6a762d43115c4309dc36b5964829d97f57" have entirely different histories.
5cfefc1ca8
...
467a9d6a76
@ -87,15 +87,15 @@ const SocialsPopover = (
|
|||||||
const ChatPopover = (
|
const ChatPopover = (
|
||||||
<Popover>
|
<Popover>
|
||||||
<Popover.Body style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
<Popover.Body style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
||||||
{/* <a
|
<a
|
||||||
href='https://tribes.sphinx.chat/t/stackerzchat' className='nav-link p-0 d-inline-flex'
|
href='https://tribes.sphinx.chat/t/stackerzchat' className='nav-link p-0 d-inline-flex'
|
||||||
target='_blank' rel='noreferrer'
|
target='_blank' rel='noreferrer'
|
||||||
>
|
>
|
||||||
sphinx
|
sphinx
|
||||||
</a>
|
</a>
|
||||||
<span className='mx-2 text-muted'> \ </span> */}
|
<span className='mx-2 text-muted'> \ </span>
|
||||||
<a
|
<a
|
||||||
href='https://t.me/k00bideh' className='nav-link p-0 d-inline-flex'
|
href='https://t.me/stackernews' className='nav-link p-0 d-inline-flex'
|
||||||
target='_blank' rel='noreferrer'
|
target='_blank' rel='noreferrer'
|
||||||
>
|
>
|
||||||
telegram
|
telegram
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
|
import { useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
|
||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { InvoiceCanceledError, InvoiceExpiredError, useInvoice, useQrPayment, useWalletPayment } from './payment'
|
import { InvoiceCanceledError, InvoiceExpiredError, useQrPayment, useWalletPayment } from './payment'
|
||||||
import { GET_PAID_ACTION } from '@/fragments/paidAction'
|
import { GET_PAID_ACTION } from '@/fragments/paidAction'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -23,7 +23,6 @@ export function usePaidMutation (mutation,
|
|||||||
fetchPolicy: 'network-only'
|
fetchPolicy: 'network-only'
|
||||||
})
|
})
|
||||||
const waitForWalletPayment = useWalletPayment()
|
const waitForWalletPayment = useWalletPayment()
|
||||||
const invoiceHelper = useInvoice()
|
|
||||||
const waitForQrPayment = useQrPayment()
|
const waitForQrPayment = useQrPayment()
|
||||||
const client = useApolloClient()
|
const client = useApolloClient()
|
||||||
// innerResult is used to store/control the result of the mutation when innerMutate runs
|
// innerResult is used to store/control the result of the mutation when innerMutate runs
|
||||||
@ -41,14 +40,12 @@ export function usePaidMutation (mutation,
|
|||||||
err instanceof InvoiceExpiredError) {
|
err instanceof InvoiceExpiredError) {
|
||||||
// bail since qr code payment will also fail
|
// bail since qr code payment will also fail
|
||||||
// also bail if the payment took more than 1 second
|
// also bail if the payment took more than 1 second
|
||||||
// and cancel the invoice if it's not already canceled so it can be retried
|
|
||||||
invoiceHelper.cancel(invoice).catch(console.error)
|
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
walletError = err
|
walletError = err
|
||||||
}
|
}
|
||||||
return await waitForQrPayment(invoice, walletError, { persistOnNavigate, waitFor })
|
return await waitForQrPayment(invoice, walletError, { persistOnNavigate, waitFor })
|
||||||
}, [waitForWalletPayment, waitForQrPayment, invoiceHelper])
|
}, [waitForWalletPayment, waitForQrPayment])
|
||||||
|
|
||||||
const innerMutate = useCallback(async ({
|
const innerMutate = useCallback(async ({
|
||||||
onCompleted: innerOnCompleted, ...innerOptions
|
onCompleted: innerOnCompleted, ...innerOptions
|
||||||
|
@ -40,7 +40,6 @@ export const COMMENT_FIELDS = gql`
|
|||||||
actionState
|
actionState
|
||||||
confirmedAt
|
confirmedAt
|
||||||
}
|
}
|
||||||
cost
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -186,23 +186,20 @@ function useConfig (wallet) {
|
|||||||
|
|
||||||
let valid = true
|
let valid = true
|
||||||
try {
|
try {
|
||||||
const transformedConfig = await walletValidate(wallet, newClientConfig)
|
newClientConfig = await walletValidate(wallet, newClientConfig)
|
||||||
if (transformedConfig) {
|
|
||||||
newClientConfig = Object.assign(newClientConfig, transformedConfig)
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
valid = false
|
valid = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (priorityOnly) {
|
if (priorityOnly) {
|
||||||
setClientConfig(newClientConfig)
|
setClientConfig(newConfig)
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// XXX: testSendPayment can return a new config (e.g. lnc)
|
// XXX: testSendPayment can return a new config (e.g. lnc)
|
||||||
const newerConfig = await wallet.testSendPayment?.(newConfig, { me, logger })
|
const newerConfig = await wallet.testSendPayment?.(newConfig, { me, logger })
|
||||||
if (newerConfig) {
|
if (newerConfig) {
|
||||||
newClientConfig = Object.assign(newClientConfig, newerConfig)
|
newClientConfig = newerConfig
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err.message)
|
logger.error(err.message)
|
||||||
@ -222,10 +219,7 @@ function useConfig (wallet) {
|
|||||||
|
|
||||||
let valid = true
|
let valid = true
|
||||||
try {
|
try {
|
||||||
const transformedConfig = await walletValidate(wallet, newServerConfig)
|
newServerConfig = await walletValidate(wallet, newServerConfig)
|
||||||
if (transformedConfig) {
|
|
||||||
newServerConfig = Object.assign(newServerConfig, transformedConfig)
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
valid = false
|
valid = false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user