Socket
Socket
Sign inDemoInstall

@web3modal/core

Package Overview
Dependencies
Maintainers
11
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/core - npm Package Compare versions

Comparing version 4.1.11 to 4.1.12-910a844.0

2

dist/esm/src/controllers/ApiController.js

@@ -156,3 +156,3 @@ import { subscribeKey as subKey } from 'valtio/vanilla/utils';

entries: '100',
search,
search: search?.trim(),
chains: NetworkController.state.caipNetwork?.id,

@@ -159,0 +159,0 @@ include: includeWalletIds?.join(','),

import { subscribeKey as subKey } from 'valtio/vanilla/utils';
import { proxy, ref, snapshot } from 'valtio/vanilla';
import { getW3mThemeVariables } from '@web3modal/common';
import { OptionsController } from './OptionsController.js';

@@ -21,2 +22,4 @@ import { ThemeController } from './ThemeController.js';

const optionsState = snapshot(OptionsController.state);
const themeMode = ThemeController.getSnapshot().themeMode;
const themeVariables = ThemeController.getSnapshot().themeVariables;
emailConnector?.provider?.syncDappData?.({

@@ -28,4 +31,5 @@ metadata: optionsState.metadata,

emailConnector.provider.syncTheme({
themeMode: ThemeController.getSnapshot().themeMode,
themeVariables: ThemeController.getSnapshot().themeVariables
themeMode,
themeVariables,
w3mThemeVariables: getW3mThemeVariables(themeVariables, themeMode)
});

@@ -32,0 +36,0 @@ }

import { proxy, subscribe as sub, snapshot } from 'valtio/vanilla';
import { ConnectorController } from './ConnectorController.js';
import { getW3mThemeVariables } from '@web3modal/common';
const state = proxy({
themeMode: 'dark',
themeVariables: {}
themeVariables: {},
w3mThemeVariables: undefined
});

@@ -17,4 +19,7 @@ export const ThemeController = {

if (emailConnector) {
const themeVariables = ThemeController.getSnapshot().themeVariables;
emailConnector.provider.syncTheme({
themeMode: ThemeController.getSnapshot().themeMode
themeMode,
themeVariables,
w3mThemeVariables: getW3mThemeVariables(themeVariables, themeMode)
});

@@ -32,4 +37,6 @@ }

if (emailConnector) {
const themeVariablesSnapshot = ThemeController.getSnapshot().themeVariables;
emailConnector.provider.syncTheme({
themeVariables: ThemeController.getSnapshot().themeVariables
themeVariables: themeVariablesSnapshot,
w3mThemeVariables: getW3mThemeVariables(state.themeVariables, state.themeMode)
});

@@ -36,0 +43,0 @@ }

@@ -314,2 +314,78 @@ import { describe, expect, it, vi } from 'vitest';

});
it('should search wallet with search term', async () => {
const includeWalletIds = ['12341', '12342'];
const excludeWalletIds = ['12343'];
let data = [
{
id: '12341',
name: 'MetaMask',
image_id: '12341'
}
];
OptionsController.setIncludeWalletIds(includeWalletIds);
OptionsController.setExcludeWalletIds(excludeWalletIds);
let fetchSpy = vi.spyOn(api, 'get').mockResolvedValue({ data });
const fetchImageSpy = vi.spyOn(ApiController, '_fetchWalletImage').mockResolvedValue();
await ApiController.searchWallet({ search: 'MetaMask ' });
expect(fetchSpy).toHaveBeenCalledWith({
path: '/getWallets',
headers: ApiController._getApiHeaders(),
params: {
page: '1',
entries: '100',
search: 'MetaMask',
include: '12341,12342',
exclude: '12343'
}
});
expect(fetchImageSpy).toHaveBeenCalledOnce();
expect(ApiController.state.search).toEqual(data);
await ApiController.searchWallet({ search: ' Metamask' });
expect(fetchSpy).toHaveBeenCalledWith({
path: '/getWallets',
headers: ApiController._getApiHeaders(),
params: {
page: '1',
entries: '100',
search: 'MetaMask',
include: '12341,12342',
exclude: '12343'
}
});
expect(ApiController.state.search).toEqual(data);
await ApiController.searchWallet({ search: ' Metamask ' });
expect(fetchSpy).toHaveBeenCalledWith({
path: '/getWallets',
headers: ApiController._getApiHeaders(),
params: {
page: '1',
entries: '100',
search: 'MetaMask',
include: '12341,12342',
exclude: '12343'
}
});
expect(ApiController.state.search).toEqual(data);
data = [
{
id: '12341',
name: 'Safe Wallet',
image_id: '12341'
}
];
fetchSpy = vi.spyOn(api, 'get').mockResolvedValue({ data });
await ApiController.searchWallet({ search: 'Safe Wallet' });
expect(fetchSpy).toHaveBeenCalledWith({
path: '/getWallets',
headers: ApiController._getApiHeaders(),
params: {
page: '1',
entries: '100',
search: 'Safe Wallet',
include: '12341,12342',
exclude: '12343'
}
});
expect(ApiController.state.search).toEqual(data);
});
it('should prefetch without analytics', () => {

@@ -316,0 +392,0 @@ OptionsController.state.enableAnalytics = false;

import { describe, expect, it, vi } from 'vitest';
import { ConnectorController, OptionsController } from '../../index.js';
import { getW3mThemeVariables } from '@web3modal/common';
const emailProvider = {

@@ -84,3 +85,7 @@ syncDappData: (_args) => Promise.resolve(),

expect(syncDappDataSpy).toHaveBeenCalledWith(mockDappData);
expect(syncThemeSpy).toHaveBeenCalledWith({ themeMode: 'dark', themeVariables: {} });
expect(syncThemeSpy).toHaveBeenCalledWith({
themeMode: 'dark',
themeVariables: {},
w3mThemeVariables: getW3mThemeVariables({}, 'dark')
});
});

@@ -87,0 +92,0 @@ it('getEmailConnector() should return emailconnector when already added', () => {

import type { ThemeMode, ThemeVariables } from '../utils/TypeUtil.js';
import type { W3mThemeVariables } from '@web3modal/common';
export interface ThemeControllerState {
themeMode: ThemeMode;
themeVariables: ThemeVariables;
w3mThemeVariables: W3mThemeVariables | undefined;
}

@@ -22,3 +24,7 @@ export declare const ThemeController: {

};
readonly w3mThemeVariables: {
readonly '--w3m-accent': string;
readonly '--w3m-background': string;
} | undefined;
};
};
{
"name": "@web3modal/core",
"version": "4.1.11",
"version": "4.1.12-910a844.0",
"type": "module",

@@ -20,4 +20,4 @@ "main": "./dist/esm/index.js",

"dependencies": {
"@web3modal/common": "4.1.11",
"@web3modal/wallet": "4.1.11",
"@web3modal/common": "4.1.12-910a844.0",
"@web3modal/wallet": "4.1.12-910a844.0",
"valtio": "1.11.2"

@@ -24,0 +24,0 @@ },

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