@web3modal/wallet
Advanced tools
Comparing version 4.1.2-rer314x.0 to 4.1.3-aw214x.1
export const W3mFrameConstants = { | ||
SECURE_SITE_SDK: 'https://secure.walletconnect.com/sdk', | ||
SECURE_SITE_SDK: 'http://localhost:3010/sdk', | ||
APP_EVENT_KEY: '@w3m-app/', | ||
@@ -17,2 +17,3 @@ FRAME_EVENT_KEY: '@w3m-frame/', | ||
APP_CONNECT_OTP: '@w3m-app/CONNECT_OTP', | ||
APP_GET_SOCIAL_REDIRECT_URI: '@w3m-app/GET_SOCIAL_REDIRECT_URI', | ||
APP_GET_USER: '@w3m-app/GET_USER', | ||
@@ -40,2 +41,4 @@ APP_SIGN_OUT: '@w3m-app/SIGN_OUT', | ||
FRAME_CONNECT_OTP_ERROR: '@w3m-frame/CONNECT_OTP_ERROR', | ||
FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS: '@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS', | ||
FRAME_GET_SOCIAL_REDIRECT_URI_ERROR: '@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR', | ||
FRAME_GET_USER_SUCCESS: '@w3m-frame/GET_USER_SUCCESS', | ||
@@ -67,3 +70,4 @@ FRAME_GET_USER_ERROR: '@w3m-frame/GET_USER_ERROR', | ||
FRAME_SET_PREFERRED_ACCOUNT_SUCCESS: '@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS', | ||
FRAME_SET_PREFERRED_ACCOUNT_ERROR: '@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR' | ||
FRAME_SET_PREFERRED_ACCOUNT_ERROR: '@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR', | ||
FRAME_GET_SOCIAL_USER_SUCCESS: '@w3m-frame/GET_SOCIAL_USER_SUCCESS' | ||
}; | ||
@@ -70,0 +74,0 @@ export const W3mFrameRpcConstants = { |
@@ -10,2 +10,3 @@ import { W3mFrame } from './W3mFrame.js'; | ||
this.connectOtpResolver = undefined; | ||
this.getSocialRedirectUriResolver = undefined; | ||
this.connectResolver = undefined; | ||
@@ -41,2 +42,6 @@ this.disconnectResolver = undefined; | ||
return this.onConnectOtpError(event); | ||
case W3mFrameConstants.FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS: | ||
return this.onGetSocialRedirectUriSuccess(event); | ||
case W3mFrameConstants.FRAME_GET_SOCIAL_REDIRECT_URI_ERROR: | ||
return this.onGetSocialRedirectUriError(event); | ||
case W3mFrameConstants.FRAME_GET_USER_SUCCESS: | ||
@@ -100,2 +105,4 @@ return this.onConnectSuccess(event); | ||
return this.onPreferSmartAccountError(); | ||
case W3mFrameConstants.FRAME_GET_SOCIAL_USER_SUCCESS: | ||
return this.onGetSocialUserSuccess(event); | ||
default: | ||
@@ -137,2 +144,12 @@ return null; | ||
} | ||
async getSocialRedirectUri(payload) { | ||
await this.w3mFrame.frameLoadPromise; | ||
this.w3mFrame.events.postAppEvent({ | ||
type: W3mFrameConstants.APP_GET_SOCIAL_REDIRECT_URI, | ||
payload | ||
}); | ||
return new Promise((resolve, reject) => { | ||
this.getSocialRedirectUriResolver = { resolve, reject }; | ||
}); | ||
} | ||
async isConnected() { | ||
@@ -325,2 +342,11 @@ await this.w3mFrame.frameLoadPromise; | ||
} | ||
onGetSocialRedirectUriSuccess(event) { | ||
this.getSocialRedirectUriResolver?.resolve(event.payload); | ||
} | ||
onGetSocialRedirectUriError(event) { | ||
this.getSocialRedirectUriResolver?.reject(event.payload.message); | ||
} | ||
onGetSocialUserSuccess(event) { | ||
console.log(event.payload); | ||
} | ||
onConnectSuccess(event) { | ||
@@ -327,0 +353,0 @@ this.setEmailLoginSuccess(event.payload.email); |
@@ -30,2 +30,5 @@ import { z } from 'zod'; | ||
export const AppConnectOtpRequest = z.object({ otp: z.string() }); | ||
export const AppGetSocialRedirectUriRequest = z.object({ | ||
provider: z.enum(['google', 'apple', 'facebook', 'x', 'github', 'discord', 'twitch', 'telegram']) | ||
}); | ||
export const AppGetUserRequest = z.object({ chainId: z.optional(z.number()) }); | ||
@@ -55,7 +58,2 @@ export const AppUpdateEmailRequest = z.object({ email: z.string().email() }); | ||
}); | ||
export const FrameUpdateEmailResponse = z | ||
.object({ | ||
action: z.enum(['VERIFY_OTP']).optional() | ||
}) | ||
.optional(); | ||
export const FrameGetUserResponse = z.object({ | ||
@@ -78,2 +76,8 @@ email: z.string().email(), | ||
export const FrameSetPreferredAccountResponse = z.object({ type: z.string() }); | ||
export const FrameGetSocialRedirectUriResponse = z.object({ uri: z.string() }); | ||
export const FrameGetSocialUserResponse = z.object({ | ||
email: z.string(), | ||
address: z.string(), | ||
chainId: z.string() | ||
}); | ||
export const RpcResponse = z.any(); | ||
@@ -230,2 +234,6 @@ export const RpcEthAccountsRequest = z.object({ | ||
.or(z.object({ type: zType('APP_CONNECT_OTP'), payload: AppConnectOtpRequest })) | ||
.or(z.object({ | ||
type: zType('APP_GET_SOCIAL_REDIRECT_URI'), | ||
payload: AppGetSocialRedirectUriRequest | ||
})) | ||
.or(z.object({ type: zType('APP_GET_USER'), payload: z.optional(AppGetUserRequest) })) | ||
@@ -299,2 +307,7 @@ .or(z.object({ type: zType('APP_SIGN_OUT') })) | ||
.or(z.object({ type: zType('FRAME_CONNECT_DEVICE_SUCCESS') })) | ||
.or(z.object({ type: zType('FRAME_GET_SOCIAL_REDIRECT_URI_ERROR'), payload: zError })) | ||
.or(z.object({ | ||
type: zType('FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS'), | ||
payload: FrameGetSocialRedirectUriResponse | ||
})) | ||
.or(z.object({ type: zType('FRAME_GET_USER_ERROR'), payload: zError })) | ||
@@ -342,3 +355,7 @@ .or(z.object({ type: zType('FRAME_GET_USER_SUCCESS'), payload: FrameGetUserResponse })) | ||
.or(z.object({ type: zType('FRAME_SET_PREFERRED_ACCOUNT_ERROR'), payload: zError })) | ||
.or(z.object({ | ||
type: zType('FRAME_GET_SOCIAL_USER_SUCCESS'), | ||
payload: FrameGetSocialUserResponse | ||
})) | ||
}; | ||
//# sourceMappingURL=W3mFrameSchema.js.map |
import { z } from 'zod'; | ||
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameUpdateEmailResponse, 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'; | ||
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, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameGetSocialUserResponse } from './W3mFrameSchema.js'; | ||
//# sourceMappingURL=W3mFrameTypes.js.map |
export declare const W3mFrameConstants: { | ||
readonly SECURE_SITE_SDK: "https://secure.walletconnect.com/sdk"; | ||
readonly SECURE_SITE_SDK: "http://localhost:3010/sdk"; | ||
readonly APP_EVENT_KEY: "@w3m-app/"; | ||
@@ -17,2 +17,3 @@ readonly FRAME_EVENT_KEY: "@w3m-frame/"; | ||
readonly APP_CONNECT_OTP: "@w3m-app/CONNECT_OTP"; | ||
readonly APP_GET_SOCIAL_REDIRECT_URI: "@w3m-app/GET_SOCIAL_REDIRECT_URI"; | ||
readonly APP_GET_USER: "@w3m-app/GET_USER"; | ||
@@ -40,2 +41,4 @@ readonly APP_SIGN_OUT: "@w3m-app/SIGN_OUT"; | ||
readonly FRAME_CONNECT_OTP_ERROR: "@w3m-frame/CONNECT_OTP_ERROR"; | ||
readonly FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS: "@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS"; | ||
readonly FRAME_GET_SOCIAL_REDIRECT_URI_ERROR: "@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR"; | ||
readonly FRAME_GET_USER_SUCCESS: "@w3m-frame/GET_USER_SUCCESS"; | ||
@@ -68,2 +71,3 @@ readonly FRAME_GET_USER_ERROR: "@w3m-frame/GET_USER_ERROR"; | ||
readonly FRAME_SET_PREFERRED_ACCOUNT_ERROR: "@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR"; | ||
readonly FRAME_GET_SOCIAL_USER_SUCCESS: "@w3m-frame/GET_SOCIAL_USER_SUCCESS"; | ||
}; | ||
@@ -70,0 +74,0 @@ export declare const W3mFrameRpcConstants: { |
@@ -7,2 +7,3 @@ import type { W3mFrameTypes } from './W3mFrameTypes.js'; | ||
private connectOtpResolver; | ||
private getSocialRedirectUriResolver; | ||
private connectResolver; | ||
@@ -31,2 +32,5 @@ private disconnectResolver; | ||
connectOtp(payload: W3mFrameTypes.Requests['AppConnectOtpRequest']): Promise<unknown>; | ||
getSocialRedirectUri(payload: W3mFrameTypes.Requests['AppGetSocialRedirectUriRequest']): Promise<{ | ||
uri: string; | ||
}>; | ||
isConnected(): Promise<{ | ||
@@ -74,2 +78,5 @@ isConnected: boolean; | ||
private onConnectOtpError; | ||
private onGetSocialRedirectUriSuccess; | ||
private onGetSocialRedirectUriError; | ||
private onGetSocialUserSuccess; | ||
private onConnectSuccess; | ||
@@ -76,0 +83,0 @@ private onConnectError; |
import { z } from 'zod'; | ||
import { W3mFrameSchema, AppConnectEmailRequest, AppConnectOtpRequest, AppSwitchNetworkRequest, FrameConnectEmailResponse, FrameUpdateEmailResponse, 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'; | ||
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, AppGetSocialRedirectUriRequest, FrameGetSocialRedirectUriResponse, FrameGetSocialUserResponse } from './W3mFrameSchema.js'; | ||
export declare namespace W3mFrameTypes { | ||
@@ -9,2 +9,3 @@ type AppEvent = z.infer<typeof W3mFrameSchema.appEvent>; | ||
AppConnectOtpRequest: z.infer<typeof AppConnectOtpRequest>; | ||
AppGetSocialRedirectUriRequest: z.infer<typeof AppGetSocialRedirectUriRequest>; | ||
AppSwitchNetworkRequest: z.infer<typeof AppSwitchNetworkRequest>; | ||
@@ -23,3 +24,2 @@ AppGetUserRequest: z.infer<typeof AppGetUserRequest>; | ||
FrameIsConnectedResponse: z.infer<typeof FrameIsConnectedResponse>; | ||
FrameUpdateEmailResponse: z.infer<typeof FrameUpdateEmailResponse>; | ||
FrameUpdateEmailSecondaryOtpResolver: z.infer<typeof FrameUpdateEmailSecondaryOtpResolver>; | ||
@@ -29,2 +29,4 @@ FrameSwitchNetworkResponse: z.infer<typeof FrameSwitchNetworkResponse>; | ||
FrameInitSmartAccountResponse: z.infer<typeof FrameInitSmartAccountResponse>; | ||
FrameGetSocialRedirectUriResponse: z.infer<typeof FrameGetSocialRedirectUriResponse>; | ||
FrameGetSocialUserResponse: z.infer<typeof FrameGetSocialUserResponse>; | ||
} | ||
@@ -38,2 +40,3 @@ interface Network { | ||
type FrameSessionType = z.infer<typeof FrameSession>; | ||
type SocialProvider = 'google' | 'apple' | 'facebook' | 'x' | 'github' | 'discord' | 'twitch' | 'telegram'; | ||
} |
{ | ||
"name": "@web3modal/wallet", | ||
"version": "4.1.2-rer314x.0", | ||
"version": "4.1.3-aw214x.1", | ||
"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
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
181752
3538