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.17 to 0.1.18

106

dist/iframe-provider.cjs.development.js

@@ -129,2 +129,10 @@ 'use strict';

function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
// A type of promise-like that resolves synchronously and supports only one observer

@@ -171,9 +179,9 @@

function RpcError(code, reason) {
var _this6;
var _this7;
_this6 = _Error.call(this, code + ": " + reason) || this;
_this6.isRpcError = true;
_this6.code = code;
_this6.reason = reason;
return _this6;
_this7 = _Error.call(this, code + ": " + reason) || this;
_this7.isRpcError = true;
_this7.code = code;
_this7.reason = reason;
return _this7;
}

@@ -183,2 +191,3 @@

}( /*#__PURE__*/_wrapNativeSuper(Error));
var _instance = null;
/**

@@ -192,3 +201,3 @@ * This is the primary artifact of this library.

function IFrameEthereumProvider(_temp2) {
var _this7;
var _this8;

@@ -206,5 +215,5 @@ var _ref = _temp2 === void 0 ? {} : _temp2,

// Call super for `this` to be defined
_this7 = _EventEmitter.call(this) || this;
_this7.enabled = null;
_this7.completers = {};
_this8 = _EventEmitter.call(this) || this;
_this8.enabled = null;
_this8.completers = {};
/**

@@ -215,3 +224,3 @@ * Handle a message on the event source.

_this7.handleEventSourceMessage = function (event) {
_this8.handleEventSourceMessage = function (event) {
var data = event.data; // No data to parse, skip.

@@ -231,3 +240,3 @@

if (typeof message.id !== 'undefined' && message.id !== null) {
var completer = _this7.completers['' + message.id]; // True if we haven't timed out and this is a response to a message we sent.
var completer = _this8.completers['' + message.id]; // True if we haven't timed out and this is a response to a message we sent.

@@ -242,3 +251,3 @@ if (completer) {

delete _this7.completers[message.id];
delete _this8.completers[message.id];
}

@@ -251,3 +260,3 @@ } // If the method is a request from the parent window, it is likely a subscription.

case 'eth_subscription':
_this7.emitEthSubNotification(message.params);
_this8.emitEthSubNotification(message.params);

@@ -257,3 +266,3 @@ break;

case 'notification':
_this7.emitNotification(message.params);
_this8.emitNotification(message.params);

@@ -263,3 +272,3 @@ break;

case 'connect':
_this7.emitConnect();
_this8.emitConnect();

@@ -269,3 +278,3 @@ break;

case 'close':
_this7.emitClose(message.params[0], message.params[1]);
_this8.emitClose(message.params[0], message.params[1]);

@@ -275,3 +284,3 @@ break;

case 'chainChanged':
_this7.emitChainChanged(message.params[0]);
_this8.emitChainChanged(message.params[0]);

@@ -281,3 +290,3 @@ break;

case 'networkChanged':
_this7.emitNetworkChanged(message.params[0]);
_this8.emitNetworkChanged(message.params[0]);

@@ -287,3 +296,3 @@ break;

case 'accountsChanged':
_this7.emitAccountsChanged(message.params[0]);
_this8.emitAccountsChanged(message.params[0]);

@@ -295,10 +304,11 @@ break;

_this7.targetOrigin = targetOrigin;
_this7.timeoutMilliseconds = timeoutMilliseconds;
_this7.eventSource = eventSource;
_this7.eventTarget = eventTarget; // Listen for messages from the event source.
_instance = _assertThisInitialized(_this8);
_this8.targetOrigin = targetOrigin;
_this8.timeoutMilliseconds = timeoutMilliseconds;
_this8.eventSource = eventSource;
_this8.eventTarget = eventTarget; // Listen for messages from the event source.
_this7.eventSource.addEventListener('message', _this7.handleEventSourceMessage);
_this8.eventSource.addEventListener('message', _this8.handleEventSourceMessage);
return _this7;
return _this8;
}

@@ -319,3 +329,3 @@ /**

try {
var _this8 = this;
var _this9 = this;

@@ -333,3 +343,3 @@ var id = optionalId !== null && optionalId !== undefined ? optionalId : getUniqueId();

var promise = new Promise(function (resolve, reject) {
return _this8.completers[id] = {
return _this9.completers[id] = {
resolve: resolve,

@@ -340,12 +350,12 @@ reject: reject

_this8.eventTarget.postMessage(payload, _this8.targetOrigin); // Delete the completer within the timeout and reject the promise.
_this9.eventTarget.postMessage(payload, _this9.targetOrigin); // Delete the completer within the timeout and reject the promise.
setTimeout(function () {
if (_this8.completers[id]) {
_this8.completers[id].reject(new Error("RPC ID \"" + id + "\" timed out after " + _this8.timeoutMilliseconds + " milliseconds"));
if (_this9.completers[id]) {
_this9.completers[id].reject(new Error("RPC ID \"" + id + "\" timed out after " + _this9.timeoutMilliseconds + " milliseconds"));
delete _this8.completers[id];
delete _this9.completers[id];
}
}, _this8.timeoutMilliseconds);
}, _this9.timeoutMilliseconds);
return Promise.resolve(promise);

@@ -365,5 +375,5 @@ } catch (e) {

try {
var _this9 = this;
var _this10 = this;
return Promise.resolve(_this9.execute(method, params)).then(function (response) {
return Promise.resolve(_this10.execute(method, params)).then(function (response) {
if ('error' in response) {

@@ -388,5 +398,7 @@ throw new RpcError(response.error.code, response.error.message);

try {
var _this10 = this;
var _this11 = this;
return Promise.resolve(_this10.execute(method, params)).then(function (response) {
var _this = _this11 || _instance;
return Promise.resolve(_this.execute(method, params)).then(function (response) {
if ('error' in response) {

@@ -409,10 +421,12 @@ throw new RpcError(response.error.code, response.error.message);

try {
var _this11 = this;
var _this12 = this;
if (_this11.enabled === null) {
var promise = _this11.enabled = _this11.send('enable')["catch"](function (error) {
var _this = _this12 || _instance;
if (_this.enabled === null) {
var promise = _this.enabled = _this.send('enable')["catch"](function (error) {
// Clear this.enabled if it's this promise so we try again next call.
// this.enabled might be set from elsewhere if, e.g. the accounts changed event is emitted
if (_this11.enabled === promise) {
_this11.enabled = null;
if (_this.enabled === promise) {
_this.enabled = null;
} // Rethrow the error.

@@ -425,3 +439,3 @@

return Promise.resolve(_this11.enabled);
return Promise.resolve(_this.enabled);
} catch (e) {

@@ -440,6 +454,8 @@ return Promise.reject(e);

try {
var _this12 = this;
var _this13 = this;
var _this = _this13 || _instance;
var _temp3 = _catch(function () {
return Promise.resolve(_this12.execute(payload.method, payload.params, payload.id)).then(function (result) {
return Promise.resolve(_this.execute(payload.method, payload.params, payload.id)).then(function (result) {
callback(null, result);

@@ -446,0 +462,0 @@ });

@@ -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,h=n.eventTarget,d=void 0===h?window.parent:h;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"eth_subscription":r.emitEthSubNotification(n.params);break;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=d,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.emitEthSubNotification=function(e){this.emit("eth_subscription",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)),f=null;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,m=n.eventSource,h=void 0===m?window:m,d=n.eventTarget,p=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"eth_subscription":r.emitEthSubNotification(n.params);break;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])}}}},f=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r),r.targetOrigin=i,r.timeoutMilliseconds=l,r.eventSource=h,r.eventTarget=p,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||f).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||f;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||f,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.emitEthSubNotification=function(e){this.emit("eth_subscription",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

@@ -127,2 +127,10 @@ import { EventEmitter } from 'eventemitter3';

function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
// A type of promise-like that resolves synchronously and supports only one observer

@@ -169,9 +177,9 @@

function RpcError(code, reason) {
var _this6;
var _this7;
_this6 = _Error.call(this, code + ": " + reason) || this;
_this6.isRpcError = true;
_this6.code = code;
_this6.reason = reason;
return _this6;
_this7 = _Error.call(this, code + ": " + reason) || this;
_this7.isRpcError = true;
_this7.code = code;
_this7.reason = reason;
return _this7;
}

@@ -181,2 +189,3 @@

}( /*#__PURE__*/_wrapNativeSuper(Error));
var _instance = null;
/**

@@ -190,3 +199,3 @@ * This is the primary artifact of this library.

function IFrameEthereumProvider(_temp2) {
var _this7;
var _this8;

@@ -204,5 +213,5 @@ var _ref = _temp2 === void 0 ? {} : _temp2,

// Call super for `this` to be defined
_this7 = _EventEmitter.call(this) || this;
_this7.enabled = null;
_this7.completers = {};
_this8 = _EventEmitter.call(this) || this;
_this8.enabled = null;
_this8.completers = {};
/**

@@ -213,3 +222,3 @@ * Handle a message on the event source.

_this7.handleEventSourceMessage = function (event) {
_this8.handleEventSourceMessage = function (event) {
var data = event.data; // No data to parse, skip.

@@ -229,3 +238,3 @@

if (typeof message.id !== 'undefined' && message.id !== null) {
var completer = _this7.completers['' + message.id]; // True if we haven't timed out and this is a response to a message we sent.
var completer = _this8.completers['' + message.id]; // True if we haven't timed out and this is a response to a message we sent.

@@ -240,3 +249,3 @@ if (completer) {

delete _this7.completers[message.id];
delete _this8.completers[message.id];
}

@@ -249,3 +258,3 @@ } // If the method is a request from the parent window, it is likely a subscription.

case 'eth_subscription':
_this7.emitEthSubNotification(message.params);
_this8.emitEthSubNotification(message.params);

@@ -255,3 +264,3 @@ break;

case 'notification':
_this7.emitNotification(message.params);
_this8.emitNotification(message.params);

@@ -261,3 +270,3 @@ break;

case 'connect':
_this7.emitConnect();
_this8.emitConnect();

@@ -267,3 +276,3 @@ break;

case 'close':
_this7.emitClose(message.params[0], message.params[1]);
_this8.emitClose(message.params[0], message.params[1]);

@@ -273,3 +282,3 @@ break;

case 'chainChanged':
_this7.emitChainChanged(message.params[0]);
_this8.emitChainChanged(message.params[0]);

@@ -279,3 +288,3 @@ break;

case 'networkChanged':
_this7.emitNetworkChanged(message.params[0]);
_this8.emitNetworkChanged(message.params[0]);

@@ -285,3 +294,3 @@ break;

case 'accountsChanged':
_this7.emitAccountsChanged(message.params[0]);
_this8.emitAccountsChanged(message.params[0]);

@@ -293,10 +302,11 @@ break;

_this7.targetOrigin = targetOrigin;
_this7.timeoutMilliseconds = timeoutMilliseconds;
_this7.eventSource = eventSource;
_this7.eventTarget = eventTarget; // Listen for messages from the event source.
_instance = _assertThisInitialized(_this8);
_this8.targetOrigin = targetOrigin;
_this8.timeoutMilliseconds = timeoutMilliseconds;
_this8.eventSource = eventSource;
_this8.eventTarget = eventTarget; // Listen for messages from the event source.
_this7.eventSource.addEventListener('message', _this7.handleEventSourceMessage);
_this8.eventSource.addEventListener('message', _this8.handleEventSourceMessage);
return _this7;
return _this8;
}

@@ -317,3 +327,3 @@ /**

try {
var _this8 = this;
var _this9 = this;

@@ -331,3 +341,3 @@ var id = optionalId !== null && optionalId !== undefined ? optionalId : getUniqueId();

var promise = new Promise(function (resolve, reject) {
return _this8.completers[id] = {
return _this9.completers[id] = {
resolve: resolve,

@@ -338,12 +348,12 @@ reject: reject

_this8.eventTarget.postMessage(payload, _this8.targetOrigin); // Delete the completer within the timeout and reject the promise.
_this9.eventTarget.postMessage(payload, _this9.targetOrigin); // Delete the completer within the timeout and reject the promise.
setTimeout(function () {
if (_this8.completers[id]) {
_this8.completers[id].reject(new Error("RPC ID \"" + id + "\" timed out after " + _this8.timeoutMilliseconds + " milliseconds"));
if (_this9.completers[id]) {
_this9.completers[id].reject(new Error("RPC ID \"" + id + "\" timed out after " + _this9.timeoutMilliseconds + " milliseconds"));
delete _this8.completers[id];
delete _this9.completers[id];
}
}, _this8.timeoutMilliseconds);
}, _this9.timeoutMilliseconds);
return Promise.resolve(promise);

@@ -363,5 +373,5 @@ } catch (e) {

try {
var _this9 = this;
var _this10 = this;
return Promise.resolve(_this9.execute(method, params)).then(function (response) {
return Promise.resolve(_this10.execute(method, params)).then(function (response) {
if ('error' in response) {

@@ -386,5 +396,7 @@ throw new RpcError(response.error.code, response.error.message);

try {
var _this10 = this;
var _this11 = this;
return Promise.resolve(_this10.execute(method, params)).then(function (response) {
var _this = _this11 || _instance;
return Promise.resolve(_this.execute(method, params)).then(function (response) {
if ('error' in response) {

@@ -407,10 +419,12 @@ throw new RpcError(response.error.code, response.error.message);

try {
var _this11 = this;
var _this12 = this;
if (_this11.enabled === null) {
var promise = _this11.enabled = _this11.send('enable')["catch"](function (error) {
var _this = _this12 || _instance;
if (_this.enabled === null) {
var promise = _this.enabled = _this.send('enable')["catch"](function (error) {
// Clear this.enabled if it's this promise so we try again next call.
// this.enabled might be set from elsewhere if, e.g. the accounts changed event is emitted
if (_this11.enabled === promise) {
_this11.enabled = null;
if (_this.enabled === promise) {
_this.enabled = null;
} // Rethrow the error.

@@ -423,3 +437,3 @@

return Promise.resolve(_this11.enabled);
return Promise.resolve(_this.enabled);
} catch (e) {

@@ -438,6 +452,8 @@ return Promise.reject(e);

try {
var _this12 = this;
var _this13 = this;
var _this = _this13 || _instance;
var _temp3 = _catch(function () {
return Promise.resolve(_this12.execute(payload.method, payload.params, payload.id)).then(function (result) {
return Promise.resolve(_this.execute(payload.method, payload.params, payload.id)).then(function (result) {
callback(null, result);

@@ -444,0 +460,0 @@ });

{
"name": "@jadbox/iframe-provider",
"version": "0.1.17",
"version": "0.1.18",
"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