@gobob/bob-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ export declare const MAINNET_ESPLORA_BASE_PATH = "https://btc-mainnet.interlay.io";
2
+ export declare const TESTNET_ESPLORA_BASE_PATH = "https://btc-testnet.interlay.io";
3
+ export declare const REGTEST_ESPLORA_BASE_PATH = "http://localhost:3002";
4
+ export interface MerkleProof {
5
+ blockHeight: number;
6
+ merkle: string;
7
+ pos: number;
8
+ }
9
+ export interface ElectrsClient {
10
+ getBlockHash(height: number): Promise<string>;
11
+ getBlockHeader(hash: string): Promise<string>;
12
+ getTransactionHex(txId: string): Promise<string>;
13
+ getMerkleProof(txId: string): Promise<MerkleProof>;
14
+ }
15
+ export declare class DefaultElectrsClient implements ElectrsClient {
16
+ private basePath;
17
+ constructor(networkOrUrl?: string);
18
+ getBlockHash(height: number): Promise<string>;
19
+ getBlockHeader(hash: string): Promise<string>;
20
+ getTransactionHex(txId: string): Promise<string>;
21
+ getMerkleProof(txId: string): Promise<MerkleProof>;
22
+ getJson<T>(url: string): Promise<T>;
23
+ getText(url: string): Promise<string>;
24
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./electrs";
2
+ export * from "./relay";
3
+ export * from "./utils";
@@ -0,0 +1,14 @@
1
+ import { ElectrsClient } from "./electrs";
2
+ export interface BitcoinTxInfo {
3
+ version: string;
4
+ inputVector: string;
5
+ outputVector: string;
6
+ locktime: string;
7
+ }
8
+ export declare function getBitcoinTxInfo(electrsClient: ElectrsClient, txId: string): Promise<BitcoinTxInfo>;
9
+ export interface BitcoinTxProof {
10
+ merkleProof: string;
11
+ txIndexInBlock: number;
12
+ bitcoinHeaders: string;
13
+ }
14
+ export declare function getBitcoinTxProof(electrsClient: ElectrsClient, txId: string, txProofDifficultyFactor: number): Promise<BitcoinTxProof>;
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { Block } from "bitcoinjs-lib";
3
+ import { Transaction } from "bitcoinjs-lib/src/transaction";
4
+ export declare function encodeRawInput(tx: Transaction): Buffer;
5
+ export declare function encodeRawOutput(tx: Transaction): Buffer;
6
+ export declare function encodeRawWitness(tx: Transaction): Buffer;
7
+ export declare function getMerkleProof(block: Block, txHash: string, forWitness?: boolean): {
8
+ pos: number;
9
+ proof: string;
10
+ root: string;
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobob/bob-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -p tsconfig.json"
9
9
  },
10
10
  "files": [
11
- "dist/",
11
+ "dist/**/*",
12
12
  "!**/*.spec.*",
13
13
  "!**/*.json",
14
14
  "CHANGELOG.md",