@ledgerhq/connect-kit 1.0.7 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/dist/umd/index.d.ts +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/providers/Ethereum.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 1.0.9 - 2022-12-30
|
11
|
+
### Changed
|
12
|
+
- Enable Connect support on macOS.
|
13
|
+
|
14
|
+
## 1.0.8 - 2022-12-21
|
15
|
+
### Changed
|
16
|
+
- Expose WalletConnect's connector property as optional in the
|
17
|
+
EthereumProvider type for integration into web3-onboard.
|
18
|
+
|
10
19
|
## 1.0.7 - 2022-12-13
|
11
20
|
### Changed
|
12
21
|
- Close the ConnectWithLedgerLive modal when clicking outside.
|
package/dist/umd/index.d.ts
CHANGED
package/dist/umd/index.js
CHANGED
@@ -59,4 +59,4 @@ t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<<s)-1,u=l>>1,c=-7,f=n?o-1:0,d=
|
|
59
59
|
* https://github.com/lancedikson/bowser
|
60
60
|
* MIT License | (c) Dustin Diaz 2012-2015
|
61
61
|
* MIT License | (c) Denis Demchenko 2015-2019
|
62
|
-
*/class mr{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new gr(e,t)}static parse(e){return new gr(e).getResult()}static get BROWSER_MAP(){return ir}static get ENGINE_MAP(){return lr}static get OS_MAP(){return sr}static get PLATFORMS_MAP(){return ar}}function vr(){var e,t,n=mr.getParser(window.navigator.userAgent),r=n.getOS(),o=n.getBrowser(),i=n.getPlatform().type;return"isBrave"===(null===(t=null===(e=window.navigator.brave)||void 0===e?void 0:e.isBrave)||void 0===t?void 0:t.name)&&(o.name="Brave"),{type:i,os:r,browser:o}}var yr,br,wr=u("WalletConnect"),_r=c("WalletConnect");function kr(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){return wr("initWalletConnectProvider"),function(e){function t(e,t){if(wr("connectHandler",t),en(!1),e)throw _r("error",e),e}function n(t,r){wr("disconnectHandler",t,r),e.removeListener("disconnect",n)}wr("assignProviderEvents"),e.connector.on("connect",t),e.on("disconnect",n)}(e=new rr(r(r({},br),{qrcode:!1}))),wr("creating new provider instance"),yr=e,[2]}))}))}function xr(e){var t=e.request.bind(e),n=vr();return function(r){var a=r.method,s=r.params;return o(this,void 0,void 0,(function(){var r=this;return i(this,(function(l){switch(l.label){case 0:return"eth_requestAccounts"!==a?[3,1]:(wr("calling patched",a,s),[2,new Promise((function(l,u){return o(r,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),wr("isWalletConnectProviderConnected",yr.connected),yr.connected?[3,2]:[4,e.connector.createSession({chainId:br.chainId})];case 1:i.sent(),wr("new session with handshakeTopic",e.connector.handshakeTopic),Jn("ConnectWithLedgerLiveModal",{withQrCode:"desktop"===n.type,uri:e.connector.uri,onClose:function(){u(new I)}}),i.label=2;case 2:return r=l,[4,t({method:a,params:s})];case 3:return[2,r.apply(void 0,[i.sent()])];case 4:return o=i.sent(),_r("error",o),[2,u(o)];case 5:return[2]}}))}))}))]);case 1:return wr("calling provider",a,s),[4,t({method:a,params:s})];case 2:return[2,l.sent()]}}))}))}}function Sr(){return o(this,void 0,void 0,(function(){var e,t;return i(this,(function(n){switch(n.label){case 0:wr("getWalletConnectProvider"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,kr()];case 2:return n.sent(),yr.request=xr(yr),[2,yr];case 3:throw e=n.sent(),t=e instanceof Error?e:new Error(String(e)),_r("error",t),t;case 4:return[2]}}))}))}function Ar(e){return"iOS"===e.os.name&&"Safari"===e.browser.name}var Mr,Er,Cr,Rr,Or,Pr=u("getProvider");function Ir(e){return e===Mr.EthereumMainnet}!function(e){e[e.EthereumMainnet=1]="EthereumMainnet"}(Mr||(Mr={})),function(e){e.Ethereum="Ethereum",e.Solana="Solana"}(Er||(Er={})),function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(Cr||(Cr={}));var Tr=u("checkSupport");e.checkSupport=function(e){var t;Tr("initializing",e),t=e.providerType,Pr("setProviderType",t),Rr=t;var n=e.chainId||1;switch(e.providerType){case Er.Ethereum:return function(e){var t=vr(),n=!1;try{n=!!$n()}catch(e){}var r={isLedgerConnectSupported:Ar(t),isLedgerConnectEnabled:!!n,isChainIdSupported:Ir(e.chainId),providerImplementation:Cr.LedgerConnect};r.isLedgerConnectSupported&&r.isChainIdSupported||(r.providerImplementation=Cr.WalletConnect,function(e){wr("setWalletConnectOptions"),br=e}({chainId:e.chainId,bridge:e.bridge,infuraId:e.infuraId,rpc:e.rpc}));return function(e){Pr("setProviderImplementation",e),Or=e}(r.providerImplementation),r}(r(r({},e),{chainId:n}));case Er.Solana:return function(){var e=vr(),t=!1;try{t=!!tr()}catch(e){}var n={isLedgerConnectSupported:Ar(e),isLedgerConnectEnabled:!!t,providerImplementation:Cr.LedgerConnect};n.isLedgerConnectSupported?n.isLedgerConnectSupported&&!n.isLedgerConnectEnabled&&Jn("ExtensionUnavailableModal"):Jn("PlatformNotSupportedModal");return n}()}},e.enableDebugLogs=function(){l=!0},e.getProvider=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:switch(Pr("getProvider",Rr,Or),Rr){case Er.Ethereum:return[3,1];case Er.Solana:return[3,5]}return[3,6];case 1:return e=void 0,Or!==Cr.LedgerConnect?[3,2]:(e=$n(),[3,4]);case 2:return[4,Sr()];case 3:e=t.sent(),t.label=4;case 4:return[2,e];case 5:return[2,tr()];case 6:throw new O}}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));//# sourceMappingURL=index.js.map
|
62
|
+
*/class mr{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new gr(e,t)}static parse(e){return new gr(e).getResult()}static get BROWSER_MAP(){return ir}static get ENGINE_MAP(){return lr}static get OS_MAP(){return sr}static get PLATFORMS_MAP(){return ar}}function vr(){var e,t,n=mr.getParser(window.navigator.userAgent),r=n.getOS(),o=n.getBrowser(),i=n.getPlatform().type;return"isBrave"===(null===(t=null===(e=window.navigator.brave)||void 0===e?void 0:e.isBrave)||void 0===t?void 0:t.name)&&(o.name="Brave"),{type:i,os:r,browser:o}}var yr,br,wr=u("WalletConnect"),_r=c("WalletConnect");function kr(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){return wr("initWalletConnectProvider"),function(e){function t(e,t){if(wr("connectHandler",t),en(!1),e)throw _r("error",e),e}function n(t,r){wr("disconnectHandler",t,r),e.removeListener("disconnect",n)}wr("assignProviderEvents"),e.connector.on("connect",t),e.on("disconnect",n)}(e=new rr(r(r({},br),{qrcode:!1}))),wr("creating new provider instance"),yr=e,[2]}))}))}function xr(e){var t=e.request.bind(e),n=vr();return function(r){var a=r.method,s=r.params;return o(this,void 0,void 0,(function(){var r=this;return i(this,(function(l){switch(l.label){case 0:return"eth_requestAccounts"!==a?[3,1]:(wr("calling patched",a,s),[2,new Promise((function(l,u){return o(r,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),wr("isWalletConnectProviderConnected",yr.connected),yr.connected?[3,2]:[4,e.connector.createSession({chainId:br.chainId})];case 1:i.sent(),wr("new session with handshakeTopic",e.connector.handshakeTopic),Jn("ConnectWithLedgerLiveModal",{withQrCode:"desktop"===n.type,uri:e.connector.uri,onClose:function(){u(new I)}}),i.label=2;case 2:return r=l,[4,t({method:a,params:s})];case 3:return[2,r.apply(void 0,[i.sent()])];case 4:return o=i.sent(),_r("error",o),[2,u(o)];case 5:return[2]}}))}))}))]);case 1:return wr("calling provider",a,s),[4,t({method:a,params:s})];case 2:return[2,l.sent()]}}))}))}}function Sr(){return o(this,void 0,void 0,(function(){var e,t;return i(this,(function(n){switch(n.label){case 0:wr("getWalletConnectProvider"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,kr()];case 2:return n.sent(),yr.request=xr(yr),[2,yr];case 3:throw e=n.sent(),t=e instanceof Error?e:new Error(String(e)),_r("error",t),t;case 4:return[2]}}))}))}function Ar(e){return("iOS"===e.os.name||"macOS"===e.os.name)&&"Safari"===e.browser.name}var Mr,Er,Cr,Rr,Or,Pr=u("getProvider");function Ir(e){return e===Mr.EthereumMainnet}!function(e){e[e.EthereumMainnet=1]="EthereumMainnet"}(Mr||(Mr={})),function(e){e.Ethereum="Ethereum",e.Solana="Solana"}(Er||(Er={})),function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(Cr||(Cr={}));var Tr=u("checkSupport");e.checkSupport=function(e){var t;Tr("initializing",e),t=e.providerType,Pr("setProviderType",t),Rr=t;var n=e.chainId||1;switch(e.providerType){case Er.Ethereum:return function(e){var t=vr(),n=!1;try{n=!!$n()}catch(e){}var r={isLedgerConnectSupported:Ar(t),isLedgerConnectEnabled:!!n,isChainIdSupported:Ir(e.chainId),providerImplementation:Cr.LedgerConnect};r.isLedgerConnectSupported&&r.isChainIdSupported||(r.providerImplementation=Cr.WalletConnect,function(e){wr("setWalletConnectOptions"),br=e}({chainId:e.chainId,bridge:e.bridge,infuraId:e.infuraId,rpc:e.rpc}));return function(e){Pr("setProviderImplementation",e),Or=e}(r.providerImplementation),r}(r(r({},e),{chainId:n}));case Er.Solana:return function(){var e=vr(),t=!1;try{t=!!tr()}catch(e){}var n={isLedgerConnectSupported:Ar(e),isLedgerConnectEnabled:!!t,providerImplementation:Cr.LedgerConnect};n.isLedgerConnectSupported?n.isLedgerConnectSupported&&!n.isLedgerConnectEnabled&&Jn("ExtensionUnavailableModal"):Jn("PlatformNotSupportedModal");return n}()}},e.enableDebugLogs=function(){l=!0},e.getProvider=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:switch(Pr("getProvider",Rr,Or),Rr){case Er.Ethereum:return[3,1];case Er.Solana:return[3,5]}return[3,6];case 1:return e=void 0,Or!==Cr.LedgerConnect?[3,2]:(e=$n(),[3,4]);case 2:return[4,Sr()];case 3:e=t.sent(),t.label=4;case 4:return[2,e];case 5:return[2,tr()];case 6:throw new O}}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));//# sourceMappingURL=index.js.map
|