@reown/appkit-controllers
Version:
The full stack toolkit to build onchain app UX.
25 lines • 773 B
JavaScript
import { proxy, subscribe as sub } from 'valtio/vanilla';
import { subscribeKey } from 'valtio/vanilla/utils';
// -- State --------------------------------------------- //
const state = proxy({
loading: false,
open: false,
selectedNetworkId: undefined,
activeChain: undefined,
initialized: false,
connectingWallet: undefined
});
// -- Controller ---------------------------------------- //
export const PublicStateController = {
state,
subscribe(callback) {
return sub(state, () => callback(state));
},
subscribeOpen(callback) {
return subscribeKey(state, 'open', callback);
},
set(newState) {
Object.assign(state, { ...state, ...newState });
}
};
//# sourceMappingURL=PublicStateController.js.map