mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #17704 from dlebrecht/bitcoinjs-lib
updated bitcoinjs-lib to version 3.0.3, more complete type definition, less any
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import bigi = require('bigi');
|
||||
import bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
@@ -8,57 +6,57 @@ declare const describe: any;
|
||||
declare const assert: any;
|
||||
|
||||
describe('bitcoinjs-lib (basic)', () => {
|
||||
it('can generate a random bitcoin address', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
it('can generate a random bitcoin address', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
// generate random keyPair
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
const address = keyPair.getAddress();
|
||||
// generate random keyPair
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
|
||||
});
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
|
||||
});
|
||||
|
||||
it('can generate an address from a SHA256 hash', () => {
|
||||
const hash = bitcoin.crypto.sha256('correct horse battery staple');
|
||||
const d = bigi.fromBuffer(hash);
|
||||
it('can generate an address from a SHA256 hash', () => {
|
||||
const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple', 'utf8'));
|
||||
const d = bigi.fromBuffer(hash);
|
||||
|
||||
const keyPair = new bitcoin.ECPair(d);
|
||||
const address = keyPair.getAddress();
|
||||
const keyPair = new bitcoin.ECPair(d);
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
|
||||
});
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
|
||||
});
|
||||
|
||||
it('can generate a random keypair for alternative networks', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
it('can generate a random keypair for alternative networks', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
const litecoin = bitcoin.networks.litecoin;
|
||||
const litecoin = bitcoin.networks.litecoin;
|
||||
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
const wif = keyPair.toWIF();
|
||||
const address = keyPair.getAddress();
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
const wif = keyPair.toWIF();
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
|
||||
});
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
|
||||
});
|
||||
|
||||
it('can import an address via WIF', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
|
||||
const address = keyPair.getAddress();
|
||||
it('can import an address via WIF', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct', bitcoin.networks.testnet);
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
|
||||
});
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
|
||||
});
|
||||
|
||||
it('can create a Transaction', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
|
||||
const tx = new bitcoin.TransactionBuilder();
|
||||
it('can create a Transaction', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy', bitcoin.networks.testnet);
|
||||
const tx = new bitcoin.TransactionBuilder();
|
||||
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
|
||||
tx.sign(0, keyPair);
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
|
||||
tx.sign(0, keyPair);
|
||||
|
||||
// tslint:disable-next-line:max-line-length
|
||||
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000');
|
||||
});
|
||||
// tslint:disable-next-line:max-line-length
|
||||
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000');
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+289
-259
@@ -1,114 +1,238 @@
|
||||
// Type definitions for bitcoinjs-lib 2.3
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Type definitions for bitcoinjs-lib 3.0
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Daniel <https://github.com/dlebrecht>
|
||||
// Ron Buckton <https://github.com/rbuckton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Declaration file initially generated by dts-gen for bitcoinjs-lib 3.0.3
|
||||
// based on the flow version found at https://github.com/flowtype/flow-typed/blob/master/definitions/npm/bitcoinjs-lib_v2.x.x/flow_v0.17.x-/bitcoinjs-lib_v2.x.x.js
|
||||
|
||||
export class Block {
|
||||
constructor();
|
||||
checkMerkleRoot(): any;
|
||||
checkProofOfWork(): any;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
getUTCDate(): any;
|
||||
toBuffer(headersOnly: any): any;
|
||||
toHex(headersOnly: any): any;
|
||||
static calculateMerkleRoot(transactions: any): any;
|
||||
static calculateTarget(bits: any): any;
|
||||
static fromBuffer(buffer: any): any;
|
||||
static fromHex(hex: any): any;
|
||||
/// <reference types="node" />
|
||||
import BigInteger = require("bigi");
|
||||
|
||||
export interface Utxo {
|
||||
address: string;
|
||||
amount: number;
|
||||
scriptPubKey: Buffer;
|
||||
txid: string;
|
||||
vout: number;
|
||||
}
|
||||
export class ECPair {
|
||||
constructor(d: any, Q?: any, options?: any);
|
||||
getAddress(): string;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
sign(hash: any): any;
|
||||
toWIF(): string;
|
||||
verify(hash: any, signature: any): boolean;
|
||||
static fromPublicKeyBuffer(buffer: any, network: Network): ECPair;
|
||||
static fromWIF(string: any, network?: Network): ECPair;
|
||||
static makeRandom(options: any): ECPair;
|
||||
|
||||
export interface Output {
|
||||
script: Buffer;
|
||||
value: number;
|
||||
}
|
||||
export class ECSignature {
|
||||
constructor(r: any, s: any, ...args: any[]);
|
||||
toCompact(i: any, compressed: any): any;
|
||||
toDER(): any;
|
||||
toScriptSignature(hashType: any): any;
|
||||
static fromDER(buffer: any): ECSignature;
|
||||
static parseCompact(buffer: any): ECSignature;
|
||||
static parseScriptSignature(buffer: any): ECSignature;
|
||||
}
|
||||
export class HDNode {
|
||||
constructor(keyPair: any, chainCode: any, ...args: any[]);
|
||||
derive(index: any): any;
|
||||
deriveHardened(index: any): any;
|
||||
derivePath(path: any): any;
|
||||
getAddress(): string;
|
||||
getFingerprint(): any;
|
||||
getIdentifier(): any;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
isNeutered(): any;
|
||||
neutered(): any;
|
||||
sign(hash: any): any;
|
||||
toBase58(__isPrivate: any): any;
|
||||
toString(__isPrivate: any): any;
|
||||
verify(hash: any, signature: any): any;
|
||||
static HIGHEST_BIT: number;
|
||||
static LENGTH: number;
|
||||
static fromBase58(string: any, networks: Network[]): HDNode;
|
||||
static fromSeedBuffer(seed: any, network: Network, ...args: any[]): HDNode;
|
||||
static fromSeedHex(hex: any, network: Network): HDNode;
|
||||
}
|
||||
export class Transaction {
|
||||
constructor();
|
||||
addInput(hash: any, index: any, sequence: any, scriptSig: any, ...args: any[]): any;
|
||||
addOutput(scriptPubKey: any, value: any, ...args: any[]): any;
|
||||
byteLength(): number;
|
||||
clone(): Transaction;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
hashForSignature(inIndex: any, prevOutScript: any, hashType: any, ...args: any[]): any;
|
||||
isCoinbase(): boolean;
|
||||
setInputScript(index: any, scriptSig: any, ...args: any[]): void;
|
||||
toBuffer(buffer?: any, initialOffset?: any): Buffer;
|
||||
toHex(): string;
|
||||
static DEFAULT_SEQUENCE: number;
|
||||
static SIGHASH_ALL: number;
|
||||
static SIGHASH_ANYONECANPAY: number;
|
||||
static SIGHASH_NONE: number;
|
||||
static SIGHASH_SINGLE: number;
|
||||
static fromBuffer(buffer: any, __noStrict: any): Transaction;
|
||||
static fromHex(hex: any): Transaction;
|
||||
static isCoinbaseHash(buffer: any): Transaction;
|
||||
}
|
||||
export class TransactionBuilder {
|
||||
constructor(network?: Network);
|
||||
addInput(txHash: any, vout: any, sequence?: any, prevOutScript?: any): any;
|
||||
addOutput(scriptPubKey: any, value: any): any;
|
||||
build(): Transaction;
|
||||
buildIncomplete(): Transaction;
|
||||
setLockTime(locktime: number): any;
|
||||
setVersion(version: number): void;
|
||||
sign(index: any, keyPair: any, redeemScript?: any, hashType?: any): any;
|
||||
static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder;
|
||||
|
||||
export interface Input {
|
||||
script: Buffer;
|
||||
hash: Buffer;
|
||||
index: number;
|
||||
sequence: number;
|
||||
}
|
||||
|
||||
export interface Network {
|
||||
bitcoin: {
|
||||
private: number;
|
||||
public: number;
|
||||
};
|
||||
dustThreshold: number;
|
||||
messagePrefix: string;
|
||||
pubKeyHash: number;
|
||||
scriptHash: number;
|
||||
wif: number;
|
||||
bip32: {
|
||||
public: number;
|
||||
private: number;
|
||||
};
|
||||
messagePrefix: string;
|
||||
pubKeyHash: number;
|
||||
scriptHash: number;
|
||||
wif: number;
|
||||
}
|
||||
|
||||
export class Block {
|
||||
constructor();
|
||||
|
||||
byteLength(headersOnly?: boolean): number;
|
||||
|
||||
checkMerkleRoot(): any;
|
||||
|
||||
checkProofOfWork(): any;
|
||||
|
||||
getHash(): Buffer;
|
||||
|
||||
getId(): string;
|
||||
|
||||
getUTCDate(): any;
|
||||
|
||||
toBuffer(headersOnly?: boolean): Buffer;
|
||||
|
||||
toHex(headersOnly?: boolean): string;
|
||||
|
||||
static calculateMerkleRoot(transactions: Transaction[] | Array<{ getHash(): Buffer; }>): Buffer;
|
||||
|
||||
static calculateTarget(bits: number): Buffer;
|
||||
|
||||
static fromBuffer(buffer: Buffer): Block;
|
||||
|
||||
static fromHex(hex: string): Block;
|
||||
}
|
||||
|
||||
export class ECPair {
|
||||
constructor(d: BigInteger, Q?: null | undefined, options?: { compressed?: boolean, network?: Network });
|
||||
|
||||
constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
sign(hash: Buffer): Buffer;
|
||||
|
||||
toWIF(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): boolean;
|
||||
|
||||
static fromPublicKeyBuffer(buffer: Buffer, network: Network): ECPair;
|
||||
|
||||
static fromWIF(string: string, network: Network): ECPair;
|
||||
|
||||
static makeRandom(options?: { compressed?: boolean, network?: Network, rng?: Rng }): ECPair;
|
||||
}
|
||||
|
||||
export type Rng = (size: number) => Buffer;
|
||||
|
||||
export class ECSignature {
|
||||
constructor(r: BigInteger, s: BigInteger);
|
||||
|
||||
toCompact(i: number, compressed: boolean): Buffer;
|
||||
|
||||
toDER(): Buffer;
|
||||
|
||||
toScriptSignature(hashType: number): Buffer;
|
||||
|
||||
static fromDER(buffer: Buffer): ECSignature;
|
||||
|
||||
static parseCompact(buffer: Buffer): { compressed: boolean, i: number, signature: ECSignature };
|
||||
|
||||
static parseScriptSignature(buffer: Buffer): { signature: ECSignature, hashType: number };
|
||||
}
|
||||
|
||||
export class HDNode {
|
||||
constructor(keyPair: ECPair, chainCode: Buffer);
|
||||
|
||||
keyPair: ECPair;
|
||||
|
||||
derive(index: number): HDNode;
|
||||
|
||||
deriveHardened(index: number): HDNode;
|
||||
|
||||
derivePath(path: string): HDNode;
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getFingerprint(): Buffer;
|
||||
|
||||
getIdentifier(): Buffer;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
isNeutered(): boolean;
|
||||
|
||||
neutered(): HDNode;
|
||||
|
||||
sign(hash: Buffer): ECSignature;
|
||||
|
||||
toBase58(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): Buffer;
|
||||
|
||||
static HIGHEST_BIT: number;
|
||||
|
||||
static LENGTH: number;
|
||||
|
||||
static fromBase58(string: string, networks?: Network[] | Network): HDNode;
|
||||
|
||||
static fromSeedBuffer(seed: Buffer, network?: Network): HDNode;
|
||||
|
||||
static fromSeedHex(hex: string, network?: Network): HDNode;
|
||||
|
||||
static MASTER_SECRET: Buffer;
|
||||
}
|
||||
|
||||
export class Transaction {
|
||||
version: number;
|
||||
locktime: number;
|
||||
ins: Input[];
|
||||
outs: Output[];
|
||||
constructor();
|
||||
|
||||
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): number;
|
||||
|
||||
addOutput(scriptPubKey: Buffer, value: number): number;
|
||||
|
||||
byteLength(): number;
|
||||
|
||||
clone(): Transaction;
|
||||
|
||||
getHash(): Buffer;
|
||||
|
||||
getId(): string;
|
||||
|
||||
hasWitnesses(): boolean;
|
||||
|
||||
hashForSignature(inIndex: number, prevOutScript: Buffer, hashType: number): Buffer;
|
||||
|
||||
hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: number, hashType: number): Buffer;
|
||||
|
||||
isCoinbase(): boolean;
|
||||
|
||||
setInputScript(index: number, scriptSig: Buffer): void;
|
||||
|
||||
setWitness(index: number, witness: any, ...args: any[]): void;
|
||||
|
||||
toBuffer(buffer: Buffer, initialOffset?: number): Buffer;
|
||||
|
||||
toHex(): string;
|
||||
|
||||
static ADVANCED_TRANSACTION_FLAG: number;
|
||||
|
||||
static ADVANCED_TRANSACTION_MARKER: number;
|
||||
|
||||
static DEFAULT_SEQUENCE: number;
|
||||
|
||||
static SIGHASH_ALL: number;
|
||||
|
||||
static SIGHASH_ANYONECANPAY: number;
|
||||
|
||||
static SIGHASH_NONE: number;
|
||||
|
||||
static SIGHASH_SINGLE: number;
|
||||
|
||||
static fromBuffer(buffer: Buffer, __noStrict?: boolean): Transaction;
|
||||
|
||||
static fromHex(hex: string): Transaction;
|
||||
|
||||
static isCoinbaseHash(buffer: Buffer): boolean;
|
||||
}
|
||||
|
||||
export class TransactionBuilder {
|
||||
constructor(network?: Network, maximumFeeRate?: number);
|
||||
|
||||
addInput(txhash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
|
||||
|
||||
addOutput(scriptPubKey: Buffer | string, value: number): number;
|
||||
|
||||
build(): Transaction;
|
||||
|
||||
buildIncomplete(): Transaction;
|
||||
|
||||
setLockTime(locktime: number): void;
|
||||
|
||||
setVersion(version: number): void;
|
||||
|
||||
sign(vin: number, keyPair: ECPair, redeemScript?: Buffer, hashType?: number, witnessValue?: number, witnessScript?: Buffer): void;
|
||||
|
||||
static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder;
|
||||
}
|
||||
|
||||
export const networks: {
|
||||
bitcoin: Network;
|
||||
dogecoin: Network;
|
||||
litecoin: Network;
|
||||
testnet: Network;
|
||||
};
|
||||
@@ -232,172 +356,78 @@ export const opcodes: {
|
||||
OP_WITHIN: number;
|
||||
OP_XOR: number;
|
||||
};
|
||||
export namespace HDNode {
|
||||
namespace MASTER_SECRET {
|
||||
const BYTES_PER_ELEMENT: number;
|
||||
const byteLength: number;
|
||||
const byteOffset: number;
|
||||
const length: number;
|
||||
const offset: number;
|
||||
function asciiSlice(): any;
|
||||
function asciiWrite(): any;
|
||||
function base64Slice(): any;
|
||||
function base64Write(): any;
|
||||
function compare(target: any, start: any, end: any, thisStart: any, thisEnd: any): any;
|
||||
function copy(): any;
|
||||
function copyWithin(p0: any, p1: any): any;
|
||||
function entries(): any;
|
||||
function equals(b: any): any;
|
||||
function every(p0: any): any;
|
||||
function fill(val: any, start: any, end: any, encoding: any): any;
|
||||
function filter(p0: any): any;
|
||||
function find(p0: any): any;
|
||||
function findIndex(p0: any): any;
|
||||
function forEach(p0: any): any;
|
||||
function hexSlice(): any;
|
||||
function hexWrite(): any;
|
||||
function includes(val: any, byteOffset: any, encoding: any): any;
|
||||
function indexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function inspect(): any;
|
||||
function join(p0: any): any;
|
||||
function keys(): any;
|
||||
function lastIndexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function latin1Slice(): any;
|
||||
function latin1Write(): any;
|
||||
function map(p0: any): any;
|
||||
function readDoubleBE(offset: any, noAssert: any): any;
|
||||
function readDoubleLE(offset: any, noAssert: any): any;
|
||||
function readFloatBE(offset: any, noAssert: any): any;
|
||||
function readFloatLE(offset: any, noAssert: any): any;
|
||||
function readInt16BE(offset: any, noAssert: any): any;
|
||||
function readInt16LE(offset: any, noAssert: any): any;
|
||||
function readInt32BE(offset: any, noAssert: any): any;
|
||||
function readInt32LE(offset: any, noAssert: any): any;
|
||||
function readInt8(offset: any, noAssert: any): any;
|
||||
function readIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUInt16BE(offset: any, noAssert: any): any;
|
||||
function readUInt16LE(offset: any, noAssert: any): any;
|
||||
function readUInt32BE(offset: any, noAssert: any): any;
|
||||
function readUInt32LE(offset: any, noAssert: any): any;
|
||||
function readUInt8(offset: any, noAssert: any): any;
|
||||
function readUIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function reduce(p0: any): any;
|
||||
function reduceRight(p0: any): any;
|
||||
function reverse(): any;
|
||||
function set(p0: any): any;
|
||||
function slice(start: any, end: any): any;
|
||||
function some(p0: any): any;
|
||||
function sort(p0: any): any;
|
||||
function subarray(p0: any, p1: any): any;
|
||||
function swap16(): any;
|
||||
function swap32(): any;
|
||||
function swap64(): any;
|
||||
function toJSON(): any;
|
||||
function toLocaleString(): any;
|
||||
function toString(...args: any[]): any;
|
||||
function ucs2Slice(): any;
|
||||
function ucs2Write(): any;
|
||||
function undefined(): any;
|
||||
function utf8Slice(): any;
|
||||
function utf8Write(): any;
|
||||
function values(): any;
|
||||
function write(string: any, offset: any, length: any, encoding: any): any;
|
||||
function writeDoubleBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeDoubleLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeUIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
namespace buffer {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
namespace parent {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace address {
|
||||
function fromBase58Check(address: any): any;
|
||||
function fromOutputScript(scriptPubKey: any, network?: Network): any;
|
||||
function toBase58Check(hash: any, version: any, ...args: any[]): any;
|
||||
function toOutputScript(address: any, network?: Network): any;
|
||||
function fromBase58Check(address: string): { hash: Buffer, version: number };
|
||||
|
||||
function fromOutputScript(outputScript: Buffer, network?: Network): { hash: Buffer, version: number };
|
||||
|
||||
function toBase58Check(hash: Buffer, version: number): string;
|
||||
|
||||
function toOutputScript(address: string, network?: Network): string;
|
||||
}
|
||||
|
||||
export namespace bufferutils {
|
||||
function equal(a: any, b: any): any;
|
||||
function pushDataSize(i: any): any;
|
||||
function readPushDataInt(buffer: any, offset: any): any;
|
||||
function readUInt64LE(buffer: any, offset: any): any;
|
||||
function readVarInt(buffer: any, offset: any): any;
|
||||
function reverse(src: any): any;
|
||||
function varIntBuffer(i: any): any;
|
||||
function varIntSize(i: any): any;
|
||||
function writePushDataInt(buffer: any, number: any, offset: any): any;
|
||||
function writeUInt64LE(buffer: any, value: any, offset: any): void;
|
||||
function writeVarInt(buffer: any, number: any, offset: any): any;
|
||||
function pushDataSize(i: number): number;
|
||||
|
||||
function readPushDataInt(buffer: Buffer, offset: number): { opcode: number, number: number, size: number };
|
||||
|
||||
function readUInt64LE(buffer: Buffer, offset: number): number;
|
||||
|
||||
function readVarInt(buffer: Buffer, offset: number): { number: number, size: number };
|
||||
|
||||
function varIntBuffer(number: number, buffer: Buffer, offset: number): Buffer;
|
||||
|
||||
function varIntSize(number: number): number;
|
||||
|
||||
function writePushDataInt(buffer: Buffer, number: number, offset: number): number;
|
||||
|
||||
function writeUInt64LE(buffer: Buffer, value: number, offset: number): number;
|
||||
|
||||
function writeVarInt(buffer: Buffer, number: number, offset: number): number;
|
||||
}
|
||||
|
||||
export namespace crypto {
|
||||
function hash160(buffer: any): any;
|
||||
function hash256(buffer: any): any;
|
||||
function ripemd160(buffer: any): any;
|
||||
function sha1(buffer: any): any;
|
||||
function sha256(buffer: any): any;
|
||||
}
|
||||
export namespace message {
|
||||
function magicHash(message: any, network: any): any;
|
||||
function sign(keyPair: any, message: any, network: any): any;
|
||||
function verify(address: any, signature: any, message: any, network: any): any;
|
||||
function hash160(buffer: Buffer): Buffer;
|
||||
|
||||
function hash256(buffer: Buffer): Buffer;
|
||||
|
||||
function ripemd160(buffer: Buffer): Buffer;
|
||||
|
||||
function sha1(buffer: Buffer): Buffer;
|
||||
|
||||
function sha256(buffer: Buffer): Buffer;
|
||||
}
|
||||
|
||||
export namespace script {
|
||||
function classifyInput(script: any, allowIncomplete: any): any;
|
||||
function classifyOutput(script: any): any;
|
||||
function compile(chunks: any): any;
|
||||
function decompile(buffer: any): any;
|
||||
function fromASM(asm: any): any;
|
||||
function isCanonicalPubKey(buffer: any): any;
|
||||
function isCanonicalSignature(buffer: any): any;
|
||||
function isDefinedHashType(hashType: any): any;
|
||||
function isMultisigInput(script: any, allowIncomplete: any): any;
|
||||
function isMultisigOutput(script: any): any;
|
||||
function isNullDataOutput(script: any): any;
|
||||
function isPubKeyHashInput(script: any): any;
|
||||
function isPubKeyHashOutput(script: any): any;
|
||||
function isPubKeyInput(script: any): any;
|
||||
function isPubKeyOutput(script: any): any;
|
||||
function isScriptHashInput(script: any, allowIncomplete: any): any;
|
||||
function isScriptHashOutput(script: any): any;
|
||||
function isWitnessPubKeyHashOutput(script: any): any;
|
||||
function isWitnessScriptHashOutput(script: any): any;
|
||||
function multisigInput(signatures: any, scriptPubKey: any): any;
|
||||
function multisigOutput(m: any, pubKeys: any, ...args: any[]): any;
|
||||
function nullDataOutput(data: any): any;
|
||||
function pubKeyHashInput(signature: any, pubKey: any, ...args: any[]): any;
|
||||
function pubKeyHashOutput(pubKeyHash: any): any;
|
||||
function pubKeyInput(signature: any): any;
|
||||
function pubKeyOutput(pubKey: any): any;
|
||||
function scriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function scriptHashOutput(scriptHash: any): any;
|
||||
function toASM(chunks: any): any;
|
||||
function witnessPubKeyHashOutput(pubKeyHash: any): any;
|
||||
function witnessScriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function witnessScriptHashOutput(scriptHash: any): any;
|
||||
function classifyInput(script: Buffer | Array<Buffer | number>, allowIncomplete: boolean): "pubkeyhash" | "scripthash" | "multisig" | "pubkey" | "nonstandard";
|
||||
|
||||
function classifyOutput(script: Buffer | Array<Buffer | number>): "witnesspubkeyhash" | "witnessscripthash" | "pubkeyhash"
|
||||
| "scripthash" | "multisig" | "pubkey" | "witnesscommitment" | "nulldata" | "nonstandard";
|
||||
|
||||
function classifyWitness(script: Buffer | Array<Buffer | number>, allowIncomplete: boolean): "witnesspubkeyhash" | "witnessscripthash" | "nonstandard";
|
||||
|
||||
function compile(chunks: Array<Buffer | number>): Buffer;
|
||||
|
||||
function decompile(buffer: Buffer): Array<Buffer | number>;
|
||||
|
||||
function fromASM(asm: string): Buffer;
|
||||
|
||||
function isCanonicalPubKey(buffer: Buffer): boolean;
|
||||
|
||||
function isCanonicalSignature(buffer: Buffer): boolean;
|
||||
|
||||
function isDefinedHashType(hashType: any): boolean;
|
||||
|
||||
function isPushOnly(value: any): boolean;
|
||||
|
||||
function toASM(chunks: Buffer | Array<Buffer | number>): string;
|
||||
|
||||
function toStack(chunks: Buffer | Array<Buffer | number>): Buffer[];
|
||||
|
||||
namespace number {
|
||||
function decode(buffer: any, maxLength: any, minimal: any): any;
|
||||
function encode(number: any): any;
|
||||
function decode(buffer: Buffer, maxLength: number, minimal: boolean): number;
|
||||
|
||||
function encode(number: number): Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"bitcoinjs-lib-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user