Zap-In - Generate transaction to add liquidity to a pool
curl --request POST \
--url https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "<string>",
"inputSOL": 123,
"percentX": 0.5,
"fromBinId": 123,
"toBinId": 123,
"amountX": 123,
"amountY": 123,
"slippage_bps": 500,
"provider": "JUPITER_ULTRA",
"mode": "zap-in"
}
'import requests
url = "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx"
payload = {
"owner": "<string>",
"inputSOL": 123,
"percentX": 0.5,
"fromBinId": 123,
"toBinId": 123,
"amountX": 123,
"amountY": 123,
"slippage_bps": 500,
"provider": "JUPITER_ULTRA",
"mode": "zap-in"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '<string>',
inputSOL: 123,
percentX: 0.5,
fromBinId: 123,
toBinId: 123,
amountX: 123,
amountY: 123,
slippage_bps: 500,
provider: 'JUPITER_ULTRA',
mode: 'zap-in'
})
};
fetch('https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'owner' => '<string>',
'inputSOL' => 123,
'percentX' => 0.5,
'fromBinId' => 123,
'toBinId' => 123,
'amountX' => 123,
'amountY' => 123,
'slippage_bps' => 500,
'provider' => 'JUPITER_ULTRA',
'mode' => 'zap-in'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx"
payload := strings.NewReader("{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"lastValidBlockHeight": 123,
"swapTxsWithJito": [
"<string>"
],
"addLiquidityTxsWithJito": [
"<string>"
],
"meta": {}
}
}Pools
Zap-In - Generate transaction to add liquidity to a pool
Generate serialized zap-in transactions to add liquidity to a pool. Supports both DLMM and DAMM V2 pools (auto-detected by pool address). In zap-in mode, provide SOL and the API auto-swaps to the correct token ratio. Returns serialized transactions ready to be signed and landed. Solana only - this endpoint has no Robinhood Chain (EVM) equivalent.
POST
/
pools
/
{poolId}
/
add-tx
Zap-In - Generate transaction to add liquidity to a pool
curl --request POST \
--url https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "<string>",
"inputSOL": 123,
"percentX": 0.5,
"fromBinId": 123,
"toBinId": 123,
"amountX": 123,
"amountY": 123,
"slippage_bps": 500,
"provider": "JUPITER_ULTRA",
"mode": "zap-in"
}
'import requests
url = "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx"
payload = {
"owner": "<string>",
"inputSOL": 123,
"percentX": 0.5,
"fromBinId": 123,
"toBinId": 123,
"amountX": 123,
"amountY": 123,
"slippage_bps": 500,
"provider": "JUPITER_ULTRA",
"mode": "zap-in"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '<string>',
inputSOL: 123,
percentX: 0.5,
fromBinId: 123,
toBinId: 123,
amountX: 123,
amountY: 123,
slippage_bps: 500,
provider: 'JUPITER_ULTRA',
mode: 'zap-in'
})
};
fetch('https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'owner' => '<string>',
'inputSOL' => 123,
'percentX' => 0.5,
'fromBinId' => 123,
'toBinId' => 123,
'amountX' => 123,
'amountY' => 123,
'slippage_bps' => 500,
'provider' => 'JUPITER_ULTRA',
'mode' => 'zap-in'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx"
payload := strings.NewReader("{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lpagent.io/open-api/v1/pools/{poolId}/add-tx")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"<string>\",\n \"inputSOL\": 123,\n \"percentX\": 0.5,\n \"fromBinId\": 123,\n \"toBinId\": 123,\n \"amountX\": 123,\n \"amountY\": 123,\n \"slippage_bps\": 500,\n \"provider\": \"JUPITER_ULTRA\",\n \"mode\": \"zap-in\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"lastValidBlockHeight": 123,
"swapTxsWithJito": [
"<string>"
],
"addLiquidityTxsWithJito": [
"<string>"
],
"meta": {}
}
}请求体
application/json
此页面对您有帮助吗?