1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5029],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>y});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=o,y=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(y,s(s({ref:t},p),{},{components:n})):r.createElement(y,s({ref:t},p))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var l=2;l<a;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},6613:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>y,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var r=n(7462),o=n(3366),a=(n(7294),n(3905)),s=["components"],i={title:"Ethereum"},c=void 0,l={unversionedId:"sdk/general/connectivity/guides/ethereum",id:"sdk/general/connectivity/guides/ethereum",title:"Ethereum",description:"Because some connectors such as the Elastos Essentials connector implement not only the Elastos connectivity methods, but also standard EVM-compatible Web3 operations (crypto operations, inherited from Ethereum), applications also need a way to easily access EVM features.",source:"@site/../docs/7.sdk/general/connectivity/guides/ethereum.md",sourceDirName:"7.sdk/general/connectivity/guides",slug:"/sdk/general/connectivity/guides/ethereum",permalink:"/sdk/general/connectivity/guides/ethereum",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/7.sdk/general/connectivity/guides/ethereum.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1676425989,formattedLastUpdatedAt:"Feb 15, 2023",frontMatter:{title:"Ethereum"},sidebar:"sdkSidebar",previous:{title:"User Experience",permalink:"/sdk/general/connectivity/guides/ux"},next:{title:"User Interface",permalink:"/sdk/general/connectivity/guides/ui"}},p={},u=[],d={toc:u},m="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Because some connectors such as the Elastos Essentials connector implement not only the Elastos connectivity methods, but also standard EVM-compatible Web3 operations (crypto operations, inherited from Ethereum), applications also need a way to easily access EVM features."),(0,a.kt)("p",null,"In the case of the Elastos Essentials connector, the third-party ",(0,a.kt)("strong",{parentName:"p"},"Wallet Connect")," library is used to let applications communicate with the wallet seamlessly. In the future, we believe Wallet Connect will be used by most decentralized applications, as it represents a convenient way to let 2 remote applications talk to each other, and fulfills desktop-mobile as well as mobile-mobile use cases."),(0,a.kt)("p",null,"The connectivity SDK provides access to possibly existing web3 providers used by connectors, so that applications can share those providers. For instance, if a connector uses Wallet Connect for DID operations, users have to scan a QR code to initiate the connection to the identity wallet first. But then, we don't want applications to also handle their own Wallet Connect instance just for Web3 EVM operations, as this would require dealing with 2 instances of Wallet Connect, and users to scan QR codes twice. In that regard, the connectivity SDK lets connectors simply ",(0,a.kt)("strong",{parentName:"p"},"share")," their ",(0,a.kt)("strong",{parentName:"p"},"existing web3 provider")," (if they have one) and applications can ",(0,a.kt)("strong",{parentName:"p"},"reuse")," them."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { connectivity } from "@elastosfoundation/elastos-connectivity-sdk-js";\nimport Web3 from "web3";\n\nconst provider = connectivity.getActiveConnector().getWeb3Provider();
1\nif (provider) {\n const web3 = new Web3(provider);\n const gasPrice = await web3.eth.getGasPrice();\n}\n')))}y.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.