E Money Network
  • Introduction to E Money Network
  • Add E Money Network to Metamask
  • Wallet Integration
  • E-Money Tokens
  • E Money Network Mainnet and Testnet Explorer​
  • E Money Network Faucet
  • E Money Network Whitelist
  • Launching Your Dapp on E Money Network
    • Developing and Deploying Contracts​
    • Contract Verification​
    • Contract Security Checks
  • Validating on E Money Network
    • Validator nodes
    • How to run a validator node on E Money Network
    • Running Validator Node
    • EMYC Token’s Utility & Purpose
    • Install Validator node​
  • Tendermint & EVMOS
    • ABCI Overview
      • Intro to ABCI
      • Motivation
    • Gas & Fees
      • How are Gas and Fees Handled on E Money Network?​
      • Gas calculation and Transaction execution on E Money Network
    • Keyring
    • Signing
    • Transactions
    • A Note on Determinism
    • Consensus Overview
  • E Money Card FAQs
    • Is a Know Your Customer (KYC) process required to obtain an E Money Card?
    • What details are required for the KYC process?
    • Do I need to create an E Money Wallet to order an E Money Card?
    • What happens if I lose my seed phrase?
    • What happens if I forget my password?
    • How do I order an E Money Card, and are there any costs?
    • Can I have the card shipped to a different address than the one I provided during KYC?
    • My card has been delivered, what’s next?
    • What should I consider before using the E Money Card for payments?
    • Where can I use the E Money Card?
    • Can I add the E Money Card to online payment services like Google Pay and Apple Pay?
    • Which countries’ citizens are eligible to apply for an E Money Card?
    • Are there any fees I should be aware of as a user?
    • How do taxes apply when using the E Money Card?
  • E Money Card Fees
  • Branding and Logos
Powered by GitBook
On this page

Wallet Integration

This integration document serves as a reference for developers building dApps that utilize RainbowKit and intend to support the E Money Wallet. While RainbowKit provides a foundation, some UI Kits might have additional considerations.

Prerequisites

This integration guide assumes you have a RainbowKit (https://www.rainbowkit.com/docs/introduction) project set up in your application.

You can use any other alternative to the RainbowKit.

Installation

Bash

npm install @rainbow-me/rainbowkit @rainbow-me/rainbowkit/wallets 
wagmi @tanstack/react-query

Define the EMoney Testnet Chain

The code utilizes a custom chain definition for the EMoney Testnet. You'll need to create a similar definition for your desired EMoney Network (Mainnet, Testnet, etc.) following this structure:

JavaScript

import { defineChain } from "viem";

export const emoneyTestnet = defineChain({
  id: 4544,
  name: "EMoney Testnet",
  network: "emoney-testnet",
  // ... other chain properties
});

Create the EMoney Wallet Definition

Define a Wallet object representing the EMoney Wallet in your application. This object specifies details like the wallet's ID, name, icons, mobile/extension integration instructions, and the connector creation function.

EMoney Provider: (enkrypt.providers.ethereum)

The provided code checks for injected EMoney providers and uses the WalletConnect connector as a fallback. You can adjust this logic based on your preference.

JavaScript

import { getInjectedConnector, hasInjectedProvider } from "@/lib/rainbowUtils";
import { getWalletConnectConnector, Wallet } from "@rainbow-me/rainbowkit";

export const EMoney = ({ projectId }: MyWalletOptions): Wallet => ({
  // ... wallet properties (refer to code for details)
  createConnector: shouldUseWalletConnect
    ? getWalletConnectConnector({
        projectId,
      })
 : getInjectedConnector({
        namespace: "enkrypt.providers.ethereum",
      }),
});

Configure RainbowKit

  • Import the necessary functions from RainbowKit.

  • Define your RainbowKit configuration object (rainbowConfig).

  • Include the custom emoneyTestnet chain and the EMoney wallet in the configuration.

  • Set your projectId obtained from RainbowKit.

JavaScript

import { getDefaultConfig, RainbowKitProvider } from "@rainbow-me/rainbowkit";
import { emoneyTestnet, EMoney } from "./"; // Assuming this file holds your definitions

const rainbowConfig = getDefaultConfig({
  appName: "Recommended",
  projectId: "YOUR_RAINBOWKIT_PROJECT_ID",
  chains: [emoneyTestnet, holesky], // Add your desired chains
  ssr: true,
  wallets: [
    {
      groupName: "Installed",
      wallets: [EMoney],
    },
  ],
});

Wrap your Application with Providers

Create a component named Providers that wraps your application with the necessary providers:

WagmiProvider: Provides a context for Wagmi functionalities.

QueryClientProvider: Manages data fetching with React Query.

RainbowKitProvider: Initializes RainbowKit with your configuration.

JavaScript

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactNode } from "react";
import { WagmiProvider } from "wagmi";

const queryClient = new QueryClient();

const Providers = ({ children }: { children: ReactNode }) => {
  return (
    <WagmiProvider config={rainbowConfig as any}>
<QueryClientProvider client={queryClient}>
        <RainbowKitProvider>{children}</RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
};

export default Providers;

Usage in your Application

Import the Providers component and wrap your application with it to enable RainbowKit and the EMoney Wallet integration.

JavaScript

import Providers from "./Providers";

function MyDApp() {
  // ... your application logic
}

function App() {
  return (
    <Providers>
      <MyDApp />
    </Providers>
  );
}

Congratulations! You've integrated the E Money Wallet.

(Successful E Money Wallet integration might require further customizations tailored to your specific application logic.)

For any questions or if you require further assistance, please don't hesitate to contact E Money support at support@emoney.com

PreviousAdd E Money Network to MetamaskNextE-Money Tokens

Last updated 4 months ago