Socket
Socket
Sign inDemoInstall

@neo-one/node-core

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo-one/node-core - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

src/AccountInput.js

121

dist/es.js

@@ -1,2 +0,2 @@

import { BaseState, BinaryReader, common, createSerializeWire, utils } from '@neo-one/client-core';
import { BinaryReader, Input, IOHelper, common, createSerializeWire, utils, BaseState } from '@neo-one/client-core';

@@ -97,2 +97,94 @@ function _classCallCheck(instance, Constructor) {

var AccountInput =
/*#__PURE__*/
function () {
function AccountInput(_ref) {
var _this = this;
var hash = _ref.hash,
input = _ref.input;
_classCallCheck(this, AccountInput);
Object.defineProperty(this, "equals", {
configurable: true,
enumerable: true,
writable: true,
value: utils.equals(AccountInput, function (other) {
return common.uInt160Equal(_this.hash, other.hash) && _this.input.equals(other.input);
})
});
Object.defineProperty(this, "serializeWire", {
configurable: true,
enumerable: true,
writable: true,
value: createSerializeWire(this.serializeWireBase.bind(this))
});
this.hash = hash;
this.hashHex = common.uInt160ToHex(hash);
this.input = input;
this.__size = utils.lazy(function () {
return IOHelper.sizeOfUInt160 + _this.input.size;
});
}
_createClass(AccountInput, [{
key: "serializeWireBase",
value: function serializeWireBase(writer) {
writer.writeUInt160(this.hash);
this.input.serializeWireBase(writer);
}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{
key: "deserializeWireBase",
value: function deserializeWireBase(options) {
var reader = options.reader;
var hash = reader.readUInt256();
var input = Input.deserializeWireBase(options); // $FlowFixMe
return new this({
hash: hash,
input: input
});
}
}, {
key: "deserializeWire",
value: function deserializeWire(options) {
return this.deserializeWireBase({
context: options.context,
reader: new BinaryReader(options.buffer)
});
}
}]);
return AccountInput;
}();
var AccountUnclaimed =
/*#__PURE__*/
function (_AccountInput) {
_inherits(AccountUnclaimed, _AccountInput);
function AccountUnclaimed() {
_classCallCheck(this, AccountUnclaimed);
return _possibleConstructorReturn(this, (AccountUnclaimed.__proto__ || Object.getPrototypeOf(AccountUnclaimed)).apply(this, arguments));
}
return AccountUnclaimed;
}(AccountInput);
var AccountUnspent =
/*#__PURE__*/
function (_AccountInput) {
_inherits(AccountUnspent, _AccountInput);
function AccountUnspent() {
_classCallCheck(this, AccountUnspent);
return _possibleConstructorReturn(this, (AccountUnspent.__proto__ || Object.getPrototypeOf(AccountUnspent)).apply(this, arguments));
}
return AccountUnspent;
}(AccountInput);
var BlockSystemFee =

@@ -124,2 +216,5 @@ /*#__PURE__*/

this.systemFee = systemFee;
this.__size = utils.lazy(function () {
return IOHelper.sizeOfUInt256 + IOHelper.sizeOfFixed8;
});
}

@@ -133,2 +228,7 @@

}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{

@@ -184,2 +284,9 @@ key: "deserializeWireBase",

_this.claimed = claimed || {};
_this.__size = utils.lazy(function () {
return IOHelper.sizeOfUInt8 + IOHelper.sizeOfUInt256 + IOHelper.sizeOfUInt32LE + IOHelper.sizeOfObject(_this.endHeights, function () {
return IOHelper.sizeOfUInt32LE + IOHelper.sizeOfUInt32LE;
}) + IOHelper.sizeOfObject(_this.claimed, function () {
return IOHelper.sizeOfUInt32LE + IOHelper.sizeOfBoolean;
});
});
return _this;

@@ -216,2 +323,7 @@ }

}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{

@@ -261,2 +373,3 @@ key: "deserializeWireBase",

// type:host:port
var SEP = '$$';
var createEndpoint = function createEndpoint(_ref) {

@@ -266,6 +379,6 @@ var type = _ref.type,

port = _ref.port;
return "".concat(type, ":").concat(host, ":").concat(port);
return [type, host, port].join(SEP);
};
var getEndpointConfig = function getEndpointConfig(endpoint) {
var _endpoint$split = endpoint.split(':'),
var _endpoint$split = endpoint.split(SEP),
_endpoint$split2 = _slicedToArray(_endpoint$split, 3),

@@ -294,3 +407,3 @@ type = _endpoint$split2[0],

export { BlockSystemFee, TransactionSpentCoins, createEndpoint, getEndpointConfig, NULL_ACTION, TRIGGER_TYPE };
export { AccountUnclaimed, AccountUnspent, BlockSystemFee, TransactionSpentCoins, createEndpoint, getEndpointConfig, NULL_ACTION, TRIGGER_TYPE };
//# sourceMappingURL=es.js.map

@@ -101,2 +101,94 @@ 'use strict';

var AccountInput =
/*#__PURE__*/
function () {
function AccountInput(_ref) {
var _this = this;
var hash = _ref.hash,
input = _ref.input;
_classCallCheck(this, AccountInput);
Object.defineProperty(this, "equals", {
configurable: true,
enumerable: true,
writable: true,
value: clientCore.utils.equals(AccountInput, function (other) {
return clientCore.common.uInt160Equal(_this.hash, other.hash) && _this.input.equals(other.input);
})
});
Object.defineProperty(this, "serializeWire", {
configurable: true,
enumerable: true,
writable: true,
value: clientCore.createSerializeWire(this.serializeWireBase.bind(this))
});
this.hash = hash;
this.hashHex = clientCore.common.uInt160ToHex(hash);
this.input = input;
this.__size = clientCore.utils.lazy(function () {
return clientCore.IOHelper.sizeOfUInt160 + _this.input.size;
});
}
_createClass(AccountInput, [{
key: "serializeWireBase",
value: function serializeWireBase(writer) {
writer.writeUInt160(this.hash);
this.input.serializeWireBase(writer);
}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{
key: "deserializeWireBase",
value: function deserializeWireBase(options) {
var reader = options.reader;
var hash = reader.readUInt256();
var input = clientCore.Input.deserializeWireBase(options); // $FlowFixMe
return new this({
hash: hash,
input: input
});
}
}, {
key: "deserializeWire",
value: function deserializeWire(options) {
return this.deserializeWireBase({
context: options.context,
reader: new clientCore.BinaryReader(options.buffer)
});
}
}]);
return AccountInput;
}();
var AccountUnclaimed =
/*#__PURE__*/
function (_AccountInput) {
_inherits(AccountUnclaimed, _AccountInput);
function AccountUnclaimed() {
_classCallCheck(this, AccountUnclaimed);
return _possibleConstructorReturn(this, (AccountUnclaimed.__proto__ || Object.getPrototypeOf(AccountUnclaimed)).apply(this, arguments));
}
return AccountUnclaimed;
}(AccountInput);
var AccountUnspent =
/*#__PURE__*/
function (_AccountInput) {
_inherits(AccountUnspent, _AccountInput);
function AccountUnspent() {
_classCallCheck(this, AccountUnspent);
return _possibleConstructorReturn(this, (AccountUnspent.__proto__ || Object.getPrototypeOf(AccountUnspent)).apply(this, arguments));
}
return AccountUnspent;
}(AccountInput);
var BlockSystemFee =

@@ -128,2 +220,5 @@ /*#__PURE__*/

this.systemFee = systemFee;
this.__size = clientCore.utils.lazy(function () {
return clientCore.IOHelper.sizeOfUInt256 + clientCore.IOHelper.sizeOfFixed8;
});
}

@@ -137,2 +232,7 @@

}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{

@@ -188,2 +288,9 @@ key: "deserializeWireBase",

_this.claimed = claimed || {};
_this.__size = clientCore.utils.lazy(function () {
return clientCore.IOHelper.sizeOfUInt8 + clientCore.IOHelper.sizeOfUInt256 + clientCore.IOHelper.sizeOfUInt32LE + clientCore.IOHelper.sizeOfObject(_this.endHeights, function () {
return clientCore.IOHelper.sizeOfUInt32LE + clientCore.IOHelper.sizeOfUInt32LE;
}) + clientCore.IOHelper.sizeOfObject(_this.claimed, function () {
return clientCore.IOHelper.sizeOfUInt32LE + clientCore.IOHelper.sizeOfBoolean;
});
});
return _this;

@@ -220,2 +327,7 @@ }

}
}, {
key: "size",
get: function get() {
return this.__size();
}
}], [{

@@ -265,2 +377,3 @@ key: "deserializeWireBase",

// type:host:port
var SEP = '$$';
var createEndpoint = function createEndpoint(_ref) {

@@ -270,6 +383,6 @@ var type = _ref.type,

port = _ref.port;
return "".concat(type, ":").concat(host, ":").concat(port);
return [type, host, port].join(SEP);
};
var getEndpointConfig = function getEndpointConfig(endpoint) {
var _endpoint$split = endpoint.split(':'),
var _endpoint$split = endpoint.split(SEP),
_endpoint$split2 = _slicedToArray(_endpoint$split, 3),

@@ -298,2 +411,4 @@ type = _endpoint$split2[0],

exports.AccountUnclaimed = AccountUnclaimed;
exports.AccountUnspent = AccountUnspent;
exports.BlockSystemFee = BlockSystemFee;

@@ -300,0 +415,0 @@ exports.TransactionSpentCoins = TransactionSpentCoins;

6

package.json
{
"name": "@neo-one/node-core",
"version": "0.0.2",
"version": "0.1.0",
"keywords": [

@@ -37,4 +37,4 @@ "neo",

"dependencies": {
"@neo-one/client-core": "^0.0.2",
"@neo-one/utils": "^0.0.2",
"@neo-one/client-core": "^0.1.0",
"@neo-one/utils": "^0.1.0",
"bn.js": "^4.11.8",

@@ -41,0 +41,0 @@ "rxjs": "^5.5.6"

@@ -44,2 +44,10 @@ /* @flow */

import type AccountUnclaimed, {
AccountUnclaimedKey,
AccountUnclaimedsKey,
} from './AccountUnclaimed';
import type AccountUnspent, {
AccountUnspentKey,
AccountUnspentsKey,
} from './AccountUnspent';
import type BlockSystemFee, { BlockSystemFeeKey } from './BlockSystemFee';

@@ -112,4 +120,15 @@ import type TransactionSpentCoins, {

+block$: Observable<Block>,
+isPersistingBlock: boolean,
+account: ReadAllStorage<AccountKey, Account>,
+accountUnclaimed: ReadGetAllStorage<
AccountUnclaimedKey,
AccountUnclaimedsKey,
AccountUnclaimed,
>,
+accountUnspent: ReadGetAllStorage<
AccountUnspentKey,
AccountUnspentsKey,
AccountUnspent,
>,
+action: ReadGetAllStorage<ActionKey, ActionsKey, Action>,

@@ -165,2 +184,7 @@ +asset: ReadStorage<AssetKey, Asset>,

+account: ReadAllAddUpdateDeleteStorage<AccountKey, Account, AccountUpdate>,
+accountUnclaimed: ReadAddDeleteStorage<
AccountUnclaimedKey,
AccountUnclaimed,
>,
+accountUnspent: ReadAddDeleteStorage<AccountUnspentKey, AccountUnspent>,
+action: ReadGetAllAddStorage<ActionKey, ActionsKey, Action>,

@@ -167,0 +191,0 @@ +asset: ReadAddUpdateStorage<AssetKey, Asset, AssetUpdate>,

@@ -14,2 +14,3 @@ /* @flow */

BinaryReader,
IOHelper,
common,

@@ -34,2 +35,4 @@ createSerializeWire,

__size: () => number;
constructor({ hash, systemFee }: BlockSystemFeeAdd) {

@@ -39,4 +42,11 @@ this.hash = hash;

this.systemFee = systemFee;
this.__size = utils.lazy(
() => IOHelper.sizeOfUInt256 + IOHelper.sizeOfFixed8,
);
}
get size(): number {
return this.__size();
}
equals: Equals = utils.equals(BlockSystemFee, other =>

@@ -43,0 +53,0 @@ common.uInt256Equal(this.hash, other.hash),

/* @flow */
export { default as AccountUnclaimed } from './AccountUnclaimed';
export { default as AccountUnspent } from './AccountUnspent';
export { default as BlockSystemFee } from './BlockSystemFee';

@@ -9,2 +11,17 @@ export { default as TransactionSpentCoins } from './TransactionSpentCoins';

export type {
AccountInputAdd,
AccountInputKey,
AccountInputsKey,
} from './AccountInput';
export type {
AccountUnclaimedAdd,
AccountUnclaimedKey,
AccountUnclaimedsKey,
} from './AccountUnclaimed';
export type {
AccountUnspentAdd,
AccountUnspentKey,
AccountUnspentsKey,
} from './AccountUnspent';
export type {
Blockchain,

@@ -11,0 +28,0 @@ ReadStorage,

@@ -11,2 +11,3 @@ /* @flow */

const SEP = '$$';
export const createEndpoint = ({

@@ -16,7 +17,7 @@ type,

port,
}: EndpointConfig): Endpoint => `${type}:${host}:${port}`;
}: EndpointConfig): Endpoint => [type, host, port].join(SEP);
export const getEndpointConfig = (endpoint: Endpoint): EndpointConfig => {
const [type, host, port] = endpoint.split(':');
const [type, host, port] = endpoint.split(SEP);
return { type: (type: $FlowFixMe), host, port: parseInt(port, 10) };
};
/* @flow */
import type { Transaction, UInt256Hex } from '@neo-one/client-core';
import type { Endpoint } from './Network';
export interface Node {
relayTransaction(transaction: Transaction): Promise<void>;
+connectedPeersCount: number;
+connectedPeers: Array<Endpoint>;
+memPool: { [hash: UInt256Hex]: Transaction };
}

@@ -22,2 +22,4 @@ /* @flow */

import type AccountUnclaimed, { AccountUnclaimedKey } from './AccountUnclaimed';
import type AccountUnspent, { AccountUnspentKey } from './AccountUnspent';
import type BlockSystemFee from './BlockSystemFee';

@@ -34,2 +36,4 @@ import type { Blockchain, ReadStorage } from './Blockchain';

| {| type: 'account', value: Account |}
| {| type: 'accountUnclaimed', value: AccountUnclaimed |}
| {| type: 'accountUnspent', value: AccountUnspent |}
| {| type: 'action', value: Action |}

@@ -49,2 +53,4 @@ | {| type: 'asset', value: Asset |}

| {| type: 'account', key: AccountKey |}
| {| type: 'accountUnclaimed', key: AccountUnclaimedKey |}
| {| type: 'accountUnspent', key: AccountUnspentKey |}
| {| type: 'contract', key: ContractKey |}

@@ -63,2 +69,4 @@ | {| type: 'storageItem', key: StorageItemKey |};

account: $PropertyType<Blockchain, 'account'>,
accountUnclaimed: $PropertyType<Blockchain, 'accountUnclaimed'>,
accountUnspent: $PropertyType<Blockchain, 'accountUnspent'>,
action: $PropertyType<Blockchain, 'action'>,

@@ -65,0 +73,0 @@ asset: $PropertyType<Blockchain, 'asset'>,

@@ -11,3 +11,5 @@ /* @flow */

BinaryReader,
IOHelper,
createSerializeWire,
utils,
} from '@neo-one/client-core';

@@ -37,2 +39,4 @@

__size: () => number;
constructor({

@@ -50,4 +54,22 @@ version,

this.claimed = claimed || {};
this.__size = utils.lazy(
() =>
IOHelper.sizeOfUInt8 +
IOHelper.sizeOfUInt256 +
IOHelper.sizeOfUInt32LE +
IOHelper.sizeOfObject(
this.endHeights,
() => IOHelper.sizeOfUInt32LE + IOHelper.sizeOfUInt32LE,
) +
IOHelper.sizeOfObject(
this.claimed,
() => IOHelper.sizeOfUInt32LE + IOHelper.sizeOfBoolean,
),
);
}
get size(): number {
return this.__size();
}
update({

@@ -54,0 +76,0 @@ endHeights,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc