diff --git a/.env b/.env new file mode 100644 index 0000000..e856462 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +VITE_FAUCET_URL=https://faucet.testnet-babbage.linera.net +VITE_COUNTER_APP_ID= +VITE_FUNGIBLE_APP_ID= diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21011ca..6f200f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: with: submodules: true - uses: cachix/install-nix-action@v26 - - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: DeterminateSystems/flakehub-cache-action@main - name: Run all CI tasks run: | nix develop '.?submodules=1' --override-input linera-protocol ./linera-protocol --command pnpm run ci diff --git a/README.md b/README.md index a599d6d..d3365ea 100644 --- a/README.md +++ b/README.md @@ -69,3 +69,12 @@ For development, you can also use `pnpm build --watch` to automatically rebuild the extension on change. Changes to the client worker will not propagate to the extension, but once you run `wasm-pack build` they will be picked up. + + +## Examples + +In `/examples` directory there are a couple of examples that can be run +to test the Linera network. The faucet address and application addresses +are controlled via ENV variables. Those can be set in `.env` file in the root +of the project or you can overwrite them in `.env.production.local` - +a file ignored by git and so needs to be created locally. \ No newline at end of file diff --git a/examples/hosted-counter-metamask/index.html b/examples/hosted-counter-metamask/index.html new file mode 100644 index 0000000..71d6f37 --- /dev/null +++ b/examples/hosted-counter-metamask/index.html @@ -0,0 +1,112 @@ + + + + + + Linera | Counter + + + + + +
+
+
+

Counter

+

+ This is a simple application tracking some on-chain state that remembers the value of an integer counter. +

+

+ Click the button to submit a block that increments the counter, and watch your local node's state update in real-time. +

+
+
+

Clicks: 0

+ +
+
+ +
+

Connected as requesting owner…

+

Chain history for requesting chain…

+
+
+ + + + + + + diff --git a/examples/hosted-counter-metamask/package.json b/examples/hosted-counter-metamask/package.json new file mode 100644 index 0000000..74b1f5e --- /dev/null +++ b/examples/hosted-counter-metamask/package.json @@ -0,0 +1,21 @@ +{ + "name": "@linera/examples/hosted-counter-metamask", + "private": true, + "author": "Linera ", + "license": "Apache-2.0", + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "ci": "pnpm build" + }, + "dependencies": { + "@linera/client": "workspace:*", + "@linera/signer": "workspace:*" + }, + "devDependencies": { + "vite": "^5.4.11" + } +} diff --git a/examples/hosted-counter-metamask/public/arrow.svg b/examples/hosted-counter-metamask/public/arrow.svg new file mode 120000 index 0000000..77d21e2 --- /dev/null +++ b/examples/hosted-counter-metamask/public/arrow.svg @@ -0,0 +1 @@ +../../assets/arrow.svg \ No newline at end of file diff --git a/examples/hosted-counter-metamask/public/icon.png b/examples/hosted-counter-metamask/public/icon.png new file mode 120000 index 0000000..b3dee6a --- /dev/null +++ b/examples/hosted-counter-metamask/public/icon.png @@ -0,0 +1 @@ +../../assets/icon.png \ No newline at end of file diff --git a/examples/hosted-counter-metamask/public/js/@linera/client b/examples/hosted-counter-metamask/public/js/@linera/client new file mode 120000 index 0000000..ad71613 --- /dev/null +++ b/examples/hosted-counter-metamask/public/js/@linera/client @@ -0,0 +1 @@ +../../../node_modules/@linera/client/dist \ No newline at end of file diff --git a/examples/hosted-counter-metamask/public/style.css b/examples/hosted-counter-metamask/public/style.css new file mode 120000 index 0000000..1e19e62 --- /dev/null +++ b/examples/hosted-counter-metamask/public/style.css @@ -0,0 +1 @@ +../../assets/style.css \ No newline at end of file diff --git a/examples/hosted-counter-metamask/vite.config.ts b/examples/hosted-counter-metamask/vite.config.ts new file mode 100644 index 0000000..203b989 --- /dev/null +++ b/examples/hosted-counter-metamask/vite.config.ts @@ -0,0 +1,27 @@ +import { defineConfig } from 'vite'; + +// https://vitejs.dev/config/ +export default defineConfig({ + base: '/hosted/counter/', + server: { + headers: { + 'Cross-Origin-Embedder-Policy': 'require-corp', + 'Cross-Origin-Opener-Policy': 'same-origin', + }, + }, + build: { + rollupOptions: { + external: ['@linera/client'], + }, + }, + esbuild: { + supported: { + 'top-level-await': true, + }, + }, + optimizeDeps: { + exclude: [ + '@linera/client', + ], + }, +}) diff --git a/examples/hosted-counter/index.html b/examples/hosted-counter/index.html index 46be494..f8b2c28 100644 --- a/examples/hosted-counter/index.html +++ b/examples/hosted-counter/index.html @@ -36,6 +36,7 @@

Counter

+

Connected as requesting owner…

Chain history for requesting chain…