Skip to main content

Read State

The following query is used to read the state of the program:

const metaWasm = fs.readFileSync('path/to/meta.wasm');
const state = await, metaWasm);
// If program expects inputValue in meta_state function it's possible to specify it
const state = await, metaWasm, inputValue);

inputValue is a payload if program expects it in meta_state


To read state in front-end applications you can use fetch browser API to get buffer from meta.wasm:

const state = fetch(metaFile)
.then((res) => res.arrayBuffer())
.then((arrayBuffer) => Buffer.from(arrayBuffer))
.then((buffer) =>, buffer, {
AnyPayload: 'Null',
.then((state) => state.toHuman());