Skip to content

Commit

Permalink
Rename method names
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Jun 27, 2024
1 parent 596a6e1 commit c6e299d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/request/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
36 changes: 18 additions & 18 deletions src/request/types/walletMethods.ts
Original file line number Diff line number Diff line change
@@ -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 requestPermissionsMethodName = 'wallet_requestPermissions';
export const requestPermissionsParamsSchema = v.undefined();
export const requestPermissionsResultSchema = v.literal(true);
export const requestPermissionsRequestMessageSchema = v.object({
...rpcRequestMessageSchema.entries,
...v.object({
method: v.literal(connectMethodName),
params: connectParamsSchema,
method: v.literal(requestPermissionsMethodName),
params: requestPermissionsParamsSchema,
id: v.string(),
}).entries,
});
export type Connect = MethodParamsAndResult<
v.InferOutput<typeof connectParamsSchema>,
v.InferOutput<typeof connectResultSchema>
export type RequestPermissions = MethodParamsAndResult<
v.InferOutput<typeof requestPermissionsParamsSchema>,
v.InferOutput<typeof requestPermissionsResultSchema>
>;

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<typeof disconnectParamsSchema>,
v.InferOutput<typeof disconnectResultSchema>
export type RenouncePermissions = MethodParamsAndResult<
v.InferOutput<typeof renouncePermissionsParamsSchema>,
v.InferOutput<typeof renouncePermissionsResultSchema>
>;

0 comments on commit c6e299d

Please sign in to comment.