Skip to content

Commit

Permalink
Merge branch 'main' into fix/safe-local-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir authored Dec 18, 2024
2 parents f927c72 + 92ef6c4 commit bf84d05
Show file tree
Hide file tree
Showing 61 changed files with 2,164 additions and 432 deletions.
22 changes: 22 additions & 0 deletions .changeset/eleven-tigers-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit': patch
'@reown/appkit-core': patch
'@reown/appkit-siwe': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fixed an issue where connectors did not remain connected after page refresh despite being connected previously
22 changes: 22 additions & 0 deletions .changeset/metal-coins-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-core': patch
'@reown/appkit-siwx': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fix logic for authentication header on CloudAuthSIWX
22 changes: 22 additions & 0 deletions .changeset/popular-items-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit': patch
'@reown/appkit-core': patch
'@reown/appkit-siwe': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fixed an issue where Coinbase Wallet wasn't working on iOS safari
22 changes: 22 additions & 0 deletions .changeset/sixty-foxes-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-utils': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Improve send flow UX with better error handling
22 changes: 22 additions & 0 deletions .changeset/tame-students-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-utils': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-ui': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fixed an issue where connector id from Local Storage wasn't in sync
22 changes: 22 additions & 0 deletions .changeset/tiny-apples-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit': patch
'@reown/appkit-core': patch
'@reown/appkit-siwe': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fixed an issue where adapters and connectors were not synchronized
2 changes: 1 addition & 1 deletion apps/builder/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Page() {
'page-container flex flex-col-reverse items-center md:items-start md:flex-row p-4 bg-background gap-4 pt-10 md:pt-4 h-full overflow-auto'
)}
>
<div className="flex max-w-[450px] md:max-w-[340px] w-full bg-transparent md:bg-fg-primary h-none md:h-full text-foreground p-0 md:p-6 flex-col rounded-2xl overflow-none md:overflow-y-auto h-auto pb-20">
<div className="flex max-w-[450px] md:max-w-[340px] w-full bg-fg-primary h-none md:h-full text-foreground p-4 md:p-6 flex-col rounded-2xl overflow-none md:overflow-y-auto h-auto pb-20">
<SidebarContent />
</div>

Expand Down
4 changes: 3 additions & 1 deletion apps/builder/components/branding-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export function BrandingHeader({ className }: { className?: string }) {
/>

<div className="flex-col gap-2 items-center md:items-start mb-0 md:mb-12">
<h4 className="text-3xl text-text-primary text-center md:text-left">AppKit demo</h4>
<h4 className="text-3xl text-text-primary text-center md:text-left capitalize">
AppKit Demo
</h4>
<p className="text-sm text-text-secondary text-center md:text-left">
Use our AppKit demo to test and design onchain UX
</p>
Expand Down
23 changes: 8 additions & 15 deletions apps/builder/components/configuration-sections/section-design.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export function SectionDesign() {
const { fontFamily, mixColor, accentColor, borderRadius } = useSnapshot(ThemeStore.state)
const [radius, setRadius] = React.useState('M')

function handleColorPickerClick(inputId: string) {
const input = document.getElementById(inputId)
input?.click()
}

function handleAccentColorChange(e: React.ChangeEvent<HTMLInputElement>) {
const newColor = e.target.value
if (/^#[0-9A-F]{6}$/i.test(newColor)) {
Expand Down Expand Up @@ -150,15 +145,14 @@ export function SectionDesign() {
</button>
))}
<div className="relative">
<button
onClick={() => handleColorPickerClick('accent-color-input')}
<Label
htmlFor="accent-color-input"
className={cn(
'w-full flex items-center justify-center p-4 rounded-2xl transition-colors bg-fg-secondary hover:bg-fg-tertiary border border-transparent h-[38px]',
!ACCENT_COLORS.includes(accentColor) && accentColor !== ''
? 'border-fg-accent bg-fg-accent/10 hover:bg-fg-accent/10'
: null
)}
aria-label="Custom color picker"
>
<Image
src="/color-picker-icon.png"
Expand All @@ -167,13 +161,13 @@ export function SectionDesign() {
height={16}
className="rounded-2xl aspect-square object-cover"
/>
</button>
</Label>
<input
id="accent-color-input"
type="color"
value={accentColor}
onChange={handleAccentColorChange}
className="absolute invisible"
className="absolute !h-0 !w-0"
/>
</div>
</div>
Expand Down Expand Up @@ -202,15 +196,14 @@ export function SectionDesign() {
</button>
))}
<div className="relative">
<button
onClick={() => handleColorPickerClick('mix-color-input')}
<Label
htmlFor="mix-color-input"
className={cn(
'w-full flex items-center justify-center p-4 rounded-2xl transition-colors bg-fg-secondary hover:bg-fg-tertiary border border-transparent h-[38px]',
!BG_COLORS.includes(mixColor) && mixColor !== ''
? 'border-fg-accent bg-fg-accent/10 hover:bg-fg-accent/10'
: null
)}
aria-label="Custom background color picker"
>
<Image
src="/color-picker-icon.png"
Expand All @@ -220,13 +213,13 @@ export function SectionDesign() {
height={16}
className="rounded-2xl aspect-square"
/>
</button>
</Label>
<input
id="mix-color-input"
type="color"
value={mixColor}
onChange={handleMixColorChange}
className="absolute invisible"
className="absolute !h-0 !w-0"
/>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions apps/builder/providers/appkit-context-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { UniqueIdentifier } from '@dnd-kit/core'
import { defaultCustomizationConfig } from '@/lib/config'
import { useTheme } from 'next-themes'
import { inter } from '@/lib/fonts'
import { Toaster } from 'sonner'

interface AppKitProviderProps {
children: ReactNode
Expand Down Expand Up @@ -128,10 +129,6 @@ export const ContextProvider: React.FC<AppKitProviderProps> = ({ children }) =>
updateThemeMode(defaultCustomizationConfig.themeMode)
}

useEffect(() => {
setTheme(theme as ThemeMode)
}, [])

useEffect(() => {
if (initialized) {
const connectMethodsOrder = appKit?.getConnectMethodsOrder()
Expand All @@ -140,6 +137,10 @@ export const ContextProvider: React.FC<AppKitProviderProps> = ({ children }) =>
}
}, [initialized])

useEffect(() => {
appKit?.setThemeMode(theme as ThemeMode)
}, [])

const socialsEnabled = Array.isArray(features.socials)

return (
Expand Down Expand Up @@ -173,6 +174,7 @@ export const ContextProvider: React.FC<AppKitProviderProps> = ({ children }) =>
resetConfigs
}}
>
<Toaster theme={theme as ThemeMode} />
{children}
</AppKitContext.Provider>
)
Expand Down
1 change: 1 addition & 0 deletions apps/builder/public/.well-known/walletconnect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4596612d-2141-48aa-9987-0ce8526e3a25=cd9cfc50fcb49c77b511f53fcdd336589c05f1ec6e6cc5d4fbf4ebe7f8b9cb07
6 changes: 3 additions & 3 deletions packages/adapters/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class EthersAdapter extends AdapterBlueprint {
connectors.forEach(connector => {
const key = connector === 'coinbase' ? 'coinbaseWalletSDK' : connector

const injectedConnector = connector === ConstantsUtil.INJECTED_CONNECTOR_ID
const injectedConnector = connector === CommonConstantsUtil.CONNECTOR_ID.INJECTED

if (this.namespace) {
this.addConnector({
Expand Down Expand Up @@ -301,7 +301,7 @@ export class EthersAdapter extends AdapterBlueprint {
const existingConnector = this.connectors?.find(c => c.name === info?.name)

if (!existingConnector) {
const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID]
const type = PresetsUtil.ConnectorTypesMap[CommonConstantsUtil.CONNECTOR_ID.EIP6963]

if (type && this.namespace) {
this.addConnector({
Expand Down Expand Up @@ -389,7 +389,7 @@ export class EthersAdapter extends AdapterBlueprint {
throw new Error('Provider not found')
}

if (params.id === ConstantsUtil.AUTH_CONNECTOR_ID) {
if (params.id === CommonConstantsUtil.CONNECTOR_ID.AUTH) {
const provider = connector['provider'] as W3mFrameProvider
const { address, accounts } = await provider.connect()

Expand Down
6 changes: 3 additions & 3 deletions packages/adapters/ethers5/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Ethers5Adapter extends AdapterBlueprint {
connectors.forEach(connector => {
const key = connector === 'coinbase' ? 'coinbaseWalletSDK' : connector

const injectedConnector = connector === ConstantsUtil.INJECTED_CONNECTOR_ID
const injectedConnector = connector === CommonConstantsUtil.CONNECTOR_ID.INJECTED

if (this.namespace) {
this.addConnector({
Expand Down Expand Up @@ -302,7 +302,7 @@ export class Ethers5Adapter extends AdapterBlueprint {
const existingConnector = this.connectors?.find(c => c.name === info?.name)

if (!existingConnector) {
const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID]
const type = PresetsUtil.ConnectorTypesMap[CommonConstantsUtil.CONNECTOR_ID.EIP6963]

if (type && this.namespace) {
this.addConnector({
Expand Down Expand Up @@ -380,7 +380,7 @@ export class Ethers5Adapter extends AdapterBlueprint {
throw new Error('Provider not found')
}

if (params.id === ConstantsUtil.AUTH_CONNECTOR_ID) {
if (params.id === CommonConstantsUtil.CONNECTOR_ID.AUTH) {
const provider = connector['provider'] as W3mFrameProvider
const { address, accounts } = await provider.connect()

Expand Down
15 changes: 10 additions & 5 deletions packages/adapters/solana/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
type ConnectorType,
type Provider
} from '@reown/appkit-core'
import { ConstantsUtil, ErrorUtil, PresetsUtil } from '@reown/appkit-utils'
import { ErrorUtil, PresetsUtil } from '@reown/appkit-utils'
import { SolConstantsUtil } from '@reown/appkit-utils/solana'
import type { W3mFrameProvider } from '@reown/appkit-wallet'
import { AdapterBlueprint } from '@reown/appkit/adapters'
Expand Down Expand Up @@ -68,6 +68,11 @@ export class SolanaAdapter extends AdapterBlueprint {
})
}

// We don't need to set auth provider since we already set it in syncConnectors
public override setAuthProvider() {
return undefined
}

public syncConnectors(options: AppKitOptions, appKit: AppKit) {
if (!options.projectId) {
AlertController.open(ErrorUtil.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED, 'error')
Expand Down Expand Up @@ -101,7 +106,7 @@ export class SolanaAdapter extends AdapterBlueprint {
})

this.addConnector({
id: ConstantsUtil.AUTH_CONNECTOR_ID,
id: CommonConstantsUtil.CONNECTOR_ID.AUTH,
type: 'AUTH',
provider: this.authProvider as unknown as W3mFrameProvider,
name: 'Auth',
Expand All @@ -111,7 +116,7 @@ export class SolanaAdapter extends AdapterBlueprint {
}

// Add Coinbase Wallet if available
if (typeof window !== 'undefined' && 'coinbaseSolana' in window) {
if (CoreHelperUtil.isClient() && 'coinbaseSolana' in window) {
this.addConnector({
id: 'coinbaseWallet',
type: 'EXTERNAL',
Expand All @@ -123,7 +128,7 @@ export class SolanaAdapter extends AdapterBlueprint {
}),
name: 'Coinbase Wallet',
chain: this.namespace as ChainNamespace,
explorerId: PresetsUtil.ConnectorExplorerIds[ConstantsUtil.COINBASE_SDK_CONNECTOR_ID],
explorerId: PresetsUtil.ConnectorExplorerIds[CommonConstantsUtil.CONNECTOR_ID.COINBASE_SDK],
chains: []
})
}
Expand Down Expand Up @@ -333,7 +338,7 @@ export class SolanaAdapter extends AdapterBlueprint {
public async switchNetwork(params: AdapterBlueprint.SwitchNetworkParams): Promise<void> {
const { caipNetwork, provider, providerType } = params

if (providerType === 'ID_AUTH') {
if (providerType === CommonConstantsUtil.CONNECTOR_ID.AUTH) {
await (provider as unknown as W3mFrameProvider).switchNetwork(caipNetwork.id)
const user = await (provider as unknown as W3mFrameProvider).getUser({
chainId: caipNetwork.id
Expand Down
Loading

0 comments on commit bf84d05

Please sign in to comment.