Serverless Canister Calls in TypeScript
Β· One min read
Hey π
If you like working with ic-js in the frontend...
Say hello to serverless canister functions in TypeScript β‘οΈ
Write backend logic using the same TypeScript you already love β now with:
- π« Built-in canister clients for the Internet Computer (ICP, ICRC, CMC, NNS, SNS...)
- βοΈ Full type-safety
- π Zero agent setup
- π§ Caller identity handled automatically
- π± ICP & ICRC transfers from serverless hooks
No Rust required. No backend headaches.
π Documentationβ
Want to go straight to the point? Checkout the π references
Exampleβ
Transfer ICP directly from a Satellite serverless function:
import { IcpLedgerCanister } from "@junobuild/functions/canisters/ledger/icp";
export const onExecute = async () => {
const ledger = new IcpLedgerCanister();
const result = await ledger.transfer({
args: {
to: "destination-account-identifier",
amount: { e8s: 100_000_000n }, // 1 ICP
fee: { e8s: 10_000n },
memo: 0n
}
});
};
And yes - this works inside datastore hooks like onSetDoc and assertSetDoc, fully atomic.
Browse the full working example π Making Canister Calls in TypeScript
Cool cool cool?
To infinity and beyond
David
