Skip to main content

Module oracle

Module oracle 

Source
Expand description

HTTP oracle interface for external data access.

This module provides functions for making HTTP requests from smart contracts via the TruthLinked oracle system.

§Example

use truthlinked_sdk::oracle::{http_get, OracleStatus};

let response = http_get("https://api.example.com/data")?;
match response.status {
    OracleStatus::Ready => {
        // Process response.body
    }
    OracleStatus::Pending => {
        // Retry later
    }
    OracleStatus::Expired => {
        // Request expired
    }
}

Structs§

OracleResponse
Response from an oracle HTTP call.

Enums§

OracleStatus
Status of an oracle request.

Functions§

body_utf8
Converts the response body to a UTF-8 string.
http_call
Makes an HTTP request via the oracle.
http_get
Makes an HTTP GET request.
http_post
Makes an HTTP POST request.