Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added transaction size and scriptSize to TxnEntity #287

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bloxbean.cardano.yaci.store.app;

import com.bloxbean.cardano.yaci.core.config.YaciConfig;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
Expand All @@ -16,6 +17,10 @@
public class YaciStoreApplication {

public static void main(String[] args) {

// will be removed before merge
YaciConfig.INSTANCE.setReturnTxSize(true);

SpringApplication.run(YaciStoreApplication.class, args);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[libraries]
yaci = "com.bloxbean.cardano:yaci:0.3.0-beta14"
yaci = "com.bloxbean.cardano:yaci:0.3.0-beta16-12c9f2b-SNAPSHOT"
cardano-client-lib = "com.bloxbean.cardano:cardano-client-lib:0.5.1"
cardano-client-backend = "com.bloxbean.cardano:cardano-client-backend:0.5.1"
cardano-client-backend-ogmios = "com.bloxbean.cardano:cardano-client-backend-ogmios:0.5.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ public class Txn extends BlockAwareDomain {
private BigInteger totalCollateral;
private List<UtxoKey> referenceInputs;
private Boolean invalid;
private int size;
private int scriptSize;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public void handleTransactionEvent(TransactionEvent event) {
.collateralReturn(new UtxoKey(transaction.getTxHash(), outputs.size()))
.referenceInputs(referenceInputs)
.invalid(transaction.isInvalid())
.size(transaction.getTxSize())
.scriptSize(transaction.getTxScriptSize())
.build();

txList.add(txn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ public class TxnEntity extends BlockAwareEntity {

@Column(name = "invalid")
private Boolean invalid;

@Column(name = "size")
private int size;

@Column(name = "script_size")
private int scriptSize;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ create table transaction
collateral_return_json json,
block bigint,
block_time bigint,
update_datetime timestamp
update_datetime timestamp,
size smallint,
script_size smallint
);

CREATE INDEX idx_transaction_slot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ create table transaction
collateral_return_json json,
block bigint,
block_time bigint,
update_datetime timestamp
update_datetime timestamp,
size smallint,
script_size smallint
);

CREATE INDEX idx_transaction_slot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ create table transaction
collateral_return_json jsonb,
block bigint,
block_time bigint,
update_datetime timestamp
update_datetime timestamp,
size smallint,
script_size smallint
);

CREATE INDEX idx_transaction_slot
Expand Down
20 changes: 10 additions & 10 deletions stores/transaction/src/test/resources/scripts/transaction_data.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
TRUNCATE table transaction;

INSERT INTO transaction
(tx_hash,auxiliary_datahash,block_hash,collateral_inputs,collateral_return,fee,inputs,invalid,network_id,outputs,reference_inputs,required_signers,script_datahash,slot,total_collateral,ttl,validity_interval_start,collateral_return_json,block,block_time,update_datetime)
(tx_hash,auxiliary_datahash,block_hash,collateral_inputs,collateral_return,fee,inputs,invalid,network_id,outputs,reference_inputs,required_signers,script_datahash,slot,total_collateral,ttl,validity_interval_start,collateral_return_json,block,block_time,update_datetime,size,script_size)
VALUES
('e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869','3b97d0d972f465789d4040b63c5ba684c7dac533fcae946b00ec51b266b98e20','64bde349c8dd00ee6195217d36e4449f6c64f3b404fed17ad284cad3f810cce2',NULL,'{"tx_hash": "e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869", "output_index": 1}' FORMAT JSON,206685,'[{"tx_hash": "d6aa8534be82c5dfbf84c1cf08e588a8e85cec3f7e7d4579a226c491a5292992", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811653,NULL,10911609,0,NULL,184626,1666494853, TIMESTAMP '2023-11-07 09:09:39.41541'),
('dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b','4062577dd136fefd5a82a943ec32c655fbfd65e42ed1443e8afca3411b731101','e2a540c327b67302c556456d69d4c0b878ccae7e1e961eee3f238769c326fbaf',NULL,'{"tx_hash": "dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b", "output_index": 1}' FORMAT JSON,203869,'[{"tx_hash": "d774e4100749dd417b67ac9246af926f56393c13603f18d60b9186467d8daf3b", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811083,NULL,10911073,0,NULL,184590,1666494283, TIMESTAMP '2023-11-07 09:09:39.453555'),
('2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4','59eb5881732a1103742fc7eb6601e83e3b38a2cffadfdf215034eac3e0dbf284','d6741535234445188db39a0cb88e72012d62522747e6ffe632116fe0e65661cc',NULL,'{"tx_hash": "2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4", "output_index": 1}' FORMAT JSON,204529,'[{"tx_hash": "1bb71ccc2669cac5d175da409e055be91e9dd05eb5f547367db4e7374d109e93", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811227,NULL,10911213,0,NULL,184600,1666494427, TIMESTAMP '2023-11-07 09:09:39.457667'),
('4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c','f70de3c0b43758461d0fedd040fa3703275d52d981bca36a8e2550ac0428b679','c81fe9256d5f7867c935ea92842e7de6b175ab66c42ab7c1131ec155c9ae9e10',NULL,'{"tx_hash": "4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c", "output_index": 1}' FORMAT JSON,205101,'[{"tx_hash": "2eb6b6ca3c874e8c22ade36b63a541a315a25edaf757bbdc0b2bf9369749631b", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811940,NULL,10911867,0,NULL,184640,1666495140, TIMESTAMP '2023-11-07 09:09:39.494264'),
('a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054','7447a0f1afd8347e5f20f4a95e15517e50fc26d877b9d446c9c3ac1779eccd4e','babf327f05bc6e1ec28e111d66cf8683d9fd4ea6c5104a841020627854903f67',NULL,'{"tx_hash": "a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054", "output_index": 1}' FORMAT JSON,206905,'[{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813467,NULL,10913450,0,NULL,184723,1666496667, TIMESTAMP '2023-11-07 09:09:39.519206'),
('9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa','ce07d6410c5662d327898ef0fb5175f312027051b8e10bcd5476561ac1b0614d','1137dcc405ed1fe7b9f5735c7f72dca2a9ab863b0a7fd9727e8691fe670f4fe9',NULL,'{"tx_hash": "9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa", "output_index": 1}' FORMAT JSON,204485,'[{"tx_hash": "28613318ea4063c937e39adce2aeeac1b075a3fcaba2af8f28cbacdcc949297c", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813800,NULL,10913797,0,NULL,184735,1666497000, TIMESTAMP '2023-11-07 09:09:39.541265'),
('6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae','54564827ee7e404d9aeeff62220eacd3049b53c0a65ad00add55a7994f62e9be','388797d9a8322b7141e2314f56330fa2efb38c961233b6138ded9c6cc371dcd9',NULL,'{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 1}' FORMAT JSON,202813,'[{"tx_hash": "b55baab05fa253ac3b284bc2ef4d1e68ad91c7e64a9b0a18c2f52170e1a9b644", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813414,NULL,10913407,0,NULL,184719,1666496614, TIMESTAMP '2023-11-07 09:09:39.563539'),
('d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014','a43224f85574182c88bacb5bed8d3b3d07c9d26a7958be7137089426a7b4f292','564bc005c9d926afcf4f3ddda29e83fc4cf7ae65d8194d1b1532e7c91e008ac3',NULL,'{"tx_hash": "d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014", "output_index": 1}' FORMAT JSON,203649,'[{"tx_hash": "accd675b07d42ea5b944adfe0a776732c305188bae773485bdf8b1f62ffb1297", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10808755,NULL,10908747,0,NULL,184471,1666491955, TIMESTAMP '2023-11-07 09:09:39.192703'),
('922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8','92e14585d67fcca2da81444ef71a90480e66ae00988b9daa7b29a01efd29ff43','2a6663a30f21c276c77bc4f5029da6a626075bc5506e2453f2e228ffa5a2c357',NULL,'{"tx_hash": "922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8", "output_index": 1}' FORMAT JSON,202857,'[{"tx_hash": "42c04d1f92f1d0b81852962ba85f727b4c993a69a3d61742285328e8744dfc99", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10809340,NULL,10909336,0,NULL,184505,1666492540, TIMESTAMP '2023-11-07 09:09:39.196543');
('e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869','3b97d0d972f465789d4040b63c5ba684c7dac533fcae946b00ec51b266b98e20','64bde349c8dd00ee6195217d36e4449f6c64f3b404fed17ad284cad3f810cce2',NULL,'{"tx_hash": "e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869", "output_index": 1}' FORMAT JSON,206685,'[{"tx_hash": "d6aa8534be82c5dfbf84c1cf08e588a8e85cec3f7e7d4579a226c491a5292992", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "e43b09f3d95f83aadc4d7436c5c9067ff04ab876b6ed8acbbed1c0ab49743869", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811653,NULL,10911609,0,NULL,184626,1666494853, TIMESTAMP '2023-11-07 09:09:39.41541',0,0),
('dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b','4062577dd136fefd5a82a943ec32c655fbfd65e42ed1443e8afca3411b731101','e2a540c327b67302c556456d69d4c0b878ccae7e1e961eee3f238769c326fbaf',NULL,'{"tx_hash": "dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b", "output_index": 1}' FORMAT JSON,203869,'[{"tx_hash": "d774e4100749dd417b67ac9246af926f56393c13603f18d60b9186467d8daf3b", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "dbcec01a23519abe2c308f7ad72ec9b25a0f725bf7cccb76b1ca0defd6f19f7b", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811083,NULL,10911073,0,NULL,184590,1666494283, TIMESTAMP '2023-11-07 09:09:39.453555',0,0),
('2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4','59eb5881732a1103742fc7eb6601e83e3b38a2cffadfdf215034eac3e0dbf284','d6741535234445188db39a0cb88e72012d62522747e6ffe632116fe0e65661cc',NULL,'{"tx_hash": "2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4", "output_index": 1}' FORMAT JSON,204529,'[{"tx_hash": "1bb71ccc2669cac5d175da409e055be91e9dd05eb5f547367db4e7374d109e93", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "2e1f7694a9d4f2314a06f05c224776caa0ec70b329706005334ca96ecab71ad4", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811227,NULL,10911213,0,NULL,184600,1666494427, TIMESTAMP '2023-11-07 09:09:39.457667',0,0),
('4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c','f70de3c0b43758461d0fedd040fa3703275d52d981bca36a8e2550ac0428b679','c81fe9256d5f7867c935ea92842e7de6b175ab66c42ab7c1131ec155c9ae9e10',NULL,'{"tx_hash": "4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c", "output_index": 1}' FORMAT JSON,205101,'[{"tx_hash": "2eb6b6ca3c874e8c22ade36b63a541a315a25edaf757bbdc0b2bf9369749631b", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "4cb2df838ec05fb74c59688a2eface5f03e8f5c8e8144ebde4ed953b89d8f09c", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10811940,NULL,10911867,0,NULL,184640,1666495140, TIMESTAMP '2023-11-07 09:09:39.494264',0,0),
('a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054','7447a0f1afd8347e5f20f4a95e15517e50fc26d877b9d446c9c3ac1779eccd4e','babf327f05bc6e1ec28e111d66cf8683d9fd4ea6c5104a841020627854903f67',NULL,'{"tx_hash": "a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054", "output_index": 1}' FORMAT JSON,206905,'[{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "a3112f8b81bff1344f965b26e577ad7d3b7ac6ad5447fffd67291a50d9aea054", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813467,NULL,10913450,0,NULL,184723,1666496667, TIMESTAMP '2023-11-07 09:09:39.519206',0,0),
('9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa','ce07d6410c5662d327898ef0fb5175f312027051b8e10bcd5476561ac1b0614d','1137dcc405ed1fe7b9f5735c7f72dca2a9ab863b0a7fd9727e8691fe670f4fe9',NULL,'{"tx_hash": "9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa", "output_index": 1}' FORMAT JSON,204485,'[{"tx_hash": "28613318ea4063c937e39adce2aeeac1b075a3fcaba2af8f28cbacdcc949297c", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "9179b03cacf88c396015016e68493ea4d72dd481fde8fe8a354c4141f74695fa", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813800,NULL,10913797,0,NULL,184735,1666497000, TIMESTAMP '2023-11-07 09:09:39.541265',0,0),
('6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae','54564827ee7e404d9aeeff62220eacd3049b53c0a65ad00add55a7994f62e9be','388797d9a8322b7141e2314f56330fa2efb38c961233b6138ded9c6cc371dcd9',NULL,'{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 1}' FORMAT JSON,202813,'[{"tx_hash": "b55baab05fa253ac3b284bc2ef4d1e68ad91c7e64a9b0a18c2f52170e1a9b644", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "6a314fbfaa67c639970a0419b5aa0c3de170dbb63016008041f4bab169ad7fae", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10813414,NULL,10913407,0,NULL,184719,1666496614, TIMESTAMP '2023-11-07 09:09:39.563539',0,0),
('d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014','a43224f85574182c88bacb5bed8d3b3d07c9d26a7958be7137089426a7b4f292','564bc005c9d926afcf4f3ddda29e83fc4cf7ae65d8194d1b1532e7c91e008ac3',NULL,'{"tx_hash": "d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014", "output_index": 1}' FORMAT JSON,203649,'[{"tx_hash": "accd675b07d42ea5b944adfe0a776732c305188bae773485bdf8b1f62ffb1297", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "d66be851787d599c270a2de55994a1e43c405911188a04b543ea604b75abb014", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10808755,NULL,10908747,0,NULL,184471,1666491955, TIMESTAMP '2023-11-07 09:09:39.192703',0,0),
('922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8','92e14585d67fcca2da81444ef71a90480e66ae00988b9daa7b29a01efd29ff43','2a6663a30f21c276c77bc4f5029da6a626075bc5506e2453f2e228ffa5a2c357',NULL,'{"tx_hash": "922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8", "output_index": 1}' FORMAT JSON,202857,'[{"tx_hash": "42c04d1f92f1d0b81852962ba85f727b4c993a69a3d61742285328e8744dfc99", "output_index": 0}]' FORMAT JSON,false,0,'[{"tx_hash": "922890de4c23a973501d9b7d12eaa045c4aab818c1a9cbff138a843b54940ca8", "output_index": 0}]' FORMAT JSON,NULL,NULL,NULL,10809340,NULL,10909336,0,NULL,184505,1666492540, TIMESTAMP '2023-11-07 09:09:39.196543',0,0);
Loading