Skip to content

Commit

Permalink
fix(rpc): add stx public key, improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Jul 29, 2024
1 parent eb39896 commit 8940013
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions packages/rpc/src/methods/get-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,35 @@ import { DefineRpcMethod, RpcRequest, RpcResponse } from '../rpc';

export type PaymentTypes = 'p2pkh' | 'p2sh' | 'p2wpkh-p2sh' | 'p2wpkh' | 'p2tr';

export interface BtcAddress extends AllowAdditionalProperties {
export interface BtcAddressBase extends AllowAdditionalProperties {
symbol: 'BTC';
type: PaymentTypes;
address: string;
publicKey: string;
derivationPath: string;
}

export interface NativeSegwitAddress extends BtcAddressBase {
type: 'p2wpkh';
}

export interface TaprootAddress extends BtcAddressBase {
type: 'p2tr';
tweakedPublicKey: string;
}

export type BtcAddress = NativeSegwitAddress | TaprootAddress;

export interface StxAddress extends AllowAdditionalProperties {
symbol: 'STX';
address: string;
publicKey: string;
}

export type Address = BtcAddress | StxAddress;

export interface AddressResponseBody extends AllowAdditionalProperties {
addresses: BtcAddress[];
addresses: Address[];
}

export type GetAddressesRequest = RpcRequest<'getAddresses'>;
Expand Down

0 comments on commit 8940013

Please sign in to comment.