zjubca-scatterjs-plugin-eosjs2
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -1,5 +0,5 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");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")),_scatterjsCore=require("scatterjs-core"),apiService=null;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;apiService=window.self==window.top?_scatterjsCore.SocketService:_scatterjsCore.IframeService;var 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,_scatterjsCore.Blockchains.EOS,_scatterjsCore.PluginTypes.BLOCKCHAIN_SUPPORT))}return(0,_inherits2.default)(b,a),(0,_createClass2.default)(b,[{key:"setApiService",value:function setApiService(a){apiService=a}},{key:"hookProvider",value:function hookProvider(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,c=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return a=_scatterjsCore.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,apiService.sendApiRequest({type:"identityFromPermissions",payload:{}}).then(function(a){return a?a.accounts.filter(function(a){return a.blockchain===_scatterjsCore.Blockchains.EOS}).map(function(a){return a.publicKey}):[]});case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop();}},a,this)}));return function getAvailableKeys(){return a.apply(this,arguments)}}(),sign:function(){var d=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function d(e){var f;return _regenerator.default.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return f=b?b():{},e.serializedTransaction=Buffer.from(e.serializedTransaction).toString("hex"),d.abrupt("return",new Promise(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function b(d,g){return _regenerator.default.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:apiService.sendApiRequest({type:"requestSignature",payload:{transaction:e,blockchain:_scatterjsCore.Blockchains.EOS,network:a,requiredFields:f}}).then(function(a){return c?void d({signatures:a.signatures,serializedTransaction:Buffer.from(e.serializedTransaction,"hex")}):d(a.signatures)}).catch(function(a){return g(a)});case 1:case"end":return b.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}()));case 3:case"end":return d.stop();}},d,this)}));return function sign(){return d.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=_scatterjsCore.Network.fromJson(b);var e={},f=function(){return e},g=a.hookProvider(b,f,d.beta3||!1);// The proxy stands between the eosjs object and scatter. | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");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")),_zjubcaScatterjsCore=require("zjubca-scatterjs-core"),apiService=null;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;apiService=window.self==window.top?_zjubcaScatterjsCore.SocketService:_zjubcaScatterjsCore.IframeService;var 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,_zjubcaScatterjsCore.Blockchains.EOS,_zjubcaScatterjsCore.PluginTypes.BLOCKCHAIN_SUPPORT))}return(0,_inherits2.default)(b,a),(0,_createClass2.default)(b,[{key:"setApiService",value:function setApiService(a){apiService=a}},{key:"hookProvider",value:function hookProvider(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,c=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return a=_zjubcaScatterjsCore.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,apiService.sendApiRequest({type:"identityFromPermissions",payload:{}}).then(function(a){return a?a.accounts.filter(function(a){return a.blockchain===_zjubcaScatterjsCore.Blockchains.EOS}).map(function(a){return a.publicKey}):[]});case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop();}},a,this)}));return function getAvailableKeys(){return a.apply(this,arguments)}}(),sign:function(){var d=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function d(e){var f;return _regenerator.default.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return f=b?b():{},e.serializedTransaction=Buffer.from(e.serializedTransaction).toString("hex"),d.abrupt("return",new Promise(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function b(d,g){return _regenerator.default.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:apiService.sendApiRequest({type:"requestSignature",payload:{transaction:e,blockchain:_zjubcaScatterjsCore.Blockchains.EOS,network:a,requiredFields:f}}).then(function(a){return c?void d({signatures:a.signatures,serializedTransaction:Buffer.from(e.serializedTransaction,"hex")}):d(a.signatures)}).catch(function(a){return g(a)});case 1:case"end":return b.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}()));case 3:case"end":return d.stop();}},d,this)}));return function sign(){return d.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=_zjubcaScatterjsCore.Network.fromJson(b);var e={},f=function(){return e},g=a.hookProvider(b,f,d.beta3||!1);// 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}(_scatterjsCore.Plugin);exports.default=ScatterEOS,"undefined"!=typeof window&&(window.ScatterEOS=ScatterEOS); | ||
}}}]),b}(_zjubcaScatterjsCore.Plugin);exports.default=ScatterEOS,"undefined"!=typeof window&&(window.ScatterEOS=ScatterEOS); |
{ | ||
"name": "zjubca-scatterjs-plugin-eosjs2", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"main": "dist/index.js", | ||
"license": "MIT", | ||
"gitHead": "bd0c2c7ebde7770f4291c2e0b31a954c4f4fcfe2" | ||
"gitHead": "2f28e7b89e081b933611825a0797f17dd6173d2a" | ||
} |
@@ -8,3 +8,3 @@ import { | ||
IframeService | ||
} from 'scatterjs-core'; | ||
} from 'zjubca-scatterjs-core'; | ||
@@ -18,3 +18,4 @@ let apiService = null; | ||
apiService = IframeService; | ||
}const proxy = (dummy, handler) => new Proxy(dummy, handler); | ||
} | ||
const proxy = (dummy, handler) => new Proxy(dummy, handler); | ||
let cache = {}; | ||
@@ -21,0 +22,0 @@ |
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
8611
103