Skip to content

Commit

Permalink
Add types
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Oct 3, 2024
1 parent 4d7865f commit 4a3b681
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/request/types/btcMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,35 @@ type Recipient = {
amount: number;
};

export type SendTransferParams = {
export const sendTransferMethodName = 'sendTransfer';
export const sendTransferParamsSchema = v.object({
/**
* Array of recipients to send to.
* The amount to send to each recipient is in satoshis.
*/
recipients: Array<Recipient>;
};
type SendTransferResult = {
recipients: v.array(
v.object({
address: v.string(),
amount: v.number(),
})
),
});
export type SendTransferParams = v.InferOutput<typeof sendTransferParamsSchema>;
export const sendTransferResultSchema = v.object({
/**
* The transaction id as a hex-encoded string.
*/
txid: string;
};

txid: v.string(),
});
export type SendTransferResult = v.InferOutput<typeof sendTransferResultSchema>;
export const sendTransferRequestMessageSchema = v.object({
...rpcRequestMessageSchema.entries,
...v.object({
method: v.literal(sendTransferMethodName),
params: sendTransferParamsSchema,
id: v.string(),
}).entries,
});
export type SendTransfer = MethodParamsAndResult<SendTransferParams, SendTransferResult>;

export type SignPsbtParams = {
Expand Down

0 comments on commit 4a3b681

Please sign in to comment.