Skip to content

Commit

Permalink
adding erc 7715 rpc method on @web3modal/wallet package (#2597)
Browse files Browse the repository at this point in the history
  • Loading branch information
KannuSingh authored Jul 29, 2024
1 parent 4618fab commit 7fe0677
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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

0 comments on commit 7fe0677

Please sign in to comment.