BARK Whitepaper
  • Welcome
  • Executive Summary
  • Abstract
  • Disclaimer
  • About
    • The BARK Protocol
      • Business Model
        • Fee Structure
          • Benefits
      • The Vision of BARK
        • Foundation
  • Introduction
    • Transformative Technology
      • Benefits
  • Markets
    • Global Markets
      • Problem
      • Traditional Finance
        • The Role of Bots
        • Solution
        • Resources
  • Solutions
    • Verifiable Web
      • Features
        • Real-World Use Cases
          • Charitable Donation
          • Tokenized Assets
            • Real-World Asset Token
            • CNFT
              • Implementation
        • Asset Marketplace
          • Benefits
          • System Architecture
      • Advantages
    • Technology
      • Architecture
      • Benefits
  • Ecosystem
    • Strategic Planning
    • Introduction
      • BARK
      • Components
        • Governance
          • Voting
          • Participation
            • Getting Started
          • Treasury
            • Advantages
        • Underdogs
          • Development
            • Members Club´s
              • Mission Statement
                • Tiered Members
                • Responsibilities
                  • Services
              • BARKER
                • Membership
                  • Council
              • The Peaky Barkers
                • Mission
                • Brand
                  • Merchandise
              • Sparky Bros
                • Mission
                • Brand
                  • Merchandise
            • Benefits
            • Marketing
            • Participate
            • FAQ
    • Members Club´s
  • Technology
    • Architecture
      • Tokenization
        • Overview
        • BARK
          • Overview
            • Utility
            • Benefits
            • Advantages
        • BPT Token
        • BRWA: Tokenized Assets
        • BARK Protocol Token
          • Integration
    • Token Standard
      • SPL-404
      • Why Solana
  • Product
    • NFT Marketplace
      • Website
      • FAQ
    • Social Finance
      • Introduction
        • CNFT 404
      • Architecture
        • Components
      • Disbursement
        • Architecture
          • User Interface
            • Features
        • Introduction
          • Use Cases
            • Charity
            • Payments
            • Swap
          • Benefits
    • Crowdfunding Platform
      • About
      • Overview
        • Features
          • Components
            • Payments System
        • Benefits
        • Use Cases
        • Compliance
      • Development
        • Overview
          • Website
          • Application
            • Assets
          • Solana
            • Components
            • Programs
          • SUI
            • Components
          • References
        • Brand Guidelines
          • Assets
        • Roadmap
    • Blinks
      • Introduction
      • Components
    • BarkBOT
      • About
      • Features
        • API
          • Example
      • Reguirements
        • Integration
          • Blockchain
          • Programs
      • Architecture
        • Advantages
      • References
    • Commerce
      • Components
        • Backend
          • API
        • Storefront
        • Plugins
          • Payments
            • Payment Gateway
      • References
        • Tutorial
    • BarkSwap
      • Introduction
        • Architecture
        • Features
          • Benefits
    • Staking DApp
    • BARK AI Chatbot
      • Application
        • Development
          • Programs
          • NFT
            • Badges
        • FAQ
      • Architecture
        • Implementation
      • Demo
    • Token Sale Dashboard
      • Terminology
      • Benefits
  • Tokenomics
    • Tokenization
      • BARK
        • BARK (SPL20)
          • Use Cases
          • Distribution
          • Vesting & Locking Mechanism
        • BARK (Token-2022)
          • Specification
            • Important
          • Utility
            • Fees
              • Allocation
            • Staking
          • Distribution
          • Vesting
          • Emission Plan
            • Burning
              • Burning Process
        • CNFT
          • BARKER
            • Information
              • Community Token
            • Allocation
            • Swap
          • SPARKY
            • Token economy
            • Features
      • BPT
      • BRWA
  • Airdop
    • Acknowledgment
    • Overview
      • FAQ
  • Roadmap
    • Comprehensive Strategy
      • Recover & BARK Burning Plan
      • Strategic Transition to SPL-20 Token Standard
    • Milestones
      • Strategy Change
        • Airdrop One
        • Trading
          • Listing Process on DEXs
      • Exchanges
  • Community
    • Future Development
      • Treasury
        • Implementation
    • Overview
      • Governance
        • Specifications
          • Verification
        • Join BARK
      • Rewards
      • Engagement
        • Airdrops
    • FAQ
  • References
    • References
  • Developers
    • Applications
      • Blinks
        • Components
          • UI/UX Design
          • Server
            • Example
        • Actions
          • Frameworks
            • React Native
          • Referrals
          • Donate
          • Swap
          • Extensions
        • API Documentation
          • API
            • Use Cases
            • Features
            • Integration
      • Token Swap System
        • Architecture
          • Sample
          • BarkSwap API
      • BarkPaws Bot
        • Interface
          • Web3 DApp
          • Benefits
          • Improvement
      • Fundraising Platform
        • Introduction
          • Smart Contracts
            • Technical Overview
              • Contract
        • Components
          • Campaigns
            • Payments
              • Payment Processor
              • Stablecoin
                • Escrow Programs
                • Compliance
        • References
          • API
            • Documentation
    • BARK & Jupiter Swap API
      • API
    • Reward System
    • Product Owners
      • Grant Programs
  • Partnership
    • Collaboration
  • Annauncement
    • Newsletter
  • Documentation
    • Projects
      • Market Maker Bot
      • BARKER´s Club
      • Contributing
      • FairLauncher.fun
    • Investors Guide
      • Trading
  • Assets
    • Brand
      • Brand Guide
        • System Design
          • Colors Guide
        • Assets
Powered by GitBook
On this page
  • BARK and Jupiter Swap API Documentation
  • Overview
  • Getting Started
  • API Endpoints
  • Rate Limiting
  • Security
  1. Developers

BARK & Jupiter Swap API

BARK API documentation is crucial for helping developers understand and effectively use BARK API. The documentation should include an overview of the API, how it works, setup instructions, authentication details, endpoints, and example requests and responses. Below is an outline and example content for the BARK and Jupiter Swap API documentation:

BARK and Jupiter Swap API Documentation


Overview

The BARK and Jupiter Swap API allows developers to perform secure token swaps using the BARK Protocol and Jupiter on the Solana blockchain. The API provides endpoints for retrieving swap information, executing swaps, and receiving transaction notifications.

Getting Started

Base URL

The base URL for accessing the API is:

https://api.barkprotocol.net/v1

Authentication

The API uses OAuth 2.0 for authentication. You'll need to obtain an access token to access protected endpoints.

OAuth 2.0 Authorization Code Flow

  1. Authorization Request: Redirect the user to the authorization URL to obtain an authorization code.

    https://auth.barkprotocol.net/authorize
  2. Token Request: Exchange the authorization code for an access token.

    POST https://auth.barkprotocol.net/token
  3. Scopes:

    • read: Read access to swap data.

    • write: Write access for executing swaps.

Setup

To begin using the API, follow these steps:

  1. Register your application to obtain client credentials.

  2. Implement the OAuth 2.0 authorization flow to authenticate users and obtain access tokens.

  3. Use the access token to authenticate API requests.

API Endpoints


1. Retrieve Swap Information

GET /bark/swap

Fetch detailed swap information for a given token pair using the BARK Protocol.

  • Query Parameters:

    • tokenPair (string, required): Token pair for which to retrieve swap information (e.g., SOL-BARK).

    • amount (number, optional): Amount of input tokens to swap.

    • page (integer, optional): Page number for pagination.

    • pageSize (integer, optional): Number of items per page for pagination.

  • Response:

    {
      "swapInfo": {
        "icon": "https://ucarecdn.com/74392932-2ff5-4237-a1fa-e0fd15725ecc/bark.svg",
        "label": "Swap SOL to BARK",
        "title": "SOL-BARK Swap",
        "description": "Perform a secure swap between SOL and BARK tokens.",
        "tokenMetadata": {
          "symbol": "BARK",
          "decimals": 9,
          "blockchain": "Solana",
          "address": "2NTvEssJ2i998V2cMGT4Fy3JhyFnAzHFonDo9dbAkVrg",
          "programId": "Raydium Program ID",
          "tokenAuthority": "Authority Address",
          "updateAuthority": "Update Authority Address"
        },
        "links": {
          "actions": [
            {
              "label": "Swap Now",
              "href": "https://jup.ag/swap/SOL-2NTvEssJ2i998V2cMGT4Fy3JhyFnAzHFonDo9dbAkVrg",
              "parameters": [
                {
                  "name": "Slippage",
                  "label": "Max Slippage"
                }
              ]
            }
          ]
        }
      }
    }
  • Errors:

    • 400: Invalid input or token pair.

    • 422: Invalid or incomplete request parameters.

2. Execute a BARK Token Swap

POST /bark/swap

Execute a swap transaction for the specified token pair and amount using the BARK Protocol.

  • Request Body:

    {
      "tokenPair": "SOL-BARK",
      "amount": 100.0,
      "account": "User Public Key"
    }
  • Response:

    {
      "transactionId": "Transaction ID",
      "swapDetails": {
        "inputMint": "SOL Mint Address",
        "outputMint": "BARK Mint Address",
        "amount": 100.0,
        "outputAmount": 98.5,
        "transactionFee": 0.2,
        "rateLimit": {
          "limit": 60,
          "remaining": 59
        }
      }
    }
  • Errors:

    • 400: Invalid request data.

    • 500: Failed to prepare transaction.

3. Execute a Token Swap Using Jupiter

POST /jupiter/swap

Initiate a token swap transaction using the Jupiter protocol on the Solana blockchain.

  • Request Body:

    {
      "inputMint": "Input Token Mint Address",
      "outputMint": "Output Token Mint Address",
      "amount": 150.0,
      "slippage": 1.0,
      "userPublicKey": "User Public Key"
    }
  • Response:

    {
      "transaction": "Serialized Transaction",
      "swapDetails": {
        "inputMint": "Input Token Mint Address",
        "outputMint": "Output Token Mint Address",
        "amount": 150.0,
        "outputAmount": 145.0,
        "transactionFee": 0.3,
        "rateLimit": {
          "limit": 60,
          "remaining": 59
        }
      }
    }
  • Errors:

    • 400: Invalid input data for Jupiter swap.

    • 500: Failed to execute Jupiter swap.

4. Webhook: Transaction Complete

POST /webhooks/transaction-complete

Receive real-time notifications about completed transactions.

  • Request Body:

    {
      "transactionId": "Transaction ID",
      "status": "Success",
      "message": "Transaction completed successfully."
    }
  • Response:

    • 200: Successfully received the notification.

    • 400: Invalid notification payload.

Rate Limiting

The API enforces rate limits to ensure fair usage. Each endpoint response includes rate limit details in the rateLimit object, which contains:

  • limit: Maximum number of requests per minute.

  • remaining: Number of requests remaining in the current window.

Security

All endpoints require OAuth 2.0 authentication. Ensure your application securely stores and uses access tokens. Follow best practices for handling authentication credentials.

PreviousDocumentationNextAPI

Last updated 9 months ago