@@ -36,6 +36,7 @@ <h1>Counter</h1>
36
36
</ div >
37
37
38
38
< div class ="logs ">
39
+ < h2 > Connected as < code id ="owner " class ="hex "> requesting owner…</ code > </ h2 >
39
40
< h2 > Chain history for < code id ="chain-id " class ="hex "> requesting chain…</ code > </ h2 >
40
41
< ul id ="logs ">
41
42
< template >
@@ -57,19 +58,23 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
57
58
</ script >
58
59
59
60
< script type ="module ">
61
+ import { Buffer } from 'buffer' ;
62
+ window . Buffer = Buffer ;
63
+
60
64
import * as linera from '@linera/client' ;
61
65
import * as signer from '@linera/signer' ;
62
66
63
- const COUNTER_APP_ID = '7ecd0211fe97206f5d78829a9e1f16166380ec138cb1f1e19cc162a0b8a036ac ' ;
67
+ const COUNTER_APP_ID = '338fd1ac2b5aa9492052fabbce2cbad69383dd94c043260de9c36de784447a6a ' ;
64
68
65
69
async function run ( ) {
66
70
await linera . default ( ) ;
67
71
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 ( ) ;
69
73
const wallet = await faucet . createWallet ( ) ;
70
- const owner = emedded_signer . address ( ) ;
74
+ const owner = await metamask_signer . getConnectedAddress ( ) ;
75
+ document . getElementById ( 'owner' ) . innerText = owner ;
71
76
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 ) ;
73
78
const counter = await client . frontend ( ) . application ( COUNTER_APP_ID ) ;
74
79
const logs = document . getElementById ( 'logs' ) ;
75
80
const incrementButton = document . getElementById ( 'increment-btn' ) ;
@@ -82,7 +87,6 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
82
87
logs . insertBefore ( entry , logs . firstChild ) ;
83
88
}
84
89
85
-
86
90
async function updateCount ( ) {
87
91
const response = await counter . query ( '{ "query": "query { value }" }' ) ;
88
92
document . getElementById ( 'count' ) . innerText
0 commit comments