Skip to content

Commit

Permalink
Add output index
Browse files Browse the repository at this point in the history
  • Loading branch information
gostkin committed Dec 1, 2023
1 parent 57205c8 commit bfc72d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class ProjectedNftRangeController extends Controller {
previousTxHash: data.previous_tx_hash,
previousTxOutputIndex: data.previous_tx_output_index != null ? parseInt(data.previous_tx_output_index) : null,
actionTxId: data.action_tx_id,
actionOutputIndex: data.action_output_index,
asset: data.asset,
amount: parseInt(data.amount),
status: data.status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ISqlProjectedNftRangeParams {

/** 'SqlProjectedNftRange' return type */
export interface ISqlProjectedNftRangeResult {
action_output_index: number;
action_slot: number;
action_tx_id: string | null;
amount: string;
Expand All @@ -26,7 +27,7 @@ export interface ISqlProjectedNftRangeQuery {
result: ISqlProjectedNftRangeResult;
}

const sqlProjectedNftRangeIR: any = {"usedParamSet":{"min_slot":true,"max_slot":true},"params":[{"name":"min_slot","required":true,"transform":{"type":"scalar"},"locs":[{"a":962,"b":971}]},{"name":"max_slot","required":true,"transform":{"type":"scalar"},"locs":[{"a":997,"b":1006}]}],"statement":"SELECT\n encode(\"ProjectedNFT\".owner_address, 'hex') as owner_address,\n\n encode(\"ProjectedNFT\".previous_utxo_tx_hash, 'hex') as previous_tx_hash,\n \"ProjectedNFT\".previous_utxo_tx_output_index as previous_tx_output_index,\n\n encode(\"Transaction\".hash, 'hex') as action_tx_id,\n\n \"ProjectedNFT\".asset as asset,\n \"ProjectedNFT\".amount as amount,\n\n CASE\n WHEN \"ProjectedNFT\".operation = 0 THEN 'Lock'\n WHEN \"ProjectedNFT\".operation = 1 THEN 'Unlocking'\n WHEN \"ProjectedNFT\".operation = 2 THEN 'Claim'\n ELSE 'Invalid'\n END AS status,\n\n encode(\"ProjectedNFT\".plutus_datum, 'hex') as plutus_datum,\n\n \"Block\".slot as action_slot\nFROM \"ProjectedNFT\"\n LEFT JOIN \"TransactionOutput\" ON \"TransactionOutput\".id = \"ProjectedNFT\".hololocker_utxo_id\n JOIN \"Transaction\" ON \"Transaction\".id = \"ProjectedNFT\".tx_id\n JOIN \"Block\" ON \"Transaction\".block_id = \"Block\".id\nWHERE\n \"Block\".slot > :min_slot!\n AND \"Block\".slot <= :max_slot!\nORDER BY (\"Block\".height, \"Transaction\".tx_index) ASC"};
const sqlProjectedNftRangeIR: any = {"usedParamSet":{"min_slot":true,"max_slot":true},"params":[{"name":"min_slot","required":true,"transform":{"type":"scalar"},"locs":[{"a":1023,"b":1032}]},{"name":"max_slot","required":true,"transform":{"type":"scalar"},"locs":[{"a":1058,"b":1067}]}],"statement":"SELECT\n encode(\"ProjectedNFT\".owner_address, 'hex') as owner_address,\n\n encode(\"ProjectedNFT\".previous_utxo_tx_hash, 'hex') as previous_tx_hash,\n \"ProjectedNFT\".previous_utxo_tx_output_index as previous_tx_output_index,\n\n \"TransactionOutput\".output_index as action_output_index,\n encode(\"Transaction\".hash, 'hex') as action_tx_id,\n\n \"ProjectedNFT\".asset as asset,\n \"ProjectedNFT\".amount as amount,\n\n CASE\n WHEN \"ProjectedNFT\".operation = 0 THEN 'Lock'\n WHEN \"ProjectedNFT\".operation = 1 THEN 'Unlocking'\n WHEN \"ProjectedNFT\".operation = 2 THEN 'Claim'\n ELSE 'Invalid'\n END AS status,\n\n encode(\"ProjectedNFT\".plutus_datum, 'hex') as plutus_datum,\n\n \"Block\".slot as action_slot\nFROM \"ProjectedNFT\"\n LEFT JOIN \"TransactionOutput\" ON \"TransactionOutput\".id = \"ProjectedNFT\".hololocker_utxo_id\n JOIN \"Transaction\" ON \"Transaction\".id = \"ProjectedNFT\".tx_id\n JOIN \"Block\" ON \"Transaction\".block_id = \"Block\".id\nWHERE\n \"Block\".slot > :min_slot!\n AND \"Block\".slot <= :max_slot!\nORDER BY (\"Block\".height, \"Transaction\".tx_index) ASC"};

/**
* Query generated from SQL:
Expand All @@ -37,6 +38,7 @@ const sqlProjectedNftRangeIR: any = {"usedParamSet":{"min_slot":true,"max_slot":
* encode("ProjectedNFT".previous_utxo_tx_hash, 'hex') as previous_tx_hash,
* "ProjectedNFT".previous_utxo_tx_output_index as previous_tx_output_index,
*
* "TransactionOutput".output_index as action_output_index,
* encode("Transaction".hash, 'hex') as action_tx_id,
*
* "ProjectedNFT".asset as asset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SELECT
encode("ProjectedNFT".previous_utxo_tx_hash, 'hex') as previous_tx_hash,
"ProjectedNFT".previous_utxo_tx_output_index as previous_tx_output_index,

"TransactionOutput".output_index as action_output_index,
encode("Transaction".hash, 'hex') as action_tx_id,

"ProjectedNFT".asset as asset,
Expand Down
1 change: 1 addition & 0 deletions webserver/shared/models/ProjectedNftRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type ProjectedNftRangeResponse = {
ownerAddress: string | null,

actionTxId: string | null,
actionOutputIndex: number | null,

previousTxHash: string | null,
previousTxOutputIndex: number | null,
Expand Down

0 comments on commit bfc72d7

Please sign in to comment.