@@ -2,12 +2,17 @@ import { describe, expect, it } from "@effect/vitest"
22import * as Cluster from "@evolution-sdk/devnet/Cluster"
33import * as Config from "@evolution-sdk/devnet/Config"
44import * as Genesis from "@evolution-sdk/devnet/Genesis"
5- import * as Address from "@evolution-sdk/evolution/core/AddressEras"
5+ import { Core } from "@evolution-sdk/evolution"
6+ import * as CoreAddress from "@evolution-sdk/evolution/core/Address"
67import * as Assets from "@evolution-sdk/evolution/sdk/Assets"
78import { createClient } from "@evolution-sdk/evolution/sdk/client/ClientImpl"
89import type { ProtocolParameters } from "@evolution-sdk/evolution/sdk/ProtocolParameters"
910import type { UTxO } from "@evolution-sdk/evolution/sdk/UTxO"
1011import { afterAll , beforeAll } from "vitest"
12+ import { createCoreTestUtxo } from "./utils/utxo-helpers"
13+
14+ // Alias for Core.Assets
15+ const CoreAssets = Core . Assets
1116
1217/**
1318 * Client integration tests with local Devnet
@@ -41,8 +46,8 @@ describe("Client with Devnet", () => {
4146 wallet : { type : "seed" , mnemonic : TEST_MNEMONIC , accountIndex : 0 }
4247 } )
4348
44- const testAddressBech32 = await testClient . address ( )
45- const testAddressHex = Address . toHex ( Address . fromBech32 ( testAddressBech32 ) )
49+ const testAddress = await testClient . address ( )
50+ const testAddressHex = CoreAddress . toHex ( testAddress )
4651
4752 genesisConfig = {
4853 ...Config . DEFAULT_SHELLEY_GENESIS ,
@@ -92,7 +97,8 @@ describe("Client with Devnet", () => {
9297
9398 const address = await client . address ( )
9499 expect ( address ) . toBeDefined ( )
95- expect ( address ) . toMatch ( / ^ a d d r _ t e s t / )
100+ const addressBech32 = CoreAddress . toBech32 ( address )
101+ expect ( addressBech32 ) . toMatch ( / ^ a d d r _ t e s t / )
96102 } )
97103
98104 it ( "should query wallet UTxOs" , { timeout : 30_000 } , async ( ) => {
@@ -123,18 +129,27 @@ describe("Client with Devnet", () => {
123129
124130 const client = createTestClient ( )
125131 const genesisAddress = await client . address ( )
126- const genesisUtxo = genesisUtxos . find ( ( u ) => u . address === genesisAddress )
132+ const genesisAddressBech32 = CoreAddress . toBech32 ( genesisAddress )
133+ const genesisUtxoSdk = genesisUtxos . find ( ( u ) => u . address === genesisAddressBech32 )
127134
128- if ( ! genesisUtxo ) {
135+ if ( ! genesisUtxoSdk ) {
129136 throw new Error ( "Genesis UTxO not found" )
130137 }
131138
139+ // Convert SDK UTxO to Core UTxO
140+ const genesisUtxo = createCoreTestUtxo ( {
141+ address : genesisUtxoSdk . address ,
142+ transactionId : genesisUtxoSdk . txHash ,
143+ index : genesisUtxoSdk . outputIndex ,
144+ lovelace : Assets . getAsset ( genesisUtxoSdk . assets , "lovelace" )
145+ } )
146+
132147 const receiverAddress =
133148 "addr_test1qz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgs68faae"
134149
135150 const signBuilder = await client
136151 . newTx ( )
137- . payToAddress ( { address : receiverAddress , assets : Assets . fromLovelace ( 5_000_000n ) } )
152+ . payToAddress ( { address : CoreAddress . fromBech32 ( receiverAddress ) , assets : CoreAssets . fromLovelace ( 5_000_000n ) } )
138153 . build ( { availableUtxos : [ genesisUtxo ] } )
139154
140155 const tx = await signBuilder . toTransaction ( )
0 commit comments