Skip to content

Commit

Permalink
Update supports description
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed May 30, 2024
1 parent bc3a57c commit d5fcc15
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions src/request/types/btcMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
*/

import { z } from 'zod';
import { Address, AddressPurpose, addressSchema } from '../../addresses';
import { AddressPurpose, addressSchema } from '../../addresses';
import { MethodParamsAndResult, rpcRequestMessageSchema } from '../../types';

export const getInfoMethodName = 'getInfo';
export const getInfoParamsSchema = z.undefined();
export const getInfoResultSchema = z.object({
version: z.union([z.number(), z.string()]),
/**
* Version of the wallet.
*/
version: z.string(),

/**
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
*/
methods: z.array(z.string()).optional(),

/**
* List of WBIP standards supported by the wallet. Not currently used.
*/
supports: z.array(z.string()),
});
export const getInfoSchema = rpcRequestMessageSchema.extend({
Expand Down Expand Up @@ -51,33 +62,40 @@ export type GetAddresses = MethodParamsAndResult<
z.infer<typeof getAddressesResultSchema>
>;

export type SignMessageParams = {
export const signMessageMethodName = 'signMessage';
export const signMessageParamsSchema = z.object({
/**
* The address used for signing.
**/
address: string;
address: z.string(),
/**
* The message to sign.
**/
message: string;
};

type SignMessageResult = {
message: z.string(),
});
export const signMessageResultSchema = z.object({
/**
* The signature of the message.
*/
signature: string;
signature: z.string(),
/**
* hash of the message.
*/
messageHash: string;
messageHash: z.string(),
/**
* The address used for signing.
*/
address: string;
};

export type SignMessage = MethodParamsAndResult<SignMessageParams, SignMessageResult>;
address: z.string(),
});
export const signMessageRequestMessageSchema = rpcRequestMessageSchema.extend({
method: z.literal(getAddressesMethodName),
params: signMessageParamsSchema,
id: z.string(),
});
export type SignMessage = MethodParamsAndResult<
z.infer<typeof signMessageParamsSchema>,
z.infer<typeof signMessageResultSchema>
>;

type Recipient = {
/**
Expand Down

0 comments on commit d5fcc15

Please sign in to comment.