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

@opensea/embedded-wallet-sdk

Package Overview
Dependencies
Maintainers
0
Versions
548
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opensea/embedded-wallet-sdk - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

dist/constants.d.ts

2

dist/index.js

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

import{EventEmitter as e}from"eventemitter3";import{Vessel as t}from"@opensea/vessel";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){s.label=u[1];break}if(6===u[0]&&s.label<o[1]){s.label=o[1],o=u;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(u);break}o[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}"function"==typeof SuppressedError&&SuppressedError;var i=function(e){function t(t){var n=t.message,r=t.code,o=t.data,i=e.call(this,n)||this;return i.code=r,i.data=o,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t}(Error),s=new e,u=function(){function e(e){var t=e.vessel;this.vessel=t,this.messageListener=this.handleInboundMessage.bind(this),this.vessel.addListener("message",this.messageListener)}return e.prototype.handleInboundMessage=function(e,t){return!!function(e){return!!e&&"object"==typeof e&&"type"in e&&"event"===e.type&&"event"in e&&"string"==typeof e.event}(e.payload)&&(s.emit(e.payload.event,e.payload.data),t(),!0)},e.prototype.request=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.vessel.send({type:"action",action:"HeadlessRPCRequest",payload:e},{timeout:void 0})];case 1:return[2,n.sent()];case 2:if(t=n.sent(),(r=t)&&"object"==typeof r&&"message"in r&&"code"in r&&"number"==typeof r.code)throw new i(t);if(t instanceof Error)throw t.message="Error sending message to wallet: ".concat(t.message),t;throw new Error("Error sending message to wallet: ".concat(JSON.stringify(t)));case 3:return[2]}var r}))}))},e.prototype.on=function(e,t){s.on(e,t)},e.prototype.removeListener=function(e,t){s.removeListener(e,t)},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.vessel.removeListener("message",this.messageListener),[4,this.vessel.send({type:"action",action:"Logout"})];case 1:return e.sent(),[2]}}))}))},e}(),c="https://wallets.opensea.io/hidden",a="https://dev-wallets.opensea.io/hidden",d="http://localhost:5001/hidden",f=new e,l=function(e){return f.addListener("mfa-required",e),function(){return f.removeListener("mfa-required",e)}},v=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"InitMfa",mfaMethod:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},h=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,M()];case 1:return[4,n.sent().vessel.send({type:"action",action:"SubmitMfa",mfaCode:t,mfaMethod:e},{timeout:void 0})];case 2:return[2,n.sent()]}}))}))},p=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CancelMfa"},{timeout:void 0})];case 2:return[2,e.sent()]}}))}))},m=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"InitMfaEnrollmentWithSms",phoneNumber:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},y=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,M()];case 1:return[4,n.sent().vessel.send({type:"action",action:"SubmitMfaEnrollmentWithSms",phoneNumber:e,mfaCode:t},{timeout:void 0})];case 2:return[2,n.sent()]}}))}))},w=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"InitMfaEnrollmentWithTotp"},{timeout:void 0})];case 2:return[2,e.sent()]}}))}))},b=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"SubmitMfaEnrollmentWithTotp",mfaCode:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},g=void 0,E=void 0,L=void 0,S=function(e){var n=void 0===e?{}:e,i=n.url,s=void 0===i?a:i,u=n.debug,c=void 0!==u&&u;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return L?[2,L]:"undefined"==typeof document?[2]:((g=document.createElement("iframe")).src=s,g.hidden=!0,g.id="os-embedded-wallet-iframe",document.body.appendChild(g),E=new t({iframe:g,targetOrigin:new URL(s).origin,debug:c}),L=r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,E.handshake()];case 1:return e.sent(),E.addListener("message",_),[2]}}))})),[2,L])}))}))},M=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(!E)throw new Error("Wallet module not initialized");return[4,L];case 1:return e.sent(),[2,{vessel:E,iframe:g}]}}))}))},_=function(e,t){return!!((o=e.payload)&&"object"==typeof o&&"type"in o&&"action"===o.type&&"action"in o&&"PromptMfa"===o.action)&&(n=e.payload.mfaMethods,r=function(){return t({success:!0})},f.emit("mfa-required",n,r),!0);var n,r,o},C=void 0,q=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return"undefined"==typeof document?[2,void 0]:[4,M()];case 1:return e=t.sent().vessel,C||(C=new u({vessel:e})),[2,C]}}))}))},I=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,q()];case 1:if(!(e=t.sent()))throw new Error("Wallet module not initialized");return[2,e]}}))}))},x=function(){return r(void 0,void 0,void 0,(function(){var e,t,n,r;return o(this,(function(o){switch(o.label){case 0:return"undefined"==typeof document?[2,{accounts:[],chainId:1}]:[4,I()];case 1:return e=o.sent(),[4,Promise.all([e.request({method:"eth_accounts"}),e.request({method:"eth_chainId"})])];case 2:return t=o.sent(),n=t[0],r=t[1],[2,{accounts:n,chainId:r}]}}))}))},W=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,I()];case 1:return[4,e.sent().disconnect()];case 2:return e.sent(),[2]}}))}))},O=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return"undefined"==typeof document?[2,[]]:[4,I()];case 1:return[2,e.sent().request({method:"eth_accounts"})]}}))}))},j=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return"undefined"==typeof document?[2,1]:[4,I()];case 1:return e=t.sent(),[2,e.request({method:"eth_chainId"})]}}))}))},k=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return"undefined"==typeof document?[2,!1]:[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CheckAuthStatus"})];case 2:return[2,e.sent()]}}))}))},P=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,I()];case 1:return[4,t.sent().request({method:"wallet_switchEthereumChain",params:[{chainId:"0x".concat(e.toString(16))}]})];case 2:return t.sent(),[2]}}))}))},T=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"SendLoginCode",email:e})];case 2:return[2,t.sent()]}}))}))},N=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"LoginWithCode",code:e})];case 2:return[2,t.sent()]}}))}))},R=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CreateEmbeddedWallet"})];case 2:return[2,e.sent()]}}))}))},z=function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"GetUser"})];case 2:return[2,e.sent()]}}))}))};export{a as DEV_OPENSEA_WALLET_URL,d as LOCAL_OPENSEA_WALLET_URL,c as PROD_OPENSEA_WALLET_URL,p as cancelMfaChallenge,x as connect,R as createWallet,W as disconnect,O as getAccounts,j as getChainId,q as getProvider,z as getUser,v as initMfaChallenge,m as initMfaEnrollmentWithSms,w as initMfaEnrollmentWithTotp,S as initialize,k as isAuthorized,N as loginWithCode,l as onMfaRequired,T as sendLoginCode,h as submitMfaChallenge,y as submitMfaEnrollmentWithSms,b as submitMfaEnrollmentWithTotp,P as switchChain};
import{EventEmitter as e}from"eventemitter3";import{Vessel as t}from"@opensea/vessel";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function u(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}c((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(6===u[0]&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){function t(t){var n=t.message,r=t.code,i=t.data,o=e.call(this,n)||this;return o.code=r,o.data=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t}(Error),s=new e,u=function(){function e(e){var t=e.vessel;this.vessel=t,this.messageListener=this.handleInboundMessage.bind(this),this.vessel.addListener("message",this.messageListener)}return e.prototype.handleInboundMessage=function(e,t){return!!function(e){return!!e&&"object"==typeof e&&"type"in e&&"event"===e.type&&"event"in e&&"string"==typeof e.event}(e.payload)&&(s.emit(e.payload.event,e.payload.data),t(),!0)},e.prototype.request=function(e){return r(this,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.vessel.send({type:"action",action:"HeadlessRPCRequest",payload:e},{timeout:void 0})];case 1:return[2,n.sent()];case 2:if(t=n.sent(),(r=t)&&"object"==typeof r&&"message"in r&&"code"in r&&"number"==typeof r.code)throw new o(t);if(t instanceof Error)throw t.message="Error sending message to wallet: ".concat(t.message),t;throw new Error("Error sending message to wallet: ".concat(JSON.stringify(t)));case 3:return[2]}var r}))}))},e.prototype.on=function(e,t){s.on(e,t)},e.prototype.removeListener=function(e,t){s.removeListener(e,t)},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this.vessel.removeListener("message",this.messageListener),[4,this.vessel.send({type:"action",action:"Logout"})];case 1:return e.sent(),[2]}}))}))},e}(),c="https://wallets.opensea.io/hidden",a="https://dev-wallets.opensea.io/hidden",d="http://localhost:5001/hidden",l=new e,f=function(e){return l.addListener("mfa-required",e),function(){return l.removeListener("mfa-required",e)}},v=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"InitMfa",mfaMethod:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},h=function(e,t){return r(void 0,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,M()];case 1:return[4,n.sent().vessel.send({type:"action",action:"SubmitMfa",mfaCode:t,mfaMethod:e},{timeout:void 0})];case 2:return[2,n.sent()]}}))}))},p=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CancelMfa"},{timeout:void 0})];case 2:return[2,e.sent()]}}))}))},m=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"InitMfaEnrollmentWithSms",phoneNumber:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},y=function(e,t){return r(void 0,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,M()];case 1:return[4,n.sent().vessel.send({type:"action",action:"SubmitMfaEnrollmentWithSms",phoneNumber:e,mfaCode:t},{timeout:void 0})];case 2:return[2,n.sent()]}}))}))},b=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"InitMfaEnrollmentWithTotp"},{timeout:void 0})];case 2:return[2,e.sent()]}}))}))},w=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"SubmitMfaEnrollmentWithTotp",mfaCode:e},{timeout:void 0})];case 2:return[2,t.sent()]}}))}))},g=void 0,E=void 0,L=void 0,S=function(e){var n=void 0===e?{}:e,o=n.url,s=void 0===o?a:o,u=n.debug,c=void 0!==u&&u,d=n.retries,l=void 0===d?1:d;return r(void 0,void 0,void 0,(function(){return i(this,(function(e){return L?[2,L]:"undefined"==typeof document?[2]:((g=document.createElement("iframe")).src=s,g.hidden=!0,g.id="os-embedded-wallet-iframe",document.body.appendChild(g),E=new t({iframe:g,targetOrigin:new URL(s).origin,debug:c,handshakeTimeout:5e3}),L=r(void 0,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,E.handshake()];case 1:return t.sent(),E.addListener("message",_),[3,3];case 2:if(e=t.sent(),console.error("Error initializing embedded wallet",e),L=void 0,l>0)return console.debug("Retrying embedded wallet initialization (".concat(l," retries left)")),[2,S({url:s,debug:c,retries:l-1})];throw e;case 3:return[2]}}))})),[2,L])}))}))},M=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:if(!E)throw new Error("Wallet module not initialized");return[4,L];case 1:return e.sent(),[2,{vessel:E,iframe:g}]}}))}))},_=function(e,t){return!!((i=e.payload)&&"object"==typeof i&&"type"in i&&"action"===i.type&&"action"in i&&"PromptMfa"===i.action)&&(n=e.payload.mfaMethods,r=function(){return t({success:!0})},l.emit("mfa-required",n,r),!0);var n,r,i},C=void 0,q=function(){return r(void 0,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return"undefined"==typeof document?[2,void 0]:[4,M()];case 1:return e=t.sent().vessel,C||(C=new u({vessel:e})),[2,C]}}))}))},I=function(){return r(void 0,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,q()];case 1:if(!(e=t.sent()))throw new Error("Wallet module not initialized");return[2,e]}}))}))},x=function(){return r(void 0,void 0,void 0,(function(){var e,t,n,r;return i(this,(function(i){switch(i.label){case 0:return"undefined"==typeof document?[2,{accounts:[],chainId:1}]:[4,I()];case 1:return e=i.sent(),[4,Promise.all([e.request({method:"eth_accounts"}),e.request({method:"eth_chainId"})])];case 2:return t=i.sent(),n=t[0],r=t[1],[2,{accounts:n,chainId:r}]}}))}))},W=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,I()];case 1:return[4,e.sent().disconnect()];case 2:return e.sent(),[2]}}))}))},k=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return"undefined"==typeof document?[2,[]]:[4,I()];case 1:return[2,e.sent().request({method:"eth_accounts"})]}}))}))},O=function(){return r(void 0,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return"undefined"==typeof document?[2,1]:[4,I()];case 1:return e=t.sent(),[2,e.request({method:"eth_chainId"})]}}))}))},j=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return"undefined"==typeof document?[2,!1]:[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CheckAuthStatus"})];case 2:return[2,e.sent()]}}))}))},P=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,I()];case 1:return[4,t.sent().request({method:"wallet_switchEthereumChain",params:[{chainId:"0x".concat(e.toString(16))}]})];case 2:return t.sent(),[2]}}))}))},T=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"SendLoginCode",email:e})];case 2:return[2,t.sent()]}}))}))},z=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return[4,t.sent().vessel.send({type:"action",action:"LoginWithCode",code:e})];case 2:return[2,t.sent()]}}))}))},R=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"CreateEmbeddedWallet"})];case 2:return[2,e.sent()]}}))}))},N=function(){return r(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,M()];case 1:return[4,e.sent().vessel.send({type:"action",action:"GetUser"})];case 2:return[2,e.sent()]}}))}))};export{a as DEV_OPENSEA_WALLET_URL,d as LOCAL_OPENSEA_WALLET_URL,c as PROD_OPENSEA_WALLET_URL,p as cancelMfaChallenge,x as connect,R as createWallet,W as disconnect,k as getAccounts,O as getChainId,q as getProvider,N as getUser,v as initMfaChallenge,m as initMfaEnrollmentWithSms,b as initMfaEnrollmentWithTotp,S as initialize,j as isAuthorized,z as loginWithCode,f as onMfaRequired,T as sendLoginCode,h as submitMfaChallenge,y as submitMfaEnrollmentWithSms,w as submitMfaEnrollmentWithTotp,P as switchChain};
//# sourceMappingURL=index.js.map
{
"name": "@opensea/embedded-wallet-sdk",
"version": "0.1.13",
"version": "0.1.14",
"description": "SDK for interacting with the OpenSea wallet product",

@@ -11,6 +11,7 @@ "license": "ISC",

"import": "./dist/index.js",
"types": "./dist/src/index.d.ts"
"types": "./dist/index.d.ts"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [

@@ -20,3 +21,2 @@ "dist",

],
"types": "./dist/src/index.d.ts",
"dependencies": {

@@ -27,2 +27,3 @@ "eventemitter3": "^5.0.1",

"devDependencies": {
"@arethetypeswrong/cli": "^0.16.0",
"@playwright/test": "1.43.1",

@@ -37,6 +38,2 @@ "@rollup/plugin-terser": "^0.4.4",

"eslint-plugin-storybook": "^0.6.13",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"prettier-package-json": "^2.8.0",
"react": "^18.2.0",

@@ -49,20 +46,5 @@ "react-dom": "^18.2.0",

"tslib": "^2.6.2",
"typescript": "^5.2.2",
"@opensea/wallet-messages": "0.0.22",
"eslint-config-custom": "0.0.0"
},
"keywords": [],
"lint-staged": {
"**/package.json": [
"prettier-package-json --write"
],
"**/*.{ts,tsx,js,jsx,html,md,mdx,yml,json}": [
"prettier --write"
]
},
"prettier": {
"arrowParens": "avoid",
"semi": false,
"trailingComma": "all"
},
"scripts": {

@@ -72,12 +54,8 @@ "build": "rollup -c",

"eslint:check": "eslint . --max-warnings 0 --ext .ts,.tsx",
"lint": "pnpm run typecheck && pnpm run eslint:check && pnpm run prettier:check:package.json",
"prettier:check": "prettier . --check",
"prettier:check:package.json": "prettier-package-json --list-different",
"prettier:fix": "prettier . --write && prettier-package-json --write",
"prepublish": "jq 'if .main then .main |= gsub(\".ts$\"; \".js\") | .main |= sub(\"./src\"; \"./dist\") else . end' package.json > package.json.tmp && pnpm run save-package-json-changes",
"save-package-json-changes": "mv package.json.tmp package.json",
"lint": "pnpm typecheck",
"storybook": "storybook dev -p 6006",
"test": "playwright test",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"typecheck:build": "pnpm attw --pack --entrypoints . --ignore-rules internal-resolution-error cjs-resolves-to-esm"
}
}

@@ -12,2 +12,3 @@ import { Vessel, VesselMessage } from "@opensea/vessel"

debug?: boolean
retries?: number
}

@@ -18,2 +19,3 @@

debug = false,
retries = 1,
}: InitializeOptions = {}): Promise<void> => {

@@ -37,6 +39,20 @@ if (initializationPromise) {

debug,
handshakeTimeout: 5_000,
})
initializationPromise = (async () => {
await vessel.handshake()
vessel.addListener("message", mfaListener)
try {
await vessel.handshake()
vessel.addListener("message", mfaListener)
} catch (error) {
console.error("Error initializing embedded wallet", error)
initializationPromise = undefined
if (retries > 0) {
// eslint-disable-next-line no-console
console.debug(
`Retrying embedded wallet initialization (${retries} retries left)`,
)
return initialize({ url, debug, retries: retries - 1 })
}
throw error
}
})()

@@ -43,0 +59,0 @@ return initializationPromise

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