TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.nodes.nodesCreate({
data: {
country: "Andorra",
nodeSmallId: 3665,
publicAddress: "<value>",
},
signature: "<value>",
});
// Handle the result
console.log(result);
}
run();from atoma_sdk import AtomaSDK
import os
with AtomaSDK(
bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
) as atoma_sdk:
res = atoma_sdk.nodes.nodes_create(data={
"country": "Andorra",
"node_small_id": 3665,
"public_address": "<value>",
}, signature="<value>")
# Handle response
print(res)curl --request POST \
--url https://api.atoma.network/v1/nodes \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"country": "<string>",
"node_small_id": 1,
"public_address": "<string>"
},
"signature": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: {country: '<string>', node_small_id: 1, public_address: '<string>'},
signature: '<string>'
})
};
fetch('https://api.atoma.network/v1/nodes', 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.atoma.network/v1/nodes",
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([
'data' => [
'country' => '<string>',
'node_small_id' => 1,
'public_address' => '<string>'
],
'signature' => '<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://api.atoma.network/v1/nodes"
payload := strings.NewReader("{\n \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<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://api.atoma.network/v1/nodes")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/nodes")
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 \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}Nodes
Create node
This endpoint allows nodes to register or update their public address in the system. When a node comes online or changes its address, it can use this endpoint to ensure the system has its current address for routing requests.
Errors
Returns various AtomaProxyError variants:
MissingHeader- If the signature header is missingInvalidHeader- If the signature header is malformedInvalidBody- If:- The request body cannot be read
- The signature is invalid
- The body cannot be parsed
- The sui address doesn’t match the signature
InternalError- If:- The state manager channel is closed
- The registration event cannot be sent
- Node Sui address lookup fails
POST
/
v1
/
nodes
TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.nodes.nodesCreate({
data: {
country: "Andorra",
nodeSmallId: 3665,
publicAddress: "<value>",
},
signature: "<value>",
});
// Handle the result
console.log(result);
}
run();from atoma_sdk import AtomaSDK
import os
with AtomaSDK(
bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
) as atoma_sdk:
res = atoma_sdk.nodes.nodes_create(data={
"country": "Andorra",
"node_small_id": 3665,
"public_address": "<value>",
}, signature="<value>")
# Handle response
print(res)curl --request POST \
--url https://api.atoma.network/v1/nodes \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"country": "<string>",
"node_small_id": 1,
"public_address": "<string>"
},
"signature": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: {country: '<string>', node_small_id: 1, public_address: '<string>'},
signature: '<string>'
})
};
fetch('https://api.atoma.network/v1/nodes', 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.atoma.network/v1/nodes",
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([
'data' => [
'country' => '<string>',
'node_small_id' => 1,
'public_address' => '<string>'
],
'signature' => '<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://api.atoma.network/v1/nodes"
payload := strings.NewReader("{\n \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<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://api.atoma.network/v1/nodes")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/nodes")
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 \"data\": {\n \"country\": \"<string>\",\n \"node_small_id\": 1,\n \"public_address\": \"<string>\"\n },\n \"signature\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}Body
application/json
Response
Node public address registered successfully
The message of the response
⌘I