EOS

兼容Scatter

MYKEY兼容Scatter协议,您可以直接开发兼容Scatter协议的dapp,再通过mykey内置浏览器访问。也可以参考以下链接,了解更多Scatter协议的内容:

https://get-scatter.com/developers/settingupforwebapps

登录

先使用scatter.connect方法,再使用login方法即可获得用户的账号信息。

import ScatterJS from "@scatterjs/core";

ScatterJS.connect("My DAPP", { network }).then(connected => {
  if (!connected) return alert("no scatter");

  const eos = ScatterJS.eos(network, Api, { rpc });
  this.setState({ eos });

  ScatterJS.login().then(id => {
    if (!id) return alert("no identity");
    const account = ScatterJS.account("eos");
    this.setState({ account }, this.getVote);
  });
});

验证MYKEY的签名

MYKEY的账号体系与其他的EOS账号有所差异,验证MYKEY签名时,需要使用Reserved公钥

Reserved Key的公钥,可以通过智能合约mykeymanager的表keydata查询到。查询时,指定范围为MYKEY账号,index为3。

Last updated

Was this helpful?