sellAlias method Null safety
- String alias,
- int amount,
- [ResponseCallback<
MsgSellAliasResponse> ? callback]
Description
Lists an existing alias
owned by the current account for sale at the given amount
. The minimum price for an Alias is 10.0 SNR. A succesful transaction will return a MsgSellAliasResponse
.
Example
final res = await MotorFlutter.to.sellAlias('hulahoop', 40.0);
if (res == null) {
throw Exception('Failed to sell alias');
}
// Print all domains for sale
for (final alias in res.aliases) {
if(alias.isForSale) {
print(alias.name); // prints: hulahoop.snr or hulahoop
}
}
Next Steps:
- Buy an alias listed for sale with transferAlias
- ADR-1
Implementation
Future<MsgSellAliasResponse?> sellAlias(String alias, int amount, [ResponseCallback<MsgSellAliasResponse>? callback]) async {
final resp = await MotorFlutterPlatform.instance.sellAlias(MsgSellAlias(
alias: alias,
creator: address.value,
amount: amount,
));
if (callback != null) {
callback(resp);
}
if (resp != null) {
domains.addAll(resp.whoIs.alias);
domains.refresh();
}
return resp;
}