Skip to content

Commit a12a0cb

Browse files
committed
feat(sdk/eip1193): emit events
1 parent 6e69eee commit a12a0cb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/thirdweb/src/adapters/eip1193/from-eip1193.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export function fromProvider(options: FromEip1193AdapterOptions): Wallet {
9797
chain = connectedChain;
9898
handleDisconnect = doDisconnect;
9999
handleSwitchChain = doSwitchChain;
100+
emitter.emit("onConnect", connectOptions);
100101
trackConnect({
101102
client: connectOptions.client,
102103
walletType: id,
@@ -119,6 +120,7 @@ export function fromProvider(options: FromEip1193AdapterOptions): Wallet {
119120
chain = connectedChain;
120121
handleDisconnect = doDisconnect;
121122
handleSwitchChain = doSwitchChain;
123+
emitter.emit("onConnect", connectOptions);
122124
trackConnect({
123125
client: connectOptions.client,
124126
walletType: id,
@@ -130,7 +132,11 @@ export function fromProvider(options: FromEip1193AdapterOptions): Wallet {
130132
disconnect: async () => {
131133
reset();
132134
await handleDisconnect();
135+
emitter.emit("disconnect", undefined);
136+
},
137+
switchChain: async (c) => {
138+
await handleSwitchChain(c);
139+
emitter.emit("chainChanged", c);
133140
},
134-
switchChain: (c) => handleSwitchChain(c),
135141
};
136142
}

0 commit comments

Comments
 (0)