Join our community of builders on

Telegram!Telegram
API Reference

Utils

This package provides the API for all Utils modules.

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

import "./compact-contracts/node_modules/@openzeppelin-compact/contracts/src/security/Initializable";

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

Ledger

None.

Witnesses

None.

Circuits

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: "".