ScAddress.fromAddress constructor

ScAddress.fromAddress(
  1. StellarAddress address
)

Implementation

factory ScAddress.fromAddress(StellarAddress address) {
  switch (address.type) {
    case XlmAddrTypes.contract:
      return ScAddressContract(address.cast());
    case XlmAddrTypes.pubKey:
    case XlmAddrTypes.muxed:
      return ScAddressAccountId(address.toPublicKey());
    default:
      throw DartStellarPlugingException("Invalid address type.",
          details: {"type": address.type.name});
  }
}