🧑‍💻 Blockchain Network

getAddress()

Face Wallet SDK provides the wallet address.

import { Face } from '@haechi-labs/face-react-native-sdk';
import { Network } from '@haechi-labs/face-types';

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

const addresses = face.getAddresses();

getNetwork()

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

import { Face } from '@haechi-labs/face-react-native-sdk';
import { Network } from '@haechi-labs/face-types';

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

const currentNetwork = face.getNetwork();

getChainId()

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

import { Face } from '@haechi-labs/face-react-native-sdk';
import { Network } from '@haechi-labs/face-types';

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

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 } from '@haechi-labs/face-react-native-sdk';
import { Network } from '@haechi-labs/face-types';

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

await face.switchNetwork(Network.MUMBAI);

🚧

If you initialized the Face object with Testnet, you can change network to Testnet. Likewise, If you initialized the Face object with Mainnet, you can change network to Mainnet.