@@ -36,6 +36,7 @@ <h1>Counter</h1>
3636 </ div >
3737
3838 < div class ="logs ">
39+ < h2 > Connected as < code id ="owner " class ="hex "> requesting owner…</ code > </ h2 >
3940 < h2 > Chain history for < code id ="chain-id " class ="hex "> requesting chain…</ code > </ h2 >
4041 < ul id ="logs ">
4142 < template >
@@ -57,19 +58,23 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
5758 </ script >
5859
5960 < script type ="module ">
61+ import { Buffer } from 'buffer' ;
62+ window . Buffer = Buffer ;
63+
6064 import * as linera from '@linera/client' ;
6165 import * as signer from '@linera/signer' ;
6266
63- const COUNTER_APP_ID = '7ecd0211fe97206f5d78829a9e1f16166380ec138cb1f1e19cc162a0b8a036ac ' ;
67+ const COUNTER_APP_ID = '338fd1ac2b5aa9492052fabbce2cbad69383dd94c043260de9c36de784447a6a ' ;
6468
6569 async function run ( ) {
6670 await linera . default ( ) ;
6771 const faucet = await new linera . Faucet ( 'http://127.0.0.1:8080' ) ;
68- const emedded_signer = new signer . EmbeddedEIP191Signer ( "f77a21701522a03b01c111ad2d2cdaf2b8403b47507ee0aec3c2e52b765d7a66" ) ;
72+ const metamask_signer = await new signer . MetaMaskEIP191Signer ( ) ;
6973 const wallet = await faucet . createWallet ( ) ;
70- const owner = emedded_signer . address ( ) ;
74+ const owner = await metamask_signer . getConnectedAddress ( ) ;
75+ document . getElementById ( 'owner' ) . innerText = owner ;
7176 document . getElementById ( 'chain-id' ) . innerText = await faucet . claimChain ( wallet , owner ) ;
72- const client = await new linera . Client ( wallet , emedded_signer ) ;
77+ const client = await new linera . Client ( wallet , metamask_signer ) ;
7378 const counter = await client . frontend ( ) . application ( COUNTER_APP_ID ) ;
7479 const logs = document . getElementById ( 'logs' ) ;
7580 const incrementButton = document . getElementById ( 'increment-btn' ) ;
@@ -82,7 +87,6 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
8287 logs . insertBefore ( entry , logs . firstChild ) ;
8388 }
8489
85-
8690 async function updateCount ( ) {
8791 const response = await counter . query ( '{ "query": "query { value }" }' ) ;
8892 document . getElementById ( 'count' ) . innerText
0 commit comments