@web3modal/core
Advanced tools
Comparing version 5.0.11-57abd61b5.0 to 5.0.11
@@ -1,9 +0,9 @@ | ||
import { proxy, ref } from 'valtio'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { BlockchainApiController } from './BlockchainApiController.js'; | ||
import { SnackController } from './SnackController.js'; | ||
import { SwapController } from './SwapController.js'; | ||
import { SwapApiUtil } from '../utils/SwapApiUtil.js'; | ||
import { BlockchainApiController } from './BlockchainApiController.js'; | ||
import { ChainController } from './ChainController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { SnackController } from './SnackController.js'; | ||
import { SwapController } from './SwapController.js'; | ||
import { proxy, ref } from 'valtio'; | ||
const state = proxy({ | ||
@@ -10,0 +10,0 @@ isConnected: false, |
@@ -208,12 +208,15 @@ import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
]; | ||
if (OptionsController.state.enableAnalytics === undefined) { | ||
promises.push(ApiController.fetchAnalyticsConfig()); | ||
} | ||
state.prefetchPromise = Promise.race([Promise.allSettled(promises), CoreHelperUtil.wait(3000)]); | ||
}, | ||
async fetchProjectConfig() { | ||
const { isAnalyticsEnabled, isAppKitAuthEnabled } = await api.get({ | ||
async fetchAnalyticsConfig() { | ||
const { isAnalyticsEnabled } = await api.get({ | ||
path: '/getAnalyticsConfig', | ||
headers: ApiController._getApiHeaders() | ||
}); | ||
return { isAnalyticsEnabled, isAppKitAuthEnabled }; | ||
OptionsController.setEnableAnalytics(isAnalyticsEnabled); | ||
} | ||
}; | ||
//# sourceMappingURL=ApiController.js.map |
import { proxyMap, subscribeKey as subKey } from 'valtio/utils'; | ||
import { proxy, ref, subscribe as sub } from 'valtio/vanilla'; | ||
import {} from '@web3modal/common'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { AccountController } from './AccountController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { PublicStateController } from './PublicStateController.js'; | ||
import {} from '@web3modal/common'; | ||
const accountState = { | ||
@@ -8,0 +8,0 @@ isConnected: false, |
@@ -1,12 +0,12 @@ | ||
import {} from '@web3modal/wallet'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy, ref } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { StorageUtil } from '../utils/StorageUtil.js'; | ||
import { TransactionsController } from './TransactionsController.js'; | ||
import { ChainController } from './ChainController.js'; | ||
import {} from '@web3modal/wallet'; | ||
import { ModalController } from './ModalController.js'; | ||
import { ConnectorController } from './ConnectorController.js'; | ||
import { EventsController } from './EventsController.js'; | ||
import { ModalController } from './ModalController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { TransactionsController } from './TransactionsController.js'; | ||
const state = proxy({ | ||
@@ -106,5 +106,2 @@ wcError: false, | ||
}, | ||
setClientId(clientId) { | ||
state.wcClientId = clientId; | ||
}, | ||
async disconnect() { | ||
@@ -111,0 +108,0 @@ const client = this._getClient(); |
@@ -1,8 +0,8 @@ | ||
import { NetworkUtil } from '@web3modal/common'; | ||
import { proxy } from 'valtio/vanilla'; | ||
import { PublicStateController } from './PublicStateController.js'; | ||
import { EventsController } from './EventsController.js'; | ||
import { ModalController } from './ModalController.js'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { NetworkUtil } from '@web3modal/common'; | ||
import { ChainController } from './ChainController.js'; | ||
import { EventsController } from './EventsController.js'; | ||
import { ModalController } from './ModalController.js'; | ||
import { PublicStateController } from './PublicStateController.js'; | ||
const state = proxy({ | ||
@@ -9,0 +9,0 @@ supportsAllNetworks: true, |
@@ -0,3 +1,3 @@ | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { ApiController } from './ApiController.js'; | ||
@@ -65,6 +65,2 @@ const state = proxy({ | ||
}, | ||
setEnableAuth(enableAuth) { | ||
state.enableAuth = enableAuth; | ||
state.isSiweEnabled = enableAuth; | ||
}, | ||
setEIP6963Enabled(enableEIP6963) { | ||
@@ -71,0 +67,0 @@ state.enableEIP6963 = enableEIP6963; |
@@ -1,19 +0,19 @@ | ||
import { NumberUtil } from '@web3modal/common'; | ||
import { W3mFrameRpcConstants } from '@web3modal/wallet'; | ||
import { subscribeKey as subKey } from 'valtio/utils'; | ||
import { proxy, subscribe as sub } from 'valtio/vanilla'; | ||
import { AccountController } from './AccountController.js'; | ||
import { ConstantsUtil } from '../utils/ConstantsUtil.js'; | ||
import { ConnectionController } from './ConnectionController.js'; | ||
import { SwapApiUtil } from '../utils/SwapApiUtil.js'; | ||
import { SnackController } from './SnackController.js'; | ||
import { RouterController } from './RouterController.js'; | ||
import { NumberUtil } from '@web3modal/common'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { BlockchainApiController } from './BlockchainApiController.js'; | ||
import { OptionsController } from './OptionsController.js'; | ||
import { SwapCalculationUtil } from '../utils/SwapCalculationUtil.js'; | ||
import { EventsController } from './EventsController.js'; | ||
import { W3mFrameRpcConstants } from '@web3modal/wallet'; | ||
import { StorageUtil } from '../utils/StorageUtil.js'; | ||
import { SwapApiUtil } from '../utils/SwapApiUtil.js'; | ||
import { SwapCalculationUtil } from '../utils/SwapCalculationUtil.js'; | ||
import { AccountController } from './AccountController.js'; | ||
import { BlockchainApiController } from './BlockchainApiController.js'; | ||
import { ConnectionController } from './ConnectionController.js'; | ||
import { ConnectorController } from './ConnectorController.js'; | ||
import { EventsController } from './EventsController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { OptionsController } from './OptionsController.js'; | ||
import { RouterController } from './RouterController.js'; | ||
import { SnackController } from './SnackController.js'; | ||
export const INITIAL_GAS_LIMIT = 150000; | ||
@@ -20,0 +20,0 @@ export const TO_AMOUNT_DECIMALS = 6; |
@@ -450,3 +450,3 @@ import { beforeAll, describe, expect, it, vi } from 'vitest'; | ||
.mockResolvedValue(); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchProjectConfig'); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchAnalyticsConfig'); | ||
ApiController.prefetch(); | ||
@@ -469,6 +469,3 @@ expect(fetchAnalyticsSpy).not.toHaveBeenCalled(); | ||
.mockResolvedValue(); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchProjectConfig').mockResolvedValue({ | ||
isAnalyticsEnabled: true, | ||
isAppKitAuthEnabled: false | ||
}); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchAnalyticsConfig').mockResolvedValue(); | ||
ApiController.prefetch(); | ||
@@ -484,5 +481,5 @@ expect(fetchAnalyticsSpy).toHaveBeenCalledOnce(); | ||
const fetchSpy = vi.spyOn(api, 'get').mockResolvedValue({ data }); | ||
await ApiController.fetchProjectConfig(); | ||
await ApiController.fetchAnalyticsConfig(); | ||
expect(fetchSpy).toHaveBeenCalledWith({ | ||
path: '/getProjectConfig', | ||
path: '/getAnalyticsConfig', | ||
headers: ApiController._getApiHeaders() | ||
@@ -489,0 +486,0 @@ }); |
@@ -1,4 +0,5 @@ | ||
import type { Balance, Chain } from '@web3modal/common'; | ||
import type { AccountType, CaipAddress, ConnectedWalletInfo, SocialProvider } from '../utils/TypeUtil.js'; | ||
import type { Balance } from '@web3modal/common'; | ||
import type { W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { AccountType, CaipAddress, ConnectedWalletInfo, SocialProvider } from '../utils/TypeUtil.js'; | ||
import type { Chain } from '@web3modal/common'; | ||
export interface AccountControllerState { | ||
@@ -5,0 +6,0 @@ isConnected: boolean; |
@@ -42,6 +42,3 @@ import { FetchUtil } from '../utils/FetchUtil.js'; | ||
prefetch(): void; | ||
fetchProjectConfig(): Promise<{ | ||
isAnalyticsEnabled: boolean; | ||
isAppKitAuthEnabled: boolean; | ||
}>; | ||
fetchAnalyticsConfig(): Promise<void>; | ||
}; |
import type { CaipNetwork, ChainAdapter, Connector } from '../utils/TypeUtil.js'; | ||
import { type NetworkControllerState } from './NetworkController.js'; | ||
import { type AccountControllerState } from './AccountController.js'; | ||
import { type Chain } from '@web3modal/common'; | ||
import { type AccountControllerState } from './AccountController.js'; | ||
import { type NetworkControllerState } from './NetworkController.js'; | ||
export interface ChainControllerState { | ||
@@ -6,0 +6,0 @@ multiChainEnabled: boolean; |
@@ -0,4 +1,4 @@ | ||
import type { Connector, EstimateGasTransactionArgs, SendTransactionArgs, WcWallet, WriteContractArgs } from '../utils/TypeUtil.js'; | ||
import { type W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { Chain } from '@web3modal/common'; | ||
import { type W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { Connector, EstimateGasTransactionArgs, SendTransactionArgs, WcWallet, WriteContractArgs } from '../utils/TypeUtil.js'; | ||
export interface ConnectExternalOptions { | ||
@@ -36,3 +36,2 @@ id: Connector['id']; | ||
buffering: boolean; | ||
wcClientId?: string | null; | ||
} | ||
@@ -62,4 +61,3 @@ export declare const ConnectionController: { | ||
setBuffering(buffering: ConnectionControllerState['buffering']): void; | ||
setClientId(clientId: ConnectionControllerState['wcClientId']): void; | ||
disconnect(): Promise<void>; | ||
}; |
@@ -0,3 +1,3 @@ | ||
import type { CaipNetwork, CaipNetworkId } from '../utils/TypeUtil.js'; | ||
import { type Chain } from '@web3modal/common'; | ||
import type { CaipNetwork, CaipNetworkId } from '../utils/TypeUtil.js'; | ||
export interface NetworkControllerClient { | ||
@@ -4,0 +4,0 @@ switchCaipNetwork: (network: NetworkControllerState['caipNetwork']) => Promise<void>; |
@@ -21,3 +21,2 @@ import type { CustomWallet, Metadata, ProjectId, SdkVersion, Tokens } from '../utils/TypeUtil.js'; | ||
disableAppend?: boolean; | ||
enableAuth?: boolean; | ||
enableEIP6963?: boolean; | ||
@@ -45,3 +44,2 @@ enableSwaps?: boolean; | ||
setDisableAppend(disableAppend: OptionsControllerState['disableAppend']): void; | ||
setEnableAuth(enableAuth: OptionsControllerState['enableAuth']): void; | ||
setEIP6963Enabled(enableEIP6963: OptionsControllerState['enableEIP6963']): void; | ||
@@ -48,0 +46,0 @@ setHasMultipleAddresses(hasMultipleAddresses: OptionsControllerState['hasMultipleAddresses']): void; |
@@ -101,5 +101,4 @@ import type { W3mFrameProvider, W3mFrameTypes } from '@web3modal/wallet'; | ||
} | ||
export interface ApiGetProjectConfigResponse { | ||
export interface ApiGetAnalyticsConfigResponse { | ||
isAnalyticsEnabled: boolean; | ||
isAppKitAuthEnabled: boolean; | ||
} | ||
@@ -106,0 +105,0 @@ export type ThemeMode = 'dark' | 'light'; |
{ | ||
"name": "@web3modal/core", | ||
"version": "5.0.11-57abd61b5.0", | ||
"version": "5.0.11", | ||
"type": "module", | ||
@@ -13,4 +13,4 @@ "main": "./dist/esm/index.js", | ||
"valtio": "1.11.2", | ||
"@web3modal/common": "5.0.11-57abd61b5.0", | ||
"@web3modal/wallet": "5.0.11-57abd61b5.0" | ||
"@web3modal/common": "5.0.11", | ||
"@web3modal/wallet": "5.0.11" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
741299
0
7714
+ Added@web3modal/common@5.0.11(transitive)
+ Added@web3modal/polyfills@5.0.11(transitive)
+ Added@web3modal/wallet@5.0.11(transitive)
- Removed@web3modal/common@5.0.11-57abd61b5.0(transitive)
- Removed@web3modal/polyfills@5.0.11-57abd61b5.0(transitive)
- Removed@web3modal/wallet@5.0.11-57abd61b5.0(transitive)
Updated@web3modal/common@5.0.11
Updated@web3modal/wallet@5.0.11