Socket
Socket
Sign inDemoInstall

@web3modal/wallet

Package Overview
Dependencies
Maintainers
10
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 5.0.7 to 5.0.8

dist/esm/tsconfig.tsbuildinfo

6

dist/esm/src/W3mFrameConstants.js

@@ -38,2 +38,4 @@ export const SECURE_SITE_SDK = process.env['NEXT_PUBLIC_SECURE_SITE_SDK_URL'] || 'https://secure.walletconnect.org/sdk';

APP_SET_PREFERRED_ACCOUNT: '@w3m-app/SET_PREFERRED_ACCOUNT',
APP_CONNECT_FARCASTER: '@w3m-app/CONNECT_FARCASTER',
APP_GET_FARCASTER_URI: '@w3m-app/GET_FARCASTER_URI',
FRAME_SWITCH_NETWORK_ERROR: '@w3m-frame/SWITCH_NETWORK_ERROR',

@@ -49,2 +51,6 @@ FRAME_SWITCH_NETWORK_SUCCESS: '@w3m-frame/SWITCH_NETWORK_SUCCESS',

FRAME_CONNECT_SOCIAL_ERROR: '@w3m-frame/CONNECT_SOCIAL_ERROR',
FRAME_CONNECT_FARCASTER_SUCCESS: '@w3m-frame/CONNECT_FARCASTER_SUCCESS',
FRAME_CONNECT_FARCASTER_ERROR: '@w3m-frame/CONNECT_FARCASTER_ERROR',
FRAME_GET_FARCASTER_URI_SUCCESS: '@w3m-frame/GET_FARCASTER_URI_SUCCESS',
FRAME_GET_FARCASTER_URI_ERROR: '@w3m-frame/GET_FARCASTER_URI_ERROR',
FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS: '@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS',

@@ -51,0 +57,0 @@ FRAME_GET_SOCIAL_REDIRECT_URI_ERROR: '@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR',

11

dist/esm/src/W3mFrameHelpers.js

@@ -27,9 +27,5 @@ import { W3mFrameStorage } from './W3mFrameStorage.js';

checkIfRequestExists(request) {
const method = this.getRequestMethod(request);
return (W3mFrameRpcConstants.NOT_SAFE_RPC_METHODS.includes(method) ||
W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(method));
return (W3mFrameRpcConstants.NOT_SAFE_RPC_METHODS.includes(request.method) ||
W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(request.method));
},
getRequestMethod(request) {
return request?.payload?.method;
},
getResponseType(response) {

@@ -50,4 +46,3 @@ const { type, payload } = response;

checkIfRequestIsAllowed(request) {
const method = this.getRequestMethod(request);
return W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(method);
return W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(request.method);
},

@@ -54,0 +49,0 @@ isClient: typeof window !== 'undefined'

@@ -13,2 +13,4 @@ import { W3mFrame } from './W3mFrame.js';

this.connectSocialResolver = undefined;
this.connectFarcasterResolver = undefined;
this.getFarcasterUriResolver = undefined;
this.disconnectResolver = undefined;

@@ -55,2 +57,10 @@ this.isConnectedResolver = undefined;

return this.onConnectEmailError(event);
case W3mFrameConstants.FRAME_CONNECT_FARCASTER_SUCCESS:
return this.onConnectFarcasterSuccess(event);
case W3mFrameConstants.FRAME_CONNECT_FARCASTER_ERROR:
return this.onConnectFarcasterError(event);
case W3mFrameConstants.FRAME_GET_FARCASTER_URI_SUCCESS:
return this.onGetFarcasterUriSuccess(event);
case W3mFrameConstants.FRAME_GET_FARCASTER_URI_ERROR:
return this.onGetFarcasterUriError(event);
case W3mFrameConstants.FRAME_CONNECT_DEVICE_SUCCESS:

@@ -179,2 +189,11 @@ return this.onConnectDeviceSuccess();

}
async getFarcasterUri() {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({
type: W3mFrameConstants.APP_GET_FARCASTER_URI
});
return new Promise((resolve, reject) => {
this.getFarcasterUriResolver = { resolve, reject };
});
}
async getSocialRedirectUri(payload) {

@@ -273,2 +292,11 @@ await this.w3mFrame.frameLoadPromise;

}
async connectFarcaster() {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({
type: W3mFrameConstants.APP_CONNECT_FARCASTER
});
return new Promise((resolve, reject) => {
this.connectFarcasterResolver = { resolve, reject };
});
}
async switchNetwork(chainId) {

@@ -307,3 +335,3 @@ await this.w3mFrame.frameLoadPromise;

if (event.type.includes(W3mFrameConstants.RPC_METHOD_KEY)) {
callback(event);
callback(event?.payload);
}

@@ -364,2 +392,17 @@ });

}
onGetFarcasterUriSuccess(event) {
this.getFarcasterUriResolver?.resolve(event.payload);
}
onGetFarcasterUriError(event) {
this.getFarcasterUriResolver?.reject(event.payload.message);
}
onConnectFarcasterSuccess(event) {
if (event.payload.userName) {
this.setSocialLoginSuccess(event.payload.userName);
}
this.connectFarcasterResolver?.resolve(event.payload);
}
onConnectFarcasterError(event) {
this.connectFarcasterResolver?.reject(event.payload.message);
}
onConnectDeviceSuccess() {

@@ -378,3 +421,3 @@ this.connectDeviceResolver?.resolve(undefined);

onConnectSuccess(event) {
this.setEmailLoginSuccess(event.payload.email);
this.setLoginSuccess(event.payload.email);
this.setLastUsedChainId(event.payload.chainId);

@@ -459,3 +502,3 @@ this.connectResolver?.resolve(event.payload);

const { newEmail } = event.payload;
this.setEmailLoginSuccess(newEmail);
this.setLoginSuccess(newEmail);
this.updateEmailSecondaryOtpResolver?.resolve({ newEmail });

@@ -498,4 +541,6 @@ }

}
setEmailLoginSuccess(email) {
W3mFrameStorage.set(W3mFrameConstants.EMAIL, email);
setLoginSuccess(email) {
if (email) {
W3mFrameStorage.set(W3mFrameConstants.EMAIL, email);
}
W3mFrameStorage.set(W3mFrameConstants.EMAIL_LOGIN_USED_KEY, 'true');

@@ -502,0 +547,0 @@ W3mFrameStorage.delete(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);

@@ -62,2 +62,8 @@ import { z } from 'zod';

});
export const FrameGetFarcasterUriResponse = z.object({
url: z.string()
});
export const FrameConnectFarcasterResponse = z.object({
userName: z.string()
});
export const FrameConnectSocialResponse = z.object({

@@ -82,3 +88,3 @@ email: z.string(),

export const FrameGetUserResponse = z.object({
email: z.string().email(),
email: z.string().email().optional().nullable(),
address: z.string(),

@@ -102,3 +108,3 @@ chainId: z.number(),

export const FrameSwitchNetworkResponse = z.object({ chainId: z.number() });
export const FrameUpdateEmailSecondaryOtpResolver = z.object({ newEmail: z.string().email() });
export const FrameUpdateEmailSecondaryOtpResponse = z.object({ newEmail: z.string().email() });
export const FrameGetSmartAccountEnabledNetworksResponse = z.object({

@@ -254,24 +260,67 @@ smartAccountEnabledNetworks: z.array(z.number())

});
export const WalletSendCallsRequest = z.object({
method: z.literal('wallet_sendCalls'),
params: z.array(z.object({
chainId: z.string().optional(),
from: z.string().optional(),
version: z.string().optional(),
capabilities: z.any().optional(),
calls: z.array(z.object({
to: z.string().startsWith('0x'),
data: z.string().startsWith('0x').optional(),
value: z.string().optional()
}))
}))
});
export const WalletGetCallsReceiptRequest = z.object({
method: z.literal('wallet_getCallsStatus'),
params: z.array(z.string())
});
export const WalletGetCapabilitiesRequest = z.object({
method: z.literal('wallet_getCapabilities')
});
export const FrameSession = z.object({
token: z.string()
});
export const EventSchema = z.object({
id: z.string().optional()
});
export const W3mFrameSchema = {
appEvent: z
.object({ type: zType('APP_SWITCH_NETWORK'), payload: AppSwitchNetworkRequest })
.or(z.object({ type: zType('APP_CONNECT_EMAIL'), payload: AppConnectEmailRequest }))
.or(z.object({ type: zType('APP_CONNECT_DEVICE') }))
.or(z.object({ type: zType('APP_CONNECT_OTP'), payload: AppConnectOtpRequest }))
.or(z.object({ type: zType('APP_CONNECT_SOCIAL'), payload: AppConnectSocialRequest }))
.or(z.object({ type: zType('APP_GET_USER'), payload: z.optional(AppGetUserRequest) }))
.or(z.object({
appEvent: EventSchema.extend({
type: zType('APP_SWITCH_NETWORK'),
payload: AppSwitchNetworkRequest
})
.or(EventSchema.extend({
type: zType('APP_CONNECT_EMAIL'),
payload: AppConnectEmailRequest
}))
.or(EventSchema.extend({ type: zType('APP_CONNECT_DEVICE') }))
.or(EventSchema.extend({ type: zType('APP_CONNECT_OTP'), payload: AppConnectOtpRequest }))
.or(EventSchema.extend({
type: zType('APP_CONNECT_SOCIAL'),
payload: AppConnectSocialRequest
}))
.or(EventSchema.extend({ type: zType('APP_GET_FARCASTER_URI') }))
.or(EventSchema.extend({ type: zType('APP_CONNECT_FARCASTER') }))
.or(EventSchema.extend({
type: zType('APP_GET_USER'),
payload: z.optional(AppGetUserRequest)
}))
.or(EventSchema.extend({
type: zType('APP_GET_SOCIAL_REDIRECT_URI'),
payload: AppGetSocialRedirectUriRequest
}))
.or(z.object({ type: zType('APP_SIGN_OUT') }))
.or(z.object({ type: zType('APP_IS_CONNECTED'), payload: z.optional(FrameSession) }))
.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({
.or(EventSchema.extend({ type: zType('APP_SIGN_OUT') }))
.or(EventSchema.extend({
type: zType('APP_IS_CONNECTED'),
payload: z.optional(FrameSession)
}))
.or(EventSchema.extend({ type: zType('APP_GET_CHAIN_ID') }))
.or(EventSchema.extend({ type: zType('APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS') }))
.or(EventSchema.extend({ type: zType('APP_INIT_SMART_ACCOUNT') }))
.or(EventSchema.extend({
type: zType('APP_SET_PREFERRED_ACCOUNT'),
payload: AppSetPreferredAccountRequest
}))
.or(EventSchema.extend({
type: zType('APP_RPC_REQUEST'),

@@ -316,75 +365,120 @@ payload: RpcPersonalSignRequest.or(RpcEthSendTransactionRequest)

.or(RpcEthSendTransactionRequest)
.or(WalletGetCallsReceiptRequest)
.or(WalletSendCallsRequest)
.or(WalletGetCapabilitiesRequest)
}))
.or(z.object({ type: zType('APP_UPDATE_EMAIL'), payload: AppUpdateEmailRequest }))
.or(z.object({
.or(EventSchema.extend({ type: zType('APP_UPDATE_EMAIL'), payload: AppUpdateEmailRequest }))
.or(EventSchema.extend({
type: zType('APP_UPDATE_EMAIL_PRIMARY_OTP'),
payload: AppUpdateEmailPrimaryOtpRequest
}))
.or(z.object({
.or(EventSchema.extend({
type: zType('APP_UPDATE_EMAIL_SECONDARY_OTP'),
payload: AppUpdateEmailSecondaryOtpRequest
}))
.or(z.object({ type: zType('APP_SYNC_THEME'), payload: AppSyncThemeRequest }))
.or(z.object({ type: zType('APP_SYNC_DAPP_DATA'), payload: AppSyncDappDataRequest })),
frameEvent: z
.object({ type: zType('FRAME_SWITCH_NETWORK_ERROR'), payload: zError })
.or(z.object({ type: zType('FRAME_SWITCH_NETWORK_SUCCESS'), payload: FrameSwitchNetworkResponse }))
.or(z.object({ type: zType('FRAME_CONNECT_EMAIL_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_CONNECT_EMAIL_SUCCESS'), payload: FrameConnectEmailResponse }))
.or(z.object({ type: zType('FRAME_CONNECT_OTP_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_CONNECT_OTP_SUCCESS') }))
.or(z.object({ type: zType('FRAME_CONNECT_DEVICE_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_CONNECT_DEVICE_SUCCESS') }))
.or(z.object({
.or(EventSchema.extend({ type: zType('APP_SYNC_THEME'), payload: AppSyncThemeRequest }))
.or(EventSchema.extend({
type: zType('APP_SYNC_DAPP_DATA'),
payload: AppSyncDappDataRequest
})),
frameEvent: EventSchema.extend({ type: zType('FRAME_SWITCH_NETWORK_ERROR'), payload: zError })
.or(EventSchema.extend({
type: zType('FRAME_SWITCH_NETWORK_SUCCESS'),
payload: FrameSwitchNetworkResponse
}))
.or(EventSchema.extend({
type: zType('FRAME_CONNECT_EMAIL_SUCCESS'),
payload: FrameConnectEmailResponse
}))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_EMAIL_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_GET_FARCASTER_URI_SUCCESS'),
payload: FrameGetFarcasterUriResponse
}))
.or(EventSchema.extend({ type: zType('FRAME_GET_FARCASTER_URI_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_CONNECT_FARCASTER_SUCCESS'),
payload: FrameConnectFarcasterResponse
}))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_FARCASTER_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_OTP_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_OTP_SUCCESS') }))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_DEVICE_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_CONNECT_DEVICE_SUCCESS') }))
.or(EventSchema.extend({
type: zType('FRAME_CONNECT_SOCIAL_SUCCESS'),
payload: FrameConnectSocialResponse
}))
.or(z.object({
.or(EventSchema.extend({
type: zType('FRAME_CONNECT_SOCIAL_ERROR'),
payload: zError
}))
.or(z.object({ type: zType('FRAME_GET_USER_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_GET_USER_SUCCESS'), payload: FrameGetUserResponse }))
.or(z.object({ type: zType('FRAME_GET_SOCIAL_REDIRECT_URI_ERROR'), payload: zError }))
.or(z.object({
.or(EventSchema.extend({ type: zType('FRAME_GET_USER_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_GET_USER_SUCCESS'),
payload: FrameGetUserResponse
}))
.or(EventSchema.extend({
type: zType('FRAME_GET_SOCIAL_REDIRECT_URI_ERROR'),
payload: zError
}))
.or(EventSchema.extend({
type: zType('FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS'),
payload: FrameGetSocialRedirectUriResponse
}))
.or(z.object({ type: zType('FRAME_SIGN_OUT_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_SIGN_OUT_SUCCESS') }))
.or(z.object({ type: zType('FRAME_IS_CONNECTED_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_IS_CONNECTED_SUCCESS'), payload: FrameIsConnectedResponse }))
.or(z.object({ type: zType('FRAME_GET_CHAIN_ID_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_GET_CHAIN_ID_SUCCESS'), payload: FrameGetChainIdResponse }))
.or(z.object({ type: zType('FRAME_RPC_REQUEST_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_RPC_REQUEST_SUCCESS'), payload: RpcResponse }))
.or(z.object({ type: zType('FRAME_SESSION_UPDATE'), payload: FrameSession }))
.or(z.object({ type: zType('FRAME_UPDATE_EMAIL_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_UPDATE_EMAIL_SUCCESS'), payload: FrameUpdateEmailResponse }))
.or(z.object({ type: zType('FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS') }))
.or(z.object({ type: zType('FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR'), payload: zError }))
.or(z.object({
.or(EventSchema.extend({ type: zType('FRAME_SIGN_OUT_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_SIGN_OUT_SUCCESS') }))
.or(EventSchema.extend({ type: zType('FRAME_IS_CONNECTED_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_IS_CONNECTED_SUCCESS'),
payload: FrameIsConnectedResponse
}))
.or(EventSchema.extend({ type: zType('FRAME_GET_CHAIN_ID_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_GET_CHAIN_ID_SUCCESS'),
payload: FrameGetChainIdResponse
}))
.or(EventSchema.extend({ type: zType('FRAME_RPC_REQUEST_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_RPC_REQUEST_SUCCESS'), payload: RpcResponse }))
.or(EventSchema.extend({ type: zType('FRAME_SESSION_UPDATE'), payload: FrameSession }))
.or(EventSchema.extend({ type: zType('FRAME_UPDATE_EMAIL_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_UPDATE_EMAIL_SUCCESS'),
payload: FrameUpdateEmailResponse
}))
.or(EventSchema.extend({
type: zType('FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR'),
payload: zError
}))
.or(EventSchema.extend({ type: zType('FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS') }))
.or(EventSchema.extend({
type: zType('FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR'),
payload: zError
}))
.or(EventSchema.extend({
type: zType('FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS'),
payload: FrameUpdateEmailSecondaryOtpResolver
payload: FrameUpdateEmailSecondaryOtpResponse
}))
.or(z.object({ type: zType('FRAME_SYNC_THEME_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_SYNC_THEME_SUCCESS') }))
.or(z.object({ type: zType('FRAME_SYNC_DAPP_DATA_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_SYNC_DAPP_DATA_SUCCESS') }))
.or(z.object({
.or(EventSchema.extend({ type: zType('FRAME_SYNC_THEME_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_SYNC_THEME_SUCCESS') }))
.or(EventSchema.extend({ type: zType('FRAME_SYNC_DAPP_DATA_ERROR'), payload: zError }))
.or(EventSchema.extend({ type: zType('FRAME_SYNC_DAPP_DATA_SUCCESS') }))
.or(EventSchema.extend({
type: zType('FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS'),
payload: FrameGetSmartAccountEnabledNetworksResponse
}))
.or(z.object({
.or(EventSchema.extend({
type: zType('FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR'),
payload: zError
}))
.or(z.object({ type: zType('FRAME_INIT_SMART_ACCOUNT_ERROR'), payload: zError }))
.or(z.object({
.or(EventSchema.extend({ type: zType('FRAME_INIT_SMART_ACCOUNT_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_SET_PREFERRED_ACCOUNT_SUCCESS'),
payload: FrameSetPreferredAccountResponse
}))
.or(z.object({ type: zType('FRAME_SET_PREFERRED_ACCOUNT_ERROR'), payload: zError }))
.or(EventSchema.extend({
type: zType('FRAME_SET_PREFERRED_ACCOUNT_ERROR'),
payload: zError
}))
};
//# sourceMappingURL=W3mFrameSchema.js.map
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, FrameGetSmartAccountEnabledNetworksResponse, FrameUpdateEmailResponse, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameConnectSocialResponse } 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, WalletSendCallsRequest, WalletGetCallsReceiptRequest, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResponse, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, FrameGetSmartAccountEnabledNetworksResponse, FrameUpdateEmailResponse, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameConnectSocialResponse, FrameConnectFarcasterResponse, FrameGetFarcasterUriResponse, AppConnectSocialRequest, AppSetPreferredAccountRequest, FrameSetPreferredAccountResponse, WalletGetCapabilitiesRequest } from './W3mFrameSchema.js';
//# sourceMappingURL=W3mFrameTypes.js.map

@@ -38,2 +38,4 @@ export declare const SECURE_SITE_SDK: string;

readonly APP_SET_PREFERRED_ACCOUNT: "@w3m-app/SET_PREFERRED_ACCOUNT";
readonly APP_CONNECT_FARCASTER: "@w3m-app/CONNECT_FARCASTER";
readonly APP_GET_FARCASTER_URI: "@w3m-app/GET_FARCASTER_URI";
readonly FRAME_SWITCH_NETWORK_ERROR: "@w3m-frame/SWITCH_NETWORK_ERROR";

@@ -49,2 +51,6 @@ readonly FRAME_SWITCH_NETWORK_SUCCESS: "@w3m-frame/SWITCH_NETWORK_SUCCESS";

readonly FRAME_CONNECT_SOCIAL_ERROR: "@w3m-frame/CONNECT_SOCIAL_ERROR";
readonly FRAME_CONNECT_FARCASTER_SUCCESS: "@w3m-frame/CONNECT_FARCASTER_SUCCESS";
readonly FRAME_CONNECT_FARCASTER_ERROR: "@w3m-frame/CONNECT_FARCASTER_ERROR";
readonly FRAME_GET_FARCASTER_URI_SUCCESS: "@w3m-frame/GET_FARCASTER_URI_SUCCESS";
readonly FRAME_GET_FARCASTER_URI_ERROR: "@w3m-frame/GET_FARCASTER_URI_ERROR";
readonly FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS: "@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS";

@@ -51,0 +57,0 @@ readonly FRAME_GET_SOCIAL_REDIRECT_URI_ERROR: "@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR";

@@ -0,9 +1,9 @@

import type { W3mFrameTypes } from './W3mFrameTypes.js';
export declare const W3mFrameHelpers: {
checkIfAllowedToTriggerEmail(): void;
getTimeToNextEmailLogin(): number;
checkIfRequestExists(request: unknown): boolean;
getRequestMethod(request: unknown): "eth_accounts" | "eth_blockNumber" | "eth_call" | "eth_chainId" | "eth_estimateGas" | "eth_feeHistory" | "eth_gasPrice" | "eth_getAccount" | "eth_getBalance" | "eth_getBlockByHash" | "eth_getBlockByNumber" | "eth_getBlockReceipts" | "eth_getBlockTransactionCountByHash" | "eth_getBlockTransactionCountByNumber" | "eth_getCode" | "eth_getFilterChanges" | "eth_getFilterLogs" | "eth_getLogs" | "eth_getProof" | "eth_getStorageAt" | "eth_getTransactionByBlockHashAndIndex" | "eth_getTransactionByBlockNumberAndIndex" | "eth_getTransactionByHash" | "eth_getTransactionCount" | "eth_getTransactionReceipt" | "eth_getUncleCountByBlockHash" | "eth_getUncleCountByBlockNumber" | "eth_maxPriorityFeePerGas" | "eth_newBlockFilter" | "eth_newFilter" | "eth_newPendingTransactionFilter" | "eth_sendRawTransaction" | "eth_syncing" | "eth_uninstallFilter" | "personal_sign" | "eth_signTypedData_v4" | "eth_sendTransaction";
getResponseType(response: unknown): "RPC_RESPONSE_ERROR" | "RPC_RESPONSE_TRANSACTION_HASH" | "RPC_RESPONSE_OBJECT";
checkIfRequestIsAllowed(request: unknown): boolean;
checkIfRequestExists(request: W3mFrameTypes.RPCRequest): boolean;
getResponseType(response: W3mFrameTypes.FrameEvent): "RPC_RESPONSE_ERROR" | "RPC_RESPONSE_TRANSACTION_HASH" | "RPC_RESPONSE_OBJECT";
checkIfRequestIsAllowed(request: W3mFrameTypes.RPCRequest): boolean;
isClient: boolean;
};

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

private connectSocialResolver;
private connectFarcasterResolver;
private getFarcasterUriResolver;
private disconnectResolver;

@@ -41,2 +43,5 @@ private isConnectedResolver;

}>;
getFarcasterUri(): Promise<{
url: string;
}>;
getSocialRedirectUri(payload: W3mFrameTypes.Requests['AppGetSocialRedirectUriRequest']): Promise<{

@@ -60,4 +65,4 @@ uri: string;

chainId: number;
email: string;
address: string;
email?: string | null | undefined;
smartAccountDeployed?: boolean | undefined;

@@ -72,4 +77,4 @@ accounts?: {

chainId: number;
email: string;
address: string;
email?: string | null | undefined;
smartAccountDeployed?: boolean | undefined;

@@ -82,2 +87,3 @@ accounts?: {

}>;
connectFarcaster(): Promise<unknown>;
switchNetwork(chainId: number): Promise<{

@@ -88,4 +94,4 @@ chainId: number;

request(req: W3mFrameTypes.RPCRequest): Promise<any>;
onRpcRequest(callback: (request: unknown) => void): void;
onRpcResponse(callback: (request: unknown) => void): void;
onRpcRequest(callback: (request: W3mFrameTypes.RPCRequest) => void): void;
onRpcResponse(callback: (request: W3mFrameTypes.FrameEvent) => void): void;
onIsConnected(callback: (request: W3mFrameTypes.Responses['FrameGetUserResponse']) => void): void;

@@ -100,2 +106,6 @@ onNotConnected(callback: () => void): void;

private onConnectEmailError;
private onGetFarcasterUriSuccess;
private onGetFarcasterUriError;
private onConnectFarcasterSuccess;
private onConnectFarcasterError;
private onConnectDeviceSuccess;

@@ -138,3 +148,3 @@ private onConnectDeviceError;

private setSocialLoginSuccess;
private setEmailLoginSuccess;
private setLoginSuccess;
private deleteAuthLoginCache;

@@ -141,0 +151,0 @@ private setLastUsedChainId;

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, FrameGetSmartAccountEnabledNetworksResponse, FrameUpdateEmailResponse, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameConnectSocialResponse } 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, WalletSendCallsRequest, WalletGetCallsReceiptRequest, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameUpdateEmailSecondaryOtpResponse, AppUpdateEmailPrimaryOtpRequest, AppUpdateEmailSecondaryOtpRequest, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, FrameGetSmartAccountEnabledNetworksResponse, FrameUpdateEmailResponse, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameConnectSocialResponse, FrameConnectFarcasterResponse, FrameGetFarcasterUriResponse, AppConnectSocialRequest, AppSetPreferredAccountRequest, FrameSetPreferredAccountResponse, WalletGetCapabilitiesRequest } from './W3mFrameSchema.js';
import type { W3mFrameRpcConstants } from './W3mFrameConstants.js';

@@ -10,18 +10,26 @@ export declare namespace W3mFrameTypes {

AppConnectOtpRequest: z.infer<typeof AppConnectOtpRequest>;
AppGetSocialRedirectUriRequest: z.infer<typeof AppGetSocialRedirectUriRequest>;
AppGetUserRequest: z.infer<typeof AppGetUserRequest>;
AppSwitchNetworkRequest: z.infer<typeof AppSwitchNetworkRequest>;
AppGetUserRequest: z.infer<typeof AppGetUserRequest>;
AppUpdateEmailRequest: z.infer<typeof AppUpdateEmailRequest>;
AppSyncThemeRequest: z.infer<typeof AppSyncThemeRequest>;
AppSyncDappDataRequest: z.infer<typeof AppSyncDappDataRequest>;
AppUpdateEmailRequest: z.infer<typeof AppUpdateEmailRequest>;
AppUpdateEmailPrimaryOtpRequest: z.infer<typeof AppUpdateEmailPrimaryOtpRequest>;
AppUpdateEmailSecondaryOtpRequest: z.infer<typeof AppUpdateEmailSecondaryOtpRequest>;
AppGetSocialRedirectUriRequest: z.infer<typeof AppGetSocialRedirectUriRequest>;
AppSetPreferredAccountRequest: z.infer<typeof AppSetPreferredAccountRequest>;
AppConnectSocialRequest: z.infer<typeof AppConnectSocialRequest>;
AppGetSmartAccountEnabledNetworksRequest: undefined;
AppGetChainIdRequest: undefined;
AppIsConnectedRequest: undefined;
AppConnectDeviceRequest: undefined;
AppSignOutRequest: undefined;
AppRpcRequest: RPCRequest;
}
interface Responses {
FrameConnectEmailResponse: z.infer<typeof FrameConnectEmailResponse>;
FrameConnectOtpResponse: undefined;
FrameGetUserResponse: z.infer<typeof FrameGetUserResponse>;
FrameSwitchNetworkResponse: z.infer<typeof FrameSwitchNetworkResponse>;
FrameGetChainIdResponse: z.infer<typeof FrameGetChainIdResponse>;
FrameGetUserResponse: z.infer<typeof FrameGetUserResponse>;
FrameIsConnectedResponse: z.infer<typeof FrameIsConnectedResponse>;
FrameUpdateEmailSecondaryOtpResolver: z.infer<typeof FrameUpdateEmailSecondaryOtpResolver>;
FrameSwitchNetworkResponse: z.infer<typeof FrameSwitchNetworkResponse>;
FrameGetSmartAccountEnabledNetworksResponse: z.infer<typeof FrameGetSmartAccountEnabledNetworksResponse>;

@@ -31,2 +39,12 @@ FrameUpdateEmailResponse: z.infer<typeof FrameUpdateEmailResponse>;

FrameConnectSocialResponse: z.infer<typeof FrameConnectSocialResponse>;
FrameGetFarcasterUriResponse: z.infer<typeof FrameGetFarcasterUriResponse>;
FrameConnectFarcasterResponse: z.infer<typeof FrameConnectFarcasterResponse>;
FrameSyncThemeResponse: undefined;
FrameSyncDappDataResponse: undefined;
FrameUpdateEmailPrimaryOtpResponse: undefined;
FrameUpdateEmailSecondaryOtpResponse: z.infer<typeof FrameUpdateEmailSecondaryOtpResponse>;
FrameConnectDeviceResponse: undefined;
FrameSetPreferredAccountResponse: z.infer<typeof FrameSetPreferredAccountResponse>;
FrameSignOutResponse: undefined;
FrameRpcResponse: RPCResponse;
}

@@ -37,3 +55,3 @@ interface Network {

}
type RPCRequest = z.infer<typeof RpcEthAccountsRequest> | z.infer<typeof RpcEthBlockNumber> | z.infer<typeof RpcEthCall> | z.infer<typeof RpcEthChainId> | z.infer<typeof RpcEthEstimateGas> | z.infer<typeof RpcEthFeeHistory> | z.infer<typeof RpcEthGasPrice> | z.infer<typeof RpcEthGetAccount> | z.infer<typeof RpcEthGetBalance> | z.infer<typeof RpcEthGetBlockyByHash> | z.infer<typeof RpcEthGetBlockByNumber> | z.infer<typeof RpcEthGetBlockReceipts> | z.infer<typeof RcpEthGetBlockTransactionCountByHash> | z.infer<typeof RcpEthGetBlockTransactionCountByNumber> | z.infer<typeof RpcEthGetCode> | z.infer<typeof RpcEthGetFilter> | z.infer<typeof RpcEthGetFilterLogs> | z.infer<typeof RpcEthGetLogs> | z.infer<typeof RpcEthGetProof> | z.infer<typeof RpcEthGetStorageAt> | z.infer<typeof RpcEthGetTransactionByBlockHashAndIndex> | z.infer<typeof RpcEthGetTransactionByBlockNumberAndIndex> | z.infer<typeof RpcEthGetTransactionByHash> | z.infer<typeof RpcEthGetTransactionCount> | z.infer<typeof RpcEthGetTransactionReceipt> | z.infer<typeof RpcEthGetUncleCountByBlockHash> | z.infer<typeof RpcEthGetUncleCountByBlockNumber> | z.infer<typeof RpcEthMaxPriorityFeePerGas> | z.infer<typeof RpcEthNewBlockFilter> | z.infer<typeof RpcEthNewFilter> | z.infer<typeof RpcEthNewPendingTransactionFilter> | z.infer<typeof RpcEthSendRawTransaction> | z.infer<typeof RpcEthSyncing> | z.infer<typeof RpcUnistallFilter> | z.infer<typeof RpcPersonalSignRequest> | z.infer<typeof RpcEthSignTypedDataV4> | z.infer<typeof RpcEthSendTransactionRequest>;
type RPCRequest = z.infer<typeof RpcEthAccountsRequest> | z.infer<typeof RpcEthBlockNumber> | z.infer<typeof RpcEthCall> | z.infer<typeof RpcEthChainId> | z.infer<typeof RpcEthEstimateGas> | z.infer<typeof RpcEthFeeHistory> | z.infer<typeof RpcEthGasPrice> | z.infer<typeof RpcEthGetAccount> | z.infer<typeof RpcEthGetBalance> | z.infer<typeof RpcEthGetBlockyByHash> | z.infer<typeof RpcEthGetBlockByNumber> | z.infer<typeof RpcEthGetBlockReceipts> | z.infer<typeof RcpEthGetBlockTransactionCountByHash> | z.infer<typeof RcpEthGetBlockTransactionCountByNumber> | z.infer<typeof RpcEthGetCode> | z.infer<typeof RpcEthGetFilter> | z.infer<typeof RpcEthGetFilterLogs> | z.infer<typeof RpcEthGetLogs> | z.infer<typeof RpcEthGetProof> | z.infer<typeof RpcEthGetStorageAt> | z.infer<typeof RpcEthGetTransactionByBlockHashAndIndex> | z.infer<typeof RpcEthGetTransactionByBlockNumberAndIndex> | z.infer<typeof RpcEthGetTransactionByHash> | z.infer<typeof RpcEthGetTransactionCount> | z.infer<typeof RpcEthGetTransactionReceipt> | z.infer<typeof RpcEthGetUncleCountByBlockHash> | z.infer<typeof RpcEthGetUncleCountByBlockNumber> | z.infer<typeof RpcEthMaxPriorityFeePerGas> | z.infer<typeof RpcEthNewBlockFilter> | z.infer<typeof RpcEthNewFilter> | z.infer<typeof RpcEthNewPendingTransactionFilter> | z.infer<typeof RpcEthSendRawTransaction> | z.infer<typeof RpcEthSyncing> | z.infer<typeof RpcUnistallFilter> | z.infer<typeof RpcPersonalSignRequest> | z.infer<typeof RpcEthSignTypedDataV4> | z.infer<typeof RpcEthSendTransactionRequest> | z.infer<typeof WalletSendCallsRequest> | z.infer<typeof WalletGetCallsReceiptRequest> | z.infer<typeof WalletGetCapabilitiesRequest>;
type RPCResponse = z.infer<typeof RpcResponse>;

@@ -43,2 +61,4 @@ type FrameSessionType = z.infer<typeof FrameSession>;

type SocialProvider = 'google' | 'github' | 'apple' | 'facebook' | 'x' | 'discord';
type ProviderRequestType = 'GetUser' | 'ConnectDevice' | 'ConnectEmail' | 'ConnectSocial' | 'ConnectOtp' | 'GetSocialRedirectUri' | 'SwitchNetwork' | 'UpdateEmail' | 'SyncTheme' | 'SyncDappData' | 'UpdateEmailPrimaryOtp' | 'UpdateEmailSecondaryOtp' | 'GetSmartAccountEnabledNetworks' | 'GetChainId' | 'IsConnected' | 'SetPreferredAccount' | 'SignOut' | 'Rpc';
type WalletCapabilities = Record<string, any>;
}
{
"name": "@web3modal/wallet",
"version": "5.0.7",
"version": "5.0.8",
"type": "module",

@@ -11,13 +11,7 @@ "main": "./dist/esm/index.js",

],
"scripts": {
"build:clean": "rm -rf dist",
"build:wallet": "tsc --build",
"watch": "tsc --watch",
"typecheck": "tsc --noEmit",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@walletconnect/logger": "2.1.2",
"@web3modal/polyfills": "5.0.7",
"zod": "3.22.4"
"zod": "3.22.4",
"@web3modal/common": "5.0.8",
"@web3modal/polyfills": "5.0.8"
},

@@ -42,3 +36,10 @@ "keywords": [

"url": "https://github.com/web3modal/web3modal/issues"
},
"scripts": {
"build:clean": "rm -rf dist",
"build": "tsc --build",
"watch": "tsc --watch",
"typecheck": "tsc --noEmit",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
}
}
}

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 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