Comparing version 1.3.6 to 1.3.7
@@ -0,0 +0,0 @@ --- |
@@ -0,0 +0,0 @@ --- |
@@ -80,5 +80,5 @@ "use strict"; | ||
This does it all: set fees, finalize, sign, and broadcast (if wanted). | ||
@arg {ConfidentialWallet} cwallet - must be unlocked, used to gather signing keys | ||
@arg {array<string>} [signer_pubkeys = null] - Optional ["GPHAbc9Def0...", ...]. These are additional signing keys. Some balance claims require propritary address formats, the witness node can't tell us which ones are needed so they must be passed in. If the witness node can figure out a signing key (mostly all other transactions), it should not be passed in here. | ||
@arg {boolean} [broadcast = false] | ||
@arg {ConfidentialWallet} cwallet - must be unlocked, used to gather signing keys | ||
@arg {array<string>} [signer_pubkeys = null] - Optional ["GPHAbc9Def0...", ...]. These are additional signing keys. Some balance claims require propritary address formats, the witness node can't tell us which ones are needed so they must be passed in. If the witness node can figure out a signing key (mostly all other transactions), it should not be passed in here. | ||
@arg {boolean} [broadcast = false] | ||
*/ | ||
@@ -85,0 +85,0 @@ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,30 +0,32 @@ | ||
'use strict'; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.object_id_type = exports.name_to_string = exports.string_to_name = undefined; | ||
exports.checksum160 = exports.object_id_type = exports.name_to_string = exports.string_to_name = undefined; | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _typeof2 = require("babel-runtime/helpers/typeof"); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
var _SerializerValidation = require('./SerializerValidation'); | ||
var _SerializerValidation = require("./SerializerValidation"); | ||
var _SerializerValidation2 = _interopRequireDefault(_SerializerValidation); | ||
var _FastParser = require('./FastParser'); | ||
var _FastParser = require("./FastParser"); | ||
var _FastParser2 = _interopRequireDefault(_FastParser); | ||
var _ChainTypes = require('../../chain/src/ChainTypes'); | ||
var _ChainTypes = require("../../chain/src/ChainTypes"); | ||
var _ChainTypes2 = _interopRequireDefault(_ChainTypes); | ||
var _ObjectId = require('../../chain/src/ObjectId'); | ||
var _ObjectId = require("../../chain/src/ObjectId"); | ||
var _ObjectId2 = _interopRequireDefault(_ObjectId); | ||
var _ecc = require('../../ecc'); | ||
var _ecc = require("../../ecc"); | ||
var _gxbjsWs = require('gxbjs-ws'); | ||
var _bytebuffer = require("bytebuffer"); | ||
var _bytebuffer2 = _interopRequireDefault(_bytebuffer); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -43,3 +45,3 @@ | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, "uint8 " + object); | ||
b.writeUint8(object); | ||
@@ -49,3 +51,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, "uint8 " + object); | ||
return object; | ||
@@ -59,3 +61,3 @@ }, | ||
} | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFF, object, "uint8 " + object); | ||
return parseInt(object); | ||
@@ -70,3 +72,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
b.writeUint16(object); | ||
@@ -76,3 +78,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
return object; | ||
@@ -86,3 +88,3 @@ }, | ||
} | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
return parseInt(object); | ||
@@ -97,3 +99,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
b.writeUint32(object); | ||
@@ -103,3 +105,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
return object; | ||
@@ -113,3 +115,3 @@ }, | ||
} | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
return parseInt(object); | ||
@@ -127,3 +129,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
b.writeVarint32(object); | ||
@@ -133,3 +135,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
return object; | ||
@@ -143,3 +145,3 @@ }, | ||
} | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
_SerializerValidation2.default.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
return parseInt(object); | ||
@@ -199,8 +201,8 @@ } | ||
b_copy = b.copy(b.offset, b.offset + len), b.skip(len); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return b_copy.toBuffer(); | ||
}, | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
_SerializerValidation2.default.required(object); | ||
b.writeVarint32(object.length); | ||
b.append(object.toString('binary'), 'binary'); | ||
b.writeVarint32(_bytebuffer2.default.calculateUTF8Bytes(object)); | ||
b.append(object, "utf8"); | ||
return; | ||
@@ -229,6 +231,6 @@ }, | ||
b_copy = b.copy(b.offset, b.offset + len), b.skip(len); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return new Buffer(b_copy.toBinary(), "binary"); | ||
} else { | ||
b_copy = b.copy(b.offset, b.offset + size), b.skip(size); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return new Buffer(b_copy.toBinary(), "binary"); | ||
} | ||
@@ -243,3 +245,3 @@ }, | ||
} | ||
b.append(object.toString('binary'), 'binary'); | ||
b.append(object.toString("binary"), "binary"); | ||
return; | ||
@@ -251,3 +253,3 @@ }, | ||
return new Buffer(object, 'hex'); | ||
return new Buffer(object, "hex"); | ||
}, | ||
@@ -264,3 +266,3 @@ toObject: function toObject(object) { | ||
_SerializerValidation2.default.required(object); | ||
return object.toString('hex'); | ||
return object.toString("hex"); | ||
} | ||
@@ -390,3 +392,3 @@ }; | ||
if (debug.use_default && object === undefined) return new Date(0).toISOString().split('.')[0]; | ||
if (debug.use_default && object === undefined) return new Date(0).toISOString().split(".")[0]; | ||
@@ -397,7 +399,7 @@ _SerializerValidation2.default.required(object); | ||
if (object.getTime) return object.toISOString().split('.')[0]; | ||
if (object.getTime) return object.toISOString().split(".")[0]; | ||
var int = parseInt(object); | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, int, 'uint32 ' + object); | ||
return new Date(int * 1000).toISOString().split('.')[0]; | ||
_SerializerValidation2.default.require_range(0, 0xFFFFFFFF, int, "uint32 " + object); | ||
return new Date(int * 1000).toISOString().split(".")[0]; | ||
} | ||
@@ -413,3 +415,3 @@ }; | ||
var ref; | ||
if (ref = typeof o === 'undefined' ? 'undefined' : (0, _typeof3.default)(o), ['string', 'number'].indexOf(ref) >= 0) { | ||
if (ref = typeof o === "undefined" ? "undefined" : (0, _typeof3.default)(o), ["string", "number"].indexOf(ref) >= 0) { | ||
if (dup_map[o] !== undefined) { | ||
@@ -574,3 +576,3 @@ throw new Error("duplicate (set)"); | ||
if (debug.use_default && object === undefined) { | ||
return reserved_spaces + '.' + object_type_id + '.0'; | ||
return reserved_spaces + "." + object_type_id + ".0"; | ||
} | ||
@@ -585,3 +587,3 @@ _SerializerValidation2.default.required(object); | ||
return reserved_spaces + '.' + object_type_id + '.' + object; | ||
return reserved_spaces + "." + object_type_id + "." + object; | ||
} | ||
@@ -651,3 +653,3 @@ }; | ||
_SerializerValidation2.default.required(object, "(type vote_id)"); | ||
if ((typeof object === 'undefined' ? 'undefined' : (0, _typeof3.default)(object)) === "object") { | ||
if ((typeof object === "undefined" ? "undefined" : (0, _typeof3.default)(object)) === "object") { | ||
_SerializerValidation2.default.required(object.type, "type"); | ||
@@ -657,10 +659,10 @@ _SerializerValidation2.default.required(object.id, "id"); | ||
} | ||
_SerializerValidation2.default.require_test(/^[0-9]+:[0-9]+$/, object, 'vote_id format ' + object); | ||
_SerializerValidation2.default.require_test(/^[0-9]+:[0-9]+$/, object, "vote_id format " + object); | ||
var _object$split = object.split(':'), | ||
var _object$split = object.split(":"), | ||
type = _object$split[0], | ||
id = _object$split[1]; | ||
_SerializerValidation2.default.require_range(0, 0xff, type, 'vote type ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xffffff, id, 'vote id ' + object); | ||
_SerializerValidation2.default.require_range(0, 0xff, type, "vote type " + object); | ||
_SerializerValidation2.default.require_range(0, 0xffffff, id, "vote id " + object); | ||
return { type: type, id: id }; | ||
@@ -680,4 +682,4 @@ }, | ||
compare: function compare(a, b) { | ||
if ((typeof a === 'undefined' ? 'undefined' : (0, _typeof3.default)(a)) !== "object") a = Types.vote_id.fromObject(a); | ||
if ((typeof b === 'undefined' ? 'undefined' : (0, _typeof3.default)(b)) !== "object") b = Types.vote_id.fromObject(b); | ||
if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object") a = Types.vote_id.fromObject(a); | ||
if ((typeof b === "undefined" ? "undefined" : (0, _typeof3.default)(b)) !== "object") b = Types.vote_id.fromObject(b); | ||
return parseInt(a.id) - parseInt(b.id); | ||
@@ -724,3 +726,3 @@ } | ||
if (debug.annotate) { | ||
if ((typeof result_object === 'undefined' ? 'undefined' : (0, _typeof3.default)(result_object)) === "object") { | ||
if ((typeof result_object === "undefined" ? "undefined" : (0, _typeof3.default)(result_object)) === "object") { | ||
result_object.__optional = "parent is optional"; | ||
@@ -744,5 +746,5 @@ } else { | ||
if (HEX_DUMP) { | ||
console.error('static_variant id 0x' + type_id.toString(16) + ' (' + type_id + ')'); | ||
console.error("static_variant id 0x" + type_id.toString(16) + " (" + type_id + ")"); | ||
} | ||
_SerializerValidation2.default.required(st_operation, 'operation ' + type_id); | ||
_SerializerValidation2.default.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.fromByteBuffer(b)]; | ||
@@ -754,3 +756,3 @@ }, | ||
var st_operation = this.st_operations[type_id]; | ||
_SerializerValidation2.default.required(st_operation, 'operation ' + type_id); | ||
_SerializerValidation2.default.required(st_operation, "operation " + type_id); | ||
b.writeVarint32(type_id); | ||
@@ -764,3 +766,3 @@ st_operation.appendByteBuffer(b, object[1]); | ||
var st_operation = this.st_operations[type_id]; | ||
_SerializerValidation2.default.required(st_operation, 'operation ' + type_id); | ||
_SerializerValidation2.default.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.fromObject(object[1])]; | ||
@@ -777,3 +779,3 @@ }, | ||
var st_operation = this.st_operations[type_id]; | ||
_SerializerValidation2.default.required(st_operation, 'operation ' + type_id); | ||
_SerializerValidation2.default.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.toObject(object[1], debug)]; | ||
@@ -797,3 +799,3 @@ } | ||
} | ||
if (ref = (0, _typeof3.default)(o[0]), ['number', 'string'].indexOf(ref) >= 0) { | ||
if (ref = (0, _typeof3.default)(o[0]), ["number", "string"].indexOf(ref) >= 0) { | ||
if (dup_map[o[0]] !== undefined) { | ||
@@ -877,5 +879,2 @@ throw new Error("duplicate (map)"); | ||
if (debug.use_default && object === undefined) { | ||
return _gxbjsWs.ChainConfig.address_prefix + "859gxfnXyUriMgUeThh1fWv3oqcpLFyHa3TfFYC4PK2HqhToVM"; | ||
} | ||
_SerializerValidation2.default.required(object); | ||
@@ -910,5 +909,2 @@ return object.toString(); | ||
if (debug.use_default && object === undefined) { | ||
return _gxbjsWs.ChainConfig.address_prefix + "664KmHxSuQyDsfwo4WEJvWpzg1QKdg67S"; | ||
} | ||
return Types.address._to_address(object).toString(); | ||
@@ -945,6 +941,12 @@ }, | ||
Types.checksum160 = Types.bytes(20); | ||
Types.checksum256 = Types.bytes(32); | ||
Types.checksum512 = Types.bytes(64); | ||
Types.block_id_type = Types.bytes(20); | ||
var char_to_symbol = function char_to_symbol(c) { | ||
var result = 0; | ||
if (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) result = c - 'a'.charCodeAt(0) + 6; | ||
if (c >= '1'.charCodeAt(0) && c <= '5'.charCodeAt(0)) result = c - '1'.charCodeAt(0) + 1; | ||
if (c >= "a".charCodeAt(0) && c <= "z".charCodeAt(0)) result = c - "a".charCodeAt(0) + 6; | ||
if (c >= "1".charCodeAt(0) && c <= "5".charCodeAt(0)) result = c - "1".charCodeAt(0) + 1; | ||
return result; | ||
@@ -984,3 +986,3 @@ }; | ||
} | ||
return str.reverse().join('').replace(/\.+$/g, ''); | ||
return str.reverse().join("").replace(/\.+$/g, ""); | ||
}; | ||
@@ -994,3 +996,3 @@ | ||
var object_id_type = exports.object_id_type = function object_id_type(account_id_str) { | ||
var account_id = account_id_str.split('.').map(function (i) { | ||
var account_id = account_id_str.split(".").map(function (i) { | ||
return _SerializerValidation2.default.to_long(i); | ||
@@ -1001,2 +1003,4 @@ }); | ||
var checksum160 = exports.checksum160 = Types.bytes(20); | ||
var strCmp = function strCmp(a, b) { | ||
@@ -1003,0 +1007,0 @@ return a > b ? 1 : a < b ? -1 : 0; |
@@ -49,5 +49,5 @@ import _JSON$stringify from "babel-runtime/core-js/json/stringify"; | ||
This does it all: set fees, finalize, sign, and broadcast (if wanted). | ||
@arg {ConfidentialWallet} cwallet - must be unlocked, used to gather signing keys | ||
@arg {array<string>} [signer_pubkeys = null] - Optional ["GPHAbc9Def0...", ...]. These are additional signing keys. Some balance claims require propritary address formats, the witness node can't tell us which ones are needed so they must be passed in. If the witness node can figure out a signing key (mostly all other transactions), it should not be passed in here. | ||
@arg {boolean} [broadcast = false] | ||
@arg {ConfidentialWallet} cwallet - must be unlocked, used to gather signing keys | ||
@arg {array<string>} [signer_pubkeys = null] - Optional ["GPHAbc9Def0...", ...]. These are additional signing keys. Some balance claims require propritary address formats, the witness node can't tell us which ones are needed so they must be passed in. If the witness node can figure out a signing key (mostly all other transactions), it should not be passed in here. | ||
@arg {boolean} [broadcast = false] | ||
*/ | ||
@@ -54,0 +54,0 @@ |
@@ -0,0 +0,0 @@ import types from "./types"; |
@@ -1,12 +0,11 @@ | ||
import _typeof from 'babel-runtime/helpers/typeof'; | ||
import _typeof from "babel-runtime/helpers/typeof"; | ||
// Low-level types that make up operations | ||
import v from './SerializerValidation'; | ||
import fp from './FastParser'; | ||
import v from "./SerializerValidation"; | ||
import fp from "./FastParser"; | ||
import ChainTypes from "../../chain/src/ChainTypes"; | ||
import ObjectId from "../../chain/src/ObjectId"; | ||
import { Address, PublicKey } from "../../ecc"; | ||
import { ChainConfig } from "gxbjs-ws"; | ||
import ByteBuffer from "bytebuffer"; | ||
@@ -22,3 +21,3 @@ var Types = {}; | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
v.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
v.require_range(0, 0xFF, object, "uint8 " + object); | ||
b.writeUint8(object); | ||
@@ -28,3 +27,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
v.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
v.require_range(0, 0xFF, object, "uint8 " + object); | ||
return object; | ||
@@ -38,3 +37,3 @@ }, | ||
} | ||
v.require_range(0, 0xFF, object, 'uint8 ' + object); | ||
v.require_range(0, 0xFF, object, "uint8 " + object); | ||
return parseInt(object); | ||
@@ -49,3 +48,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
v.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
v.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
b.writeUint16(object); | ||
@@ -55,3 +54,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
v.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
v.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
return object; | ||
@@ -65,3 +64,3 @@ }, | ||
} | ||
v.require_range(0, 0xFFFF, object, 'uint16 ' + object); | ||
v.require_range(0, 0xFFFF, object, "uint16 " + object); | ||
return parseInt(object); | ||
@@ -76,3 +75,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
v.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
v.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
b.writeUint32(object); | ||
@@ -82,3 +81,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
v.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
v.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
return object; | ||
@@ -92,3 +91,3 @@ }, | ||
} | ||
v.require_range(0, 0xFFFFFFFF, object, 'uint32 ' + object); | ||
v.require_range(0, 0xFFFFFFFF, object, "uint32 " + object); | ||
return parseInt(object); | ||
@@ -106,3 +105,3 @@ } | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
b.writeVarint32(object); | ||
@@ -112,3 +111,3 @@ return; | ||
fromObject: function fromObject(object) { | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
return object; | ||
@@ -122,3 +121,3 @@ }, | ||
} | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, 'uint32 ' + object); | ||
v.require_range(MIN_SIGNED_32, MAX_SIGNED_32, object, "uint32 " + object); | ||
return parseInt(object); | ||
@@ -178,8 +177,8 @@ } | ||
b_copy = b.copy(b.offset, b.offset + len), b.skip(len); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return b_copy.toBuffer(); | ||
}, | ||
appendByteBuffer: function appendByteBuffer(b, object) { | ||
v.required(object); | ||
b.writeVarint32(object.length); | ||
b.append(object.toString('binary'), 'binary'); | ||
b.writeVarint32(ByteBuffer.calculateUTF8Bytes(object)); | ||
b.append(object, "utf8"); | ||
return; | ||
@@ -208,6 +207,6 @@ }, | ||
b_copy = b.copy(b.offset, b.offset + len), b.skip(len); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return new Buffer(b_copy.toBinary(), "binary"); | ||
} else { | ||
b_copy = b.copy(b.offset, b.offset + size), b.skip(size); | ||
return new Buffer(b_copy.toBinary(), 'binary'); | ||
return new Buffer(b_copy.toBinary(), "binary"); | ||
} | ||
@@ -222,3 +221,3 @@ }, | ||
} | ||
b.append(object.toString('binary'), 'binary'); | ||
b.append(object.toString("binary"), "binary"); | ||
return; | ||
@@ -230,3 +229,3 @@ }, | ||
return new Buffer(object, 'hex'); | ||
return new Buffer(object, "hex"); | ||
}, | ||
@@ -243,3 +242,3 @@ toObject: function toObject(object) { | ||
v.required(object); | ||
return object.toString('hex'); | ||
return object.toString("hex"); | ||
} | ||
@@ -369,3 +368,3 @@ }; | ||
if (debug.use_default && object === undefined) return new Date(0).toISOString().split('.')[0]; | ||
if (debug.use_default && object === undefined) return new Date(0).toISOString().split(".")[0]; | ||
@@ -376,7 +375,7 @@ v.required(object); | ||
if (object.getTime) return object.toISOString().split('.')[0]; | ||
if (object.getTime) return object.toISOString().split(".")[0]; | ||
var int = parseInt(object); | ||
v.require_range(0, 0xFFFFFFFF, int, 'uint32 ' + object); | ||
return new Date(int * 1000).toISOString().split('.')[0]; | ||
v.require_range(0, 0xFFFFFFFF, int, "uint32 " + object); | ||
return new Date(int * 1000).toISOString().split(".")[0]; | ||
} | ||
@@ -392,3 +391,3 @@ }; | ||
var ref; | ||
if (ref = typeof o === 'undefined' ? 'undefined' : _typeof(o), ['string', 'number'].indexOf(ref) >= 0) { | ||
if (ref = typeof o === "undefined" ? "undefined" : _typeof(o), ["string", "number"].indexOf(ref) >= 0) { | ||
if (dup_map[o] !== undefined) { | ||
@@ -553,3 +552,3 @@ throw new Error("duplicate (set)"); | ||
if (debug.use_default && object === undefined) { | ||
return reserved_spaces + '.' + object_type_id + '.0'; | ||
return reserved_spaces + "." + object_type_id + ".0"; | ||
} | ||
@@ -564,3 +563,3 @@ v.required(object); | ||
return reserved_spaces + '.' + object_type_id + '.' + object; | ||
return reserved_spaces + "." + object_type_id + "." + object; | ||
} | ||
@@ -630,3 +629,3 @@ }; | ||
v.required(object, "(type vote_id)"); | ||
if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) === "object") { | ||
if ((typeof object === "undefined" ? "undefined" : _typeof(object)) === "object") { | ||
v.required(object.type, "type"); | ||
@@ -636,10 +635,10 @@ v.required(object.id, "id"); | ||
} | ||
v.require_test(/^[0-9]+:[0-9]+$/, object, 'vote_id format ' + object); | ||
v.require_test(/^[0-9]+:[0-9]+$/, object, "vote_id format " + object); | ||
var _object$split = object.split(':'), | ||
var _object$split = object.split(":"), | ||
type = _object$split[0], | ||
id = _object$split[1]; | ||
v.require_range(0, 0xff, type, 'vote type ' + object); | ||
v.require_range(0, 0xffffff, id, 'vote id ' + object); | ||
v.require_range(0, 0xff, type, "vote type " + object); | ||
v.require_range(0, 0xffffff, id, "vote id " + object); | ||
return { type: type, id: id }; | ||
@@ -659,4 +658,4 @@ }, | ||
compare: function compare(a, b) { | ||
if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== "object") a = Types.vote_id.fromObject(a); | ||
if ((typeof b === 'undefined' ? 'undefined' : _typeof(b)) !== "object") b = Types.vote_id.fromObject(b); | ||
if ((typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object") a = Types.vote_id.fromObject(a); | ||
if ((typeof b === "undefined" ? "undefined" : _typeof(b)) !== "object") b = Types.vote_id.fromObject(b); | ||
return parseInt(a.id) - parseInt(b.id); | ||
@@ -703,3 +702,3 @@ } | ||
if (debug.annotate) { | ||
if ((typeof result_object === 'undefined' ? 'undefined' : _typeof(result_object)) === "object") { | ||
if ((typeof result_object === "undefined" ? "undefined" : _typeof(result_object)) === "object") { | ||
result_object.__optional = "parent is optional"; | ||
@@ -723,5 +722,5 @@ } else { | ||
if (HEX_DUMP) { | ||
console.error('static_variant id 0x' + type_id.toString(16) + ' (' + type_id + ')'); | ||
console.error("static_variant id 0x" + type_id.toString(16) + " (" + type_id + ")"); | ||
} | ||
v.required(st_operation, 'operation ' + type_id); | ||
v.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.fromByteBuffer(b)]; | ||
@@ -733,3 +732,3 @@ }, | ||
var st_operation = this.st_operations[type_id]; | ||
v.required(st_operation, 'operation ' + type_id); | ||
v.required(st_operation, "operation " + type_id); | ||
b.writeVarint32(type_id); | ||
@@ -743,3 +742,3 @@ st_operation.appendByteBuffer(b, object[1]); | ||
var st_operation = this.st_operations[type_id]; | ||
v.required(st_operation, 'operation ' + type_id); | ||
v.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.fromObject(object[1])]; | ||
@@ -756,3 +755,3 @@ }, | ||
var st_operation = this.st_operations[type_id]; | ||
v.required(st_operation, 'operation ' + type_id); | ||
v.required(st_operation, "operation " + type_id); | ||
return [type_id, st_operation.toObject(object[1], debug)]; | ||
@@ -776,3 +775,3 @@ } | ||
} | ||
if (ref = _typeof(o[0]), ['number', 'string'].indexOf(ref) >= 0) { | ||
if (ref = _typeof(o[0]), ["number", "string"].indexOf(ref) >= 0) { | ||
if (dup_map[o[0]] !== undefined) { | ||
@@ -856,5 +855,2 @@ throw new Error("duplicate (map)"); | ||
if (debug.use_default && object === undefined) { | ||
return ChainConfig.address_prefix + "859gxfnXyUriMgUeThh1fWv3oqcpLFyHa3TfFYC4PK2HqhToVM"; | ||
} | ||
v.required(object); | ||
@@ -889,5 +885,2 @@ return object.toString(); | ||
if (debug.use_default && object === undefined) { | ||
return ChainConfig.address_prefix + "664KmHxSuQyDsfwo4WEJvWpzg1QKdg67S"; | ||
} | ||
return Types.address._to_address(object).toString(); | ||
@@ -924,6 +917,12 @@ }, | ||
Types.checksum160 = Types.bytes(20); | ||
Types.checksum256 = Types.bytes(32); | ||
Types.checksum512 = Types.bytes(64); | ||
Types.block_id_type = Types.bytes(20); | ||
var char_to_symbol = function char_to_symbol(c) { | ||
var result = 0; | ||
if (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) result = c - 'a'.charCodeAt(0) + 6; | ||
if (c >= '1'.charCodeAt(0) && c <= '5'.charCodeAt(0)) result = c - '1'.charCodeAt(0) + 1; | ||
if (c >= "a".charCodeAt(0) && c <= "z".charCodeAt(0)) result = c - "a".charCodeAt(0) + 6; | ||
if (c >= "1".charCodeAt(0) && c <= "5".charCodeAt(0)) result = c - "1".charCodeAt(0) + 1; | ||
return result; | ||
@@ -963,3 +962,3 @@ }; | ||
} | ||
return str.reverse().join('').replace(/\.+$/g, ''); | ||
return str.reverse().join("").replace(/\.+$/g, ""); | ||
}; | ||
@@ -973,3 +972,3 @@ | ||
export var object_id_type = function object_id_type(account_id_str) { | ||
var account_id = account_id_str.split('.').map(function (i) { | ||
var account_id = account_id_str.split(".").map(function (i) { | ||
return v.to_long(i); | ||
@@ -980,2 +979,4 @@ }); | ||
export var checksum160 = Types.bytes(20); | ||
var strCmp = function strCmp(a, b) { | ||
@@ -982,0 +983,0 @@ return a > b ? 1 : a < b ? -1 : 0; |
@@ -0,0 +0,0 @@ import {name_to_string, object_id_type, string_to_name} from "../lib/serializer"; |
{ | ||
"name": "gxbjs", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"description": "Pure JavaScript GXChain library for node.js and browsers.", | ||
@@ -19,3 +19,3 @@ "browser": { | ||
"build-es": "BABEL_ENV=es babel lib -d es", | ||
"postbuild": "npm run browserify && npm run build-es", | ||
"postbuild": "npm run browserify && npm run browserify_action_serializer && npm run build-es", | ||
"build:watch": "babel lib -d dist --watch", | ||
@@ -25,18 +25,6 @@ "prebrowserify": "rm -rf ./build/*", | ||
"postbrowserify": "uglifyjs --compress --mangle --sequences --drop_console --output build/gxbjs.min.js -- build/gxbjs.js", | ||
"browserify_action_serializer":"browserify --full-paths dist/action_serializer.js --standalone action_serializer -o build/action_serializer.js -d", | ||
"postbrowserify_action_serializer": "uglifyjs --compress --mangle --sequences --drop_console --output build/action_serializer.min.js -- build/action_serializer.js", | ||
"prepublish": "npm run build", | ||
"doc": "esdoc -c esdoc.json", | ||
"example:transfer": "babel-node examples/transfer", | ||
"example:block": "babel-node examples/block", | ||
"example:sign": "babel-node examples/sign", | ||
"example:verify": "babel-node examples/verify", | ||
"example:create_data_transaction": "babel-node examples/create_data_transaction", | ||
"example:update_data_transaction": "babel-node examples/update_data_transaction", | ||
"example:pay_data_transaction": "babel-node examples/pay_data_transaction", | ||
"example:subscribe_data_transaction": "babel-node examples/subscribe_data_transaction", | ||
"example:data_transaction_datasource_validate_error": "babel-node examples/data_transaction_datasource_validate_error", | ||
"example:chainStore": "babel-node examples/chainStore", | ||
"example:privKey": "babel-node examples/privKey", | ||
"example:name_type": "babel-node examples/name_type", | ||
"example:dynamicSerializer": "babel-node examples/dynamicSerializer", | ||
"ttt": "babel-node test/chain/test.js" | ||
"doc": "esdoc -c esdoc.json" | ||
}, | ||
@@ -43,0 +31,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
748097
96
13072