Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions typings/block/Block.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BufferReader } from '../buffer/BufferReader';
import { BufferWriter } from '../buffer/BufferWriter';
import { BlockHeader } from './BlockHeader';
import { MerkleBlock } from './MerkleBlock';
import { Transaction } from '../transaction/Transaction';

export namespace Block {
Expand All @@ -9,7 +10,7 @@ export namespace Block {
* @property {Transaction.toObjectParams[]} transactions
* @property {BlockHeader.toObjectParams} header
*/
type fromObjectParams = {
export type fromObjectParams = {
transactions: Transaction[];
header: BlockHeader.toObjectParams;
};
Expand All @@ -23,7 +24,7 @@ export namespace Block {
* @property {number} bits
* @property {number} nonce
*/
type toObjectParams = {
export type toObjectParams = {
hash: string;
version: number;
prevHash: string;
Expand All @@ -33,10 +34,13 @@ export namespace Block {
nonce: number;
};

type Values = {
export type Values = {
START_OF_BLOCK: number;
NULL_HASH: Buffer;
};

export { BlockHeader };
export { MerkleBlock };
}

/**
Expand Down
8 changes: 8 additions & 0 deletions typings/govobject/GovObject.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { Proposal } from './Proposal';
import { Trigger } from './Trigger';

export namespace GovObject {
export { Proposal };
export { Trigger };
}

/**
* Represents a generic Governance Object
*
Expand Down
22 changes: 17 additions & 5 deletions typings/transaction/Transaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Signature } from '../crypto/Signature';
import { AbstractPayload } from './payload/AbstractPayload';
import { bitcore } from '../bitcore';
import { TransactionSignature } from './TransactionSignature';
import { UnspentOutput } from './UnspentOutput';

export namespace Transaction {
/**
Expand All @@ -17,7 +18,7 @@ export namespace Transaction {
* @property {(Buffer|string|Script)} script
* @property {number} satoshis
*/
type fromObjectParams = {
export type fromObjectParams = {
prevTxId: string;
outputIndex: number;
script: Buffer | string | Script;
Expand All @@ -28,10 +29,15 @@ export namespace Transaction {
* @property {(string|Address)} address
* @property {number} satoshis
*/
type toObjectParams = {
export type toObjectParams = {
address: string | Address;
satoshis: number;
};

export { Input };
export { Output };
export { UnspentOutput };
export { TransactionSignature as Signature };
}
/**
* Represents a transaction, a set of inputs and outputs to change ownership of tokens
Expand Down Expand Up @@ -177,10 +183,10 @@ export class Transaction {
* @param {number=} threshold
*/
from(
utxo: Transaction.fromObjectParams[] | Transaction.fromObjectParams,
utxo: Transaction.fromObjectParams[] | Transaction.fromObjectParams | UnspentOutput | UnspentOutput[],
pubkeys?: any[],
threshold?: number
): void;
): Transaction;

/**
* Add an input to this transaction. The input must be an instance of the `Input` class.
Expand Down Expand Up @@ -239,7 +245,7 @@ export class Transaction {
* @param {Address} address An address for change to be sent to.
* @return {Transaction} this, for chaining
*/
change(address: Address): Transaction;
change(address: Address | string): Transaction;

/**
* @return {Output} change output, if it exists
Expand Down Expand Up @@ -476,6 +482,12 @@ export class Transaction {
*/
toJSON(): any;

/**
* @function
* @returns {Buffer} Buffer with the transaction bytes
*/
toBuffer(): Buffer;

/**
* @param {Number} fundingAmount
* @return {Transaction}
Expand Down