Comparing version 13.0.0 to 13.0.1
@@ -17,12 +17,15 @@ 'use strict'; | ||
/** @return {Promise} {precision} */ | ||
};function lookupAsync(symbol, account) { | ||
/** | ||
@return {Promise} {precision} | ||
@throws AssertionError | ||
*/ | ||
};function lookupAsync(symbol, contract) { | ||
assert(symbol, 'required symbol'); | ||
assert(account, 'required account'); | ||
assert(contract, 'required contract'); | ||
if (account === 'eosio') { | ||
account = 'eosio.token'; | ||
if (contract === 'eosio') { | ||
contract = 'eosio.token'; | ||
} | ||
var extendedAsset = symbol + '@' + account; | ||
var extendedAsset = symbol + '@' + contract; | ||
@@ -33,5 +36,9 @@ if (cache[extendedAsset] != null) { | ||
var statsPromise = network.getCurrencyStats(account, symbol).then(function (result) { | ||
var statsPromise = network.getCurrencyStats(contract, symbol).then(function (result) { | ||
var stats = result[symbol]; | ||
assert(stats, 'Missing currency stats for asset: ' + extendedAsset); | ||
if (!stats) { | ||
cache[extendedAsset] = null; // retry (null means no asset was observed) | ||
// console.log(`Missing currency stats for asset: ${extendedAsset}`) | ||
return; | ||
} | ||
@@ -60,24 +67,29 @@ var max_supply = stats.max_supply; | ||
}); | ||
promises.push(statsPromise); | ||
return cache[extendedAsset] = statsPromise; | ||
} | ||
function lookup(symbol, account) { | ||
/** | ||
@return {Object} {precision}, or null asset did not exist, | ||
or undefined = unknown if asset exists (call lookupAsync) | ||
*/ | ||
function lookup(symbol, contract) { | ||
assert(symbol, 'required symbol'); | ||
assert(account, 'required account'); | ||
assert(contract, 'required contract'); | ||
if (account === 'eosio') { | ||
account = 'eosio.token'; | ||
if (contract === 'eosio') { | ||
contract = 'eosio.token'; | ||
} | ||
var extendedAsset = symbol + '@' + account; | ||
var extendedAsset = symbol + '@' + contract; | ||
var c = cache[extendedAsset]; | ||
if (c != null) { | ||
return c; | ||
} | ||
if (c instanceof Promise) { | ||
return undefined; | ||
return undefined; // pending | ||
} | ||
return null; | ||
return c; | ||
} | ||
@@ -84,0 +96,0 @@ |
@@ -5,4 +5,2 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var assert = require('assert'); | ||
@@ -29,3 +27,3 @@ | ||
UDecimalUnimply: UDecimalUnimply, | ||
parseAssetSymbol: parseAssetSymbol | ||
parseExtendedAsset: parseExtendedAsset | ||
}; | ||
@@ -82,2 +80,3 @@ | ||
@arg {string} name - A string to encode, up to 12 characters long. | ||
@return {string<uint64>} - compressed string (from name arg). A string is | ||
@@ -91,3 +90,3 @@ always used because a number could exceed JavaScript's 52 bit limit. | ||
if (name.length > 13) throw new TypeError('A name can be up to 13 characters long'); | ||
if (name.length > 12) throw new TypeError('A name can be up to 12 characters long'); | ||
@@ -256,4 +255,5 @@ var bitstr = ''; | ||
} | ||
assert.equal('number', typeof precision === 'undefined' ? 'undefined' : _typeof(precision), 'precision'); | ||
assert(precision >= 0 && precision <= 18, 'Precision should be 18 characters or less'); | ||
var part = value.split('.'); | ||
@@ -292,2 +292,3 @@ | ||
assert(precision != null, 'precision required'); | ||
assert(precision >= 0 && precision <= 18, 'Precision should be 18 characters or less'); | ||
@@ -306,43 +307,48 @@ // Ensure minimum length | ||
/** | ||
@arg {string} assetSymbol - 4,SYS | ||
@arg {number} [precision = null] - expected precision or mismatch AssertionError | ||
Attempts to parse all forms of the asset strings (symbol, asset, or extended | ||
versions). If the provided string contains any additional or appears to have | ||
invalid information an error is thrown. | ||
@example assert.deepEqual(parseAssetSymbol('SYS'), {precision: null, symbol: 'SYS'}) | ||
@example assert.deepEqual(parseAssetSymbol('4,SYS'), {precision: 4, symbol: 'SYS'}) | ||
@return {object} {amount, precision, symbol, contract} | ||
@throws AssertionError | ||
@throws TypeError | ||
*/ | ||
function parseAssetSymbol(assetSymbol) { | ||
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
function parseExtendedAsset(str) { | ||
var _str$split = str.split(' '), | ||
_str$split2 = _slicedToArray(_str$split, 1), | ||
amountRaw = _str$split2[0]; | ||
assert.equal(typeof assetSymbol === 'undefined' ? 'undefined' : _typeof(assetSymbol), 'string', 'Asset symbol should be string'); | ||
var amountMatch = amountRaw.match(/^([0-9]+(\.[0-9]+)?)( |$)/); | ||
var amount = amountMatch ? amountMatch[1] : null; | ||
if (assetSymbol.indexOf(',') === -1) { | ||
assetSymbol = ',' + assetSymbol; // null precision | ||
} | ||
var v = assetSymbol.split(','); | ||
assert(v.length === 2, 'Asset symbol "' + assetSymbol + '" may have a precision like this: 4,SYS'); | ||
var precisionMatch = str.match(/(^| )([0-9]+),([A-Z]+)(@|$)/); | ||
var precision = precisionMatch ? Number(precisionMatch[2]) : null; | ||
var symbolPrecision = v[0] == '' ? null : parseInt(v[0]); | ||
var symbolMatch = str.match(/([A-Z]+)(@|$)/); | ||
var symbol = symbolMatch ? symbolMatch[1] : null; | ||
var _v$1$split = v[1].split('@'), | ||
_v$1$split2 = _slicedToArray(_v$1$split, 1), | ||
symbol = _v$1$split2[0]; // remove contract (if exists) | ||
var _str$split3 = str.split('@'), | ||
_str$split4 = _slicedToArray(_str$split3, 2), | ||
contractRaw = _str$split4[1]; | ||
if (precision != null) { | ||
assert.equal(precision, symbolPrecision, 'Asset symbol precision mismatch'); | ||
} else { | ||
precision = symbolPrecision; | ||
} | ||
var contract = /[a-z0-5]+(\.[a-z0-5]+])?$/.test(contractRaw) ? contractRaw : null; | ||
var join = function join(e1, e2) { | ||
return e1 == null ? '' : e2 == null ? '' : e1 + e2; | ||
}; | ||
var asset = join(precision, ',') + symbol; | ||
var check = join(amount, ' ') + asset + join('@', contract); | ||
assert.equal(str, check, 'Invalid extended asset string: ' + str + ' !== ' + check); | ||
if (precision != null) { | ||
assert.equal(typeof precision === 'undefined' ? 'undefined' : _typeof(precision), 'number', 'precision'); | ||
assert(precision > -1, 'precision must be positive'); | ||
assert(precision >= 0 && precision <= 18, 'Precision should be 18 characters or less'); | ||
} | ||
if (symbol != null) { | ||
assert(symbol.length <= 7, 'Asset symbol is 7 characters or less'); | ||
} | ||
if (contract != null) { | ||
assert(contract.length <= 12, 'Contract is 12 characters or less'); | ||
} | ||
assert(/^[A-Z]+$/.test(symbol), 'Asset symbol should contain only uppercase letters A-Z: ' + symbol); | ||
assert(precision <= 18, 'Precision should be 18 characters or less'); | ||
assert(symbol.length <= 7, 'Asset symbol is 7 characters or less'); | ||
return { precision: precision, symbol: symbol }; | ||
var extendedAsset = join(symbol, '') + join('@', contract); | ||
return { amount: amount, precision: precision, symbol: symbol, contract: contract }; | ||
} |
'use strict'; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
/* eslint-env mocha */ | ||
@@ -14,3 +16,3 @@ var assert = require('assert'); | ||
UDecimalUnimply = _require.UDecimalUnimply, | ||
parseAssetSymbol = _require.parseAssetSymbol; | ||
parseExtendedAsset = _require.parseExtendedAsset; | ||
@@ -21,4 +23,4 @@ describe('format', function () { | ||
var nameFixture = { | ||
isname: ['isname111111j', 'a', '1', '5', 'sam5', 'sam', 'adam.applejjj'], | ||
noname: ['isname111111k', undefined, null, 1, '6', 'a6', ' '] | ||
isname: ['isname111111', 'a', '1', '5', 'sam5', 'sam', 'adam.applejj'], | ||
noname: ['isname111111j', undefined, null, 1, '6', 'a6', ' '] | ||
}; | ||
@@ -240,27 +242,33 @@ | ||
it('parseAssetSymbol', function () { | ||
assert.deepEqual(parseAssetSymbol('SYS'), { precision: null, symbol: 'SYS' }); | ||
assert.deepEqual(parseAssetSymbol('4,SYS'), { precision: 4, symbol: 'SYS' }); | ||
it('parseExtendedAsset', function () { | ||
var parseExtendedAssets = [['SYM', null, null, 'SYM', null], ['SYM@contract', null, null, 'SYM', 'contract'], ['4,SYM', null, 4, 'SYM', null], ['4,SYM@contract', null, 4, 'SYM', 'contract'], ['1 SYM', '1', null, 'SYM', null], ['1.0 SYM', '1.0', null, 'SYM', null], ['1.0 4,SYM@contract', '1.0', 4, 'SYM', 'contract'], ['1.0 4,SYM', '1.0', 4, 'SYM', null]]; | ||
var _iteratorNormalCompletion7 = true; | ||
var _didIteratorError7 = false; | ||
var _iteratorError7 = undefined; | ||
assert.throws(function () { | ||
return parseAssetSymbol(369); | ||
}, /should be string/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('4,SYS,2', 2); | ||
}, /precision like this/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('4,SYS', 2); | ||
}, /Asset symbol precision mismatch/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('-2,SYS'); | ||
}, /precision must be positive/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('sym'); | ||
}, /only uppercase/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('19,SYS'); | ||
}, /18 characters or less/); | ||
assert.throws(function () { | ||
return parseAssetSymbol('TOOLONGSYM'); | ||
}, /7 characters or less/); | ||
try { | ||
for (var _iterator7 = parseExtendedAssets[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { | ||
var _step7$value = _slicedToArray(_step7.value, 5), | ||
str = _step7$value[0], | ||
amount = _step7$value[1], | ||
precision = _step7$value[2], | ||
symbol = _step7$value[3], | ||
contract = _step7$value[4]; | ||
assert.deepEqual(parseExtendedAsset(str), { amount: amount, precision: precision, symbol: symbol, contract: contract }); | ||
} | ||
} catch (err) { | ||
_didIteratorError7 = true; | ||
_iteratorError7 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion7 && _iterator7.return) { | ||
_iterator7.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError7) { | ||
throw _iteratorError7; | ||
} | ||
} | ||
} | ||
}); | ||
@@ -267,0 +275,0 @@ }); |
@@ -351,2 +351,12 @@ { | ||
}, | ||
"setparams": { | ||
"base": "", | ||
"action": { | ||
"name": "setparams", | ||
"account": "eosio" | ||
}, | ||
"fields": { | ||
"params": "eosio_parameters" | ||
} | ||
}, | ||
"setpriv": { | ||
@@ -353,0 +363,0 @@ "base": "", |
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _require = require('eosjs-ecc'), | ||
@@ -24,3 +24,3 @@ Signature = _require.Signature, | ||
UDecimalUnimply = _require2.UDecimalUnimply, | ||
parseAssetSymbol = _require2.parseAssetSymbol; | ||
parseExtendedAsset = _require2.parseExtendedAsset; | ||
@@ -248,22 +248,46 @@ /** Configures Fcbuffer for EOS specific structs and types. */ | ||
/** @private */ | ||
function precisionCache(assetCache, sym) { | ||
var account = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentAccount; | ||
function precisionCache(assetCache, value) { | ||
var symbolInfo = parseExtendedAsset(value); | ||
var contract = symbolInfo.contract || currentAccount; | ||
var assetSymbol = parseAssetSymbol(sym); | ||
var precision = assetSymbol.precision; | ||
var precision = void 0; | ||
if (account) { | ||
var asset = assetCache.lookup(assetSymbol.symbol, account); | ||
if (asset) { | ||
if (precision == null) { | ||
precision = asset.precision; | ||
} else { | ||
assert.equal(asset.precision, precision, 'Precision mismatch for asset: ' + sym + '@' + account); | ||
if (contract) { | ||
var asset = assetCache.lookup(symbolInfo.symbol, contract); | ||
if (asset != null) { | ||
if (symbolInfo.precision != null) { | ||
assert.equal(asset.precision, symbolInfo.precision, 'Precision mismatch for asset: ' + value); | ||
} | ||
precision = asset.precision; | ||
} else { | ||
// Lookup data for later (appendByteBuffer needs it) | ||
assetCache.lookupAsync(assetSymbol.symbol, account); | ||
// Lookup for later (appendByteBuffer) | ||
assetCache.lookupAsync(symbolInfo.symbol, contract); | ||
// asset === null is a confirmation that the asset did not exist on the blockchain | ||
if (asset === null) { | ||
if (symbolInfo.precision == null && symbolInfo.amount != null) { | ||
// no blockchain asset, no explicit precision .. derive from amount | ||
var _symbolInfo$amount$sp = symbolInfo.amount.split('.'), | ||
_symbolInfo$amount$sp2 = _slicedToArray(_symbolInfo$amount$sp, 2), | ||
_symbolInfo$amount$sp3 = _symbolInfo$amount$sp2[1], | ||
decimalstr = _symbolInfo$amount$sp3 === undefined ? '' : _symbolInfo$amount$sp3; | ||
precision = decimalstr.length; | ||
// console.log('derivied precision for new asset: ' + precision + ',' + symbolInfo.symbol) | ||
} | ||
} | ||
} | ||
} | ||
return { symbol: assetSymbol.symbol, precision: precision }; | ||
if (precision == null) { | ||
precision = symbolInfo.precision; | ||
} | ||
var pc = Object.assign({}, symbolInfo, { contract: contract }); | ||
if (precision != null) { | ||
pc.precision = precision; | ||
} | ||
// console.log('precisionCache', pc) | ||
return pc; | ||
} | ||
@@ -396,20 +420,10 @@ | ||
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var defaultContract = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'string', 'expecting asset string, got ' + (typeof value === 'undefined' ? 'undefined' : _typeof(value))); | ||
var _value$split3 = value.split(' '), | ||
_value$split4 = _slicedToArray(_value$split3, 2), | ||
amount = _value$split4[0], | ||
sym = _value$split4[1]; | ||
var _sym$split = sym.split('@'), | ||
_sym$split2 = _slicedToArray(_sym$split, 2), | ||
asset = _sym$split2[0], | ||
_sym$split2$ = _sym$split2[1], | ||
contract = _sym$split2$ === undefined ? defaultContract : _sym$split2$; | ||
var _precisionCache3 = precisionCache(assetCache, asset, contract), | ||
var _precisionCache3 = precisionCache(assetCache, value), | ||
precision = _precisionCache3.precision, | ||
symbol = _precisionCache3.symbol; | ||
symbol = _precisionCache3.symbol, | ||
amount = _precisionCache3.amount, | ||
contract = _precisionCache3.contract; | ||
@@ -428,3 +442,5 @@ if (format === 'plain') { | ||
var precisionPrefix = precision != null ? precision + ',' : ''; | ||
return UDecimalPad(amount, precision) + ' ' + precisionPrefix + symbol + _contractSuffix; | ||
var full = UDecimalPad(amount, precision) + ' ' + precisionPrefix + symbol + _contractSuffix; | ||
// console.log('full', full) | ||
return full; | ||
} | ||
@@ -450,5 +466,6 @@ | ||
var _precisionCache4 = precisionCache(assetCache, sym), | ||
precision = _precisionCache4.precision; | ||
precision = _precisionCache4.precision, | ||
symbol = _precisionCache4.symbol; | ||
return toAssetString(UDecimalUnimply(amount, precision) + ' ' + sym, assetCache, 'full', currentAccount); | ||
return toAssetString(UDecimalUnimply(amount, precision) + ' ' + precision + ',' + symbol, assetCache, 'full'); | ||
}, | ||
@@ -458,22 +475,14 @@ appendByteBuffer: function appendByteBuffer(b, value) { | ||
var _value$split5 = value.split(' '), | ||
_value$split6 = _slicedToArray(_value$split5, 2), | ||
amount = _value$split6[0], | ||
sym = _value$split6[1]; | ||
var _precisionCache5 = precisionCache(assetCache, value), | ||
amount = _precisionCache5.amount, | ||
precision = _precisionCache5.precision, | ||
symbol = _precisionCache5.symbol, | ||
contract = _precisionCache5.contract; | ||
var _precisionCache5 = precisionCache(assetCache, sym), | ||
precision = _precisionCache5.precision; | ||
assert(precision != null, 'Precision unknown for asset: ' + sym + '@' + currentAccount); | ||
var _sym$split3 = sym.split('@'), | ||
_sym$split4 = _slicedToArray(_sym$split3, 2), | ||
asset = _sym$split4[0], | ||
contract = _sym$split4[1]; | ||
assert(precision != null, 'Precision unknown for asset: ' + value); | ||
amountType.appendByteBuffer(b, UDecimalImply(amount, precision)); | ||
symbolType.appendByteBuffer(b, asset); | ||
symbolType.appendByteBuffer(b, value); | ||
}, | ||
fromObject: function fromObject(value) { | ||
return toAssetString(value, assetCache, 'full', currentAccount); | ||
return toAssetString(value, assetCache, 'full'); | ||
}, | ||
@@ -484,3 +493,3 @@ toObject: function toObject(value) { | ||
} | ||
return toAssetString(value, assetCache, 'plain', currentAccount); | ||
return toAssetString(value, assetCache, 'plain'); | ||
} | ||
@@ -508,6 +517,6 @@ }; | ||
var _value$split7 = value.split('@'), | ||
_value$split8 = _slicedToArray(_value$split7, 2), | ||
asset = _value$split8[0], | ||
contract = _value$split8[1]; | ||
var _value$split3 = value.split('@'), | ||
_value$split4 = _slicedToArray(_value$split3, 2), | ||
asset = _value$split4[0], | ||
contract = _value$split4[1]; | ||
@@ -571,7 +580,7 @@ assert.equal(typeof contract === 'undefined' ? 'undefined' : _typeof(contract), 'string', 'Invalid extended asset: ' + value); | ||
if (typeof value === 'string') { | ||
var _value$split9 = value.split('@'), | ||
_value$split10 = _slicedToArray(_value$split9, 2), | ||
account = _value$split10[0], | ||
_value$split10$ = _value$split10[1], | ||
permission = _value$split10$ === undefined ? 'active' : _value$split10$; | ||
var _value$split5 = value.split('@'), | ||
_value$split6 = _slicedToArray(_value$split5, 2), | ||
account = _value$split6[0], | ||
_value$split6$ = _value$split6[1], | ||
permission = _value$split6$ === undefined ? 'active' : _value$split6$; | ||
@@ -608,8 +617,9 @@ return { | ||
result = _ref.result; | ||
var binaryen = config.binaryen; | ||
assert(binaryen != null, 'required: config.binaryen = require("binaryen")'); | ||
try { | ||
var code = object.code.toString(); | ||
if (/^\s*\(module/.test(code)) { | ||
var binaryen = config.binaryen; | ||
assert(binaryen != null, 'required: config.binaryen = require("binaryen")'); | ||
if (config.debug) { | ||
@@ -699,2 +709,3 @@ console.log('Assembling WASM..'); | ||
currentAccount = object.account; | ||
try { | ||
@@ -705,3 +716,2 @@ var ser = (name || '') == '' ? fields.data : structLookup(name, object.account); | ||
result.data = ser.fromObject(data); // resolve shorthand | ||
return; | ||
} else if (typeof data === 'string') { | ||
@@ -732,6 +742,6 @@ var buf = new Buffer(data, 'hex'); | ||
data = _ref6.data, | ||
name = _ref6.name, | ||
account = _ref6.account; | ||
name = _ref6.name; | ||
currentAccount = object.account; | ||
try { | ||
@@ -741,7 +751,2 @@ var ser = (name || '') == '' ? fields.data : structLookup(name, object.account); | ||
// Types without an ABI will accept hex | ||
// const b2 = new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY, ByteBuffer.LITTLE_ENDIAN) | ||
// const buf = !Buffer.isBuffer(data) ? new Buffer(data, 'hex') : data | ||
// b2.writeVarint32(buf.length) | ||
// b2.append(buf) | ||
// result.data = b2.copy(0, b2.offset).toString('hex') | ||
result.data = Buffer.isBuffer(data) ? data.toString('hex') : data; | ||
@@ -757,3 +762,2 @@ return; | ||
result.data = b2.copy(0, b2.offset).toString('hex'); | ||
// console.log('result.data', result.data) | ||
@@ -760,0 +764,0 @@ return; |
@@ -607,7 +607,6 @@ 'use strict'; | ||
// resolve shorthand | ||
txObject = Transaction.fromObject(rawTx); | ||
// Resolve shorthand, queue requests | ||
Transaction.fromObject(rawTx); | ||
// After fromObject ensure any async actions are finished | ||
_context2.next = 9; | ||
@@ -617,2 +616,5 @@ return regeneratorRuntime.awrap(AssetCache.resolve()); | ||
case 9: | ||
// Create the object again with resolved data | ||
txObject = Transaction.fromObject(rawTx); | ||
buf = Fcbuffer.toBuffer(Transaction, txObject); | ||
@@ -694,3 +696,3 @@ tr = Transaction.toObject(txObject); | ||
case 15: | ||
case 16: | ||
case 'end': | ||
@@ -746,3 +748,3 @@ return _context2.stop(); | ||
var struct = void 0; | ||
if (account === 'eosio.token') { | ||
if (account === 'eosio' || account === 'eosio.token') { | ||
var _Structs = Structs(Object.assign({ defaults: true, network: Network }, config)), | ||
@@ -749,0 +751,0 @@ structs = _Structs.structs; |
{ | ||
"name": "eosjs", | ||
"version": "13.0.0", | ||
"version": "13.0.1", | ||
"description": "General purpose library for the EOS blockchain.", | ||
@@ -49,3 +49,3 @@ "main": "lib/index.js", | ||
"create-hash": "^1.1.3", | ||
"eosjs-api": "6.0.2", | ||
"eosjs-api": "6.1.0", | ||
"eosjs-ecc": "4.0.1", | ||
@@ -52,0 +52,0 @@ "fcbuffer": "2.2.0" |
@@ -56,2 +56,3 @@ [](https://travis-ci.org/EOSIO/eosjs) | ||
config = { | ||
chainId: null, // 32 byte (64 char) hex string | ||
keyProvider: ['PrivateKeys...'], // WIF string or array of keys.. | ||
@@ -96,2 +97,6 @@ httpEndpoint: 'http://127.0.0.1:8888', | ||
* **chainId** - Unique ID for the blockchain your connecting too. This is | ||
required for valid transaction signing. The chainId is provided via the | ||
[get_info](http://ayeaye.cypherglass.com:8888/v1/chain/get_info) API call. | ||
* **authorization** `{array<auth>|auth}` - identifies the | ||
@@ -210,7 +215,10 @@ signing account and permission typically in a multi-sig | ||
// Requires a large library, separate from the eosjs bundle | ||
// If your loading a wasm file, you do not need binaryen. If your loading | ||
// a "wast" file you can include and configure the binaryen compiler: | ||
// | ||
// $ npm install binaryen@37.0.0 | ||
binaryen = require('binaryen') | ||
// binaryen = require('binaryen') | ||
// eos = Eos.Localnet({keyProvider, binaryen}) | ||
eos = Eos.Localnet({keyProvider, binaryen}) | ||
eos = Eos.Localnet({keyProvider}) | ||
@@ -333,12 +341,13 @@ wasm = fs.readFileSync(`docker/contracts/eosio.token/eosio.token.wasm`) | ||
```javascript | ||
// 'nonce' is a struct but could be any type or struct like: uint8 or transaction | ||
nonce = {value: '..'} | ||
nonceBuffer = eos.fc.toBuffer('nonce', nonce) | ||
assert.deepEqual(nonce, eos.fc.fromBuffer('nonce', nonceBuffer)) | ||
// 'asset' is a type but could be any struct or type like: transaction or uint8 | ||
type = {type: 1, data: '00ff'} | ||
buffer = eos.fc.toBuffer('extensions_type', type) | ||
assert.deepEqual(type, eos.fc.fromBuffer('extensions_type', buffer)) | ||
// Serialization for a smart-contract's Abi: | ||
eos.contract('currency', (error, c) => currency = c) | ||
issue = {to: 'inita', quantity: '1.0000 CUR', memo: 'memo'} | ||
issueBuffer = currency.fc.toBuffer('issue', issue) | ||
assert.deepEqual(issue, currency.fc.fromBuffer('issue', issueBuffer)) | ||
create = {issuer: 'inita', maximum_supply: '1.0000 4,CUR'} | ||
buffer = currency.fc.toBuffer('create', create) | ||
create.maximum_supply = '1.0000 CUR' | ||
assert.deepEqual(create, currency.fc.fromBuffer('create', buffer)) | ||
``` | ||
@@ -345,0 +354,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1362354
28
35773
410
1
+ Addedeosjs-api@6.1.0(transitive)
- Removedeosjs-api@6.0.2(transitive)
Updatedeosjs-api@6.1.0