🧑‍💻 Blockchain Network

getNetwork()

Face Wallet SDK provides the current blockchain network set in Face object.

import { Face, Network } from '@haechi-labs/face-sdk';

const face = new Face({
  network: Network.GOERLI, 
  apiKey: 'YOUR_DAPP_API_KEY'
});
const currentNetwork = face.getNetwork();

getChainId()

Face Wallet SDK provides the chain id of the current blockchain network of Face object.

import { Face, Network } from '@haechi-labs/face-sdk';

const face = new Face({
  network: Network.GOERLI, 
  apiKey: 'YOUR_DAPP_API_KEY'
});
const chainId = await face.getChainId();

switchNetwork()

Since Face object cannot be initialized several times, Face Wallet SDK provides a method that can change the blockchain network of already initialized Face object.

import { Face, Network } from '@haechi-labs/face-sdk';

const face = new Face({
  network: Network.GOERLI, 
  apiKey: 'YOUR_DAPP_API_KEY'
});
await face.switchNetwork(Network.MUMBAI);