curl --request POST \
--url https://mpc.hex-api.app/bridge/withdrawals \
--header 'Content-Type: application/json' \
--data '
{
"chain_id": 137,
"nonce": "1792107257000001836156",
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR"
}
'import requests
url = "https://mpc.hex-api.app/bridge/withdrawals"
payload = {
"chain_id": 137,
"nonce": "1792107257000001836156",
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
chain_id: 137,
nonce: '1792107257000001836156',
receiver: '0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2',
intent_account: 'alice.near',
near_tx: '2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR'
})
};
fetch('https://mpc.hex-api.app/bridge/withdrawals', 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://mpc.hex-api.app/bridge/withdrawals",
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([
'chain_id' => 137,
'nonce' => '1792107257000001836156',
'receiver' => '0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2',
'intent_account' => 'alice.near',
'near_tx' => '2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR'
]),
CURLOPT_HTTPHEADER => [
"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://mpc.hex-api.app/bridge/withdrawals"
payload := strings.NewReader("{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://mpc.hex-api.app/bridge/withdrawals")
.header("Content-Type", "application/json")
.body("{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mpc.hex-api.app/bridge/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}"
response = http.request(request)
puts response.read_body{
"recorded": true,
"withdrawal": {
"nonce": "1792107257000001836156",
"chain_id": 137,
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"token": null,
"amount": null,
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR",
"status": "registered",
"payout_tx": null,
"clear_tx": null,
"attempts": 0,
"last_error": null,
"created_at": 1792944180000,
"updated_at": 1792944180000
}
}Record a withdrawal a user just made
Records a withdrawal published on NEAR, unique on nonce. It must be a withdrawal omni holds, to that chain_id (404 / 422 otherwise), made within the last hour (omni’s nonce carries its time; 422 otherwise: report it right after publishing it), and on EVM chains to the posted receiver (422 otherwise). token, amount and the EVM receiver are omni’s. A second post fills only what is still unknown (intent_account, near_tx) and never moves the status. Nothing is paid out: call POST /relay/withdraw for that.
curl --request POST \
--url https://mpc.hex-api.app/bridge/withdrawals \
--header 'Content-Type: application/json' \
--data '
{
"chain_id": 137,
"nonce": "1792107257000001836156",
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR"
}
'import requests
url = "https://mpc.hex-api.app/bridge/withdrawals"
payload = {
"chain_id": 137,
"nonce": "1792107257000001836156",
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
chain_id: 137,
nonce: '1792107257000001836156',
receiver: '0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2',
intent_account: 'alice.near',
near_tx: '2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR'
})
};
fetch('https://mpc.hex-api.app/bridge/withdrawals', 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://mpc.hex-api.app/bridge/withdrawals",
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([
'chain_id' => 137,
'nonce' => '1792107257000001836156',
'receiver' => '0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2',
'intent_account' => 'alice.near',
'near_tx' => '2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR'
]),
CURLOPT_HTTPHEADER => [
"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://mpc.hex-api.app/bridge/withdrawals"
payload := strings.NewReader("{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://mpc.hex-api.app/bridge/withdrawals")
.header("Content-Type", "application/json")
.body("{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mpc.hex-api.app/bridge/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain_id\": 137,\n \"nonce\": \"1792107257000001836156\",\n \"receiver\": \"0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2\",\n \"intent_account\": \"alice.near\",\n \"near_tx\": \"2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR\"\n}"
response = http.request(request)
puts response.read_body{
"recorded": true,
"withdrawal": {
"nonce": "1792107257000001836156",
"chain_id": 137,
"receiver": "0xe4df1d74122c2a7b14481cbdde704fbd0a4f11a2",
"token": null,
"amount": null,
"intent_account": "alice.near",
"near_tx": "2rQmS4n4TxT7GJ26XLDDZEHEmsizLb1ezGC81zr8dpkR",
"status": "registered",
"payout_tx": null,
"clear_tx": null,
"attempts": 0,
"last_error": null,
"created_at": 1792944180000,
"updated_at": 1792944180000
}
}Body
Chain ids are omni's (v2_1.omni.hot.tg), not always the chain's own: EVM chains use their EIP-155 id (Ethereum 1, Optimism 10, BNB 56, Polygon 137, Monad 143, X Layer 196, Base 8453, Arbitrum 42161, Avalanche 43114, ...); the others have omni's numbers: Solana 1001, NEAR 1010, Stellar 1100, TON 1117 (TON v1, 1111, is dead), Juno 4444118, Gonka 4444119.
x >= 11100
1117
137
4444119