Add: Enable MAYAName Registration Without Requiring a Maya Address

Allow MAYAName registration without requiring a Maya address. This change would provide greater flexibility, making it possible for users to register a MAYAName even if they do not have a Maya address associated with it.

I was experimenting with something like this to create the Owner from FromAddress (ofc need to add error handling etc.) :

func getMsgManageMAYANameFromMemo(memo ManageMAYANameMemo, tx ObservedTx, signer cosmos.AccAddress) (cosmos.Msg, error) {
	if len(tx.Tx.Coins) == 0 {
		return nil, fmt.Errorf("transaction must have rune in it")
	}

	owner := memo.Owner
	if (len(owner) == 0) && !tx.Tx.Coins[0].Asset.IsNative() {
		hasher := sha256.New()
		_, _ = hasher.Write([]byte(tx.Tx.FromAddress))
		sum := hasher.Sum(nil)
		name := hex.EncodeToString(sum)
		str, _ := common.ConvertAndEncode(cmd.Bech32PrefixAccAddr, crypto.AddressHash([]byte(name)))
		addr, _ := common.NewAddress(str, GetCurrentVersion())
		owner, _ = addr.AccAddress()
	}
	return NewMsgManageMAYAName(memo.Name, memo.Chain, memo.Address, tx.Tx.Coins[0], memo.Expire, memo.PreferredAsset, memo.AffiliateBps, memo.SubaffiliateBps, memo.SubaffiliateName, owner, signer), nil
}

I propose the following approach (including also the code above):

  • If a MAYAName is being set via an observed transaction on a non-Maya chain, the Owner is generated from the hash of the sender's address.
  • This Owner Maya address is used only internally as the affiliate collector address; after reaching the threshold, the collected fees are swapped and paid in the preferred asset.
  • Modify MsgManageMAYAName validation to enable other coins.
  • Modify MsgManageMAYAName handler to calculate the registration fee and the correct ExpireBlockHeight.
  • Modify MsgManageMAYAName handler to swap the provided coins to CACAO to Reserve wallet
Edited by ZlyDevMaya