Skip to content

Commit

Permalink
AUTO: Sync ScalarDL docs in English to docs site repo (#684)
Browse files Browse the repository at this point in the history
Co-authored-by: josh-wong <[email protected]>
  • Loading branch information
github-actions[bot] and josh-wong authored Feb 4, 2025
1 parent 898031d commit fcf5c18
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions docs/use-generic-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ You should get the following hash value:
You can put the hash value by running the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Put \
--contract-argument '{"object_id": "a.txt", "hash_value": "5c7440fb2273a247f78aadefbc511c680a84e7d44004abfaedef2b145151dab0", "metadata": {"note": "created"}}'
```
Expand All @@ -154,15 +154,15 @@ b97a42c87a46ffebe1439f8c1cd2f86e2f9b84dad89c8e9ebb257a19b6fdfe1c a.txt
You can then update the hash value as follows:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Put \
--contract-argument '{"object_id": "a.txt", "hash_value": "b97a42c87a46ffebe1439f8c1cd2f86e2f9b84dad89c8e9ebb257a19b6fdfe1c", "metadata": {"note": "updated"}}'
```

You can also get the latest status of the object with the [`object.Get` contract](generic-contracts-reference.mdx#objectget-contract) by running the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Get \
--contract-argument '{"object_id": "a.txt"}'
```
Expand Down Expand Up @@ -191,7 +191,7 @@ If you cannot get an older version in your file system, you can specify the hash
:::

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Validate \
--contract-argument \
'{"object_id": "a.txt", "versions": [{"version_id": "v2", "hash_value": "b97a42c87a46ffebe1439f8c1cd2f86e2f9b84dad89c8e9ebb257a19b6fdfe1c"}, {"version_id": "v1", "hash_value": "5c7440fb2273a247f78aadefbc511c680a84e7d44004abfaedef2b145151dab0"}]}'
Expand All @@ -217,7 +217,7 @@ Alice updated this file
Now the hash value of the latest version is `1f75d715648a3b4b3a33ecd7428a3e7139d9357da7d38735c23bf38618ecf9c7`. You can execute validation by running the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Validate \
--contract-argument \
'{"object_id": "a.txt", "versions": [{"version_id": "v2", "hash_value": "1f75d715648a3b4b3a33ecd7428a3e7139d9357da7d38735c23bf38618ecf9c7"}, {"version_id": "v1", "hash_value": "5c7440fb2273a247f78aadefbc511c680a84e7d44004abfaedef2b145151dab0"}]}'
Expand Down Expand Up @@ -248,7 +248,7 @@ Think about a situation where you would like to store hash values of updated obj
The third step above can be done in an ACID manner by executing the following command for the [`object.Put` contract](generic-contracts-reference.mdx#objectput-contract) with the [`object.PutToMutableDatabase` function](generic-contracts-reference.mdx#objectputtomutabledatabase-function):

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id object.Put \
--contract-argument '{"object_id": "a.txt", "hash_value": "5c7440fb2273a247f78aadefbc511c680a84e7d44004abfaedef2b145151dab0"}' \
--function-id object.PutToMutableDatabase \
Expand Down Expand Up @@ -283,7 +283,7 @@ As an example of collection authenticity management, think about managing an aud
To create a collection for an audit set, use the [`collection.Create` contract](generic-contracts-reference.mdx#collectioncreate-contract) by running the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id collection.Create \
--contract-argument '{"collection_id":"audit_set", "object_ids": ["a.txt", "b.txt"]}'
```
Expand All @@ -293,18 +293,20 @@ The collection ID must be a unique ID that identifies the collection. You can sp
You can also add and remove objects to or from the collection by using the [`collection.Add` contract](generic-contracts-reference.mdx#collectionadd-contract) and the [`collection.Remove` contract](generic-contracts-reference.mdx#collectionremove-contract). To do this, run the following commands:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id collection.Add \
--contract-argument '{"collection_id":"audit_set", "object_ids": ["c.txt", "d.txt"]}'
scalardl execute-contract --properties client.properties \
```
```console
client/bin/scalardl execute-contract --properties client.properties \
--contract-id collection.Remove \
--contract-argument '{"collection_id":"audit_set", "object_ids": ["a.txt"]}'
```

You can get the latest status of the collection by using the [`collection.Get` contract](generic-contracts-reference.mdx#collectionget-contract). To do this, run the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id collection.Get \
--contract-argument '{"collection_id":"audit_set"}'
```
Expand All @@ -319,7 +321,7 @@ Contract result:
To confirm that the audit set has not been changed unexpectedly, you can check the update history of the audit set by using the [`collection.GetHistory` contract](generic-contracts-reference.mdx#collectiongethistory-contract). To do this, run the following command:

```console
scalardl execute-contract --properties client.properties \
client/bin/scalardl execute-contract --properties client.properties \
--contract-id collection.GetHistory \
--contract-argument '{"collection_id":"audit_set"}'
```
Expand Down

0 comments on commit fcf5c18

Please sign in to comment.