Skip to content

Commit b2ed00a

Browse files
committed
feat(core): add setstate action
1 parent 1813e71 commit b2ed00a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/core/src/manifest.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ type OpenLinkAction = BaseAction & {
130130
url: string;
131131
};
132132

133+
type SetStateAction = BaseAction & {
134+
type: "SETSTATE";
135+
ref: string;
136+
value: string;
137+
};
138+
133139
export type EthPersonalSignData = {
134140
statement: string;
135141
version: string;
@@ -171,6 +177,7 @@ export type ModAction =
171177
| AddEmbedAction
172178
| SetInputAction
173179
| OpenLinkAction
180+
| SetStateAction
174181
| EthPersonalSignAction
175182
| SendEthTransactionAction
176183
| ExitAction;

packages/core/src/renderer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ export interface OpenLinkActionResolver {
272272
events: OpenLinkActionResolverEvents
273273
): void;
274274
}
275+
export interface SetStateActionResolver {
276+
ref: string;
277+
value: string;
278+
}
275279

276280
export type EthPersonalSignActionResolverInit = {
277281
data: EthPersonalSignData;
@@ -855,6 +859,11 @@ export class Renderer {
855859
};
856860
break;
857861
}
862+
case "SETSTATE": {
863+
set(this.refs, action.ref, this.replaceInlineContext(action.value));
864+
this.onTreeChange();
865+
break;
866+
}
858867
case "web3.eth.personal.sign": {
859868
const promise = new Promise<void>((resolve) => {
860869
setTimeout(() => {

0 commit comments

Comments
 (0)