Compare commits
4 Commits
467a9d6a76
...
5cfefc1ca8
Author | SHA1 | Date | |
---|---|---|---|
|
5cfefc1ca8 | ||
|
5ae3084e53 | ||
|
48d0cd1086 | ||
|
203db13553 |
@ -87,15 +87,15 @@ const SocialsPopover = (
|
||||
const ChatPopover = (
|
||||
<Popover>
|
||||
<Popover.Body style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
||||
<a
|
||||
{/* <a
|
||||
href='https://tribes.sphinx.chat/t/stackerzchat' className='nav-link p-0 d-inline-flex'
|
||||
target='_blank' rel='noreferrer'
|
||||
>
|
||||
sphinx
|
||||
</a>
|
||||
<span className='mx-2 text-muted'> \ </span>
|
||||
<span className='mx-2 text-muted'> \ </span> */}
|
||||
<a
|
||||
href='https://t.me/stackernews' className='nav-link p-0 d-inline-flex'
|
||||
href='https://t.me/k00bideh' className='nav-link p-0 d-inline-flex'
|
||||
target='_blank' rel='noreferrer'
|
||||
>
|
||||
telegram
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { InvoiceCanceledError, InvoiceExpiredError, useQrPayment, useWalletPayment } from './payment'
|
||||
import { InvoiceCanceledError, InvoiceExpiredError, useInvoice, useQrPayment, useWalletPayment } from './payment'
|
||||
import { GET_PAID_ACTION } from '@/fragments/paidAction'
|
||||
|
||||
/*
|
||||
@ -23,6 +23,7 @@ export function usePaidMutation (mutation,
|
||||
fetchPolicy: 'network-only'
|
||||
})
|
||||
const waitForWalletPayment = useWalletPayment()
|
||||
const invoiceHelper = useInvoice()
|
||||
const waitForQrPayment = useQrPayment()
|
||||
const client = useApolloClient()
|
||||
// innerResult is used to store/control the result of the mutation when innerMutate runs
|
||||
@ -40,12 +41,14 @@ export function usePaidMutation (mutation,
|
||||
err instanceof InvoiceExpiredError) {
|
||||
// bail since qr code payment will also fail
|
||||
// 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
|
||||
}
|
||||
walletError = err
|
||||
}
|
||||
return await waitForQrPayment(invoice, walletError, { persistOnNavigate, waitFor })
|
||||
}, [waitForWalletPayment, waitForQrPayment])
|
||||
}, [waitForWalletPayment, waitForQrPayment, invoiceHelper])
|
||||
|
||||
const innerMutate = useCallback(async ({
|
||||
onCompleted: innerOnCompleted, ...innerOptions
|
||||
|
@ -40,6 +40,7 @@ export const COMMENT_FIELDS = gql`
|
||||
actionState
|
||||
confirmedAt
|
||||
}
|
||||
cost
|
||||
}
|
||||
`
|
||||
|
||||
|
@ -186,20 +186,23 @@ function useConfig (wallet) {
|
||||
|
||||
let valid = true
|
||||
try {
|
||||
newClientConfig = await walletValidate(wallet, newClientConfig)
|
||||
const transformedConfig = await walletValidate(wallet, newClientConfig)
|
||||
if (transformedConfig) {
|
||||
newClientConfig = Object.assign(newClientConfig, transformedConfig)
|
||||
}
|
||||
} catch {
|
||||
valid = false
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
if (priorityOnly) {
|
||||
setClientConfig(newConfig)
|
||||
setClientConfig(newClientConfig)
|
||||
} else {
|
||||
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 })
|
||||
if (newerConfig) {
|
||||
newClientConfig = newerConfig
|
||||
newClientConfig = Object.assign(newClientConfig, newerConfig)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(err.message)
|
||||
@ -219,7 +222,10 @@ function useConfig (wallet) {
|
||||
|
||||
let valid = true
|
||||
try {
|
||||
newServerConfig = await walletValidate(wallet, newServerConfig)
|
||||
const transformedConfig = await walletValidate(wallet, newServerConfig)
|
||||
if (transformedConfig) {
|
||||
newServerConfig = Object.assign(newServerConfig, transformedConfig)
|
||||
}
|
||||
} catch {
|
||||
valid = false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user