Onchain Actions
public/get_onchain_action_history
Returns the lifecycle of onchain actions submitted via OnchainActionManager.sol. Public endpoint.
Onchain actions are either applied directly or with a fallback flag. Each onchain action is affected by the fallback flag uniquely:
- Deposits: sequencer moved the deposit into the
fallback_subaccount - SetSessionKey: no-op
- Admin actions: no-op
The onchain action can have several states:
applied: action was successfully applied by the sequencerapplied_with_fallback: action was applied by the sequencer with fallback=trueinstant_fallback: action failed its initial attempt, will be re-submitted with fallback=trueretry_then_fallback: action failed its initial attempt, will be re-submitted with fallback=false until the retry budget is exceeded, then re-submitted with fallback=truenever_escalate: action failed its initial attempt but will retry until successful, never with fallback=true
A failed attempt is recorded in error_code, error_message and error_data, and kept once the action is applied. error_code is a catalogued error code; error_data carries the specifics, and is null for an internal error.
POST
/
public
/
get_onchain_action_history
public/get_onchain_action_history
curl --request POST \
--url https://api.derive.xyz/v3/public/get_onchain_action_history \
--header 'Content-Type: application/json' \
--data '
{
"action_type": null,
"end_timestamp": null,
"page": null,
"page_size": null,
"start_timestamp": null,
"wallet": null
}
'import requests
url = "https://api.derive.xyz/v3/public/get_onchain_action_history"
payload = {
"action_type": None,
"end_timestamp": None,
"page": None,
"page_size": None,
"start_timestamp": None,
"wallet": None
}
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({
action_type: null,
end_timestamp: null,
page: null,
page_size: null,
start_timestamp: null,
wallet: null
})
};
fetch('https://api.derive.xyz/v3/public/get_onchain_action_history', 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.derive.xyz/v3/public/get_onchain_action_history",
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([
'action_type' => null,
'end_timestamp' => null,
'page' => null,
'page_size' => null,
'start_timestamp' => null,
'wallet' => null
]),
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.derive.xyz/v3/public/get_onchain_action_history"
payload := strings.NewReader("{\n \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\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.derive.xyz/v3/public/get_onchain_action_history")
.header("Content-Type", "application/json")
.body("{\n \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/get_onchain_action_history")
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 \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\n}"
response = http.request(request)
puts response.read_body{
"actions": [
{
"acc": "<string>",
"action_id": 1,
"action_type": 1,
"action_type_label": "<string>",
"block_number": 1,
"data": "<string>",
"l1_sender": "<string>",
"queue": "<string>",
"status": "<string>",
"updated_at": 123,
"error_code": 123,
"error_data": "<string>",
"error_message": "<string>",
"fallback_at": 123,
"first_failed_at": 123,
"last_failed_at": 123,
"op_uuid": "<string>",
"skip_reason": "<string>",
"skip_reason_code": "<string>",
"tx_hash": "<string>"
}
],
"pagination": {
"count": 1,
"num_pages": 1
}
}Body
application/json
On-chain actionType id.
Required range:
x >= 0Required range:
x >= 0Required range:
x >= 0L1 sender of the action (any hex casing).
public/get_onchain_action_history
curl --request POST \
--url https://api.derive.xyz/v3/public/get_onchain_action_history \
--header 'Content-Type: application/json' \
--data '
{
"action_type": null,
"end_timestamp": null,
"page": null,
"page_size": null,
"start_timestamp": null,
"wallet": null
}
'import requests
url = "https://api.derive.xyz/v3/public/get_onchain_action_history"
payload = {
"action_type": None,
"end_timestamp": None,
"page": None,
"page_size": None,
"start_timestamp": None,
"wallet": None
}
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({
action_type: null,
end_timestamp: null,
page: null,
page_size: null,
start_timestamp: null,
wallet: null
})
};
fetch('https://api.derive.xyz/v3/public/get_onchain_action_history', 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.derive.xyz/v3/public/get_onchain_action_history",
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([
'action_type' => null,
'end_timestamp' => null,
'page' => null,
'page_size' => null,
'start_timestamp' => null,
'wallet' => null
]),
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.derive.xyz/v3/public/get_onchain_action_history"
payload := strings.NewReader("{\n \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\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.derive.xyz/v3/public/get_onchain_action_history")
.header("Content-Type", "application/json")
.body("{\n \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/get_onchain_action_history")
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 \"action_type\": null,\n \"end_timestamp\": null,\n \"page\": null,\n \"page_size\": null,\n \"start_timestamp\": null,\n \"wallet\": null\n}"
response = http.request(request)
puts response.read_body{
"actions": [
{
"acc": "<string>",
"action_id": 1,
"action_type": 1,
"action_type_label": "<string>",
"block_number": 1,
"data": "<string>",
"l1_sender": "<string>",
"queue": "<string>",
"status": "<string>",
"updated_at": 123,
"error_code": 123,
"error_data": "<string>",
"error_message": "<string>",
"fallback_at": 123,
"first_failed_at": 123,
"last_failed_at": 123,
"op_uuid": "<string>",
"skip_reason": "<string>",
"skip_reason_code": "<string>",
"tx_hash": "<string>"
}
],
"pagination": {
"count": 1,
"num_pages": 1
}
}