Search…
⌃K

Deploying Functions

Before you deploy a function, we recommend you read How To Write A Function
Deploying a function represents the action of deploying a source code (usable by EXM) to Arweave.
This can be done in multiple ways:
  • SDK
JS SDK
exm-function.js
import { Exm, ContractType } from '@execution-machine/sdk';
import { readFileSync } from 'fs';
const exm = new Exm({ token: 'MY_EXM_TOKEN' });
const contractSource: Uint8Array = readFileSync('exm-function.js');
// .deploy(source, initState, contractType)
await exm.functions.deploy(contractSource, { counter: 0 }, ContractType.JS)
export async function handle(state, action) {
state.counter++;
return { state };
}
  • CLI
$ exm function:deploy --src exm-function.js --init-state '{"counter": 0}' --token MY_EXM_TOKEN
For more information about deployments with exm , refer to:
$ exm function:deploy --help