Skip to content

stream-protocol/payment-dapp

Repository files navigation

StreamPay - Send and Receive Digital Money Around The World

Powered by Solana, StreamPay helps you conveniently send and receive money in an instant without any hassle. You only need to simply connect your Wallet to get started.

Description

Cross-border payments refer to transactions involving individuals, companies, banks, or settlement institutions operating in at least two different countries and are international transactions. These payments are inclusive of retail and wholesale transactions.

Creating a full source code for a complex application like the one described, including wallet integration, transaction handling, real-time value and exchange rates, and more, is beyond the scope of a single response. However, I can provide you with a detailed code structure and guidance on how to implement each part of Stream Payment application. Please note that this will be a lengthy process, and you might need to refer to documentation and external resources for some specific tasks.

Setting Up the Project

  1. Create a Next.js Project:

    npx create-next-app stream-payment-app
    cd stream-payment-app
  2. Install Dependencies:

    npm install @solana/wallet-adapter-react @solana/wallet-adapter-react-ui @solana/wallet-adapter-base @solana/web3.js bignumber.js
  3. Create the Folder Structure:

    Organize your project into folders like components, pages, and utils to keep things organized.

Wallet Integration

  1. Configure Wallet Adapters:

    Create a custom hook (e.g., useWallet.ts) to manage wallet-related functionality. Configure wallet adapters, connect to the Solana network, and handle wallet states.

  2. Create a WalletProvider Component:

    Wrap your Next.js app with a WalletProvider component. This component should provide wallet-related context to application.

Transaction Handling

  1. Implement Transaction API:

    Create an API route (e.g., transaction.ts) to handle transactions. This route should receive data from the client, create transactions, and return serialized transactions or transaction IDs.

  2. Transaction Logic:

    Within the API route, implement the logic to create Solana transactions. This includes transferring USDC tokens from the buyer to the shop. Make sure to handle errors and edge cases.

Real-Time Data

  1. Fetch Real-Time USDC Data:

    Use a cryptocurrency data API (e.g., CoinGecko or a financial data provider) to fetch real-time USDC value and exchange rates. You can create a utility function (e.g., fetchUSDCData.ts) to make API requests.

  2. Display Real-Time Data:

    Integrate the fetched data into your components (e.g., RecieveMoney.tsx). You can display the current USDC value, exchange rates, and other relevant information.

Components and UI

  1. Create UI Components:

    Build React components for different parts of your application, such as the transaction form, wallet connection button, and real-time data display.

  2. Styling:

    Apply styling to your components using CSS, a CSS-in-JS library, or a component library like Tailwind CSS.

Testing and Deployment

  1. Testing:

    Test your application thoroughly, especially the transaction-related functionality. Use testing libraries like Jest and React Testing Library.

  2. Deployment:

    Deploy your Next.js application to a hosting provider of your choice (e.g., Vercel, Netlify, or a custom server).

Additional Features

  1. Fee/Tax Wallet Address:

    Implement an option to specify a fee or tax wallet address during transactions.

  2. Donation (Donate Wallet):

    Add an option for users to make donations by providing a donate wallet address.

Please note that each of these steps is a significant task, and you'll need to write detailed code for each part of your application. Additionally, you may need to handle various edge cases and security considerations when dealing with cryptocurrency transactions and wallets.

If you have specific questions or need detailed code examples for any part of this implementation, feel free to ask, and I'll provide further assistance.

Getting Started

Built with Typescript, Next.js (React), Stream Pay / Solana Pay, and Stripe

Clone and run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Table of Contents

Prerequisites

Before you start, make sure you have the following installed on your machine:

Project Structure

The project has the following directory structure:

  • backend/: Contains the Express.js backend code.
  • frontend/: Contains the Next.js frontend code.
  • package.json: Configuration and dependencies for the entire project.
  • tsconfig.json: TypeScript configuration for the project.
  • README.md: This file.

Running the Application

Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or create a pull request.

License

This project is licensed under the MIT License.

About

Send and Receive Digital Money Around The World. Powered by Solana. Application helps you conveniently send and recieve money in an instant without any hassle. You only need to simply connect your Wallet to get started.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors