@@ -41,7 +41,7 @@ export const network: WalletStateSliceStore = createWalletStateSliceStore({
41
41
parameter : "network" ,
42
42
initialState : null
43
43
} )
44
- export const balance : BalanceStore = createBalanceStore ( "" )
44
+ export const balance : BalanceStore = createBalanceStore ( null )
45
45
export const wallet : WritableStore = writable ( {
46
46
name : null ,
47
47
provider : null ,
@@ -106,14 +106,14 @@ function createWalletInterfaceStore(
106
106
107
107
function createWalletStateSliceStore ( options : {
108
108
parameter : string
109
- initialState : string | number | null
109
+ initialState : string | number | null | undefined
110
110
} ) : WalletStateSliceStore {
111
111
const { parameter, initialState } = options
112
112
const { subscribe, set } = writable ( initialState )
113
113
114
114
return {
115
115
subscribe,
116
- reset : ( ) => set ( initialState ) ,
116
+ reset : ( ) => set ( undefined ) ,
117
117
setStateSyncer : ( stateSyncer : StateSyncer ) => {
118
118
validateType ( { name : "stateSyncer" , value : stateSyncer , type : "object" } )
119
119
@@ -155,7 +155,7 @@ function createWalletStateSliceStore(options: {
155
155
}
156
156
}
157
157
158
- function createBalanceStore ( initialState : string ) : BalanceStore {
158
+ function createBalanceStore ( initialState : string | null ) : BalanceStore {
159
159
let stateSyncer : StateSyncer
160
160
let emitter
161
161
@@ -181,7 +181,7 @@ function createBalanceStore(initialState: string): BalanceStore {
181
181
emitter . on ( "all" , ( ) => false )
182
182
} else {
183
183
// no address, so set balance back to null
184
- set && set ( initialState )
184
+ set && set ( undefined )
185
185
}
186
186
}
187
187
} )
@@ -234,7 +234,7 @@ function syncStateWithTimeout(options: {
234
234
"There was a problem getting the balance of this wallet"
235
235
} )
236
236
}
237
- )
237
+ ) . catch ( ( ) => { } )
238
238
)
239
239
240
240
balanceSyncStatus . syncing = prom
@@ -251,7 +251,7 @@ function syncStateWithTimeout(options: {
251
251
252
252
timedOut . then ( ( ) => {
253
253
if ( ! prom . isFulfilled ( ) ) {
254
- prom . cancel ( )
254
+ prom . cancel ( ( ) => { } )
255
255
}
256
256
} )
257
257
}
0 commit comments