Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
acd76ad
Add basic EmbeddedEIP191Signer
deuszx May 28, 2025
89496ed
Use IJsSigner interface exported from linera-protocol
deuszx May 29, 2025
1086fca
Work with string types in JS api
deuszx May 29, 2025
3d9516f
Move the sample Embedded signer to linera-protocol repo
deuszx May 30, 2025
a8bb8eb
Use updated APIs
deuszx Jun 2, 2025
01610ef
Integrate MetaMask example
deuszx Jun 3, 2025
f236412
Update hosted fungible demo to use embedded signer
deuszx Jun 3, 2025
052b2f3
Fix CI
deuszx Jun 3, 2025
369b78d
Adapt to work with latest version of linera-web
deuszx Jun 4, 2025
39c57b5
Update git submodule to point at main. Workspace deps
deuszx Jun 9, 2025
300de33
Update to work w/ latest main branch
deuszx Jun 11, 2025
23c9787
Pull in faucet url and app IDs via env vars
deuszx Jun 12, 2025
43f2b6f
Make base demos use the PrivateKey signers
deuszx Jun 12, 2025
6e71b49
Add separate counter with MetaMask integration
deuszx Jun 12, 2025
93f5409
Remove imported Buffer
deuszx Jun 12, 2025
4fad1ef
COmmit newlines at the end of the files
deuszx Jun 12, 2025
26be11f
Initialize a Signer in extension example
deuszx Jun 13, 2025
1ce1a4b
Add section to README about env vars
deuszx Jun 13, 2025
af5b5af
Replace magic-nix-cache with flakehub-cache
deuszx Jun 13, 2025
8575cf4
Remove extension from workspace
deuszx Jun 13, 2025
6730616
Move linera-protocol out of the workspace
deuszx Jun 13, 2025
01328d9
See if this helps
deuszx Jun 13, 2025
ad24510
Update submodule
deuszx Jun 14, 2025
67d2443
Move linera-protocol back to workspace member
deuszx Jun 14, 2025
a887355
Call install --frozen-lockfile in root package.json
deuszx Jun 14, 2025
ecb6e5f
Update to use main linera-protocol
deuszx Jun 14, 2025
c980910
Merge remote-tracking branch 'origin/main' into embedded-js-signer
deuszx Jun 23, 2025
b8867be
Do not install deps in pnpm build for hosted-counter eexample
deuszx Jun 23, 2025
1e31661
Generate new privkey for every app load
deuszx Jun 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions examples/hosted-counter/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h1>Counter</h1>
</div>

<div class="logs">
<h2>Connected as <code id="owner" class="hex">requesting owner…</code> </h2>
<h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code></h2>
<ul id="logs">
<template>
Expand All @@ -50,22 +51,30 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
<script type="importmap">
{
"imports": {
"@linera/client": "./js/@linera/client/linera_web.js"
"@linera/client": "./js/@linera/client/linera_web.js",
"@linera/signer": "./js/@linera/signer/index.js"
}
}
</script>

<script type="module">
import { Buffer } from 'buffer';
window.Buffer = Buffer;

import * as linera from '@linera/client';
import * as signer from '@linera/signer';

const COUNTER_APP_ID = '2b1a0df8868206a4b7d6c2fdda911e4355d6c0115b896d4947ef8e535ee3c6b8';
const COUNTER_APP_ID = '87bdd2357acfe1a8c598ec04740755c46d7644f21d7aa287c96186329ddfe9fc';

async function run() {
await linera.default();
const faucet = await new linera.Faucet('https://faucet.testnet-babbage.linera.net');
const faucet = await new linera.Faucet('http://127.0.0.1:8080');
const signer = await new signer.MetaMaskEIP191Signer();
const wallet = await faucet.createWallet();
const client = await new linera.Client(wallet);
document.getElementById('chain-id').innerText = await faucet.claimChain(client);
const owner = await signer.address();
document.getElementById('owner').innerText = owner;
document.getElementById('chain-id').innerText = await faucet.claimChain(wallet, owner);
const client = await new linera.Client(wallet, signer);
const counter = await client.frontend().application(COUNTER_APP_ID);
const logs = document.getElementById('logs');
const incrementButton = document.getElementById('increment-btn');
Expand All @@ -78,7 +87,6 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting chain…</code>
logs.insertBefore(entry, logs.firstChild);
}


async function updateCount() {
const response = await counter.query('{ "query": "query { value }" }');
document.getElementById('count').innerText
Expand Down
6 changes: 4 additions & 2 deletions examples/hosted-counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"ci": "pnpm install --frozen-lockfile && pnpm build"
},
"dependencies": {
"@linera/client": "file:../../linera-protocol/linera-web"
"@linera/client": "workspace:*",
"@linera/signer": "workspace:*",
"buffer": "^6.0.3"
},
"devDependencies": {
"vite": "^5.4.10"
"vite": "^5.4.11"
}
}
15 changes: 11 additions & 4 deletions examples/hosted-fungible/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ <h4>Transfer</h4>
</div>

<div class="logs">
<h2>Connected as <code id="owner" class="hex">requesting owner…</code> </h2>
<h2>Chain history for <code id="chain-id" class="hex">requesting a new microchain…</code></h2>
<ul id="logs">
<template>
Expand All @@ -140,8 +141,10 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai

<script type="module">
import * as linera from '@linera/client';
import * as signer from '@linera/signer';

const FUNGIBLE_APP_ID = '465e465b050db5034fd8a51df46b9a7cf02a8a6414cc2b94b102e912208d4a4b';
// This needs to point at actual deployed fungible application ID.
const FUNGIBLE_APP_ID = 'ae2e8739878ed86fe67eb3a3f473437e122233ab46fc00f1d115462dcf9a597b8588f06d13062198951b0a37c0552db564c5d6903f1e00e8f0e2df6b87891bd700';

const gql = (query, variables = {}) => JSON.stringify({ query, variables });

Expand Down Expand Up @@ -216,11 +219,15 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
});

await linera.default();
const faucet = await new linera.Faucet('https://faucet.testnet-babbage.linera.net');
const faucet = await new linera.Faucet('http://127.0.0.1:8080');
throw new Error('INSERT PRIVKEY HERE'); // Replace with your private key
const signer = await new signer.PrivateKey("f77a21701522a03b01c111ad2d2cdaf2b8403b47507ee0aec3c2e52b765d7a66");
const wallet = await faucet.createWallet();
const client = await new linera.Client(wallet);
const chainId = await faucet.claimChain(client);
const owner = signer.address();
const chainId = await faucet.claimChain(wallet, owner);
const client = await new linera.Client(wallet, signer);
document.querySelector('#chain-id').innerText = chainId;
document.querySelector('#owner').innerText = owner;

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

Expand Down
3 changes: 2 additions & 1 deletion examples/hosted-fungible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"ci": "pnpm install --frozen-lockfile && pnpm build"
},
"dependencies": {
"@linera/client": "file:../../linera-protocol/linera-web"
"@linera/client": "workspace:*",
"@linera/signer": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.11"
Expand Down
10 changes: 1 addition & 9 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
"@shoelace-style/shoelace": "^2.16.0",
"lit": "^3.2.0",
"randomstring": "^1.3.0",
"webext-bridge": "^6.0.1",
"@linera/client": "file:../linera-protocol/linera-web"
},
"devDependencies": {
"@types/chrome": "^0.0.267",
"@types/randomstring": "^1.3.0",
"ts-auto-guard": "^5.0.1",
"typescript": "^5.6.2",
"vite": "^5.4.5"
"webext-bridge": "^6.0.1"
}
}
2 changes: 1 addition & 1 deletion extension/src/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Server {
async setWallet(wallet: string) {
this.wallet = wallet;
await linera;
this.client = await new linera.Client({} as linera.Wallet); // Replace with actual wallet initialization
this.client = await new linera.Client({} as linera.Wallet, {} as linera.Signer); // Replace with actual wallet initialization
this.client.onNotification((notification: any) => {
console.debug('got notification for', this.subscribers.size, 'subscribers:', notification);
for (const subscriber of this.subscribers.values()) {
Expand Down
2 changes: 1 addition & 1 deletion linera-protocol
Submodule linera-protocol updated 236 files
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@
"keywords": [],
"author": "Linera <[email protected]>",
"license": "Apache-2.0",
"devDependencies": {}
"dependencies": {
"@linera/client": "file:./linera-protocol/linera-web",
"@linera/signer": "file:./linera-protocol/linera-web/signer"
},
"devDependencies": {
"@types/chrome": "^0.0.267",
"@types/jest": "^29.5.14",
"@types/node": "^24.0.0",
"@types/randomstring": "^1.3.0",
"ts-auto-guard": "^5.0.1",
"typescript": "^5.8.3",
"vite": "^5.4.5"
}
}
Loading
Loading