|
| 1 | +--- |
| 2 | +title: Integrate Web3Auth with the Chiliz Blockchain in React Native |
| 3 | +sidebar_label: React Native |
| 4 | +image: "banners/chiliz.png" |
| 5 | + |
| 6 | +keywords: [react-native, chiliz, web3auth, authentication, blockchain] |
| 7 | +description: |
| 8 | + "Integrate Web3Auth with the Chiliz Blockchain in React Native | Documentation - Web3Auth" |
| 9 | +--- |
| 10 | + |
| 11 | +import InstallationSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-installation.mdx"; |
| 12 | +import GetAccountSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-get-account.mdx"; |
| 13 | +import UserInfoSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-user-info.mdx"; |
| 14 | +import GetBalanceSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-get-balance.mdx"; |
| 15 | +import InitialisationSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-initialisation.mdx"; |
| 16 | +import SignMessageSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-sign-message.mdx"; |
| 17 | +import SendTransactionSnippet from "@site/src/common/docs/react-native-connect-blockchain/_evm-send-transaction.mdx"; |
| 18 | +import Tabs from "@theme/Tabs"; |
| 19 | +import TabItem from "@theme/TabItem"; |
| 20 | +import SEO from "@site/src/components/SEO"; |
| 21 | + |
| 22 | +<SEO |
| 23 | + title="Integrate Web3Auth with the Chiliz Blockchain in React Native" |
| 24 | + description="Integrate Web3Auth with the Chiliz Blockchain in React Native | Documentation - Web3Auth" |
| 25 | + image="https://web3auth.io/docs/banners/chiliz.png" |
| 26 | + slug="/connect-blockchain/evm/chiliz/react-native" |
| 27 | +/> |
| 28 | + |
| 29 | +While using the Web3Auth React Native SDK, you get a |
| 30 | +[`EIP1193`](https://eips.ethereum.org/EIPS/eip-1193) provider, similar to the |
| 31 | +[Metamask Provider](https://docs.metamask.io/guide/ethereum-provider.html). This provider can be |
| 32 | +used with libraries like [`web3.js`](https://web3js.readthedocs.io/en/v1.2.8/getting-started.html), |
| 33 | +[`ethers.js`](https://docs.ethers.io/v5/getting-started/) etc. to make |
| 34 | +[Chiliz Blockchain](https://www.chiliz.com) blockchain calls like getting the user's `account`, |
| 35 | +fetching `balance`, signing transactions, sending transactions, and interacting with smart |
| 36 | +contracts. We have highlighted a few key examples to get you started quickly on that. |
| 37 | + |
| 38 | +## Installation |
| 39 | + |
| 40 | +<InstallationSnippet /> |
| 41 | + |
| 42 | +## Initializing Provider |
| 43 | + |
| 44 | +Using `eip155` as `chainNamespace` while initializing `web3auth` will provide an |
| 45 | +[`EIP1193`](https://eips.ethereum.org/EIPS/eip-1193) compatible provider as **`web3auth.provider`** |
| 46 | +after successful authentication. |
| 47 | + |
| 48 | +### Getting the `chainConfig` |
| 49 | + |
| 50 | +<Tabs |
| 51 | + defaultValue="mainnet" |
| 52 | + values={[ |
| 53 | + { label: "Mainnet", value: "mainnet", }, |
| 54 | + { label: "Testnet", value: "testnet", }, |
| 55 | + ]} |
| 56 | +> |
| 57 | +<TabItem |
| 58 | + value="mainnet" |
| 59 | +> |
| 60 | + |
| 61 | +```typescript |
| 62 | +const chainConfig = { |
| 63 | + chainNamespace: ChainNamespace.EIP155, |
| 64 | + chainId: "0x15B38", // hex of 88888, Chiliz Mainnet |
| 65 | + rpcTarget: "https://rpc.ankr.com/chiliz", |
| 66 | + // Avoid using public rpcTarget in production. |
| 67 | + // Use services like Infura, Quicknode, etc. |
| 68 | + displayName: "Chiliz Mainnet", |
| 69 | + blockExplorer: "https://chiliscan.com", |
| 70 | + ticker: "CHZ", |
| 71 | + tickerName: "Chiliz", |
| 72 | +}; |
| 73 | +``` |
| 74 | + |
| 75 | +</TabItem> |
| 76 | + |
| 77 | +<TabItem |
| 78 | + value="testnet" |
| 79 | +> |
| 80 | + |
| 81 | +```typescript |
| 82 | +const chainConfig = { |
| 83 | + chainNamespace: ChainNamespace.EIP155, |
| 84 | + chainId: "0x15B42", // hex of 88882, Chiliz Spicy Testnet |
| 85 | + rpcTarget: "https://spicy-rpc.chiliz.com/", |
| 86 | + // Avoid using public rpcTarget in production. |
| 87 | + // Use services like Infura, Quicknode, etc. |
| 88 | + displayName: "Chiliz Spicy Testnet", |
| 89 | + blockExplorer: "https://testnet.chiliscan.com/", |
| 90 | + ticker: "CHZ", |
| 91 | + tickerName: "Chiliz (Testnet)", |
| 92 | +}; |
| 93 | +``` |
| 94 | + |
| 95 | +</TabItem> |
| 96 | +</Tabs> |
| 97 | + |
| 98 | +## Initialize |
| 99 | + |
| 100 | +<InitialisationSnippet /> |
| 101 | + |
| 102 | +## Get User Info |
| 103 | + |
| 104 | +<UserInfoSnippet /> |
| 105 | + |
| 106 | +## Get Account |
| 107 | + |
| 108 | +<GetAccountSnippet /> |
| 109 | + |
| 110 | +## Get Balance |
| 111 | + |
| 112 | +<GetBalanceSnippet /> |
| 113 | + |
| 114 | +## Send Transaction |
| 115 | + |
| 116 | +<SendTransactionSnippet /> |
| 117 | + |
| 118 | +## Sign a message |
| 119 | + |
| 120 | +<SignMessageSnippet /> |
0 commit comments