From 090c9359fd1e158527f56d15c9a581123c6301c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Bardaj=C3=AD=20Puig?= Date: Thu, 27 Jun 2024 09:09:48 +0100 Subject: [PATCH] Rename method names --- src/request/types/index.ts | 6 ++--- src/request/types/walletMethods.ts | 36 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/request/types/index.ts b/src/request/types/index.ts index ed4e7dd..83ffc6f 100644 --- a/src/request/types/index.ts +++ b/src/request/types/index.ts @@ -27,7 +27,7 @@ import { StxSignTransaction, StxTransferStx, } from './stxMethods'; -import { Connect, Disconnect } from './walletMethods'; +import { RequestPermissions, RenouncePermissions } from './walletMethods'; export interface StxRequests { stx_callContract: StxCallContract; @@ -68,8 +68,8 @@ export interface RunesRequests { export type RunesRequestMethod = keyof RunesRequests; export interface WalletMethods { - wallet_connect: Connect; - wallet_disconnect: Disconnect; + wallet_requestPermissions: RequestPermissions; + wallet_renouncePermissions: RenouncePermissions; } export type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods; diff --git a/src/request/types/walletMethods.ts b/src/request/types/walletMethods.ts index c6b6684..ec4a2ed 100644 --- a/src/request/types/walletMethods.ts +++ b/src/request/types/walletMethods.ts @@ -1,34 +1,34 @@ import { MethodParamsAndResult, rpcRequestMessageSchema } from '../../types'; import * as v from 'valibot'; -export const connectMethodName = 'wallet_connect'; -export const connectParamsSchema = v.undefined(); -export const connectResultSchema = v.literal(true); -export const connectRequestMessageSchema = v.object({ +export const grantPermissionsMethodName = 'wallet_requestPermissions'; +export const grantPermissionsParamsSchema = v.undefined(); +export const grantPermissionsResultSchema = v.literal(true); +export const grantPermissionsRequestMessageSchema = v.object({ ...rpcRequestMessageSchema.entries, ...v.object({ - method: v.literal(connectMethodName), - params: connectParamsSchema, + method: v.literal(grantPermissionsMethodName), + params: grantPermissionsParamsSchema, id: v.string(), }).entries, }); -export type Connect = MethodParamsAndResult< - v.InferOutput, - v.InferOutput +export type RequestPermissions = MethodParamsAndResult< + v.InferOutput, + v.InferOutput >; -export const disconnectMethodName = 'wallet_disconnect'; -export const disconnectParamsSchema = v.undefined(); -export const disconnectResultSchema = v.literal(true); -export const disconnectRequestMessageSchema = v.object({ +export const renouncePermissionsMethodName = 'wallet_renouncePermissions'; +export const renouncePermissionsParamsSchema = v.undefined(); +export const renouncePermissionsResultSchema = v.literal(true); +export const renouncePermissionsRequestMessageSchema = v.object({ ...rpcRequestMessageSchema.entries, ...v.object({ - method: v.literal(disconnectMethodName), - params: disconnectParamsSchema, + method: v.literal(renouncePermissionsMethodName), + params: renouncePermissionsParamsSchema, id: v.string(), }).entries, }); -export type Disconnect = MethodParamsAndResult< - v.InferOutput, - v.InferOutput +export type RenouncePermissions = MethodParamsAndResult< + v.InferOutput, + v.InferOutput >;