Skip to main content

Function quick reference

  • abs Calculate the absolute value of a number.
  • acquire-module-admin Grant module administrative privileges for a specified module.
  • add-time Add a specified number of seconds to a time.
  • add (+) Add numbers, concatenation for strings, or merge objects.
  • and? Apply a logical AND operation to a result.
  • and Perform a boolean logic AND operation.
  • at Get a value using an index for a list or a key for an object.
  • base64-decode Decode a base64-encoded string.
  • base64-encode Encode a string as unpadded base64.
  • begin-tx Begin a new transaction with an optional name (REPL only).
  • bind Evaluate an object with bindings.
  • bitwise-and (&) Compute the bitwise AND operation between arguments.
  • bitwise-or (|) Computes the bitwise OR operation between two integers.
  • bitwise-reverse (~) Reverse all bits in the provided integer.
  • ceiling Round up the value of a decimal to the nearest integer or specified precision.
  • chain-data Retrieve public metadata.
  • charset-ascii Use the standard ASCII character set.
  • charset-latin Use the standard Latin1 character set.
  • commit-tx Commit the current transaction (REPL only).
  • compose-capability Request the grant of a capability within a capability.
  • compose Compose functions to operate on value.
  • concat Concatenate a list of strings.
  • constantly Ignore specified arguments.
  • contains Evaluate the contents of a list, object, or string.
  • continue-pact Continue a previously-initiated multi-step defpact transaction (REPL only).
  • continue Continue a previously started defpact step.
  • create-capability-guard Create a guard to enforce a specified capability.
  • create-capability-pact-guard Create a guard to enforces a specified capability in an executing defpact step.
  • create-module-guard Define a guard to enforce the current module administrator predicate.
  • create-pact-guard Define a guard predicate that captures the pact-id for a defpact step.
  • create-principal Create a principal that identifies a guard.
  • create-table Create a table.
  • create-user-guard Define a custom guard.
  • days Specify a number of days to add or subtract days from a given time.
  • dec Convert an integer to a decimal value.
  • define-keyset Define an authorization keyset from keyset data set in the environment.
  • define-namespace Create a new namespace or update the guards of an existing namespace.
  • describe-keyset Retrieve metadata for a specified keyset.
  • describe-module Get metadata for a specified module.
  • describe-namespace Describe the specified namespace.
  • describe-table Get metadata for a specified table.
  • diff-time Compute the difference in seconds between two specified times.
  • distinct Return a list with duplicates removed.
  • div (/) Divide the first argument by the second argument.
  • do Evaluate a sequence of expressions and return the result from the last expression.
  • drop Remove values from a list or string.
  • emit-event Emit a specified capability as an event.
  • enforce-guard Execute a specified guard or keyset to enforce predicate logic.
  • enforce-keyset Execute a keyset to enforce predicate logic.
  • enforce-one Evaluate a series of tests in order.
  • enforce-pact-version Enforce the runtime Pact version to be within a specified range.
  • enforce-verifier Enforce that a verifier with the specified name is in scope.
  • enforce Fail a transaction if an expression evaluates to false.
  • enumerate Return a sequence of numbers as a list.
  • env-chain-data Define chain information for transactions in your testing environment (REPL only).
  • env-data Set transaction data for your testing environment (REPL only).
  • env-enable-repl-natives Control whether REPL native functions are allowed in module code (REPL only).
  • env-events Retrieve any accumulated events and optionally clear the event state (REPL only).
  • env-exec-config Query or set configuration information for transactions in your testing environment (REPL only).
  • env-gas Query the current gas state or set it to a specific value (REPL only).
  • env-gaslimit Set the environment gas limit to a specific value (REPL only).
  • env-gaslog Enable gas logging for a block of code (REPL only).
  • env-gasmodel Query or update the current gas model (REPL only).
  • env-hash Set the current transaction hash (REPL only).
  • env-keys Set the transaction signer keys (REPL only, deprecated).
  • env-milligas Query the current gas state in units of one one thousandth of a gas unit.
  • env-module-admin Acquire the module administrative rights for any module loaded in the REPL.
  • env-namespace-policy Install a managed namespace policy (REPL only).
  • env-set-debug-flag Set the Pact interpreter debug flags.
  • env-set-milligas Set the current gas state to a specific value in units of one one thousandth of a gas unit.
  • env-sigs Set signature keys for signing transactions and granting capabilities (REPL only).
  • env-verifiers Set transaction verifier names and capabilities.
  • equal (=) Return true if the first argument is equal to the second argument.
  • exp Calculate the exponential function of a value.
  • expect-failure Evaluate an expression and succeed only if the expressions results in an error (REPL only).
  • expect-that Evaluate an expression and succeed if the resulting value passes a predicate function (REPL only).
  • expect Evaluate an expression and verify that the result equals an expected value (REPL only).
  • filter Filter a list by applying a function to each element.
  • floor Round down the value of a decimal to an integer or to a specified precision.
  • fold-db Select rows from a table using a predicate and accumulate the results.
  • fold Reduce a list iteratively by applying a function to each element.
  • format-time Format a time value using a specified format.
  • format Format a message using placeholders and variables.
  • greater-than or equal (>=) Return true if the first argument is greater than or equal to the second argument.
  • greater-thant (>) Return true if the first argument is greater than the second argument.
  • hash-keccak256 Compute the hash of a list of inputs.
  • hash Compute the BLAKE2b 256-bit hash of a value.
  • hours Add a specific number of hours to a given time.
  • hyperlane-decode-token-message Decode a base-64-unpadded encoded Hyperlane Token Message into an object.
  • hyperlane-encode-token-message Encode an object into base-64-unpadded encoded Hyperlane Token Message.
  • hyperlane-message-id Get the message identifier of a Hyperlane Message object.
  • identity Return the provided value.
  • if Test whether a condition is true to determine the operation to perform.
  • insert Add a new value to a database record in a specified table.
  • install-capability Specify and provision a managed capability.
  • int-to-str Represent an integer value as a string in a specified base.
  • is-charset Check whether a string conforms to a supported character set.
  • is-principal Check whether a principal string conforms to the principal format.
  • keys-2 Determine whether a keyset has at least two required keys.
  • keys-all Determine whether a keyset has all of its required keys.
  • keys Return all of the keys for a specified table in a module.
  • keys Return all of the keys for a specified table in a module.
  • keyset-ref-guard Create a guard for the keyset in the guard database.
  • length Compute the length of a list, string, or object.
  • less-than or equal (<=) Return true if the first argument is less than or equal to the second argument.
  • list-module List modules available for loading.
  • list-modules List all of the modules deployed on a particular chain using the /local endpoint.
  • ln Compute the natural logarithm of a specified value.
  • load Load and evaluate a specified .pact or .repl file.
  • log Compute the logarithm of the specified value with the specified base.
  • less-than < Return true if the first argument is less than the second argument.
  • make-list Create a list by repeating a specified value a certain number of times.
  • map Apply a function (APP) to each element in a list.
  • minutes Add a specific number of minutes to a given time.
  • mod Compute the remainder for the first value divided by the second value.
  • multiply (*) Multiply the first argument by the second argument.
  • namespace Set the current namespace to a specified value.
  • negate Negate a specified integer or decimal value.
  • not-equal (!=) Return true if the first argument does not equal the second argument.
  • not? Apply a logical NOT to the results of a function.
  • not Perform a boolean logic NOT operation.
  • or? Apply a logical OR to the results a function.
  • or Perform a boolean logic NOT operation.
  • pact-id Return the identifier associated with defpact execution.
  • pact-state Inspect state from most recent defpact execution.
  • pact-version Get the current Pact build version.
  • pairing-check Perform pairing and final exponentiation on points for a zero knowledge proof.
  • parse-time Construct time from a UTC value using a specified format.
  • point-add Add two points together for a zero knowledge proof.
  • poseidon-hash-hack-a-chain Compute a hash using the Poseidon hash function used by Hack-a-Chain.
  • power-of (^) Raise an argument to the power of the second argument.
  • print Convert a value into a string and print it to the REPL output.
  • read-decimal Read a key string or number value from the message data as a decimal.
  • read-integer Read a key string or number value from the message data as an integer.
  • read-keyset Read a key from the message data as a keyset with a list of keys and a predicate function.
  • read-msg Read a key from the message data body.
  • read-string Read a key string or number value from the message data as a string.
  • read Retrieve information from a specified table based on a given key row.
  • remove Remove an entry associated with a specified key from an object.
  • require-capability Check whether a specified capability has been granted.
  • resume Bind a yielded object value from a defpact step to the execution of the next defpact step.
  • reverse Reverse the order of elements in a given list.
  • rollback-tx Roll back the current transaction.
  • round Perform Banker's rounding to return an integer or decimal value.
  • scalar-mult Multiply a point by an integer value for a zero-knowledge proof.
  • select Retrieve full rows or specific columns from a table.
  • shift Perform a bitwise shift operation on the specified integer by the specified number of bits.
  • show Convert a specified value into a string.
  • sig-keyset Build a keyset guard from keys present in message signatures.
  • sort Sort a list of primitive values or objects.
  • sqrt Compute the square root of the given value.
  • static-redeploy Redeploy a module without any code changes.
  • str-to-int Compute the integer value of the specified string.
  • str-to-list Convert a string into a list where each element is a single-character string.
  • subtract (-) Negate an argument or subtract the second argument from the first argument.
  • take Retrieve a specified number of values from a list, string, or object.
  • test-capability Acquire or install the capability specified.
  • time Construct a time object from a UTC value using the %Y-%m-%dT%H:%M:%SZ format.
  • try Attempt a pure action without input, output, or state-changing operations.
  • tx-hash Get the hash of the current transaction as a string.
  • typecheck Run the Pact static type checker on a module.
  • typeof-principal Return the protocol type of a given principal.
  • typeof Return a description of the data type for a specified value.
  • update Update a value for a database record in the specified table.
  • validate-principal Validate that a principal identifies a specified guard.
  • verify-spv Perform a platform-specific simplified payment verification (SPV) proof.
  • where Define a clause to refine the results from filter or select operations.
  • with-capability Specify the capability that must be granted to perform a privileged operation.
  • with-default-read Read a row from a specified table and use default values for columns if the row isn't found.
  • with-read Read a row from a specified table and bind columns names to variables.
  • write Write or overwrite a value for a database record in the specified table.
  • xor Compute the bitwise exclusive OR operation between two integers.
  • yield Yield an object to use with the resume function in a defpact step.
  • zip Combine two lists using a specified function to create a new list.