Get OP hook
curl --request POST \
--url https://router-api.initia.xyz/op-hook \
--header 'Content-Type: application/json' \
--data '
{
"source_address": "init1abc...",
"source_asset_chain_id": "echelon-1",
"source_asset_denom": "uinit",
"dest_address": "0xdef...",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x..."
}
'import requests
url = "https://router-api.initia.xyz/op-hook"
payload = {
"source_address": "init1abc...",
"source_asset_chain_id": "echelon-1",
"source_asset_denom": "uinit",
"dest_address": "0xdef...",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x..."
}
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({
source_address: 'init1abc...',
source_asset_chain_id: 'echelon-1',
source_asset_denom: 'uinit',
dest_address: '0xdef...',
dest_asset_chain_id: '8453',
dest_asset_denom: '0x...'
})
};
fetch('https://router-api.initia.xyz/op-hook', 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://router-api.initia.xyz/op-hook",
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([
'source_address' => 'init1abc...',
'source_asset_chain_id' => 'echelon-1',
'source_asset_denom' => 'uinit',
'dest_address' => '0xdef...',
'dest_asset_chain_id' => '8453',
'dest_asset_denom' => '0x...'
]),
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://router-api.initia.xyz/op-hook"
payload := strings.NewReader("{\n \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\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://router-api.initia.xyz/op-hook")
.header("Content-Type", "application/json")
.body("{\n \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/op-hook")
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 \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\n}"
response = http.request(request)
puts response.read_body{
"chain_id": "8453",
"hook": []
}Routing
Get OP hook
Generates OP hook data required for certain cross-chain routes that involve Optimistic bridge withdrawals with ERC-20 token conversion. When the Compute Route response includes required_op_hook: true, you must call this endpoint to obtain the hook payload before generating transaction messages.
Pass the returned hook data to the Generate Transaction endpoint (POST /v2/fungible/msgs) in the signed_op_hook field after signing it.
POST
/
op-hook
Get OP hook
curl --request POST \
--url https://router-api.initia.xyz/op-hook \
--header 'Content-Type: application/json' \
--data '
{
"source_address": "init1abc...",
"source_asset_chain_id": "echelon-1",
"source_asset_denom": "uinit",
"dest_address": "0xdef...",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x..."
}
'import requests
url = "https://router-api.initia.xyz/op-hook"
payload = {
"source_address": "init1abc...",
"source_asset_chain_id": "echelon-1",
"source_asset_denom": "uinit",
"dest_address": "0xdef...",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x..."
}
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({
source_address: 'init1abc...',
source_asset_chain_id: 'echelon-1',
source_asset_denom: 'uinit',
dest_address: '0xdef...',
dest_asset_chain_id: '8453',
dest_asset_denom: '0x...'
})
};
fetch('https://router-api.initia.xyz/op-hook', 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://router-api.initia.xyz/op-hook",
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([
'source_address' => 'init1abc...',
'source_asset_chain_id' => 'echelon-1',
'source_asset_denom' => 'uinit',
'dest_address' => '0xdef...',
'dest_asset_chain_id' => '8453',
'dest_asset_denom' => '0x...'
]),
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://router-api.initia.xyz/op-hook"
payload := strings.NewReader("{\n \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\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://router-api.initia.xyz/op-hook")
.header("Content-Type", "application/json")
.body("{\n \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/op-hook")
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 \"source_address\": \"init1abc...\",\n \"source_asset_chain_id\": \"echelon-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_address\": \"0xdef...\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\"\n}"
response = http.request(request)
puts response.read_body{
"chain_id": "8453",
"hook": []
}Body
application/json
Sender address on the source chain.
Source chain ID.
Source asset denomination.
Recipient address on the destination chain.
Destination chain ID.
Destination asset denomination.
Was this page helpful?
⌘I