From 93a93e8b125750e59d1384a3144a9fd6465c2e37 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 7 Jun 2024 16:36:03 +0200 Subject: [PATCH 1/4] rpc: add getFeeStats method --- .../api-reference/methods/getFeeStats.mdx | 8 + openrpc/src/methods/getFeeStats.json | 79 +++++++ openrpc/src/schemas/FeeDistribution.json | 67 ++++++ static/openrpc.json | 204 ++++++++++++++++++ 4 files changed, 358 insertions(+) create mode 100644 network/soroban-rpc/api-reference/methods/getFeeStats.mdx create mode 100644 openrpc/src/methods/getFeeStats.json create mode 100644 openrpc/src/schemas/FeeDistribution.json diff --git a/network/soroban-rpc/api-reference/methods/getFeeStats.mdx b/network/soroban-rpc/api-reference/methods/getFeeStats.mdx new file mode 100644 index 000000000..3683632de --- /dev/null +++ b/network/soroban-rpc/api-reference/methods/getFeeStats.mdx @@ -0,0 +1,8 @@ +--- +hide_title: true +description: Returns statistics about charged transaction fees +--- + +import { RpcMethod } from "@site/src/components/RpcMethod"; + + \ No newline at end of file diff --git a/openrpc/src/methods/getFeeStats.json b/openrpc/src/methods/getFeeStats.json new file mode 100644 index 000000000..b604c67bc --- /dev/null +++ b/openrpc/src/methods/getFeeStats.json @@ -0,0 +1,79 @@ +{ + "name": "getFeeStats", + "summary": "returns statistics about charged transaction fees", + "description": "Statistics about charged transaction fees.", + "externalDocs": { + "url": "https://developers.stellar.org/network/soroban-rpc/api-reference/methods/getFeeStats" + }, + "paramStructure": "by-name", + "params": [], + "result": { + "name": "getFeeStatsResult", + "schema": { + "type": "object", + "properties": { + "sorobanInclusionFee": { + "description": "Inclusion fee distribution statistics for Soroban transactions", + "$ref": "#/components/schemas/FeeDistribution" + }, + "inclusionFee": { + "description": "Fee distribution statistics for classic (i.e. non-Soroban) transactions. Statistics are normalized per operation.", + "$ref": "#/components/schemas/FeeDistribution" + }, + "latestLedger": { + "$ref": "#/components/schemas/LatestLedger" + } + } + } + }, + "examples": [ + { + "name": "Statistics about charged transaction fees.", + "description": "Example request to the `getFeeStats` method", + "params": [], + "result": { + "name": "getFeeStatsResult", + "value": { + "sorobanInclusionFee": { + "max": "210", + "min": "100", + "mode": "100", + "p10": "100", + "p20": "100", + "p30": "100", + "p40": "100", + "p50": "100", + "p60": "100", + "p70": "100", + "p80": "100", + "p90": "120", + "p95": "190", + "p99": "200", + "transactionCount": "10", + "ledgerCount": 50 + }, + "inclusionFee": { + "max": "100", + "min": "100", + "mode": "100", + "p10": "100", + "p20": "100", + "p30": "100", + "p40": "100", + "p50": "100", + "p60": "100", + "p70": "100", + "p80": "100", + "p90": "100", + "p95": "100", + "p99": "100", + "transactionCount": "7", + "ledgerCount": 10 + }, + "latestLedger": 4519945 + } + + } + } + ] +} diff --git a/openrpc/src/schemas/FeeDistribution.json b/openrpc/src/schemas/FeeDistribution.json new file mode 100644 index 000000000..46f2a218f --- /dev/null +++ b/openrpc/src/schemas/FeeDistribution.json @@ -0,0 +1,67 @@ +{ + "FeeDistribution": { + "type": "object", + "properties": { + "max": { + "description": "Maximum fee.", + "type": "string" + }, + "min": { + "description": "Minimum fee", + "type": "string" + }, + "mode": { + "description": "Fee value which occurs the most often", + "type": "string" + }, + "p10": { + "description": "10th nearest-rank fee percentile", + "type": "string" + }, + "p20": { + "description": "20th nearest-rank fee percentile", + "type": "string" + }, + "p30": { + "description": "30th nearest-rank fee percentile", + "type": "string" + }, + "p40": { + "description": "40th nearest-rank fee percentile", + "type": "string" + }, + "p50": { + "description": "50th nearest-rank fee percentile", + "type": "string" + }, + "p60": { + "description": "60th nearest-rank fee percentile", + "type": "string" + }, + "p70": { + "description": "70th nearest-rank fee percentile", + "type": "string" + }, + "p80": { + "description": "80th nearest-rank fee percentile", + "type": "string" + }, + "p90": { + "description": "90th nearest-rank fee percentile.", + "type": "string" + }, + "p99": { + "description": "99th nearest-rank fee percentile", + "type": "string" + }, + "transactionCount": { + "description": "How many transactions are part of the distribution", + "type": "number" + }, + "ledgerCount": { + "description": "How many consecutive ledgers form the distribution", + "type": "number" + } + } + } +} diff --git a/static/openrpc.json b/static/openrpc.json index 3ae501e2b..3ee183436 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -334,6 +334,210 @@ } ] }, + { + "name": "getFeeStats", + "summary": "returns statistics about charged transaction fees", + "description": "Statistics about charged transaction fees.", + "externalDocs": { + "url": "https://developers.stellar.org/network/soroban-rpc/api-reference/methods/getFeeStats" + }, + "paramStructure": "by-name", + "params": [], + "result": { + "name": "getFeeStatsResult", + "schema": { + "type": "object", + "properties": { + "sorobanInclusionFee": { + "type": "object", + "description": "Inclusion fee distribution statistics for Soroban transactions", + "properties": { + "max": { + "description": "Maximum fee.", + "type": "string" + }, + "min": { + "description": "Minimum fee", + "type": "string" + }, + "mode": { + "description": "Fee value which occurs the most often", + "type": "string" + }, + "p10": { + "description": "10th nearest-rank fee percentile", + "type": "string" + }, + "p20": { + "description": "20th nearest-rank fee percentile", + "type": "string" + }, + "p30": { + "description": "30th nearest-rank fee percentile", + "type": "string" + }, + "p40": { + "description": "40th nearest-rank fee percentile", + "type": "string" + }, + "p50": { + "description": "50th nearest-rank fee percentile", + "type": "string" + }, + "p60": { + "description": "60th nearest-rank fee percentile", + "type": "string" + }, + "p70": { + "description": "70th nearest-rank fee percentile", + "type": "string" + }, + "p80": { + "description": "80th nearest-rank fee percentile", + "type": "string" + }, + "p90": { + "description": "90th nearest-rank fee percentile.", + "type": "string" + }, + "p99": { + "description": "99th nearest-rank fee percentile", + "type": "string" + }, + "transactionCount": { + "description": "How many transactions are part of the distribution", + "type": "number" + }, + "ledgerCount": { + "description": "How many consecutive ledgers form the distribution", + "type": "number" + } + } + }, + "inclusionFee": { + "type": "object", + "description": "Fee distribution statistics for classic (i.e. non-Soroban) transactions. Statistics are normalized per operation.", + "properties": { + "max": { + "description": "Maximum fee.", + "type": "string" + }, + "min": { + "description": "Minimum fee", + "type": "string" + }, + "mode": { + "description": "Fee value which occurs the most often", + "type": "string" + }, + "p10": { + "description": "10th nearest-rank fee percentile", + "type": "string" + }, + "p20": { + "description": "20th nearest-rank fee percentile", + "type": "string" + }, + "p30": { + "description": "30th nearest-rank fee percentile", + "type": "string" + }, + "p40": { + "description": "40th nearest-rank fee percentile", + "type": "string" + }, + "p50": { + "description": "50th nearest-rank fee percentile", + "type": "string" + }, + "p60": { + "description": "60th nearest-rank fee percentile", + "type": "string" + }, + "p70": { + "description": "70th nearest-rank fee percentile", + "type": "string" + }, + "p80": { + "description": "80th nearest-rank fee percentile", + "type": "string" + }, + "p90": { + "description": "90th nearest-rank fee percentile.", + "type": "string" + }, + "p99": { + "description": "99th nearest-rank fee percentile", + "type": "string" + }, + "transactionCount": { + "description": "How many transactions are part of the distribution", + "type": "number" + }, + "ledgerCount": { + "description": "How many consecutive ledgers form the distribution", + "type": "number" + } + } + }, + "latestLedger": { + "title": "latestLedger", + "description": "The sequence number of the latest ledger known to Soroban RPC at the time it handled the request.", + "type": "number" + } + } + } + }, + "examples": [ + { + "name": "Statistics about charged transaction fees.", + "description": "Example request to the `getFeeStats` method", + "params": [], + "result": { + "name": "getFeeStatsResult", + "value": { + "sorobanInclusionFee": { + "max": "210", + "min": "100", + "mode": "100", + "p10": "100", + "p20": "100", + "p30": "100", + "p40": "100", + "p50": "100", + "p60": "100", + "p70": "100", + "p80": "100", + "p90": "120", + "p95": "190", + "p99": "200", + "transactionCount": "10", + "ledgerCount": 50 + }, + "inclusionFee": { + "max": "100", + "min": "100", + "mode": "100", + "p10": "100", + "p20": "100", + "p30": "100", + "p40": "100", + "p50": "100", + "p60": "100", + "p70": "100", + "p80": "100", + "p90": "100", + "p95": "100", + "p99": "100", + "transactionCount": "7", + "ledgerCount": 10 + }, + "latestLedger": 4519945 + } + } + } + ] + }, { "name": "getHealth", "summary": "returns node health", From 073e78a64039aacaf58f461cd1d78a3be39c6069 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 7 Jun 2024 21:04:58 +0200 Subject: [PATCH 2/4] Address review feedback --- openrpc/src/methods/getFeeStats.json | 2 +- static/openrpc.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openrpc/src/methods/getFeeStats.json b/openrpc/src/methods/getFeeStats.json index b604c67bc..aa0470162 100644 --- a/openrpc/src/methods/getFeeStats.json +++ b/openrpc/src/methods/getFeeStats.json @@ -17,7 +17,7 @@ "$ref": "#/components/schemas/FeeDistribution" }, "inclusionFee": { - "description": "Fee distribution statistics for classic (i.e. non-Soroban) transactions. Statistics are normalized per operation.", + "description": "Fee distribution statistics for Stellar (i.e. non-Soroban) transactions. Statistics are normalized per operation.", "$ref": "#/components/schemas/FeeDistribution" }, "latestLedger": { diff --git a/static/openrpc.json b/static/openrpc.json index 3ee183436..6d7f899a3 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -416,7 +416,7 @@ }, "inclusionFee": { "type": "object", - "description": "Fee distribution statistics for classic (i.e. non-Soroban) transactions. Statistics are normalized per operation.", + "description": "Fee distribution statistics for Stellar (i.e. non-Soroban) transactions. Statistics are normalized per operation.", "properties": { "max": { "description": "Maximum fee.", From 5639537bf4e32540f51012f7983396ebac16457f Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 7 Jun 2024 21:06:52 +0200 Subject: [PATCH 3/4] Remove unneeded stop --- openrpc/src/schemas/FeeDistribution.json | 2 +- static/openrpc.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openrpc/src/schemas/FeeDistribution.json b/openrpc/src/schemas/FeeDistribution.json index 46f2a218f..7c7fffdfe 100644 --- a/openrpc/src/schemas/FeeDistribution.json +++ b/openrpc/src/schemas/FeeDistribution.json @@ -3,7 +3,7 @@ "type": "object", "properties": { "max": { - "description": "Maximum fee.", + "description": "Maximum fee", "type": "string" }, "min": { diff --git a/static/openrpc.json b/static/openrpc.json index 6d7f899a3..06410e072 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -353,7 +353,7 @@ "description": "Inclusion fee distribution statistics for Soroban transactions", "properties": { "max": { - "description": "Maximum fee.", + "description": "Maximum fee", "type": "string" }, "min": { @@ -419,7 +419,7 @@ "description": "Fee distribution statistics for Stellar (i.e. non-Soroban) transactions. Statistics are normalized per operation.", "properties": { "max": { - "description": "Maximum fee.", + "description": "Maximum fee", "type": "string" }, "min": { From b80082eefcc86913f04ee9b0acc8b06ce1c25fe6 Mon Sep 17 00:00:00 2001 From: Jane Wang Date: Fri, 7 Jun 2024 15:20:49 -0400 Subject: [PATCH 4/4] Add some description updates --- network/soroban-rpc/api-reference/methods/getFeeStats.mdx | 4 ++-- openrpc/src/methods/getFeeStats.json | 4 ++-- static/openrpc.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/network/soroban-rpc/api-reference/methods/getFeeStats.mdx b/network/soroban-rpc/api-reference/methods/getFeeStats.mdx index 3683632de..959af6630 100644 --- a/network/soroban-rpc/api-reference/methods/getFeeStats.mdx +++ b/network/soroban-rpc/api-reference/methods/getFeeStats.mdx @@ -1,8 +1,8 @@ --- hide_title: true -description: Returns statistics about charged transaction fees +description: Returns statistics about charged inclusion fees for Soroban transactions and Stellar transactions --- import { RpcMethod } from "@site/src/components/RpcMethod"; - \ No newline at end of file + diff --git a/openrpc/src/methods/getFeeStats.json b/openrpc/src/methods/getFeeStats.json index aa0470162..fd322c105 100644 --- a/openrpc/src/methods/getFeeStats.json +++ b/openrpc/src/methods/getFeeStats.json @@ -1,7 +1,7 @@ { "name": "getFeeStats", - "summary": "returns statistics about charged transaction fees", - "description": "Statistics about charged transaction fees.", + "summary": "returns statistics about charged inclusion fees", + "description": "Statistics for charged inclusion fees. The inclusion fee statistics are calculated from the inclusion fees that were paid for the transactions to be included onto the ledger. For Soroban transactions and Stellar transactions, they each have their own inclusion fees and own surge pricing. Inclusion fees are used to prevent spam and prioritize transactions during network traffic surge.", "externalDocs": { "url": "https://developers.stellar.org/network/soroban-rpc/api-reference/methods/getFeeStats" }, diff --git a/static/openrpc.json b/static/openrpc.json index 06410e072..62ae42f04 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -336,8 +336,8 @@ }, { "name": "getFeeStats", - "summary": "returns statistics about charged transaction fees", - "description": "Statistics about charged transaction fees.", + "summary": "returns statistics about charged inclusion fees", + "description": "Statistics for charged inclusion fees. The inclusion fee statistics are calculated from the inclusion fees that were paid for the transactions to be included onto the ledger. For Soroban transactions and Stellar transactions, they each have their own inclusion fees and own surge pricing. Inclusion fees are used to prevent spam and prioritize transactions during network traffic surge.", "externalDocs": { "url": "https://developers.stellar.org/network/soroban-rpc/api-reference/methods/getFeeStats" },