diff --git a/.changeset/gold-needles-pretend.md b/.changeset/gold-needles-pretend.md new file mode 100644 index 0000000000..d9d8f32833 --- /dev/null +++ b/.changeset/gold-needles-pretend.md @@ -0,0 +1,23 @@ +--- +'@reown/appkit-scaffold-ui': patch +'@reown/appkit': patch +'@reown/appkit-core': patch +'@apps/demo': patch +'@apps/gallery': patch +'@apps/laboratory': patch +'@reown/appkit-adapter-ethers': patch +'@reown/appkit-adapter-ethers5': patch +'@reown/appkit-adapter-polkadot': patch +'@reown/appkit-adapter-solana': patch +'@reown/appkit-adapter-wagmi': patch +'@reown/appkit-utils': patch +'@reown/appkit-cdn': 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 +--- + +Removes intermediate screen for Embedded Wallet multi-account diff --git a/packages/core/src/controllers/RouterController.ts b/packages/core/src/controllers/RouterController.ts index 403f78a02f..31b3732a33 100644 --- a/packages/core/src/controllers/RouterController.ts +++ b/packages/core/src/controllers/RouterController.ts @@ -32,7 +32,6 @@ export interface RouterControllerState { view: | 'Account' | 'AccountSettings' - | 'SelectAddresses' | 'AllWallets' | 'ApproveTransaction' | 'BuyInProgress' diff --git a/packages/scaffold-ui/exports/index.ts b/packages/scaffold-ui/exports/index.ts index a7ded149b5..b1264352c1 100644 --- a/packages/scaffold-ui/exports/index.ts +++ b/packages/scaffold-ui/exports/index.ts @@ -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' diff --git a/packages/scaffold-ui/src/modal/w3m-router/index.ts b/packages/scaffold-ui/src/modal/w3m-router/index.ts index 43c16fc958..3903351a8c 100644 --- a/packages/scaffold-ui/src/modal/w3m-router/index.ts +++ b/packages/scaffold-ui/src/modal/w3m-router/index.ts @@ -103,8 +103,6 @@ export class W3mRouter extends LitElement { return html`` case 'Profile': return html`` - case 'SelectAddresses': - return html`` case 'SwitchAddress': return html`` case 'Transactions': diff --git a/packages/scaffold-ui/src/partials/w3m-header/index.ts b/packages/scaffold-ui/src/partials/w3m-header/index.ts index bbfc4290c6..29b04c2530 100644 --- a/packages/scaffold-ui/src/partials/w3m-header/index.ts +++ b/packages/scaffold-ui/src/partials/w3m-header/index.ts @@ -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', @@ -234,7 +233,7 @@ export class W3mHeader extends LitElement { return html`` diff --git a/packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts b/packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts index a267ad496d..4346f6d24e 100644 --- a/packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts +++ b/packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts @@ -71,13 +71,7 @@ export class W3mConnectingWcView extends LitElement { if (retry || CoreHelperUtil.isPairingExpired(wcPairingExpiry) || status === 'connecting') { await ConnectionController.connectWalletConnect() this.finalizeConnection() - - if ( - StorageUtil.getConnectedConnector() === 'AUTH' && - OptionsController.state.hasMultipleAddresses - ) { - RouterController.push('SelectAddresses') - } else if (!this.isSiweEnabled) { + if (!this.isSiweEnabled) { ModalController.close() } } diff --git a/packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts b/packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts index ed05a730f5..084202e630 100644 --- a/packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts +++ b/packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts @@ -5,36 +5,16 @@ import { EventsController, ConnectionController, ModalController, - RouterController, - AccountController, ChainController, OptionsController } 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 = ChainController.checkIfSmartAccountEnabled() await this.authConnector.provider.connectOtp({ otp }) EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_PASS' }) @@ -52,11 +32,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) { + if (!OptionsController.state.isSiweEnabled) { ModalController.close() } } diff --git a/packages/scaffold-ui/src/views/w3m-profile-view/index.ts b/packages/scaffold-ui/src/views/w3m-profile-view/index.ts index 05b308ceda..de125128be 100644 --- a/packages/scaffold-ui/src/views/w3m-profile-view/index.ts +++ b/packages/scaffold-ui/src/views/w3m-profile-view/index.ts @@ -143,7 +143,7 @@ export class W3mProfileView extends LitElement { : html` this.onSwitchAccount(account)} >Switch { - this.allAccounts = allAccounts - }) - } - - // -- Render -------------------------------------------- // - public override render() { - return html` - - - - - Select all - - - - ${this.allAccounts.map(account => this.getAddressTemplate(account))} - - - - Cancel - - - ${this.isApproving ? 'Signing...' : 'Continue'} - - - ` - } - - // -- Private ------------------------------------------- // - - private getAddressTemplate = (account: AccountType) => { - const checked = this.selectedAccounts.some(_account => _account.address === account.address) - - return html` - - ` - } - - private onSelectAll = (event: Event) => { - const checked = (event.target as HTMLInputElement).checked - this.selectAll = this.selectedAccounts.length === this.allAccounts.length - this.allAccounts.forEach(account => { - this.onSelect(account, checked) - }) - } - - private onSelect = (account: AccountType, add: boolean) => { - if (add) { - this.selectedAccounts.push(account) - } else { - this.selectedAccounts = this.selectedAccounts.filter(a => a.address !== account.address) - } - if (this.selectedAccounts.length > 0) { - this.selectAll = this.selectedAccounts.length === this.allAccounts.length - } - } - - private handleClick(account: AccountType) { - return (event: Event) => { - const target = event.target as HTMLInputElement - this.onSelect?.({ ...account }, target?.checked) - } - } - - private onContinue() { - if (this.selectedAccounts.length > 0) { - this.isApproving = true - AccountController.setAllAccounts(this.selectedAccounts, ChainController.state.activeChain) - AccountController.setShouldUpdateToAddress( - this.selectedAccounts[0]?.address ?? '', - ChainController.state.activeChain - ) - this.approved = true - this.isApproving = false - ModalController.close() - } else { - this.onCancel() - } - } - - private async onCancel() { - const { activeCaipAddress } = ChainController.state - if (activeCaipAddress) { - await ConnectionController.disconnect() - ModalController.close() - } else { - RouterController.push('Connect') - } - } - public override disconnectedCallback() { - super.disconnectedCallback() - if (!this.approved) { - this.onCancel() - } - } -} - -declare global { - interface HTMLElementTagNameMap { - 'w3m-select-addresses-view': W3mSelectAddressesView - } -} diff --git a/packages/scaffold-ui/src/views/w3m-select-addresses-view/styles.ts b/packages/scaffold-ui/src/views/w3m-select-addresses-view/styles.ts deleted file mode 100644 index 0a60778245..0000000000 --- a/packages/scaffold-ui/src/views/w3m-select-addresses-view/styles.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { css } from 'lit' - -export default css` - input[type='checkbox'] { - all: revert; - width: var(--wui-spacing-xl); - height: var(--wui-spacing-xl); - accent-color: var(--wui-color-accent-100); - } -`