This document describes the REST API endpoints provided by PiDualTx backend services:
/predict
Predict the future Pi price based on historical data.
application/json
{
"historical_prices": [0.80, 0.81, 0.82, 0.83, 0.84],
"sequence_length": 5
}
200 OK
{
"predicted_price": 0.8423,
"confidence": 0.95
}
400 Bad Request
: Input validation failure.500 Internal Server Error
: Prediction failed./api/rates
Retrieve current Pi price rates.
200 OK
{
"internalRate": "314159",
"externalRate": "0.8152",
"timestamp": 1680000000
}
/api/transactions/execute
Execute a transaction via the PiDualTx smart contract.
application/json
{
"user": "User Address...", // User address starting with 'G'
"merchant": "MerchantAddress...", // Merchant address starting with 'G'
"amount": "1000000000000000000", // Amount in wei
"paymentType": "internal", // or "external"
"autoConvert": true
}
200 OK
{
"transactionHash": "0xabc123...",
"status": true
}
400 Bad Request
: Invalid input.500 Internal Server Error
: Transaction failed./api/transactions/{user}
Retrieve transaction history for a specified user address.
200 OK
[
{
"user": "User Address...", // User address starting with 'G'
"merchant": "MerchantAddress...", // Merchant address starting with 'G'
"amount": 1000000000000000000,
"paymentType": "internal",
"autoConvert": true,
"timestamp": 1680000123
},
{
"user": "User Address...", // User address starting with 'G'
"merchant": "AnotherMerchant...", // Merchant address starting with 'G'
"amount": 500000000000000000,
"paymentType": "external",
"autoConvert": false,
"timestamp": 1680000456
}
]
"internal"
or "external"
.This document is subject to update as the PiDualTx platform evolves.