Table of Contents
< All Topics
Print

keeper.go

# keeper.go

package keeper

import (
“github.com/cosmos/cosmos-sdk/types”
“github.com/cosmos/cosmos-sdk/x/auth/types”

“github.com/your_username/experience/x/registration/types”

)

// RegisterPatient registra un nuovo paziente e crea un wallet
func (k Keeper) RegisterPatient(ctx types.Context, creator types.AccAddress, name string, email string) error {
// Creare un nuovo account paziente
acc := k.accountKeeper.NewAccountWithAddress(ctx, creator)

// Aggiungere l’account al keeper degli account k.accountKeeper.SetAccount(ctx, acc) // Generare eventi per il log ctx.EventManager().EmitEvents(types.Events{ types.NewEvent( types.EventTypeMessage, types.NewAttribute(types.AttributeKeyModule, types.AttributeValueCategory), types.NewAttribute(types.AttributeKeySender, creator.String()), ), }) return nil

}

Condividi