Skip to content

Single-transaction Apply flow #5

@martinjms

Description

@martinjms

Summary

The current Apply flow splits work across 2-3 transactions:

  • TX1: Create binding + create condition objects + share them
  • (wait for confirmation + extract IDs from effects)
  • TX2: Set policies using condition IDs from TX1

This can be collapsed into a single PTB by extracting condition IDs before sharing:

condition_everyone::new() → cond
condition_everyone::id(&cond) → cond_id   // get ID while we still have a reference
condition_everyone::share(cond)            // now share it
rule(cond_id, effect) → rule              // use the ID
set_policy(binding, assembly_id, rules)

Benefits

  • Single wallet signature instead of 2-3
  • No waiting for TX1 confirmation before TX2
  • No fragile ID extraction from transaction effects
  • Lower total gas (fewer transaction overheads)
  • Better UX — one click, one sign, done

Current workaround

The DApp reads condition IDs from getTransaction() effects after TX1, stores them in localStorage, then builds TX2. This is fragile and has caused multiple bugs.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions