Obtain accounts information with MetamSk
When is web3.js integration and Metamk extensions provider in its JavaScript project, will intelligence be asked in information?
Unfortunately, it is not possible to directly access the Metamk extension provider. These detailed are typical assaults on the chain with the Ethereum block chain and are not accessible to the side of the JavaScript code browser code.
However, they are some work sheets that you can consider:
1.
You can use the web3.js. You can use the et_name
yeth_icon'.js methods
Javacript
const web3 = new web3 (window.ethereum);
// Get an ac
Const dodress = alea web3.eth.getaddress ();
// Recover the name and account icon
const name = appeal web3.eth.name (address);
Const icon = alea web3.eth.icon (address);
Re
2.
Use of a service provider
Anap-up to the service provider such as the Metamask API, which provides access to data in the chain. You can make your Metamask account and then use the object 'eth_name and' eth_icon 'fulfilled the object' Metamask.
`Javacript
const metamask = new window.metamask ({accesstoken: 'your_acciss_token'});
// log in with MetamSk
MetamSk.sign ();
// Recover the name and account icon
const name = alea metamask.eth.name ();
const icon = wait metamk.eth.icon ();
Re
3.
Use of a third -party library
There are libraries from all parts such asu-uls
that provide a timely data form in the chain through its API. These libraries can offer methods to delay accounting information.
`Javacript
Import {signname, mean} of 'web3-utils';
const web3 = new web3 (window.ethereum);
// log in with MetamSk
MetamSk.sign ();
// Recover the name and account icon
const name = except me (web3.eth.address ());
Const icon = alea signicon (web3.eth.address ());
Console.log (name, icon);
` Re
While these solutions can provide access to some data in the chain, keep in mind that Etherum or Web3.js. He always ensures that he is making a good reputation solution and according to his project.
The best professionals can learn about the name of information and names.