Transactions routes
You generated an address for a user, Then that user received transactions and you want to show all of their transactions. For a profile to receive digital assets they need a receiving address. every profile has the ability to get a lot of receiving addresses.
This operation sends transactions
POST
https://sandbox.oumla.com/api/v1/withdraw
Request Body (required)
network*
NetworkType
specify which blockchain BTC | tBTC | ETH | tETH
from*
string[]
specify which addresses to withdraw from. This is an array of strings.
amount*
number
the amount to send.
to*
string
the desired address
clientShare*
string
the client share
Headers
x-api-key*
string
Oumla api key
Sample code of the request:
async function sendTransaction(data:any ) {
const apiKey = "Your API Key";
const url = "https://sandbox.oumla.com/api/v1/withdraw";
const clientShare = "YOUR_CLIENT_SHARE";
data["clientShare"] = clientShare;
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": apiKey,
},
body: JSON.stringify(data),
});
const responseData = await response.json();
console.log(responseData);
}
// Example usage
let sendTransactionData = {
network: "BTC",
amount: "0.001",
form: ["tb1qkpncdv42vgsmlvfsuwagqtexc4wnu82pg5q8q2wlgpgcsdkcy0q8js65e"],
to: "tb1qkpncdv42vgsmlvfsuwagqtexc4whu82pg58q2wlgpgcsdkcy0q8js65e"
};
sendTransaction(sendTransactionData).catch((error) => console.error("Error:", error));
The expected response:
{
"id": "1436f4bc75adbe862db0421fffaf83e334edf318283d1f30a0160f539050e",
"status": "Pending"
}
This operation to get transactions by reference
or by address
reference
or by address
GET
https://sandbox.oumla.com/api/v1/transactions/
address
/{{
reference
}}
OR
GET
https://sandbox.oumla.com/api/v1/transactions/
address
/{{
address
}}
Query Parameters (required)
reference*
string
the id for that user.
address*
string
the address of that user.
Headers
x-api-key*
string
Oumla api key
Sample code of the request:
async function getTransactions() {
const apiKey = "Your API Key";
const address = "Your address";
// OR
const reference = "Your reference"
const url = `https://sandbox.oumla.com/api/v1/transactions/address/${address}`;
// OR
const url = `https://sandbox.oumla.com/api/v1/transactions/address/${reference}`;
const options = {
method: "GET",
headers: {
"x-api-key": apiKey,
},
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
}
// Example usage
getTransactionsByAddress().catch((error) => console.error("Error:", error));;
The expected response:
{
"transactions": [
{
"addressFrom": null,
"addressTo": "tb1qkpncdv42vgssmlvfsuwagqtexc4wnu82pq8q2wlgpgcsdkcy0q8js65e",
"amount": 0.00002,
"date": "2024-03-21T23:46:09.484Z",
"isMempool": false,
"isSpent": false,
"status": "Confirmed",
"updatedAt": "2024-03-21T23:48:46.251Z",
"createdAt": "2024-03-21T23:46:09.485Z",
"type": "Deposit",
"network": "BTC",
"txid": "3b176452402f0d1c09c17e55e96c91dbeee609fe130538c45d1cbcd090ffa3"
},
{
"addressFrom": null,
"addressTo": "tb1qkpncdv42vgssmlvfsuwagqtexc4whu82pg58wlgpgcsdkcy0q8js65e",
"amount": 0.00001,
"date": "2024-03-21T23:45:27.890Z",
"isMempool": false,
"isSpent": false,
"status": "Confirmed",
"updatedAt": "2024-03-21T23:48:45.916Z",
"createdAt": "2024-03-21T23:45:27.891Z",
"type": "Deposit",
"network": "BTC",
"txid": "6915a5c70cdfe452c6687940c6b4301ecd964e09f5d10798c34bb958a77be6"
}
// and the other transactions...
],
"totalElements": 2,
"totalPages": 1
}
Last updated