Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding erc 7715 rpc method on @web3modal/wallet package #2597

Merged
merged 7 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/wallet/src/W3mFrameConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ export const W3mFrameRpcConstants = {
'eth_syncing',
'eth_uninstallFilter'
],
NOT_SAFE_RPC_METHODS: ['personal_sign', 'eth_signTypedData_v4', 'eth_sendTransaction'],
NOT_SAFE_RPC_METHODS: [
'personal_sign',
'eth_signTypedData_v4',
'eth_sendTransaction',
'wallet_grantPermissions'
],
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',
Expand Down
5 changes: 5 additions & 0 deletions packages/wallet/src/W3mFrameSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ export const WalletGetCallsReceiptRequest = z.object({
export const WalletGetCapabilitiesRequest = z.object({
method: z.literal('wallet_getCapabilities')
})
export const WalletGrantPermissionsRequest = z.object({
method: z.literal('wallet_grantPermissions'),
params: z.array(z.any())
})

export const FrameSession = z.object({
token: z.string()
Expand Down Expand Up @@ -457,6 +461,7 @@ export const W3mFrameSchema = {
.or(WalletGetCallsReceiptRequest)
.or(WalletSendCallsRequest)
.or(WalletGetCapabilitiesRequest)
.or(WalletGrantPermissionsRequest)
})
)

Expand Down
4 changes: 3 additions & 1 deletion packages/wallet/src/W3mFrameTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ import {
AppConnectSocialRequest,
AppSetPreferredAccountRequest,
FrameSetPreferredAccountResponse,
WalletGetCapabilitiesRequest
WalletGetCapabilitiesRequest,
WalletGrantPermissionsRequest
} from './W3mFrameSchema.js'
import type { W3mFrameRpcConstants } from './W3mFrameConstants.js'

Expand Down Expand Up @@ -168,6 +169,7 @@ export namespace W3mFrameTypes {
| z.infer<typeof WalletSendCallsRequest>
| z.infer<typeof WalletGetCallsReceiptRequest>
| z.infer<typeof WalletGetCapabilitiesRequest>
| z.infer<typeof WalletGrantPermissionsRequest>

export type RPCResponse = z.infer<typeof RpcResponse>

Expand Down
Loading