Does web3auth support NEAR blockchain?

Asked by gmist#6034 on Discord.



Originally posted by: shahbaz17

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/470

Yes, Web3Auth does support NEAR as it is blockchain agnostics.

Simply use the below code to create web3auth.provider:

https://dashboard.web3auth.io)
chainConfig: {
chainNamespace: "other",
rpcTarget: "Ankr | The Fastest Web3 Infrastructure,
displayName: "NEAR",
blockExplorer: "https://explorer.near.org/",
ticker: "NEAR",
tickerName: "NEAR",
},
});

const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
clientId,
network: "testnet",
uxMode: "popup",
},
});
web3auth.configureAdapter(openloginAdapter);

await web3auth.initModal();

const web3authProvider = web3auth.connect(); // web3auth.provider">

import { Web3Auth } from @web3auth/web3auth”;
import { OpenloginAdapter } from @web3auth/openlogin-adapter”;

const web3auth = new Web3Auth({
clientId: “YOUR_CLIENT_ID”, // get it from Web3Auth Dashboard(https://dashboard.web3auth.io)
chainConfig: {
chainNamespace: “other”,
rpcTarget: https://rpc.ankr.com/near,
displayName: “NEAR”,
blockExplorer: https://explorer.near.org/,
ticker: “NEAR”,
tickerName: “NEAR”,
},
});

const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
clientId,
network: “testnet”,
uxMode: “popup”,
},
});
web3auth.configureAdapter(openloginAdapter);

await web3auth.initModal();

const web3authProvider = web3auth.connect(); // web3auth.provider

Next, get the User's Private Key using the below code:

async getPrivateKey() {
  // web3authProvider is web3auth.provider
  const privateKey = await web3authProvider.request({
      method: "private_key"
  });
    // Fetch Address, do transactions with privateKey on NEAR Blockchain
}

Use https://www.npmjs.com/package/near-api-js to interact with NEAR.



Originally posted by: shahbaz17