mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 10:05:48 +00:00
JS: Rename ADDRESS_ to ACCOUNT_ to be consistent with C++.
This commit is contained in:
@@ -106,14 +106,14 @@ UInt.prototype.parse_generic = function (j) {
|
|||||||
case undefined:
|
case undefined:
|
||||||
case "0":
|
case "0":
|
||||||
case this.constructor.STR_ZERO:
|
case this.constructor.STR_ZERO:
|
||||||
case this.constructor.ADDRESS_ZERO:
|
case this.constructor.ACCOUNT_ZERO:
|
||||||
case this.constructor.HEX_ZERO:
|
case this.constructor.HEX_ZERO:
|
||||||
this._value = nbi();
|
this._value = nbi();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "1":
|
case "1":
|
||||||
case this.constructor.STR_ONE:
|
case this.constructor.STR_ONE:
|
||||||
case this.constructor.ADDRESS_ONE:
|
case this.constructor.ACCOUNT_ONE:
|
||||||
case this.constructor.HEX_ONE:
|
case this.constructor.HEX_ONE:
|
||||||
this._value = new BigInteger([1]);
|
this._value = new BigInteger([1]);
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ UInt160.width = 20;
|
|||||||
UInt160.prototype = extend({}, UInt.prototype);
|
UInt160.prototype = extend({}, UInt.prototype);
|
||||||
UInt160.prototype.constructor = UInt160;
|
UInt160.prototype.constructor = UInt160;
|
||||||
|
|
||||||
var ADDRESS_ZERO = UInt160.ADDRESS_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
|
var ACCOUNT_ZERO = UInt160.ACCOUNT_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
|
||||||
var ADDRESS_ONE = UInt160.ADDRESS_ONE = "rrrrrrrrrrrrrrrrrrrrBZbvji";
|
var ACCOUNT_ONE = UInt160.ACCOUNT_ONE = "rrrrrrrrrrrrrrrrrrrrBZbvji";
|
||||||
var HEX_ZERO = UInt160.HEX_ZERO = "0000000000000000000000000000000000000000";
|
var HEX_ZERO = UInt160.HEX_ZERO = "0000000000000000000000000000000000000000";
|
||||||
var HEX_ONE = UInt160.HEX_ONE = "0000000000000000000000000000000000000001";
|
var HEX_ONE = UInt160.HEX_ONE = "0000000000000000000000000000000000000001";
|
||||||
var STR_ZERO = UInt160.STR_ZERO = utils.hexToString(HEX_ZERO);
|
var STR_ZERO = UInt160.STR_ZERO = utils.hexToString(HEX_ZERO);
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ UInt256.width = 32;
|
|||||||
UInt256.prototype = extend({}, UInt.prototype);
|
UInt256.prototype = extend({}, UInt.prototype);
|
||||||
UInt256.prototype.constructor = UInt256;
|
UInt256.prototype.constructor = UInt256;
|
||||||
|
|
||||||
// XXX Generate these constants (or remove them)
|
|
||||||
var ADDRESS_ZERO = UInt256.ADDRESS_ZERO = "XXX";
|
|
||||||
var ADDRESS_ONE = UInt256.ADDRESS_ONE = "XXX";
|
|
||||||
var HEX_ZERO = UInt256.HEX_ZERO = "00000000000000000000000000000000" +
|
var HEX_ZERO = UInt256.HEX_ZERO = "00000000000000000000000000000000" +
|
||||||
"00000000000000000000000000000000";
|
"00000000000000000000000000000000";
|
||||||
var HEX_ONE = UInt256.HEX_ONE = "00000000000000000000000000000000" +
|
var HEX_ONE = UInt256.HEX_ONE = "00000000000000000000000000000000" +
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ buster.testCase("Amount", {
|
|||||||
buster.assert.equals(nbi(), UInt160.from_generic("0")._value);
|
buster.assert.equals(nbi(), UInt160.from_generic("0")._value);
|
||||||
},
|
},
|
||||||
"Parse 0 export" : function () {
|
"Parse 0 export" : function () {
|
||||||
buster.assert.equals(UInt160.ADDRESS_ZERO, UInt160.from_generic("0").to_json());
|
buster.assert.equals(UInt160.ACCOUNT_ZERO, UInt160.from_generic("0").to_json());
|
||||||
},
|
},
|
||||||
"Parse 1" : function () {
|
"Parse 1" : function () {
|
||||||
buster.assert.equals(new BigInteger([1]), UInt160.from_generic("1")._value);
|
buster.assert.equals(new BigInteger([1]), UInt160.from_generic("1")._value);
|
||||||
},
|
},
|
||||||
"Parse rrrrrrrrrrrrrrrrrrrrrhoLvTp export" : function () {
|
"Parse rrrrrrrrrrrrrrrrrrrrrhoLvTp export" : function () {
|
||||||
buster.assert.equals(UInt160.ADDRESS_ZERO, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrrhoLvTp").to_json());
|
buster.assert.equals(UInt160.ACCOUNT_ZERO, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrrhoLvTp").to_json());
|
||||||
},
|
},
|
||||||
"Parse rrrrrrrrrrrrrrrrrrrrBZbvji export" : function () {
|
"Parse rrrrrrrrrrrrrrrrrrrrBZbvji export" : function () {
|
||||||
buster.assert.equals(UInt160.ADDRESS_ONE, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrBZbvji").to_json());
|
buster.assert.equals(UInt160.ACCOUNT_ONE, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrBZbvji").to_json());
|
||||||
},
|
},
|
||||||
"Parse mtgox export" : function () {
|
"Parse mtgox export" : function () {
|
||||||
buster.assert.equals(config.accounts["mtgox"].account, UInt160.from_json("mtgox").to_json());
|
buster.assert.equals(config.accounts["mtgox"].account, UInt160.from_json("mtgox").to_json());
|
||||||
|
|||||||
Reference in New Issue
Block a user