@@ -159,11 +159,11 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
159159 parent . insertBefore ( entry , parent . firstChild ) ;
160160 }
161161
162- async function updateBalance ( application ) {
163- const response = JSON . parse ( await application . query ( gql ( `query { tickerSymbol, accounts { entries { key value } } }` ) ) ) ;
162+ async function updateBalance ( application , owner ) {
163+ const response = JSON . parse ( await application . query ( gql ( `query { tickerSymbol, accounts { entry(key: " ${ owner } ") { value } } }` ) ) ) ;
164164 console . debug ( 'application response:' , response ) ;
165165 document . querySelector ( '#ticker-symbol' ) . textContent = response . data . tickerSymbol ;
166- document . querySelector ( '#balance' ) . textContent = ( + ( response ? .data ? .accounts ?. entries ?. [ 0 ] ?. value || 0 ) ) . toFixed ( 2 ) ;
166+ document . querySelector ( '#balance' ) . textContent = ( + ( response . data . accounts . entry ?. value || 0 ) ) . toFixed ( 2 ) ;
167167 }
168168
169169 async function transfer ( application , donor , amount , recipient ) {
@@ -232,13 +232,13 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
232232
233233 const application = await client . frontend ( ) . application ( FUNGIBLE_APP_ID ) ;
234234
235- await updateBalance ( application ) ;
235+ await updateBalance ( application , owner ) ;
236236
237237 client . onNotification ( notification => {
238238 let newBlock = notification . reason . NewBlock ;
239239 if ( ! newBlock ) return ;
240240 prependEntry ( document . querySelector ( '#logs' ) , newBlock ) ;
241- updateBalance ( application ) ;
241+ updateBalance ( application , owner ) ;
242242 } ) ;
243243
244244 submitButton . disabled = false ;
0 commit comments