feat: move up caller to the view state method

This commit is contained in:
Tadeuchi
2023-06-30 13:49:16 +02:00
parent 8ac43ceb04
commit 2c68d7c382
2 changed files with 6 additions and 3 deletions

View File

@@ -129,12 +129,14 @@ export interface Contract<State = unknown> {
* @param input - the input to the contract - eg. function name and parameters
* @param tags - a set of tags that can be added to the interaction transaction
* @param transfer - additional {@link ArTransfer} data that can be attached to the interaction
* @param caller - caller of the view state operation
* transaction
*/
viewState<Input = unknown, View = unknown>(
input: Input,
tags?: Tags,
transfer?: ArTransfer
transfer?: ArTransfer,
caller?: string
): Promise<InteractionResult<State, View>>;
/**

View File

@@ -209,10 +209,11 @@ export class HandlerBasedContract<State> implements Contract<State> {
async viewState<Input, View>(
input: Input,
tags: Tags = [],
transfer: ArTransfer = emptyTransfer
transfer: ArTransfer = emptyTransfer,
caller?: string
): Promise<InteractionResult<State, View>> {
this.logger.info('View state for', this._contractTxId);
return await this.callContract<Input, View>(input, 'view', undefined, undefined, tags, transfer);
return await this.callContract<Input, View>(input, 'view', caller, undefined, tags, transfer);
}
async viewStateForTx<Input, View>(