Skip to content

Commit 67b5213

Browse files
committed
fixup! feat: enable blockfrost enabled e2e tests
1 parent f35a79c commit 67b5213

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/cardano-services/src/util/BlockfrostProvider/BlockfrostToCore.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Cardano } from '@cardano-sdk/core';
22
import { Responses } from '@blockfrost/blockfrost-js';
3+
import { Value } from '@cardano-sdk/core/dist/cjs/Cardano';
34

45
type Unpacked<T> = T extends (infer U)[] ? U : T;
56
type BlockfrostAddressUtxoContent = Responses['address_utxo_content'];
@@ -105,17 +106,21 @@ export const BlockfrostToCore = {
105106
}),
106107

107108
txOut: (blockfrost: BlockfrostOutput): Cardano.TxOut => {
109+
const value: Cardano.Value = {
110+
coins: BigInt(blockfrost.amount.find(({ unit }) => unit === 'lovelace')!.quantity)
111+
};
112+
108113
const assets: Cardano.TokenMap = new Map();
109114
for (const { quantity, unit } of blockfrost.amount) {
110115
if (unit === 'lovelace') continue;
111116
assets.set(Cardano.AssetId(unit), BigInt(quantity));
112117
}
118+
119+
if (assets.size > 0) value.assets = assets;
120+
113121
return {
114122
address: Cardano.PaymentAddress(blockfrost.address),
115-
value: {
116-
assets: assets.size > 0 ? assets : undefined,
117-
coins: BigInt(blockfrost.amount.find(({ unit }) => unit === 'lovelace')!.quantity)
118-
}
123+
value
119124
};
120125
}
121126
};

0 commit comments

Comments
 (0)