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

@web3modal/wagmi

Package Overview
Dependencies
Maintainers
6
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/wagmi - npm Package Compare versions

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6

8

dist/esm/exports/index.js

@@ -1,4 +0,8 @@

export { Web3Modal } from '../src/client.js';
export { defaultWagmiConfig as defaultConfig } from '../src/utils/defaultWagmiCoreConfig.js';
import { Web3Modal } from '../src/client.js';
import { VERSION } from '../src/utils/constants.js';
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
export { walletConnectProvider } from '../src/utils/provider.js';
export function createWeb3Modal(options) {
return new Web3Modal({ ...options, _sdkVersion: `html-wagmi-${VERSION}` });
}
//# sourceMappingURL=index.js.map

@@ -12,2 +12,3 @@ 'use client';

}
export { defaultWagmiConfig } from '../src/utils/defaultWagmiReactConfig.js';
export function useWeb3ModalTheme() {

@@ -53,3 +54,2 @@ if (!modal) {

}
export { defaultWagmiConfig } from '../src/utils/defaultWagmiReactConfig.js';
//# sourceMappingURL=react.js.map

@@ -11,2 +11,3 @@ import { onUnmounted, ref } from 'vue';

}
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
export function useWeb3ModalTheme() {

@@ -53,3 +54,2 @@ if (!modal) {

}
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
//# sourceMappingURL=vue.js.map
import { connect, disconnect, fetchBalance, fetchEnsAvatar, fetchEnsName, getAccount, getNetwork, switchNetwork, watchAccount, watchNetwork } from '@wagmi/core';
import { mainnet } from '@wagmi/core/chains';
import { Web3ModalScaffold } from '@web3modal/scaffold';
import { ADD_CHAIN_METHOD, INJECTED_CONNECTOR_ID, NAMESPACE, VERSION, WALLET_CHOICE_KEY, WALLET_CONNECT_CONNECTOR_ID } from './utils/constants.js';
import { getCaipDefaultChain } from './utils/helpers.js';
import { ADD_CHAIN_METHOD, NAMESPACE, VERSION, WALLET_CHOICE_KEY, WALLET_CONNECT_CONNECTOR_ID } from './utils/constants.js';
import { getCaipDefaultChain, getCaipTokens } from './utils/helpers.js';
import { ConnectorExplorerIds, ConnectorImageIds, ConnectorNamesMap, ConnectorTypesMap, NetworkImageIds } from './utils/presets.js';
export class Web3Modal extends Web3ModalScaffold {
constructor(options) {
const { wagmiConfig, chains, defaultChain, _sdkVersion, ...w3mOptions } = options;
const { wagmiConfig, chains, defaultChain, _sdkVersion, tokens, ...w3mOptions } = options;
if (!wagmiConfig) {

@@ -68,10 +68,2 @@ throw new Error('web3modal:constructor - wagmiConfig is undefined');

},
connectInjected: async () => {
const connector = wagmiConfig.connectors.find(c => c.id === INJECTED_CONNECTOR_ID);
if (!connector) {
throw new Error('connectionControllerClient:connectInjected - connector is undefined');
}
const chainId = this.caipNetworkIdToNumber(this.getCaipNetwork()?.id);
await connect({ connector, chainId });
},
checkInjectedInstalled(ids) {

@@ -92,2 +84,3 @@ if (!window?.ethereum) {

defaultChain: getCaipDefaultChain(defaultChain),
tokens: getCaipTokens(tokens),
_sdkVersion: _sdkVersion ?? `html-wagmi-${VERSION}`,

@@ -97,2 +90,4 @@ ...w3mOptions

this.hasSyncedConnectedAccount = false;
this.options = undefined;
this.options = options;
this.syncRequestedNetworks(chains);

@@ -126,3 +121,3 @@ this.syncConnectors(wagmiConfig.connectors);

}
else if (!isConnected) {
else if (!isConnected && this.hasSyncedConnectedAccount) {
this.resetWcConnection();

@@ -173,3 +168,7 @@ this.resetNetwork();

async syncBalance(address, chain) {
const balance = await fetchBalance({ address, chainId: chain.id });
const balance = await fetchBalance({
address,
chainId: chain.id,
token: this.options?.tokens?.[chain.id]?.address
});
this.setBalance(balance.formatted, balance.symbol);

@@ -176,0 +175,0 @@ }

@@ -11,3 +11,3 @@ export const WALLET_CONNECT_CONNECTOR_ID = 'walletConnect';

export const BLOCKCHAIN_WSS_API = 'wss://rpc.walletconnect.com';
export const VERSION = '3.0.0-alpha.5';
export const VERSION = '3.0.0-alpha.6';
//# sourceMappingURL=constants.js.map

@@ -13,2 +13,12 @@ import { NAMESPACE } from './constants.js';

}
export function getCaipTokens(tokens) {
if (!tokens) {
return undefined;
}
const caipTokens = {};
Object.entries(tokens).forEach(([id, token]) => {
caipTokens[`${NAMESPACE}:${id}`] = token;
});
return caipTokens;
}
//# sourceMappingURL=helpers.js.map

@@ -28,3 +28,3 @@ import { COINBASE_CONNECTOR_ID, INJECTED_CONNECTOR_ID, LEDGER_CONNECTOR_ID, SAFE_CONNECTOR_ID, WALLET_CONNECT_CONNECTOR_ID } from './constants.js';

[WALLET_CONNECT_CONNECTOR_ID]: 'ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400',
[INJECTED_CONNECTOR_ID]: 'b2e6085e-8306-47fd-1a87-14bbd434f400'
[INJECTED_CONNECTOR_ID]: '07ba87ed-43aa-4adf-4540-9e6a2b9cae00'
};

@@ -31,0 +31,0 @@ export const ConnectorExplorerIds = {

@@ -1,4 +0,6 @@

export { Web3Modal } from '../src/client.js';
import type { Web3ModalOptions } from '../src/client.js';
import { Web3Modal } from '../src/client.js';
export type { Web3ModalOptions } from '../src/client.js';
export { defaultWagmiConfig as defaultConfig } from '../src/utils/defaultWagmiCoreConfig.js';
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
export { walletConnectProvider } from '../src/utils/provider.js';
export declare function createWeb3Modal(options: Web3ModalOptions): Web3Modal;

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

import type { W3mAccountButton, W3mButton, W3mConnectButton, W3mNetworkButton } from '@web3modal/scaffold';
import type { Web3ModalOptions } from '../src/client.js';

@@ -7,6 +8,17 @@ import { Web3Modal } from '../src/client.js';

type ThemeVariablesOptions = Parameters<Web3Modal['setThemeVariables']>[0];
declare global {
namespace JSX {
interface IntrinsicElements {
'w3m-connect-button': Pick<W3mConnectButton, 'size' | 'label' | 'loadingLabel'>;
'w3m-account-button': Pick<W3mAccountButton, 'disabled' | 'balance'>;
'w3m-button': Pick<W3mButton, 'size' | 'label' | 'loadingLabel' | 'disabled' | 'balance'>;
'w3m-network-button': Pick<W3mNetworkButton, 'disabled'>;
}
}
}
export declare function createWeb3Modal(options: Web3ModalOptions): Web3Modal;
export { defaultWagmiConfig } from '../src/utils/defaultWagmiReactConfig.js';
export declare function useWeb3ModalTheme(): {
themeMode: "dark" | "light";
themeVariables: import("packages/core/dist/types/index.js").ThemeVariables;
themeVariables: import("@web3modal/scaffold").ThemeVariables;
setThemeMode: (themeMode: ThemeModeOptions) => void;

@@ -19,2 +31,1 @@ setThemeVariables: (themeVariables: ThemeVariablesOptions) => void;

};
export { defaultWagmiConfig } from '../src/utils/defaultWagmiReactConfig.js';

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

import type { ThemeMode } from '@web3modal/scaffold';
import type { ThemeMode, W3mAccountButton, W3mButton, W3mConnectButton, W3mNetworkButton } from '@web3modal/scaffold';
import type { Web3ModalOptions } from '../src/client.js';

@@ -8,3 +8,12 @@ import { Web3Modal } from '../src/client.js';

type ThemeVariablesOptions = Parameters<Web3Modal['setThemeVariables']>[0];
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
W3mConnectButton: Pick<W3mConnectButton, 'size' | 'label' | 'loadingLabel'>;
W3mAccountButton: Pick<W3mAccountButton, 'disabled' | 'balance'>;
W3mButton: Pick<W3mButton, 'size' | 'label' | 'loadingLabel' | 'disabled' | 'balance'>;
W3mNetworkButton: Pick<W3mNetworkButton, 'disabled'>;
}
}
export declare function createWeb3Modal(options: Web3ModalOptions): Web3Modal;
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
export declare function useWeb3ModalTheme(): import("vue").Ref<{

@@ -28,2 +37,1 @@ setThemeMode: (themeMode: ThemeModeOptions) => void;

}>;
export { defaultWagmiConfig } from '../src/utils/defaultWagmiCoreConfig.js';
import type { Chain, Config } from '@wagmi/core';
import type { LibraryOptions } from '@web3modal/scaffold';
import type { LibraryOptions, Token } from '@web3modal/scaffold';
import { Web3ModalScaffold } from '@web3modal/scaffold';
export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultChain'> {
export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultChain' | 'tokens'> {
wagmiConfig: Config<any, any>;
chains?: Chain[];
defaultChain?: Chain;
tokens?: Record<number, Token>;
}

@@ -17,2 +18,3 @@ export type Web3ModalOptions = Omit<Web3ModalClientOptions, '_sdkVersion'>;

private hasSyncedConnectedAccount;
private options;
constructor(options: Web3ModalClientOptions);

@@ -19,0 +21,0 @@ private syncRequestedNetworks;

@@ -11,2 +11,2 @@ export declare const WALLET_CONNECT_CONNECTOR_ID = "walletConnect";

export declare const BLOCKCHAIN_WSS_API = "wss://rpc.walletconnect.com";
export declare const VERSION = "3.0.0-alpha.5";
export declare const VERSION = "3.0.0-alpha.6";

@@ -8,2 +8,2 @@ import '@web3modal/polyfills';

}
export declare function defaultWagmiConfig({ projectId, chains, appName }: ConfigOptions): import("@wagmi/core").Config<import("@wagmi/core/index-fc9ab085.js").P<import("viem").FallbackTransport>, import("@wagmi/core/index-fc9ab085.js").W<import("viem").FallbackTransport>>;
export declare function defaultWagmiConfig({ projectId, chains, appName }: ConfigOptions): import("@wagmi/core").Config<import("@wagmi/core/index-e744bbc2.js").P<import("viem").FallbackTransport>, import("@wagmi/core/index-e744bbc2.js").W<import("viem").FallbackTransport>>;
import '@web3modal/polyfills';
import type { ConfigOptions } from './defaultWagmiCoreConfig.js';
export declare function defaultWagmiConfig({ projectId, chains, appName }: ConfigOptions): import("@wagmi/core").Config<import("@wagmi/core/index-fc9ab085.js").P<import("viem").FallbackTransport>, import("@wagmi/core/index-fc9ab085.js").W<import("viem").FallbackTransport>> & {
export declare function defaultWagmiConfig({ projectId, chains, appName }: ConfigOptions): import("@wagmi/core").Config<import("@wagmi/core/index-e744bbc2.js").P<import("viem").FallbackTransport>, import("@wagmi/core/index-e744bbc2.js").W<import("viem").FallbackTransport>> & {
queryClient: import("@tanstack/query-core").QueryClient;
};

@@ -1,3 +0,4 @@

import type { Chain } from '@wagmi/core';
import type { CaipNetwork } from '@web3modal/scaffold';
export declare function getCaipDefaultChain(chain?: Chain): CaipNetwork | undefined;
import type { CaipNetwork, Tokens } from '@web3modal/scaffold';
import type { Web3ModalClientOptions } from '../client.js';
export declare function getCaipDefaultChain(chain?: Web3ModalClientOptions['defaultChain']): CaipNetwork | undefined;
export declare function getCaipTokens(tokens?: Web3ModalClientOptions['tokens']): Tokens | undefined;
{
"name": "@web3modal/wagmi",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.6",
"type": "module",

@@ -36,3 +36,3 @@ "main": "./dist/esm/exports/index.js",

"build:clean": "rm -rf dist",
"build": "npm run build:clean; tsc --build",
"build": "npm run build:clean; tsc --build; rm dist/esm/tsconfig.tsbuildinfo",
"watch": "npm run build:clean; tsc --watch",

@@ -43,4 +43,4 @@ "typecheck": "tsc --noEmit",

"dependencies": {
"@web3modal/polyfills": "3.0.0-alpha.5",
"@web3modal/scaffold": "3.0.0-alpha.5"
"@web3modal/polyfills": "3.0.0-alpha.6",
"@web3modal/scaffold": "3.0.0-alpha.6"
},

@@ -47,0 +47,0 @@ "peerDependencies": {

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