Having trouble connecting Kukai wallet. I don't understand how to add "preferredNetwork" properly. I was told that is needed for Kukai Wallets. The code works fine for Temple wallet.
Not sure what I am missing here.
If anyone could point me to additional documentation I don't mind reading.
useBeacon.js
import { BeaconWallet } from "@taquito/beacon-wallet";
import { PermissionScope, NetworkType } from "@airgap/beacon-sdk";
import { DEFAULT_NETWORK } from "../../defaults";
const options = {
name: "FA2 deployer",
preferredNetwork: DEFAULT_NETWORK.id,
iconUrl: "https://tezostaquito.io/img/favicon.png",
eventHandlers: {
PERMISSION_REQUEST_SUCCESS: {
handler: async (data) => {
console.log("permission data:", data);
},
},
},
};
const wallet = new BeaconWallet(options);
defaults.js
import { NetworkType } from "@airgap/beacon-sdk";
export const NETWORKS = [
{
id: NetworkType.GRANADANET ,
nextNetworkIndex: 4,
name: "Granadanet",
type: "main",
rpcBaseURL: "https://granadanet.api.tez.ie/",
},
{
id: NetworkType.FLORENCENET,
nextNetworkIndex: 3,
name: "Florencenet",
type: "test",
rpcBaseURL: "https://florencenet.api.tez.ie/",
},
{
id: NetworkType.DELPHINET,
nextNetworkIndex: 1,
name: "Delphinet",
type: "test",
rpcBaseURL: "https://delphinet.smartpy.io/",
},
{
id: NetworkType.EDONET,
nextNetworkIndex: 2,
name: "Edonet",
type: "test",
rpcBaseURL: "https://edonet.smartpy.io/",
},
{
id: NetworkType.MAINNET,
nextNetworkIndex: 0,
name: "Mainnet",
type: "main",
rpcBaseURL: "https://mainnet.smartpy.io",
},
];
export const DEFAULT_NETWORK = NETWORKS[0];
Example says... You should also use the preferredNetwork property that allows you to use the Kukai wallet during development. This property takes the name of the network you want to connect to as a value and this is when we can use the NetworkType enum. https://wiki.tezosagora.org/build/dapp-development/create-your-first-dapp
OSS project here https://github.com/KStasi/fa2-deployer
files I want modifying are here
- src\app\defaults.js
- src\app\components\hooks\useBeacon.js