Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] - support sortKey or blockHeight in viewState #504

Closed
dtfiedler opened this issue Jan 26, 2024 · 1 comment
Closed

[FEATURE] - support sortKey or blockHeight in viewState #504

dtfiedler opened this issue Jan 26, 2024 · 1 comment

Comments

@dtfiedler
Copy link
Contributor

dtfiedler commented Jan 26, 2024

Is your feature request related to a problem? Please describe.
The current docs suggest viewState supports sortKey/blockHeight, but it is not a provided param on the SDK

    /**
     * Returns the "view" of the state, computed by the SWC -
     * i.e. object that is a derivative of a current state and some specific
     * smart contract business logic.
     * Similar to the "interactRead" from the current SDK version.
     *
     * This method firstly evaluates the contract state to the requested block height.
     * Having the contract state on this block height - it then calls the contract's code
     * with specified input.
     *
     * @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, caller?: string, signal?: AbortSignal): Promise<InteractionResult<State, View>>;

Describe the solution you'd like
Support sortKey and/or blockHeight when calling viewState.

e.g.

const readInteractionResult = await contract.viewState(
  {
    function: functionName,
    ...input,
  },
  sortKey, // or blockHeight
);
@ppedziwiatr
Copy link
Contributor

added in 1.4.31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants