Interface ToInterface<T, IfU>

A mixin for [[Template]] that provides the toInterface and unsafeFromInterface contract ID conversion functions.

Even templates that directly implement no interfaces implement this, because this also permits conversion with interfaces that supply retroactive implementations to this template.

T The template type.

IfU The union of implemented interfaces, or never for templates that directly implement no interface.

interface ToInterface<T extends object, IfU> {
    toInterface<If>(
        ic: FromTemplate<If, unknown>,
        cid: ContractId<T>,
    ): ContractId<If>;
    toInterface<If>(
        ic: FromTemplate<If, T>,
        cid: ContractId<T>,
    ): ContractId<If>;
    unsafeFromInterface(
        ic: FromTemplate<IfU, unknown>,
        cid: ContractId<IfU>,
    ): ContractId<T>;
    unsafeFromInterface<If>(
        ic: FromTemplate<If, T>,
        cid: ContractId<If>,
    ): ContractId<T>;
}

Type Parameters

  • T extends object
  • IfU

Methods