toXdr method
Returns a XdrSCAddress object created from this Address object.
Implementation
XdrSCAddress toXdr() {
if (_type == TYPE_ACCOUNT) {
if (accountId == null) {
throw Exception("invalid address, has no account id");
}
return XdrSCAddress.forAccountId(accountId!);
} else if (_type == TYPE_CONTRACT) {
if (contractId == null) {
throw Exception("invalid address, has no contract id");
}
return XdrSCAddress.forContractId(contractId!);
} else {
throw Exception("unknown address type " + _type.toString());
}
}