Skip to content

Commit

Permalink
add swap
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbaz17 committed Oct 29, 2024
1 parent 3fc483d commit 104177e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function App() {
addAndSwitchChain,
} = useWeb3Auth();

const { showCheckout, showWalletConnectScanner, showWalletUI, isPluginConnected } = useWalletServicesPlugin();
const { showCheckout, showWalletConnectScanner, showWalletUI, showSwap, isPluginConnected } = useWalletServicesPlugin();
const [unloggedInView, setUnloggedInView] = useState<JSX.Element | null>(null);
const [MFAHeader, setMFAHeader] = useState<JSX.Element | null>(
<div>
Expand Down Expand Up @@ -247,8 +247,8 @@ function App() {
<button
onClick={() => {
if (isPluginConnected) {
uiConsole("Show Checkout doesn't work in Testnet network, please switch to mainnet. Click Add and Switch Chain button first.");
showCheckout({

show: true,
});
}
Expand All @@ -258,6 +258,20 @@ function App() {
Show Checkout
</button>
</div>
<div>
<button
onClick={() => {
if (isPluginConnected) {
showSwap({
show: true,
});
}
}}
className="card"
>
Show Swap
</button>
</div>
<div>
<button onClick={getChainId} className="card">
Get Chain ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import { CHAIN_NAMESPACES, WEB3AUTH_NETWORK } from "@web3auth/base";
import { AuthAdapter } from "@web3auth/auth-adapter";
import { WalletServicesPlugin } from "@web3auth/wallet-services-plugin";
import { getDefaultExternalAdapters, getInjectedAdapters } from "@web3auth/default-evm-adapter";
// import { getDefaultExternalAdapters, getInjectedAdapters } from "@web3auth/default-evm-adapter";

const chainConfig = {
chainId: "0xaa36a7", // for wallet connect make sure to pass in this chain in the loginSettings of the adapter.
Expand Down

0 comments on commit 104177e

Please sign in to comment.