-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from Concordium/node7-support
Support Concordium Node v7 API changes
- Loading branch information
Showing
16 changed files
with
243 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
RUST_VERSION: 1.68 | ||
RUST_VERSION: 1.73 | ||
|
||
jobs: | ||
build-native-ubuntu: | ||
|
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
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
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,22 @@ | ||
using Concordium.Sdk.Helpers; | ||
|
||
namespace Concordium.Sdk.Types; | ||
|
||
/// <summary> | ||
/// The stake on the account that is in cooldown. | ||
/// </summary> | ||
/// <param name="EndTime">The time when the cooldown period ends.</param> | ||
/// <param name="Amount">The amount that is in cooldown and set to be released at the end of the cooldown period.</param> | ||
/// <param name="Status">The status of the cooldown.</param> | ||
public sealed record Cooldown( | ||
DateTimeOffset EndTime, | ||
CcdAmount Amount, | ||
CooldownStatus Status | ||
) | ||
{ | ||
internal static Cooldown From(Grpc.V2.Cooldown cooldown) => new( | ||
cooldown.EndTime.ToDateTimeOffset(), | ||
CcdAmount.From(cooldown.Amount), | ||
cooldown.Status.Into() | ||
); | ||
} |
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,48 @@ | ||
using Concordium.Sdk.Exceptions; | ||
|
||
namespace Concordium.Sdk.Types; | ||
|
||
/// <summary> | ||
/// The status of a cooldown. | ||
/// </summary> | ||
/// <remarks> | ||
/// When stake is removed from a baker or delegator | ||
/// (from protocol version 7) it first enters the pre-pre-cooldown state. | ||
/// The next time the stake snaphot is taken (at the epoch transition before | ||
/// a payday) it enters the pre-cooldown state. At the subsequent payday, it | ||
/// enters the cooldown state. At the payday after the end of the cooldown | ||
/// period, the stake is finally released. | ||
/// </remarks> | ||
public enum CooldownStatus | ||
{ | ||
/// <summary> | ||
/// The amount is in cooldown and will expire at the specified time, becoming available | ||
/// at the subsequent pay day. | ||
/// </summary> | ||
Cooldown, | ||
/// <summary> | ||
/// The amount will enter cooldown at the next pay day. The specified end time is | ||
/// projected to be the end of the cooldown period, but the actual end time will be | ||
/// determined at the payday, and may be different if the global cooldown period | ||
/// changes. | ||
/// </summary> | ||
PreCooldown, | ||
/// <summary> | ||
/// The amount will enter pre-cooldown at the next snapshot epoch (i.e. the epoch | ||
/// transition before a pay day transition). As with pre-cooldown, the specified | ||
/// end time is projected, but the actual end time will be determined later. | ||
/// </summary> | ||
PrePreCooldown | ||
} | ||
|
||
internal static class CooldownStatusFactory | ||
{ | ||
internal static CooldownStatus Into(this Grpc.V2.Cooldown.Types.CooldownStatus status) => | ||
status switch | ||
{ | ||
Grpc.V2.Cooldown.Types.CooldownStatus.Cooldown => CooldownStatus.Cooldown, | ||
Grpc.V2.Cooldown.Types.CooldownStatus.PreCooldown => CooldownStatus.PreCooldown, | ||
Grpc.V2.Cooldown.Types.CooldownStatus.PrePreCooldown => CooldownStatus.PrePreCooldown, | ||
_ => throw new MissingEnumException<Grpc.V2.Cooldown.Types.CooldownStatus>(status) | ||
}; | ||
} |
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,22 @@ | ||
using Concordium.Sdk.Helpers; | ||
|
||
namespace Concordium.Sdk.Types; | ||
|
||
/// <summary> | ||
/// An individual release of a locked balance. | ||
/// </summary> | ||
/// <param name="Timestamp">Effective time of the release.</param> | ||
/// <param name="Amount">Amount to be released.</param> | ||
/// <param name="Transactions">List of transaction hashes that contribute a balance to this release.</param> | ||
public sealed record Release( | ||
DateTimeOffset Timestamp, | ||
CcdAmount Amount, | ||
IList<TransactionHash> Transactions | ||
) | ||
{ | ||
internal static Release From(Grpc.V2.Release release) => new( | ||
release.Timestamp.ToDateTimeOffset(), | ||
CcdAmount.From(release.Amount), | ||
release.Transactions.Select(TransactionHash.From).ToList() | ||
); | ||
} |
Oops, something went wrong.