用ganache-cli来测试(http://127.0.0.1:8545) 向ganache-cli节点发送post请求数据data={ 'jsonrpc': '2.0','method': 'eth_accounts', 'params': [],'id': 1}
输出结果为:
import axios from 'axios';
axios.post( 'http://127.0.0.1:8545', {
'jsonrpc': '2.0',
'method': 'eth_accounts',
'params': [],
'id': 1,
} ).then( ( result ) => {
console.log( '8545post请求数据:', result );
} ).catch( ( error ) => {
throw error;
} );