I test some eosjs apis.
But, I am stucked because of some problems.
This is my code.
///////////////////////////////// import * as Eos from 'eosjs'
class EOSService {
constructor() {
this.eos = Eos({
httpEndPoint : 'https://eu1.eosdac.io:443',
chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',
})
}
fetchTransactionData(txid, callback) {
this.eos.getTransaction(txid)
.then( (result) => {
callback(result)
})
}
fetchAccountData(accountName, callback) {
this.eos.getAccount(accountName)
.then( (result) => {
callback(result)
})
}
}
export default EOSService;
I call this methods from react component like below.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import EOSService from 'services/EOSService'
class AccountPage extends Component {
componentDidMount() {
let accountName = this.props.match.params.accountName;
(new EOSService()).fetchAccountData(accountName, (result) => {
console.log(result)
})
}
render() {
return(
<div>AccountPage</div>
);
}
}
AccountPage.propTypes = propTypes;
AccountPage.defaultProps = defaultProps;
export default AccountPage;
But, I encounter error like this. => POST http://127.0.0.1:8888/v1/chain/get_account 0 ()
In other words, I want to ask data from BP's httpEndPoint, but eosjs called 127.0.0.1:8888.
How to solve this?