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] Execute options object refactor #811

Merged
merged 8 commits into from
Nov 28, 2023

Conversation

onetrickwolf
Copy link
Collaborator

Motivation

Moves params for execute into an ExecutionOptions object and interface. This will minimize breaking changes should execute be modified in the future and also makes usage a bit easier as you don't have to pass in undefined to reach other optional params.

buildExecutionTransaction, buildBondPublicTransaction, buildUnbondPublicTransaction, unbondPublic, buildClaimUnbondPublicTransaction, claimUnbondPublic, setValidatorState and unbondDelegatorAsValidator updated as well to unify into single ExecutionOptions interface and flow.

Would like to do this with most functions (especially run) but wanted to get opinions on approach before refactor becomes too big. @Pauan @iamalwaysuncomfortable

Example Old

const transaction = await programManager.execute(
	program_id,
	aleoFunction,
	fee,
	privateFee,
	inputs,
	undefined,
	keyParams,
	feeRecord,
	undefined,
	undefined,
	privateKeyObject,
	undefined
);

Example New

  const transaction = await programManager.execute({
      programName: program_id,
      functionName: aleoFunction,
      fee: fee,
      privateFee: privateFee,
      inputs: inputs,
      keySearchParams: keyParams,
      feeRecord: feeRecord,
      privateKey: privateKeyObject
  });

Test Plan

Should ideally work the same as the previous execute, params just passed in as object now.

@iamalwaysuncomfortable
Copy link
Collaborator

I like the options refactors, I have a few minor nits, but I'd say we're okay to just proceed refactoring the rest of the methods in the ProgramManager to this

Copy link
Collaborator

@Pauan Pauan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@onetrickwolf
Copy link
Collaborator Author

@iamalwaysuncomfortable resolved conflicts and updated docs if you want to just double check I resolved the intent of your changes correctly.

…jects-option-refactor

# Conflicts:
#	website/src/workers/worker.js
@onetrickwolf onetrickwolf merged commit e629b2b into testnet3 Nov 28, 2023
1 check passed
@onetrickwolf onetrickwolf deleted the feat/objects-option-refactor branch November 28, 2023 16:07
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

Successfully merging this pull request may close these issues.

4 participants