Skip to main content
Version: Next

Interface: StarknetPlugin<TProviderMethods, TAccountMethods>

Defined in: src/plugins/types.ts:67

A Starknet plugin that can extend Provider and Account with methods and lifecycle hooks.

Example

const myPlugin = (): StarknetPlugin<{ greet(): string }> => ({
name: 'my-plugin',
extend: () => ({ greet: () => 'hello' }),
});

Type Parameters

TProviderMethods

TProviderMethods extends Record<string, any> = Record<string, never>

Methods added to Provider instances

TAccountMethods

TAccountMethods extends Record<string, any> = TProviderMethods

Methods added to Account instances (defaults to TProviderMethods)

Properties

name

readonly name: string

Defined in: src/plugins/types.ts:72

Unique plugin name, used for deduplication


hooks?

optional hooks?: ProviderHooks

Defined in: src/plugins/types.ts:88

Provider-level lifecycle hooks


accountHooks?

optional accountHooks?: AccountHooks

Defined in: src/plugins/types.ts:91

Account-level lifecycle hooks

Methods

extend()?

optional extend(provider): TProviderMethods

Defined in: src/plugins/types.ts:78

Called when the plugin is installed on a Provider. Returns an object of methods to add to the provider instance.

Parameters

provider

ProviderInterface

Returns

TProviderMethods


accountExtend()?

optional accountExtend(account): TAccountMethods

Defined in: src/plugins/types.ts:85

Called when the plugin is installed on an Account. Returns methods specific to the account context. If not provided, extend is used instead.

Parameters

account

AccountInterface

Returns

TAccountMethods