New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More β†’
Socket
Sign inDemoInstall
Socket

@web3modal/scaffold

Package Overview
Dependencies
Maintainers
6
Versions
245
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/scaffold - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0-598ec14

dist/esm/src/partials/w3m-connecting-wc-browser/index.js

3

dist/esm/index.js

@@ -12,2 +12,3 @@ export * from './src/modal/w3m-account-button/index.js';

export * from './src/views/w3m-connecting-wc-view/index.js';
export * from './src/views/w3m-downloads-view/index.js';
export * from './src/views/w3m-get-wallet-view/index.js';

@@ -21,4 +22,4 @@ export * from './src/views/w3m-network-switch-view/index.js';

export * from './src/partials/w3m-connecting-header/index.js';
export * from './src/partials/w3m-connecting-wc-browser/index.js';
export * from './src/partials/w3m-connecting-wc-desktop/index.js';
export * from './src/partials/w3m-connecting-wc-injected/index.js';
export * from './src/partials/w3m-connecting-wc-mobile/index.js';

@@ -25,0 +26,0 @@ export * from './src/partials/w3m-connecting-wc-qrcode/index.js';

@@ -1,2 +0,2 @@

import { AccountController, ApiController, BlockchainApiController, ConnectionController, ConnectorController, CoreHelperUtil, ModalController, NetworkController, OptionsController, PublicStateController, ThemeController } from '@web3modal/core';
import { AccountController, BlockchainApiController, ConnectionController, ConnectorController, CoreHelperUtil, EventsController, ModalController, NetworkController, OptionsController, PublicStateController, ThemeController } from '@web3modal/core';
import { setColorTheme, setThemeVariables } from '@web3modal/ui';

@@ -42,2 +42,3 @@ let isInitialized = false;

};
this.getConnectors = () => ConnectorController.getConnectors();
this.resetWcConnection = () => {

@@ -84,2 +85,8 @@ ConnectionController.resetWcConnection();

}
getEvent() {
return { ...EventsController.state };
}
subscribeEvents(callback) {
return EventsController.subscribe(callback);
}
initControllers(options) {

@@ -96,4 +103,5 @@ NetworkController.setClient(options.networkControllerClient);

OptionsController.setCustomWallets(options.customWallets);
OptionsController.setEnableAnalytics(options.enableAnalytics);
OptionsController.setSdkVersion(options._sdkVersion);
ConnectionController.setClient(options.connectionControllerClient);
ApiController.setSdkVersion(options._sdkVersion);
if (options.themeMode) {

@@ -100,0 +108,0 @@ ThemeController.setThemeMode(options.themeMode);

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { AccountController, AssetController, CoreHelperUtil, ModalController, NetworkController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ let W3mAccountButton = class W3mAccountButton extends LitElement {

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { AccountController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ let W3mButton = class W3mButton extends LitElement {

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { ModalController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ let W3mConnectButton = class W3mConnectButton extends LitElement {

@@ -7,6 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ApiController, ModalController, SnackController, ThemeController } from '@web3modal/core';
import { UiHelperUtil, initializeTheming } from '@web3modal/ui';
import { ApiController, EventsController, ModalController, SnackController, ThemeController } from '@web3modal/core';
import { UiHelperUtil, customElement, initializeTheming } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import styles from './styles.js';

@@ -23,2 +23,3 @@ const SCROLL_LOCK = 'scroll-lock';

this.unsubscribe.push(ModalController.subscribeKey('open', val => (val ? this.onOpen() : this.onClose())));
EventsController.sendEvent({ type: 'track', event: 'MODAL_LOADED' });
}

@@ -25,0 +26,0 @@ disconnectedCallback() {

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { AccountController, AssetUtil, ModalController, NetworkController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ let W3mNetworkButton = class W3mNetworkButton extends LitElement {

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import styles from './styles.js';

@@ -66,2 +67,4 @@ let W3mRouter = class W3mRouter extends LitElement {

return html `<w3m-get-wallet-view></w3m-get-wallet-view>`;
case 'Downloads':
return html `<w3m-downloads-view></w3m-downloads-view>`;
default:

@@ -68,0 +71,0 @@ return html `<w3m-connect-view></w3m-connect-view>`;

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { ApiController, AssetUtil, ConnectorController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ import styles from './styles.js';

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { ApiController, AssetUtil, ConnectorController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ import styles from './styles.js';

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { ConnectionController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { property, state } from 'lit/decorators.js';
let W3mConnectingHeader = class W3mConnectingHeader extends LitElement {

@@ -38,4 +39,4 @@ constructor() {

const tabs = this.platforms.map(platform => {
if (platform === 'injected') {
return { label: 'Browser', icon: 'extension', platform: 'injected' };
if (platform === 'browser') {
return { label: 'Browser', icon: 'extension', platform: 'browser' };
}

@@ -42,0 +43,0 @@ else if (platform === 'mobile') {

@@ -7,4 +7,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, CoreHelperUtil } from '@web3modal/core';
import { customElement } from 'lit/decorators.js';
import { ConnectionController, CoreHelperUtil, EventsController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { W3mConnectingWidget } from '../../utils/w3m-connecting-widget/index.js';

@@ -19,2 +19,7 @@ let W3mConnectingWcDesktop = class W3mConnectingWcDesktop extends W3mConnectingWidget {

this.onRender = this.onRenderProxy.bind(this);
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: this.wallet.name, platform: 'desktop' }
});
}

@@ -21,0 +26,0 @@ onRenderProxy() {

@@ -7,4 +7,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, CoreHelperUtil } from '@web3modal/core';
import { customElement } from 'lit/decorators.js';
import { ConnectionController, CoreHelperUtil, EventsController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { W3mConnectingWidget } from '../../utils/w3m-connecting-widget/index.js';

@@ -20,2 +20,7 @@ let W3mConnectingWcMobile = class W3mConnectingWcMobile extends W3mConnectingWidget {

document.addEventListener('visibilitychange', this.onBuffering.bind(this));
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: this.wallet.name, platform: 'mobile' }
});
}

@@ -22,0 +27,0 @@ disconnectedCallback() {

@@ -7,5 +7,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { AssetUtil, ConnectionController, ThemeController } from '@web3modal/core';
import { AssetUtil, ConnectionController, EventsController, ThemeController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { html } from 'lit';
import { customElement } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -21,2 +21,7 @@ import { W3mConnectingWidget } from '../../utils/w3m-connecting-widget/index.js';

window.addEventListener('resize', this.forceUpdate);
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: this.wallet?.name ?? 'WalletConnect', platform: 'qrcode' }
});
}

@@ -37,6 +42,6 @@ disconnectedCallback() {

<wui-button variant="fullWidth" @click=${this.onCopyUri}>
<wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
<wui-link @click=${this.onCopyUri} color="fg-200">
<wui-icon size="sm" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
Copy Link
</wui-button>
</wui-link>
</wui-flex>

@@ -43,0 +48,0 @@

@@ -7,15 +7,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { AssetUtil, CoreHelperUtil, RouterController } from '@web3modal/core';
import { AssetUtil, EventsController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
let W3mConnectingWcUnsupported = class W3mConnectingWcUnsupported extends LitElement {
constructor() {
super(...arguments);
super();
this.wallet = RouterController.state.data?.wallet;
}
render() {
if (!this.wallet) {
throw new Error('w3m-connecting-wc-unsupported: No wallet provided');
}
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: this.wallet.name, platform: 'browser' }
});
}
render() {
return html `

@@ -25,3 +30,3 @@ <wui-flex

alignItems="center"
.padding=${['3xl', 'xl', '3xl', 'xl']}
.padding=${['3xl', 'xl', 'xl', 'xl']}
gap="xl"

@@ -34,32 +39,8 @@ >

<wui-flex flexDirection="column" alignItems="center" gap="xxs">
<wui-text variant="paragraph-500" color="fg-100">Not Detected</wui-text>
<wui-text variant="small-500" color="fg-200" align="center">
Download and install ${this.wallet.name} to continue
</wui-text>
</wui-flex>
<wui-text variant="paragraph-500" color="fg-100">Not Detected</wui-text>
</wui-flex>
${this.downloadBtnTemplate()}
</wui-flex>
<w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
`;
}
downloadBtnTemplate() {
if (!this.wallet) {
throw new Error('w3m-connecting-wc-unsupported:onDownload No wallet provided');
}
const { homepage } = this.wallet;
if (!homepage) {
return null;
}
return html `
<wui-button
size="sm"
variant="fill"
@click=${() => CoreHelperUtil.openHref(homepage, '_blank')}
>
<wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
Download
</wui-button>
`;
}
};

@@ -66,0 +47,0 @@ W3mConnectingWcUnsupported = __decorate([

@@ -7,4 +7,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, CoreHelperUtil } from '@web3modal/core';
import { customElement } from 'lit/decorators.js';
import { ConnectionController, CoreHelperUtil, EventsController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { W3mConnectingWidget } from '../../utils/w3m-connecting-widget/index.js';

@@ -21,2 +21,7 @@ let W3mConnectingWcWeb = class W3mConnectingWcWeb extends W3mConnectingWidget {

this.secondaryBtnIcon = 'externalLink';
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: this.wallet.name, platform: 'web' }
});
}

@@ -23,0 +28,0 @@ onConnectProxy() {

@@ -7,5 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, ModalController, RouterController } from '@web3modal/core';
import { ConnectionController, EventsController, ModalController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import styles from './styles.js';

@@ -27,3 +28,4 @@ function headings() {

WhatIsAWallet: 'What is a wallet?',
GetWallet: 'Get a Wallet'
GetWallet: 'Get a Wallet',
Downloads: name ? `Get ${name}` : 'Downloads'
};

@@ -59,2 +61,6 @@ }

}
onWalletHelp() {
EventsController.sendEvent({ type: 'track', event: 'CLICK_WALLET_HELP' });
RouterController.push('WhatIsAWallet');
}
titleTemplate() {

@@ -78,3 +84,3 @@ return html `<wui-text variant="paragraph-700" color="fg-100">${this.heading}</wui-text>`;

icon="helpCircle"
@click=${() => RouterController.push('WhatIsAWallet')}
@click=${this.onWalletHelp.bind(this)}
></wui-icon-link>`;

@@ -81,0 +87,0 @@ }

@@ -7,4 +7,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { property } from 'lit/decorators.js';
let W3mHelpWidget = class W3mHelpWidget extends LitElement {

@@ -11,0 +12,0 @@ constructor() {

@@ -8,4 +8,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { OptionsController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
import styles from './styles.js';

@@ -12,0 +12,0 @@ let W3mLegalFooter = class W3mLegalFooter extends LitElement {

@@ -7,5 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { CoreHelperUtil } from '@web3modal/core';
import { CoreHelperUtil, RouterController } from '@web3modal/core';
import { UiHelperUtil, customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { property } from 'lit/decorators.js';
import styles from './styles.js';

@@ -22,59 +23,47 @@ let W3mMobileDownloadLinks = class W3mMobileDownloadLinks extends LitElement {

}
const { app_store, play_store } = this.wallet;
const { name, app_store, play_store, homepage } = this.wallet;
const isMobile = CoreHelperUtil.isMobile();
const isIos = CoreHelperUtil.isIos();
const isAndroid = CoreHelperUtil.isAndroid();
if (app_store && play_store && !isMobile) {
const isMultiple = [app_store, play_store, homepage].filter(Boolean).length > 1;
const shortName = UiHelperUtil.getTruncateString({
string: name,
charsStart: 12,
charsEnd: 0,
truncate: 'end'
});
if (isMultiple && !isMobile) {
return html `
<wui-separator></wui-separator>
<wui-flex gap="xs">
<wui-list-item
variant="icon"
icon="appStore"
iconVariant="square"
@click=${this.onAppStore.bind(this)}
>
<wui-text variant="paragraph-500" color="fg-100">App Store</wui-text>
</wui-list-item>
<wui-list-item
variant="icon"
icon="playStore"
iconVariant="square"
@click=${this.onPlayStore.bind(this)}
>
<wui-text variant="paragraph-500" color="fg-100">Play Store</wui-text>
</wui-list-item>
</wui-flex>
<wui-cta-button
label=${`Don't have ${shortName}?`}
buttonLabel="Get"
@click=${() => RouterController.push('Downloads', { wallet: this.wallet })}
></wui-cta-button>
`;
}
if (app_store && !isAndroid) {
if (!isMultiple && homepage) {
return html `
<wui-separator></wui-separator>
<wui-list-item
variant="icon"
icon="appStore"
iconVariant="square"
chevron
<wui-cta-button
label=${`Don't have ${shortName}?`}
buttonLabel="Get"
@click=${this.onHomePage.bind(this)}
></wui-cta-button>
`;
}
if (app_store && isIos) {
return html `
<wui-cta-button
label=${`Don't have ${shortName}?`}
buttonLabel="Get"
@click=${this.onAppStore.bind(this)}
>
<wui-text variant="paragraph-500" color="fg-100">Get the app</wui-text>
</wui-list-item>
></wui-cta-button>
`;
}
if (play_store && !isIos) {
if (play_store && isAndroid) {
return html `
<wui-separator></wui-separator>
<wui-list-item
variant="icon"
icon="playStore"
iconVariant="square"
chevron
<wui-cta-button
label=${`Don't have ${shortName}?`}
buttonLabel="Get"
@click=${this.onPlayStore.bind(this)}
>
<wui-text variant="paragraph-500" color="fg-100">Get the app</wui-text>
</wui-list-item>
></wui-cta-button>
`;

@@ -95,2 +84,7 @@ }

}
onHomePage() {
if (this.wallet?.homepage) {
CoreHelperUtil.openHref(this.wallet.homepage, '_blank');
}
}
};

@@ -97,0 +91,0 @@ W3mMobileDownloadLinks.styles = [styles];

@@ -7,12 +7,3 @@ import { css } from 'lit';

}
wui-separator {
width: calc(100% + var(--wui-spacing-xl) * 2);
margin: 0 calc(var(--wui-spacing-xl) * -1) var(--wui-spacing-xl);
}
wui-list-item {
flex: 1;
}
`;
//# sourceMappingURL=styles.js.map

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { SnackController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import styles from './styles.js';

@@ -12,0 +13,0 @@ const presets = {

@@ -75,3 +75,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

alignItems="center"
.padding=${['3xl', 'xl', '3xl', 'xl']}
.padding=${['3xl', 'xl', 'xl', 'xl']}
gap="xl"

@@ -114,13 +114,12 @@ >

? html `
<wui-flex .padding=${['0', 'xl', 'xl', 'xl']}>
<wui-button variant="fullWidth" @click=${this.onCopyUri}>
<wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
<wui-flex .padding=${['0', 'xl', 'xl', 'xl']} justifyContent="center">
<wui-link @click=${this.onCopyUri} color="fg-200">
<wui-icon size="sm" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
Copy Link
</wui-button>
</wui-link>
</wui-flex>
`
: null}
${this.isMobile
? html `<w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>`
: null}
<w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
`;

@@ -127,0 +126,0 @@ }

@@ -52,7 +52,7 @@ import { css } from 'lit';

[data-retry='false'] wui-button {
[data-retry='false'] wui-link {
display: none;
}
[data-retry='true'] wui-button {
[data-retry='true'] wui-link {
display: block;

@@ -59,0 +59,0 @@ opacity: 1;

@@ -7,6 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { AccountController, AssetController, ConnectionController, CoreHelperUtil, ModalController, NetworkController, RouterController, SnackController } from '@web3modal/core';
import { UiHelperUtil } from '@web3modal/ui';
import { AccountController, AssetController, ConnectionController, CoreHelperUtil, EventsController, ModalController, NetworkController, RouterController, SnackController } from '@web3modal/core';
import { UiHelperUtil, customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -70,4 +70,14 @@ import styles from './styles.js';

${this.profileName
? UiHelperUtil.getTruncateString(this.profileName, 20, 'end')
: UiHelperUtil.getTruncateString(this.address, 8, 'middle')}
? UiHelperUtil.getTruncateString({
string: this.profileName,
charsStart: 20,
charsEnd: 0,
truncate: 'end'
})
: UiHelperUtil.getTruncateString({
string: this.address,
charsStart: 4,
charsEnd: 6,
truncate: 'middle'
})}
</wui-text>

@@ -97,3 +107,3 @@ <wui-icon-link

imageSrc=${ifDefined(networkImage)}
?chevron=${this.isMultiNetwork()}
?chevron=${this.isAllowedNetworkSwitch()}
@click=${this.onNetworks.bind(this)}

@@ -131,5 +141,7 @@ >

}
isMultiNetwork() {
isAllowedNetworkSwitch() {
const { requestedCaipNetworks } = NetworkController.state;
return requestedCaipNetworks ? requestedCaipNetworks.length > 1 : false;
const isMultiNetwork = requestedCaipNetworks ? requestedCaipNetworks.length > 1 : false;
const isValidNetwork = requestedCaipNetworks?.find(({ id }) => id === this.network?.id);
return isMultiNetwork || !isValidNetwork;
}

@@ -148,3 +160,3 @@ onCopyAddress() {

onNetworks() {
if (this.isMultiNetwork()) {
if (this.isAllowedNetworkSwitch()) {
RouterController.push('Networks');

@@ -157,5 +169,7 @@ }

await ConnectionController.disconnect();
EventsController.sendEvent({ type: 'track', event: 'DISCONNECT_SUCCESS' });
ModalController.close();
}
catch {
EventsController.sendEvent({ type: 'track', event: 'DISCONNECT_ERROR' });
SnackController.showError('Failed to disconnect');

@@ -162,0 +176,0 @@ }

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { CoreHelperUtil, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
let W3mAllWalletsView = class W3mAllWalletsView extends LitElement {

@@ -12,0 +13,0 @@ constructor() {

@@ -7,5 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ApiController, AssetUtil, ConnectionController, ConnectorController, CoreHelperUtil, OptionsController, RouterController, StorageUtil } from '@web3modal/core';
import { ApiController, AssetUtil, ConnectionController, ConnectorController, CoreHelperUtil, EventsController, OptionsController, RouterController, StorageUtil } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -58,3 +59,3 @@ import styles from './styles.js';

}
const wallets = this.filterOutRecentWallets(customWallets);
const wallets = this.filterOutDuplicateWallets(customWallets);
return wallets.map(wallet => html `

@@ -64,3 +65,3 @@ <wui-list-wallet

name=${wallet.name ?? 'Unknown'}
@click=${() => RouterController.push('ConnectingWalletConnect', { wallet })}
@click=${() => this.onConnectWallet(wallet)}
>

@@ -75,3 +76,3 @@ </wui-list-wallet>

}
const wallets = this.filterOutRecentWallets(featured);
const wallets = this.filterOutDuplicateWallets(featured);
return wallets.map(wallet => html `

@@ -81,3 +82,3 @@ <wui-list-wallet

name=${wallet.name ?? 'Unknown'}
@click=${() => RouterController.push('ConnectingWalletConnect', { wallet })}
@click=${() => this.onConnectWallet(wallet)}
>

@@ -93,3 +94,3 @@ </wui-list-wallet>

name=${wallet.name ?? 'Unknown'}
@click=${() => RouterController.push('ConnectingWalletConnect', { wallet })}
@click=${() => this.onConnectWallet(wallet)}
tagLabel="recent"

@@ -103,3 +104,3 @@ tagVariant="shade"

return this.connectors.map(connector => {
if (connector.type !== 'EIP6963') {
if (connector.type !== 'ANNOUNCED') {
return null;

@@ -120,3 +121,3 @@ }

injectedTemplate() {
const announced = this.connectors.find(c => c.type === 'EIP6963');
const announced = this.connectors.find(c => c.type === 'ANNOUNCED');
return this.connectors.map(connector => {

@@ -126,3 +127,3 @@ if (connector.type !== 'INJECTED') {

}
if (!ConnectionController.checkInjectedInstalled()) {
if (!ConnectionController.checkInstalled()) {
return null;

@@ -144,3 +145,3 @@ }

return this.connectors.map(connector => {
if (['WALLET_CONNECT', 'INJECTED', 'EIP6963'].includes(connector.type)) {
if (['WALLET_CONNECT', 'INJECTED', 'ANNOUNCED'].includes(connector.type)) {
return null;

@@ -165,3 +166,3 @@ }

showAllWallets
@click=${() => RouterController.push('AllWallets')}
@click=${this.onAllWallets.bind(this)}
tagLabel=${`${roundedCount}+`}

@@ -173,15 +174,13 @@ tagVariant="shade"

recommendedTemplate() {
const { recommended, featured } = ApiController.state;
const { customWallets } = OptionsController.state;
const { recommended } = ApiController.state;
const { customWallets, featuredWalletIds } = OptionsController.state;
const { connectors } = ConnectorController.state;
const recent = StorageUtil.getRecentWallets();
const eip6963 = connectors.filter(c => c.type === 'EIP6963');
if (!recommended.length) {
const eip6963 = connectors.filter(c => c.type === 'ANNOUNCED');
if (featuredWalletIds || customWallets || !recommended.length) {
return null;
}
const featuredLength = featured?.length ?? 0;
const customLength = customWallets?.length ?? 0;
const overrideLength = featuredLength + customLength + eip6963.length + recent.length;
const overrideLength = eip6963.length + recent.length;
const maxRecommended = Math.max(0, 2 - overrideLength);
const wallets = this.filterOutRecentWallets(recommended).slice(0, maxRecommended);
const wallets = this.filterOutDuplicateWallets(recommended).slice(0, maxRecommended);
return wallets.map(wallet => html `

@@ -191,3 +190,3 @@ <wui-list-wallet

name=${wallet?.name ?? 'Unknown'}
@click=${() => RouterController.push('ConnectingWalletConnect', { wallet })}
@click=${() => this.onConnectWallet(wallet)}
>

@@ -210,8 +209,17 @@ </wui-list-wallet>

}
filterOutRecentWallets(wallets) {
filterOutDuplicateWallets(wallets) {
const { connectors } = ConnectorController.state;
const recent = StorageUtil.getRecentWallets();
const recentIds = recent.map(wallet => wallet.id);
const filtered = wallets.filter(wallet => !recentIds.includes(wallet.id));
const rdnsIds = connectors.map(c => c.info?.rdns).filter(Boolean);
const filtered = wallets.filter(wallet => !recentIds.includes(wallet.id) && !rdnsIds.includes(wallet.rdns ?? undefined));
return filtered;
}
onAllWallets() {
EventsController.sendEvent({ type: 'track', event: 'CLICK_ALL_WALLETS' });
RouterController.push('AllWallets');
}
onConnectWallet(wallet) {
RouterController.push('ConnectingWalletConnect', { wallet });
}
};

@@ -218,0 +226,0 @@ W3mConnectView.styles = styles;

@@ -7,5 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, ModalController } from '@web3modal/core';
import { customElement } from 'lit/decorators.js';
import { ConnectionController, EventsController, ModalController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { W3mConnectingWidget } from '../../utils/w3m-connecting-widget/index.js';
const platformMap = {
INJECTED: 'browser',
ANNOUNCED: 'browser'
};
let W3mConnectingExternalView = class W3mConnectingExternalView extends W3mConnectingWidget {

@@ -17,2 +21,10 @@ constructor() {

}
EventsController.sendEvent({
type: 'track',
event: 'SELECT_WALLET',
properties: {
name: this.connector.name ?? 'Unknown',
platform: platformMap[this.connector.type] ?? 'external'
}
});
this.onConnect = this.onConnectProxy.bind(this);

@@ -28,5 +40,15 @@ this.onAutoConnect = this.onConnectProxy.bind(this);

ModalController.close();
EventsController.sendEvent({
type: 'track',
event: 'CONNECT_SUCCESS',
properties: { method: 'external' }
});
}
}
catch {
catch (error) {
EventsController.sendEvent({
type: 'track',
event: 'CONNECT_ERROR',
properties: { message: error?.message ?? 'Unknown' }
});
this.error = true;

@@ -33,0 +55,0 @@ }

@@ -7,5 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ConnectionController, ConnectorController, ConstantsUtil, CoreHelperUtil, ModalController, RouterController, SnackController, StorageUtil } from '@web3modal/core';
import { ConnectionController, ConstantsUtil, CoreHelperUtil, EventsController, ModalController, RouterController, SnackController, StorageUtil } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
let W3mConnectingWcView = class W3mConnectingWcView extends LitElement {

@@ -41,7 +42,12 @@ constructor() {

await ConnectionController.state.wcPromise;
this.storeWalletConnectDeeplink();
this.finalizeConnection();
ModalController.close();
}
}
catch {
catch (error) {
EventsController.sendEvent({
type: 'track',
event: 'CONNECT_ERROR',
properties: { message: error?.message ?? 'Unknown' }
});
ConnectionController.setWcError(true);

@@ -55,3 +61,3 @@ if (CoreHelperUtil.isAllowedRetry(this.lastRetry)) {

}
storeWalletConnectDeeplink() {
finalizeConnection() {
const { wcLinking, recentWallet } = ConnectionController.state;

@@ -64,2 +70,9 @@ if (wcLinking) {

}
EventsController.sendEvent({
type: 'track',
event: 'CONNECT_SUCCESS',
properties: {
method: wcLinking ? 'mobile' : 'qrcode'
}
});
}

@@ -73,14 +86,13 @@ determinePlatforms() {

}
const { connectors } = ConnectorController.state;
const { mobile_link, desktop_link, webapp_link, injected } = this.wallet;
const injectedIds = injected?.map(({ injected_id }) => injected_id).filter(Boolean) ?? [];
const isInjected = injectedIds.length;
const { mobile_link, desktop_link, webapp_link, injected, rdns } = this.wallet;
const injectedIds = injected?.map(({ injected_id }) => injected_id).filter(Boolean);
const browserIds = rdns ? [rdns] : injectedIds ?? [];
const isBrowser = browserIds.length;
const isMobileWc = mobile_link;
const isWebWc = webapp_link;
const isInjectedConnector = connectors.find(c => c.type === 'INJECTED');
const isInjectedInstalled = ConnectionController.checkInjectedInstalled(injectedIds);
const isInjectedWc = isInjected && isInjectedInstalled && isInjectedConnector;
const isBrowserInstalled = ConnectionController.checkInstalled(browserIds);
const isBrowserWc = isBrowser && isBrowserInstalled;
const isDesktopWc = desktop_link && !CoreHelperUtil.isMobile();
if (isInjectedWc) {
this.platforms.push('injected');
if (isBrowserWc) {
this.platforms.push('browser');
}

@@ -96,3 +108,3 @@ if (isMobileWc) {

}
if (!isInjectedWc && isInjected) {
if (!isBrowserWc && isBrowser) {
this.platforms.push('unsupported');

@@ -104,4 +116,4 @@ }

switch (this.platform) {
case 'injected':
return html `<w3m-connecting-wc-injected></w3m-connecting-wc-injected>`;
case 'browser':
return html `<w3m-connecting-wc-browser></w3m-connecting-wc-browser>`;
case 'desktop':

@@ -108,0 +120,0 @@ return html `

@@ -8,4 +8,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { ApiController, AssetUtil, CoreHelperUtil, OptionsController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +12,0 @@ const EXPLORER = 'https://walletconnect.com/explorer';

@@ -8,4 +8,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { AssetUtil, NetworkController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -12,0 +13,0 @@ import styles from './styles.js';

@@ -7,5 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { AccountController, AssetUtil, NetworkController, RouterController } from '@web3modal/core';
import { AccountController, AssetUtil, EventsController, NetworkController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

@@ -34,3 +35,3 @@ let W3mNetworksView = class W3mNetworksView extends LitElement {

</wui-text>
<wui-link @click=${() => RouterController.push('WhatIsANetwork')}>
<wui-link @click=${this.onNetworkHelp.bind(this)}>
<wui-icon size="xs" color="accent-100" slot="iconLeft" name="helpCircle"></wui-icon>

@@ -42,2 +43,6 @@ What is a network

}
onNetworkHelp() {
EventsController.sendEvent({ type: 'track', event: 'CLICK_NETWORK_HELP' });
RouterController.push('WhatIsANetwork');
}
networksTemplate() {

@@ -44,0 +49,0 @@ const { approvedCaipNetworkIds, requestedCaipNetworks, supportsAllNetworks } = NetworkController.state;

@@ -8,4 +8,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { CoreHelperUtil } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
const data = [

@@ -12,0 +12,0 @@ {

@@ -7,5 +7,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { RouterController } from '@web3modal/core';
import { EventsController, RouterController } from '@web3modal/core';
import { customElement } from '@web3modal/ui';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
const data = [

@@ -38,3 +38,3 @@ {

<w3m-help-widget .data=${data}></w3m-help-widget>
<wui-button variant="fill" size="sm" @click=${() => RouterController.push('GetWallet')}>
<wui-button variant="fill" size="sm" @click=${this.onGetWallet.bind(this)}>
<wui-icon color="inherit" slot="iconLeft" name="wallet"></wui-icon>

@@ -46,2 +46,6 @@ Get a Wallet

}
onGetWallet() {
EventsController.sendEvent({ type: 'track', event: 'CLICK_GET_WALLET' });
RouterController.push('GetWallet');
}
};

@@ -48,0 +52,0 @@ W3mWhatIsAWalletView = __decorate([

@@ -12,2 +12,3 @@ export * from './src/modal/w3m-account-button/index.js';

export * from './src/views/w3m-connecting-wc-view/index.js';
export * from './src/views/w3m-downloads-view/index.js';
export * from './src/views/w3m-get-wallet-view/index.js';

@@ -21,4 +22,4 @@ export * from './src/views/w3m-network-switch-view/index.js';

export * from './src/partials/w3m-connecting-header/index.js';
export * from './src/partials/w3m-connecting-wc-browser/index.js';
export * from './src/partials/w3m-connecting-wc-desktop/index.js';
export * from './src/partials/w3m-connecting-wc-injected/index.js';
export * from './src/partials/w3m-connecting-wc-mobile/index.js';

@@ -25,0 +26,0 @@ export * from './src/partials/w3m-connecting-wc-qrcode/index.js';

@@ -1,2 +0,2 @@

import type { ApiControllerState, ConnectionControllerClient, NetworkControllerClient, NetworkControllerState, OptionsControllerState, PublicStateControllerState, ThemeControllerState, ThemeMode, ThemeVariables } from '@web3modal/core';
import type { ConnectionControllerClient, EventsControllerState, NetworkControllerClient, NetworkControllerState, OptionsControllerState, PublicStateControllerState, ThemeControllerState, ThemeMode, ThemeVariables } from '@web3modal/core';
import { AccountController, BlockchainApiController, ConnectionController, ConnectorController, NetworkController } from '@web3modal/core';

@@ -15,3 +15,4 @@ export interface LibraryOptions {

customWallets?: OptionsControllerState['customWallets'];
_sdkVersion: ApiControllerState['sdkVersion'];
enableAnalytics?: OptionsControllerState['enableAnalytics'];
_sdkVersion: OptionsControllerState['sdkVersion'];
}

@@ -40,2 +41,7 @@ export interface ScaffoldOptions extends LibraryOptions {

subscribeState(callback: (newState: PublicStateControllerState) => void): () => void;
getEvent(): {
timestamp: number;
data: import("@web3modal/core").Event;
};
subscribeEvents(callback: (newEvent: EventsControllerState) => void): () => void;
protected setIsConnected: (typeof AccountController)['setIsConnected'];

@@ -54,2 +60,3 @@ protected setCaipAddress: (typeof AccountController)['setCaipAddress'];

protected addConnector: (typeof ConnectorController)['addConnector'];
protected getConnectors: (typeof ConnectorController)['getConnectors'];
protected resetWcConnection: (typeof ConnectionController)['resetWcConnection'];

@@ -56,0 +63,0 @@ protected fetchIdentity: (typeof BlockchainApiController)['fetchIdentity'];

import { LitElement } from 'lit';
export declare class W3mConnectingWcUnsupported extends LitElement {
private readonly wallet;
constructor();
render(): import("lit-html").TemplateResult<1>;
private downloadBtnTemplate;
}

@@ -7,0 +7,0 @@ declare global {

@@ -11,2 +11,3 @@ import { LitElement } from 'lit';

render(): import("lit-html").TemplateResult<1>;
private onWalletHelp;
private titleTemplate;

@@ -13,0 +14,0 @@ private dynamicButtonTemplate;

@@ -9,2 +9,3 @@ import type { WcWallet } from '@web3modal/core';

private onPlayStore;
private onHomePage;
}

@@ -11,0 +12,0 @@ declare global {

@@ -17,3 +17,3 @@ import { LitElement } from 'lit';

private explorerBtnTemplate;
private isMultiNetwork;
private isAllowedNetworkSwitch;
private onCopyAddress;

@@ -20,0 +20,0 @@ private onNetworks;

@@ -19,3 +19,5 @@ import { LitElement } from 'lit';

private onConnector;
private filterOutRecentWallets;
private filterOutDuplicateWallets;
private onAllWallets;
private onConnectWallet;
}

@@ -22,0 +24,0 @@ declare global {

@@ -12,3 +12,3 @@ import { LitElement } from 'lit';

private initializeConnection;
private storeWalletConnectDeeplink;
private finalizeConnection;
private determinePlatforms;

@@ -15,0 +15,0 @@ private platformTemplate;

@@ -9,2 +9,3 @@ import type { CaipNetwork } from '@web3modal/core';

render(): import("lit-html").TemplateResult<1>;
private onNetworkHelp;
private networksTemplate;

@@ -11,0 +12,0 @@ private onSwitchNetwork;

import { LitElement } from 'lit';
export declare class W3mWhatIsAWalletView extends LitElement {
render(): import("lit-html").TemplateResult<1>;
private onGetWallet;
}

@@ -5,0 +6,0 @@ declare global {

{
"name": "@web3modal/scaffold",
"version": "3.0.2",
"version": "3.1.0-598ec14",
"type": "module",

@@ -19,5 +19,5 @@ "main": "./dist/esm/index.js",

"dependencies": {
"@web3modal/core": "3.0.2",
"@web3modal/ui": "3.0.2",
"lit": "2.8.0"
"@web3modal/core": "3.1.0-598ec14",
"@web3modal/ui": "3.1.0-598ec14",
"lit": "3.0.0"
},

@@ -24,0 +24,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc