Skip to content

Commit

Permalink
use grpc-bchrpc interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jcramer committed Sep 11, 2020
1 parent 66304a9 commit 72d608b
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 93 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Table of Contents

# Installation

NOTE: Using SLPJS requires bitbox-sdk and bitcore-lib-cash to also be installed.
NOTE: Using SLPJS has peer dependencies bitbox-sdk and bitcore-lib-cash, so these also need to be installed.

#### For node.js
`npm install slpjs bitbox-sdk bitcore-lib-cash`

#### For browser (only works for versions <= 0.26.0)
```<script src='https://unpkg.com/slpjs@0.26.0'></script>```
#### For browser
```<script src='https://unpkg.com/slpjs'></script>```

NOTE: The latest version of slpjs package will be refactored to fix this problem.

Expand Down Expand Up @@ -837,6 +837,10 @@ Running the unit tests require node.js v8.15+.

# Change Log

### 0.27.6
- Update BchdNetwork to use an interface for gRPC client
- Note: 0.27.5 was skipped due to an error during publishing

### 0.27.4
- Fixed false positive edge case for NFT child GENESIS validation using new SLP unit test vectors

Expand Down
8 changes: 4 additions & 4 deletions lib/bchdnetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BITBOX } from "bitbox-sdk";
import { AddressDetailsResult, AddressUtxoResult,
TxnDetailsResult, utxo } from "bitcoin-com-rest";
import * as Bitcore from "bitcore-lib-cash";
import { GrpcClient, Transaction } from "grpc-bchrpc-node";
import { IGrpcClient, Transaction } from "grpc-bchrpc";
import * as _ from "lodash";
import { INetwork, logger, Primatives,
SlpAddressUtxoResult, SlpBalancesResult,
Expand All @@ -22,14 +22,14 @@ export class BchdNetwork implements INetwork {
public validator: SlpValidator;
public txnHelpers: TransactionHelpers;
public logger: logger = { log: (s: string) => null };
public client: GrpcClient;
public client: IGrpcClient;

constructor({ BITBOX, validator, logger, client }:
{ BITBOX: BITBOX, client: GrpcClient, validator: SlpValidator, logger?: logger }) {
{ BITBOX: BITBOX, client: IGrpcClient, validator: SlpValidator, logger?: logger }) {
if (!BITBOX) {
throw Error("Must provide BITBOX instance to class constructor.");
}
if (!client || !(client instanceof GrpcClient)) {
if (!client) {
throw Error("Must provide instance of GrpClient to class constructor.");
}
if (logger) {
Expand Down
Loading

0 comments on commit 72d608b

Please sign in to comment.