Skip to content

Commit f236412

Browse files
committed
Update hosted fungible demo to use embedded signer
1 parent 01610ef commit f236412

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

examples/hosted-counter/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +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>
39+
<h2>Connected as <code id="owner" class="hex">requesting owner…</code> </h2>
4040
<h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code></h2>
4141
<ul id="logs">
4242
<template>

examples/hosted-fungible/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ <h4>Transfer</h4>
127127
</div>
128128

129129
<div class="logs">
130+
<h2>Connected as <code id="owner" class="hex">requesting owner…</code> </h2>
130131
<h2>Chain history for <code id="chain-id" class="hex">requesting a new microchain…</code></h2>
131132
<ul id="logs">
132133
<template>
@@ -140,7 +141,9 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
140141

141142
<script type="module">
142143
import * as linera from '@linera/client';
144+
import * as signer from '@linera/signer';
143145

146+
// This needs to point at actual deployed fungible application ID.
144147
const FUNGIBLE_APP_ID = '465e465b050db5034fd8a51df46b9a7cf02a8a6414cc2b94b102e912208d4a4b';
145148

146149
const gql = (query, variables = {}) => JSON.stringify({ query, variables });
@@ -216,11 +219,16 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
216219
});
217220

218221
await linera.default();
219-
const faucet = await new linera.Faucet('https://faucet.testnet-babbage.linera.net');
222+
throw new Error('INSERT FAUCET URL HERE'); // Replace with your Linera Faucet URL
223+
// const faucet = await new linera.Faucet(FAUCET URL HERE);
224+
throw new Error('INSERT PRIVKEY HERE'); // Replace with your private key
225+
// const embedded_signer = await new signer.EmbeddedSigner("INSERT PRIVKEY HERE");
220226
const wallet = await faucet.createWallet();
221-
const client = await new linera.Client(wallet);
222-
const chainId = await faucet.claimChain(client);
227+
const owner = await embedded_signer.address();
228+
const chainId = await faucet.claimChain(wallet, owner);
229+
const client = await new linera.Client(wallet, embedded_signer);
223230
document.querySelector('#chain-id').innerText = chainId;
231+
document.querySelector('#owner').innerText = owner;
224232

225233
const application = await client.frontend().application(FUNGIBLE_APP_ID);
226234

0 commit comments

Comments
 (0)