Skip to content

Commit

Permalink
Merge pull request bitpay#2413 from cmgustavo/fix/secp256k1-build-cop…
Browse files Browse the repository at this point in the history
…ay-01

Fix/secp256k1 build copay 01
  • Loading branch information
matiu authored Sep 24, 2019
2 parents fddb6eb + 7027018 commit d0b7ad8
Show file tree
Hide file tree
Showing 29 changed files with 424 additions and 529 deletions.
7 changes: 2 additions & 5 deletions packages/bitcore-wallet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"async": "^0.9.0",
"awesome-typescript-loader": "^5.2.1",
"bip38": "^1.3.0",
"bitcore-lib": "^8.8.0",
"bitcore-lib-cash": "^8.8.0",
"bitcore-mnemonic": "^8.8.0",
"crypto-wallet-core": "^8.8.0",
"json-stable-stringify": "^1.0.1",
Expand All @@ -50,7 +48,6 @@
"istanbul": "*",
"mocha": "^5.2.0",
"mongodb": "^2.0.27",
"rimraf": "^2.6.3",
"sinon": "^7.1.1",
"supertest": "*",
"ts-node": "^8.0.3",
Expand All @@ -62,14 +59,14 @@
"scripts": {
"start": "npm run clean && npm run tsc && node app.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test",
"test": "npm run compile && ./node_modules/.bin/mocha --exit",
"test": "npm run compile && mocha --exit",
"test:ci": "npm run test",
"docs": "./node_modules/.bin/jsdox lib/* lib/common lib/errors -o docs && cat README.header.md docs/*.md LICENSE > README.md",
"coveralls": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"compile": "npm run tsc",
"tsc": "npm run clean && tsc",
"build": "tsc && npm run lint",
"clean": "rimraf ./ts_build",
"clean": "rm -rf ./ts_build",
"lint": "tslint -c tslint.json 'src/**/*.ts'",
"lint-fix": "tslint --fix -c tslint.json 'src/**/*.ts'",
"pub": "npm run build && npm publish"
Expand Down
32 changes: 16 additions & 16 deletions packages/bitcore-wallet-client/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ var $ = require('preconditions').singleton();
var util = require('util');
var async = require('async');
var events = require('events');
var Bitcore = require('bitcore-lib');
var Bitcore = CWC.BitcoreLib;
var Bitcore_ = {
btc: Bitcore,
bch: require('bitcore-lib-cash'),
eth: Bitcore
btc: CWC.BitcoreLib,
bch: CWC.BitcoreLibCash,
eth: CWC.BitcoreLib
};
var Mnemonic = require('bitcore-mnemonic');
var url = require('url');
Expand Down Expand Up @@ -61,8 +61,8 @@ export class API extends EventEmitter {
static errors = Errors;

// Expose bitcore
static Bitcore = require('bitcore-lib');
static BitcoreCash = require('bitcore-lib-cash');
static Bitcore = CWC.BitcoreLib;
static BitcoreCash = CWC.BitcoreLibCash;

constructor(opts?) {
super();
Expand Down Expand Up @@ -103,7 +103,7 @@ export class API extends EventEmitter {
}

_fetchLatestNotifications(interval, cb) {
cb = cb || function () { };
cb = cb || function() {};

var opts: any = {
lastNotificationId: this.lastNotificationId,
Expand Down Expand Up @@ -294,7 +294,7 @@ export class API extends EventEmitter {
var words;
try {
words = c.getMnemonic();
} catch (ex) { }
} catch (ex) {}

var xpriv;
if (words && (!c.mnemonicHasPassphrase || opts.passphrase)) {
Expand Down Expand Up @@ -631,7 +631,7 @@ export class API extends EventEmitter {
};
t.inputs[i].addSignature(t, s);
i++;
} catch (e) { }
} catch (e) {}
});
if (i != txp.inputs.length) throw new Error('Wrong signatures');
}
Expand Down Expand Up @@ -741,9 +741,9 @@ export class API extends EventEmitter {

this.request.get(
'/v2/feelevels/?coin=' +
(coin || 'btc') +
'&network=' +
(network || 'livenet'),
(coin || 'btc') +
'&network=' +
(network || 'livenet'),
(err, result) => {
if (err) return cb(err);
return cb(err, result);
Expand Down Expand Up @@ -1462,9 +1462,9 @@ export class API extends EventEmitter {
encryptedPkr: opts.doNotEncryptPkr
? null
: Utils.encryptMessage(
JSON.stringify(this.credentials.publicKeyRing),
this.credentials.personalEncryptingKey
),
JSON.stringify(this.credentials.publicKeyRing),
this.credentials.personalEncryptingKey
),
unencryptedPkr: opts.doNotEncryptPkr
? JSON.stringify(this.credentials.publicKeyRing)
: null,
Expand Down Expand Up @@ -2141,7 +2141,7 @@ export class API extends EventEmitter {
var ret;
try {
ret = JSON.parse(decrypted);
} catch (e) { }
} catch (e) {}
return ret;
}

Expand Down
7 changes: 4 additions & 3 deletions packages/bitcore-wallet-client/src/lib/common/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

import { Deriver, Transactions } from 'crypto-wallet-core';
import { BitcoreLib, BitcoreLibCash, Deriver, Transactions } from 'crypto-wallet-core';

import * as _ from 'lodash';
import { Constants } from './constants';
import { Defaults } from './defaults';
Expand All @@ -9,10 +10,10 @@ var $ = require('preconditions').singleton();
var sjcl = require('sjcl');
var Stringify = require('json-stable-stringify');

var Bitcore = require('bitcore-lib');
var Bitcore = BitcoreLib;
var Bitcore_ = {
btc: Bitcore,
bch: require('bitcore-lib-cash'),
bch: BitcoreLibCash,
eth: Bitcore
};
var PrivateKey = Bitcore.PrivateKey;
Expand Down
5 changes: 3 additions & 2 deletions packages/bitcore-wallet-client/src/lib/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

import { BitcoreLib } from 'crypto-wallet-core';

import { Constants, Utils } from './common';
const $ = require('preconditions').singleton();
const _ = require('lodash');

const Bitcore = require('bitcore-lib');
const Mnemonic = require('bitcore-mnemonic');
const Bitcore = BitcoreLib;
const sjcl = require('sjcl');

export class Credentials {
Expand Down
4 changes: 2 additions & 2 deletions packages/bitcore-wallet-client/src/lib/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as _ from 'lodash';
import { Constants, Utils } from './common';
import { Credentials } from './credentials';

import { Transactions } from 'crypto-wallet-core';
import { BitcoreLib, Transactions } from 'crypto-wallet-core';

var Bitcore = require('bitcore-lib');
var Bitcore = BitcoreLib;
var Mnemonic = require('bitcore-mnemonic');
var sjcl = require('sjcl');
var log = require('./log');
Expand Down
6 changes: 4 additions & 2 deletions packages/bitcore-wallet-client/src/lib/paypro.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

import { BitcoreLib, BitcoreLibCash } from 'crypto-wallet-core';

var $ = require('preconditions').singleton();
const URL = require('url');
const _ = require('lodash');
const superagent = require('superagent');
var Bitcore = require('bitcore-lib');
var Bitcore = BitcoreLib;
const Errors = require('./errors');
var Bitcore_ = {
btc: Bitcore,
bch: require('bitcore-lib-cash')
bch: BitcoreLibCash
};
// const request = require('request');
const JSON_PAYMENT_REQUEST_CONTENT_TYPE = 'application/payment-request';
Expand Down
6 changes: 4 additions & 2 deletions packages/bitcore-wallet-client/src/lib/verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import * as _ from 'lodash';
import { Utils } from './common';
var $ = require('preconditions').singleton();

var Bitcore = require('bitcore-lib');
var BCHAddress = require('bitcore-lib-cash').Address;
import { BitcoreLib, BitcoreLibCash } from 'crypto-wallet-core';

var Bitcore = BitcoreLib;
var BCHAddress = BitcoreLibCash.Address;

var log = require('./log');

Expand Down
6 changes: 4 additions & 2 deletions packages/bitcore-wallet-client/test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ var mongodb = require('mongodb');
var config = require('./test-config');
var oldCredentials = require('./legacyCredentialsExports');

var Bitcore = require('bitcore-lib');
var CWC = require('crypto-wallet-core');

var Bitcore = CWC.BitcoreLib;
var Bitcore_ = {
btc: Bitcore,
bch: require('bitcore-lib-cash'),
bch: CWC.BitcoreLibCash,
};

var BWS = require('bitcore-wallet-service');
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-wallet-client/test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var _ = require('lodash');
var chai = require('chai');
var should = chai.should();
var Bitcore = require('bitcore-lib');
var Bitcore = require('crypto-wallet-core').BitcoreLib;
var { Utils } = require('../ts_build/common');

describe('Utils', () => {
Expand Down
Loading

0 comments on commit d0b7ad8

Please sign in to comment.