Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scatterjs/eosjs2

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scatterjs/eosjs2 - npm Package Compare versions

Comparing version 1.5.25 to 1.5.26

92

dist/index.js

@@ -1,87 +0,5 @@

import { Plugin, PluginTypes, Blockchains, Network, SocketService } from '@scatterjs/core';
let socketService = SocketService;
const proxy = (dummy, handler) => new Proxy(dummy, handler);
let cache = {};
export default class ScatterEOS extends Plugin {
constructor() {
super(Blockchains.EOS, PluginTypes.BLOCKCHAIN_SUPPORT);
}
setSocketService(_s) {
socketService = _s;
}
hookProvider(network, fieldsFetcher = null) {
network = Network.fromJson(network);
return {
requiredFields: {},
getAvailableKeys: async () => {
return await socketService.sendApiRequest({
type: 'identityFromPermissions',
payload: {}
}).then(id => {
if (!id) return [];
return id.accounts.filter(x => x.blockchain === Blockchains.EOS).map(x => x.publicKey);
});
},
sign: async signargs => {
const requiredFields = fieldsFetcher ? fieldsFetcher() : {};
signargs.serializedTransaction = Buffer.from(signargs.serializedTransaction).toString('hex');
return new Promise(async (resolve, reject) => {
socketService.sendApiRequest({
type: 'requestSignature',
payload: {
transaction: signargs,
blockchain: Blockchains.EOS,
network,
requiredFields
}
}).then(x => {
resolve({
signatures: x.signatures,
serializedTransaction: Buffer.from(signargs.serializedTransaction, 'hex')
});
}).catch(x => reject(x));
});
}
};
}
signatureProvider(...args) {
const throwIfNoIdentity = args[0]; // Protocol will be deprecated.
return (network, _api, _options = {}) => {
network = Network.fromJson(network);
let requiredFields = {};
const fieldsFetcher = () => requiredFields;
const signatureProvider = this.hookProvider(network, fieldsFetcher); // The proxy stands between the eosjs object and scatter.
// This is used to add special functionality like adding `requiredFields` arrays to transactions
return proxy(new _api(Object.assign(_options, {
signatureProvider
})), {
get(eosInstance, method) {
return (...args) => {
if (typeof eosInstance[method] === 'undefined') {
throw new Error(`${method} does not exist on the eosjs.Api() object.`);
}
const rqf = args.find(arg => arg.hasOwnProperty('requiredFields'));
requiredFields = rqf ? rqf.requiredFields : {};
return eosInstance[method](...args);
};
}
}); // Proxy
};
}
}
if (typeof window !== 'undefined') {
window.ScatterEOS = ScatterEOS;
}
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_core=require("@scatterjs/core"),socketService=_core.SocketService,proxy=function(a,b){return new Proxy(a,b)},cache={},ScatterEOS=/*#__PURE__*/function(a){function b(){return(0,_classCallCheck2["default"])(this,b),(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(b).call(this,_core.Blockchains.EOS,_core.PluginTypes.BLOCKCHAIN_SUPPORT))}return(0,_inherits2["default"])(b,a),(0,_createClass2["default"])(b,[{key:"setSocketService",value:function setSocketService(a){socketService=a}},{key:"hookProvider",value:function hookProvider(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return a=_core.Network.fromJson(a),{requiredFields:{},getAvailableKeys:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,socketService.sendApiRequest({type:"identityFromPermissions",payload:{}}).then(function(a){return a?a.accounts.filter(function(a){return a.blockchain===_core.Blockchains.EOS}).map(function(a){return a.publicKey}):[]});case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop();}},a)}));return function getAvailableKeys(){return a.apply(this,arguments)}}(),sign:function(){var c=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function c(d){var e;return _regenerator["default"].wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return e=b?b():{},d.serializedTransaction=Buffer.from(d.serializedTransaction).toString("hex"),c.abrupt("return",new Promise(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(c,f){return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:socketService.sendApiRequest({type:"requestSignature",payload:{transaction:d,blockchain:_core.Blockchains.EOS,network:a,requiredFields:e}}).then(function(a){c({signatures:a.signatures,serializedTransaction:Buffer.from(d.serializedTransaction,"hex")})})["catch"](function(a){return f(a)});case 1:case"end":return b.stop();}},b)}));return function(){return b.apply(this,arguments)}}()));case 3:case"end":return c.stop();}},c)}));return function sign(){return c.apply(this,arguments)}}()}}},{key:"signatureProvider",value:function signatureProvider(){var a=this,b=0>=arguments.length?void 0:arguments[0];// Protocol will be deprecated.
return function(b,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};b=_core.Network.fromJson(b);var e={},f=function(){return e},g=a.hookProvider(b,f);// The proxy stands between the eosjs object and scatter.
// This is used to add special functionality like adding `requiredFields` arrays to transactions
return proxy(new c(Object.assign(d,{signatureProvider:g})),{get:function get(a,b){return function(){if("undefined"==typeof a[b])throw new Error("".concat(b," does not exist on the eosjs.Api() object."));for(var c=arguments.length,d=Array(c),f=0;f<c;f++)d[f]=arguments[f];var g=d.find(function(a){return a.hasOwnProperty("requiredFields")});return e=g?g.requiredFields:{},a[b].apply(a,d)}}});// Proxy
}}}]),b}(_core.Plugin);exports["default"]=ScatterEOS,"undefined"!=typeof window&&(window.ScatterEOS=ScatterEOS);

6

package.json
{
"name": "@scatterjs/eosjs2",
"version": "1.5.25",
"version": "1.5.26",
"main": "dist/index.js",
"license": "MIT",
"gitHead": "d63655da24c3ba2fb25a3ec01c6bc19c63e32292",
"gitHead": "27be873d8c1f1743689633ae9bba13b4a23b1157",
"publishConfig": {

@@ -14,4 +14,4 @@ "access": "public"

"dependencies": {
"@scatterjs/core": "^2.7.43"
"@scatterjs/core": "^2.7.44"
}
}
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