skalenetwork / docs.skale.space

https://docs.skale.space/
MIT License
1 stars 2 forks source link

Using Web3Auth #37

Closed manuelbarbas closed 5 months ago

manuelbarbas commented 11 months ago

WITH BUG: Can't connect to SKALE Chains. Need to check

Web3Auth

Pluggable wallet infrastructure for Web3 wallets and applications. It streamlines the onboarding of both mainstream and crypto native users in under a minute by providing experiences that they're most comfortable with.

Web3Auth's MPC-based wallet management infrastructure provides secure, non-custodial wallet management, where users maintain control of their cryptographic key pair. The login service only accesses a single share, preventing the provider from retrieving the user's wallet independently.

Implementation Example

NPM Packages

npm install --save @web3auth/modal

Client ID Get your client ID under https://dashboard.web3auth.io/

Implementation code

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: "0x50877ed6",
    rpcTarget: "https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix",
    // Avoid using public rpcTarget in production.
    // Use services like Infura, Quicknode etc
    displayName: "SKALE Chaos Testnet",
    blockExplorer: "https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com/",
    ticker: "sFUEL",
    tickerName: "sFUEL",
  },
});
await web3auth.initModal();

const web3authProvider = await web3auth.connect();

const web3 = new Web3(web3authProvider);

Integration Errors

In case of encountering polyfill related issues check the Web3auth troubleshooting page about this topic

manuelbarbas commented 9 months ago

What is: Wallet Language: Javascript, Typescript, C#, Kotlin, Swift, Flutter Target: Web, Mobile (Android and IOS), Unity, Unreal