canonicalfunctionfunction canonical(value: unknown): stringA value as text with the keys of every object in order and no space: one text for one value.
The hash of a plan: the SHA-256 of its canonical text, in which every object has its keys in order and nothing depends on how the plan was made. Two plans with the same actions, the same losses and the same ends have the same hash, and a plan changed in any way has another, so that an apply can hold a plan to the hash a person approved.
import { canonical } from "./hash.ts";
canonical({ b: 1, a: [2, { d: 1, c: 0 }] }); // '{"a":[2,{"c":0,"d":1}],"b":1}'canonicalfunctionfunction canonical(value: unknown): stringA value as text with the keys of every object in order and no space: one text for one value.
hashPlanfunctionfunction hashPlan(plan: Omit<Plan, "hash">): Promise<PlanHash>The hash of a plan without its hash.