Aptos
Create Staking Request
Construct a serialized transaction to add tokens to the delegation pool.
POST
/
api
/
v1
/
aptos
/
{network}
/
staking
/
delegated
/
add
Create Staking Request
curl --request POST \
--url https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"gas": {
"unitPrice": 100,
"maxGasLimit": 100
}
}
'import requests
url = "https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add"
payload = {
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"gas": {
"unitPrice": 100,
"maxGasLimit": 100
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1100000000,
delegatorAddress: '0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a',
gas: {unitPrice: 100, maxGasLimit: 100}
})
};
fetch('https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add', 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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add",
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([
'amount' => 1100000000,
'delegatorAddress' => '0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a',
'gas' => [
'unitPrice' => 100,
'maxGasLimit' => 100
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add"
payload := strings.NewReader("{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"error": null,
"result": {
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"unsignedTransaction": "0xa571a5bc9b1bfd5fe58e6e09a5be251a3299985494d022959ce206f1f23f752e21000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c096164645f7374616b650002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d28080100000000000000400d0300000000006400000000000000e5742068000000000200",
"createdAt": "2023-08-24T08:14:50.455Z"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Aptos network:
- `mainnet` — Aptos mainnet.
- `testnet` — Aptos devnet.
Available options:
mainnet, testnet Body
application/json
Amount of tokens to stake in Octas (1 APT = 10⁸ Octas).
Example:
1100000000
Delegator account address.
Example:
"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a"
Computational effort required to execute the transaction, measured in gas units.
Show child attributes
Show child attributes
Create Staking Request
curl --request POST \
--url https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"gas": {
"unitPrice": 100,
"maxGasLimit": 100
}
}
'import requests
url = "https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add"
payload = {
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"gas": {
"unitPrice": 100,
"maxGasLimit": 100
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1100000000,
delegatorAddress: '0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a',
gas: {unitPrice: 100, maxGasLimit: 100}
})
};
fetch('https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add', 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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add",
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([
'amount' => 1100000000,
'delegatorAddress' => '0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a',
'gas' => [
'unitPrice' => 100,
'maxGasLimit' => 100
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add"
payload := strings.NewReader("{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.p2p.org/api/api/v1/aptos/{network}/staking/delegated/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1100000000,\n \"delegatorAddress\": \"0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a\",\n \"gas\": {\n \"unitPrice\": 100,\n \"maxGasLimit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"error": null,
"result": {
"amount": 1100000000,
"delegatorAddress": "0xd890b1115b39c8d182aeac6cae313cc713cd93922135f8a5893c34fce4e0f32a",
"unsignedTransaction": "0xa571a5bc9b1bfd5fe58e6e09a5be251a3299985494d022959ce206f1f23f752e21000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c096164645f7374616b650002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d28080100000000000000400d0300000000006400000000000000e5742068000000000200",
"createdAt": "2023-08-24T08:14:50.455Z"
}
}