Skip to content

Commit

Permalink
Merge branch 'master' into yushi/unit-of-account-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
vsubhuman committed Jan 17, 2022
2 parents bf885f0 + 26a0ece commit 7002616
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -84,6 +84,7 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
block_num: number, // NOTE: not slot_no
receiver: string,
amount: string,
dataHash: string,
assets: Asset[],
}>
```
Expand Down Expand Up @@ -335,6 +336,7 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
outputs: Array<{ //these will be ordered by transaction index asc.
address: string,
amount: string,
dataHash: string,
assets: Asset[]
}>,
withdrawals: Array<{| address: string, // hex
Expand Down Expand Up @@ -440,6 +442,7 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
outputs: Array<{ //these will be ordered by transaction index asc.
address: string,
amount: string,
dataHash: string,
assets: Asset[]
}>,
withdrawals: Array<{| address: string, // hex
Expand Down Expand Up @@ -689,6 +692,7 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
outputs: Array<{ //these will be ordered by transaction index asc.
address: string,
amount: string,
dataHash: string,
assets: Asset[]
}>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/Transactions/output.ts
Expand Up @@ -5,7 +5,8 @@ DROP VIEW if exists TransactionOutput;
CREATE VIEW "TransactionOutput" AS SELECT tx_out.address,
tx_out.value,
tx.hash AS "txHash",
tx_out.index
tx_out.index,
tx_out.data_hash AS "txDataHash"
FROM tx
JOIN tx_out ON tx.id = tx_out.tx_id;
`;
Expand Down
1 change: 1 addition & 0 deletions src/Transactions/types.ts
Expand Up @@ -54,6 +54,7 @@ export interface TransInputFrag {
export interface TransOutputFrag {
address: string;
amount: string;
dataHash: null | string;
assets: null | Asset[];
}

Expand Down
1 change: 1 addition & 0 deletions src/Transactions/userDefinedFunctions.ts
Expand Up @@ -97,6 +97,7 @@ BEGIN
SELECT json_agg(
("address"
, "value"
, "txDataHash"
, (
SELECT json_agg(ROW(encode("policy", 'hex'), encode("name", 'hex'), "quantity"))
FROM ma_tx_out
Expand Down
1 change: 1 addition & 0 deletions src/Transactions/valid_utxos_view.ts
Expand Up @@ -10,6 +10,7 @@ SELECT
, encode(tx.hash,'hex') as hash
, tx_out.index
, tx_out.value
, tx_out.data_hash
, block.block_no as "blockNumber"
, (
select json_agg(ROW (encode("multi_asset"."policy", 'hex'), encode("multi_asset"."name", 'hex'), "quantity"))
Expand Down
3 changes: 2 additions & 1 deletion src/services/txIO.ts
Expand Up @@ -46,7 +46,8 @@ export const handleGetTxIO =
(obj: any): TransOutputFrag => ({
address: obj.f1,
amount: obj.f2.toString(),
assets: extractAssets(obj.f3),
dataHash: obj.f3,
assets: extractAssets(obj.f4),
})
),
});
Expand Down
1 change: 1 addition & 0 deletions src/services/utxoForAddress.ts
Expand Up @@ -41,6 +41,7 @@ export const utxoForAddresses =
tx_index: utxo.index,
receiver: utxo.address,
amount: utxo.value.toString(),
dataHash: utxo.data_hash,
assets: extractAssets(utxo.assets),
block_num: utxo.blockNumber,
}));
Expand Down
4 changes: 3 additions & 1 deletion src/utils/mappers.ts
Expand Up @@ -51,7 +51,8 @@ export const mapTxRowsToTransactionFrags = (rows: any[]): TransactionFrag[] => {
(obj: any): TransOutputFrag => ({
address: obj.f1,
amount: obj.f2.toString(),
assets: extractAssets(obj.f3),
dataHash: obj.f3,
assets: extractAssets(obj.f4),
})
)
: [];
Expand All @@ -60,6 +61,7 @@ export const mapTxRowsToTransactionFrags = (rows: any[]): TransactionFrag[] => {
(obj: any): TransOutputFrag => ({
address: obj.f1,
amount: obj.f2.toString(),
dataHash: null,
assets: [] as Asset[],
})
)
Expand Down

0 comments on commit 7002616

Please sign in to comment.