Get Presales

Endpoint: GET /merchant/presales | Auth: ๐Ÿ”’ Secret Key | Purpose: Retrieve merchant presales with completion tracking

๐Ÿค– AI Implementation Summary:

  • Returns: Array of merchant presales with comprehensive completion data
  • Includes: Completion tracking, transaction hashes, deployment info
  • Status Values: pending, active, completed, ended
  • Use Case: Monitor presale progress and token deployment status

Retrieve a list of all presales for a merchant with detailed completion tracking and transaction information.


GETapi.metal.build/merchant/presales

List all presales

This endpoint returns an array of all presales associated with your merchant account, including detailed completion tracking, transaction hashes, and deployment information.


Response attributes

  • Name
    id
    Type
    string
    Description

    Unique presale identifier

  • Name
    name
    Type
    string
    Description

    Presale name

  • Name
    description
    Type
    string
    Description

    Presale description

  • Name
    startTimestamp
    Type
    number
    Description

    UNIX timestamp when presale starts

  • Name
    endTimestamp
    Type
    number
    Description

    UNIX timestamp when presale ends

  • Name
    targetUsdcAmount
    Type
    number
    Description

    Target USDC amount to raise

  • Name
    purchasedUsdcAmount
    Type
    number
    Description

    Current USDC amount raised

  • Name
    status
    Type
    string
    Description

    Presale status: pending, active, completed, ended

  • Name
    participants
    Type
    array
    Description

    Array of holders who contributed to the presale

    • Name
      id
      Type
      string
      Description
      Holder's unique identifier
    • Name
      address
      Type
      string
      Description
      Holder's wallet address
    • Name
      usdcAmount
      Type
      number
      Description
      USDC amount contributed by this holder
    • Name
      tokenPercentage
      Type
      number
      Description
      Percentage of tokens allocated to this holder
  • Name
    signerAddress
    Type
    string
    Description

    Address of the presale signer

  • Name
    tokenInfo
    Type
    object
    Description
    • Name
      name
      Type
      string
      Description
      Token name
    • Name
      symbol
      Type
      string
      Description
      Token symbol
    • Name
      imageUrl
      Type
      string
      Description
      Token image URL
  • Name
    completionState
    Type
    object
    Description
    • Name
      step
      Type
      string
      Description
      Current completion step: pending, swapping, token-created, tokens-withdrawn, distributing, completed
    • Name
      transactions
      Type
      object
      Description
      Object containing transaction hashes for each completion step
    • Name
      retryCount
      Type
      number
      Description
      Number of retry attempts

    Tracks presale completion progress and transaction hashes

  • Name
    presaleInfo
    Type
    object
    Description
    • Name
      distributed
      Type
      boolean
      Description
      Whether tokens have been distributed
    • Name
      distributeTxHash
      Type
      string
      Description
      Distribution transaction hash
  • Name
    tokenDeploymentInfo
    Type
    object
    Description
    • Name
      tokenAddress
      Type
      string
      Description
      Deployed token contract address
    • Name
      hash
      Type
      string
      Description
      Token deployment transaction hash
    • Name
      amountTokensBought
      Type
      string
      Description
      Total tokens purchased amount

    Present only after token deployment

Request

GET
api.metal.build/merchant/presales
const response = await fetch(
  'https://api.metal.build/merchant/presales',
  {
    headers: {
      'x-api-key': 'YOUR_SECRET_API_KEY',
    },
})

const presales = await response.json()

Response

[
  {
    "id": "72f0a186-1aab-4d1d-9cb5-4b4b13eae515",
    "name": "E2E Test Presale",
    "description": "End-to-end test presale for verification",
    "startTimestamp": 1750014810,
    "endTimestamp": 1750101270,
    "targetUsdcAmount": 2,
    "purchasedUsdcAmount": 2,
    "status": "completed",
    "participants": [
      {
        "id": "e2e-test-holder-1",
        "address": "0x75452Eccd39bc3fb22B64C0dA202858DbD43adc5",
        "usdcAmount": 1,
        "tokenPercentage": 50
      }
    ],
    "signerAddress": "0x09a7A94c9E1D6A02529526bDbA11F30edca9c8c2",
    "tokenInfo": {
      "name": "E2E Test Token",
      "symbol": "E2E",
      "imageUrl": "https://example.com/e2e-token.png"
    },
    "completionState": {
      "step": "completed",
      "transactions": {
        "swapApprovalTx": "0x4047d857af6bf1a2e09e9f9d6c6206061fdea6002966d50f8a40bb00b5b8ee61",
        "swapTx": "0xad25dd434e9de2b4b5a2a909439f0fd69ab5e5307aed0fbe6d6bc9e4095ea1e6",
        "tokenCreationTx": "0xa0b17d44407e1b1719b28db1deb4126b74716f47417f8ddf90ebb8f4b4ebcd04",
        "withdrawTx": "0x181a9849fedc2917b48881647d60f9d8b8bf965efb999b0ca4c97ec08882ce38",
        "distributionApprovalTx": "0xc508c3b9b84c5e0c3c7dc6296a2a769f7365da5a7c0c25684ee2ffe7d9565a9b",
        "distributionTx": "0x84f76c62fd53d4d77418420fda8f84d19d5ae17737ba70022d5ff7753ccf2a66"
      },
      "retryCount": 0
    },
    "presaleInfo": {
      "distributed": true,
      "distributeTxHash": "0x84f76c62fd53d4d77418420fda8f84d19d5ae17737ba70022d5ff7753ccf2a66"
    },
    "tokenDeploymentInfo": {
      "tokenAddress": "0xc472631b37446e062F49F99cb13902537D2BA79F",
      "hash": "0xa0b17d44407e1b1719b28db1deb4126b74716f47417f8ddf90ebb8f4b4ebcd04",
      "amountTokensBought": "1282559864549679917173146"
    }
  }
]

Was this page helpful?