|
@@ -9,35 +9,21 @@
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
- <button id="mm">test</button>
|
|
|
+ <button id="getRawTransaction">getRawTransaction</button>
|
|
|
+ <div id="result"></div>
|
|
|
</body>
|
|
|
<script type="text/javascript">
|
|
|
- //const url = 'https://goerli.infura.io/v3/a65939973eea40d2543fd907fa281eeb024936ddcdc3d872249d396faea650a1'
|
|
|
- //const url = 'https://goerli.infura.io/v3'
|
|
|
- const url = 'http://127.0.0.1:7545'
|
|
|
-
|
|
|
+ //https://chainlist.org/ 这个网站查 API key
|
|
|
+ const url = 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'
|
|
|
var web3 = new Web3(new Web3.providers.HttpProvider(url));
|
|
|
- //var web3 = new Web3()
|
|
|
- web3.setProvider(url)
|
|
|
-
|
|
|
- console.log(web3)
|
|
|
-
|
|
|
- //console.log(web3.isConnected())
|
|
|
-
|
|
|
- // function trans(){
|
|
|
- // console.log('....click')
|
|
|
- // }
|
|
|
- //a65939973eea40d2543fd907fa281eeb024936ddcdc3d872249d396faea650a1
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- const checkAll = document.querySelector('#mm')
|
|
|
|
|
|
+ const resultTxt = document.querySelector('#result')
|
|
|
+ const checkAll = document.querySelector('#getRawTransaction')
|
|
|
checkAll.addEventListener('click', function () {
|
|
|
- console.log('dddddd')
|
|
|
- const ret = web3.eth.getTransaction('0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b§234')
|
|
|
- //const ret = web3.eth.accounts
|
|
|
- console.log(ret)
|
|
|
+ web3.eth.getTransaction('0x01957ea8c7690c58f6125bee78af460a3198db3a79daaaf9e10e195e65726db3').then((res)=>{
|
|
|
+ console.log(res)
|
|
|
+ resultTxt.innerHTML = JSON.stringify(res)
|
|
|
+ });
|
|
|
})
|
|
|
|
|
|
</script>
|