fix: internal writes validity
This commit is contained in:
@@ -677,7 +677,10 @@ export class HandlerBasedContract<State> implements Contract<State> {
|
||||
currentTx
|
||||
};
|
||||
|
||||
return await this.evalInteraction(interactionData, executionContext, evalStateResult);
|
||||
const result = await this.evalInteraction<Input, View>(interactionData, executionContext, evalStateResult);
|
||||
result.originalValidity = evalStateResult.validity;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async evalInteraction<Input, View = unknown>(
|
||||
|
||||
@@ -128,7 +128,10 @@ export class ContractHandlerApi<State> implements HandlerApi<State> {
|
||||
this.logger.debug('Cache result?:', !this.swGlobal._activeTx.dry);
|
||||
await executionContext.warp.stateEvaluator.onInternalWriteStateUpdate(this.swGlobal._activeTx, contractTxId, {
|
||||
state: result.state as State,
|
||||
validity: {}
|
||||
validity: {
|
||||
...result.originalValidity,
|
||||
[this.swGlobal._activeTx.id]: result.type == 'ok'
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
@@ -246,6 +246,7 @@ export type HandlerResult<State, Result> = {
|
||||
export type InteractionResult<State, Result> = HandlerResult<State, Result> & {
|
||||
type: InteractionResultType;
|
||||
errorMessage?: string;
|
||||
originalValidity?: Record<string, boolean>;
|
||||
};
|
||||
|
||||
export type ContractInteraction<Input> = {
|
||||
|
||||
@@ -242,7 +242,10 @@ export class WasmContractHandlerApi<State> implements HandlerApi<State> {
|
||||
this.logger.debug('Cache result?:', !this.swGlobal._activeTx.dry);
|
||||
await executionContext.warp.stateEvaluator.onInternalWriteStateUpdate(this.swGlobal._activeTx, contractTxId, {
|
||||
state: result.state as State,
|
||||
validity: {}
|
||||
validity: {
|
||||
...result.originalValidity,
|
||||
[this.swGlobal._activeTx.id]: result.type == 'ok'
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user