# Internal Wallet Services

Tomo provides a few internal wallet services to wallet users so developers can selectively embed these services into their applications with minimum effort. <mark style="color:red;">**Currently, these features are only available for users using social login, and users can only operate through a pop-up Tomo UI component.**</mark> We will add support for extension wallet users and provide more configurable ways to invoke these services.

### Service Types

Tomo supports the following basic service types:

```tsx
enum WebWalletInvokeType {
  SWAP = "swap",             // Swap between selected token pairs
  ONRAMP = "onramp",         // Purchase Token by card
  SEND = "send",             // Send token to a given address
  RECEIVE = "receive",       // Display QR code and address for given token
}
```

#### Modals for Internal Services

<img src="/files/43k6AFoXtz1TYLXel4Bz" alt="Modals for Onramp Services" class="gitbook-drawing">

<img src="/files/1CbAgEXwtEEHDa8XYvn6" alt="Modals for Swap Services" class="gitbook-drawing">

### Invoke Services

```tsx
import { TomoEVMKitProvider, WebWalletInvokeType} from "@tomo-inc/tomo-evm-kit";

const handleAction = async (type: WebWalletInvokeType) => {
     // Take SDK from the provider core
    const provider = (await connector?.getProvider());
    const tomoSDK = provider?.core;
    try {
      tomoSDK?.handleWebWalletInvoke(type);
    } catch (e) {
      console.log("handleAction error:", e);
    }
  };

//your app logic
...
<button onClick={() => handleAction(WebWalletInvokeType.SWAP)}>
        Swap
      </button>
```

#### Example

```tsx

import { getDefaultConfig, TomoEVMKitProvider, useConnectModal, useAccountModal, useWalletConnectors, WebWalletInvokeType } from "@tomo-inc/tomo-evm-kit";
import { WagmiProvider, useAccount } from "wagmi";
import { mainnet, polygon, optimism, arbitrum, base } from "wagmi/chains";
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";

const ConnectButton = () => {
  const { openConnectModal } = useConnectModal();

  return (
    <button onClick={openConnectModal}>
      Connect Wallet
    </button>
  );
};

const OrderComponent = () => {

  const { connector } = useAccount();

  const handleAction = async (type: WebWalletInvokeType) => {
     // get sdk instance
    const provider = (await connector?.getProvider());
    const tomoSDK = provider?.core;
    try {
      tomoSDK?.handleWebWalletInvoke(type);
    } catch (e) {
      console.log("handleAction error:", e);
    }
  };

  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
      <h1>EVMKit Demo</h1>
      <button onClick={() => handleAction(WebWalletInvokeType.ONRAMP)}>
        Onramp
      </button>
      <button onClick={() => handleAction(WebWalletInvokeType.SWAP)}>
        Swap
      </button>
      <button onClick={() => handleAction(WebWalletInvokeType.SEND)}>
        Send
      </button>
      <button onClick={() => handleAction(WebWalletInvokeType.RECEIVE)}>
        Receive
      </button>
    </div>
  );
};

export default function EVMKitPage() {
  const config = getDefaultConfig({
    clientId:
      "YOUR_CLIENT_ID", // Replace with your clientId
    appName: "My TomoEVMKit App",
    projectId: "YOUR_PROJECT_ID", // Note: Every dApp that relies on WalletConnect now needs to obtain a projectId from WalletConnect Cloud.
    chains: [mainnet, polygon, optimism, arbitrum, base],
    ssr: true, // If your dApp uses server-side rendering (SSR)
  });

  const queryClient = new QueryClient();

  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={queryClient}>
        <TomoEVMKitProvider>
          <ConnectButton />
          <OrderComponent />
        </TomoEVMKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tomo.inc/tomo-sdk/tomoevmkit/internal-wallet-services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
