Socket
Socket
Sign inDemoInstall

@json-rpc-tools/utils

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@json-rpc-tools/utils - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

dist/umd/index.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("JsonRpcUtils",[],t):"object"==typeof exports?exports.JsonRpcUtils=t():e.JsonRpcUtils=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return o})),r.d(t,"__assign",(function(){return u})),r.d(t,"__rest",(function(){return i})),r.d(t,"__decorate",(function(){return c})),r.d(t,"__param",(function(){return s})),r.d(t,"__metadata",(function(){return a})),r.d(t,"__awaiter",(function(){return f})),r.d(t,"__generator",(function(){return l})),r.d(t,"__createBinding",(function(){return R})),r.d(t,"__exportStar",(function(){return d})),r.d(t,"__values",(function(){return _})),r.d(t,"__read",(function(){return p})),r.d(t,"__spread",(function(){return E})),r.d(t,"__spreadArrays",(function(){return y})),r.d(t,"__await",(function(){return v})),r.d(t,"__asyncGenerator",(function(){return O})),r.d(t,"__asyncDelegator",(function(){return b})),r.d(t,"__asyncValues",(function(){return S})),r.d(t,"__makeTemplateObject",(function(){return h})),r.d(t,"__importStar",(function(){return m})),r.d(t,"__importDefault",(function(){return P})),r.d(t,"__classPrivateFieldGet",(function(){return A})),r.d(t,"__classPrivateFieldSet",(function(){return g}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("JsonRpcUtils",[],t):"object"==typeof exports?exports.JsonRpcUtils=t():e.JsonRpcUtils=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return o})),r.d(t,"__assign",(function(){return u})),r.d(t,"__rest",(function(){return i})),r.d(t,"__decorate",(function(){return c})),r.d(t,"__param",(function(){return s})),r.d(t,"__metadata",(function(){return a})),r.d(t,"__awaiter",(function(){return f})),r.d(t,"__generator",(function(){return l})),r.d(t,"__createBinding",(function(){return R})),r.d(t,"__exportStar",(function(){return d})),r.d(t,"__values",(function(){return _})),r.d(t,"__read",(function(){return p})),r.d(t,"__spread",(function(){return E})),r.d(t,"__spreadArrays",(function(){return y})),r.d(t,"__await",(function(){return v})),r.d(t,"__asyncGenerator",(function(){return O})),r.d(t,"__asyncDelegator",(function(){return b})),r.d(t,"__asyncValues",(function(){return h})),r.d(t,"__makeTemplateObject",(function(){return S})),r.d(t,"__importStar",(function(){return m})),r.d(t,"__importDefault",(function(){return A})),r.d(t,"__classPrivateFieldGet",(function(){return P})),r.d(t,"__classPrivateFieldSet",(function(){return g}));
/*! *****************************************************************************

@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation.

***************************************************************************** */
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function i(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,u=arguments.length,i=u<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(u<3?o(i):u>3?o(t,r,i):o(t,r))||i);return u>3&&i&&Object.defineProperty(t,r,i),i}function s(e,t){return function(r,n){t(r,n,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,r,n){return new(r||(r=Promise))((function(o,u){function i(e){try{s(n.next(e))}catch(e){u(e)}}function c(e){try{s(n.throw(e))}catch(e){u(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}s((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function R(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function d(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function _(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,u=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}return i}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}function y(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var u=arguments[t],i=0,c=u.length;i<c;i++,o++)n[o]=u[i];return n}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function O(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),u=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){u.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof v?Promise.resolve(r.value.v).then(s,a):f(u[0][2],r)}catch(e){f(u[0][3],e)}var r}function s(e){c("next",e)}function a(e){c("throw",e)}function f(e,t){e(t),u.shift(),u.length&&c(u[0][0],u[0][1])}}function b(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:v(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=_(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function h(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function P(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function g(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.STANDARD_ERROR_MAP=t.SERVER_ERROR_CODE_RANGE=t.RESERVED_ERROR_CODES=t.SERVER_ERROR=t.INTERNAL_ERROR=t.INVALID_PARAMS=t.METHOD_NOT_FOUND=t.INVALID_REQUEST=t.PARSE_ERROR=void 0,t.PARSE_ERROR="PARSE_ERROR",t.INVALID_REQUEST="INVALID_REQUEST",t.METHOD_NOT_FOUND="METHOD_NOT_FOUND",t.INVALID_PARAMS="INVALID_PARAMS",t.INTERNAL_ERROR="INTERNAL_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],t.SERVER_ERROR_CODE_RANGE=[-32e3,-32099],t.STANDARD_ERROR_MAP={[t.PARSE_ERROR]:{code:-32700,message:"Parse error"},[t.INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[t.METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[t.INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[t.INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[t.SERVER_ERROR]:{code:-32e3,message:"Server error"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IEvents=void 0;t.IEvents=class{}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorByCode=t.getError=t.isValidErrorCode=t.isReservedErrorCode=t.isServerErrorCode=void 0;const n=r(1);function o(e){return e<=n.SERVER_ERROR_CODE_RANGE[0]&&e>=n.SERVER_ERROR_CODE_RANGE[1]}function u(e){return n.RESERVED_ERROR_CODES.includes(e)}t.isServerErrorCode=o,t.isReservedErrorCode=u,t.isValidErrorCode=function(e){return o(e)||u(e)},t.getError=function(e){return Object.keys(n.STANDARD_ERROR_MAP).includes(e)?n.STANDARD_ERROR_MAP[e]:n.STANDARD_ERROR_MAP[n.INTERNAL_ERROR]},t.getErrorByCode=function(e){const t=Object.values(n.STANDARD_ERROR_MAP).find(t=>t.code===e);return t||n.STANDARD_ERROR_MAP[n.INTERNAL_ERROR]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IJsonRpcProvider=void 0;const n=r(2);class o extends n.IEvents{}t.IJsonRpcProvider=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);n.__exportStar(r(1),t),n.__exportStar(r(3),t),n.__exportStar(r(6),t),n.__exportStar(r(12),t),n.__exportStar(r(13),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(0).__exportStar(r(7),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);n.__exportStar(r(8),t),n.__exportStar(r(9),t),n.__exportStar(r(2),t),n.__exportStar(r(4),t),n.__exportStar(r(10),t),n.__exportStar(r(11),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IJsonRpcAuthenticator=t.IPendingRequests=void 0;const n=r(2);t.IPendingRequests=class{constructor(e){this.store=e}};class o extends n.IEvents{constructor(e,t,r){super(),this.config=e,this.signer=t}}t.IJsonRpcAuthenticator=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IJsonRpcSigner=void 0;const n=r(4);class o extends n.IJsonRpcProvider{}t.IJsonRpcSigner=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatErrorMessage=t.formatJsonRpcError=t.formatJsonRpcResult=t.formatJsonRpcRequest=t.payloadId=void 0;const n=r(3),o=r(1);function u(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function i(e){if(void 0===e)return n.getError(o.INTERNAL_ERROR);if("string"==typeof e&&(e=Object.assign(Object.assign({},n.getError(o.SERVER_ERROR)),{message:e})),n.isReservedErrorCode(e.code)&&(e=n.getErrorByCode(e.code)),!n.isServerErrorCode(e.code))throw new Error("Error code is not in server code range");return e}t.payloadId=u,t.formatJsonRpcRequest=function(e,t,r){return{id:r||u(),jsonrpc:"2.0",method:e,params:t}},t.formatJsonRpcResult=function(e,t){return{id:e,jsonrpc:"2.0",result:t}},t.formatJsonRpcError=function(e,t){return{id:e,jsonrpc:"2.0",error:i(t)}},t.formatErrorMessage=i},function(e,t,r){"use strict";function n(e){return"method"in e}Object.defineProperty(t,"__esModule",{value:!0}),t.isJsonRpcError=t.isJsonRpcResult=t.isJsonRpcResponse=t.isJsonRpcRequest=void 0,t.isJsonRpcRequest=n,t.isJsonRpcResponse=function(e){return!n(e)},t.isJsonRpcResult=function(e){return"result"in e},t.isJsonRpcError=function(e){return"error"in e}}])}));
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function i(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,u=arguments.length,i=u<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(u<3?o(i):u>3?o(t,r,i):o(t,r))||i);return u>3&&i&&Object.defineProperty(t,r,i),i}function s(e,t){return function(r,n){t(r,n,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,r,n){return new(r||(r=Promise))((function(o,u){function i(e){try{s(n.next(e))}catch(e){u(e)}}function c(e){try{s(n.throw(e))}catch(e){u(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}s((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function R(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function d(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function _(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,u=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}return i}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}function y(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var u=arguments[t],i=0,c=u.length;i<c;i++,o++)n[o]=u[i];return n}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function O(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),u=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){u.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof v?Promise.resolve(r.value.v).then(s,a):f(u[0][2],r)}catch(e){f(u[0][3],e)}var r}function s(e){c("next",e)}function a(e){c("throw",e)}function f(e,t){e(t),u.shift(),u.length&&c(u[0][0],u[0][1])}}function b(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:v(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=_(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}function P(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function g(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.STANDARD_ERROR_MAP=t.SERVER_ERROR_CODE_RANGE=t.RESERVED_ERROR_CODES=t.SERVER_ERROR=t.INTERNAL_ERROR=t.INVALID_PARAMS=t.METHOD_NOT_FOUND=t.INVALID_REQUEST=t.PARSE_ERROR=void 0,t.PARSE_ERROR="PARSE_ERROR",t.INVALID_REQUEST="INVALID_REQUEST",t.METHOD_NOT_FOUND="METHOD_NOT_FOUND",t.INVALID_PARAMS="INVALID_PARAMS",t.INTERNAL_ERROR="INTERNAL_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],t.SERVER_ERROR_CODE_RANGE=[-32e3,-32099],t.STANDARD_ERROR_MAP={[t.PARSE_ERROR]:{code:-32700,message:"Parse error"},[t.INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[t.METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[t.INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[t.INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[t.SERVER_ERROR]:{code:-32e3,message:"Server error"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IEvents=void 0;t.IEvents=class{}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorByCode=t.getError=t.isValidErrorCode=t.isReservedErrorCode=t.isServerErrorCode=void 0;const n=r(1);function o(e){return e<=n.SERVER_ERROR_CODE_RANGE[0]&&e>=n.SERVER_ERROR_CODE_RANGE[1]}function u(e){return n.RESERVED_ERROR_CODES.includes(e)}t.isServerErrorCode=o,t.isReservedErrorCode=u,t.isValidErrorCode=function(e){return o(e)||u(e)},t.getError=function(e){return Object.keys(n.STANDARD_ERROR_MAP).includes(e)?n.STANDARD_ERROR_MAP[e]:n.STANDARD_ERROR_MAP[n.INTERNAL_ERROR]},t.getErrorByCode=function(e){const t=Object.values(n.STANDARD_ERROR_MAP).find(t=>t.code===e);return t||n.STANDARD_ERROR_MAP[n.INTERNAL_ERROR]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);n.__exportStar(r(1),t),n.__exportStar(r(3),t),n.__exportStar(r(5),t),n.__exportStar(r(11),t),n.__exportStar(r(12),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(0).__exportStar(r(6),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);n.__exportStar(r(7),t),n.__exportStar(r(8),t),n.__exportStar(r(2),t),n.__exportStar(r(9),t),n.__exportStar(r(10),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IJsonRpcAuthenticator=t.IPendingRequests=void 0;const n=r(2);t.IPendingRequests=class{constructor(e,t){this.context=e,this.store=t}};class o extends n.IEvents{constructor(e,t,r){super(),this.config=e,this.provider=t}}t.IJsonRpcAuthenticator=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IJsonRpcProvider=t.IJsonRpcConnection=void 0;const n=r(2);class o extends n.IEvents{constructor(e){super(),this.url=e}}t.IJsonRpcConnection=o;class u extends n.IEvents{constructor(e){super(),this.url=e}}t.IJsonRpcProvider=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatErrorMessage=t.formatJsonRpcError=t.formatJsonRpcResult=t.formatJsonRpcRequest=t.payloadId=void 0;const n=r(3),o=r(1);function u(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function i(e){if(void 0===e)return n.getError(o.INTERNAL_ERROR);if("string"==typeof e&&(e=Object.assign(Object.assign({},n.getError(o.SERVER_ERROR)),{message:e})),n.isReservedErrorCode(e.code)&&(e=n.getErrorByCode(e.code)),!n.isServerErrorCode(e.code))throw new Error("Error code is not in server code range");return e}t.payloadId=u,t.formatJsonRpcRequest=function(e,t,r){return{id:r||u(),jsonrpc:"2.0",method:e,params:t}},t.formatJsonRpcResult=function(e,t){return{id:e,jsonrpc:"2.0",result:t}},t.formatJsonRpcError=function(e,t){return{id:e,jsonrpc:"2.0",error:i(t)}},t.formatErrorMessage=i},function(e,t,r){"use strict";function n(e){return"method"in e}Object.defineProperty(t,"__esModule",{value:!0}),t.isJsonRpcError=t.isJsonRpcResult=t.isJsonRpcResponse=t.isJsonRpcRequest=void 0,t.isJsonRpcRequest=n,t.isJsonRpcResponse=function(e){return!n(e)},t.isJsonRpcResult=function(e){return"result"in e},t.isJsonRpcError=function(e){return"error"in e}}])}));
{
"name": "@json-rpc-tools/utils",
"description": "Utilities for JSON-RPC",
"version": "1.0.0",
"version": "1.1.0",
"author": "Pedro Gomes <github.com/pedrouid>",

@@ -37,3 +37,3 @@ "homepage": "https://github.com/pedrouid/json-rpc-tools/",

"dependencies": {
"@json-rpc-tools/types": "^1.0.0"
"@json-rpc-tools/types": "^1.1.0"
},

@@ -47,6 +47,6 @@ "devDependencies": {

"@babel/preset-typescript": "^7.12.1",
"@types/lodash.isequal": "^4.5.5",
"@babel/register": "^7.12.1",
"@types/chai": "^4.2.14",
"@types/jest": "^22.2.3",
"@types/lodash.isequal": "^4.5.5",
"@types/mocha": "^8.0.4",

@@ -53,0 +53,0 @@ "@types/node": "^14.14.2",

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