payment_queryInfo - JSON-RPC Method
Description#
Calculates the weight and partial fee that a given signed extrinsic would incur on Enjin Matrix. Call this endpoint before author_submitExtrinsic to display fee previews or to enforce wallet budgeting logic.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
extrinsic | string | Yes | Signed, SCALE-encoded extrinsic in hex |
blockHash | string | null | No | Block hash to evaluate against (default: best block) |
Returns#
| Field | Type | Description |
|---|---|---|
weight.ref_time | number | Execution weight measured in picoseconds |
weight.proof_size | number | Size of storage proofs in bytes |
class | string | Dispatch class (normal, operational, mandatory) |
partialFee | string | Fee in plancks (18 decimals for ENJ) |
Request Example#
{
"jsonrpc": "2.0",
"method": "payment_queryInfo",
"params": [
"0x280403000b40c006a99901",
null
],
"id": 1
}
Response Example#
{
"jsonrpc": "2.0",
"result": {
"weight": {
"ref_time": 162586000,
"proof_size": 1493
},
"class": "mandatory",
"partialFee": "0"
},
"id": 1
}
(The sample extrinsic is a system remark with zero fee; regular transfers will return a non-zero partialFee.)
Code Examples#
- cURL
- Python
- JavaScript
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "payment_queryInfo",
"params": ["0x280403000b40c006a99901", null],
"id": 1
}'
{
"jsonrpc": "2.0",
"result": {
"weight": {
"ref_time": 162586000,
"proof_size": 1493
},
"class": "mandatory",
"partialFee": "0"
},
"id": 1
}
The sample extrinsic is a system remark included in block 0x1873093eade39aa409f64537dd972c27156e4691fc0fda227a06d50c52ad5fef, so it reports a zero fee. Substitute your own signed payload to estimate fees for pending transactions.
payload = {
"jsonrpc": "2.0",
"method": "payment_queryInfo",
"params": ["0xSIGNED_EXTRINSIC", None],
"id": 1,
}
info = requests.post(
"https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload),
timeout=10,
).json()["result"]
print(info)
const body = {
jsonrpc: '2.0',
method: 'payment_queryInfo',
params: ['0xSIGNED_EXTRINSIC', null],
id: 1
};
const info = await fetch('https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
}).then((res) => res.json());
console.log(info.result.partialFee);
Tips#
- Use the returned
weightto settipvalues when prioritizing extrinsics. - When building transactions with fuel tanks, check if the partial fee is zero, indicating sponsorship.
- Cache results per extrinsic payload if you queue multiple submissions of the same call.