BARK - Blink Payments facilitates payments and SPL token transfers on the Solana blockchain. This application showcases integration with SOL, USDC, and SPL tokens. It includes endpoints for sending and receiving payments, handling SPL token transactions, and ensuring efficient transaction management.
- Introduction
- Installation
- Development
- Usage
- API Routes
- Components
- Utilities
- Scripts
- Contributing
- License
BARK - Blink Payments facilitates payments and token transfers on the Solana blockchain. This application showcases integration with SOL, USDC, and SPL tokens. It provides endpoints for sending and receiving payments, handling SPL token transactions, and ensuring efficient transaction management.
To set up the project on your local machine, follow these steps:
-
Clone the repository:
git clone https://github.com/barkprotocol/bark-blink-payments.git
-
Navigate to the project directory:
cd bark-blink-payments
-
Install dependencies:
npm install
If using TypeScript, you may also need:
npm install --save-dev typescript @types/react @types/node
To start the development server, use:
npm run dev
This command will start the server on http://localhost:3000, and you can view changes in real-time as you develop.
The project includes API routes for handling payments and token transfers:
/api/receive-payment
: Endpoint to receive payments, supports BARK, SEND, SOL, USDC, and SPL tokens./api/send-token
: Endpoint to send tokens, supports BARK, SEND, SOL, USDC, and SPL tokens.
You can test these endpoints using tools like Postman or directly through the provided web interface.
Components for the application are located in the components/
directory:
components/Header.tsx
: The header component for navigating the application.components/Footer.tsx
: The footer component displayed at the bottom of each page.
Utility functions are in the utils/
directory:
utils/utils.ts
: General utility functions, including URL and fetch handling.utils/helpers.ts
: Functions for specific tasks like interacting with the Solana blockchain and processing payments.
-
processPayment(request: PaymentRequest): Promise<TransactionResponse>
: Handles payments for SOL, USDC, and SPL tokens. The request should include:connection
: Solana blockchain connection object.payer
: PublicKey string of the payer.amount
: Amount to transfer.token
: Token type (SOL, USDC, or SPL token address).
-
processTokenTransfer(request: TokenTransferRequest): Promise<TransactionResponse>
: Handles token transfers for SPL tokens. The request should include:connection
: Solana blockchain connection object.recipient
: PublicKey string of the recipient.amount
: Amount to transfer.token
: SPL token address.
Here are some common scripts you can use:
dev
- Start the development server.build
- Build the application for production.start
- Run the application in production mode.lint
- Lint the codebase.lint:fix
- Automatically fix linting issues.test
- Run the tests.
For example, to build the application for production, use:
npm run build
Contributions are welcome! To contribute:
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Commit your changes:
git commit -m "Describe your changes"
-
Push to the branch:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.