-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements Epoch and Fee related methods (#58)
* Implementing all Slot related methods and fixing some docs * Implements fees and epoch rpc methods * Deleting transaction models file
- Loading branch information
1 parent
14d6220
commit a1fb441
Showing
17 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
namespace Solnet.Rpc.Models | ||
{ | ||
/// <summary> | ||
/// Represents information about the current epoch. | ||
/// </summary> | ||
public class EpochInfo | ||
{ | ||
/// <summary> | ||
/// The current slot. | ||
/// </summary> | ||
public ulong AbsoluteSlot { get; set; } | ||
|
||
/// <summary> | ||
/// The current block height. | ||
/// </summary> | ||
public ulong BlockHeight { get; set; } | ||
|
||
/// <summary> | ||
/// The current epoch. | ||
/// </summary> | ||
public ulong Epoch { get; set; } | ||
|
||
/// <summary> | ||
/// The current slot relative to the start of the current epoch. | ||
/// </summary> | ||
public ulong SlotIndex { get; set; } | ||
|
||
/// <summary> | ||
/// The number of slots in this epoch | ||
/// </summary> | ||
public ulong SlotsInEpoch { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Represents information about the epoch schedule. | ||
/// </summary> | ||
public class EpochScheduleInfo | ||
{ | ||
/// <summary> | ||
/// The maximum number of slots in each epoch. | ||
/// </summary> | ||
public ulong SlotsPerEpoch { get; set; } | ||
|
||
/// <summary> | ||
/// The number of slots before beginning of an epoch to calculate a leader schedule for that epoch. | ||
/// </summary> | ||
public ulong LeaderScheduleSlotOffset { get; set; } | ||
|
||
/// <summary> | ||
/// The first normal-length epoch. | ||
/// </summary> | ||
public ulong FirstNormalEpoch { get; set; } | ||
|
||
/// <summary> | ||
/// The first normal-length slot. | ||
/// </summary> | ||
public ulong FirstNormalSlot { get; set; } | ||
|
||
/// <summary> | ||
/// Whether epochs start short and grow. | ||
/// </summary> | ||
public bool Warmup { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace Solnet.Rpc.Models | ||
{ | ||
/// <summary> | ||
/// Represents the fee rate governor. | ||
/// </summary> | ||
public class FeeRateGovernor | ||
{ | ||
/// <summary> | ||
/// Percentage of fees collected to be destroyed. | ||
/// </summary> | ||
public decimal BurnPercent { get; set; } | ||
|
||
/// <summary> | ||
/// Highest value LamportsPerSignature can attain for the next slot. | ||
/// </summary> | ||
public ulong MaxLamportsPerSignature { get; set; } | ||
|
||
/// <summary> | ||
/// Smallest value LamportsPerSignature can attain for the next slot. | ||
/// </summary> | ||
public ulong MinLamportsPerSignature { get; set; } | ||
|
||
/// <summary> | ||
/// Desired fee rate for the cluster. | ||
/// </summary> | ||
public ulong TargetLamportsPerSignature { get; set; } | ||
|
||
/// <summary> | ||
/// Desired signature rate for the cluster. | ||
/// </summary> | ||
public ulong TargetSignaturesPerSlot { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Represents the fee rate governor info. | ||
/// </summary> | ||
public class FeeRateGovernorInfo | ||
{ | ||
/// <summary> | ||
/// The fee rate governor. | ||
/// </summary> | ||
public FeeRateGovernor FeeRateGovernor { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Represents information about the fees. | ||
/// </summary> | ||
public class FeesInfo | ||
{ | ||
/// <summary> | ||
/// A block hash as base-58 encoded string. | ||
/// </summary> | ||
public string Blockhash { get; set; } | ||
|
||
/// <summary> | ||
/// The fee calculator for this block hash. | ||
/// </summary> | ||
public FeeCalculator FeeCalculator { get; set; } | ||
|
||
/// <summary> | ||
/// DEPRECATED - this value is inaccurate and should not be relied upon | ||
/// </summary> | ||
public ulong LastValidSlot { get; set; } | ||
|
||
/// <summary> | ||
/// Last block height at which a blockhash will be valid. | ||
/// </summary> | ||
public ulong LastValidBlockHeight { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"method":"getEpochInfo","jsonrpc":"2.0","id":0} |
11 changes: 11 additions & 0 deletions
11
test/Solnet.Rpc.Test/Resources/Http/GetEpochInfoResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"absoluteSlot": 166598, | ||
"blockHeight": 166500, | ||
"epoch": 27, | ||
"slotIndex": 2790, | ||
"slotsInEpoch": 8192 | ||
}, | ||
"id": 0 | ||
} |
1 change: 1 addition & 0 deletions
1
test/Solnet.Rpc.Test/Resources/Http/GetEpochScheduleRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"method":"getEpochSchedule","jsonrpc":"2.0","id":0} |
11 changes: 11 additions & 0 deletions
11
test/Solnet.Rpc.Test/Resources/Http/GetEpochScheduleResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"firstNormalEpoch": 8, | ||
"firstNormalSlot": 8160, | ||
"leaderScheduleSlotOffset": 8192, | ||
"slotsPerEpoch": 8192, | ||
"warmup": true | ||
}, | ||
"id": 0 | ||
} |
1 change: 1 addition & 0 deletions
1
test/Solnet.Rpc.Test/Resources/Http/GetFeeCalculatorForBlockhashRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"method":"getFeeCalculatorForBlockhash","params":["GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ"],"jsonrpc":"2.0","id":0} |
14 changes: 14 additions & 0 deletions
14
test/Solnet.Rpc.Test/Resources/Http/GetFeeCalculatorForBlockhashResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"context": { | ||
"slot": 221 | ||
}, | ||
"value": { | ||
"feeCalculator": { | ||
"lamportsPerSignature": 5000 | ||
} | ||
} | ||
}, | ||
"id": 0 | ||
} |
1 change: 1 addition & 0 deletions
1
test/Solnet.Rpc.Test/Resources/Http/GetFeeRateGovernorRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"method":"getFeeRateGovernor","jsonrpc":"2.0","id":0} |
18 changes: 18 additions & 0 deletions
18
test/Solnet.Rpc.Test/Resources/Http/GetFeeRateGovernorResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"context": { | ||
"slot": 54 | ||
}, | ||
"value": { | ||
"feeRateGovernor": { | ||
"burnPercent": 50, | ||
"maxLamportsPerSignature": 100000, | ||
"minLamportsPerSignature": 5000, | ||
"targetLamportsPerSignature": 10000, | ||
"targetSignaturesPerSlot": 20000 | ||
} | ||
} | ||
}, | ||
"id": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"method":"getFees","jsonrpc":"2.0","id":0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"context": { | ||
"slot": 1 | ||
}, | ||
"value": { | ||
"blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", | ||
"feeCalculator": { | ||
"lamportsPerSignature": 5000 | ||
}, | ||
"lastValidSlot": 297, | ||
"lastValidBlockHeight": 296 | ||
} | ||
}, | ||
"id": 0 | ||
} |
Oops, something went wrong.