Drag the ParticleWalletGUI.prefab to your first scene(Required)
Init
It is required before call other method, you can define your app info as a metadata or user the default value, metadata is used for wallet connect.
var metadata =newDAppMetaData("Particle Connect","https://connect.particle.network/icons/512.png","https://connect.particle.network");ChainInfo chainInfo =newAvalancheChain(AvalancheChainId.Mainnet);// Init and set default chain info.ParticleNetwork.Init(chainInfo);ParticleConnectInteraction.Init(chainInfo, metadata);// The following methods are optional, used for configure your project.// Set support chain info array. you can set a chain info array, default value is all chains.ParticleWalletGUI.SupportChain(new []{chainInfo});// Disable buy.ParticleWalletGUI.EnablePay(false);// Disable testnet if release.ParticleWalletGUI.ShowTestNetwork(false);// Disable wallet manage page if you only support one wallet.ParticleWalletGUI.ShowManageWallet(false);// Use this method to control dark mode or light mode. you can call this method with your button.ParticleNetwork.SetInterfaceStyle(UserInterfaceStyle.DARK);// Manage Tokens and NFTs, set show only native and your tokens, NFTs, don't show other tokens and NFTs.ParticleWalletGUI.SetDisplayTokenAddresses(new []{"Your token address"});ParticleWalletGUI.SetDisplayNFTContractAddresses(new []{"Your nft address"});// Manage Tokens and NFTs, set priority tokens and NFTs. ParticleWalletGUI.SetPriorityTokenAddresses(new []{"Your token address"});ParticleWalletGUI.SetPriorityNFTContractAddresses(new []{"Your nft address"});// Control if show add button in wallet page.ParticleWalletGUI.SetSupportAddToken(false);// Control if support wallet connect as a walletParticleWalletGUI.SupportWalletConnect(false)// Control if show dapp browser in wallet pageParticleWalletGUI.SupportDappBrowser(false)// Control UI pages native currency symbolParticleWalletGUI.SetFiatCoin("HKD");// Set languageParticleWalletGUI.SetLanguage(Language.KO);// Control if show language setting button in setting page.ParticleWalletGUI.ShowLanguageSetting(true);// Control if show appearance setting button in setting page.ParticleWalletGUI.ShowAppearanceSetting(true);
Migrating to WalletConnect v2
Starting from version 0.14.0, WalletConnectV2 is supported.
var metaData =newWalletMetaData("Particle Connect","https://connect.particle.network/icons/512.png","https://connect.particle.network", description:"","your wallet connect project id");ParticleWalletGUI.ParticleWalletConnectInitialize(metaData);
Navigator Wallet
publicvoidNavigatorWallet(){ // If you want to navigator wallet token, set display to 0 // If you want to navigator wallet NFT, set display to 1int display =0;ParticleWalletGUI.NavigatorWallet(display);}
Navigator Token Receive
publicvoidNavigatorTokenReceive(){ // If you want to test solana, your should replace under value with solana test account. // Navigator to token receive page // This is ChainLink Token in Ethereum Gnerlistring tokenAddress =TestAccount.EVM.TokenContractAddress;ParticleWalletGUI.NavigatorTokenReceive(tokenAddress);}
Navigator Token Send
publicvoidNavigatorTokenSend(){ // If you want to test solana, your should replace under value with solana test account. // This is ChainLink Token in Ethereum Gnerlistring tokenAddress =TestAccount.EVM.TokenContractAddress; // Another receiver addressstring toAddress =TestAccount.EVM.ReceiverAddress; // Send amountstring amount ="1000000000";ParticleWalletGUI.NavigatorTokenSend(tokenAddress, toAddress, amount);}
Navigator Token Transaction Records
publicvoidNavigatorTokenTransactionRecords(){ // If you want to test solana, your should replace under value with solana test account. // This is ChainLink Token in Ethereum Gnerlistring tokenAddress =TestAccount.EVM.TokenContractAddress;ParticleWalletGUI.NavigatorTokenTransactionRecords(tokenAddress);}
Navigator NFT Send
publicvoidNavigatorNFTSend(){ // If you want to test solana, your should replace under value with solana test account. // This is a test NFTstring mint =TestAccount.EVM.NFTContractAddress;string tokenId =TestAccount.EVM.NFTTokenId;string receiveAddress ="";ParticleWalletGUI.NavigatorNFTSend(mint, tokenId, receiveAddress);}
Navigator NFT Details
publicvoidNavigatorNFTDetails(){ // If you want to test solana, your should replace under value with solana test account. // This is a test NFTstring mint =TestAccount.EVM.NFTContractAddress;string tokenId =TestAccount.EVM.NFTTokenId;ParticleWalletGUI.NavigatorNFTDetails(mint, tokenId);}
Navigator Buy Crypto
publicvoidNavigatorBuyCrypto(){ // buy crypto with parametersBuyCryptoConfig config =newBuyCryptoConfig(TestAccount.EVM.PublicAddress,OpenBuyNetwork.BinanceSmartChain,"BNB","USD",100);ParticleWalletGUI.NavigatorBuyCrypto(config); // also support buy crypto without parametersParticleWalletGUI.NavigatorBuyCrypto();}