Biport Wallet API Documentation
  • 시작하기
    • Biport 감지하기
    • 사용자의 네트워크 감지하기
    • 사용자의 계정 접근하기
  • API
    • Biport provider API
    • JSON-RPC API
Powered by GitBook
On this page
  1. 시작하기

사용자의 네트워크 감지하기

사용자의 네트워크 Chain ID를 추적하는 것은 중요합니다. 왜냐하면 모든 RPC 요청은 현재 연결된 네트워크로 제출되기 때문입니다.

eth_chainId RPC 메서드를 사용하여 사용자의 현재 네트워크 Chain ID를 감지할 수 있습니다. chainChanged 제공자 이벤트를 수신하여 사용자가 네트워크를 변경할 때 감지할 수 있습니다.

예제 프로젝트 스크립트에서 다음 코드는 사용자의 네트워크와 사용자가 네트워크를 변경할 때 감지합니다.

const chainId = await window.biport.request({ method: 'eth_chainId' });

window.biport.on('chainChanged', handleChainChanged);

function handleChainChanged(chainId) {
  // We recommend reloading the page, unless you must do otherwise.
  window.location.reload();
  console.log('Changed Value:', chainId);
}

Chain IDs

이것들은 Biport가 기본적으로 지원하는 네트워크의 체인 ID입니다.

Hex
Decimal
Network

0xbfc

3068

Bifrost main network (Mainnet)

0xbfc0

49088

Bifrost test network

0x1

1

Ethereum main network (Mainnet)

0x5

5

Goerli test network

0x38

56

BNB Chain (Mainnet)

0x61

97

BNB Chain Test

0xa86a

43114

Avalanche Mainnet C (Mainnet)

0xa869

43113

Avalanche Fuji Test

0x2019

8217

Klaytn Cypress (Mainnet)

0x3e9

1001

Klaytn Baobab Test

0x89

137

Polygon Mainnet (Mainnet)

0x13881

80001

Polygon Mumbai Test

PreviousBiport 감지하기Next사용자의 계정 접근하기

Last updated 2 years ago