Skip to content
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

chore: remove intermediate select screen account on auth connector #2827

Merged
merged 10 commits into from
Oct 30, 2024
38 changes: 38 additions & 0 deletions .changeset/sour-laws-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
'@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
'@apps/laboratory': patch
'@reown/appkit': patch
'@reown/appkit-common': patch
'@reown/appkit-wallet': patch
'@reown/appkit-core': patch
'@apps/demo': patch
'@apps/gallery': patch
'@examples/html-ethers': patch
'@examples/html-ethers5': patch
'@examples/html-wagmi': patch
'@examples/next-ethers': patch
'@examples/next-wagmi': patch
'@examples/react-ethers': patch
'@examples/react-ethers5': patch
'@examples/react-solana': patch
tomiir marked this conversation as resolved.
Show resolved Hide resolved
'@examples/react-wagmi': patch
'@examples/vue-ethers5': patch
'@examples/vue-solana': patch
'@examples/vue-wagmi': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-cdn': patch
'@reown/appkit-ethers': patch
'@reown/appkit-ethers5': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-solana': patch
'@reown/appkit-ui': patch
'@reown/appkit-wagmi': patch
---

Remove intermediate screen for multi address on auth wallet
1 change: 0 additions & 1 deletion packages/core/src/controllers/RouterController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface RouterControllerState {
view:
| 'Account'
| 'AccountSettings'
| 'SelectAddresses'
| 'AllWallets'
| 'ApproveTransaction'
| 'BuyInProgress'
Expand Down
1 change: 0 additions & 1 deletion packages/scaffold-ui/exports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export * from '../src/views/w3m-connect-wallets-view/index.js'
export * from '../src/views/w3m-connect-socials-view/index.js'
export * from '../src/views/w3m-connecting-social-view/index.js'
export * from '../src/views/w3m-profile-view/index.js'
export * from '../src/views/w3m-select-addresses-view/index.js'
export * from '../src/views/w3m-switch-address-view/index.js'
export * from '../src/views/w3m-connecting-farcaster-view/index.js'

Expand Down
2 changes: 0 additions & 2 deletions packages/scaffold-ui/src/modal/w3m-router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ export class W3mRouter extends LitElement {
return html`<w3m-network-switch-view></w3m-network-switch-view>`
case 'Profile':
return html`<w3m-profile-view></w3m-profile-view>`
case 'SelectAddresses':
return html`<w3m-select-addresses-view></w3m-select-addresses-view>`
case 'SwitchAddress':
return html`<w3m-switch-address-view></w3m-switch-address-view>`
case 'Transactions':
Expand Down
3 changes: 1 addition & 2 deletions packages/scaffold-ui/src/partials/w3m-header/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function headings() {
OnRampTokenSelect: 'Select Token',
OnRampFiatSelect: 'Select Currency',
Profile: undefined,
SelectAddresses: 'Select accounts',
SwitchNetwork: networkName ?? 'Switch Network',
SwitchAddress: 'Switch Address',
Transactions: 'Activity',
Expand Down Expand Up @@ -213,7 +212,7 @@ export class W3mHeader extends LitElement {
return html`<wui-select
id="dynamic"
data-testid="w3m-account-select-network"
active-network=${this.network?.name}
active-network=${ifDefined(this.network?.name)}
@click=${this.onNetworks.bind(this)}
imageSrc=${ifDefined(AssetUtil.getNetworkImage(this.network))}
></wui-select>`
Expand Down
10 changes: 1 addition & 9 deletions packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,7 @@ export class W3mConnectingWcView extends LitElement {
if (retry || CoreHelperUtil.isPairingExpired(wcPairingExpiry)) {
await ConnectionController.connectWalletConnect()
this.finalizeConnection()

if (
StorageUtil.getConnectedConnector() === 'AUTH' &&
OptionsController.state.hasMultipleAddresses
) {
RouterController.push('SelectAddresses')
} else {
ModalController.close()
}
ModalController.close()
}
} catch (error) {
EventsController.sendEvent({
Expand Down
32 changes: 2 additions & 30 deletions packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,15 @@ import {
EventsController,
ConnectionController,
ModalController,
NetworkController,
RouterController,
AccountController,
ChainController,
OptionsController
ChainController
} from '@reown/appkit-core'
import { state } from 'lit/decorators.js'

@customElement('w3m-email-verify-otp-view')
export class W3mEmailVerifyOtpView extends W3mEmailOtpWidget {
// -- Members ------------------------------------------- //
private unsubscribe: (() => void)[] = []

// -- State ------------------------------------------- //
@state() private smartAccountDeployed = AccountController.state.smartAccountDeployed

public constructor() {
super()

this.unsubscribe.push(
AccountController.subscribeKey('smartAccountDeployed', val => {
this.smartAccountDeployed = val
})
)
}

// -- Private ------------------------------------------ //
override onOtpSubmit: OnOtpSubmitFn = async otp => {
try {
if (this.authConnector) {
const smartAccountEnabled = NetworkController.checkIfSmartAccountEnabled()
await this.authConnector.provider.connectOtp({ otp })
EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_PASS' })

Expand All @@ -53,13 +31,7 @@ export class W3mEmailVerifyOtpView extends W3mEmailOtpWidget {
event: 'CONNECT_SUCCESS',
properties: { method: 'email', name: this.authConnector.name || 'Unknown' }
})
if (AccountController.state.allAccounts.length > 1) {
RouterController.push('SelectAddresses')
} else if (smartAccountEnabled && !this.smartAccountDeployed) {
RouterController.push('UpgradeToSmartAccount')
} else if (!OptionsController.state.isSiweEnabled) {
ModalController.close()
}
ModalController.close()
}
} catch (error) {
EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_FAIL' })
Expand Down
2 changes: 1 addition & 1 deletion packages/scaffold-ui/src/views/w3m-profile-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class W3mProfileView extends LitElement {
: html`<wui-button
tomiir marked this conversation as resolved.
Show resolved Hide resolved
slot="action"
textVariant="small-600"
size="sm"
size="md"
variant="accent"
@click=${() => this.onSwitchAccount(account)}
>Switch</wui-button
Expand Down
158 changes: 0 additions & 158 deletions packages/scaffold-ui/src/views/w3m-select-addresses-view/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/scaffold-ui/src/views/w3m-select-addresses-view/styles.ts

This file was deleted.

Loading