Build a transaction that registers a builder code
curl --request POST \
--url https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register \
--header 'Content-Type: application/json' \
--data '
{
"caller": "<string>",
"code": "<string>",
"isPercentFee": true,
"feeCollector": "<string>",
"feePercent": "<string>",
"fixedFeeUsdc": "<string>"
}
'import requests
url = "https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register"
payload = {
"caller": "<string>",
"code": "<string>",
"isPercentFee": True,
"feeCollector": "<string>",
"feePercent": "<string>",
"fixedFeeUsdc": "<string>"
}
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({
caller: '<string>',
code: '<string>',
isPercentFee: true,
feeCollector: '<string>',
feePercent: '<string>',
fixedFeeUsdc: '<string>'
})
};
fetch('https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register', 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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register",
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([
'caller' => '<string>',
'code' => '<string>',
'isPercentFee' => true,
'feeCollector' => '<string>',
'feePercent' => '<string>',
'fixedFeeUsdc' => '<string>'
]),
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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register"
payload := strings.NewReader("{\n \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register")
.header("Content-Type", "application/json")
.body("{\n \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register")
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 \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"to": "0x0000000000000000000000000000000000000000",
"from": "0x0000000000000000000000000000000000000000",
"data": "<string>",
"value": "0x0",
"chainId": 123,
"description": "<string>",
"meta": {}
}
}{
"ok": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"details": "<unknown>"
}
}Misc
Build a transaction that registers a builder code
For builder partners: registers a fee configuration (percent or fixed per trade) that integrations can attach to trades routed through them. The caller becomes the code owner.
POST
/
v2
/
misc
/
builder-code
/
register
Build a transaction that registers a builder code
curl --request POST \
--url https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register \
--header 'Content-Type: application/json' \
--data '
{
"caller": "<string>",
"code": "<string>",
"isPercentFee": true,
"feeCollector": "<string>",
"feePercent": "<string>",
"fixedFeeUsdc": "<string>"
}
'import requests
url = "https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register"
payload = {
"caller": "<string>",
"code": "<string>",
"isPercentFee": True,
"feeCollector": "<string>",
"feePercent": "<string>",
"fixedFeeUsdc": "<string>"
}
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({
caller: '<string>',
code: '<string>',
isPercentFee: true,
feeCollector: '<string>',
feePercent: '<string>',
fixedFeeUsdc: '<string>'
})
};
fetch('https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register', 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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register",
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([
'caller' => '<string>',
'code' => '<string>',
'isPercentFee' => true,
'feeCollector' => '<string>',
'feePercent' => '<string>',
'fixedFeeUsdc' => '<string>'
]),
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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register"
payload := strings.NewReader("{\n \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\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://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register")
.header("Content-Type", "application/json")
.body("{\n \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx-builder-testnet.avantisfi.com/v2/misc/builder-code/register")
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 \"caller\": \"<string>\",\n \"code\": \"<string>\",\n \"isPercentFee\": true,\n \"feeCollector\": \"<string>\",\n \"feePercent\": \"<string>\",\n \"fixedFeeUsdc\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"to": "0x0000000000000000000000000000000000000000",
"from": "0x0000000000000000000000000000000000000000",
"data": "<string>",
"value": "0x0",
"chainId": 123,
"description": "<string>",
"meta": {}
}
}{
"ok": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"details": "<unknown>"
}
}Body
application/json
The account sending this transaction (must sign it).
Builder code identifier: a plain string of 1-31 characters or a 32-byte 0x-hex value.
Minimum string length:
1true = charge feePercent of each trade; false = charge fixedFeeUsdc per trade.
Address that receives the builder fees.
Builder fee as a percent of the trade (1 = 1%); capped by the protocol maximum.
Fixed builder fee in USDC per trade; capped by the protocol maximum.
Response
Success envelope: ok is true and data carries the payload documented below.
⌘I