File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
packages/cardano-services
src/Utxo/DbSyncUtxoProvider Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -90,8 +90,11 @@ export const utxosToCore = (utxosModels: UtxoModel[]): Cardano.Utxo[] => {
9090 coins : BigInt ( current . coins )
9191 }
9292 } ;
93- if ( isNotNil ( current . data_hash ) ) txOut . datumHash = current . data_hash as unknown as Hash32ByteBase16 ;
94- if ( isNotNil ( current . inline_datum ) ) txOut . datum = PlutusData . fromCbor ( HexBlob ( current . inline_datum ) ) . toCore ( ) ;
93+ if ( isNotNil ( current . inline_datum ) ) {
94+ txOut . datum = PlutusData . fromCbor ( HexBlob ( current . inline_datum ) ) . toCore ( ) ;
95+ } else if ( isNotNil ( current . data_hash ) ) {
96+ txOut . datumHash = current . data_hash as unknown as Hash32ByteBase16 ;
97+ }
9598 if ( isNotNil ( current . reference_script_type ) ) txOut . scriptReference = parseReferenceScript ( current ) ;
9699
97100 if ( isNotNil ( current . asset_name ) && current . asset_policy && current . asset_quantity ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import {
1111 UNLIMITED_CACHE_TTL ,
1212 UtxoHttpService
1313} from '../../src' ;
14- import { Hash32ByteBase16 } from '@cardano-sdk/crypto' ;
1514import { HexBlob } from '@cardano-sdk/util' ;
1615import { INFO , createLogger } from 'bunyan' ;
1716import { OgmiosCardanoNode } from '@cardano-sdk/ogmios' ;
@@ -172,9 +171,9 @@ describe('UtxoHttpService', () => {
172171 const firstTxOut = res [ 0 ] [ 1 ] ;
173172
174173 expect ( res . length ) . toBeGreaterThan ( 0 ) ;
175- expect ( res [ 0 ] ) . toMatchShapeOf ( [ DataMocks . Tx . input , DataMocks . Tx . outputWithInlineDatum ] ) ;
174+ expect ( res [ 1 ] ) . toMatchShapeOf ( [ DataMocks . Tx . input , DataMocks . Tx . outputWithInlineDatum ] ) ;
176175 expect ( ( ) => HexBlob ( firstTxOut . datum ! as unknown as string ) ) . not . toThrow ( ) ;
177- expect ( ( ) => Hash32ByteBase16 ( firstTxOut . datumHash ! as unknown as string ) ) . not . toThrow ( ) ;
176+ expect ( firstTxOut . datumHash ) . toBeUndefined ( ) ;
178177 } ) ;
179178
180179 it ( 'return UTxO with time lock reference script' , async ( ) => {
You can’t perform that action at this time.
0 commit comments