Skip to main content
Version: Next

How to convert an address to a contract in LIGO testing framework ?

In the context of testing framework, if you want to convert an address to a contract, you need to convert address to typed_address using Test.cast_address.

Then convert typed_address to contract using Test.to_contract


const _test = () : contract<unit> => {
const addr = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" as address);
const taddr : typed_address<unit,unit> = Test.cast_address(addr);
const contract : contract<unit> = Test.to_contract(taddr);
return contract;
const test = _test();

Check out the reference of the Test framework for exact signature of the functions here.