diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1957c197..0f1972ccd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## Unreleased
+- Support for Protocol 7
+- Added `ProtocolVersion.V7` corresponding to Protocol version 7
+- Added `cooldowns` list to `AccountInfo`
+- Added `availableBalance` to `AccountInfo`
+- Made optional the following `BakerPoolStatus` fields:
+ `bakerEquityCapital`, `delegatedCapital`, `delegatedCapitalCap`, `poolInfo`
+- Added `BakerDelegationRemoved` and `DelegationBakerRemoved` transaction result events
+
## 7.2.0
- Added `MessageSigningDigest` class to generate digests for message signing
- Added support for company identity attributes
diff --git a/concordium-android-sdk/pom.xml b/concordium-android-sdk/pom.xml
index fd4d2f243..47a1960f4 100644
--- a/concordium-android-sdk/pom.xml
+++ b/concordium-android-sdk/pom.xml
@@ -5,7 +5,7 @@
com.concordium.sdk
concordium-sdk-base
- 7.2.0
+ 8.0.0-SNAPSHOT
concordium-android-sdk
diff --git a/concordium-base b/concordium-base
index 38cf687f1..8c925efc1 160000
--- a/concordium-base
+++ b/concordium-base
@@ -1 +1 @@
-Subproject commit 38cf687f16074b9a2538093a40e2befa06cd104d
+Subproject commit 8c925efc17405cc2927f20df46ed5b57275840c2
diff --git a/concordium-sdk-examples/pom.xml b/concordium-sdk-examples/pom.xml
index 8f49ed5b2..778848320 100644
--- a/concordium-sdk-examples/pom.xml
+++ b/concordium-sdk-examples/pom.xml
@@ -23,7 +23,7 @@
com.concordium.sdk
concordium-sdk
- 7.2.0
+ 8.0.0-SNAPSHOT
compile
diff --git a/concordium-sdk/pom.xml b/concordium-sdk/pom.xml
index 4cb7a45d3..3cae43a53 100644
--- a/concordium-sdk/pom.xml
+++ b/concordium-sdk/pom.xml
@@ -7,7 +7,7 @@
com.concordium.sdk
concordium-sdk-base
- 7.2.0
+ 8.0.0-SNAPSHOT
com.concordium.sdk
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2MapperExtensions.java b/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2MapperExtensions.java
index 866727240..d3612785a 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2MapperExtensions.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2MapperExtensions.java
@@ -1,5 +1,6 @@
package com.concordium.sdk;
+import com.concordium.grpc.v2.AbsoluteBlockHeight;
import com.concordium.grpc.v2.AccessStructure;
import com.concordium.grpc.v2.AccountAddress;
import com.concordium.grpc.v2.AccountIndex;
@@ -9,6 +10,7 @@
import com.concordium.grpc.v2.BlockItem;
import com.concordium.grpc.v2.Commitment;
import com.concordium.grpc.v2.ContractAddress;
+import com.concordium.grpc.v2.Cooldown;
import com.concordium.grpc.v2.CredentialPublicKeys;
import com.concordium.grpc.v2.CredentialRegistrationId;
import com.concordium.grpc.v2.DelegatorInfo;
@@ -21,7 +23,6 @@
import com.concordium.grpc.v2.Policy;
import com.concordium.grpc.v2.ProtocolVersion;
import com.concordium.grpc.v2.ReleaseSchedule;
-import com.concordium.grpc.v2.AbsoluteBlockHeight;
import com.concordium.grpc.v2.*;
import com.concordium.sdk.crypto.bulletproof.BulletproofGenerators;
import com.concordium.sdk.crypto.ed25519.ED25519PublicKey;
@@ -314,6 +315,7 @@ static com.concordium.sdk.responses.accountinfo.AccountInfo to(AccountInfo accou
builder
.Nonce(to(account.getSequenceNumber()))
.accountAmount(to(account.getAmount()))
+ .availableBalance(to(account.getAvailableBalance()))
.accountReleaseSchedule(to(account.getSchedule()))
.accountCredentials(ImmutableMap.copyOf(to(
account.getCredsMap(),
@@ -323,7 +325,8 @@ static com.concordium.sdk.responses.accountinfo.AccountInfo to(AccountInfo accou
.accountEncryptedAmount(to(account.getEncryptedBalance()))
.accountEncryptionKey(ElgamalPublicKey.from(account.getEncryptionKey().getValue().toByteArray()))
.accountIndex(to(account.getIndex()))
- .accountAddress(to(account.getAddress()));
+ .accountAddress(to(account.getAddress()))
+ .cooldowns(copyOf(to(account.getCooldownsList(), ClientV2MapperExtensions::to)));
if (account.hasStake()) {
switch (account.getStake().getStakingInfoCase()) {
@@ -344,6 +347,14 @@ static com.concordium.sdk.types.AccountAddress to(AccountAddress address) {
return com.concordium.sdk.types.AccountAddress.from(address.getValue().toByteArray());
}
+ static com.concordium.sdk.responses.accountinfo.Cooldown to(Cooldown cooldown) {
+ return com.concordium.sdk.responses.accountinfo.Cooldown.builder()
+ .amount(to(cooldown.getAmount()))
+ .endTime(Timestamp.from(cooldown.getEndTime()))
+ .status(com.concordium.sdk.responses.accountinfo.Cooldown.CooldownStatus.from(cooldown.getStatus()))
+ .build();
+ }
+
@Nullable
static AccountDelegation to(com.concordium.grpc.v2.AccountStakingInfo.Delegator stake) {
return AccountDelegation.builder()
@@ -1232,14 +1243,24 @@ static BakerPoolStatus to(PoolInfoResponse grpcOutput) {
return BakerPoolStatus.builder()
.bakerId(to(grpcOutput.getBaker()))
.bakerAddress(to(grpcOutput.getAddress()))
- .bakerEquityCapital(to(grpcOutput.getEquityCapital()))
- .delegatedCapital(to(grpcOutput.getDelegatedCapital()))
- .delegatedCapitalCap(to(grpcOutput.getDelegatedCapitalCap()))
- .poolInfo(to(grpcOutput.getPoolInfo()))
+ .bakerEquityCapital(grpcOutput.hasEquityCapital()
+ ? to(grpcOutput.getEquityCapital())
+ : null)
+ .delegatedCapital(grpcOutput.hasDelegatedCapital()
+ ? to(grpcOutput.getDelegatedCapital())
+ : null)
+ .delegatedCapitalCap(grpcOutput.hasDelegatedCapitalCap()
+ ? to(grpcOutput.getDelegatedCapitalCap())
+ : null)
+ .poolInfo(grpcOutput.hasPoolInfo()
+ ? to(grpcOutput.getPoolInfo())
+ : null)
.bakerStakePendingChange(grpcOutput.hasEquityPendingChange()
? to(grpcOutput.getEquityPendingChange())
: null)
- .currentPaydayStatus(grpcOutput.hasCurrentPaydayInfo() ? to(grpcOutput.getCurrentPaydayInfo()) : null)
+ .currentPaydayStatus(grpcOutput.hasCurrentPaydayInfo()
+ ? to(grpcOutput.getCurrentPaydayInfo())
+ : null)
.allPoolTotalCapital(to(grpcOutput.getAllPoolTotalCapital()))
.build();
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/AccountIndex.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/AccountIndex.java
index fc446ac60..517ea7417 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/AccountIndex.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/AccountIndex.java
@@ -1,13 +1,9 @@
package com.concordium.sdk.responses;
import com.concordium.grpc.v2.DelegatorId;
-import com.concordium.sdk.types.UInt16;
import com.concordium.sdk.types.UInt64;
import lombok.EqualsAndHashCode;
import lombok.Getter;
-import lombok.val;
-
-import java.nio.ByteBuffer;
/**
* Account index
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/ProtocolVersion.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/ProtocolVersion.java
index 98f8e4ef5..be4a690c1 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/ProtocolVersion.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/ProtocolVersion.java
@@ -24,7 +24,12 @@ public enum ProtocolVersion {
/**
* https://github.com/Concordium/concordium-update-proposals/blob/main/updates/P6.txt
*/
- V6;
+ V6,
+ /**
+ * https://github.com/Concordium/concordium-update-proposals/blob/main/updates/P7.txt
+ */
+ V7,
+ ;
/**
* Parses {@link com.concordium.grpc.v2.ProtocolVersion} to {@link ProtocolVersion}.
@@ -46,6 +51,8 @@ public static ProtocolVersion parse(com.concordium.grpc.v2.ProtocolVersion proto
return V5;
case PROTOCOL_VERSION_6:
return V6;
+ case PROTOCOL_VERSION_7:
+ return V7;
default:
throw new IllegalArgumentException("Unrecognized protocol version " + protocolVersion);
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/AccountInfo.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/AccountInfo.java
index b7fab799d..23cb0f8bd 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/AccountInfo.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/AccountInfo.java
@@ -7,10 +7,10 @@
import com.concordium.sdk.transactions.Index;
import com.concordium.sdk.types.AccountAddress;
import com.concordium.sdk.types.Nonce;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import lombok.Builder;
import lombok.Data;
-import lombok.EqualsAndHashCode;
import lombok.Singular;
import lombok.extern.jackson.Jacksonized;
@@ -37,6 +37,15 @@ public final class AccountInfo {
* The amount of CCD owned by this account.
*/
private final CCDAmount accountAmount;
+ /**
+ * The available (unencrypted) balance of the account (i.e. that can be transferred
+ * or used to pay for transactions). This is the balance ({@link AccountInfo#accountAmount})
+ * minus the locked amount.
+ * The locked amount is the maximum of the amount in the release schedule ({@link AccountInfo#accountReleaseSchedule})
+ * and the total amount that is actively staked or in cooldown (inactive stake, {@link AccountInfo#cooldowns}).
+ * This was introduced in node version 7.0.
+ */
+ private final CCDAmount availableBalance;
/**
* The account threshold for this account i.e., how
* many credentials that needs to sign transactions for this account.
@@ -76,11 +85,18 @@ public final class AccountInfo {
*/
@Singular
private final ImmutableMap accountCredentials;
-
/**
* If the account is delegating then this is non-null.
*/
private final AccountDelegation delegation;
+ /**
+ * The stake on the account that is in cooldown.
+ * There can be multiple amounts in cooldown that expire at different times.
+ * This was introduced in protocol version 7, and so is not present in
+ * earlier protocol versions.
+ */
+ @Singular
+ private final ImmutableList cooldowns;
public boolean isBaker() {
return !Objects.isNull(bakerInfo);
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/Cooldown.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/Cooldown.java
new file mode 100644
index 000000000..635ead541
--- /dev/null
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/accountinfo/Cooldown.java
@@ -0,0 +1,50 @@
+package com.concordium.sdk.responses.accountinfo;
+
+import com.concordium.sdk.transactions.CCDAmount;
+import com.concordium.sdk.types.Timestamp;
+import lombok.Builder;
+import lombok.Data;
+import lombok.extern.jackson.Jacksonized;
+
+/**
+ * Records the amount, (expected) release time and whether it's a regular cooldown,
+ * pre-cooldown or pre-pre-cooldown.
+ */
+@Data
+@Jacksonized
+@Builder
+public final class Cooldown {
+ /**
+ * The time in milliseconds since the Unix epoch when the cooldown period ends.
+ */
+ private final Timestamp endTime;
+ /**
+ * The amount that is in cooldown and set to be released at the end of the
+ * cooldown period.
+ */
+ private final CCDAmount amount;
+ /**
+ * The status of the cooldown.
+ */
+ private final CooldownStatus status;
+
+ public enum CooldownStatus {
+ COOLDOWN,
+ PRE_COOLDOWN,
+ PRE_PRE_COOLDOWN,
+ ;
+
+ public static CooldownStatus from(com.concordium.grpc.v2.Cooldown.CooldownStatus cooldownStatus) {
+ switch (cooldownStatus) {
+ case COOLDOWN:
+ return COOLDOWN;
+ case PRE_COOLDOWN:
+ return PRE_COOLDOWN;
+ case PRE_PRE_COOLDOWN:
+ return PRE_PRE_COOLDOWN;
+ default:
+ throw new IllegalArgumentException("Unrecognized cooldown status.");
+ }
+ }
+ }
+}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/BakerConfigured.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/BakerConfigured.java
index e404fe291..320379135 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/BakerConfigured.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/BakerConfigured.java
@@ -58,6 +58,8 @@ public static BakerConfigured from(AccountTransactionEffects.BakerConfigured bak
case BAKER_SET_FINALIZATION_REWARD_COMMISSION:
builder.event(BakerSetFinalizationRewardCommission.from(bakerEvent.getBakerSetFinalizationRewardCommission(), sender));
break;
+ case DELEGATION_REMOVED:
+ builder.event(BakerDelegationRemoved.from(bakerEvent.getDelegationRemoved(), sender));
case EVENT_NOT_SET:
throw new IllegalArgumentException("Baker event was not set.");
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/DelegatorConfigured.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/DelegatorConfigured.java
index 6b1ae9db1..c724eadc1 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/DelegatorConfigured.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/blockitemsummary/DelegatorConfigured.java
@@ -43,6 +43,8 @@ public static DelegatorConfigured from(AccountTransactionEffects.DelegationConfi
case DELEGATION_REMOVED:
builder.event(DelegationRemoved.from(delegationEvent.getDelegationRemoved(), sender));
break;
+ case BAKER_REMOVED:
+ builder.event(DelegationBakerRemoved.from(delegationEvent.getBakerRemoved(), sender));
case EVENT_NOT_SET:
throw new IllegalArgumentException("Delegation event type not set");
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/poolstatus/BakerPoolStatus.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/poolstatus/BakerPoolStatus.java
index 9a17904cc..5d1183a43 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/poolstatus/BakerPoolStatus.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/poolstatus/BakerPoolStatus.java
@@ -47,6 +47,7 @@ public class BakerPoolStatus {
/**
* Any pending change to the baker's stake.
+ * This is not used from protocol version 7 onwards, as stake changes are immediate.
*/
private final PendingChange bakerStakePendingChange;
@@ -60,6 +61,22 @@ public class BakerPoolStatus {
*/
private final CCDAmount allPoolTotalCapital;
+ public Optional getBakerEquityCapital() {
+ return Optional.ofNullable(bakerEquityCapital);
+ }
+
+ public Optional getDelegatedCapital() {
+ return Optional.ofNullable(delegatedCapital);
+ }
+
+ public Optional getDelegatedCapitalCap() {
+ return Optional.ofNullable(delegatedCapitalCap);
+ }
+
+ public Optional getPoolInfo() {
+ return Optional.ofNullable(poolInfo);
+ }
+
public Optional getBakerStakePendingChange() {
return Optional.ofNullable(bakerStakePendingChange);
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerChangeResult.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerChangeResult.java
index e3953e2a2..a49f0af5c 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerChangeResult.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerChangeResult.java
@@ -1,6 +1,7 @@
package com.concordium.sdk.responses.transactionstatus;
import com.concordium.sdk.crypto.ed25519.ED25519PublicKey;
+import com.concordium.sdk.responses.BakerId;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@@ -14,6 +15,7 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public abstract class AbstractBakerChangeResult extends AbstractBakerResult {
+ private final BakerId bakerId;
/**
* The public VRF key of the baker.
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerResult.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerResult.java
index 73ad98de4..011037443 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerResult.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractBakerResult.java
@@ -1,6 +1,5 @@
package com.concordium.sdk.responses.transactionstatus;
-import com.concordium.sdk.responses.BakerId;
import com.concordium.sdk.types.AccountAddress;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -12,7 +11,5 @@
@SuperBuilder
@EqualsAndHashCode
public abstract class AbstractBakerResult implements TransactionResultEvent {
- private final BakerId bakerId;
private final AccountAddress account;
-
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractDelegatorResult.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractDelegatorResult.java
index 0d9ea2957..76ec5318c 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractDelegatorResult.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/AbstractDelegatorResult.java
@@ -12,7 +12,5 @@
@SuperBuilder
@EqualsAndHashCode
public abstract class AbstractDelegatorResult implements TransactionResultEvent {
- private final AccountIndex delegatorId;
private final AccountAddress delegatorAddress;
-
}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerDelegationRemoved.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerDelegationRemoved.java
new file mode 100644
index 000000000..bc16c32e4
--- /dev/null
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerDelegationRemoved.java
@@ -0,0 +1,34 @@
+package com.concordium.sdk.responses.transactionstatus;
+
+import com.concordium.grpc.v2.BakerEvent;
+import com.concordium.sdk.responses.AccountIndex;
+import com.concordium.sdk.types.AccountAddress;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+/**
+ * Removed an existing delegator.
+ */
+@Getter
+@ToString
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+public class BakerDelegationRemoved extends AbstractBakerResult {
+
+ private final AccountIndex delegatorId;
+
+ public static BakerDelegationRemoved from(BakerEvent.DelegationRemoved bakerDelegationRemoved, AccountAddress sender) {
+ return BakerDelegationRemoved
+ .builder()
+ .delegatorId(AccountIndex.from(bakerDelegationRemoved.getDelegatorId()))
+ .account(sender)
+ .build();
+ }
+
+ @Override
+ public TransactionResultEventType getType() {
+ return TransactionResultEventType.BAKER_DELEGATION_REMOVED;
+ }
+}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerRemovedResult.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerRemovedResult.java
index ec336f9a9..e5b211175 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerRemovedResult.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerRemovedResult.java
@@ -12,6 +12,8 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public final class BakerRemovedResult extends AbstractBakerResult {
+ private final BakerId bakerId;
+
public static BakerRemovedResult from(com.concordium.grpc.v2.BakerId bakerRemoved, AccountAddress accountAddress) {
return BakerRemovedResult
.builder()
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetBakingRewardCommission.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetBakingRewardCommission.java
index 40a0afb4f..b4fd91768 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetBakingRewardCommission.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetBakingRewardCommission.java
@@ -13,7 +13,9 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class BakerSetBakingRewardCommission extends AbstractBakerResult {
+ private final BakerId bakerId;
private final double bakingRewardCommission;
+
public static BakerSetBakingRewardCommission from(BakerEvent.BakerSetBakingRewardCommission bakerSetBakingRewardCommission, AccountAddress sender) {
return BakerSetBakingRewardCommission
.builder()
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetFinalizationRewardCommission.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetFinalizationRewardCommission.java
index 304107c53..82fa31501 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetFinalizationRewardCommission.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetFinalizationRewardCommission.java
@@ -14,7 +14,9 @@
@EqualsAndHashCode(callSuper = true)
public class BakerSetFinalizationRewardCommission extends AbstractBakerResult {
+ private final BakerId bakerId;
private final double finalizationRewardCommission;
+
public static BakerSetFinalizationRewardCommission from(BakerEvent.BakerSetFinalizationRewardCommission bakerSetFinalizationRewardCommission, AccountAddress sender) {
return BakerSetFinalizationRewardCommission
.builder()
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetMetadataURL.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetMetadataURL.java
index bfaf8b920..d2c295288 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetMetadataURL.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetMetadataURL.java
@@ -13,6 +13,8 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class BakerSetMetadataURL extends AbstractBakerResult {
+
+ private final BakerId bakerId;
private final String metadataUrl;
public static BakerSetMetadataURL from(BakerEvent.BakerSetMetadataUrl bakerSetMetadataUrl, AccountAddress sender) {
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetOpenStatus.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetOpenStatus.java
index 83be279a7..785ed6f65 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetOpenStatus.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetOpenStatus.java
@@ -17,6 +17,7 @@
@EqualsAndHashCode(callSuper = true)
public class BakerSetOpenStatus extends AbstractBakerResult {
+ private final BakerId bakerId;
/**
* The updated {@link OpenStatus} for the baker.
*/
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetRestakeEarningsResult.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetRestakeEarningsResult.java
index 27b99cccb..431ad8f18 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetRestakeEarningsResult.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetRestakeEarningsResult.java
@@ -13,6 +13,8 @@
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
public final class BakerSetRestakeEarningsResult extends AbstractBakerResult {
+
+ private final BakerId bakerId;
private final boolean restakeEarnings;
public static BakerSetRestakeEarningsResult from(BakerEvent.BakerRestakeEarningsUpdated restake, AccountAddress account) {
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetTransactionFeeCommission.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetTransactionFeeCommission.java
index 3b338a728..569bad75d 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetTransactionFeeCommission.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerSetTransactionFeeCommission.java
@@ -13,6 +13,8 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class BakerSetTransactionFeeCommission extends AbstractBakerResult {
+
+ private final BakerId bakerId;
private final double feeCommission;
public static BakerSetTransactionFeeCommission from(BakerEvent.BakerSetTransactionFeeCommission bakerSetTransactionFeeCommission, AccountAddress sender) {
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerStakeUpdated.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerStakeUpdated.java
index c46d92965..75ff57e43 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerStakeUpdated.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/BakerStakeUpdated.java
@@ -18,6 +18,9 @@
@Getter
@ToString
public abstract class BakerStakeUpdated extends AbstractBakerResult {
+
+ private final BakerId bakerId;
+
public static BakerStakeUpdated from(AccountTransactionEffects.BakerStakeUpdated bakerStakeUpdated, AccountAddress account) {
val update = bakerStakeUpdated.getUpdate();
if (update.getIncreased()) {
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationAdded.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationAdded.java
index 4ced62257..6cf2dcc7c 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationAdded.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationAdded.java
@@ -17,6 +17,8 @@
@EqualsAndHashCode(callSuper = true)
public class DelegationAdded extends AbstractDelegatorResult {
+ private final AccountIndex delegatorId;
+
public static DelegationAdded from(DelegatorId delegationAdded, AccountAddress sender) {
return DelegationAdded
.builder()
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationBakerRemoved.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationBakerRemoved.java
new file mode 100644
index 000000000..e639b1c17
--- /dev/null
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationBakerRemoved.java
@@ -0,0 +1,30 @@
+package com.concordium.sdk.responses.transactionstatus;
+
+import com.concordium.grpc.v2.DelegationEvent;
+import com.concordium.sdk.types.AccountAddress;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+@Getter
+@ToString
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+public class DelegationBakerRemoved extends AbstractDelegatorResult {
+
+ private final long bakerId;
+
+ public static DelegationBakerRemoved from(DelegationEvent.BakerRemoved delegationBakerRemoved, AccountAddress sender) {
+ return DelegationBakerRemoved
+ .builder()
+ .bakerId(delegationBakerRemoved.getBakerId().getValue())
+ .delegatorAddress(sender)
+ .build();
+ }
+
+ @Override
+ public TransactionResultEventType getType() {
+ return TransactionResultEventType.DELEGATION_BAKER_REMOVED;
+ }
+}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationRemoved.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationRemoved.java
index a0bb6bbbd..fd2d63f41 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationRemoved.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationRemoved.java
@@ -17,6 +17,8 @@
@EqualsAndHashCode(callSuper = true)
public class DelegationRemoved extends AbstractDelegatorResult {
+ private final AccountIndex delegatorId;
+
public static DelegationRemoved from(DelegatorId delegationRemoved, AccountAddress sender) {
return DelegationRemoved
.builder()
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetDelegationTarget.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetDelegationTarget.java
index 247b4518a..9bf11a24f 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetDelegationTarget.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetDelegationTarget.java
@@ -17,6 +17,7 @@
@EqualsAndHashCode(callSuper = true)
public class DelegationSetDelegationTarget extends AbstractDelegatorResult {
+ private final AccountIndex delegatorId;
/**
* The target to delegate to.
*/
@@ -35,4 +36,4 @@ public static DelegationSetDelegationTarget from(DelegationEvent.DelegationSetDe
public TransactionResultEventType getType() {
return TransactionResultEventType.DELEGATION_SET_DELEGATION_TARGET;
}
-}
\ No newline at end of file
+}
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetRestakeEarnings.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetRestakeEarnings.java
index 2bb2a0a66..1b3ce1d5c 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetRestakeEarnings.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationSetRestakeEarnings.java
@@ -17,7 +17,7 @@
@EqualsAndHashCode(callSuper = true)
public class DelegationSetRestakeEarnings extends AbstractDelegatorResult {
-
+ private final AccountIndex delegatorId;
/**
* Whether earnings should be automatically restaked or not.
*/
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeDecreased.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeDecreased.java
index b5cd90faa..8a1fbe8cf 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeDecreased.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeDecreased.java
@@ -14,6 +14,8 @@
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class DelegationStakeDecreased extends AbstractDelegatorResult {
+
+ private final AccountIndex delegatorId;
private final CCDAmount newStake;
public static DelegationStakeDecreased from(DelegationEvent.DelegationStakeDecreased delegationStakeDecreased, AccountAddress sender) {
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeIncreased.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeIncreased.java
index bcb9916e6..7128e391a 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeIncreased.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/DelegationStakeIncreased.java
@@ -10,7 +10,7 @@
import lombok.experimental.SuperBuilder;
/**
- * The delegator increased its stake.
+ * The delegator increased their stake.
*/
@Getter
@ToString
@@ -18,6 +18,7 @@
@EqualsAndHashCode(callSuper = true)
public class DelegationStakeIncreased extends AbstractDelegatorResult {
+ private final AccountIndex delegatorId;
/**
* The new stake
*/
diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/TransactionResultEventType.java b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/TransactionResultEventType.java
index aa320d2b1..f01e85a8f 100644
--- a/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/TransactionResultEventType.java
+++ b/concordium-sdk/src/main/java/com/concordium/sdk/responses/transactionstatus/TransactionResultEventType.java
@@ -4,7 +4,7 @@
/**
* Events emitted by transactions.
- * Should match https://github.com/Concordium/concordium-base/blob/8dcee8746e40d663222aa3b4b04eaa3710e2779e/haskell-src/Concordium/Types/Execution.hs
+ * Should match GRPC types.proto
*/
public enum TransactionResultEventType {
@JsonProperty("ModuleDeployed")
@@ -31,6 +31,8 @@ public enum TransactionResultEventType {
BAKER_SET_RESTAKE_EARNINGS,
@JsonProperty("BakerKeysUpdated")
BAKER_KEYS_UPDATED,
+ @JsonProperty("BakerDelegationRemoved")
+ BAKER_DELEGATION_REMOVED,
@JsonProperty("CredentialKeysUpdated")
CREDENTIAL_KEYS_UPDATED,
@JsonProperty("NewEncryptedAmount")
@@ -77,6 +79,8 @@ public enum TransactionResultEventType {
DELEGATION_ADDED,
@JsonProperty("DelegationRemoved")
DELEGATION_REMOVED,
+ @JsonProperty("DelegationBakerRemoved")
+ DELEGATION_BAKER_REMOVED,
@JsonProperty("Upgraded")
UPGRADED,
@JsonProperty("BakerStakeUpdated")
diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java
index 45e333289..ed4af5f60 100644
--- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java
+++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java
@@ -4,6 +4,7 @@
import com.concordium.grpc.v2.BakerPoolInfo;
import com.concordium.grpc.v2.CommissionRates;
import com.concordium.grpc.v2.Commitment;
+import com.concordium.grpc.v2.Cooldown;
import com.concordium.grpc.v2.CredentialPublicKeys;
import com.concordium.grpc.v2.Policy;
import com.concordium.grpc.v2.ReleaseSchedule;
@@ -60,6 +61,7 @@ public class ClientV2GetAccountInfoTest {
= com.concordium.sdk.types.AccountAddress.from("3XSLuJcXg6xEua6iBPnWacc3iWh93yEDMCqX8FbE3RDSbEnT9P");
private static final byte[] ENCRYPTED_AMOUNT = new byte[]{0, 0, 1};
private static final long ACCOUNT_AMOUNT = 10000;
+ private static final long AVAILABLE_BALANCE = 9000;
private static final long ACCOUNT_INDEX = 1;
private static final byte[] ENCRYPTION_KEY = new byte[]{0, 0, 2};
private static final long RELEASE_AMOUNT = 10;
@@ -101,6 +103,9 @@ public class ClientV2GetAccountInfoTest {
private static final byte[] FIRST_NAME_VALUE
= "policy-value-0".getBytes(StandardCharsets.UTF_8);
private static final byte[] ENC_ID_PUB_SHARE = new byte[]{90, 90, 90};
+ private static final long COOLDOWN_AMOUNT = 1000;
+ private static final Cooldown.CooldownStatus COOLDOWN_STATUS = Cooldown.CooldownStatus.COOLDOWN;
+ private static final long COOLDOWN_END_TIME = 1234;
private static Commitment toCommitment(byte[] commitmentCredCounter) {
return Commitment.newBuilder()
@@ -139,8 +144,9 @@ private static AccountInfo NEW_GRPC_RES(com.concordium.sdk.types.AccountAddress
.build()));
pendingChange.ifPresent(bakerInfoBuilder::setPendingChange);
return AccountInfo.newBuilder()
- .setAddress(com.concordium.grpc.v2.AccountAddress.newBuilder().setValue(ByteString.copyFrom(address.getBytes())).build())
+ .setAddress(AccountAddress.newBuilder().setValue(ByteString.copyFrom(address.getBytes())).build())
.setAmount(Amount.newBuilder().setValue(ACCOUNT_AMOUNT).build())
+ .setAvailableBalance(Amount.newBuilder().setValue(AVAILABLE_BALANCE).build())
.setEncryptedBalance(EncryptedBalance.newBuilder()
.setStartIndex(ENCRYPTED_AMOUNT_START_INDEX)
.setAggregatedAmount(from(ENCRYPTED_AMOUNT))
@@ -215,6 +221,12 @@ private static AccountInfo NEW_GRPC_RES(com.concordium.sdk.types.AccountAddress
.build())
.build())
.build())
+ .addCooldowns(Cooldown.newBuilder()
+ .setAmount(Amount.newBuilder().setValue(COOLDOWN_AMOUNT).build())
+ .setStatus(COOLDOWN_STATUS)
+ .setEndTime(Timestamp.newBuilder().setValue(COOLDOWN_END_TIME).build())
+ .build()
+ )
.build();
}
@@ -231,6 +243,7 @@ private static com.concordium.sdk.responses.accountinfo.AccountInfo NEW_EXPECTED
return com.concordium.sdk.responses.accountinfo.AccountInfo.builder().
accountAddress(address).
accountAmount(CCDAmount.fromMicro(ACCOUNT_AMOUNT)).
+ availableBalance(CCDAmount.fromMicro(AVAILABLE_BALANCE)).
accountEncryptedAmount(AccountEncryptedAmount.builder().
startIndex(EncryptedAmountIndex.from(ENCRYPTED_AMOUNT_START_INDEX)).
selfAmount(com.concordium.sdk.transactions.EncryptedAmount.from(ENCRYPTED_AMOUNT_SELF_AMOUNT_1)).
@@ -302,7 +315,12 @@ private static com.concordium.sdk.responses.accountinfo.AccountInfo NEW_EXPECTED
build()).
build()).
build()).
- build();
+ cooldown(com.concordium.sdk.responses.accountinfo.Cooldown.builder().
+ amount(CCDAmount.fromMicro(COOLDOWN_AMOUNT)).
+ status(com.concordium.sdk.responses.accountinfo.Cooldown.CooldownStatus.from(COOLDOWN_STATUS)).
+ endTime(com.concordium.sdk.types.Timestamp.newMillis(COOLDOWN_END_TIME)).
+ build()).
+ build();
}
diff --git a/crypto-jni/Cargo.lock b/crypto-jni/Cargo.lock
index 1c483980d..b102d247f 100644
--- a/crypto-jni/Cargo.lock
+++ b/crypto-jni/Cargo.lock
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "concordium-contracts-common"
-version = "9.1.0"
+version = "9.2.0"
dependencies = [
"base64",
"bs58",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "concordium_base"
-version = "5.0.0"
+version = "6.0.0"
dependencies = [
"anyhow",
"ark-bls12-381",
diff --git a/pom.xml b/pom.xml
index f647837fc..2ae82c761 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.concordium.sdk
concordium-sdk-base
- 7.2.0
+ 8.0.0-SNAPSHOT
pom
https://github.com/Concordium/concordium-java-sdk