Data Decoding

Data Decoding

The d utility provides almost the same data types as the e utility, but instead of encoding the data it allows decoding of the data. It is useful when wanting to decode data returned by a query.

For example, if the contract has the positions storage mapper:

fn positions(&self, address: &ManagedAddress, token: &TokenIdentifier) -> VecMapper<Position<Self::Api>>;

and we would want to decode the data returned by the mapper, we could use:

import { e, d } from "xsuite";
const { returnData } = await world.query({
  callee: contract,
  funcName: "positions",
  funcArgs: [
const positions = d.List(
    name: d.Str(),
    timestamp: d.U32(),
    price: d.U(),

The supported types are identical to the ones from the Data Encoding page.