UNPKG

1.36 kBTypeScriptView Raw
1/// <reference types="node" />
2/**
3 * Represents a payment object, which is used to create a payment.
4 *
5 * Supports P2PKH、P2SH、P2WPKH、P2WSH、P2TR and so on
6 *
7 * @packageDocumentation
8 */
9import { Network } from '../networks';
10import { Taptree } from '../types';
11import { p2data as embed } from './embed';
12import { p2ms } from './p2ms';
13import { p2pk } from './p2pk';
14import { p2pkh } from './p2pkh';
15import { p2sh } from './p2sh';
16import { p2wpkh } from './p2wpkh';
17import { p2wsh } from './p2wsh';
18import { p2tr } from './p2tr';
19export interface Payment {
20 name?: string;
21 network?: Network;
22 output?: Buffer;
23 data?: Buffer[];
24 m?: number;
25 n?: number;
26 pubkeys?: Buffer[];
27 input?: Buffer;
28 signatures?: Buffer[];
29 internalPubkey?: Buffer;
30 pubkey?: Buffer;
31 signature?: Buffer;
32 address?: string;
33 hash?: Buffer;
34 redeem?: Payment;
35 redeemVersion?: number;
36 scriptTree?: Taptree;
37 witness?: Buffer[];
38}
39export type PaymentCreator = (a: Payment, opts?: PaymentOpts) => Payment;
40export type PaymentFunction = () => Payment;
41export interface PaymentOpts {
42 validate?: boolean;
43 allowIncomplete?: boolean;
44}
45export type StackElement = Buffer | number;
46export type Stack = StackElement[];
47export type StackFunction = () => Stack;
48export { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh, p2tr };