Skip to content

Latest commit

 

History

History

README.md

Serverless Canister Call Demo (Rust + Juno)

A sample app showcasing how to perform canister calls (e.g., transfer_from) inside a Rust-based serverless function using Juno.

This example listens for documents added to the request collection and:

  • Checks if the user has enough ICP.
  • Calls the transfer_from method to move 1 ICP from the user's wallet to the Satellite.
  • Marks the request as processed if the transfer succeeds.

The included UI is minimal and meant for testing.
You can use it to request ICP and trigger the function. If successful, your ICP balance decreases by 1 and the request appears as processed.

Getting started

git clone https://github.com/junobuild/examples
cd rust/calls

How to Run

  1. Install dependencies:
npm ci
  1. Start Juno local emulator:

Important

Requires the Juno CLI to be available npm i -g @junobuild/cli

juno emulator start
  1. Create a Satellite for local dev:
  1. Create required collections:
  1. Start the frontend dev server (in a separate terminal):
npm run dev
  1. Build the serverless functions (in a separate terminal):
juno functions build

The emulator will automatically upgrade your Satellite and live reload the changes.