Comparing version 7.1.2 to 7.1.3
@@ -5,3 +5,9 @@ 'use strict'; | ||
require("babel-polyfill"); | ||
try { | ||
require("babel-polyfill"); | ||
} catch (e) { | ||
if (e.message.indexOf('only one instance of babel-polyfill is allowed') === -1) { | ||
console.error(e); | ||
} | ||
} | ||
@@ -35,3 +41,2 @@ var ecc = require('eosjs-ecc'); | ||
var configDefaults = { | ||
httpEndpoint: 'http://127.0.0.1:8888', | ||
broadcast: true, | ||
@@ -38,0 +43,0 @@ debug: false, |
@@ -100,2 +100,5 @@ 'use strict'; | ||
}, // must come after AssetSymbol | ||
extended_asset: function extended_asset() { | ||
return [ExtendedAsset]; | ||
}, // after Asset | ||
signature: function signature() { | ||
@@ -353,2 +356,47 @@ return [Signature]; | ||
var ExtendedAsset = function ExtendedAsset(validation, baseTypes, customTypes) { | ||
var assetType = customTypes.asset(validation); | ||
var contractName = customTypes.name(validation); | ||
function toString(value) { | ||
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'string', 'extended_asset is expecting a string like: 9.9999 SBL@contract'); | ||
var _value$split5 = value.split('@'), | ||
_value$split6 = _slicedToArray(_value$split5, 2), | ||
asset = _value$split6[0], | ||
_value$split6$ = _value$split6[1], | ||
contract = _value$split6$ === undefined ? 'eosio' : _value$split6$; | ||
return assetType.fromObject(asset) + '@' + contract; | ||
} | ||
return { | ||
fromByteBuffer: function fromByteBuffer(b) { | ||
var asset = assetType.fromByteBuffer(b); | ||
var contract = contractName.fromByteBuffer(b); | ||
return asset + '@' + contract; | ||
}, | ||
appendByteBuffer: function appendByteBuffer(b, value) { | ||
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'string', 'value'); | ||
var _value$split7 = value.split('@'), | ||
_value$split8 = _slicedToArray(_value$split7, 2), | ||
asset = _value$split8[0], | ||
contract = _value$split8[1]; | ||
assetType.appendByteBuffer(b, asset); | ||
contractName.appendByteBuffer(b, contract); | ||
}, | ||
fromObject: function fromObject(value) { | ||
return toString(value); | ||
}, | ||
toObject: function toObject(value) { | ||
if (validation.defaults && value == null) { | ||
return '0.0001 SYMBOL@contract'; | ||
} | ||
return toString(value); | ||
} | ||
}; | ||
}; | ||
var Signature = function Signature(validation, baseTypes, customTypes) { | ||
@@ -395,7 +443,7 @@ var signatureType = baseTypes.fixed_bytes65(validation); | ||
if (typeof value === 'string') { | ||
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$; | ||
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$; | ||
@@ -402,0 +450,0 @@ return { |
@@ -65,2 +65,10 @@ 'use strict'; | ||
it('extended_asset', function () { | ||
var eos = Eos.Localnet({ defaults: true }); | ||
var eaType = eos.fc.types.extended_asset(); | ||
var eaString = eaType.toObject(); | ||
assertSerializer(eaType, eaString); | ||
assert.equal(eaType.toObject('1 SBL'), '1.0000 SBL@eosio'); | ||
}); | ||
it('symbol', function () { | ||
@@ -67,0 +75,0 @@ var eos = Eos.Localnet(); |
@@ -536,3 +536,4 @@ 'use strict'; | ||
function transaction(arg, options, callback) { | ||
var optionDefault = { expireInSeconds: 60, broadcast: true, sign: true }; | ||
var defaultExpiration = config.expireInSeconds ? config.expireInSeconds : 60; | ||
var optionDefault = { expireInSeconds: defaultExpiration, broadcast: true, sign: true }; | ||
options = Object.assign({} /*clone*/, optionDefault, options); | ||
@@ -539,0 +540,0 @@ |
{ | ||
"name": "eosjs", | ||
"version": "7.1.2", | ||
"version": "7.1.3", | ||
"description": "General purpose library for the EOS blockchain.", | ||
@@ -52,3 +52,3 @@ "main": "lib/index.js", | ||
"eosjs-json": "^3.0.1", | ||
"fcbuffer": "^2.1.2" | ||
"fcbuffer": "^2.1.4" | ||
}, | ||
@@ -55,0 +55,0 @@ "babel": { |
[](https://travis-ci.org/EOSIO/eosjs) | ||
[](https://www.npmjs.org/package/eosjs) | ||
### The current release of eosjs is built for the last stable eos build Dawn 2.x | ||
You can find the current stable branch of eos here: https://github.com/EOSIO/eos/tree/dawn-2.x | ||
A Dawn 3.x pre-release version of eosjs is available: | ||
`npm i eosjs@dawn3` | ||
You can run the latest Dawn 3.x node from the default master branch at: http://github.com/eosio/eos | ||
| Version | [EOSIO/eosjs](/EOSIO/eosjs) | [Npm](https://www.npmjs.com/package/eosjs) | [EOSIO/eos](/EOSIO/eos) | [Docker](https://hub.docker.com/r/eosio/eos/) | Node | | ||
| --- | --- | --- | --- | --- | --- | | ||
| dawn3 | branch: master | `npm install eosjs@dawn3` | branch: master | eosio/eos:20180322 | [local docker](https://github.com/EOSIO/eosjs/tree/master/docker) | | ||
| dawn2 | branch: dawn2 | `npm install eosjs` | branch: dawn-2.x | eosio/eos:dawn2x | http or [https://t1readonly.eos.io](https://t1readonly.eos.io/v1/chain/get_info) | | ||
# Eosjs | ||
@@ -13,4 +26,4 @@ | ||
// API, note: to use a local testnet, use Eos.Localnet() | ||
let eos = Eos.Testnet() | ||
// eos = Eos.Localnet() // 127.0.0.1:8888 | ||
eos = Eos.Testnet() // testnet at eos.io | ||
@@ -17,0 +30,0 @@ // All API methods print help when called with no-arguments. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31
411
2248140
60502
Updatedfcbuffer@^2.1.4