-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Asset Transactions endpoint + DB type specific indexing + asset endpo…
…int refactoring (#408) * fix: #399 Add serializer to convert amount from BigIn to String (#404) * Blockfrost Block by number/hash api Response Format Mismatch (#405) * fix: #402 Add next block info and confirmations to BlockDto Enhanced the BlockDto by adding next block hash and confirmation count. Adjusted the BlockController to populate these new fields. Included new API tests to verify the additional fields in the response. * Bump yaci version * fix: #399 Refactor 'amount' handling and add API test for UTxOs (#406) Refactor the 'amount' field to use the new 'Amount' class instead of 'Amt' across the transaction domain and service layers. Added a new API test to verify the UTXOs retrieval by transaction hash. * feat: #400 Add asset transaction support and enhance indexing scripts (db specific), refactor existing asset apis Implemented `findTransactionsByAsset` in `UtxoStorageReaderImpl`. Added H2 and PostgreSQL specific indexing script executions in `DBIndexService`. Introduced `AssetTransaction` domain class with necessary test cases and API updates, including deprecation warnings for old endpoints.
- Loading branch information
Showing
26 changed files
with
581 additions
and
88 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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
### | ||
### Get utxos by asset | ||
GET {{base_url}}/api/v1/assets/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b5041594d454e54544f4b454e/utxos? | ||
count=10&page=0&order=desc | ||
|
||
> {% | ||
client.test("Get utxos by assets", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.length >= 1, "No of returned utxos is more than 0 " + response.body.length) | ||
//assert if unit is there in amounts field | ||
}); | ||
%} | ||
|
||
### Get transactions by asset | ||
GET {{base_url}}/api/v1/assets/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b5041594d454e54544f4b454e/transactions? | ||
count=10&page=0&order=desc | ||
|
||
> {% | ||
client.test("Get utxos by assets", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.length >= 1, "No of returned transaction is more than 0 " + response.body.length) | ||
//assert if unit is there in amounts field | ||
}); | ||
%} | ||
|
||
### | ||
### -- Asset store | ||
### supply by unit | ||
GET {{base_url}}/api/v1/assets/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b5041594d454e54544f4b454e/supply | ||
|
||
> {% | ||
client.test("Get supply by unit", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.unit === "436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b5041594d454e54544f4b454e", "Unit mismatch " + response.body.unit) | ||
client.assert(response.body.supply >= 1, "Supply is not greater than 1 " + response.body.supply) | ||
//assert if unit is there in amounts field | ||
}); | ||
%} | ||
|
||
### | ||
### history by unit | ||
GET {{base_url}}/api/v1/assets/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b5041594d454e54544f4b454e/history | ||
|
||
> {% | ||
client.test("Get history by unit", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.length > 0 , "More than 0 transactions should be returned: " + response.body.length); | ||
}); | ||
%} | ||
|
||
|
||
### | ||
### assets in a tx | ||
GET {{base_url}}/api/v1/assets/txs/05212c1b8df78e9c313a038f6417bc0351a5a959b96cad1cd8d21884a4868f6c | ||
|
||
> {% | ||
client.test("Get assets in a tx", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body[0].tx_hash === "05212c1b8df78e9c313a038f6417bc0351a5a959b96cad1cd8d21884a4868f6c" , "Tx hash mismatch"); | ||
client.assert(response.body[0].quantity === 100000000 , "Quantity doesn't match"); | ||
client.assert(response.body[0].mint_type === "MINT" , "mint_type doesn't match"); | ||
}); | ||
%} | ||
|
||
|
||
### | ||
### supply by policy | ||
GET {{base_url}}/api/v1/assets/policy/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b/supply | ||
|
||
> {% | ||
client.test("Get supply by policy", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.policy === "436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b" , "Policy mismatch"); | ||
client.assert(response.body.supply >= 1 , "Total supply should be more than one"); | ||
}); | ||
%} | ||
|
||
### | ||
### history by policy | ||
GET {{base_url}}/api/v1/assets/policy/436941ead56c61dbf9b92b5f566f7d5b9cac08f8c957f28f0bd60d4b/history | ||
|
||
> {% | ||
client.test("Get history by policy", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.length > 0 , "More than 0 transactions should be returned: " + response.body.length); | ||
}); | ||
%} | ||
|
||
### | ||
### supply by policy | ||
GET {{base_url}}/api/v1/assets/fingerprint/asset1hdfatxyf7mn8x5rutgy5ehgxpsqxx3un9alm88/supply | ||
|
||
> {% | ||
client.test("Get supply by fingerprint", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.fingerprint === "asset1hdfatxyf7mn8x5rutgy5ehgxpsqxx3un9alm88" , "Fingerprint mismatch"); | ||
client.assert(response.body.supply >= 1 , "Total supply should be more than one"); | ||
}); | ||
%} | ||
|
||
### | ||
### history by policy | ||
GET {{base_url}}/api/v1/assets/fingerprint/asset1hdfatxyf7mn8x5rutgy5ehgxpsqxx3un9alm88/history | ||
|
||
> {% | ||
client.test("Get history by policy", function () { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.length > 0 , "More than 0 transactions should be returned: " + response.body.length); | ||
}); | ||
%} |
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,33 @@ | ||
### | ||
### Get block by block number | ||
GET {{base_url}}/api/v1/blocks/2925862 | ||
|
||
> {% | ||
client.test("Get block by block number", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.height === 2925862, "Block number is wrong" + response.body.height) | ||
client.assert(response.body.hash === "1b57a2298737589695f7ec88da9e5b1af8f9f4479e7bd03367c10e165d5cc4bc", "Block hash is wrong" + response.body.hash) | ||
client.assert(response.body.op_cert_counter === "6", "Expected 6 as string") | ||
client.assert(response.body.next_block === "7d50f0dbc258ffeee329fbd61e10ccdc83d65068cb9d99e2a663c07b3a7f15fd", "Mismatch next block") | ||
client.assert(response.body.confirmations > 1, "Confirmations should be greater than 1") | ||
client.assert(response.body.output === "19511865", "Output mismatch") | ||
client.assert(response.body.fees === "488135", "Fees mismatch") | ||
}); | ||
%} | ||
|
||
|
||
### Get block by block hash | ||
GET {{base_url}}/api/v1/blocks/1b57a2298737589695f7ec88da9e5b1af8f9f4479e7bd03367c10e165d5cc4bc | ||
|
||
> {% | ||
client.test("Get block by block number", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.height === 2925862, "Block number is wrong" + response.body.height) | ||
client.assert(response.body.hash === "1b57a2298737589695f7ec88da9e5b1af8f9f4479e7bd03367c10e165d5cc4bc", "Block hash is wrong" + response.body.hash) | ||
client.assert(response.body.op_cert_counter === "6", "Expected 6 as string") | ||
client.assert(response.body.next_block === "7d50f0dbc258ffeee329fbd61e10ccdc83d65068cb9d99e2a663c07b3a7f15fd", "Mismatch next block") | ||
client.assert(response.body.confirmations > 1, "Confirmations should be greater than 1") | ||
client.assert(response.body.output === "19511865", "Output mismatch") | ||
client.assert(response.body.fees === "488135", "Fees mismatch") | ||
}); | ||
%} |
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,12 @@ | ||
### | ||
### Get utxos by tx hash | ||
GET {{base_url}}/api/v1/txs/d9301af967fc9fe8995c297be05561859401b89c0c8237264e4016081dd92011/utxos | ||
|
||
> {% | ||
client.test("Get utxos by tx hash", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
client.assert(response.body.outputs.length === 3, "No of returned utxos is not 3: " + response.body.outputs.length) | ||
client.assert(response.body.outputs[0].amount[0].quantity === "2000000", "Quantity mismatch : " + response.body.outputs[0].amount[0].quantity) | ||
client.assert(response.body.outputs[1].amount[0].quantity === "5000000", "Quantity mismatch : " + response.body.outputs[1].amount[0].quantity) | ||
}); | ||
%} |
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,4 @@ | ||
-- Additional H2 specific indexes | ||
|
||
CREATE INDEX if not exists idx_address_utxo_amounts | ||
ON address_utxo(amounts); |
4 changes: 4 additions & 0 deletions
4
applications/all/src/main/resources/sql/extra-index-postgresql.sql
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,4 @@ | ||
-- Additional postgresql specific indexes | ||
|
||
CREATE INDEX if not exists idx_address_utxo_amounts | ||
ON address_utxo USING gin (amounts); |
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
4 changes: 4 additions & 0 deletions
4
applications/utxo-indexer/src/main/resources/sql/extra-index-h2.sql
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,4 @@ | ||
-- Additional H2 specific indexes | ||
|
||
CREATE INDEX if not exists idx_address_utxo_amounts | ||
ON address_utxo(amounts); |
4 changes: 4 additions & 0 deletions
4
applications/utxo-indexer/src/main/resources/sql/extra-index-postgresql.sql
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,4 @@ | ||
-- Additional postgresql specific indexes | ||
|
||
CREATE INDEX if not exists idx_address_utxo_amounts | ||
ON address_utxo USING gin (amounts); |
Oops, something went wrong.