Socket
Socket
Sign inDemoInstall

@web3modal/wallet

Package Overview
Dependencies
Maintainers
11
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/wallet - npm Package Compare versions

Comparing version 4.0.11 to 4.0.12-0c59f84f.0

14

dist/esm/src/W3mFrameConstants.js
export const W3mFrameConstants = {
SECURE_SITE_SDK: 'https://secure.walletconnect.com/sdk',
SECURE_SITE_SDK: 'https://secure.web3modal.com/sdk',
APP_EVENT_KEY: '@w3m-app/',

@@ -12,2 +12,3 @@ FRAME_EVENT_KEY: '@w3m-frame/',

EMAIL: 'EMAIL',
PREFERRED_ACCOUNT_TYPE: 'PREFERRED_ACCOUNT_TYPE',
APP_SWITCH_NETWORK: '@w3m-app/SWITCH_NETWORK',

@@ -28,2 +29,5 @@ APP_CONNECT_EMAIL: '@w3m-app/CONNECT_EMAIL',

APP_SYNC_DAPP_DATA: '@w3m-app/SYNC_DAPP_DATA',
APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS: '@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS',
APP_INIT_SMART_ACCOUNT: '@w3m-app/INIT_SMART_ACCOUNT',
APP_SET_PREFERRED_ACCOUNT: '@w3m-app/SET_PREFERRED_ACCOUNT',
FRAME_SWITCH_NETWORK_ERROR: '@w3m-frame/SWITCH_NETWORK_ERROR',

@@ -57,3 +61,9 @@ FRAME_SWITCH_NETWORK_SUCCESS: '@w3m-frame/SWITCH_NETWORK_SUCCESS',

FRAME_SYNC_DAPP_DATA_SUCCESS: '@w3m-frame/SYNC_DAPP_DATA_SUCCESS',
FRAME_SYNC_DAPP_DATA_ERROR: '@w3m-frame/SYNC_DAPP_DATA_ERROR'
FRAME_SYNC_DAPP_DATA_ERROR: '@w3m-frame/SYNC_DAPP_DATA_ERROR',
FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS: '@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS',
FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR: '@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR',
FRAME_INIT_SMART_ACCOUNT_SUCCESS: '@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS',
FRAME_INIT_SMART_ACCOUNT_ERROR: '@w3m-frame/INIT_SMART_ACCOUNT_ERROR',
FRAME_SET_PREFERRED_ACCOUNT_SUCCESS: '@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS',
FRAME_SET_PREFERRED_ACCOUNT_ERROR: '@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR'
};

@@ -60,0 +70,0 @@ export const W3mFrameRpcConstants = {

@@ -21,2 +21,5 @@ import { W3mFrame } from './W3mFrame.js';

this.syncDappDataResolver = undefined;
this.smartAccountEnabledNetworksResolver = undefined;
this.initSmartAccountResolver = undefined;
this.setPreferredAccountResolver = undefined;
this.w3mFrame = new W3mFrame(projectId, true);

@@ -84,2 +87,14 @@ this.w3mFrame.events.onFrameEvent(event => {

return this.onSyncDappDataError(event);
case W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:
return this.onSmartAccountEnabledNetworksSuccess(event);
case W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:
return this.onSmartAccountEnabledNetworksError(event);
case W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_SUCCESS:
return this.onInitSmartAccountSuccess(event);
case W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_ERROR:
return this.onInitSmartAccountError(event);
case W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:
return this.onPreferSmartAccountSuccess(event);
case W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_ERROR:
return this.onPreferSmartAccountError();
default:

@@ -180,2 +195,28 @@ return null;

}
async getSmartAccountEnabledNetworks() {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({
type: W3mFrameConstants.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS
});
return new Promise((resolve, reject) => {
this.smartAccountEnabledNetworksResolver = { resolve, reject };
});
}
async initSmartAccount() {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_INIT_SMART_ACCOUNT });
return new Promise((resolve, reject) => {
this.initSmartAccountResolver = { resolve, reject };
});
}
async setPreferredAccount(type) {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({
type: W3mFrameConstants.APP_SET_PREFERRED_ACCOUNT,
payload: { type }
});
return new Promise((resolve, reject) => {
this.setPreferredAccountResolver = { resolve, reject };
});
}
async connect(payload) {

@@ -254,2 +295,12 @@ const chainId = payload?.chainId ?? this.getLastUsedChainId() ?? 1;

}
onInitSmartAccount(callback) {
this.w3mFrame.events.onFrameEvent(event => {
if (event.type === W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_SUCCESS) {
callback(event.payload.isDeployed);
}
else if (event.type === W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_ERROR) {
callback(false);
}
});
}
onConnectEmailSuccess(event) {

@@ -356,2 +407,21 @@ this.connectEmailResolver?.resolve(event.payload);

}
onSmartAccountEnabledNetworksSuccess(event) {
this.smartAccountEnabledNetworksResolver?.resolve(event.payload);
}
onSmartAccountEnabledNetworksError(event) {
this.smartAccountEnabledNetworksResolver?.reject(event.payload.message);
}
onInitSmartAccountSuccess(event) {
this.initSmartAccountResolver?.resolve(event.payload);
}
onInitSmartAccountError(event) {
this.initSmartAccountResolver?.reject(event.payload.message);
}
onPreferSmartAccountSuccess(event) {
this.persistPreferredAccount(event.payload.type);
this.setPreferredAccountResolver?.resolve(undefined);
}
onPreferSmartAccountError() {
this.setPreferredAccountResolver?.reject();
}
setNewLastEmailLoginTime() {

@@ -371,3 +441,3 @@ W3mFrameStorage.set(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME, Date.now().toString());

setLastUsedChainId(chainId) {
W3mFrameStorage.set(W3mFrameConstants.LAST_USED_CHAIN_KEY, `${chainId}`);
W3mFrameStorage.set(W3mFrameConstants.LAST_USED_CHAIN_KEY, String(chainId));
}

@@ -377,3 +447,6 @@ getLastUsedChainId() {

}
persistPreferredAccount(type) {
W3mFrameStorage.set(W3mFrameConstants.PREFERRED_ACCOUNT_TYPE, type);
}
}
//# sourceMappingURL=W3mFrameProvider.js.map

@@ -50,2 +50,3 @@ import { z } from 'zod';

});
export const AppSetPreferredAccountRequest = z.object({ type: z.string() });
export const FrameConnectEmailResponse = z.object({

@@ -63,2 +64,10 @@ action: z.enum(['VERIFY_DEVICE', 'VERIFY_OTP'])

export const FrameUpdateEmailSecondaryOtpResolver = z.object({ newEmail: z.string().email() });
export const FrameGetSmartAccountEnabledNetworksResponse = z.object({
smartAccountEnabledNetworks: z.array(z.number())
});
export const FrameInitSmartAccountResponse = z.object({
address: z.string(),
isDeployed: z.boolean()
});
export const FrameSetPreferredAccountResponse = z.object({ type: z.string() });
export const RpcResponse = z.any();

@@ -219,2 +228,5 @@ export const RpcEthAccountsRequest = z.object({

.or(z.object({ type: zType('APP_GET_CHAIN_ID') }))
.or(z.object({ type: zType('APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS') }))
.or(z.object({ type: zType('APP_INIT_SMART_ACCOUNT') }))
.or(z.object({ type: zType('APP_SET_PREFERRED_ACCOUNT'), payload: AppSetPreferredAccountRequest }))
.or(z.object({

@@ -305,3 +317,21 @@ type: zType('APP_RPC_REQUEST'),

.or(z.object({ type: zType('FRAME_SYNC_DAPP_DATA_SUCCESS') }))
.or(z.object({
type: zType('FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS'),
payload: FrameGetSmartAccountEnabledNetworksResponse
}))
.or(z.object({
type: zType('FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR'),
payload: zError
}))
.or(z.object({
type: zType('FRAME_INIT_SMART_ACCOUNT_SUCCESS'),
payload: FrameInitSmartAccountResponse
}))
.or(z.object({ type: zType('FRAME_INIT_SMART_ACCOUNT_ERROR'), payload: zError }))
.or(z.object({
type: zType('FRAME_SET_PREFERRED_ACCOUNT_SUCCESS'),
payload: FrameSetPreferredAccountResponse
}))
.or(z.object({ type: zType('FRAME_SET_PREFERRED_ACCOUNT_ERROR'), payload: zError }))
};
//# sourceMappingURL=W3mFrameSchema.js.map

2

dist/esm/src/W3mFrameTypes.js
import { z } from 'zod';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcEthBlockNumber, RpcEthGetTransactionByHash, RpcEthGetBlockByNumber, RpcEthCall, RpcEthFeeHistory, RpcEthGetAccount, RpcEthGetBalance, RpcEthGetBlockyByHash, RpcUnistallFilter, RpcEthSyncing, RpcEthSendRawTransaction, RpcEthNewPendingTransactionFilter, RpcEthNewFilter, RpcEthNewBlockFilter, RpcEthMaxPriorityFeePerGas, RpcEthGetUncleCountByBlockNumber, RpcEthGetUncleCountByBlockHash, RpcEthGetTransactionReceipt, RpcEthGetTransactionCount, RpcEthGetTransactionByBlockNumberAndIndex, RpcEthGetTransactionByBlockHashAndIndex, RpcEthGetStorageAt, RpcEthGetProof, RpcEthGetLogs, RpcEthGetFilterLogs, RpcEthGetFilter, RpcEthGetCode, RcpEthGetBlockTransactionCountByNumber, RcpEthGetBlockTransactionCountByHash, RpcEthGetBlockReceipts, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResolver, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest } from './W3mFrameSchema.js';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcEthBlockNumber, RpcEthGetTransactionByHash, RpcEthGetBlockByNumber, RpcEthCall, RpcEthFeeHistory, RpcEthGetAccount, RpcEthGetBalance, RpcEthGetBlockyByHash, RpcUnistallFilter, RpcEthSyncing, RpcEthSendRawTransaction, RpcEthNewPendingTransactionFilter, RpcEthNewFilter, RpcEthNewBlockFilter, RpcEthMaxPriorityFeePerGas, RpcEthGetUncleCountByBlockNumber, RpcEthGetUncleCountByBlockHash, RpcEthGetTransactionReceipt, RpcEthGetTransactionCount, RpcEthGetTransactionByBlockNumberAndIndex, RpcEthGetTransactionByBlockHashAndIndex, RpcEthGetStorageAt, RpcEthGetProof, RpcEthGetLogs, RpcEthGetFilterLogs, RpcEthGetFilter, RpcEthGetCode, RcpEthGetBlockTransactionCountByNumber, RcpEthGetBlockTransactionCountByHash, RpcEthGetBlockReceipts, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResolver, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, FrameGetSmartAccountEnabledNetworksResponse, FrameInitSmartAccountResponse } from './W3mFrameSchema.js';
//# sourceMappingURL=W3mFrameTypes.js.map
export declare const W3mFrameConstants: {
readonly SECURE_SITE_SDK: "https://secure.walletconnect.com/sdk";
readonly SECURE_SITE_SDK: "https://secure.web3modal.com/sdk";
readonly APP_EVENT_KEY: "@w3m-app/";

@@ -12,2 +12,3 @@ readonly FRAME_EVENT_KEY: "@w3m-frame/";

readonly EMAIL: "EMAIL";
readonly PREFERRED_ACCOUNT_TYPE: "PREFERRED_ACCOUNT_TYPE";
readonly APP_SWITCH_NETWORK: "@w3m-app/SWITCH_NETWORK";

@@ -28,2 +29,5 @@ readonly APP_CONNECT_EMAIL: "@w3m-app/CONNECT_EMAIL";

readonly APP_SYNC_DAPP_DATA: "@w3m-app/SYNC_DAPP_DATA";
readonly APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS: "@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS";
readonly APP_INIT_SMART_ACCOUNT: "@w3m-app/INIT_SMART_ACCOUNT";
readonly APP_SET_PREFERRED_ACCOUNT: "@w3m-app/SET_PREFERRED_ACCOUNT";
readonly FRAME_SWITCH_NETWORK_ERROR: "@w3m-frame/SWITCH_NETWORK_ERROR";

@@ -58,2 +62,8 @@ readonly FRAME_SWITCH_NETWORK_SUCCESS: "@w3m-frame/SWITCH_NETWORK_SUCCESS";

readonly FRAME_SYNC_DAPP_DATA_ERROR: "@w3m-frame/SYNC_DAPP_DATA_ERROR";
readonly FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS: "@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS";
readonly FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR: "@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR";
readonly FRAME_INIT_SMART_ACCOUNT_SUCCESS: "@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS";
readonly FRAME_INIT_SMART_ACCOUNT_ERROR: "@w3m-frame/INIT_SMART_ACCOUNT_ERROR";
readonly FRAME_SET_PREFERRED_ACCOUNT_SUCCESS: "@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS";
readonly FRAME_SET_PREFERRED_ACCOUNT_ERROR: "@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR";
};

@@ -60,0 +70,0 @@ export declare const W3mFrameRpcConstants: {

@@ -18,2 +18,5 @@ import type { W3mFrameTypes } from './W3mFrameTypes.js';

private syncDappDataResolver;
private smartAccountEnabledNetworksResolver;
private initSmartAccountResolver;
private setPreferredAccountResolver;
constructor(projectId: string);

@@ -41,2 +44,10 @@ getLoginEmailUsed(): boolean;

syncDappData(payload: W3mFrameTypes.Requests['AppSyncDappDataRequest']): Promise<unknown>;
getSmartAccountEnabledNetworks(): Promise<{
smartAccountEnabledNetworks: number[];
}>;
initSmartAccount(): Promise<{
address: string;
isDeployed: boolean;
}>;
setPreferredAccount(type: 'eoa' | 'smartAccount'): Promise<unknown>;
connect(payload?: W3mFrameTypes.Requests['AppGetUserRequest']): Promise<{

@@ -56,2 +67,3 @@ chainId: number;

onNotConnected(callback: () => void): void;
onInitSmartAccount(callback: (isDeployed: boolean) => void): void;
private onConnectEmailSuccess;

@@ -86,2 +98,8 @@ private onConnectEmailError;

private onSyncDappDataError;
private onSmartAccountEnabledNetworksSuccess;
private onSmartAccountEnabledNetworksError;
private onInitSmartAccountSuccess;
private onInitSmartAccountError;
private onPreferSmartAccountSuccess;
private onPreferSmartAccountError;
private setNewLastEmailLoginTime;

@@ -92,2 +110,3 @@ private setEmailLoginSuccess;

private getLastUsedChainId;
private persistPreferredAccount;
}
import { z } from 'zod';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcEthBlockNumber, RpcEthGetTransactionByHash, RpcEthGetBlockByNumber, RpcEthCall, RpcEthFeeHistory, RpcEthGetAccount, RpcEthGetBalance, RpcEthGetBlockyByHash, RpcUnistallFilter, RpcEthSyncing, RpcEthSendRawTransaction, RpcEthNewPendingTransactionFilter, RpcEthNewFilter, RpcEthNewBlockFilter, RpcEthMaxPriorityFeePerGas, RpcEthGetUncleCountByBlockNumber, RpcEthGetUncleCountByBlockHash, RpcEthGetTransactionReceipt, RpcEthGetTransactionCount, RpcEthGetTransactionByBlockNumberAndIndex, RpcEthGetTransactionByBlockHashAndIndex, RpcEthGetStorageAt, RpcEthGetProof, RpcEthGetLogs, RpcEthGetFilterLogs, RpcEthGetFilter, RpcEthGetCode, RcpEthGetBlockTransactionCountByNumber, RcpEthGetBlockTransactionCountByHash, RpcEthGetBlockReceipts, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResolver, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest } from './W3mFrameSchema.js';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcEthBlockNumber, RpcEthGetTransactionByHash, RpcEthGetBlockByNumber, RpcEthCall, RpcEthFeeHistory, RpcEthGetAccount, RpcEthGetBalance, RpcEthGetBlockyByHash, RpcUnistallFilter, RpcEthSyncing, RpcEthSendRawTransaction, RpcEthNewPendingTransactionFilter, RpcEthNewFilter, RpcEthNewBlockFilter, RpcEthMaxPriorityFeePerGas, RpcEthGetUncleCountByBlockNumber, RpcEthGetUncleCountByBlockHash, RpcEthGetTransactionReceipt, RpcEthGetTransactionCount, RpcEthGetTransactionByBlockNumberAndIndex, RpcEthGetTransactionByBlockHashAndIndex, RpcEthGetStorageAt, RpcEthGetProof, RpcEthGetLogs, RpcEthGetFilterLogs, RpcEthGetFilter, RpcEthGetCode, RcpEthGetBlockTransactionCountByNumber, RcpEthGetBlockTransactionCountByHash, RpcEthGetBlockReceipts, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResolver, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, FrameGetSmartAccountEnabledNetworksResponse, FrameInitSmartAccountResponse } from './W3mFrameSchema.js';
export declare namespace W3mFrameTypes {

@@ -24,2 +24,4 @@ type AppEvent = z.infer<typeof W3mFrameSchema.appEvent>;

FrameSwitchNetworkResponse: z.infer<typeof FrameSwitchNetworkResponse>;
FrameGetSmartAccountEnabledNetworksResponse: z.infer<typeof FrameGetSmartAccountEnabledNetworksResponse>;
FrameInitSmartAccountResponse: z.infer<typeof FrameInitSmartAccountResponse>;
}

@@ -26,0 +28,0 @@ interface Network {

{
"name": "@web3modal/wallet",
"version": "4.0.11",
"version": "4.0.12-0c59f84f.0",
"type": "module",

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

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 too big to display

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