Skip to content

Commit 5677b11

Browse files
committed
zel to ZEL
1 parent 944bafa commit 5677b11

File tree

8 files changed

+110
-110
lines changed

8 files changed

+110
-110
lines changed

lib/api.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var async = require('async');
77
var events = require('events');
88
var Bitcore = require('bitcore-lib-zel');
99
var Bitcore_ = {
10-
zel: Bitcore,
10+
ZEL: Bitcore,
1111
};
1212
var Mnemonic = require('bitcore-mnemonic');
1313
var sjcl = require('sjcl');
@@ -291,7 +291,7 @@ API.prototype.seedFromRandom = function(opts) {
291291
$.checkArgument(_.isUndefined(opts) || _.isObject(opts), 'DEPRECATED: argument should be an options object.');
292292

293293
opts = opts || {};
294-
this.credentials = Credentials.create(opts.coin || 'zel', opts.network || 'livenet');
294+
this.credentials = Credentials.create(opts.coin || 'ZEL', opts.network || 'livenet');
295295
};
296296

297297

@@ -381,7 +381,7 @@ API.prototype.seedFromRandomWithMnemonic = function(opts) {
381381
$.checkArgument(_.isUndefined(opts) || _.isObject(opts), 'DEPRECATED: argument should be an options object.');
382382

383383
opts = opts || {};
384-
this.credentials = Credentials.createWithMnemonic(opts.coin || 'zel', opts.network || 'livenet', opts.passphrase, opts.language || 'en', opts.account || 0);
384+
this.credentials = Credentials.createWithMnemonic(opts.coin || 'ZEL', opts.network || 'livenet', opts.passphrase, opts.language || 'en', opts.account || 0);
385385
};
386386

387387
API.prototype.getMnemonic = function() {
@@ -409,7 +409,7 @@ API.prototype.clearMnemonic = function() {
409409
*/
410410
API.prototype.seedFromExtendedPrivateKey = function(xPrivKey, opts) {
411411
opts = opts || {};
412-
this.credentials = Credentials.fromExtendedPrivateKey(opts.coin || 'zel', xPrivKey, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
412+
this.credentials = Credentials.fromExtendedPrivateKey(opts.coin || 'ZEL', xPrivKey, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
413413
};
414414

415415

@@ -429,7 +429,7 @@ API.prototype.seedFromMnemonic = function(words, opts) {
429429
$.checkArgument(_.isUndefined(opts) || _.isObject(opts), 'DEPRECATED: second argument should be an options object.');
430430

431431
opts = opts || {};
432-
this.credentials = Credentials.fromMnemonic(opts.coin || 'zel', opts.network || 'livenet', words, opts.passphrase, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
432+
this.credentials = Credentials.fromMnemonic(opts.coin || 'ZEL', opts.network || 'livenet', words, opts.passphrase, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
433433
};
434434

435435
/**
@@ -447,7 +447,7 @@ API.prototype.seedFromExtendedPublicKey = function(xPubKey, source, entropySourc
447447
$.checkArgument(_.isUndefined(opts) || _.isObject(opts));
448448

449449
opts = opts || {};
450-
this.credentials = Credentials.fromExtendedPublicKey(opts.coin || 'zel', xPubKey, source, entropySourceHex, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44);
450+
this.credentials = Credentials.fromExtendedPublicKey(opts.coin || 'ZEL', xPubKey, source, entropySourceHex, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44);
451451
};
452452

453453

@@ -542,7 +542,7 @@ API.prototype.importFromMnemonic = function(words, opts, cb) {
542542
opts = opts || {};
543543

544544
function derive(nonCompliantDerivation) {
545-
return Credentials.fromMnemonic(opts.coin || 'zel', opts.network || 'livenet', words, opts.passphrase, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, {
545+
return Credentials.fromMnemonic(opts.coin || 'ZEL', opts.network || 'livenet', words, opts.passphrase, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, {
546546
nonCompliantDerivation: nonCompliantDerivation,
547547
entropySourcePath: opts.entropySourcePath,
548548
walletPrivKey: opts.walletPrivKey,
@@ -590,7 +590,7 @@ API.prototype.importFromExtendedPrivateKey = function(xPrivKey, opts, cb) {
590590
}
591591

592592
try {
593-
this.credentials = Credentials.fromExtendedPrivateKey(opts.coin || 'zel', xPrivKey, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
593+
this.credentials = Credentials.fromExtendedPrivateKey(opts.coin || 'ZEL', xPrivKey, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
594594
} catch (e) {
595595
log.info('xPriv error:', e);
596596
return cb(new Errors.INVALID_BACKUP);
@@ -619,7 +619,7 @@ API.prototype.importFromExtendedPublicKey = function(xPubKey, source, entropySou
619619
opts = opts || {};
620620
log.debug('Importing from Extended Private Key');
621621
try {
622-
this.credentials = Credentials.fromExtendedPublicKey(opts.coin || 'zel', xPubKey, source, entropySourceHex, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
622+
this.credentials = Credentials.fromExtendedPublicKey(opts.coin || 'ZEL', xPubKey, source, entropySourceHex, opts.account || 0, opts.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP44, opts);
623623
} catch (e) {
624624
log.info('xPriv error:', e);
625625
return cb(new Errors.INVALID_BACKUP);
@@ -656,7 +656,7 @@ API.prototype.getBalanceFromPrivateKey = function(privateKey, coin, cb) {
656656

657657
if (_.isFunction(coin)) {
658658
cb = coin;
659-
coin = 'zel';
659+
coin = 'ZEL';
660660
}
661661
var B = Bitcore_[coin];
662662

@@ -675,7 +675,7 @@ API.prototype.buildTxFromPrivateKey = function(privateKey, destinationAddress, o
675675

676676
opts = opts || {};
677677

678-
var coin = opts.coin || 'zel';
678+
var coin = opts.coin || 'ZEL';
679679
var B = Bitcore_[coin];
680680
var privateKey = B.PrivateKey(privateKey);
681681
var address = privateKey.publicKey.toAddress();
@@ -984,7 +984,7 @@ API.parseSecret = function(secret) {
984984

985985
var walletPrivKey = Bitcore.PrivateKey.fromString(secretSplit[1]);
986986
var networkChar = secretSplit[2];
987-
var coin = secretSplit[3] || 'zel';
987+
var coin = secretSplit[3] || 'ZEL';
988988

989989
return {
990990
walletId: walletId,
@@ -1254,10 +1254,10 @@ API.prototype.decryptPrivateKey = function(password) {
12541254
API.prototype.getFeeLevels = function(coin, network, cb) {
12551255
var self = this;
12561256

1257-
$.checkArgument(coin || _.includes(['zel', 'bch'], coin));
1257+
$.checkArgument(coin || _.includes(['ZEL', 'bch'], coin));
12581258
$.checkArgument(network || _.includes(['livenet', 'testnet'], network));
12591259

1260-
self._doGetRequest('/v2/feelevels/?coin=' + (coin || 'zel') + '&network=' + (network || 'livenet'), function(err, result) {
1260+
self._doGetRequest('/v2/feelevels/?coin=' + (coin || 'ZEL') + '&network=' + (network || 'livenet'), function(err, result) {
12611261
if (err) return cb(err);
12621262
return cb(err, result);
12631263
});
@@ -1304,8 +1304,8 @@ API.prototype.createWallet = function(walletName, copayerName, m, n, opts, cb) {
13041304
if (opts) $.shouldBeObject(opts);
13051305
opts = opts || {};
13061306

1307-
var coin = opts.coin || 'zel';
1308-
if (!_.includes(['zel', 'bch'], coin)) return cb(new Error('Invalid coin'));
1307+
var coin = opts.coin || 'ZEL';
1308+
if (!_.includes(['ZEL', 'bch'], coin)) return cb(new Error('Invalid coin'));
13091309

13101310
var network = opts.network || 'livenet';
13111311
if (!_.includes(['testnet', 'livenet'], network)) return cb(new Error('Invalid network'));
@@ -1385,8 +1385,8 @@ API.prototype.joinWallet = function(secret, copayerName, opts, cb) {
13851385

13861386
opts = opts || {};
13871387

1388-
var coin = opts.coin || 'zel';
1389-
if (!_.includes(['zel', 'bch'], coin)) return cb(new Error('Invalid coin'));
1388+
var coin = opts.coin || 'ZEL';
1389+
if (!_.includes(['ZEL', 'bch'], coin)) return cb(new Error('Invalid coin'));
13901390

13911391
try {
13921392
var secretData = API.parseSecret(secret);
@@ -1880,7 +1880,7 @@ API.prototype.getBalance = function(opts, cb) {
18801880
var args = [];
18811881
if (opts.twoStep) args.push('?twoStep=1');
18821882
if (opts.coin) {
1883-
if (!_.includes(['zel', 'bch'], opts.coin)) return cb(new Error('Invalid coin'));
1883+
if (!_.includes(['ZEL', 'bch'], opts.coin)) return cb(new Error('Invalid coin'));
18841884
args.push('coin=' + opts.coin);
18851885
}
18861886
var qs = '';
@@ -2082,8 +2082,8 @@ API.signTxProposalFromAirGapped = function(key, txp, unencryptedPkr, m, n, opts)
20822082
var self = this;
20832083
opts = opts || {}
20842084

2085-
var coin = opts.coin || 'zel';
2086-
if (!_.includes(['zel', 'bch'], coin)) return cb(new Error('Invalid coin'));
2085+
var coin = opts.coin || 'ZEL';
2086+
if (!_.includes(['ZEL', 'bch'], coin)) return cb(new Error('Invalid coin'));
20872087

20882088
var publicKeyRing = JSON.parse(unencryptedPkr);
20892089

lib/common/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Constants.PATHS = {
2121
Constants.BIP45_SHARED_INDEX = 0x80000000 - 1;
2222

2323
Constants.UNITS = {
24-
zel: {
24+
ZEL: {
2525
toSatoshis: 100000000,
2626
full: {
2727
maxDecimals: 8,

lib/common/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var Stringify = require('json-stable-stringify');
77

88
var Bitcore = require('bitcore-lib-zel');
99
var Bitcore_ = {
10-
zel: Bitcore,
10+
ZEL: Bitcore,
1111
};
1212
var PrivateKey = Bitcore.PrivateKey;
1313
var PublicKey = Bitcore.PublicKey;
@@ -102,7 +102,7 @@ Utils.getProposalHash = function(proposalHeader) {
102102
Utils.deriveAddress = function(scriptType, publicKeyRing, path, m, network, coin) {
103103
$.checkArgument(_.includes(_.values(Constants.SCRIPT_TYPES), scriptType));
104104

105-
coin = coin || 'zel';
105+
coin = coin || 'ZEL';
106106
var bitcore = Bitcore_[coin];
107107
var publicKeys = _.map(publicKeyRing, function(item) {
108108
var xpub = new bitcore.HDPublicKey(item.xPubKey);
@@ -128,7 +128,7 @@ Utils.deriveAddress = function(scriptType, publicKeyRing, path, m, network, coin
128128
};
129129

130130
Utils.xPubToCopayerId = function(coin, xpub) {
131-
var str = coin == 'zel' ? xpub : coin + xpub;
131+
var str = coin == 'ZEL' ? xpub : coin + xpub;
132132
var hash = sjcl.hash.sha256.hash(str);
133133
return sjcl.codec.hex.fromBits(hash);
134134
};
@@ -177,7 +177,7 @@ Utils.formatAmount = function(satoshis, unit, opts) {
177177
};
178178

179179
Utils.buildTx = function(txp) {
180-
var coin = txp.coin || 'zel';
180+
var coin = txp.coin || 'ZEL';
181181

182182
var bitcore = Bitcore_[coin];
183183

lib/credentials.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function Credentials() {
4949
};
5050

5151
function _checkCoin(coin) {
52-
if (!_.includes(['zel', 'bch'], coin)) throw new Error('Invalid coin');
52+
if (!_.includes(['ZEL', 'bch'], coin)) throw new Error('Invalid coin');
5353
};
5454

5555
function _checkNetwork(network) {
@@ -270,7 +270,7 @@ Credentials.fromObj = function(obj) {
270270
x[k] = obj[k];
271271
});
272272

273-
x.coin = x.coin || 'zel';
273+
x.coin = x.coin || 'ZEL';
274274
x.derivationStrategy = x.derivationStrategy || Constants.DERIVATION_STRATEGIES.BIP45;
275275
x.addressType = x.addressType || Constants.SCRIPT_TYPES.P2SH;
276276
x.account = x.account || 0;
@@ -464,7 +464,7 @@ Credentials.fromOldCopayWallet = function(w) {
464464
};
465465

466466
var credentials = new Credentials();
467-
credentials.coin = 'zel';
467+
credentials.coin = 'ZEL';
468468
credentials.derivationStrategy = Constants.DERIVATION_STRATEGIES.BIP45;
469469
credentials.xPrivKey = w.privateKey.extendedPrivateKeyString;
470470
credentials._expand();

lib/verifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Verifier.checkTxProposalSignature = function(credentials, txp) {
127127
$.checkState(credentials.isComplete());
128128

129129
var creatorKeys = _.find(credentials.publicKeyRing, function(item) {
130-
if (Utils.xPubToCopayerId(txp.coin || 'zel', item.xPubKey) === txp.creatorId) return true;
130+
if (Utils.xPubToCopayerId(txp.coin || 'ZEL', item.xPubKey) === txp.creatorId) return true;
131131
});
132132

133133
if (!creatorKeys) return false;

test/client.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var log = require('../lib/log');
1717

1818
var Bitcore = require('bitcore-lib-zel');
1919
var Bitcore_ = {
20-
zel: Bitcore,
20+
ZEL: Bitcore,
2121
};
2222

2323

@@ -37,11 +37,11 @@ var Errors = require('../lib/errors');
3737

3838
var helpers = {};
3939

40-
helpers.toSatoshi = function(zel) {
41-
if (_.isArray(zel)) {
42-
return _.map(zel, helpers.toSatoshi);
40+
helpers.toSatoshi = function(ZEL) {
41+
if (_.isArray(ZEL)) {
42+
return _.map(ZEL, helpers.toSatoshi);
4343
} else {
44-
return parseFloat((zel * 1e8).toPrecision(12));
44+
return parseFloat((ZEL * 1e8).toPrecision(12));
4545
}
4646
};
4747

@@ -117,7 +117,7 @@ helpers.createAndJoinWallet = function(clients, m, n, opts, cb) {
117117

118118
opts = opts || {};
119119

120-
var coin = opts.coin || 'zel';
120+
var coin = opts.coin || 'ZEL';
121121
var network = opts.network || 'testnet';
122122

123123
clients[0].seedFromRandomWithMnemonic({
@@ -1004,7 +1004,7 @@ describe('client API', function() {
10041004
var walletId = Uuid.v4();
10051005
var walletPrivKey = new Bitcore.PrivateKey();
10061006
var network = i % 2 == 0 ? 'testnet' : 'livenet';
1007-
var coin = i % 3 == 0 ? 'bch' : 'zel';
1007+
var coin = i % 3 == 0 ? 'bch' : 'ZEL';
10081008
var secret = Client._buildSecret(walletId, walletPrivKey, coin, network);
10091009
var result = Client.parseSecret(secret);
10101010
result.walletId.should.equal(walletId);
@@ -1022,7 +1022,7 @@ describe('client API', function() {
10221022
it('should create secret and parse secret from string', function() {
10231023
var walletId = Uuid.v4();
10241024
var walletPrivKey = new Bitcore.PrivateKey();
1025-
var coin = 'zel';
1025+
var coin = 'ZEL';
10261026
var network = 'testnet';
10271027
var secret = Client._buildSecret(walletId, walletPrivKey.toString(), coin, network);
10281028
var result = Client.parseSecret(secret);
@@ -1033,7 +1033,7 @@ describe('client API', function() {
10331033
});
10341034
it('should default to zel for secrets not specifying coin', function() {
10351035
var result = Client.parseSecret('5ZN64RxKWCJXcy1pZwgrAzL1NnN5FQic5M2tLJVG5bEHaGXNRQs2uzJjMa9pMAbP5rz9Vu2xSaT');
1036-
result.coin.should.equal('zel');
1036+
result.coin.should.equal('ZEL');
10371037
});
10381038
});
10391039

@@ -1654,7 +1654,7 @@ describe('client API', function() {
16541654
10: 18000,
16551655
});
16561656
clients[0].credentials = {};
1657-
clients[0].getFeeLevels('zel', 'livenet', function(err, levels) {
1657+
clients[0].getFeeLevels('ZEL', 'livenet', function(err, levels) {
16581658
should.not.exist(err);
16591659
should.exist(levels);
16601660
_.difference(['priority', 'normal', 'economy'], _.map(levels, 'level')).should.be.empty;
@@ -2570,7 +2570,7 @@ describe('client API', function() {
25702570

25712571
describe('ZEL', function(done) {
25722572
beforeEach(function(done) {
2573-
setup(2, 3, 'zel', 'testnet', done);
2573+
setup(2, 3, 'ZEL', 'testnet', done);
25742574
});
25752575

25762576
it('Should sign proposal', function(done) {
@@ -5160,10 +5160,10 @@ describe('client API', function() {
51605160
});
51615161

51625162
var addrMap = {
5163-
zel: ['1PuKMvRFfwbLXyEPXZzkGi111gMUCs6uE3','1GG3JQikGC7wxstyavUBDoCJ66bWLLENZC'],
5163+
ZEL: ['1PuKMvRFfwbLXyEPXZzkGi111gMUCs6uE3','1GG3JQikGC7wxstyavUBDoCJ66bWLLENZC'],
51645164
bch: ['CfNCvxmKYzZsS78pDKKfrDd2doZt3w4jUs','CXivsT4p9F6Us1oQGfo6oJpKiDovJjRVUE']
51655165
};
5166-
_.each(['bch', 'zel'], function(coin) {
5166+
_.each(['bch', 'ZEL'], function(coin) {
51675167
var addr= addrMap[coin];
51685168

51695169
describe('Sweep paper wallet ' + coin, function() {
@@ -5280,15 +5280,15 @@ describe('client API', function() {
52805280
}],
52815281
expected: '0.01',
52825282
}, {
5283-
args: [1, 'zel'],
5283+
args: [1, 'ZEL'],
52845284
expected: '0.00',
52855285
}, {
5286-
args: [1, 'zel', {
5286+
args: [1, 'ZEL', {
52875287
fullPrecision: true
52885288
}],
52895289
expected: '0.00000001',
52905290
}, {
5291-
args: [1234567899999, 'zel', {
5291+
args: [1234567899999, 'ZEL', {
52925292
thousandsSeparator: ' ',
52935293
decimalSeparator: ','
52945294
}],

0 commit comments

Comments
 (0)