Skip to content

toMBR

toMBR(obj, pathsCache?): bigint

Defined in: packages/store-kit/src/objects/payments.ts:47

Calculates the minimum balance requirement (MBR) for an object.

Parameters

obj

unknown

The object for which to calculate the MBR.

pathsCache?

(undefined | string)[]

Precomputed paths of the object.

Returns

bigint

Throws

Throws a TypeError if the object is undefined.

Throws

Throws a MaxSizeError if the object key or value exceeds the maximum size.

Example

Basic Usage

// Define an object
const obj = {
key: "value"
}
// Calculate the MBR
const mbr = toMBR(obj)

Cached Paths

Using the paths parameter

// Define an object
const obj = {
key: "value"
}
// Calculate the paths
const paths = toPaths(obj)
// Calculate the MBR
const mbr = toMBR(obj, paths)