SnapInterfaceController Actions
9 actions registered.
| Name | Deprecated |
|---|---|
createInterface | |
deleteInterface | |
getInterface | |
getInterfaceState | |
getState | |
resolveInterface | |
setInterfaceDisplayed | |
updateInterface | |
updateInterfaceState |
SnapInterfaceController:createInterface
Package: @metamask/snaps-controllers
Create an interface in the controller state with the associated data.
Parameters:
| Name | Description |
|---|---|
snapId | The snap id that created the interface. |
content | The interface content. |
context | An optional interface context object. |
contentType | The type of content. |
Returns: The newly interface id.
Handler signature:
(snapId: SnapId, content: ComponentOrElement, context?: InterfaceContext, contentType?: ContentType) => string
SnapInterfaceController:deleteInterface
Package: @metamask/snaps-controllers
Delete an interface from state.
Parameters:
| Name | Description |
|---|---|
id | The interface id. |
Handler signature:
(id: string) => void
SnapInterfaceController:getInterface
Package: @metamask/snaps-controllers
Get the data of a given interface id.
Parameters:
| Name | Description |
|---|---|
snapId | The snap id requesting the interface data. |
id | The interface id. |
Returns: The interface state.
Handler signature:
(snapId: SnapId, id: string) => StoredInterface
SnapInterfaceController:getInterfaceState
Package: @metamask/snaps-controllers
Get the state of a given interface ID, if the interface has been displayed at least once.
Parameters:
| Name | Description |
|---|---|
snapId | The snap ID requesting the interface state. |
id | The interface ID. |
Returns: The interface state.
Handler signature:
(snapId: SnapId, id: string) => Record<string, string | boolean | {
addresses: `${string}:${string}:${string}`[];
accountId: string;
} | {
name: string;
size: number;
contentType: string;
contents: string;
} | {
symbol: string;
name: string;
asset: `${string}:${string}/${string}:${string}`;
} | Record<string, string | boolean | {
addresses: `${string}:${string}:${string}`[];
accountId: string;
} | {
name: string;
size: number;
contentType: string;
contents: string;
} | {
symbol: string;
name: string;
asset: `${string}:${string}/${string}:${string}`;
} | null> | null>
SnapInterfaceController:getState
Package: @metamask/snaps-controllers
Handler signature:
() => SnapInterfaceControllerState
SnapInterfaceController:resolveInterface
Package: @metamask/snaps-controllers
Resolve the promise of a given interface approval request. The approval needs to have the same ID as the interface.
Parameters:
| Name | Description |
|---|---|
snapId | The snap id. |
id | The interface id. |
value | The value to resolve the promise with. |
Handler signature:
(snapId: SnapId, id: string, value: Json) => Promise<void>
SnapInterfaceController:setInterfaceDisplayed
Package: @metamask/snaps-controllers
Set the interface as displayed.
Parameters:
| Name | Description |
|---|---|
snapId | The snap ID requesting the update. |
id | The interface ID. |
Handler signature:
(snapId: SnapId, id: string) => void
SnapInterfaceController:updateInterface
Package: @metamask/snaps-controllers
Update the interface with the given content.
Parameters:
| Name | Description |
|---|---|
snapId | The snap id requesting the update. |
id | The interface id. |
content | The new content. |
context | An optional interface context object. |
Handler signature:
(snapId: SnapId, id: string, content: ComponentOrElement, context?: InterfaceContext) => void
SnapInterfaceController:updateInterfaceState
Package: @metamask/snaps-controllers
Update the interface state.
Parameters:
| Name | Description |
|---|---|
id | The interface id. |
state | The new state. |
Handler signature:
(id: string, state: InterfaceState) => void