欢迎所有爱好区块链技术的人加入。

ARCHIVES / 146.HTML

Scatter 在测试网络中与Dapp交互使用

Surou EOS-新手教程

本文章将演示Scatter在测试网络中,与Dapp项目进行常规操作。

1.Dapp测试项目搭建

#####1.clone Dapp测试项目代码

git clone https://github.com/generEOS/eostoolkit.git

#####2.编译运行eostoolkit

const httpNetwork = {
    blockchain:'eos',
    host:'192.168.1.112', // ( or null if endorsed chainId )
    port:8888, // ( or null if defaulting to 80 )
    chainId:"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f", // Or null to fetch automatically ( takes longer )
}

修改 network为httpNetwork

connectIdentity() {
      this.state.scatter.getIdentity({accounts:[{chainId:httpNetwork.chainId, blockchain:httpNetwork.blockchain}]}).then(() => {
          console.log('Attach Identity');
          console.log(this.state.scatter.identity);
          this.setState({identity: window.scatter.identity});
      }).catch(error => {
          console.error(error);
		  console.error(chainId:httpNetwork.chainId);
      });
  }