You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
393 B

1 month ago
  1. ---
  2. title: eth_chainId
  3. description: 获取BUZZUP当前的chainId
  4. ---
  5. ---
  6. ### 参数
  7. - 该方法不接受任何参数
  8. ---
  9. ### 返回值
  10. - <div>ChainId<span style={{marginLeft:10,color:'#707070'}}>hex encoded bytes</span></div>
  11. ---
  12. ### Request
  13. ```js
  14. async function getAccounts() {
  15. const chainId = await window.ethereum.request({ method: 'eth_chainId' });
  16. console.log(chainId);
  17. }
  18. ```