From 8deb3686d03de9cbf76e65c0a58aba940b2c9b17 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:29:17 +0100 Subject: [PATCH] docs: affine and regenerate --- .../examples/multiple-sources/README.md | 8 +++----- .../examples/multiple-sources/gov.pl | 4 ++-- .../examples/multiple-sources/template.pl | 2 +- .../examples/single-source/README.md | 8 +++----- .../examples/single-source/gov.pl | 4 ++-- contracts/okp4-objectarium/README.md | 5 ----- docs/okp4-law-stone.md | 18 ++++++------------ docs/okp4-objectarium.md | 7 +------ 8 files changed, 18 insertions(+), 38 deletions(-) diff --git a/contracts/okp4-law-stone/examples/multiple-sources/README.md b/contracts/okp4-law-stone/examples/multiple-sources/README.md index 02682e51..dbbe92ea 100644 --- a/contracts/okp4-law-stone/examples/multiple-sources/README.md +++ b/contracts/okp4-law-stone/examples/multiple-sources/README.md @@ -23,14 +23,14 @@ Where: - `{contract_name}`: Only informative, represents the corresponding smart contract name or type (e.g. `okp4-objectarium`); - `{contract_address}`: The smart contract to query, concerning the `okp4-law-stone` it must be a `okp4-objectarium` contract; -- `{contract_query}`: The JSON query to perform on the targeted smart contract, URL encoded. In our case an `ObjectData` query, for example: `%7B%22object_data%22%3A%7B%22id%22%3A%20%224cbe36399aabfcc7158ee7a66cbfffa525bb0ceab33d1ff2cff08759fe0a9b05%22%7D%7D`; +- `{contract_query}`: The JSON query to perform on the targeted smart contract, URL encoded. In our case an `ObjectData` query, for example: `%7B%22object_data%22%3A%7B%22id%22%3A%22b118d79b4a368028b34d564448e5f1082e098613434370f3c15d6a2bf9979dfc%22%7D%7D`; ## Instantiate First the `template.pl` program must be stored on a `okp4-objectarium` and the `gov.pl` updated with the right URI in the `consult(File).` predicate, the URI should be in the form: ```bash -cosmwasm:okp4-objectarium:${STORAGE_ADDRESS}?query=%7B%22object_data%22%3A%7B%22id%22%3A%221a88ca1632c7323c0aa594000cda26ed9f48b36351c29c3d1e35e0a0474e862e%22%7D%7D +cosmwasm:okp4-objectarium:${STORAGE_ADDRESS}?query=%7B%22object_data%22%3A%7B%22id%22%3A%22b118d79b4a368028b34d564448e5f1082e098613434370f3c15d6a2bf9979dfc%22%7D%7D ``` The instantiate will take as parameters the base64 encoded program and the address of a `okp4-objectarium` contract, on which the program will be stored and pinned, the `template.pl` object will also be pinned to ensure all the needed resources stays available: @@ -41,7 +41,6 @@ okp4d tx wasm instantiate $CODE_ID \ --from $ADDR \ --admin $ADMIN_ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"program\":\"$(cat gov.pl | base64)\", \"storage_address\": \"$STORAGE_ADDR\"}" ``` @@ -53,7 +52,7 @@ By using the `Ask` query we can provide Prolog predicates to be evaluated agains ```bash okp4d query wasm contract-state smart $CONTRACT_ADDR \ - "{\"ask\": {\"query\": \"can('change_governance', 'did:key:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6').\"}}" + "{\"ask\": {\"query\": \"can('change_governance', 'did:example:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6').\"}}" ``` ## Break @@ -68,6 +67,5 @@ By breaking the stone, you will not be able to query it anymore. okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ '"break_stone"' ``` diff --git a/contracts/okp4-law-stone/examples/multiple-sources/gov.pl b/contracts/okp4-law-stone/examples/multiple-sources/gov.pl index b760aa1c..b654fb5b 100644 --- a/contracts/okp4-law-stone/examples/multiple-sources/gov.pl +++ b/contracts/okp4-law-stone/examples/multiple-sources/gov.pl @@ -1,9 +1,9 @@ -:- consult('cosmwasm:okp4-objectarium:${STORAGE_ADDRESS}?query=%7B%22object_data%22%3A%7B%22id%22%3A%221a88ca1632c7323c0aa594000cda26ed9f48b36351c29c3d1e35e0a0474e862e%22%7D%7D'). +:- consult('cosmwasm:okp4-objectarium:${STORAGE_ADDRESS}?query=%7B%22object_data%22%3A%7B%22id%22%3A%22b118d79b4a368028b34d564448e5f1082e098613434370f3c15d6a2bf9979dfc%22%7D%7D'). admin_addr('okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6'). allow_denom('uknow'). -allow_did_method('key'). +allow_did_method('example'). allow_addr(Addr) :- bech32_address(-('okp4', _), Addr). min_exec_workflow_amount(1000000). diff --git a/contracts/okp4-law-stone/examples/multiple-sources/template.pl b/contracts/okp4-law-stone/examples/multiple-sources/template.pl index 33c1a6e3..6becce5a 100644 --- a/contracts/okp4-law-stone/examples/multiple-sources/template.pl +++ b/contracts/okp4-law-stone/examples/multiple-sources/template.pl @@ -1,5 +1,5 @@ valid_did(DID, Addr) :- - did_components(DID, did(Method, Addr, _, _, _)), + did_components(DID, did_components(Method, Addr, _, _, _)), allow_did_method(Method), allow_addr(Addr). diff --git a/contracts/okp4-law-stone/examples/single-source/README.md b/contracts/okp4-law-stone/examples/single-source/README.md index 4f626b24..cf36b0de 100644 --- a/contracts/okp4-law-stone/examples/single-source/README.md +++ b/contracts/okp4-law-stone/examples/single-source/README.md @@ -8,9 +8,9 @@ The spirit here is to provide a `okp4-law-stone` smart contract instance providi You'll find in the [gov.pl](gov.pl) Prolog program some predicates defining the rules allowing to perform some typical Dataspaces actions. -The `can(Action, DID)` predicate will allow or not an action for a `did` (i.e. Decentralized Identifier), a `did` being expected to have the form: `did:key:${OKP4_ADDRESS}`. We can describe the action rules as follows: +The `can(Action, DID)` predicate will allow or not an action for a `did` (i.e. Decentralized Identifier), a `did` being expected to have the form: `did:example:${OKP4_ADDRESS}`. We can describe the action rules as follows: -- `change_governance`: Only the did admin can do it: `did:key:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6`; +- `change_governance`: Only the did admin can do it: `did:example:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6`; - `exec_workflow`: Only a valid DID having a minimum spendable of `1000000uknow`; - `create_dataset` Only a valid DID having a minimum spendable of `10000uknow`; - `create_service` Only a valid DID having a minimum spendable of `100000uknow`; @@ -25,7 +25,6 @@ okp4d tx wasm instantiate $CODE_ID \ --from $ADDR \ --admin $ADMIN_ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"program\":\"$(cat gov.pl | base64)\", \"storage_address\": \"$STORAGE_ADDR\"}" ``` @@ -37,7 +36,7 @@ By using the `Ask` query we can provide Prolog predicates to be evaluated agains ```bash okp4d query wasm contract-state smart $CONTRACT_ADDR \ - "{\"ask\": {\"query\": \"can('change_governance', 'did:key:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6').\"}}" + "{\"ask\": {\"query\": \"can('change_governance', 'did:example:okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6').\"}}" ``` ## Break @@ -52,6 +51,5 @@ By breaking the stone, you will not be able to query it anymore. okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ '"break_stone"' ``` diff --git a/contracts/okp4-law-stone/examples/single-source/gov.pl b/contracts/okp4-law-stone/examples/single-source/gov.pl index bdf9d2d7..94f93d44 100644 --- a/contracts/okp4-law-stone/examples/single-source/gov.pl +++ b/contracts/okp4-law-stone/examples/single-source/gov.pl @@ -1,11 +1,11 @@ admin_addr('okp41p8u47en82gmzfm259y6z93r9qe63l25dfwwng6'). allow_denom('uknow'). -allow_did_method('key'). +allow_did_method('example'). allow_addr(Addr) :- bech32_address(-('okp4', _), Addr). valid_did(DID, Addr) :- - did_components(DID, did(Method, Addr, _, _, _)), + did_components(DID, did_components(Method, Addr, _, _, _)), allow_did_method(Method), allow_addr(Addr). diff --git a/contracts/okp4-objectarium/README.md b/contracts/okp4-objectarium/README.md index 7fcda1f1..040c3b25 100644 --- a/contracts/okp4-objectarium/README.md +++ b/contracts/okp4-objectarium/README.md @@ -63,7 +63,6 @@ okp4d tx wasm instantiate $CODE_ID \ --from $ADDR \ --admin $ADMIN_ADDR \ --gas 1000000 \ - --broadcast-mode block \ '{"bucket":"my-bucket"}' ``` @@ -75,7 +74,6 @@ We can store an object by providing its data in base64 encoded, we can pin the s okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"store_object\":{\"data\": \"$(cat my-data | base64)\",\"pin\":true}}" ``` @@ -87,13 +85,11 @@ With the following commands we can pin and unpin existing objects: okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"pin_object\":{\"id\": \"$OBJECT_ID\"}}" okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"unpin_object\":{\"id\": \"$OBJECT_ID\"}}" ``` @@ -103,7 +99,6 @@ And if an object is not pinned, or pinned by the sender of transaction, we can r okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"forget_object\":{\"id\": \"$OBJECT_ID\"}}" ``` diff --git a/docs/okp4-law-stone.md b/docs/okp4-law-stone.md index fbc715a4..5ba60f43 100644 --- a/docs/okp4-law-stone.md +++ b/docs/okp4-law-stone.md @@ -99,6 +99,7 @@ This is only needed as serde-json-\{core,wasm\} has a horrible encoding for Vec& | property | description | | ----------- | -------------------------------------------------- | +| `error` | **string\|null**. | | `has_more` | _(Required.) _ **boolean**. | | `results` | _(Required.) _ **Array<[Result](#result)>**. | | `success` | _(Required.) _ **boolean**. | @@ -120,18 +121,11 @@ A string containing Base64-encoded data. ### Substitution -| property | description | -| ---------- | -------------------------- | -| `term` | _(Required.) _ **object**. | -| `variable` | _(Required.) _ **string**. | - -### Term - -| property | description | -| ----------- | ---------------------------------------------- | -| `arguments` | _(Required.) _ **Array<[Term](#term)>**. | -| `name` | _(Required.) _ **string**. | +| property | description | +| ------------ | -------------------------- | +| `expression` | _(Required.) _ **string**. | +| `variable` | _(Required.) _ **string**. | --- -_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-law-stone.json` (`175af2aa8dc69420`)_ +_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-law-stone.json` (`b4af0e49e5a861ed`)_ diff --git a/docs/okp4-objectarium.md b/docs/okp4-objectarium.md index 51fd29b6..cea0f103 100644 --- a/docs/okp4-objectarium.md +++ b/docs/okp4-objectarium.md @@ -63,7 +63,6 @@ okp4d tx wasm instantiate $CODE_ID \ --from $ADDR \ --admin $ADMIN_ADDR \ --gas 1000000 \ - --broadcast-mode block \ '{"bucket":"my-bucket"}' ``` @@ -75,7 +74,6 @@ We can store an object by providing its data in base64 encoded, we can pin the s okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"store_object\":{\"data\": \"$(cat my-data | base64)\",\"pin\":true}}" ``` @@ -87,13 +85,11 @@ With the following commands we can pin and unpin existing objects: okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"pin_object\":{\"id\": \"$OBJECT_ID\"}}" okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"unpin_object\":{\"id\": \"$OBJECT_ID\"}}" ``` @@ -103,7 +99,6 @@ And if an object is not pinned, or pinned by the sender of transaction, we can r okp4d tx wasm execute $CONTRACT_ADDR \ --from $ADDR \ --gas 1000000 \ - --broadcast-mode block \ "{\"forget_object\":{\"id\": \"$OBJECT_ID\"}}" ``` @@ -516,4 +511,4 @@ A string containing a 128-bit integer in decimal representation. --- -_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-objectarium.json` (`2b01e2531b94fc0e`)_ +_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-objectarium.json` (`37a6830a8446a597`)_