Skip to main content
Version: 1.4.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 = ("mv18Cw7psUrAAPBpXYd9CtCpHg9EgjHP9KTe" 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.