diff --git a/packages/core/src/manifest.ts b/packages/core/src/manifest.ts index 3e47b32..20bc11e 100644 --- a/packages/core/src/manifest.ts +++ b/packages/core/src/manifest.ts @@ -130,6 +130,12 @@ type OpenLinkAction = BaseAction & { url: string; }; +type SetStateAction = BaseAction & { + type: "SETSTATE"; + ref: string; + value: string; +}; + export type EthPersonalSignData = { statement: string; version: string; @@ -171,6 +177,7 @@ export type ModAction = | AddEmbedAction | SetInputAction | OpenLinkAction + | SetStateAction | EthPersonalSignAction | SendEthTransactionAction | ExitAction; diff --git a/packages/core/src/renderer.ts b/packages/core/src/renderer.ts index 6255101..a4003c2 100644 --- a/packages/core/src/renderer.ts +++ b/packages/core/src/renderer.ts @@ -272,6 +272,10 @@ export interface OpenLinkActionResolver { events: OpenLinkActionResolverEvents ): void; } +export interface SetStateActionResolver { + ref: string; + value: string; +} export type EthPersonalSignActionResolverInit = { data: EthPersonalSignData; @@ -855,6 +859,11 @@ export class Renderer { }; break; } + case "SETSTATE": { + set(this.refs, action.ref, this.replaceInlineContext(action.value)); + this.onTreeChange(); + break; + } case "web3.eth.personal.sign": { const promise = new Promise((resolve) => { setTimeout(() => {