@web3modal/wallet
Advanced tools
Comparing version 3.6.0-f682e195 to 3.6.0-fa87e21c
@@ -5,4 +5,4 @@ export { W3mFrame } from './src/W3mFrame.js'; | ||
export { W3mFrameSchema } from './src/W3mFrameSchema.js'; | ||
export { W3mFrameConstants } from './src/W3mFrameConstants.js'; | ||
export { W3mFrameConstants, W3mFrameRpcConstants } from './src/W3mFrameConstants.js'; | ||
export { W3mFrameStorage } from './src/W3mFrameStorage.js'; | ||
//# sourceMappingURL=index.js.map |
export const W3mFrameConstants = { | ||
SECURE_SITE_SDK: 'https://secure.web3modal.com/sdk', | ||
SECURE_SITE_SDK: 'https://secure-web3modal-git-magic-preview-walletconnect1.vercel.app/sdk', | ||
APP_EVENT_KEY: '@w3m-app/', | ||
@@ -9,2 +9,3 @@ FRAME_EVENT_KEY: '@w3m-frame/', | ||
EMAIL_LOGIN_USED_KEY: 'EMAIL_LOGIN_USED_KEY', | ||
LAST_USED_CHAIN_KEY: 'LAST_USED_CHAIN_KEY', | ||
LAST_EMAIL_LOGIN_TIME: 'LAST_EMAIL_LOGIN_TIME', | ||
@@ -24,2 +25,3 @@ EMAIL: 'EMAIL', | ||
APP_SYNC_THEME: '@w3m-app/SYNC_THEME', | ||
APP_SYNC_DAPP_DATA: '@w3m-app/SYNC_DAPP_DATA', | ||
FRAME_SWITCH_NETWORK_ERROR: '@w3m-frame/SWITCH_NETWORK_ERROR', | ||
@@ -49,4 +51,10 @@ FRAME_SWITCH_NETWORK_SUCCESS: '@w3m-frame/SWITCH_NETWORK_SUCCESS', | ||
FRAME_SYNC_THEME_SUCCESS: '@w3m-frame/SYNC_THEME_SUCCESS', | ||
FRAME_SYNC_THEME_ERROR: '@w3m-frame/SYNC_THEME_ERROR' | ||
FRAME_SYNC_THEME_ERROR: '@w3m-frame/SYNC_THEME_ERROR', | ||
FRAME_SYNC_DAPP_DATA_SUCCESS: '@w3m-frame/SYNC_DAPP_DATA_SUCCESS', | ||
FRAME_SYNC_DAPP_DATA_ERROR: '@w3m-frame/SYNC_DAPP_DATA_ERROR' | ||
}; | ||
export const W3mFrameRpcConstants = { | ||
SAFE_RPC_METHODS: ['eth_blockNumber', 'eth_estimateGas', 'eth_getTransactionByHash'], | ||
GET_CHAIN_ID: 'eth_chainId' | ||
}; | ||
//# sourceMappingURL=W3mFrameConstants.js.map |
@@ -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 |
import { W3mFrame } from './W3mFrame.js'; | ||
import { W3mFrameConstants } from './W3mFrameConstants.js'; | ||
import { W3mFrameConstants, W3mFrameRpcConstants } from './W3mFrameConstants.js'; | ||
import { W3mFrameStorage } from './W3mFrameStorage.js'; | ||
@@ -19,2 +19,3 @@ import { W3mFrameHelpers } from './W3mFrameHelpers.js'; | ||
this.syncThemeResolver = undefined; | ||
this.syncDappDataResolver = undefined; | ||
this.w3mFrame = new W3mFrame(projectId, true); | ||
@@ -53,3 +54,3 @@ this.w3mFrame.events.onFrameEvent(event => { | ||
case W3mFrameConstants.FRAME_SWITCH_NETWORK_SUCCESS: | ||
return this.onSwitchChainSuccess(); | ||
return this.onSwitchChainSuccess(event); | ||
case W3mFrameConstants.FRAME_SWITCH_NETWORK_ERROR: | ||
@@ -75,2 +76,6 @@ return this.onSwitchChainError(event); | ||
return this.onSyncThemeError(event); | ||
case W3mFrameConstants.FRAME_SYNC_DAPP_DATA_SUCCESS: | ||
return this.onSyncDappDataSuccess(); | ||
case W3mFrameConstants.FRAME_SYNC_DAPP_DATA_ERROR: | ||
return this.onSyncDappDataError(event); | ||
default: | ||
@@ -148,5 +153,16 @@ return null; | ||
} | ||
async syncDappData(payload) { | ||
await this.w3mFrame.frameLoadPromise; | ||
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_SYNC_DAPP_DATA, payload }); | ||
return new Promise((resolve, reject) => { | ||
this.syncDappDataResolver = { resolve, reject }; | ||
}); | ||
} | ||
async connect(payload) { | ||
const chainId = payload?.chainId ?? this.getLastUsedChainId() ?? 1; | ||
await this.w3mFrame.frameLoadPromise; | ||
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_GET_USER, payload }); | ||
this.w3mFrame.events.postAppEvent({ | ||
type: W3mFrameConstants.APP_GET_USER, | ||
payload: { chainId } | ||
}); | ||
return new Promise((resolve, reject) => { | ||
@@ -175,2 +191,5 @@ this.connectResolver = { resolve, reject }; | ||
await this.w3mFrame.frameLoadPromise; | ||
if (W3mFrameRpcConstants.GET_CHAIN_ID === req.method) { | ||
return this.getLastUsedChainId(); | ||
} | ||
this.w3mFrame.events.postAppEvent({ | ||
@@ -200,3 +219,3 @@ type: W3mFrameConstants.APP_RPC_REQUEST, | ||
this.w3mFrame.events.onFrameEvent(event => { | ||
if (event.type === W3mFrameConstants.FRAME_IS_CONNECTED_SUCCESS) { | ||
if (event.type === W3mFrameConstants.FRAME_GET_USER_SUCCESS) { | ||
callback(); | ||
@@ -227,2 +246,3 @@ } | ||
this.setEmailLoginSuccess(event.payload.email); | ||
this.setLastUsedChainId(event.payload.chainId); | ||
this.connectResolver?.resolve(event.payload); | ||
@@ -234,2 +254,5 @@ } | ||
onIsConnectedSuccess(event) { | ||
if (!event.payload.isConnected) { | ||
this.deleteEmailLoginCache(); | ||
} | ||
this.isConnectedResolver?.resolve(event.payload); | ||
@@ -241,2 +264,3 @@ } | ||
onGetChainIdSuccess(event) { | ||
this.setLastUsedChainId(event.payload.chainId); | ||
this.getChainIdResolver?.resolve(event.payload); | ||
@@ -249,4 +273,3 @@ } | ||
this.disconnectResolver?.resolve(undefined); | ||
W3mFrameStorage.delete(W3mFrameConstants.EMAIL_LOGIN_USED_KEY); | ||
W3mFrameStorage.delete(W3mFrameConstants.EMAIL); | ||
this.deleteEmailLoginCache(); | ||
} | ||
@@ -256,4 +279,5 @@ onSignOutError(event) { | ||
} | ||
onSwitchChainSuccess() { | ||
this.switchChainResolver?.resolve(undefined); | ||
onSwitchChainSuccess(event) { | ||
this.setLastUsedChainId(event.payload.chainId); | ||
this.switchChainResolver?.resolve(event.payload); | ||
} | ||
@@ -294,2 +318,8 @@ onSwitchChainError(event) { | ||
} | ||
onSyncDappDataSuccess() { | ||
this.syncDappDataResolver?.resolve(undefined); | ||
} | ||
onSyncDappDataError(event) { | ||
this.syncDappDataResolver?.reject(event.payload.message); | ||
} | ||
setNewLastEmailLoginTime() { | ||
@@ -303,3 +333,14 @@ W3mFrameStorage.set(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME, Date.now().toString()); | ||
} | ||
deleteEmailLoginCache() { | ||
W3mFrameStorage.delete(W3mFrameConstants.EMAIL_LOGIN_USED_KEY); | ||
W3mFrameStorage.delete(W3mFrameConstants.EMAIL); | ||
W3mFrameStorage.delete(W3mFrameConstants.LAST_USED_CHAIN_KEY); | ||
} | ||
setLastUsedChainId(chainId) { | ||
W3mFrameStorage.set(W3mFrameConstants.LAST_USED_CHAIN_KEY, `${chainId}`); | ||
} | ||
getLastUsedChainId() { | ||
return Number(W3mFrameStorage.get(W3mFrameConstants.LAST_USED_CHAIN_KEY)); | ||
} | ||
} | ||
//# sourceMappingURL=W3mFrameProvider.js.map |
@@ -7,2 +7,22 @@ import { z } from 'zod'; | ||
} | ||
export const GetTransactionByHashResponse = z.object({ | ||
accessList: z.array(z.string()), | ||
blockHash: z.string().nullable(), | ||
blockNumber: z.string().nullable(), | ||
chainId: z.string(), | ||
from: z.string(), | ||
gas: z.string(), | ||
hash: z.string(), | ||
input: z.string().nullable(), | ||
maxFeePerGas: z.string(), | ||
maxPriorityFeePerGas: z.string(), | ||
nonce: z.string(), | ||
r: z.string(), | ||
s: z.string(), | ||
to: z.string(), | ||
transactionIndex: z.string().nullable(), | ||
type: z.string(), | ||
v: z.string(), | ||
value: z.string() | ||
}); | ||
export const AppSwitchNetworkRequest = z.object({ chainId: z.number() }); | ||
@@ -17,2 +37,14 @@ export const AppConnectEmailRequest = z.object({ email: z.string().email() }); | ||
}); | ||
export const AppSyncDappDataRequest = z.object({ | ||
metadata: z | ||
.object({ | ||
name: z.string(), | ||
description: z.string(), | ||
url: z.string(), | ||
icons: z.array(z.string()) | ||
}) | ||
.optional(), | ||
sdkVersion: z.string(), | ||
projectId: z.string() | ||
}); | ||
export const FrameConnectEmailResponse = z.object({ | ||
@@ -28,4 +60,5 @@ action: z.enum(['VERIFY_DEVICE', 'VERIFY_OTP']) | ||
export const FrameGetChainIdResponse = z.object({ chainId: z.number() }); | ||
export const FrameSwitchNetworkResponse = z.object({ chainId: z.number() }); | ||
export const FrameAwaitUpdateEmailResponse = z.object({ email: z.string().email() }); | ||
export const RpcResponse = z.string(); | ||
export const RpcResponse = z.any(); | ||
export const RpcPersonalSignRequest = z.object({ | ||
@@ -57,2 +90,12 @@ method: z.literal('personal_sign'), | ||
}); | ||
export const RpcEthGetTransactionByHash = z.object({ | ||
method: z.literal('eth_getTransactionByHash'), | ||
params: z.array(z.any()) | ||
}); | ||
export const RpcEthBlockNumber = z.object({ | ||
method: z.literal('eth_blockNumber') | ||
}); | ||
export const RpcEthChainId = z.object({ | ||
method: z.literal('eth_chainId') | ||
}); | ||
export const FrameSession = z.object({ | ||
@@ -79,9 +122,13 @@ token: z.string() | ||
.or(RpcEthSignTypedDataV4) | ||
.or(RpcEthBlockNumber) | ||
.or(RpcEthChainId) | ||
.or(RpcEthGetTransactionByHash) | ||
})) | ||
.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_SYNC_THEME'), payload: AppSyncThemeRequest })), | ||
.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') })) | ||
.or(z.object({ type: zType('FRAME_SWITCH_NETWORK_SUCCESS'), payload: FrameSwitchNetworkResponse })) | ||
.or(z.object({ type: zType('FRAME_CONNECT_EMAIL_ERROR'), payload: zError })) | ||
@@ -113,3 +160,5 @@ .or(z.object({ type: zType('FRAME_CONNECT_EMAIL_SUCCESS'), payload: FrameConnectEmailResponse })) | ||
.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') })) | ||
}; | ||
//# 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, AppSyncThemeRequest } from './W3mFrameSchema.js'; | ||
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, RpcEthBlockNumber, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, RpcEthGetTransactionByHash } from './W3mFrameSchema.js'; | ||
//# sourceMappingURL=W3mFrameTypes.js.map |
@@ -5,4 +5,4 @@ export { W3mFrame } from './src/W3mFrame.js'; | ||
export { W3mFrameSchema } from './src/W3mFrameSchema.js'; | ||
export { W3mFrameConstants } from './src/W3mFrameConstants.js'; | ||
export { W3mFrameConstants, W3mFrameRpcConstants } from './src/W3mFrameConstants.js'; | ||
export { W3mFrameStorage } from './src/W3mFrameStorage.js'; | ||
export type { W3mFrameTypes } from './src/W3mFrameTypes.js'; |
export declare const W3mFrameConstants: { | ||
readonly SECURE_SITE_SDK: "https://secure.web3modal.com/sdk"; | ||
readonly SECURE_SITE_SDK: "https://secure-web3modal-git-magic-preview-walletconnect1.vercel.app/sdk"; | ||
readonly APP_EVENT_KEY: "@w3m-app/"; | ||
@@ -9,2 +9,3 @@ readonly FRAME_EVENT_KEY: "@w3m-frame/"; | ||
readonly EMAIL_LOGIN_USED_KEY: "EMAIL_LOGIN_USED_KEY"; | ||
readonly LAST_USED_CHAIN_KEY: "LAST_USED_CHAIN_KEY"; | ||
readonly LAST_EMAIL_LOGIN_TIME: "LAST_EMAIL_LOGIN_TIME"; | ||
@@ -24,2 +25,3 @@ readonly EMAIL: "EMAIL"; | ||
readonly APP_SYNC_THEME: "@w3m-app/SYNC_THEME"; | ||
readonly APP_SYNC_DAPP_DATA: "@w3m-app/SYNC_DAPP_DATA"; | ||
readonly FRAME_SWITCH_NETWORK_ERROR: "@w3m-frame/SWITCH_NETWORK_ERROR"; | ||
@@ -50,2 +52,8 @@ readonly FRAME_SWITCH_NETWORK_SUCCESS: "@w3m-frame/SWITCH_NETWORK_SUCCESS"; | ||
readonly FRAME_SYNC_THEME_ERROR: "@w3m-frame/SYNC_THEME_ERROR"; | ||
readonly FRAME_SYNC_DAPP_DATA_SUCCESS: "@w3m-frame/SYNC_DAPP_DATA_SUCCESS"; | ||
readonly FRAME_SYNC_DAPP_DATA_ERROR: "@w3m-frame/SYNC_DAPP_DATA_ERROR"; | ||
}; | ||
export declare const W3mFrameRpcConstants: { | ||
SAFE_RPC_METHODS: string[]; | ||
GET_CHAIN_ID: string; | ||
}; |
export declare const W3mFrameHelpers: { | ||
getBlockchainApiUrl(): false | "https://rpc.walletconnect.org" | "https://rpc.walletconnect.com"; | ||
checkIfAllowedToTriggerEmail(): void; | ||
getTimeToNextEmailLogin(): number; | ||
}; |
@@ -16,2 +16,3 @@ import type { W3mFrameTypes } from './W3mFrameTypes.js'; | ||
private syncThemeResolver; | ||
private syncDappDataResolver; | ||
constructor(projectId: string); | ||
@@ -36,2 +37,3 @@ getLoginEmailUsed(): boolean; | ||
syncTheme(payload: W3mFrameTypes.Requests['AppSyncThemeRequest']): Promise<unknown>; | ||
syncDappData(payload: W3mFrameTypes.Requests['AppSyncDappDataRequest']): Promise<unknown>; | ||
connect(payload?: W3mFrameTypes.Requests['AppGetUserRequest']): Promise<{ | ||
@@ -42,5 +44,7 @@ chainId: number; | ||
}>; | ||
switchNetwork(chainId: number): Promise<unknown>; | ||
switchNetwork(chainId: number): Promise<{ | ||
chainId: number; | ||
}>; | ||
disconnect(): Promise<unknown>; | ||
request(req: W3mFrameTypes.RPCRequest): Promise<string>; | ||
request(req: W3mFrameTypes.RPCRequest): Promise<any>; | ||
onRpcRequest(callback: (request: unknown) => void): void; | ||
@@ -74,4 +78,9 @@ onRpcResponse(callback: (request: unknown) => void): void; | ||
private onSyncThemeError; | ||
private onSyncDappDataSuccess; | ||
private onSyncDappDataError; | ||
private setNewLastEmailLoginTime; | ||
private setEmailLoginSuccess; | ||
private deleteEmailLoginCache; | ||
private setLastUsedChainId; | ||
private getLastUsedChainId; | ||
} |
import { z } from 'zod'; | ||
export declare const GetTransactionByHashResponse: z.ZodObject<{ | ||
accessList: z.ZodArray<z.ZodString, "many">; | ||
blockHash: z.ZodNullable<z.ZodString>; | ||
blockNumber: z.ZodNullable<z.ZodString>; | ||
chainId: z.ZodString; | ||
from: z.ZodString; | ||
gas: z.ZodString; | ||
hash: z.ZodString; | ||
input: z.ZodNullable<z.ZodString>; | ||
maxFeePerGas: z.ZodString; | ||
maxPriorityFeePerGas: z.ZodString; | ||
nonce: z.ZodString; | ||
r: z.ZodString; | ||
s: z.ZodString; | ||
to: z.ZodString; | ||
transactionIndex: z.ZodNullable<z.ZodString>; | ||
type: z.ZodString; | ||
v: z.ZodString; | ||
value: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
value: string; | ||
accessList: string[]; | ||
blockHash: string | null; | ||
blockNumber: string | null; | ||
chainId: string; | ||
from: string; | ||
gas: string; | ||
hash: string; | ||
input: string | null; | ||
maxFeePerGas: string; | ||
maxPriorityFeePerGas: string; | ||
nonce: string; | ||
r: string; | ||
s: string; | ||
to: string; | ||
transactionIndex: string | null; | ||
v: string; | ||
}, { | ||
type: string; | ||
value: string; | ||
accessList: string[]; | ||
blockHash: string | null; | ||
blockNumber: string | null; | ||
chainId: string; | ||
from: string; | ||
gas: string; | ||
hash: string; | ||
input: string | null; | ||
maxFeePerGas: string; | ||
maxPriorityFeePerGas: string; | ||
nonce: string; | ||
r: string; | ||
s: string; | ||
to: string; | ||
transactionIndex: string | null; | ||
v: string; | ||
}>; | ||
export declare const AppSwitchNetworkRequest: z.ZodObject<{ | ||
@@ -47,2 +105,40 @@ chainId: z.ZodNumber; | ||
}>; | ||
export declare const AppSyncDappDataRequest: z.ZodObject<{ | ||
metadata: z.ZodOptional<z.ZodObject<{ | ||
name: z.ZodString; | ||
description: z.ZodString; | ||
url: z.ZodString; | ||
icons: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
}, { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
}>>; | ||
sdkVersion: z.ZodType<`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`, z.ZodTypeDef, `html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`>; | ||
projectId: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | undefined; | ||
}, { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | undefined; | ||
}>; | ||
export declare const FrameConnectEmailResponse: z.ZodObject<{ | ||
@@ -82,2 +178,9 @@ action: z.ZodEnum<["VERIFY_DEVICE", "VERIFY_OTP"]>; | ||
}>; | ||
export declare const FrameSwitchNetworkResponse: z.ZodObject<{ | ||
chainId: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
chainId: number; | ||
}, { | ||
chainId: number; | ||
}>; | ||
export declare const FrameAwaitUpdateEmailResponse: z.ZodObject<{ | ||
@@ -90,3 +193,3 @@ email: z.ZodString; | ||
}>; | ||
export declare const RpcResponse: z.ZodString; | ||
export declare const RpcResponse: z.ZodAny; | ||
export declare const RpcPersonalSignRequest: z.ZodObject<{ | ||
@@ -156,2 +259,26 @@ method: z.ZodLiteral<"personal_sign">; | ||
}>; | ||
export declare const RpcEthGetTransactionByHash: z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_getTransactionByHash">; | ||
params: z.ZodArray<z.ZodAny, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
}, { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
}>; | ||
export declare const RpcEthBlockNumber: z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_blockNumber">; | ||
}, "strip", z.ZodTypeAny, { | ||
method: "eth_blockNumber"; | ||
}, { | ||
method: "eth_blockNumber"; | ||
}>; | ||
export declare const RpcEthChainId: z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_chainId">; | ||
}, "strip", z.ZodTypeAny, { | ||
method: "eth_chainId"; | ||
}, { | ||
method: "eth_chainId"; | ||
}>; | ||
export declare const FrameSession: z.ZodObject<{ | ||
@@ -165,3 +292,3 @@ token: z.ZodString; | ||
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.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.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-app/SWITCH_NETWORK">; | ||
@@ -281,3 +408,3 @@ payload: z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-app/RPC_REQUEST">; | ||
payload: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
payload: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
method: z.ZodLiteral<"personal_sign">; | ||
@@ -339,2 +466,23 @@ params: z.ZodArray<z.ZodAny, "many">; | ||
method: "eth_signTypedData_v4"; | ||
}>]>, z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_blockNumber">; | ||
}, "strip", z.ZodTypeAny, { | ||
method: "eth_blockNumber"; | ||
}, { | ||
method: "eth_blockNumber"; | ||
}>]>, z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_chainId">; | ||
}, "strip", z.ZodTypeAny, { | ||
method: "eth_chainId"; | ||
}, { | ||
method: "eth_chainId"; | ||
}>]>, z.ZodObject<{ | ||
method: z.ZodLiteral<"eth_getTransactionByHash">; | ||
params: z.ZodArray<z.ZodAny, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
}, { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
}>]>; | ||
@@ -362,2 +510,9 @@ }, "strip", z.ZodTypeAny, { | ||
method: "eth_signTypedData_v4"; | ||
} | { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
} | { | ||
method: "eth_blockNumber"; | ||
} | { | ||
method: "eth_chainId"; | ||
}; | ||
@@ -385,2 +540,9 @@ }, { | ||
method: "eth_signTypedData_v4"; | ||
} | { | ||
params: any[]; | ||
method: "eth_getTransactionByHash"; | ||
} | { | ||
method: "eth_blockNumber"; | ||
} | { | ||
method: "eth_chainId"; | ||
}; | ||
@@ -436,4 +598,68 @@ }>]>, z.ZodObject<{ | ||
}; | ||
}>]>, z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-app/SYNC_DAPP_DATA">; | ||
payload: z.ZodObject<{ | ||
metadata: z.ZodOptional<z.ZodObject<{ | ||
name: z.ZodString; | ||
description: z.ZodString; | ||
url: z.ZodString; | ||
icons: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
}, { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
}>>; | ||
sdkVersion: z.ZodType<`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`, z.ZodTypeDef, `html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`>; | ||
projectId: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | undefined; | ||
}, { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | undefined; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-app/SYNC_DAPP_DATA"; | ||
payload: { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | undefined; | ||
}; | ||
}, { | ||
type: "@w3m-app/SYNC_DAPP_DATA"; | ||
payload: { | ||
projectId: string; | ||
sdkVersion: (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}`) & (`html-wagmi-${string}` | `react-wagmi-${string}` | `vue-wagmi-${string}` | `html-ethers5-${string}` | `react-ethers5-${string}` | `vue-ethers5-${string}` | `html-ethers-${string}` | `react-ethers-${string}` | `vue-ethers-${string}` | undefined); | ||
metadata?: { | ||
name: string; | ||
description: string; | ||
url: string; | ||
icons: string[]; | ||
} | 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.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.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-frame/SWITCH_NETWORK_ERROR">; | ||
@@ -459,6 +685,19 @@ payload: z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-frame/SWITCH_NETWORK_SUCCESS">; | ||
payload: z.ZodObject<{ | ||
chainId: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
chainId: number; | ||
}, { | ||
chainId: number; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-frame/SWITCH_NETWORK_SUCCESS"; | ||
payload: { | ||
chainId: number; | ||
}; | ||
}, { | ||
type: "@w3m-frame/SWITCH_NETWORK_SUCCESS"; | ||
payload: { | ||
chainId: number; | ||
}; | ||
}>]>, z.ZodObject<{ | ||
@@ -722,9 +961,9 @@ type: z.ZodLiteral<"@w3m-frame/CONNECT_EMAIL_ERROR">; | ||
type: z.ZodLiteral<"@w3m-frame/RPC_REQUEST_SUCCESS">; | ||
payload: z.ZodString; | ||
payload: z.ZodAny; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-frame/RPC_REQUEST_SUCCESS"; | ||
payload: string; | ||
payload?: any; | ||
}, { | ||
type: "@w3m-frame/RPC_REQUEST_SUCCESS"; | ||
payload: string; | ||
payload?: any; | ||
}>]>, z.ZodObject<{ | ||
@@ -837,3 +1076,28 @@ type: z.ZodLiteral<"@w3m-frame/SESSION_UPDATE">; | ||
type: "@w3m-frame/SYNC_THEME_SUCCESS"; | ||
}>]>, z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-frame/SYNC_DAPP_DATA_ERROR">; | ||
payload: z.ZodObject<{ | ||
message: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
message: string; | ||
}, { | ||
message: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-frame/SYNC_DAPP_DATA_ERROR"; | ||
payload: { | ||
message: string; | ||
}; | ||
}, { | ||
type: "@w3m-frame/SYNC_DAPP_DATA_ERROR"; | ||
payload: { | ||
message: string; | ||
}; | ||
}>]>, z.ZodObject<{ | ||
type: z.ZodLiteral<"@w3m-frame/SYNC_DAPP_DATA_SUCCESS">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-frame/SYNC_DAPP_DATA_SUCCESS"; | ||
}, { | ||
type: "@w3m-frame/SYNC_DAPP_DATA_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, AppSyncThemeRequest } from './W3mFrameSchema.js'; | ||
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameGetChainIdResponse, FrameGetUserResponse, FrameIsConnectedResponse, RpcPersonalSignRequest, RpcResponse, RpcEthSendTransactionRequest, RpcEthSignTypedDataV4, RpcEthAccountsRequest, RpcEthEstimateGas, RpcEthGasPrice, RpcGetBalance, RpcEthBlockNumber, FrameSession, AppGetUserRequest, AppUpdateEmailRequest, FrameAwaitUpdateEmailResponse, AppSyncThemeRequest, RpcEthChainId, FrameSwitchNetworkResponse, AppSyncDappDataRequest, RpcEthGetTransactionByHash } from './W3mFrameSchema.js'; | ||
export declare namespace W3mFrameTypes { | ||
@@ -13,2 +13,3 @@ type AppEvent = z.infer<typeof W3mFrameSchema.appEvent>; | ||
AppSyncThemeRequest: z.infer<typeof AppSyncThemeRequest>; | ||
AppSyncDappDataRequest: z.infer<typeof AppSyncDappDataRequest>; | ||
} | ||
@@ -21,2 +22,3 @@ interface Responses { | ||
FrameAwaitUpdateEmailResponse: z.infer<typeof FrameAwaitUpdateEmailResponse>; | ||
FrameSwitchNetworkResponse: z.infer<typeof FrameSwitchNetworkResponse>; | ||
} | ||
@@ -27,5 +29,5 @@ interface Network { | ||
} | ||
type RPCRequest = z.infer<typeof RpcPersonalSignRequest> | z.infer<typeof RpcEthSendTransactionRequest> | z.infer<typeof RpcEthSignTypedDataV4> | z.infer<typeof RpcEthAccountsRequest> | z.infer<typeof RpcEthEstimateGas> | z.infer<typeof RpcEthGasPrice> | z.infer<typeof RpcGetBalance>; | ||
type RPCRequest = z.infer<typeof RpcPersonalSignRequest> | z.infer<typeof RpcEthSendTransactionRequest> | z.infer<typeof RpcEthSignTypedDataV4> | z.infer<typeof RpcEthAccountsRequest> | z.infer<typeof RpcEthEstimateGas> | z.infer<typeof RpcEthGasPrice> | z.infer<typeof RpcGetBalance> | z.infer<typeof RpcEthBlockNumber> | z.infer<typeof RpcEthChainId> | z.infer<typeof RpcEthGetTransactionByHash>; | ||
type RPCResponse = z.infer<typeof RpcResponse>; | ||
type FrameSessionType = z.infer<typeof FrameSession>; | ||
} |
{ | ||
"name": "@web3modal/wallet", | ||
"version": "3.6.0-f682e195", | ||
"version": "3.6.0-fa87e21c", | ||
"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
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
107591
2003