diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 17e82647..77ad615f 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -33484,6 +33484,8 @@ paths: imageId: type: string format: uint64 + name: + type: string default: description: An unexpected error response. schema: @@ -33545,6 +33547,8 @@ paths: imageId: type: string format: uint64 + name: + type: string image: type: string format: byte @@ -33608,6 +33612,8 @@ paths: imageId: type: string format: uint64 + name: + type: string default: description: An unexpected error response. schema: @@ -33665,6 +33671,8 @@ paths: imageId: type: string format: uint64 + name: + type: string image: type: string format: byte @@ -69184,6 +69192,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string DecentralCardGame.cardchain.cardchain.EncounterWithImage: type: object properties: @@ -69209,6 +69219,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string image: type: string format: byte @@ -69861,6 +69873,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string DecentralCardGame.cardchain.cardchain.QueryQEncounterWithImageResponse: type: object properties: @@ -69889,6 +69903,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string image: type: string format: byte @@ -69919,6 +69935,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string DecentralCardGame.cardchain.cardchain.QueryQEncountersWithImageResponse: type: object properties: @@ -69949,6 +69967,8 @@ definitions: imageId: type: string format: uint64 + name: + type: string image: type: string format: byte diff --git a/x/cardchain/keeper/msg_server_encounter_close.go b/x/cardchain/keeper/msg_server_encounter_close.go index 319cbe76..795e11aa 100644 --- a/x/cardchain/keeper/msg_server_encounter_close.go +++ b/x/cardchain/keeper/msg_server_encounter_close.go @@ -30,7 +30,7 @@ func (k msgServer) EncounterClose(goCtx context.Context, msg *types.MsgEncounter index := slices.Index(user.OpenEncounters, msg.EncounterId) if index == -1 { - return nil, sdkerrors.Wrapf(errors.ErrUnauthorized, "encounter %d isnt open for user", msg.EncounterId) + return nil, sdkerrors.Wrapf(errors.ErrUnauthorized, "encounter %d isn't open for user", msg.EncounterId) } user.OpenEncounters = append(user.OpenEncounters[:index], user.OpenEncounters[index+1:]...) @@ -38,6 +38,12 @@ func (k msgServer) EncounterClose(goCtx context.Context, msg *types.MsgEncounter if msg.Won { user.WonEncounters = append(user.WonEncounters, msg.EncounterId) // TODO: Treasury reward here + + encounter := k.Encounters.Get(ctx, msg.EncounterId) + if !encounter.Proven { + encounter.Proven = true + k.Encounters.Set(ctx, msg.EncounterId, encounter) + } } return &types.MsgEncounterCloseResponse{}, nil