Skip to content

Export ScopeConfig and related types #176

@jeffsmale90

Description

@jeffsmale90

It would be useful for consumers to be able to import the ScopeConfig and related types.

Background

ScopeConfig is used in public API functions like createDelegation() and createOpenDelegation() as part of the options parameter. Currently, consumers cannot import these types directly, making it difficult to:

  • Get proper TypeScript autocomplete when creating delegations
  • Understand the structure of scope configurations
  • Write type-safe code that works with scopes

Types to Export

1. Essential Scope Types (Primary)

  • ScopeConfig - Main discriminated union type covering all 9 scope types
  • Erc20TransferScopeConfig
  • Erc20StreamingScopeConfig
  • Erc20PeriodicScopeConfig
  • NativeTokenTransferScopeConfig
  • NativeTokenStreamingScopeConfig
  • NativeTokenPeriodicScopeConfig
  • Erc721ScopeConfig
  • OwnershipScopeConfig
  • FunctionCallScopeConfig

2. Supporting Builder Config Types (Nested Properties)

These types appear as properties in the scope configs above:

  • AllowedTargetsBuilderConfig - Used in FunctionCallScopeConfig
  • AllowedMethodsBuilderConfig - Used in FunctionCallScopeConfig
  • AllowedCalldataBuilderConfig - Used in FunctionCallScopeConfig, NativeTokenTransferScopeConfig, etc.
  • ExactCalldataBuilderConfig - Used in FunctionCallScopeConfig, NativeTokenTransferScopeConfig, etc.
  • ValueLteBuilderConfig - Used in FunctionCallScopeConfig
  • MethodSelector - Used by AllowedMethodsBuilderConfig

3. Internal utility types (DO NOT EXPORT)

  • ConvertScopeConfigsToInputs - Allows the type field to accept both ScopeType.X enum and string value

Benefits

Exporting these types will:

  1. Improve TypeScript DX: Consumers get autocomplete and type validation when creating scopes
  2. Better Documentation: Types serve as inline documentation for what properties are needed
  3. Clearer Error Messages: Individual scope types provide better compiler errors than just the union type
  4. API Completeness: If a type appears in a public API parameter, it should be importable

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