@web3modal/wallet
Advanced tools
Comparing version 4.1.3 to 4.1.4
@@ -67,3 +67,4 @@ import { W3mFrameConstants } from './W3mFrameConstants.js'; | ||
iframe.style.opacity = '0'; | ||
iframe.style.borderRadius = `clamp(0px, var(--wui-border-radius-l), 44px)`; | ||
iframe.style.borderBottomLeftRadius = `clamp(0px, var(--wui-border-radius-l), 44px)`; | ||
iframe.style.borderBottomRightRadius = `clamp(0px, var(--wui-border-radius-l), 44px)`; | ||
document.body.appendChild(iframe); | ||
@@ -70,0 +71,0 @@ this.iframe = iframe; |
@@ -13,2 +13,4 @@ export const W3mFrameConstants = { | ||
PREFERRED_ACCOUNT_TYPE: 'PREFERRED_ACCOUNT_TYPE', | ||
SMART_ACCOUNT_ENABLED: 'SMART_ACCOUNT_ENABLED', | ||
SMART_ACCOUNT_ENABLED_NETWORKS: 'SMART_ACCOUNT_ENABLED_NETWORKS', | ||
APP_SWITCH_NETWORK: '@w3m-app/SWITCH_NETWORK', | ||
@@ -108,4 +110,8 @@ APP_CONNECT_EMAIL: '@w3m-app/CONNECT_EMAIL', | ||
RPC_METHOD_NOT_ALLOWED_MESSAGE: 'Requested RPC call is not allowed', | ||
RPC_METHOD_NOT_ALLOWED_UI_MESSAGE: 'Action not allowed' | ||
RPC_METHOD_NOT_ALLOWED_UI_MESSAGE: 'Action not allowed', | ||
ACCOUNT_TYPES: { | ||
EOA: 'eoa', | ||
SMART_ACCOUNT: 'smartAccount' | ||
} | ||
}; | ||
//# sourceMappingURL=W3mFrameConstants.js.map |
@@ -61,4 +61,8 @@ import { W3mFrameStorage } from './W3mFrameStorage.js'; | ||
}, | ||
getPreferredAccountType() { | ||
const storedType = W3mFrameStorage.get(W3mFrameConstants.PREFERRED_ACCOUNT_TYPE); | ||
return storedType || W3mFrameRpcConstants.ACCOUNT_TYPES.EOA; | ||
}, | ||
isClient: typeof window !== 'undefined' | ||
}; | ||
//# sourceMappingURL=W3mFrameHelpers.js.map |
@@ -22,3 +22,2 @@ import { W3mFrame } from './W3mFrame.js'; | ||
this.smartAccountEnabledNetworksResolver = undefined; | ||
this.initSmartAccountResolver = undefined; | ||
this.setPreferredAccountResolver = undefined; | ||
@@ -91,6 +90,2 @@ this.w3mFrame = new W3mFrame(projectId, true); | ||
return this.onSmartAccountEnabledNetworksError(event); | ||
case W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_SUCCESS: | ||
return this.onInitSmartAccountSuccess(event); | ||
case W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_ERROR: | ||
return this.onInitSmartAccountError(event); | ||
case W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS: | ||
@@ -204,9 +199,2 @@ return this.onPreferSmartAccountSuccess(event); | ||
} | ||
async initSmartAccount() { | ||
await this.w3mFrame.frameLoadPromise; | ||
this.w3mFrame.events.postAppEvent({ type: W3mFrameConstants.APP_INIT_SMART_ACCOUNT }); | ||
return new Promise((resolve, reject) => { | ||
this.initSmartAccountResolver = { resolve, reject }; | ||
}); | ||
} | ||
async setPreferredAccount(type) { | ||
@@ -227,3 +215,3 @@ await this.w3mFrame.frameLoadPromise; | ||
type: W3mFrameConstants.APP_GET_USER, | ||
payload: { chainId } | ||
payload: { chainId, preferredAccountType: payload?.preferredAccountType } | ||
}); | ||
@@ -281,3 +269,3 @@ return new Promise((resolve, reject) => { | ||
if (event.type === W3mFrameConstants.FRAME_GET_USER_SUCCESS) { | ||
callback(); | ||
callback(event.payload); | ||
} | ||
@@ -297,12 +285,22 @@ }); | ||
} | ||
onInitSmartAccount(callback) { | ||
onSetPreferredAccount(callback) { | ||
this.w3mFrame.events.onFrameEvent(event => { | ||
if (event.type === W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_SUCCESS) { | ||
callback(event.payload.isDeployed); | ||
if (event.type === W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS) { | ||
callback(event.payload); | ||
} | ||
else if (event.type === W3mFrameConstants.FRAME_INIT_SMART_ACCOUNT_ERROR) { | ||
callback(false); | ||
else if (event.type === W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_ERROR) { | ||
callback({ type: W3mFrameRpcConstants.ACCOUNT_TYPES.EOA }); | ||
} | ||
}); | ||
} | ||
onGetSmartAccountEnabledNetworks(callback) { | ||
this.w3mFrame.events.onFrameEvent(event => { | ||
if (event.type === W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS) { | ||
callback(event.payload.smartAccountEnabledNetworks); | ||
} | ||
else if (event.type === W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR) { | ||
callback([]); | ||
} | ||
}); | ||
} | ||
onConnectEmailSuccess(event) { | ||
@@ -410,13 +408,9 @@ this.connectEmailResolver?.resolve(event.payload); | ||
onSmartAccountEnabledNetworksSuccess(event) { | ||
this.persistSmartAccountEnabledNetworks(event.payload.smartAccountEnabledNetworks); | ||
this.smartAccountEnabledNetworksResolver?.resolve(event.payload); | ||
} | ||
onSmartAccountEnabledNetworksError(event) { | ||
this.persistSmartAccountEnabledNetworks([]); | ||
this.smartAccountEnabledNetworksResolver?.reject(event.payload.message); | ||
} | ||
onInitSmartAccountSuccess(event) { | ||
this.initSmartAccountResolver?.resolve(event.payload); | ||
} | ||
onInitSmartAccountError(event) { | ||
this.initSmartAccountResolver?.reject(event.payload.message); | ||
} | ||
onPreferSmartAccountSuccess(event) { | ||
@@ -451,3 +445,6 @@ this.persistPreferredAccount(event.payload.type); | ||
} | ||
persistSmartAccountEnabledNetworks(networks) { | ||
W3mFrameStorage.set(W3mFrameConstants.SMART_ACCOUNT_ENABLED_NETWORKS, networks.join(',')); | ||
} | ||
} | ||
//# sourceMappingURL=W3mFrameProvider.js.map |
@@ -326,6 +326,2 @@ import { z } from 'zod'; | ||
})) | ||
.or(z.object({ | ||
type: zType('FRAME_INIT_SMART_ACCOUNT_SUCCESS'), | ||
payload: FrameInitSmartAccountResponse | ||
})) | ||
.or(z.object({ type: zType('FRAME_INIT_SMART_ACCOUNT_ERROR'), payload: zError })) | ||
@@ -332,0 +328,0 @@ .or(z.object({ |
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, 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 } from './W3mFrameSchema.js'; | ||
//# sourceMappingURL=W3mFrameTypes.js.map |
@@ -13,2 +13,4 @@ export declare const W3mFrameConstants: { | ||
readonly PREFERRED_ACCOUNT_TYPE: "PREFERRED_ACCOUNT_TYPE"; | ||
readonly SMART_ACCOUNT_ENABLED: "SMART_ACCOUNT_ENABLED"; | ||
readonly SMART_ACCOUNT_ENABLED_NETWORKS: "SMART_ACCOUNT_ENABLED_NETWORKS"; | ||
readonly APP_SWITCH_NETWORK: "@w3m-app/SWITCH_NETWORK"; | ||
@@ -74,2 +76,6 @@ readonly APP_CONNECT_EMAIL: "@w3m-app/CONNECT_EMAIL"; | ||
RPC_METHOD_NOT_ALLOWED_UI_MESSAGE: string; | ||
ACCOUNT_TYPES: { | ||
readonly EOA: "eoa"; | ||
readonly SMART_ACCOUNT: "smartAccount"; | ||
}; | ||
}; |
@@ -0,1 +1,2 @@ | ||
import type { W3mFrameTypes } from './W3mFrameTypes.js'; | ||
export declare const W3mFrameHelpers: { | ||
@@ -8,3 +9,4 @@ getBlockchainApiUrl(): false | "https://rpc.walletconnect.org" | "https://rpc.walletconnect.com"; | ||
checkIfRequestIsAllowed(request: unknown): boolean; | ||
getPreferredAccountType(): W3mFrameTypes.AccountType; | ||
isClient: boolean; | ||
}; |
@@ -19,3 +19,2 @@ import type { W3mFrameTypes } from './W3mFrameTypes.js'; | ||
private smartAccountEnabledNetworksResolver; | ||
private initSmartAccountResolver; | ||
private setPreferredAccountResolver; | ||
@@ -47,7 +46,3 @@ constructor(projectId: string); | ||
}>; | ||
initSmartAccount(): Promise<{ | ||
address: string; | ||
isDeployed: boolean; | ||
}>; | ||
setPreferredAccount(type: 'eoa' | 'smartAccount'): Promise<unknown>; | ||
setPreferredAccount(type: W3mFrameTypes.AccountType): Promise<unknown>; | ||
connect(payload?: W3mFrameTypes.Requests['AppGetUserRequest']): Promise<{ | ||
@@ -66,5 +61,9 @@ chainId: number; | ||
onRpcResponse(callback: (request: unknown) => void): void; | ||
onIsConnected(callback: () => void): void; | ||
onIsConnected(callback: (request: W3mFrameTypes.Responses['FrameGetUserResponse']) => void): void; | ||
onNotConnected(callback: () => void): void; | ||
onInitSmartAccount(callback: (isDeployed: boolean) => void): void; | ||
onSetPreferredAccount(callback: ({ type, address }: { | ||
type: string; | ||
address?: string; | ||
}) => void): void; | ||
onGetSmartAccountEnabledNetworks(callback: (networks: number[]) => void): void; | ||
private onConnectEmailSuccess; | ||
@@ -101,4 +100,2 @@ private onConnectEmailError; | ||
private onSmartAccountEnabledNetworksError; | ||
private onInitSmartAccountSuccess; | ||
private onInitSmartAccountError; | ||
private onPreferSmartAccountSuccess; | ||
@@ -112,2 +109,3 @@ private onPreferSmartAccountError; | ||
private persistPreferredAccount; | ||
private persistSmartAccountEnabledNetworks; | ||
} |
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, 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 } from './W3mFrameSchema.js'; | ||
import type { W3mFrameRpcConstants } from './W3mFrameConstants.js'; | ||
export declare namespace W3mFrameTypes { | ||
@@ -25,3 +26,2 @@ type AppEvent = z.infer<typeof W3mFrameSchema.appEvent>; | ||
FrameGetSmartAccountEnabledNetworksResponse: z.infer<typeof FrameGetSmartAccountEnabledNetworksResponse>; | ||
FrameInitSmartAccountResponse: z.infer<typeof FrameInitSmartAccountResponse>; | ||
} | ||
@@ -35,2 +35,3 @@ interface Network { | ||
type FrameSessionType = z.infer<typeof FrameSession>; | ||
type AccountType = (typeof W3mFrameRpcConstants.ACCOUNT_TYPES)[keyof typeof W3mFrameRpcConstants.ACCOUNT_TYPES]; | ||
} |
{ | ||
"name": "@web3modal/wallet", | ||
"version": "4.1.3", | ||
"version": "4.1.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
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
175473
3382