Skip to content

Commit

Permalink
Update Pact for 4.4 release (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilypi committed Sep 5, 2022
1 parent 4fc970f commit 957b8bd
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 31 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
4.4
---
* Document VSCode support - thanks JeremeyJS! (#965)
* Documentation fixes - thanks JCM00N and Luzzotica! (#1003, #1021)
* Gas-related bug fixes and adjustments to `format` and `try` (#1020, #1019)
* Defined keysets are now required to be namespaced (#1011)
* Consolidated Pact 4.4 execution config flag (removes need for `DisablePreserveNamespaceUpgrade` flag, #1026)

4.3
---
* Interpreter improvements (#970)
Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ Return ID if called during current pact execution, failing if not.
Obtain current pact build version.
```lisp
pact> (pact-version)
"4.3.1"
"4.4"
```

Top level only: this function will fail if used in module code.
Expand Down
101 changes: 72 additions & 29 deletions docs/en/pact-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ will be rotated in its place.
Top level only: this function will fail if used in module code.

describe-namespace
~~~~~~~~~~~~~~~~~~

*ns* ``string`` *→* ``object:{described-namespace}``
Describe the namespace NS, returning a row object containing the user
and admin guards of the namespace, as well as its name.

.. code:: lisp
(describe-namespace 'my-namespace)
Top level only: this function will fail if used in module code.

distinct
~~~~~~~~

Expand Down Expand Up @@ -503,7 +517,7 @@ Obtain current pact build version.
.. code:: lisp
pact> (pact-version)
"4.3"
"4.4"
Top level only: this function will fail if used in module code.

Expand Down Expand Up @@ -832,7 +846,7 @@ by the ordering of keys.

.. code:: lisp
(let*
(let*
((qry (lambda (k obj) true)) ;; select all rows
(f (lambda (x) [(at 'firstName x), (at 'b x)]))
)
Expand Down Expand Up @@ -1732,21 +1746,6 @@ time ‘pact-id’ must return the same value. In effect this ensures that
the guard will only succeed within the multi-transaction identified by
the pact id.

create-principal
~~~~~~~~~~~~~~~~

*guard* ``guard`` *→* ``string``
Create a principal which unambiguously identifies GUARD.

.. code:: lisp
(create-principal (read-keyset 'keyset))
(create-principal (keyset-ref-guard 'keyset))
(create-principal (create-module-guard 'module-guard))
(create-principal (create-user-guard 'user-guard))
(create-principal (create-pact-guard 'pact-guard))
create-user-guard
~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1855,17 +1854,6 @@ found in environment.
(require-capability (TRANSFER src dest))
validate-principal
~~~~~~~~~~~~~~~~~~

*guard* ``guard`` *principal* ``string`` *→* ``bool``
Validate that PRINCIPAL unambiguously identifies GUARD.

.. code:: lisp
(enforce (validate-principal (read-keyset 'keyset) account) "Invalid account ID")
with-capability
~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1945,6 +1933,61 @@ are base-16 strings of length 32.
(validate-keypair pubkey privkey)
.. _Guards:

Guards
------

create-principal
~~~~~~~~~~~~~~~~

*guard* ``guard`` *→* ``string``
Create a principal which unambiguously identifies GUARD.

.. code:: lisp
(create-principal (read-keyset 'keyset))
(create-principal (keyset-ref-guard 'keyset))
(create-principal (create-module-guard 'module-guard))
(create-principal (create-user-guard 'user-guard))
(create-principal (create-pact-guard 'pact-guard))
is-principal
~~~~~~~~~~~~

*principal* ``string`` *→* ``bool``
Tell whether PRINCIPAL string conforms to the principal format without
proving validity.

.. code:: lisp
(enforce (is-principal 'k:462e97a099987f55f6a2b52e7bfd52a36b4b5b470fed0816a3d9b26f9450ba69) "Invalid account structure: non-principal account")
typeof-principal
~~~~~~~~~~~~~~~~

*principal* ``string`` *→* ``string``
Return the protocol type of a given PRINCIPAL value. If input value is
not a principal type, then the empty string is returned.

.. code:: lisp
(typeof-principal 'k:462e97a099987f55f6a2b52e7bfd52a36b4b5b470fed0816a3d9b26f9450ba69)
validate-principal
~~~~~~~~~~~~~~~~~~

*guard* ``guard`` *principal* ``string`` *→* ``bool``
Validate that PRINCIPAL unambiguously identifies GUARD.

.. code:: lisp
(enforce (validate-principal (read-keyset 'keyset) account) "Invalid account ID")
.. _repl-lib:

REPL-only functions
Expand Down Expand Up @@ -2106,7 +2149,7 @@ env-exec-config
*→* ``[string]``
Queries, or with arguments, sets execution config flags. Valid flags:
[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”]
[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePact431”,“DisablePact44”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”]

.. code:: lisp
Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ that simply encloses ``debit`` and ``credit`` calls:
(check-account-exists to))
(defun transfer (from to amount)
(with-capability (TRANSFER to from amount)
(with-capability (TRANSFER from to amount)
(debit from amount)
(credit to amount)))
Expand Down

0 comments on commit 957b8bd

Please sign in to comment.