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

@jadbox/iframe-provider

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jadbox/iframe-provider - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

2

dist/iframe-provider.cjs.development.js

@@ -300,3 +300,3 @@ 'use strict';

var id = isNaN(optionalId) ? getUniqueId() : optionalId;
var id = optionalId !== null && optionalId !== undefined ? optionalId : getUniqueId();

@@ -303,0 +303,0 @@ var payload = _extends({

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

"use strict";var e=require("eventemitter3");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t,r){return(i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return i(e,arguments,n(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)})(e)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var a="*",u=6e4,s="2.0",l=function(e){function t(t,r){var n;return(n=e.call(this,t+": "+r)||this).isRpcError=!0,n.code=t,n.reason=r,n}return r(t,e),t}(c(Error));exports.IFrameEthereumProvider=function(e){function n(t){var r,n=void 0===t?{}:t,o=n.targetOrigin,i=void 0===o?a:o,c=n.timeoutMilliseconds,l=void 0===c?u:c,f=n.eventSource,m=void 0===f?window:f,d=n.eventTarget,h=void 0===d?window.parent:d;return(r=e.call(this)||this).enabled=null,r.completers={},r.handleEventSourceMessage=function(e){var t=e.data;if(t){var n=t;if(n.jsonrpc===s){if(null!=n.id){var o=r.completers[""+n.id];o&&("error"in n||"result"in n?o.resolve(n):o.reject(new Error("Response from provider did not have error or result key")),delete r.completers[n.id])}if("method"in n)switch(n.method){case"notification":r.emitNotification(n.params);break;case"connect":r.emitConnect();break;case"close":r.emitClose(n.params[0],n.params[1]);break;case"chainChanged":r.emitChainChanged(n.params[0]);break;case"networkChanged":r.emitNetworkChanged(n.params[0]);break;case"accountsChanged":r.emitAccountsChanged(n.params[0])}}}},r.targetOrigin=i,r.timeoutMilliseconds=l,r.eventSource=m,r.eventTarget=h,r.eventSource.addEventListener("message",r.handleEventSourceMessage),r}r(n,e);var o,i=n.prototype;return i.execute=function(e,r,n){try{var o=this,i=isNaN(n)?Math.floor(Math.random()*Number.MAX_SAFE_INTEGER):n,c=t({jsonrpc:s,id:i,method:e},void 0===r?null:{params:r}),a=new Promise(function(e,t){return o.completers[i]={resolve:e,reject:t}});return o.eventTarget.postMessage(c,o.targetOrigin),setTimeout(function(){o.completers[i]&&(o.completers[i].reject(new Error('RPC ID "'+i+'" timed out after '+o.timeoutMilliseconds+" milliseconds")),delete o.completers[i])},o.timeoutMilliseconds),Promise.resolve(a)}catch(e){return Promise.reject(e)}},i.request=function(e,t){try{return Promise.resolve(this.execute(e,t)).then(function(e){if("error"in e)throw new l(e.error.code,e.error.message);return e.result})}catch(e){return Promise.reject(e)}},i.send=function(e,t){try{return Promise.resolve(this.execute(e,t)).then(function(e){if("error"in e)throw new l(e.error.code,e.error.message);return e.result})}catch(e){return Promise.reject(e)}},i.enable=function(){try{var e=this;if(null===e.enabled)var t=e.enabled=e.send("enable").catch(function(r){throw e.enabled===t&&(e.enabled=null),r});return Promise.resolve(e.enabled)}catch(e){return Promise.reject(e)}},i.sendAsync=function(e,t){try{var r=this,n=function(n,o){try{var i=Promise.resolve(r.execute(e.method,e.params,e.id)).then(function(e){t(null,e)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){t(e,null)});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},i.emitNotification=function(e){this.emit("notification",e)},i.emitConnect=function(){null===this.enabled&&(this.enabled=Promise.resolve([])),this.emit("connect")},i.emitClose=function(e,t){this.emit("close",e,t)},i.emitChainChanged=function(e){this.emit("chainChanged",e)},i.emitNetworkChanged=function(e){this.emit("networkChanged",e)},i.emitAccountsChanged=function(e){this.enabled=Promise.resolve(e),this.emit("accountsChanged",e)},(o=[{key:"isIFrame",get:function(){return!0}},{key:"currentProvider",get:function(){return this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,o),n}(e.EventEmitter),exports.RpcError=l;
"use strict";var e=require("eventemitter3");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t,r){return(i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return i(e,arguments,n(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)})(e)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var a="*",u=6e4,s="2.0",l=function(e){function t(t,r){var n;return(n=e.call(this,t+": "+r)||this).isRpcError=!0,n.code=t,n.reason=r,n}return r(t,e),t}(c(Error));exports.IFrameEthereumProvider=function(e){function n(t){var r,n=void 0===t?{}:t,o=n.targetOrigin,i=void 0===o?a:o,c=n.timeoutMilliseconds,l=void 0===c?u:c,f=n.eventSource,m=void 0===f?window:f,d=n.eventTarget,h=void 0===d?window.parent:d;return(r=e.call(this)||this).enabled=null,r.completers={},r.handleEventSourceMessage=function(e){var t=e.data;if(t){var n=t;if(n.jsonrpc===s){if(null!=n.id){var o=r.completers[""+n.id];o&&("error"in n||"result"in n?o.resolve(n):o.reject(new Error("Response from provider did not have error or result key")),delete r.completers[n.id])}if("method"in n)switch(n.method){case"notification":r.emitNotification(n.params);break;case"connect":r.emitConnect();break;case"close":r.emitClose(n.params[0],n.params[1]);break;case"chainChanged":r.emitChainChanged(n.params[0]);break;case"networkChanged":r.emitNetworkChanged(n.params[0]);break;case"accountsChanged":r.emitAccountsChanged(n.params[0])}}}},r.targetOrigin=i,r.timeoutMilliseconds=l,r.eventSource=m,r.eventTarget=h,r.eventSource.addEventListener("message",r.handleEventSourceMessage),r}r(n,e);var o,i=n.prototype;return i.execute=function(e,r,n){try{var o=this,i=null!=n?n:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),c=t({jsonrpc:s,id:i,method:e},void 0===r?null:{params:r}),a=new Promise(function(e,t){return o.completers[i]={resolve:e,reject:t}});return o.eventTarget.postMessage(c,o.targetOrigin),setTimeout(function(){o.completers[i]&&(o.completers[i].reject(new Error('RPC ID "'+i+'" timed out after '+o.timeoutMilliseconds+" milliseconds")),delete o.completers[i])},o.timeoutMilliseconds),Promise.resolve(a)}catch(e){return Promise.reject(e)}},i.request=function(e,t){try{return Promise.resolve(this.execute(e,t)).then(function(e){if("error"in e)throw new l(e.error.code,e.error.message);return e.result})}catch(e){return Promise.reject(e)}},i.send=function(e,t){try{return Promise.resolve(this.execute(e,t)).then(function(e){if("error"in e)throw new l(e.error.code,e.error.message);return e.result})}catch(e){return Promise.reject(e)}},i.enable=function(){try{var e=this;if(null===e.enabled)var t=e.enabled=e.send("enable").catch(function(r){throw e.enabled===t&&(e.enabled=null),r});return Promise.resolve(e.enabled)}catch(e){return Promise.reject(e)}},i.sendAsync=function(e,t){try{var r=this,n=function(n,o){try{var i=Promise.resolve(r.execute(e.method,e.params,e.id)).then(function(e){t(null,e)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){t(e,null)});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},i.emitNotification=function(e){this.emit("notification",e)},i.emitConnect=function(){null===this.enabled&&(this.enabled=Promise.resolve([])),this.emit("connect")},i.emitClose=function(e,t){this.emit("close",e,t)},i.emitChainChanged=function(e){this.emit("chainChanged",e)},i.emitNetworkChanged=function(e){this.emit("networkChanged",e)},i.emitAccountsChanged=function(e){this.enabled=Promise.resolve(e),this.emit("accountsChanged",e)},(o=[{key:"isIFrame",get:function(){return!0}},{key:"currentProvider",get:function(){return this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,o),n}(e.EventEmitter),exports.RpcError=l;
//# sourceMappingURL=iframe-provider.cjs.production.min.js.map

@@ -298,3 +298,3 @@ import { EventEmitter } from 'eventemitter3';

var id = isNaN(optionalId) ? getUniqueId() : optionalId;
var id = optionalId !== null && optionalId !== undefined ? optionalId : getUniqueId();

@@ -301,0 +301,0 @@ var payload = _extends({

{
"name": "@jadbox/iframe-provider",
"version": "0.1.13",
"version": "0.1.14",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/ethereumprovider.esm.js",

Sorry, the diff of this file is not supported yet

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