-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capsule integration final #883
base: main
Are you sure you want to change the base?
Conversation
…usecapsule-integration-two
Deploying ens-app-v3 with Cloudflare Pages
|
…capsule-integration-final
Default to moonpay when balance is zero
…capsule-integration-final
src/components/ConnectButton.tsx
Outdated
const isCapsuleConnected = getIsCapsuleConnected(wagmiConfig.state) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this be better suited to use with wagmi's useConnections
?
src/components/ConnectButton.tsx
Outdated
isCapsuleConnected | ||
? { | ||
label: t('wallet.myWallet'), | ||
color: 'text', | ||
icon: <WalletSVG />, | ||
wrapper: (children: ReactNode, key: Key) => ( | ||
<BaseLink href="https://connect.usecapsule.com/" key={key}> | ||
{children} | ||
</BaseLink> | ||
), | ||
} | ||
: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use ...[isCapsuleConnected ? [...] : []]
you can avoid filtering
src/pages/_app.tsx
Outdated
|
||
import '@rainbow-me/rainbowkit/styles.css' | ||
|
||
// prettier-ignore-file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
|
||
const rainbowKitTheme: Theme = { | ||
...lightTheme({ | ||
// accentColor: thorinLightTheme.colors.accent, // requires a hex string color but thorinLightTheme returns a hsl string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
src/utils/query/capsuleWallet.ts
Outdated
githubUrl: 'https://github.com/ensdomains', | ||
xUrl: 'https://twitter.com/ensdomains', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have these elsewhere i think, would be nice to have a single reference
src/utils/query/capsuleWallet.ts
Outdated
githubUrl: 'https://github.com/ensdomains', | ||
xUrl: 'https://twitter.com/ensdomains', | ||
homepageUrl: 'https://ens.domains/', | ||
supportUrl: 'mailto:[email protected]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a real email?
const isSupportedChain = (chainId: number): chainId is (typeof chains)[number]['id'] => | ||
chains.some((c) => c.id === chainId) | ||
|
||
// hotfix for wagmi bug | ||
wagmiConfig_.subscribe( | ||
({ connections, current }) => (current ? connections.get(current)?.chainId : undefined), | ||
(chainId_) => { | ||
const chainId = chainId_ || chains[0].id | ||
// If chain is not configured, then don't switch over to it. | ||
const isChainConfigured = isSupportedChain(chainId) | ||
if (!isChainConfigured) return | ||
|
||
return wagmiConfig_.setState((x) => ({ | ||
...x, | ||
chainId: chainId ?? x.chainId, | ||
})) | ||
}, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need these unless they went somewhere else, our logic means we're always defaulting to the 0th item in the chain array (without it it'll stay on the last connected supported chain)
…capsule-integration-final
…capsule-integration-final
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
@@ -203,6 +230,10 @@ const createTransactionRequestUnsafe = async ({ | |||
transactionName: params.name, | |||
}) | |||
|
|||
const isCapsuleConnected = hasCapsuleConnection(connections) | |||
|
|||
const largestMedianGasFee = await getLargestMedianGasFee() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to do this unless it's capsule
@@ -515,6 +509,7 @@ describe('useRenew', () => { | |||
}) | |||
|
|||
it('should handle URL changes', () => { | |||
console.log('hi there') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you log out and log in with capsule, sometimes the will not update to connected. You have to click connect > sign in with capsule in order for it to trigger login.
@@ -1,10 +1,11 @@ | |||
import { queryOptions } from '@tanstack/react-query' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasPendingMoonpayTransaction ? PaymentMethod.moonpay : PaymentMethod.ethereum, | ||
hasPendingMoonpayTransaction || balance?.value === 0n | ||
? PaymentMethod.moonpay | ||
: PaymentMethod.ethereum, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const chainParam = params.get('chain') | ||
const segments = hostname.split('.') | ||
|
||
if (segments.length === 4 && segments.slice(1).join('.') === 'ens-app-v3.pages.dev') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return match(segments[0]) | ||
.with('sepolia', () => [ | ||
...(isLocalProvider ? ([localhostWithEns] as const) : ([] as const)), | ||
sepoliaWithEns, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to inject localhostWithEns here? Seems like we would want it to link to sepolia chain.
vi.mock('wagmi') | ||
vi.mock('@app/transaction-flow/TransactionFlowProvider') | ||
vi.mock('next/navigation') | ||
|
||
const mockUseBasicName = mockFunction(useBasicName) | ||
const mockUseAbilities = mockFunction(useAbilities) | ||
const mockUseConnectModal = mockFunction(useConnectModal) | ||
// const mockUseConnectModal = mockFunction(useConnectModal) | ||
const mockUseAccount = mockFunction(useAccount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
|
||
export const capsuleModalProps = { | ||
appName: '', | ||
oAuthMethods: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is appName supposed to have a value?
const capsuleWalletItegratedOpts: GetCapsuleIntegratedOpts = { | ||
capsule: capsuleClient, | ||
nameOverride: 'Sign in with Capsule', | ||
iconBackgroundOverride: '#ffffff', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
translation for "Sign in with Capsule'?
{ | ||
appName: APP_NAME, | ||
projectId: '', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projectId should be WC_PROJECT_ID?
No description provided.