MetaMask / MetaMask/smart-accounts-kit

Export various `CaveatConfig`, `ScopeConfig` and related types

Open
#176 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
63
Forks
45
Avg merge
4d 15h
Merged PRs (30d)
2

Description

**AI Generated; use caution**

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. 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

Contributor guide

Open the contributing guide

Research direction

Start at the public API definitions for createDelegation() and createOpenDelegation() and trace where ScopeConfig and the listed related types are declared and exported. Make the nine scope configuration types importable while keeping ConvertScopeConfigsToInputs internal, then verify consumers can import the types and receive TypeScript autocomplete and validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.