Skip to content

Commit

Permalink
Revert sendBtcTransaction -> sendTransaction renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
olistic committed Jul 15, 2023
1 parent d2846ae commit c691b2c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/provider/types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { GetAddressResponse } from '../addresses';
import type { CallWalletResponse } from '../call';
import type { SignMessageResponse } from '../messages';
import type { SendTransactionResponse, SignTransactionResponse } from '../transactions';
import type { SendBtcTransactionResponse, SignTransactionResponse } from '../transactions';

export interface BitcoinProvider {
call: (request: string) => Promise<CallWalletResponse>;
connect: (request: string) => Promise<GetAddressResponse>;
signMessage: (request: string) => Promise<SignMessageResponse>;
signTransaction: (request: string) => Promise<SignTransactionResponse>;
sendTransaction: (request: string) => Promise<SendTransactionResponse>;
sendBtcTransaction: (request: string) => Promise<SendBtcTransactionResponse>;
}

declare global {
Expand Down
2 changes: 1 addition & 1 deletion src/transactions/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './sendTransaction';
export * from './sendBtcTransaction';
export * from './signTransaction';
export * from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { Json } from 'jsontokens';
import { createUnsecuredToken } from 'jsontokens';

import { getDefaultProvider } from '../provider';
import type { SendTransactionOptions } from './types';
import type { SendBtcTransactionOptions } from './types';

export const sendTransaction = async (options: SendTransactionOptions) => {
export const sendBtcTransaction = async (options: SendBtcTransactionOptions) => {
const { getProvider = getDefaultProvider } = options;
const provider = await getProvider();
if (!provider) {
Expand All @@ -21,7 +21,7 @@ export const sendTransaction = async (options: SendTransactionOptions) => {

try {
const request = createUnsecuredToken(options.payload as unknown as Json);
const response = await provider.sendTransaction(request);
const response = await provider.sendBtcTransaction(request);
options.onFinish?.(response);
} catch (error) {
console.error('[Connect] Error during send BTC transaction request', error);
Expand Down
10 changes: 5 additions & 5 deletions src/transactions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ export interface Recipient {
amountSats: bigint;
}

export interface SendTransactionPayload extends RequestPayload {
export interface SendBtcTransactionPayload extends RequestPayload {
recipients: Recipient[];
senderAddress: string;
message?: string;
}

export type SendTransactionResponse = string;
export type SendBtcTransactionResponse = string;

export type SendTransactionOptions = RequestOptions<
SendTransactionPayload,
SendTransactionResponse
export type SendBtcTransactionOptions = RequestOptions<
SendBtcTransactionPayload,
SendBtcTransactionResponse
>;

export interface InputToSign {
Expand Down

0 comments on commit c691b2c

Please sign in to comment.