Skip to content

Commit

Permalink
Merge pull request #150 from FigureTechnologies/marker_tx_hash
Browse files Browse the repository at this point in the history
Add tx hash field to marker supply and marker transfer
  • Loading branch information
rchaing-figure authored Jul 20, 2023
2 parents e4e78be + 6656ef6 commit 126cdba
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class DBClient: DBJdbc() {
csvRecord["event_type"],
csvRecord["block_height"].toLong(),
csvRecord["block_timestamp"],
csvRecord["tx_hash"],
csvRecord["amount"],
csvRecord["denom"],
csvRecord["administrator"],
Expand All @@ -107,6 +108,7 @@ class DBClient: DBJdbc() {
record.eventType,
record.blockHeight.toDouble(),
record.blockTimestamp.toOffsetDateTime(),
record.txHash,
record.amount,
record.denom,
record.administrator,
Expand All @@ -125,6 +127,7 @@ class DBClient: DBJdbc() {
csvRecord["event_type"],
csvRecord["block_height"].toLong(),
csvRecord["block_timestamp"],
csvRecord["tx_hash"],
csvRecord["coins"],
csvRecord["denom"],
csvRecord["amount"],
Expand All @@ -144,6 +147,7 @@ class DBClient: DBJdbc() {
record.eventType ?: "",
record.blockHeight.toDouble(),
record.blockTimestamp!!.toOffsetDateTime(),
record.txHash ?: "",
record.coins ?: "",
record.denom ?: "",
record.amount ?: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ fun List<MutableMap<String, Any>>.toTxMarkerSupply() =
result["EVENT_TYPE"].toString(),
result["BLOCK_HEIGHT"] as Long,
result["BLOCK_TIMESTAMP"] as Timestamp,
result["TX_HASH"].toString(),
result["COINS"].toString(),
result["DENOM"].toString(),
result["AMOUNT"].toString(),
Expand All @@ -172,6 +173,7 @@ fun List<MutableMap<String, Any>>.toTxMarkerTransfer() =
result["EVENT_TYPE"].toString(),
result["BLOCK_HEIGHT"] as Long,
result["BLOCK_TIMESTAMP"]as Timestamp,
result["TX_HASH"].toString(),
result["AMOUNT"].toString(),
result["DENOM"].toString(),
result["ADMINISTRATOR"].toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class TxMarkerSupply(
val eventType: String?,
val blockHeight: Long,
val blockTimestamp: Timestamp,
val txHash: String?,
val coins: String?,
val denom: String?,
val amount: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class TxMarkerTransfer(
val eventType: String,
val blockHeight: Long,
val blockTimestamp: Timestamp,
val txHash: String,
val amount: String,
val denom: String,
val administrator: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object MarkerSupplyTable: IdTable<String>("marker_supply") {
val eventType = text("event_type")
val blockHeight = double("block_height")
val blockTimestamp = offsetDatetime("block_timestamp")
val txHash = text("tx_hash")
val coins = text("coins")
val denom = text("denom")
val amount = text("amount")
Expand All @@ -36,6 +37,7 @@ open class MarkerSupplyEntityClass: EntityClass<String, MarkerSupplyRecord>(Mark
eventType: String,
blockHeight: Double,
blockTimestamp: OffsetDateTime,
txHash: String,
coins: String,
denom: String,
amount: String,
Expand All @@ -53,6 +55,7 @@ open class MarkerSupplyEntityClass: EntityClass<String, MarkerSupplyRecord>(Mark
this.eventType = eventType
this.blockHeight = blockHeight
this.blockTimestamp = blockTimestamp
this.txHash = txHash
this.coins = coins
this.denom = denom
this.amount = amount
Expand All @@ -77,6 +80,7 @@ class MarkerSupplyRecord(hash: EntityID<String>): Entity<String>(hash) {
var eventType by MarkerSupplyTable.eventType
var blockHeight by MarkerSupplyTable.blockHeight
var blockTimestamp by MarkerSupplyTable.blockTimestamp
var txHash by MarkerSupplyTable.txHash
var coins by MarkerSupplyTable.coins
var denom by MarkerSupplyTable.denom
var amount by MarkerSupplyTable.amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object MarkerTransferTable: IdTable<String>("marker_transfer") {
val eventType = text("event_type")
val blockHeight = double("block_height")
val blockTimestamp = offsetDatetime("block_timestamp")
val txHash = text("tx_hash")
val amount = text("amount")
val denom = text("denom")
val administrator = text("administrator")
Expand All @@ -29,6 +30,7 @@ open class MarkerTransferEntityClass: EntityClass<String, MarkerTransferRecord>(
eventType: String,
blockHeight: Double,
blockTimestamp: OffsetDateTime,
txHash: String,
amount: String,
denom: String,
administrator: String,
Expand All @@ -39,6 +41,7 @@ open class MarkerTransferEntityClass: EntityClass<String, MarkerTransferRecord>(
this.eventType = eventType
this.blockHeight = blockHeight
this.blockTimestamp = blockTimestamp
this.txHash = txHash
this.amount = amount
this.denom = denom
this.administrator = administrator
Expand All @@ -55,6 +58,7 @@ class MarkerTransferRecord(hash: EntityID<String>): Entity<String>(hash) {
var eventType by MarkerTransferTable.eventType
var blockHeight by MarkerTransferTable.blockHeight
var blockTimestamp by MarkerTransferTable.blockTimestamp
var txHash by MarkerTransferTable.txHash
var amount by MarkerTransferTable.amount
var denom by MarkerTransferTable.denom
var administrator by MarkerTransferTable.administrator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class MarkerSupply(
val eventType: String?,
val blockHeight: Long,
val blockTimestamp: String?,
val txHash: String?,
val coins: String?,
val denom: String?,
val amount: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class MarkerTransfer(
val eventType: String,
val blockHeight: Long,
val blockTimestamp: String,
val txHash: String,
val amount: String,
val denom: String,
val administrator: String,
Expand Down
2 changes: 2 additions & 0 deletions migrations/sql/V5__ADD_TX_HASH_MARKERS_TABLE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE MARKER_SUPPLY ADD tx_hash TEXT;
ALTER TABLE MARKER_TRANSFER ADD tx_hash TEXT;
25 changes: 13 additions & 12 deletions proto/src/main/proto/marker-supply.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ message MarkerSupply {
uint64 block_height = 1;
google.protobuf.Timestamp block_timestamp = 2;
string event_type = 3;
string coins = 4;
string denom = 5;
string amount = 6;
string administrator = 7;
string to_address = 8;
string from_address = 9;
string metadata_base = 10;
string metadata_description = 11;
string metadata_display = 12;
string metadata_denom_units = 13;
string metadata_name = 14;
string metadata_symbol = 15;
string tx_hash = 4;
string coins = 5;
string denom = 6;
string amount = 7;
string administrator = 8;
string to_address = 9;
string from_address = 10;
string metadata_base = 11;
string metadata_description = 12;
string metadata_display = 13;
string metadata_denom_units = 14;
string metadata_name = 15;
string metadata_symbol = 16;
}
11 changes: 6 additions & 5 deletions proto/src/main/proto/marker-transfer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ message MarkerTransfer {
uint64 block_height = 1;
google.protobuf.Timestamp block_timestamp = 2;
string event_type = 3;
string amount = 4;
string denom = 5;
string administrator = 6;
string to_address = 7;
string from_address = 8;
string tx_hash = 4;
string amount = 5;
string denom = 6;
string administrator = 7;
string to_address = 8;
string from_address = 9;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ fun Flow<StreamTypeImpl>.toMarkerSupplyStreamResponse(): Flow<StreamResponse> =
.setEventType(it.eventType)
.setBlockHeight(it.blockHeight)
.setBlockTimestamp(it.blockTimestamp.toString().toOffsetDateTime().toProtoTimestamp())
.setTxHash(it.txHash)
.setCoins(it.coins)
.setDenom(it.denom)
.setAdministrator(it.administrator)
Expand All @@ -126,6 +127,7 @@ fun Flow<StreamTypeImpl>.toMarkerTransferStreamResponse(): Flow<StreamResponse>
.setEventType(it.eventType)
.setBlockHeight(it.blockHeight)
.setBlockTimestamp(it.blockTimestamp.toOffsetDateTime().toProtoTimestamp())
.setTxHash(it.txHash)
.setAmount(it.amount)
.setDenom(it.denom)
.setAdministrator(it.administrator)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TxMarkerSupply : CSVFileExtractor(
"event_type",
"block_height",
"block_timestamp",
"tx_hash",
"coins",
"denom",
"amount",
Expand All @@ -42,6 +43,7 @@ class TxMarkerSupply : CSVFileExtractor(
event.eventType,
event.blockHeight,
event.blockDateTime?.toISOString(),
event.txHash,
record.coins,
record.denom,
record.amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TxMarkerTransfer : CSVFileExtractor(
"event_type",
"block_height",
"block_timestamp",
"tx_hash",
"amount",
"denom",
"administrator",
Expand All @@ -33,6 +34,7 @@ class TxMarkerTransfer : CSVFileExtractor(
event.eventType,
event.blockHeight,
event.blockDateTime?.toISOString(),
event.txHash,
record.amount,
record.denom,
record.administrator,
Expand Down

0 comments on commit 126cdba

Please sign in to comment.