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

[BOOST-4786] feat(sdk,EventAction): add deriveActionClaimantFromTransaction method #194

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

sammccord
Copy link
Contributor

@sammccord sammccord commented Oct 9, 2024

🚨 Please review the guidelines for contributing to this repository.

Description

  • Add method to get a claimant's address from an EventActions's claimant configuration given a tx hash or logs
  • Slightly refactor ValidateActionStepParams to use event/function agnostic naming/typing and make accessing abi items off the params more consistent for action step validation as well

fix #139

💔 Thank you!

Copy link

changeset-bot bot commented Oct 9, 2024

🦋 Changeset detected

Latest commit: 4b43ebc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@boostxyz/sdk Minor
@boostxyz/cli Patch
agora-vote Patch
delegate-action Patch
ens-register Patch
swap-specific-dex Patch
zora-mint Patch
@boostxyz/test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

params: ValidateActionStepParams,
) {
if (!('logs' in params)) {
throw new ValidationLogsMissingError();
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this error since this was the only place it was used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

knownSignatures?: Record<Hex, AbiEvent | AbiFunction>;
abiItem?: AbiEvent | AbiFunction;
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome ty for adding function support

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty for doing literally all the hard work and letting me ctrl+c your work

Comment on lines +560 to +564
for (let log of decodedLogs) {
if (!isAddressEqual(log.address, claimant.targetContract)) continue;
let addressCandidate = this.validateClaimantAgainstArgs(claimant, log);
if (addressCandidate) address = addressCandidate;
}
return address;
Copy link
Contributor

@jonathandiep jonathandiep Oct 10, 2024

Choose a reason for hiding this comment

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

Thinking out loud here on an edge case here: would deriving claimant from event only work for txs with a single event? Cause if there are multiple event logs that match, it would basically just return the last match

Copy link
Contributor

Choose a reason for hiding this comment

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

but I guess we can make sure that when defining an action claimant that the values must be strict!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking out loud here on an edge case here: would deriving claimant from event only work for txs with a single event? Cause if there are multiple event logs that match, it would basically just return the last match

yeah wasn't really sure how to handle that, @Quazia is this approach decent?

Copy link
Contributor

@jonathandiep jonathandiep left a comment

Choose a reason for hiding this comment

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

🔥

lgtm, left a non-blocking comment

…, refactor ValidateActionStepParams slightly

chore: address feedback
@sammccord sammccord force-pushed the sam/boost-4786-feat-derive-claimant branch from 15d4a60 to 4b43ebc Compare October 10, 2024 14:24
@sammccord sammccord merged commit aa20a00 into main Oct 10, 2024
6 checks passed
@sammccord sammccord deleted the sam/boost-4786-feat-derive-claimant branch October 10, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add helpers for deriving the claimant from an EventAction
2 participants