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.Typed_address.to_typed_address.

Then cast typed_address to contract<unit> using Test.Typed_address.to_contract. For example:

const test = (() => {
const addr : address = "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx";
const taddr : typed_address<unit,unit> = Test.Address.to_typed_address(addr);
const contract : contract<unit> = Test.Typed_address.to_contract(taddr);
return contract;
})();

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