Skip to content

Commit 6aa22cb

Browse files
authored
Merge pull request #431 from bloxbean/fix/slot-config-tx-evaluation
Introduced SlotConfigs for Transaction Evaluators
2 parents 83b8eac + 818563b commit 6aa22cb

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.bloxbean.cardano.client.common.model;
2+
3+
import java.util.Objects;
4+
5+
public class SlotConfig {
6+
7+
private int slotLength;
8+
private long zeroSlot;
9+
private long zeroTime;
10+
11+
public SlotConfig(int slotLength, long zeroSlot, long zeroTime) {
12+
this.slotLength = slotLength;
13+
this.zeroSlot = zeroSlot;
14+
this.zeroTime = zeroTime;
15+
}
16+
17+
public int getSlotLength() {
18+
return slotLength;
19+
}
20+
21+
public long getZeroSlot() {
22+
return zeroSlot;
23+
}
24+
25+
public long getZeroTime() {
26+
return zeroTime;
27+
}
28+
29+
@Override
30+
public boolean equals(Object o) {
31+
if (this == o) return true;
32+
if (o == null || getClass() != o.getClass()) return false;
33+
SlotConfig that = (SlotConfig) o;
34+
return slotLength == that.slotLength && zeroSlot == that.zeroSlot && zeroTime == that.zeroTime;
35+
}
36+
37+
@Override
38+
public int hashCode() {
39+
return Objects.hash(slotLength, zeroSlot, zeroTime);
40+
}
41+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.bloxbean.cardano.client.common.model;
2+
3+
public class SlotConfigs {
4+
5+
public static SlotConfig mainnet() {
6+
return new SlotConfig(1000, 4492800L, 1596059091000L);
7+
}
8+
9+
public static SlotConfig preprod() {
10+
return new SlotConfig(1000, 86400L, 1655769600000L);
11+
}
12+
13+
public static SlotConfig preview() {
14+
return new SlotConfig(1000, 0L, 1666656000000L);
15+
}
16+
17+
}

0 commit comments

Comments
 (0)