@web3modal/wallet
Advanced tools
Comparing version 4.0.10 to 4.0.11-8c88aa26.0
@@ -95,4 +95,6 @@ export const W3mFrameConstants = { | ||
NOT_SAFE_RPC_METHODS: ['personal_sign', 'eth_signTypedData_v4', 'eth_sendTransaction'], | ||
GET_CHAIN_ID: 'eth_chainId' | ||
GET_CHAIN_ID: 'eth_chainId', | ||
RPC_METHOD_NOT_ALLOWED_MESSAGE: 'Requested RPC call is not allowed', | ||
RPC_METHOD_NOT_ALLOWED_UI_MESSAGE: 'Action not allowed' | ||
}; | ||
//# sourceMappingURL=W3mFrameConstants.js.map |
@@ -50,8 +50,11 @@ import { W3mFrameStorage } from './W3mFrameStorage.js'; | ||
checkIfRequestExists(request) { | ||
const method = request?.payload?.method; | ||
const method = this.getRequestMethod(request); | ||
return (W3mFrameRpcConstants.NOT_SAFE_RPC_METHODS.includes(method) || | ||
W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(method)); | ||
}, | ||
getRequestMethod(request) { | ||
return request?.payload?.method; | ||
}, | ||
checkIfRequestIsAllowed(request) { | ||
const method = request?.payload?.method; | ||
const method = this.getRequestMethod(request); | ||
return W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(method); | ||
@@ -58,0 +61,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
import { CryptoUtil } from '@web3modal/core'; | ||
import { W3mFrame } from './W3mFrame.js'; | ||
@@ -107,3 +108,7 @@ import { W3mFrameConstants, W3mFrameRpcConstants } from './W3mFrameConstants.js'; | ||
await this.w3mFrame.frameLoadPromise; | ||
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_CONNECT_DEVICE }); | ||
const jwt = await CryptoUtil.createJwt(); | ||
this.w3mFrame.events.postAppEvent({ | ||
type: W3mFrameConstants.APP_CONNECT_DEVICE, | ||
payload: { jwt: jwt || '' } | ||
}); | ||
return new Promise((resolve, reject) => { | ||
@@ -110,0 +115,0 @@ this.connectDeviceResolver = { resolve, reject }; |
@@ -50,2 +50,3 @@ import { z } from 'zod'; | ||
}); | ||
export const AppConnectDeviceRequest = z.object({ jwt: z.string() }); | ||
export const FrameConnectEmailResponse = z.object({ | ||
@@ -212,3 +213,3 @@ action: z.enum(['VERIFY_DEVICE', 'VERIFY_OTP']) | ||
.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_DEVICE'), payload: AppConnectDeviceRequest })) | ||
.or(z.object({ type: zType('APP_CONNECT_OTP'), payload: AppConnectOtpRequest })) | ||
@@ -215,0 +216,0 @@ .or(z.object({ type: zType('APP_GET_USER'), payload: z.optional(AppGetUserRequest) })) |
@@ -61,2 +61,4 @@ export declare const W3mFrameConstants: { | ||
GET_CHAIN_ID: string; | ||
RPC_METHOD_NOT_ALLOWED_MESSAGE: string; | ||
RPC_METHOD_NOT_ALLOWED_UI_MESSAGE: string; | ||
}; |
@@ -6,4 +6,5 @@ export declare const W3mFrameHelpers: { | ||
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"; | ||
checkIfRequestIsAllowed(request: unknown): boolean; | ||
isClient: boolean; | ||
}; |
@@ -157,2 +157,9 @@ import { z } from 'zod'; | ||
}>; | ||
export declare const AppConnectDeviceRequest: z.ZodObject<{ | ||
jwt: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
jwt: string; | ||
}, { | ||
jwt: string; | ||
}>; | ||
export declare const FrameConnectEmailResponse: z.ZodObject<{ | ||
@@ -604,6 +611,19 @@ action: z.ZodEnum<["VERIFY_DEVICE", "VERIFY_OTP"]>; | ||
type: z.ZodLiteral<"@w3m-app/CONNECT_DEVICE">; | ||
payload: z.ZodObject<{ | ||
jwt: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
jwt: string; | ||
}, { | ||
jwt: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "@w3m-app/CONNECT_DEVICE"; | ||
payload: { | ||
jwt: string; | ||
}; | ||
}, { | ||
type: "@w3m-app/CONNECT_DEVICE"; | ||
payload: { | ||
jwt: string; | ||
}; | ||
}>]>, z.ZodObject<{ | ||
@@ -610,0 +630,0 @@ type: z.ZodLiteral<"@w3m-app/CONNECT_OTP">; |
{ | ||
"name": "@web3modal/wallet", | ||
"version": "4.0.10", | ||
"version": "4.0.11-8c88aa26.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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
156025
3059
1