Notify NEAR deposit
curl --request POST \
--url https://api.leokit.dev/notify-deposit \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"txHash": "0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
"depositAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
'import requests
url = "https://api.leokit.dev/notify-deposit"
payload = {
"txHash": "0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
"depositAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
txHash: '0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890',
depositAddress: '0x1234567890abcdef1234567890abcdef12345678'
})
};
fetch('https://api.leokit.dev/notify-deposit', 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.leokit.dev/notify-deposit",
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([
'txHash' => '0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890',
'depositAddress' => '0x1234567890abcdef1234567890abcdef12345678'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);
$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.leokit.dev/notify-deposit"
payload := strings.NewReader("{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("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.leokit.dev/notify-deposit")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/notify-deposit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status": "received",
"correlationId": "abc123",
"message": "Deposit notification sent to NEAR"
}{
"error": "Missing required fields: txHash, depositAddress"
}{
"message": "<string>",
"code": "<string>"
}Endpoint Details
Notify Deposit
Notify NEAR 1Click API about completed deposits for faster swap processing
POST
/
notify-deposit
Notify NEAR deposit
curl --request POST \
--url https://api.leokit.dev/notify-deposit \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"txHash": "0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
"depositAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
'import requests
url = "https://api.leokit.dev/notify-deposit"
payload = {
"txHash": "0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
"depositAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
txHash: '0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890',
depositAddress: '0x1234567890abcdef1234567890abcdef12345678'
})
};
fetch('https://api.leokit.dev/notify-deposit', 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.leokit.dev/notify-deposit",
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([
'txHash' => '0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890',
'depositAddress' => '0x1234567890abcdef1234567890abcdef12345678'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);
$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.leokit.dev/notify-deposit"
payload := strings.NewReader("{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("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.leokit.dev/notify-deposit")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/notify-deposit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txHash\": \"0xa1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890\",\n \"depositAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status": "received",
"correlationId": "abc123",
"message": "Deposit notification sent to NEAR"
}{
"error": "Missing required fields: txHash, depositAddress"
}{
"message": "<string>",
"code": "<string>"
}Overview
The notify-deposit endpoint notifies the NEAR 1Click API about a completed deposit transaction. This allows NEAR to preemptively verify the deposit, speeding up swap processing.This endpoint is specifically for NEAR protocol swaps. It’s optional but recommended for faster swap execution.
Endpoint
POST /leokit/notify-deposit
Request
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
Api-Key | Your API key |
Body
{
"txHash": "0x1234567890abcdef...",
"depositAddress": "0xabcdef1234567890..."
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
txHash | string | Yes | Transaction hash of the deposit (must start with 0x) |
depositAddress | string | Yes | Deposit address provided in the quote (must start with 0x) |
Response
Success (200)
{
"success": true,
"status": "submitted",
"correlationId": "abc123-def456",
"message": "Deposit notification sent to NEAR"
}
| Field | Description |
|---|---|
success | Whether the notification was accepted |
status | Status from NEAR 1Click API |
correlationId | Tracking ID from NEAR |
message | Human-readable status message |
Error Responses
- 400 Bad Request
- 4xx/5xx from NEAR
- 500 Internal Error
Missing or invalid parameters:Or invalid format:
{
"error": "Missing required fields: txHash, depositAddress"
}
{
"error": "Invalid format: txHash and depositAddress must be hex strings starting with 0x"
}
NEAR API error forwarded:
{
"error": "NEAR 1Click API error",
"details": { ... }
}
Server error:
{
"error": "Failed to notify NEAR about deposit",
"details": "Connection timeout"
}
Example
curl -X POST https://api.leokit.dev/leokit/notify-deposit \
-H "Content-Type: application/json" \
-H "Api-Key: your_api_key" \
-d '{
"txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"depositAddress": "0xabcdef1234567890abcdef1234567890abcdef12"
}'
const response = await fetch('https://api.leokit.dev/leokit/notify-deposit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Api-Key': 'your_api_key'
},
body: JSON.stringify({
txHash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
depositAddress: '0xabcdef1234567890abcdef1234567890abcdef12'
})
});
const result = await response.json();
console.log(result);
// { success: true, status: "submitted", correlationId: "...", message: "..." }
interface NotifyDepositRequest {
txHash: string;
depositAddress: string;
}
interface NotifyDepositResponse {
success: boolean;
status: string;
correlationId: string;
message: string;
}
async function notifyDeposit(
txHash: string,
depositAddress: string
): Promise<NotifyDepositResponse> {
const response = await fetch('https://api.leokit.dev/leokit/notify-deposit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Api-Key': process.env.LEOKIT_API_KEY!
},
body: JSON.stringify({ txHash, depositAddress })
});
if (!response.ok) {
throw new Error(`Notify failed: ${response.status}`);
}
return response.json();
}
When to Use
Call this endpoint after broadcasting a deposit transaction for a NEAR-routed swap:1
Get Quote
Request a quote with NEAR as the destination or intermediary
2
Generate Deposit
Call
/leokit/deposit to get the deposit address and transaction3
Sign & Broadcast
Sign and broadcast the transaction to the source chain
4
Notify Deposit
Call this endpoint with the transaction hash and deposit address
5
Track Status
Monitor the swap via
/leokit/statusNotes
- This endpoint forwards requests to NEAR’s 1Click API at
https://1click.chaindefuser.com/v0/deposit/submit - The timeout for NEAR API calls is 10 seconds
- Notification is optional but can significantly speed up swap processing
- Only applicable for swaps routed through the NEAR protocol
Authorizations
Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4
Body
application/json