@web3modal/core
Advanced tools
Comparing version 5.1.3 to 5.1.4-8d342a50c
@@ -0,9 +1,9 @@ | ||
import { proxy, ref } from 'valtio'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.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 { SwapApiUtil } from '../utils/SwapApiUtil.js'; | ||
import { ChainController } from './ChainController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { proxy, ref } from 'valtio'; | ||
// -- State --------------------------------------------- // | ||
@@ -137,4 +137,7 @@ const state = proxy({ | ||
ChainController.resetAccount(chain); | ||
}, | ||
setSiweStatus(status) { | ||
ChainController.setAccountProp('siweStatus', status, ChainController.state.activeChain); | ||
} | ||
}; | ||
//# sourceMappingURL=AccountController.js.map |
@@ -0,3 +1,3 @@ | ||
import { proxy } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy } from 'valtio/vanilla'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
@@ -212,15 +212,12 @@ import { FetchUtil } from '../utils/FetchUtil.js'; | ||
]; | ||
if (OptionsController.state.enableAnalytics === undefined) { | ||
promises.push(ApiController.fetchAnalyticsConfig()); | ||
} | ||
state.prefetchPromise = Promise.race([Promise.allSettled(promises)]); | ||
state.prefetchPromise = Promise.allSettled(promises); | ||
}, | ||
async fetchAnalyticsConfig() { | ||
const { isAnalyticsEnabled } = await api.get({ | ||
async fetchProjectConfig() { | ||
const { isAnalyticsEnabled, isAppKitAuthEnabled } = await api.get({ | ||
path: '/getAnalyticsConfig', | ||
headers: ApiController._getApiHeaders() | ||
}); | ||
OptionsController.setEnableAnalytics(isAnalyticsEnabled); | ||
return { isAnalyticsEnabled, isAppKitAuthEnabled }; | ||
} | ||
}; | ||
//# 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 { AccountController } from './AccountController.js'; | ||
import { NetworkController } from './NetworkController.js'; | ||
import { AccountController } from './AccountController.js'; | ||
import { PublicStateController } from './PublicStateController.js'; | ||
import {} from '@web3modal/common'; | ||
// -- Constants ----------------------------------------- // | ||
@@ -8,0 +8,0 @@ const accountState = { |
@@ -0,12 +1,12 @@ | ||
import {} from '@web3modal/wallet'; | ||
import { proxy, ref } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy, ref } from 'valtio/vanilla'; | ||
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'; | ||
// -- State --------------------------------------------- // | ||
@@ -108,2 +108,5 @@ const state = proxy({ | ||
}, | ||
setClientId(clientId) { | ||
state.wcClientId = clientId; | ||
}, | ||
async disconnect() { | ||
@@ -113,3 +116,2 @@ const client = this._getClient(); | ||
await client.disconnect(); | ||
StorageUtil.removeConnectedWalletImageUrl(); | ||
this.resetWcConnection(); | ||
@@ -116,0 +118,0 @@ } |
@@ -0,7 +1,7 @@ | ||
import { NetworkUtil } from '@web3modal/common'; | ||
import { proxy, ref } from 'valtio/vanilla'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { ChainController } from './ChainController.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 { PublicStateController } from './PublicStateController.js'; | ||
@@ -8,0 +8,0 @@ // -- State --------------------------------------------- // |
@@ -0,3 +1,3 @@ | ||
import { proxy } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy } from 'valtio/vanilla'; | ||
import { ApiController } from './ApiController.js'; | ||
@@ -70,2 +70,8 @@ // -- State --------------------------------------------- // | ||
}, | ||
setEnableAuth(enableAuth) { | ||
state.enableAuth = enableAuth; | ||
if (enableAuth) { | ||
state.isSiweEnabled = enableAuth; | ||
} | ||
}, | ||
setEIP6963Enabled(enableEIP6963) { | ||
@@ -72,0 +78,0 @@ state.enableEIP6963 = enableEIP6963; |
@@ -0,3 +1,3 @@ | ||
import { proxy } from 'valtio/vanilla'; | ||
import { subscribeKey as subKey } from 'valtio/vanilla/utils'; | ||
import { proxy } from 'valtio/vanilla'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
@@ -8,3 +8,4 @@ // -- State --------------------------------------------- // | ||
variant: 'success', | ||
open: false | ||
open: false, | ||
durationMs: 2500 | ||
}); | ||
@@ -17,13 +18,19 @@ // -- Controller ---------------------------------------- // | ||
}, | ||
showLoading(message) { | ||
showLoading(message, durationMs) { | ||
state.message = message; | ||
state.variant = 'loading'; | ||
state.open = true; | ||
if (durationMs) { | ||
state.durationMs = durationMs; | ||
} | ||
}, | ||
showSuccess(message) { | ||
showSuccess(message, durationMs) { | ||
state.message = message; | ||
state.variant = 'success'; | ||
state.open = true; | ||
if (durationMs) { | ||
state.durationMs = durationMs; | ||
} | ||
}, | ||
showError(message) { | ||
showError(message, durationMs) { | ||
const errorMessage = CoreHelperUtil.parseError(message); | ||
@@ -33,2 +40,5 @@ state.message = errorMessage; | ||
state.open = true; | ||
if (durationMs) { | ||
state.durationMs = durationMs; | ||
} | ||
}, | ||
@@ -35,0 +45,0 @@ hide() { |
@@ -0,19 +1,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 { ConstantsUtil } from '../utils/ConstantsUtil.js'; | ||
import { CoreHelperUtil } from '../utils/CoreHelperUtil.js'; | ||
import { StorageUtil } from '../utils/StorageUtil.js'; | ||
import { SwapApiUtil } from '../utils/SwapApiUtil.js'; | ||
import { SwapCalculationUtil } from '../utils/SwapCalculationUtil.js'; | ||
import { AccountController } from './AccountController.js'; | ||
import { ConstantsUtil } from '../utils/ConstantsUtil.js'; | ||
import { BlockchainApiController } from './BlockchainApiController.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 { ConnectorController } from './ConnectorController.js'; | ||
import { EventsController } from './EventsController.js'; | ||
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 { ConnectorController } from './ConnectorController.js'; | ||
import { RouterController } from './RouterController.js'; | ||
import { SnackController } from './SnackController.js'; | ||
// -- Constants ---------------------------------------- // | ||
@@ -20,0 +20,0 @@ export const INITIAL_GAS_LIMIT = 150000; |
// -- Helpers ----------------------------------------------------------------- | ||
const WC_DEEPLINK = 'WALLETCONNECT_DEEPLINK_CHOICE'; | ||
const W3M_RECENT = '@w3m/recent'; | ||
const W3M_CONNECTED_WALLET_IMAGE_URL = '@w3m/connected_wallet_image_url'; | ||
const W3M_CONNECTED_CONNECTOR = '@w3m/connected_connector'; | ||
@@ -64,27 +63,2 @@ const W3M_CONNECTED_SOCIAL = '@w3m/connected_social'; | ||
}, | ||
setConnectedWalletImageUrl(imageUrl) { | ||
try { | ||
localStorage.setItem(W3M_CONNECTED_WALLET_IMAGE_URL, imageUrl); | ||
} | ||
catch { | ||
console.info('Unable to set Connected Wallet Image Url'); | ||
} | ||
}, | ||
removeConnectedWalletImageUrl() { | ||
try { | ||
localStorage.removeItem(W3M_CONNECTED_WALLET_IMAGE_URL); | ||
} | ||
catch { | ||
console.info('Unable to remove Connected Wallet Image Url'); | ||
} | ||
}, | ||
getConnectedWalletImageUrl() { | ||
try { | ||
return localStorage.getItem(W3M_CONNECTED_WALLET_IMAGE_URL); | ||
} | ||
catch { | ||
console.info('Unable to set Connected Wallet Image Url'); | ||
} | ||
return undefined; | ||
}, | ||
setConnectedConnector(connectorType) { | ||
@@ -91,0 +65,0 @@ try { |
@@ -471,3 +471,3 @@ import { beforeAll, describe, expect, it, vi } from 'vitest'; | ||
.mockResolvedValue(); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchAnalyticsConfig'); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchProjectConfig'); | ||
ApiController.prefetch(); | ||
@@ -490,3 +490,6 @@ expect(fetchAnalyticsSpy).not.toHaveBeenCalled(); | ||
.mockResolvedValue(); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchAnalyticsConfig').mockResolvedValue(); | ||
const fetchAnalyticsSpy = vi.spyOn(ApiController, 'fetchProjectConfig').mockResolvedValue({ | ||
isAnalyticsEnabled: true, | ||
isAppKitAuthEnabled: false | ||
}); | ||
ApiController.prefetch(); | ||
@@ -503,5 +506,5 @@ expect(fetchAnalyticsSpy).toHaveBeenCalledOnce(); | ||
const fetchSpy = vi.spyOn(api, 'get').mockResolvedValue({ data }); | ||
await ApiController.fetchAnalyticsConfig(); | ||
await ApiController.fetchProjectConfig(); | ||
expect(fetchSpy).toHaveBeenCalledWith({ | ||
path: '/getAnalyticsConfig', | ||
path: '/getProjectConfig', | ||
headers: ApiController._getApiHeaders() | ||
@@ -508,0 +511,0 @@ }); |
@@ -0,5 +1,4 @@ | ||
import type { Balance, Chain } from '@web3modal/common'; | ||
import type { W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { AccountType, CaipAddress, ConnectedWalletInfo, SocialProvider } from '../utils/TypeUtil.js'; | ||
import type { Balance } from '@web3modal/common'; | ||
import type { W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { Chain } from '@web3modal/common'; | ||
export interface AccountControllerState { | ||
@@ -25,2 +24,3 @@ isConnected: boolean; | ||
farcasterUrl?: string; | ||
siweStatus?: string; | ||
} | ||
@@ -53,2 +53,3 @@ export declare const AccountController: { | ||
resetAccount(chain: Chain): void; | ||
setSiweStatus(status: AccountControllerState['siweStatus']): void; | ||
}; |
@@ -42,3 +42,6 @@ import { FetchUtil } from '../utils/FetchUtil.js'; | ||
prefetch(): void; | ||
fetchAnalyticsConfig(): Promise<void>; | ||
fetchProjectConfig(): Promise<{ | ||
isAnalyticsEnabled: boolean; | ||
isAppKitAuthEnabled: boolean; | ||
}>; | ||
}; |
import type { CaipNetwork, ChainAdapter, Connector } from '../utils/TypeUtil.js'; | ||
import { type Chain } from '@web3modal/common'; | ||
import { type AccountControllerState } from './AccountController.js'; | ||
import { type NetworkControllerState } from './NetworkController.js'; | ||
import { type AccountControllerState } from './AccountController.js'; | ||
import { type Chain } from '@web3modal/common'; | ||
export interface ChainControllerState { | ||
@@ -6,0 +6,0 @@ activeChain: Chain | undefined; |
@@ -0,4 +1,4 @@ | ||
import type { Chain } from '@web3modal/common'; | ||
import { type W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { Connector, EstimateGasTransactionArgs, SendTransactionArgs, WcWallet, WriteContractArgs } from '../utils/TypeUtil.js'; | ||
import { type W3mFrameTypes } from '@web3modal/wallet'; | ||
import type { Chain } from '@web3modal/common'; | ||
export interface ConnectExternalOptions { | ||
@@ -36,2 +36,3 @@ id: Connector['id']; | ||
buffering: boolean; | ||
wcClientId?: string | null; | ||
} | ||
@@ -61,3 +62,4 @@ export declare const ConnectionController: { | ||
setBuffering(buffering: ConnectionControllerState['buffering']): void; | ||
setClientId(clientId: ConnectionControllerState['wcClientId']): void; | ||
disconnect(): Promise<void>; | ||
}; |
@@ -0,3 +1,3 @@ | ||
import { type Chain } from '@web3modal/common'; | ||
import type { CaipNetwork, CaipNetworkId } from '../utils/TypeUtil.js'; | ||
import { type Chain } from '@web3modal/common'; | ||
export interface NetworkControllerClient { | ||
@@ -4,0 +4,0 @@ switchCaipNetwork: (network: NetworkControllerState['caipNetwork']) => Promise<void>; |
@@ -79,2 +79,3 @@ import type { CustomWallet, Metadata, ProjectId, SdkVersion, Tokens } from '../utils/TypeUtil.js'; | ||
disableAppend?: boolean; | ||
enableAuth?: boolean; | ||
/** | ||
@@ -113,2 +114,3 @@ * Enable or disable the EIP6963 feature in your AppKit. | ||
setDisableAppend(disableAppend: OptionsControllerState['disableAppend']): void; | ||
setEnableAuth(enableAuth: OptionsControllerState['enableAuth']): void; | ||
setEIP6963Enabled(enableEIP6963: OptionsControllerState['enableEIP6963']): void; | ||
@@ -115,0 +117,0 @@ setHasMultipleAddresses(hasMultipleAddresses: OptionsControllerState['hasMultipleAddresses']): void; |
@@ -5,2 +5,3 @@ export interface SnackControllerState { | ||
open: boolean; | ||
durationMs: number; | ||
} | ||
@@ -10,6 +11,6 @@ export declare const SnackController: { | ||
subscribeKey<K extends keyof SnackControllerState>(key: K, callback: (value: SnackControllerState[K]) => void): () => void; | ||
showLoading(message: SnackControllerState['message']): void; | ||
showSuccess(message: SnackControllerState['message']): void; | ||
showError(message: unknown): void; | ||
showLoading(message: SnackControllerState['message'], durationMs?: SnackControllerState['durationMs']): void; | ||
showSuccess(message: SnackControllerState['message'], durationMs?: SnackControllerState['durationMs']): void; | ||
showError(message: unknown, durationMs?: SnackControllerState['durationMs']): void; | ||
hide(): void; | ||
}; |
@@ -11,5 +11,2 @@ import type { WcWallet, ConnectorType, SocialProvider } from './TypeUtil.js'; | ||
getRecentWallets(): WcWallet[]; | ||
setConnectedWalletImageUrl(imageUrl: string): void; | ||
removeConnectedWalletImageUrl(): void; | ||
getConnectedWalletImageUrl(): string | null | undefined; | ||
setConnectedConnector(connectorType: ConnectorType): void; | ||
@@ -16,0 +13,0 @@ getConnectedConnector(): ConnectorType | undefined; |
@@ -102,4 +102,5 @@ import type { W3mFrameProvider, W3mFrameTypes } from '@web3modal/wallet'; | ||
} | ||
export interface ApiGetAnalyticsConfigResponse { | ||
export interface ApiGetProjectConfigResponse { | ||
isAnalyticsEnabled: boolean; | ||
isAppKitAuthEnabled: boolean; | ||
} | ||
@@ -106,0 +107,0 @@ export type ThemeMode = 'dark' | 'light'; |
{ | ||
"name": "@web3modal/core", | ||
"version": "5.1.3", | ||
"version": "5.1.4-8d342a50c", | ||
"type": "module", | ||
@@ -13,4 +13,4 @@ "main": "./dist/esm/index.js", | ||
"valtio": "1.11.2", | ||
"@web3modal/common": "5.1.3", | ||
"@web3modal/wallet": "5.1.3" | ||
"@web3modal/wallet": "5.1.4-8d342a50c", | ||
"@web3modal/common": "5.1.4-8d342a50c" | ||
}, | ||
@@ -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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8247
708284
1
+ Added@web3modal/common@5.1.4-8d342a50c(transitive)
+ Added@web3modal/polyfills@5.1.4-8d342a50c(transitive)
+ Added@web3modal/wallet@5.1.4-8d342a50c(transitive)
- Removed@web3modal/common@5.1.3(transitive)
- Removed@web3modal/polyfills@5.1.3(transitive)
- Removed@web3modal/wallet@5.1.3(transitive)