Skip to main content
Version: 1.6.0

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. For example:

const test = do {
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;
};

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