Note:
If you just need to skip this complex process & just place a buy/sell use Trade API endpoint instead. Endpoint URL:https://pmpapi.fun/api/trade_transaction
Your request body must contain the following Parameters:
| Parameter | Example | Description | Required |
|---|---|---|---|
trade_type | Buy or sell | ”buy” or “sell” to specify trade type | Yes |
mint | Token mint address | Token mint address | Yes |
amount | Value in of SOL/Tokens | Amount of SOL or tokens to trade | Yes |
slippage | Desired slippage | Slippage allowed (integer) | Yes |
priorityFee | Value in SOL (optional) | Amount to use as priority fee (optional) In SOL | No |
userPublicKey | User wallet address | The wallet used the sign the transaction | Yes |
Note Amount in SOL , if buying or of tokens if selling.Examples Usage:
transaction object is a base58 encoded transaction which later you can sign and send it as per your needs.
Below shows how to do this:
Now below is the complete snippet to sign and send the transaction:
Typescript
400 Bad Request: Invalid request parameters or missing required fields.401 Unauthorized: Authentication failed.404 Not Found: The requested resource (endpoint) is not found.429 Too Many Requests: Rate limit exceeded.500 Internal Server Error: Unexpected server-side error.
200 OK: The request was successful.
