Utils

This directory provides the API for all Utils modules.

For an overview of the module, read the Utils guide.

Utils

import "./node_modules/@openzeppelin-compact/contracts/src/utils/Utils" prefix Utils_;

Utils

There’s no easy way to get the constraints of pure circuits at this time so the constraints of the circuits listed below have been omitted.

isKeyOrAddressZero(keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>) → Boolean circuit

Returns whether keyOrAddress is the zero address.

Midnight’s burn address is represented as left<ZswapCoinPublicKey, ContractAddress>(default<ZswapCoinPublicKey>) in Compact, so we’ve chosen to represent the zero address as this structure as well

isKeyZero(key: ZswapCoinPublicKey) → Boolean circuit

Returns whether key is the zero address.

isKeyOrAddressEqual(keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>, other: Either<ZswapCoinPublicKey, ContractAddress>) → Boolean circuit

Returns whether keyOrAddress is equal to other. Assumes that a ZswapCoinPublicKey and a ContractAddress can never be equal

isContractAddress(keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>) → Boolean circuit

Returns whether keyOrAddress is a ContractAddress type.

emptyString() → Opaque<"string"> circuit

A helper function that returns the empty string: "".