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 3.5.3 to 3.5.4

5

dist/esm/src/W3mFrameConstants.js

@@ -22,2 +22,3 @@ export const W3mFrameConstants = {

APP_AWAIT_UPDATE_EMAIL: '@w3m-app/AWAIT_UPDATE_EMAIL',
APP_SYNC_THEME: '@w3m-app/SYNC_THEME',
FRAME_SWITCH_NETWORK_ERROR: '@w3m-frame/SWITCH_NETWORK_ERROR',

@@ -45,4 +46,6 @@ FRAME_SWITCH_NETWORK_SUCCESS: '@w3m-frame/SWITCH_NETWORK_SUCCESS',

FRAME_AWAIT_UPDATE_EMAIL_SUCCESS: '@w3m-frame/AWAIT_UPDATE_EMAIL_SUCCESS',
FRAME_AWAIT_UPDATE_EMAIL_ERROR: '@w3m-frame/AWAIT_UPDATE_EMAIL_ERROR'
FRAME_AWAIT_UPDATE_EMAIL_ERROR: '@w3m-frame/AWAIT_UPDATE_EMAIL_ERROR',
FRAME_SYNC_THEME_SUCCESS: '@w3m-frame/SYNC_THEME_SUCCESS',
FRAME_SYNC_THEME_ERROR: '@w3m-frame/SYNC_THEME_ERROR'
};
//# sourceMappingURL=W3mFrameConstants.js.map

15

dist/esm/src/W3mFrameHelpers.js

@@ -15,2 +15,3 @@ import { W3mFrameStorage } from './W3mFrameStorage.js';

];
const EMAIL_MINIMUM_TIMEOUT = 30 * 1000;
export const W3mFrameHelpers = {

@@ -33,9 +34,19 @@ getBlockchainApiUrl() {

const difference = Date.now() - Number(lastEmailLoginTime);
if (difference < 30000) {
const cooldownSec = Math.ceil((30000 - difference) / 1000);
if (difference < EMAIL_MINIMUM_TIMEOUT) {
const cooldownSec = Math.ceil((EMAIL_MINIMUM_TIMEOUT - difference) / 1000);
throw new Error(`Please try again after ${cooldownSec} seconds`);
}
}
},
getTimeToNextEmailLogin() {
const lastEmailLoginTime = W3mFrameStorage.get(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);
if (lastEmailLoginTime) {
const difference = Date.now() - Number(lastEmailLoginTime);
if (difference < EMAIL_MINIMUM_TIMEOUT) {
return Math.ceil((EMAIL_MINIMUM_TIMEOUT - difference) / 1000);
}
}
return 0;
}
};
//# sourceMappingURL=W3mFrameHelpers.js.map

@@ -18,2 +18,3 @@ import { W3mFrame } from './W3mFrame.js';

this.awaitUpdateEmailResolver = undefined;
this.syncThemeResolver = undefined;
this.w3mFrame = new W3mFrame(projectId, true);

@@ -69,2 +70,6 @@ this.w3mFrame.events.onFrameEvent(event => {

return this.onAwaitUpdateEmailError(event);
case W3mFrameConstants.FRAME_SYNC_THEME_SUCCESS:
return this.onSyncThemeSuccess();
case W3mFrameConstants.FRAME_SYNC_THEME_ERROR:
return this.onSyncThemeError(event);
default:

@@ -135,2 +140,9 @@ return null;

}
async syncTheme(payload) {
await this.w3mFrame.frameLoadPromise;
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_SYNC_THEME, payload });
return new Promise((resolve, reject) => {
this.syncThemeResolver = { resolve, reject };
});
}
async connect(payload) {

@@ -268,2 +280,8 @@ await this.w3mFrame.frameLoadPromise;

}
onSyncThemeSuccess() {
this.syncThemeResolver?.resolve(undefined);
}
onSyncThemeError(event) {
this.syncThemeResolver?.reject(event.payload.message);
}
setNewLastEmailLoginTime() {

@@ -270,0 +288,0 @@ W3mFrameStorage.set(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME, Date.now().toString());

@@ -12,2 +12,6 @@ import { z } from 'zod';

export const AppUpdateEmailRequest = z.object({ email: z.string().email() });
export const AppSyncThemeRequest = z.object({
themeMode: z.optional(z.enum(['light', 'dark'])),
themeVariables: z.optional(z.record(z.string(), z.string().or(z.number())))
});
export const FrameConnectEmailResponse = z.object({

@@ -74,3 +78,4 @@ action: z.enum(['VERIFY_DEVICE', 'VERIFY_OTP'])

.or(z.object({ type: zType('APP_UPDATE_EMAIL'), payload: AppUpdateEmailRequest }))
.or(z.object({ type: zType('APP_AWAIT_UPDATE_EMAIL') })),
.or(z.object({ type: zType('APP_AWAIT_UPDATE_EMAIL') }))
.or(z.object({ type: zType('APP_SYNC_THEME'), payload: AppSyncThemeRequest })),
frameEvent: z

@@ -103,3 +108,5 @@ .object({ type: zType('FRAME_SWITCH_NETWORK_ERROR'), payload: zError })

}))
.or(z.object({ type: zType('FRAME_SYNC_THEME_ERROR'), payload: zError }))
.or(z.object({ type: zType('FRAME_SYNC_THEME_SUCCESS') }))
};
//# sourceMappingURL=W3mFrameSchema.js.map
import { z } from 'zod';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse } from './W3mFrameSchema.js';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse, AppSyncThemeRequest } from './W3mFrameSchema.js';
//# sourceMappingURL=W3mFrameTypes.js.map

@@ -22,2 +22,3 @@ export declare const W3mFrameConstants: {

readonly APP_AWAIT_UPDATE_EMAIL: "@w3m-app/AWAIT_UPDATE_EMAIL";
readonly APP_SYNC_THEME: "@w3m-app/SYNC_THEME";
readonly FRAME_SWITCH_NETWORK_ERROR: "@w3m-frame/SWITCH_NETWORK_ERROR";

@@ -46,2 +47,4 @@ readonly FRAME_SWITCH_NETWORK_SUCCESS: "@w3m-frame/SWITCH_NETWORK_SUCCESS";

readonly FRAME_AWAIT_UPDATE_EMAIL_ERROR: "@w3m-frame/AWAIT_UPDATE_EMAIL_ERROR";
readonly FRAME_SYNC_THEME_SUCCESS: "@w3m-frame/SYNC_THEME_SUCCESS";
readonly FRAME_SYNC_THEME_ERROR: "@w3m-frame/SYNC_THEME_ERROR";
};
export declare const W3mFrameHelpers: {
getBlockchainApiUrl(): false | "https://rpc.walletconnect.org" | "https://rpc.walletconnect.com";
checkIfAllowedToTriggerEmail(): void;
getTimeToNextEmailLogin(): number;
};

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

private awaitUpdateEmailResolver;
private syncThemeResolver;
constructor(projectId: string);

@@ -34,2 +35,3 @@ getLoginEmailUsed(): boolean;

}>;
syncTheme(payload: W3mFrameTypes.Requests['AppSyncThemeRequest']): Promise<unknown>;
connect(payload?: W3mFrameTypes.Requests['AppGetUserRequest']): Promise<{

@@ -69,4 +71,6 @@ chainId: number;

private onAwaitUpdateEmailError;
private onSyncThemeSuccess;
private onSyncThemeError;
private setNewLastEmailLoginTime;
private setEmailLoginSuccess;
}

@@ -37,2 +37,12 @@ import { z } from 'zod';

}>;
export declare const AppSyncThemeRequest: z.ZodObject<{
themeMode: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
themeVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
}, "strip", z.ZodTypeAny, {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
}, {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
}>;
export declare const FrameConnectEmailResponse: z.ZodObject<{

@@ -152,3 +162,3 @@ action: z.ZodEnum<["VERIFY_DEVICE", "VERIFY_OTP"]>;

export declare const W3mFrameSchema: {
appEvent: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
appEvent: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"@w3m-app/SWITCH_NETWORK">;

@@ -395,4 +405,28 @@ payload: z.ZodObject<{

type: "@w3m-app/AWAIT_UPDATE_EMAIL";
}>]>, z.ZodObject<{
type: z.ZodLiteral<"@w3m-app/SYNC_THEME">;
payload: z.ZodObject<{
themeMode: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
themeVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
}, "strip", z.ZodTypeAny, {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
}, {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
}>;
}, "strip", z.ZodTypeAny, {
type: "@w3m-app/SYNC_THEME";
payload: {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
};
}, {
type: "@w3m-app/SYNC_THEME";
payload: {
themeMode?: "light" | "dark" | undefined;
themeVariables?: Record<string, string | number> | undefined;
};
}>]>;
frameEvent: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
frameEvent: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"@w3m-frame/SWITCH_NETWORK_ERROR">;

@@ -769,3 +803,28 @@ payload: z.ZodObject<{

};
}>]>, z.ZodObject<{
type: z.ZodLiteral<"@w3m-frame/SYNC_THEME_ERROR">;
payload: z.ZodObject<{
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
}, {
message: string;
}>;
}, "strip", z.ZodTypeAny, {
type: "@w3m-frame/SYNC_THEME_ERROR";
payload: {
message: string;
};
}, {
type: "@w3m-frame/SYNC_THEME_ERROR";
payload: {
message: string;
};
}>]>, z.ZodObject<{
type: z.ZodLiteral<"@w3m-frame/SYNC_THEME_SUCCESS">;
}, "strip", z.ZodTypeAny, {
type: "@w3m-frame/SYNC_THEME_SUCCESS";
}, {
type: "@w3m-frame/SYNC_THEME_SUCCESS";
}>]>;
};
import { z } from 'zod';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse } from './W3mFrameSchema.js';
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse, AppSyncThemeRequest } from './W3mFrameSchema.js';
export declare namespace W3mFrameTypes {

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

AppUpdateEmailRequest: z.infer<typeof AppUpdateEmailRequest>;
AppSyncThemeRequest: z.infer<typeof AppSyncThemeRequest>;
}

@@ -14,0 +15,0 @@ interface Responses {

{
"name": "@web3modal/wallet",
"version": "3.5.3",
"version": "3.5.4",
"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 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