-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into guides-update
- Loading branch information
Showing
14 changed files
with
2,564 additions
and
50 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,316 @@ | ||
--- | ||
title: Integrate Web3Auth with the zKatana Blockchain | ||
sidebar_label: zKatana | ||
image: "content-hub/guides/banners/zkatana.png" | ||
displayed_sidebar: docs | ||
keywords: [zkatana, blockchain, web3auth] | ||
description: "Integrate Web3Auth with the zKatana Blockchain | Documentation - Web3Auth" | ||
--- | ||
|
||
import InstallationSnippet from "@site/src/common/docs/_evm-installation.mdx"; | ||
import GetUserInfoSnippet from "@site/src/common/docs/_get-userinfo.mdx"; | ||
import GetAccountAndBalanceSnippet from "@site/src/common/docs/_evm-get-account-n-balance.mdx"; | ||
import SendTransactionSnippet from "@site/src/common/docs/_evm-send-transaction.mdx"; | ||
import SignTransactionSnippet from "@site/src/common/docs/_evm-sign-transaction.mdx"; | ||
import SignPersonalMessageSnippet from "@site/src/common/docs/_evm-sign-message-personal-sign.mdx"; | ||
import SignTypedDataV1Snippet from "@site/src/common/docs/_evm-sign-message-v1.mdx"; | ||
import SignTypedDataV3Snippet from "@site/src/common/docs/_evm-sign-message-v3.mdx"; | ||
import SignTypedDataV4Snippet from "@site/src/common/docs/_evm-sign-message-v4.mdx"; | ||
import SmartContractSoliditySnippet from "@site/src/common/docs/_smart-contract-solidity.mdx"; | ||
import DeployContractSolidityDeploySnippet from "@site/src/common/docs/_smart-contract-solidity-deploy.mdx"; | ||
import DeployContractSolidityReadSnippet from "@site/src/common/docs/_smart-contract-solidity-read.mdx"; | ||
import DeployContractSolidityWriteSnippet from "@site/src/common/docs/_smart-contract-solidity-write.mdx"; | ||
import FetchUserPrivateKeySnippet from "@site/src/common/docs/_evm-fetch-user-private-key.mdx"; | ||
import TabItem from "@theme/TabItem"; | ||
import Tabs from "@theme/Tabs"; | ||
|
||
While using the Web3Auth Web SDK, you get a [`EIP1193`](https://eips.ethereum.org/EIPS/eip-1193) provider, similar to the | ||
[Metamask Provider](https://docs.metamask.io/guide/ethereum-provider.html). This provider can be used with libraries like | ||
[`web3.js`](https://web3js.readthedocs.io/en/v1.2.8/getting-started.html), [`ethers.js`](https://docs.ethers.io/v5/getting-started/) etc. to make | ||
[zKatana](https://astar.network/) blockchain calls like getting the user's `account`, fetching `balance`, `sign transaction`, `send transaction`, | ||
`read` from and `write` to the smart contract, etc. We have highlighted a few here to get you started quickly on that. | ||
|
||
:::info | ||
|
||
This reference is for the `Web`, however, you can use zKatana on `Android`, `iOS`, `React Native`, `Flutter`, & `Unity` as well. Please follow our | ||
reference for [Ethereum](/connect-blockchain/ethereum/), and change the RPC Provider URL & configurations corresponding to zKatana. | ||
|
||
::: | ||
|
||
## Installation | ||
|
||
To interact with the zKatana blockchain, you can use either [web3.js](https://web3js.readthedocs.io/en/v1.2.8/getting-started.html) or | ||
[ethers.js](https://docs.ethers.io/v5/getting-started/) libraries with Web3Auth. | ||
|
||
<InstallationSnippet /> | ||
|
||
## Initializing Provider (zKatana) | ||
|
||
### Testnet | ||
|
||
Testnet Block Explorer URL: https://zkatana.blockscout.com | ||
|
||
<Tabs | ||
defaultValue="web3" | ||
values={[ | ||
{ label: "web3.js", value: "web3" }, | ||
{ label: "ethers.js", value: "ethers" }, | ||
]} | ||
> | ||
<TabItem value="web3"> | ||
|
||
<Tabs | ||
defaultValue="es" | ||
values={[ | ||
{ label: "ES Modules", value: "es" }, | ||
{ label: "TypeScript", value: "ts" }, | ||
{ label: "CommonJS", value: "js" }, | ||
]} | ||
> | ||
<TabItem value="es"> | ||
|
||
```tsx | ||
import { Web3Auth } from "@web3auth/modal"; | ||
import Web3 from "web3"; | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const web3 = new Web3(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="ts"> | ||
|
||
```tsx | ||
import { Web3Auth } from "@web3auth/modal"; | ||
import { CHAIN_NAMESPACES } from "@web3auth/base"; | ||
import Web3 from "web3"; | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const web3 = new Web3(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="js"> | ||
|
||
```tsx | ||
const { Web3Auth } = require("@web3auth/modal"); | ||
const Web3 = require("web3"); | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const web3 = new Web3(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</TabItem> | ||
<TabItem value="ethers"> | ||
|
||
<Tabs | ||
defaultValue="es" | ||
values={[ | ||
{ label: "ES Modules", value: "es" }, | ||
{ label: "TypeScript", value: "ts" }, | ||
{ label: "CommonJS", value: "js" }, | ||
]} | ||
> | ||
<TabItem value="es"> | ||
|
||
```tsx | ||
import { Web3Auth } from "@web3auth/modal"; | ||
import { ethers } from "ethers"; | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const provider = new ethers.providers.Web3Provider(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="ts"> | ||
|
||
```tsx | ||
import { Web3Auth } from "@web3auth/modal"; | ||
import { CHAIN_NAMESPACES } from "@web3auth/base"; | ||
import { ethers } from "ethers"; | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const provider = new ethers.providers.Web3Provider(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="js"> | ||
|
||
```tsx | ||
const { Web3Auth } = require("@web3auth/modal"); | ||
const ethers = require("ethers"); | ||
|
||
const web3auth = new Web3Auth({ | ||
clientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", // get it from Web3Auth Dashboard | ||
web3AuthNetwork: "sapphire_mainnet", | ||
chainConfig: { | ||
chainNamespace: "eip155", | ||
chainId: "0x133120", // hex of 1261120 | ||
rpcTarget: "https://rpc.zkatana.gelato.digital", | ||
// Avoid using public rpcTarget in production. | ||
// Use services like Infura, Quicknode etc | ||
displayName: "zKatana Testnet", | ||
blockExplorer: "https://zkatana.blockscout.com", | ||
ticker: "ETH", | ||
tickerName: "ETH", | ||
}, | ||
}); | ||
await web3auth.initModal(); | ||
|
||
const web3authProvider = await web3auth.connect(); | ||
|
||
const provider = new ethers.providers.Web3Provider(web3authProvider); // web3auth.provider | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Get User Info | ||
|
||
<GetUserInfoSnippet /> | ||
|
||
## Get Account and Balance | ||
|
||
<GetAccountAndBalanceSnippet /> | ||
|
||
## Send Transaction | ||
|
||
<SendTransactionSnippet /> | ||
|
||
## Sign Transaction | ||
|
||
<SignTransactionSnippet /> | ||
|
||
## Sign Message | ||
|
||
### Personal Sign | ||
|
||
<SignPersonalMessageSnippet /> | ||
|
||
### Sign Typed Data v1 | ||
|
||
<SignTypedDataV1Snippet /> | ||
|
||
### Sign Typed Data v3 | ||
|
||
<SignTypedDataV3Snippet /> | ||
|
||
### Sign Typed Data v4 | ||
|
||
<SignTypedDataV4Snippet /> | ||
|
||
## Smart Contract | ||
|
||
<SmartContractSoliditySnippet /> | ||
|
||
### Deploy Contract | ||
|
||
<DeployContractSolidityDeploySnippet /> | ||
|
||
### Read From Contract | ||
|
||
<DeployContractSolidityReadSnippet /> | ||
|
||
### Write to Contract | ||
|
||
<DeployContractSolidityWriteSnippet /> | ||
|
||
## Fetch User's Private Key | ||
|
||
<FetchUserPrivateKeySnippet /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.