Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: blockchains integration #20

Merged
merged 14 commits into from
Mar 20, 2024
147 changes: 51 additions & 96 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,24 +541,55 @@ function sidebarHome() {
link: "/developers/blockchains-integration",
},
{
text: "Akash (AKT)",
link: "/developers/akash",
},
{
text: "Arbitrum (AETH)",
link: "/developers/arbitrum",
},
{
text: "Aurora (AURORA)",
link: "/developers/aurora",
},
{
text: "Avalanche (AVAX)",
link: "/developers/avalanche",
},
{
text: "Axelar (AXL)",
link: "/developers/axelar",
text: "EVM's",
link: "/developers/ethereum",
collapsed: true,
items: [
{
text: "Ethereum(ETH)",
link: "/developers/ethereum",
},
{
text: "Arbitrum(AETH)",
link: "/developers/arbitrum",
},
{
text: "Aurora (AURORA)",
link: "/developers/aurora",
},
{
text: "Avalanche (AVAX)",
link: "/developers/avalanche",
},
{
text: "BNB Smart Chain (BNB)",
link: "/developers/bnb-smart-chain",
},
{
text: "Canto (CANTO)",
link: "/developers/canto",
},
{
text: "Cronos (CRO)",
link: "/developers/cronos",
},
{
text: "Fantom (FTM)",
link: "/developers/fantom",
},
{
text: "Gnosis (xDAI)",
link: "/developers/gnosis",
},
{
text: "Optimism (ETH)",
link: "/developers/optimism",
},
{
text: "Polygon (MATIC)",
link: "/developers/polygon",
},
],
},
{
text: "Bitcoin (BTC)",
Expand All @@ -572,114 +603,38 @@ function sidebarHome() {
text: "BNB Beacon Chain (BNB)",
link: "/developers/bnb-beacon-chain",
},
{
text: "BNB Smart Chain (BNB)",
link: "/developers/bnb-smart-chain",
},
{
text: "Canto (CANTO)",
link: "/developers/canto",
},
{
text: "Cosmos (ATOM)",
link: "/developers/cosmos",
},
{
text: "Crescent (CRE)",
link: "/developers/crescent",
},
{
text: "Cronos (CRO)",
link: "/developers/cronos",
},
{
text: "Dogecoin (DOGE)",
link: "/developers/dogecoin",
},
{
text: "Ethereum (ETH)",
link: "/developers/ethereum",
},
{
text: "Fantom (FTM)",
link: "/developers/fantom",
},
{
text: "Gnosis (xDAI)",
link: "/developers/gnosis",
},
{
text: "Juno (JUNO)",
link: "/developers/juno",
},
{
text: "Kava (KAVA)",
link: "/developers/kava",
},
{
text: "Klaytn (KLAY)",
link: "/developers/klaytn",
},
{
text: "Kujira (KUJI)",
link: "/developers/kujira",
},
{
text: "Litecoin (LTC)",
link: "/developers/litecoin",
},
{
text: "Mars (MARS)",
link: "/developers/mars",
},
{
text: "Maya Protocol (MAYA)",
link: "/developers/maya",
},
{
text: "Near Protocol (NEAR)",
text: "NEAR (NEAR)",
link: "/developers/near",
},
{
text: "Optimism (ETH)",
link: "/developers/optimism",
},
{
text: "Osmosis (OSMO)",
link: "/developers/osmosis",
},
{
text: "Polygon (MATIC)",
link: "/developers/polygon",
},
{
text: "Sei Testnet (SEI)",
link: "/developers/sei",
},
{
text: "Solana (SOL)",
link: "/developers/solana",
},
{
text: "Stargaze (STARS)",
link: "/developers/stargaze",
},
{
text: "Stride (STRD)",
link: "/developers/stride",
},
{
text: "Terra (LUNA)",
link: "/developers/terra",
},
{
text: "THORChain (RUNE)",
text: "Thorchain (RUNE)",
link: "/developers/thorchain",
},
{
text: "Tron (TRX)",
link: "/developers/tron",
},
],
},
],
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ making a pull request.

## Directory Structure

- /.vitepress: Configuration files for the VitePress site.
- /about: A category for learning more about XDEFI Technologies and $XDEFI token.
- /campaigns: A category for Campaigns Service API
- /developers: A category with tutorials and guides for deploying
dApps and connect with XDEFI Wallet.
- /routing: Technical reference materials for integrating our Routing aggregator API.
<!-- * /guides [WIP]: In-depth articles that cover specific topics in detail. -->
- /community: A category for the XDEFI community.
- /public: Images, diagrams, and other media files used in the documentation.
- /components: Custom components used in the documentation.

## Feedback & Suggestions

Expand Down
51 changes: 51 additions & 0 deletions components/DetectWallet.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useState } from "react";

const DetectWallet = ({ chainId }) => {
const [address, setAddress] = useState(undefined);

const detectWallet = async () => {
if (window.xfi) {
if (!window.xfi[chainId]) {
alert("XDEFI Wallet not connected to the correct network!");
return;
}
if (chainId === "ethereum") {
await window.ethereum
.request({ method: "eth_requestAccounts" })
.then((accounts) => setAddress(accounts[0]));
return;
}
await window.xfi[chainId].request(
{ method: "request_accounts", params: [] },
(error, accounts) => setAddress(accounts[0]),
);
} else {
alert("XDEFI Wallet not detected!");
}
};

return (
<>
<div className="flex justify-center">
<button
className="flex justify-center items-center gap-2 bg-[#2770CB] text-white px-2 py-1 rounded"
onClick={detectWallet}
>
Detect Wallet
</button>
</div>
{address && (
<div className="my-4 rounded-lg max-h-[600px] overflow-auto bg-[#F6F6F7] text-[#24292E] dark:bg-[#161618] dark:text-[#E1E4E8]">
<div className="px-5 border-b border-[#e2e2e3] dark:border-black">
<span className="inline-block border-b-2 border-[#3451b2] dark:border-[#a8b1ff] text-[14px] leading-[48px]">
Address
</span>
</div>
<pre className="p-5">{address}</pre>
</div>
)}
</>
);
};

export default DetectWallet;
Loading
Loading