Module
Transactions โ 2 credits
Check transaction status, browse history, and look up raw on-chain transaction data. All methods require API Key authentication and cost 2 credits each.
API Key
status()
POST
2 credits
API Key
Check the confirmation status of a transaction by its hash. Use this to poll after a transfer or contract write.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$txHash | string | Yes | Transaction hash (0x-prefixed hex) |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
Example
$result = Web3Api::transactions()->status(
txHash: '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
network: 'polygon',
);
Response
[
'tx_hash' => '0xabcdef...',
'status' => 'confirmed', // "pending", "confirmed", or "failed"
'block_number' => 12345678,
'gas_used' => 21000,
]
history()
GET
2 credits
API Key
List stored transactions with optional filters for status and type. Returns the API's internal transaction records (not necessarily all on-chain activity).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$page | int | No | Page number (default: 1) |
$limit | int | No | Results per page (default: 50, max: 100) |
$status | ?string | No | Filter by status: "pending", "confirmed", or "failed" |
$type | ?string | No | Filter by type: "transfer", "token_transfer", "nft_transfer", etc. |
Example
// Get confirmed transfers
$txs = Web3Api::transactions()->history(
page: 1,
limit: 20,
status: 'confirmed',
type: 'token_transfer',
);
foreach ($txs as $tx) {
echo $tx['tx_hash']; // "0xabc..."
echo $tx['from_address']; // "0xSENDER..."
echo $tx['to_address']; // "0xRECEIVER..."
echo $tx['amount']; // "10.5"
echo $tx['transaction_type']; // "token_transfer"
echo $tx['status']; // "confirmed"
echo $tx['block_number']; // 12345678
}
Response item shape
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"tx_hash": "0xabcdef...",
"from_address": "0xSENDER...",
"to_address": "0xRECEIVER...",
"token_address": "0xUSDC...",
"amount": "10.5",
"transaction_type": "token_transfer",
"status": "confirmed",
"gas_used": 65000,
"block_number": 12345678,
"created_at": "2024-06-01T12:00:00"
}
onchain()
GET
2 credits
API Key
Fetch raw on-chain transaction data directly from the blockchain node. Returns the actual transaction object as broadcast.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$txHash | string | Yes | Transaction hash (0x-prefixed) |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
Example
$tx = Web3Api::transactions()->onchain(
txHash: '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
network: 'ethereum',
);
// Returns raw on-chain tx object with from, to, value, gas, input data, etc.
get()
GET
2 credits
API Key
Retrieve a specific stored transaction by its internal UUID (not by tx hash). Useful when you've stored the UUID from history() or status().
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$txId | string | Yes | Internal transaction UUID |
Example
$tx = Web3Api::transactions()->get(
txId: '550e8400-e29b-41d4-a716-446655440000',
);
// Returns same shape as a history() entry