From 34bab1d487e31b13c04e01eaa0da995721964439 Mon Sep 17 00:00:00 2001 From: Chloe Cai <93294344+rollerchloe@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:53:40 +0800 Subject: [PATCH 1/6] docs: edit oa-cli readme to update a remote file --- README.md | 740 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 532 insertions(+), 208 deletions(-) diff --git a/README.md b/README.md index 49b794b8..19bef0ec 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,69 @@ -# Open Attestation (CLI) +# OpenAttestation (CLI) -This CLI tool in the [Open Attestation CLI](https://github.com/Open-Attestation/open-attestation-cli) repository turns .json documents into any open-attestation verifiable documents. It applies the OpenAttestation algorithm to produce a hash of the json document and then creates a file with the data and proof of integrity. +This command line interface tool in the [OpenAttestation CLI](https://github.com/Open-Attestation/open-attestation-cli) repository turns `.json` documents into OpenAttestation verifiable documents. It applies OpenAttestation algorithm to produce a hash of the `.json` document, and then creates a file with the data and proof of integrity. ## Installation +There are three ways to install the CLI, including binary, NPM, and NPX. + ### Binary -To install the binary, simply download the binary from the [CLI release page](https://github.com/Open-Attestation/open-attestation-cli/releases) for your OS. +To install the binary on your operating system, download the corresponding file from the [CLI release page](https://github.com/Open-Attestation/open-attestation-cli/releases). -> We are aware that the size of the binaries must be reduced and we have tracked the issue in [Github](https://github.com/Open-Attestation/open-attestation-cli/issues/68). We hope to find a solution in a near future and any help is welcomed. +>**Note:** There is an existing issue that the size of the binaries must be reduced, which is tracked in GitHub. If you want to contribute your feedback to resolve it, see [this issue here](https://github.com/Open-Attestation/open-attestation-cli/issues/68). ### NPM -Alternatively for Linux or MacOS users, if you have `npm` installed on your machine, you may install the cli using the following command: +If you are a Linux or MacOS user with `npm` installed on your machine, you can also install the CLI using the following command: ```bash npm install -g @govtechsg/open-attestation-cli ``` -The above command will install the open-attestation CLI to your machine. You will need to have node.js installed to be able to run the command. +The above command will install the open-attestation CLI to your machine. Be sure to have `node.js` installed, so that you can run the command. -You can also opt to use npx: +### NPX +You can also opt to use `npx` for the installation: ```bash npx -p @govtechsg/open-attestation-cli open-attestation ``` -> In all the guides, we will refer to the CLI as `open-attestation` when running a command. That means we will assume the CLI is available in your execution path. If it's not the case, you will to change `open-attestation` by the full path to the executable. +No matter which way you choose, once the installation process is complete, a configuration folder will be created in the `~/.config/open-attestation/` folder. -> A configuration folder will be created in the `~/.config/open-attestation/` +>**Important:** On this website, the CLI is referred to as `open-attestation` when you run a command. The assumption is the CLI is available in your execution path. If not, you must change `open-attestation` to reflect the full path to the executable. --- ## Supported networks -| Network | Chain ID | Type | -| ------------------ | -------- | ---------- | -| mainnet | 1 | Production | -| sepolia | 11155111 | Test | -| polygon | 137 | Production | -| mumbai | 80001 | Test | -| xdc | 50 | Production | -| xdcapothem | 51 | Test | +| Network ID | Name | Network | Type | +| ---------- | ------------------------ | ------------ | ---------- | +| `1` | Ethereum Mainnet | `mainnet` | Production | +| `11155111` | Ethereum Testnet Sepolia | `sepolia` | Test | +| `137` | Polygon Mainnet | `polygon` | Production | +| `80001` | Polygon Testnet Mumbai | `mumbai` | Test | +| `50` | XDC Network | `xdc` | Production | +| `51` | XDC Apothem Network | `xdcapothem` | Test | + --- ## Usage -### Network Fees +### Network fees -For information on how network fees work, please refer to the ethereum documentation: [https://ethereum.org/en/developers/docs/gas/](https://ethereum.org/en/developers/docs/gas/) +For more information on network fees, see the [ ethereum documentation](https://ethereum.org/en/developers/docs/gas/). #### Adjusting preset gas price -To adjust transaction gas price, use the variable of `priority` to scale against the market price. +To adjust transaction gas price, use the `priority` variable to scale against the market price. -Calculation: -priority \* previous block priority fee +>**Calculation:** Priority \* Previous block priority fee = Priority fee to use -Example: +The table below shows some examples: -| Priority | Previous block priority fee | Priority Fee to use | +| Priority | Previous block priority fee | Priority fee to use | | -------- | --------------------------- | ------------------- | | 1 | 1 | 1 \* 1 = 1 | | 1.2 | 1 | 1.2 \* 1 = 1.2 | @@ -69,15 +72,19 @@ Example: | 1.2 | 10 | 1.2 \* 10 = 12 | | 2 | 10 | 2 \* 10 = 20 | -#### Fee Information +#### Fee information -To display an estimated price of a transaction use the option of `dry-run` on your command. +To display an estimated price of a transaction, use the `--dry-run` option in your command. -Example: +The following shows a command example: ```bash open-attestation deploy document-store "My Name" --network sepolia --dry-run +``` + +The response looks like: +```bash /!\ Welcome to the fee table. Please read the information below to understand the transaction fee The table below display information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you better help you to choose a gas price depending on your needs: @@ -106,397 +113,589 @@ Please read the information above to understand the table #### List of features with the required options +The following is a feature list and the options each feature requires. + | | Private Key | Wallet | Aws Kms | | -------------------------------------------------------------------------- | ----------- | ------ | ------- | -| [Create config](#config-create-configuration-file) | ❎ | ✔️ | ❎ | -| [Deploy document store](#deploy-new-document-store) | ✔ | ✔ | ✔ | -| [Deploy token registry](#deploy-new-token-registry) | ✔ | ✔ | ✔ | -| [Dns txt create](#dns-txt-record) | ❎ | ❎ | ❎ | -| [Dns txt get](#dns-txt-record) | ❎ | ❎ | ❎ | -| [Document store issue](#issue-document-to-document-store) | ✔ | ✔ | ✔ | -| [Document store revoke](#revoke-document-in-document-store) | ✔ | ✔ | ✔ | -| [Document store grant ownership](#grant-role-on-document-store) | ✔ | ✔ | ✔ | -| [Document store revoke ownership](#revoke-role-on-document-store) | ✔ | ✔ | ✔ | -| [Document store transfer ownership](#transfer-ownership-of-document-store) | ✔ | ✔ | ✔ | -| [Token registry issue](#issue-document-to-token-registry) | ✔ | ✔ | ✔ | -| [Token registry mint](#issue-document-to-token-registry) | ✔ | ✔ | ✔ | -| [Transaction cancel](#cancel-pending-transaction) | ✔ | ✔ | ✔ | -| [Wallet create](#wallet) | ❎ | ❎ | ❎ | -| [Wallet decrypt](#wallet) | ❎ | ❎ | ❎ | -| [Wallet encrypt](#wallet) | ✔ | ❎ | ❎ | +| [Create config](#creating-the-configuration-file) | ❎ | ✔️ | ❎ | +| [Deploy document store](#deploying-a-new-document-store) | ✔ | ✔ | ✔ | +| [Deploy token registry](#deploying-a-new-token-registry) | ✔ | ✔ | ✔ | +| [Dns txt create](#creating-a-temporary-dns-txt-record) | ❎ | ❎ | ❎ | +| [Dns txt get](#getting-the-dns-txt-record-list) | ❎ | ❎ | ❎ | +| [Document store issue](#issuing-a-document-to-document-store) | ✔ | ✔ | ✔ | +| [Document store revoke](#revoking-a-document-on-document-store) | ✔ | ✔ | ✔ | +| [Document store grant ownership](#granting-a-role-on-document-store) | ✔ | ✔ | ✔ | +| [Document store revoke ownership](#revoking-a-role-on-document-store) | ✔ | ✔ | ✔ | +| [Document store transfer ownership](#transferring-the-ownership-of-document-store) | ✔ | ✔ | ✔ | +| [Token registry issue](#issuing-a-document-to-token-registry) | ✔ | ✔ | ✔ | +| [Token registry mint](#issuing-a-document-to-token-registry) | ✔ | ✔ | ✔ | +| [Transaction cancel](#canceling-a-pending-transaction) | ✔ | ✔ | ✔ | +| [Wallet create](#creating-a-wallet) | ❎ | ❎ | ❎ | +| [Wallet decrypt](#decrypting-a-wallet) | ❎ | ❎ | ❎ | +| [Wallet encrypt](#encrypting-a-wallet) | ✔ | ❎ | ❎ | | [Filter (obfuscate) document](#document-privacy-filter) | ❎ | ❎ | ❎ | | [Sign document](#did-direct-signing) | ✔ | ❎ | ❎ | -| [Encrypt document](#encrypting-document) | ❎ | ❎ | ❎ | -| [Decrypt document](#decrypting-document) | ❎ | ❎ | ❎ | +| [Encrypt document](#encrypting-a-document) | ❎ | ❎ | ❎ | +| [Decrypt document](#decrypting-a-document) | ❎ | ❎ | ❎ | | [Wrap document](#wrapping-documents) | ❎ | ❎ | ❎ | | [Unwrap document](#unwrapping-documents) | ❎ | ❎ | ❎ | -| [Verify document](#verify) | ❎ | ❎ | ❎ | -| [Change holder (Title Escrow)](#change-holder) | ✔ | ✔ | ✔ | -| [Nominate change of owner (Title Escrow)](#nominate-change-of-owner) | ✔ | ✔ | ✔ | -| [Endorse transfer to owner (Title Escrow)](#endorse-transfer-of-owner) | ✔ | ✔ | ✔ | -| [Endorse change of owner (Title Escrow)](#endorse-change-of-owner) | ✔ | ✔ | ✔ | -| [Surrender document (Title Escrow)](#surrender-document) | ✔ | ✔ | ✔ | -| [Reject surrendered document (Title Escrow)](#reject-surrendered-document) | ✔ | ✔ | ✔ | -| [Accept surrendered document (Title Escrow)](#accept-surrendered-document) | ✔ | ✔ | ✔ | +| [Verify document](#verifying-a-document) | ❎ | ❎ | ❎ | +| [Change holder (Title Escrow)](#changing-the-holder) | ✔ | ✔ | ✔ | +| [Nominate change of owner (Title Escrow)](#nominating-the-change-of-owner) | ✔ | ✔ | ✔ | +| [Endorse transfer to owner (Title Escrow)](#endorsing-the-transfer-to-owner) | ✔ | ✔ | ✔ | +| [Endorse change of owner (Title Escrow)](#endorsing-the-change-of-owner) | ✔ | ✔ | ✔ | +| [Surrender document (Title Escrow)](#surrendering-a-document) | ✔ | ✔ | ✔ | +| [Reject surrendered document (Title Escrow)](#rejecting-a-surrendered-document) | ✔ | ✔ | ✔ | +| [Accept surrendered document (Title Escrow)](#accepting-a-surrendered-document) | ✔ | ✔ | ✔ | ### Wrapping documents -This command process all documents in the input directory. It will add the issuance proofs to the individual documents. Additionally, you'll get the Batch Document Root (merkleRoot) value. Thereafter, you can issue all the documents in a single batch with the merkleRoot later. +The `wrap` command processes all documents in the input directory. It will add the issuance proofs to the individual documents. Additionally, you'll get the Batch Document Root (`merkleRoot`) value. Thereafter, you can issue all the documents in a single batch with the `merkleRoot` later. -Example: +The following shows a command example: ```bash open-attestation wrap ./examples/raw-documents/example.0.json +``` +The response looks like: +``` ✔ success Batch Document Root: 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc ``` +#### Specifying the output file while wrapping documents -The command will display the result in the console. If you need to save the file you can use the `--output-file` file. +The `wrap` command will display the result in the console. If you need to save the file, use the `--output-file` option in your command. -Example: +The following shows a command example with the `--output-file` option: ```bash open-attestation wrap ./examples/raw-documents/example.0.json --output-file ./examples/wrapped-documents/example.0.json +``` +The response looks like: +``` ✔ success Batch Document Root: 0x5d318c8083aac18f8075ca2a2eac74b06f2cc37d6ccad680c7c80c9bb36f7be1 ``` +#### Specifying the output directory while wrapping documents -If you need to wrap a folder you will need to provide the `--output-dir` options to specify in which folder the documents must be wrapped in. +If you need to wrap a folder, use the `--output-dir` option to specify in which folder all the documents will be wrapped. -Example: +The following shows a command example with the `--output-dir` option: ```bash open-attestation wrap ./examples/raw-documents --output-dir ./examples/wrapped-documents +``` +The response looks like: +``` ✔ success Batch Document Root: 0x5d318c8083aac18f8075ca2a2eac74b06f2cc37d6ccad680c7c80c9bb36f7be1 ``` -You can also provide an optional JSON schema document to perform extra check on the documents +#### Providing an optional JSON schema while wrapping documents +You can also provide an optional JSON schema document using the `--schema` option to perform an extra check on the documents. -Example: +The following shows a command example with the `--schema` option: ```bash open-attestation wrap ./examples/raw-documents/ --output-dir ./examples/wrapped-documents/ --schema ./examples/schema.json +``` + +The response looks like: +``` ✔ success Batch Document Root: 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc +``` + +##### Short form of the `--schema` option + +Alternatively, you can use `-s` in the command, which is the short form of `--schema`. +```bash open-attestation wrap ./examples/raw-documents/ ./examples/wrapped-documents/ -s ./examples/schema.json +``` +The response looks like: +``` ✔ success Batch Document Root: 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc ``` -The JSON schema parameter also allow for http endpoint returning valid JSON schema: +##### HTTP endpoint in the `--schema` option -Example: +The `schema` parameter also allows an HTTP endpoint to return valid JSON schema: + +The following shows a command example containing an HTTP endpoint: ```bash open-attestation wrap ./examples/raw-documents/ --output-dir ./examples/wrapped-documents/ --schema https://gist.githubusercontent.com/Nebulis/dd8198ab76443489e14121dad225d351/raw/693b50a1694942fb3cc6a8dcf5187cc7c75adb58/schema.json +``` +The response looks like: +``` ✔ success Batch Document Root: 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc +``` +##### HTTP endpoint in the short form `-s` + +Similarly, you can also use the short form `-s` to replace the `--schema` option in the command: +```bash open-attestation wrap ./examples/raw-documents/ --output-dir ./examples/wrapped-documents/ -s https://gist.githubusercontent.com/Nebulis/dd8198ab76443489e14121dad225d351/raw/693b50a1694942fb3cc6a8dcf5187cc7c75adb58/schema.json +``` +The response looks like: +``` ✔ success Batch Document Root: 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc ``` +#### Editing a wrapped document -You can also re-wrap a document by editing a wrapped document content and using the `--unwrap` option: +You can also re-wrap a document through editing the wrapped document content and using the `--unwrap` option. -```bash -open-attestation wrap ./examples/raw-documents/example.0.json --output-file ./examples/wrapped-documents/example.0.json +1. Run the command below to wrap a raw document: -# edit the recipient name in ./tmp/wrapped-documents/example.0.json for instance for Your Name to Another Name -open-attestation wrap ./examples/wrapped-documents/example.0.json --of ./examples/wrapped-documents/example.1.json --unwrap -``` + ```bash + open-attestation wrap ./examples/raw-documents/example.0.json --output-file ./examples/wrapped-documents/example.0.json + ``` +2. After the first round of wrapping, edit the content in the wrapped document. For example, change your name to another name in `example.0.json`. + +3. To re-wrap the document after editing, run the command below with the `--unwrap` option: + + ```bash + open-attestation wrap ./examples/wrapped-documents/example.0.json --of ./examples/wrapped-documents/example.1.json --unwrap + ``` -You can disable the `--batched` option to wrap multiple documents individually (i.e. they will not have the same merkle root): +#### Wrapping documents individually + +You can disable the `--batched` option to wrap multiple documents individually. Consequently, these documents will not have the same merkle root. + +The following shows a command example with the `--batched` option disabled: ```bash open-attestation wrap ./examples/raw-documents/ --output-dir ./examples/wrapped-documents/ --batched false +``` +The response looks like: + +``` ✔ success All documents have been individually wrapped ``` -By default the CLI will use open-attestation schema v2 but you can opt in for open-attestation schema v3 using `open-attestation-v3` option: +#### Changing the OpenAttestation CLI version + +By default, the CLI will use OpenAttestation schema V2, but you can opt in for OpenAttestation schema V3 using the `--open-attestation-v3` option: ```bash open-attestation wrap ./examples/raw-documents/ ./examples/wrapped-documents/ --open-attestation-v3 +``` +Alternatively, you can use the short form `--oav3` to replace `--open-attestation-v3` in the command: + +```bash open-attestation wrap ./examples/raw-documents/ ./examples/wrapped-documents/ --oav3 ``` -> **_NOTE:_** For transferable records, you should wrap them individually as each of them would be minted to a unique title escrow that represents the beneficiary and holder entities of the document. For more information about title escrow, refer [here](https://www.openattestation.com/docs/integrator-section/transferable-record/title-escrow). +>**Note:** You should wrap Transferable Records individually, as each of them will be minted to a unique title escrow that represents the document's beneficiary and holder entities. For more information about title escrow, see [here](https://www.openattestation.com/docs/integrator-section/transferable-record/overview). ### Unwrapping documents -This command processes a document in the input directory. It will unwrap the wrapped document to its raw document form to be displayed on the console. +The `unwrap` command processes a document in the input directory. It will unwrap the document that has been wrapped to its raw document form, and display it in the console. -Example: +The following shows a command example of `unwrap`: ```bash open-attestation unwrap ./examples/v2/wrapped-documents/example.0.json +``` +The response looks like: +``` ✔ success The document has been unwrapped ``` -The command will display the result in the console. If you need to save the file you can use the `--output-file` option. +#### Specifying the output file while unwrapping documents + +The `unwrap` command will display the result in the console. If you need to save the file, use the `--output-file` option. -Example: +The following shows a command example with the `--output-file` option: ```bash open-attestation unwrap ./examples/v2/wrapped-documents/example.0.json --output-file ./examples/v2/raw-documents/example.0.json +``` +The response looks like: +``` ✔ success The document has been unwrapped ``` -If you need to unwrap a folder you will need to provide the `--output-dir` option to specify which folder the documents must be unwrapped in. +#### Specifying the output directory while unwrapping documents + +If you need to unwrap a folder, use the `--output-dir` option to specify in which folder all the documents will be unwrapped. -Example: +The following shows a command example with the `--output-dir` option: ```bash open-attestation unwrap ./examples/v2/wrapped-documents --output-dir ./examples/v2/raw-documents +``` +The response looks like: +``` ✔ success The documents have been individually unwrapped into folder ./examples/v2/raw-documents ``` ### Document privacy filter -This allows document holders to generate valid documents which obfuscates certain fields. For example, sensitive information that you wish not to disclose. +The `filter` command lets the document holders generate valid documents and obfuscates certain fields, such as those fields containing sensitive information that you prefer not to disclose. + +The following shows the syntax of the `filter` command: ```bash open-attestation filter [filters...] ``` -Example: +The following is a command example: ```bash open-attestation filter examples/wrapped-documents/example.0.json tmp/example.0.out.json key1 +``` +The response looks like: +``` ✔ success Obfuscated document saved to: tmp/example.0.out.json ``` -### Encrypting document +### Encrypting a document + +The `encrypt` command helps you encrypt the documents, so that you can share and store them safely. -This allows you to encrypt document in order to share and store them safely. +The following shows the syntax of the `encrypt` command: ```bash open-attestation encrypt ``` -Example: +The following is a command example: ```bash open-attestation encrypt ./examples/wrapped-documents/example.0.json ./tmp/encrypted.json +``` +The response looks like: +``` ✔ success Encrypted document saved to: tmp/encrypted.json ⚠ warning Here is the key to decrypt the document: don't lose it: 9bac5be27bac31d852fc1e48eb9d5249ec6ad7978da23377b5879f7a24994cb2 ``` -### Decrypting document +### Decrypting a document -This allows you to decrypt document encrypted using the method above. +The `decrypt` command lets you decrypt documents that were encrypted using the [encrypt](#encrypting-a-document) method. + +The following shows the syntax of the `decrypt` command: ```bash open-attestation decrypt ``` -Example: +The following is a command example: ```bash open-attestation decrypt ./src/__tests__/fixture/did-dns-encrypted.json decrypted.json 88da9b9cd61cfc1677ae7e79dba9b3aeba4b40c95f94c950759e76c6210b5402 +``` +The response looks like: +``` ✔ success Decrypted document saved to: decrypted.json ``` ### Token Registry -#### Deploy new Token Registry +#### Deploying a new Token Registry -Deploys a token registry contract on the blockchain. Factory Contract that have been deployed using token-registry can be used with the factory address flag. To deploy a standalone token registry, please refer to [Token-Registry](https://github.com/Open-Attestation/token-registry) deployment. +The `deploy token-registry` command deploys a token registry contract on the blockchain. You can use the `--factory-address` flag with the Factory Contract that were deployed using this command. + +To deploy a standalone token registry, refer to the [Token-Registry](https://github.com/Open-Attestation/token-registry) repository. + +The following shows the syntax of the `deploy token-registry` command: ```bash open-attestation deploy token-registry --factory-address [options] ``` +See more options [here](#providing-the-wallet). -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. ```bash open-attestation deploy token-registry "My Sample Token" MST --network sepolia +``` + +The response looks like: +``` ✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 ``` -#### Issue document to token registry +#### Issuing a document to token registry + +The `token-registry issue` command issues a hash to a token registry deployed on the blockchain. The `--tokenId` option indicates the document hash, and the `--to` option indicates the title escrow address to which the document is mapped. + + -`Issue` a hash to a token registry deployed on the blockchain. The `tokenId` option would be used to indicate the document hash, and the `to` option to indicate the title escrow address the document is mapped to. +The following shows the syntax of the `token-registry issue` command: ```bash open-attestation token-registry issue --network --address --tokenId --beneficiary --holder [options] ``` +>**Important:** In this command, you can use `mint` instead of `issue` and they will be strictly equivalent. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. ```bash open-attestation token-registry mint --network sepolia --address 0x6133f580aE903b8e79845340375cCfd78a45FF35 --tokenId 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c --to 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +``` +The response looks like: - +``` ✔ success Token with hash 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c has been issued on 0x6133f580aE903b8e79845340375cCfd78a45FF35 with the initial recipient being 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 ``` -`mint` can be used instead of issue and will be strictly equivalent. +#### Token Registry roles -#### Token Registry Roles - -Interfaces for the Assignment and Revocation of roles are available on the Token Registry repository. +The interfaces for the assignment and revocation of roles are available in [the Token Registry repository](https://github.com/Open-Attestation/token-registry). ### Document Store -#### Deploy new document store +#### Deploying a new document store + +The `deploy document-store` command deploys a document store contract on the blockchain. -Deploys a document store contract on the blockchain +The following shows the command syntax: ```bash open-attestation deploy document-store [options] ``` +See more options [here](#providing-the-wallet). -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. ```bash open-attestation deploy document-store "My Name" --network sepolia +``` +The response looks like: +``` ✔ success Document store deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 ``` +##### Specifying a different owner + +By default, the owner of the document store will be the deployer. You can specify a different owner using the `--owner` option. -By default, the owner of the document store will be the deployer. You can specify a different owner using the `--owner` option: +The following shows a command example: ```bash open-attestation deploy document-store "My Name" --owner 0x1234 --network sepolia ``` -#### Issue document to document store +#### Issuing a document to document store + +The `document-store issue` command issues a hash to a document store deployed on the blockchain. -Issue a hash to a document store deployed on the blockchain +The following shows the command syntax: ```bash open-attestation document-store issue --address --hash [options] ``` +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation document-store issue --network sepolia --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1 +``` +The response looks like: +``` ✔ success Document/Document Batch with hash 0x0c1a666aa55d17d26412bb57fbed96f40ec5a08e2f995a108faf45429ae3511f has been issued on 0x19f89607b52268D0A19543e48F790c65750869c6 ``` -#### Revoke document in document store +#### Revoking a document on document store -Revoke a hash to a document store deployed on the blockchain +The `document-store revoke` command revokes a hash to a document store deployed on the blockchain. + +The following shows the command syntax: ```bash open-attestation document-store revoke --address --hash [options] ``` -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. + ```bash open-attestation document-store revoke --network sepolia --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1 +``` +The response looks like: +``` ✔ success Document/Document Batch with hash 0x0c1a666aa55d17d26412bb57fbed96f40ec5a08e2f995a108faf45429ae3511f has been revoked on 0x19f89607b52268D0A19543e48F790c65750869c6 ``` -#### Grant role on document store +#### Granting a role on document store + +The `document-store grant-role` command grants a role on the document store deployed on the blockchain to a wallet. -Grant role on document store deployed on the blockchain to a wallet +The following shows the command syntax: ```bash open-attestation document-store grant-role --address --account --role [options] ``` -Roles options: "admin", "issuer", "revoker" +The `--role` option accepts the following values: + +- `admin` +- `issuer` +- `revoker` + +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation document-store grant-role --address 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 --new-owner 0xf81ea9d2c0133de728d28b8d7f186bed61079997 --role admin --network sepolia +``` +The response looks like: +``` ✔ success Document store 0x80732bF5CA47A85e599f3ac9572F602c249C8A28's role of: admin has been granted to wallet 0xf81ea9d2c0133de728d28b8d7f186bed61079997 ``` -#### Revoke role on document store +#### Revoking a role on document store -Revoke role on document store deployed on the blockchain to a wallet +The `document-store revoke-role` command revokes a role on the document store deployed on the blockchain to a wallet. -Roles options: "admin", "issuer", "revoker" +The following shows the command syntax: ```bash open-attestation document-store revoke-role --address --account --role [options] ``` -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +The `--role` option accepts the following values: + +- `admin` +- `issuer` +- `revoker` + +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. + ```bash open-attestation document-store revoke-role --address 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 --new-owner 0xf81ea9d2c0133de728d28b8d7f186bed61079997 --role admin --network sepolia +``` +The response looks like: + +``` ✔ success Document store 0x80732bF5CA47A85e599f3ac9572F602c249C8A28's role of: admin has been revoked from wallet 0xf81ea9d2c0133de728d28b8d7f186bed61079997 ``` -#### Transfer ownership of document store +#### Transferring the ownership of document store -Transfer ownership of a document store deployed on the blockchain to another wallet +The `document-store transfer-ownership` command transfers the ownership of a document store deployed on the blockchain to another wallet. + +The following shows the command syntax: ```bash open-attestation document-store transfer-ownership --address --new-owner [options] ``` +See more options [here](#providing-the-wallet). -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. ```bash open-attestation document-store transfer-ownership --address 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 --new-owner 0xf81ea9d2c0133de728d28b8d7f186bed61079997 --network sepolia +``` +The response looks like: +``` ✔ success Ownership of document store 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 has been transferred to new wallet 0xf81ea9d2c0133de728d28b8d7f186bed61079997 ``` -### Verify +### Verifying a document -Verify if a document is valid. +The `verify` command runs the verification to check if a document is valid. + +The following is a command example: ```bash open-attestation verify --document ./examples/wrapped-documents/example.0.json --network sepolia +``` +The response looks like: +``` … awaiting Verifying examples/wrapped-documents/example.0.json ✔ success The document is valid ``` -### DID Direct Signing +### DID direct signing -Sign on an OA document directly with a private key. +The `sign` command signs on an OA document directly with a private key. + +The following is a command example: ```bash open-attestation sign ./examples/unsigned-documents -f ./examples/sample-key -p did:ethr:0x6813Eb9362372EEF6200f3b1dbC3f819671cBA69#controller --output-dir ./examples/signed-documents ``` -### DNS TXT Record +### DNS TXT record + +You can create, retrieve, or filter DNS TXT records using the commands below. + +#### Creating a temporary DNS TXT record -Create a temporary DNS TXT record in OpenAttestation sandbox +The `dns text-record create` command creates a temporary DNS TXT record in the OpenAttestation sandbox. + +The following is a command example: ```bash open-attestation dns txt-record create --address 0xf51030c5751a646284c898cff0f9d833c64a50d6f307b61f2c96c3c838b13bfc --networkId 10 +``` +The response looks like: + +``` ✔ success Record created at exotic-blush-primate.sandbox.openattestation.com and will stay valid until Thu Jul 02 2020 13:51:34 GMT+0800 (Singapore Standard Time) ``` -Get the list of DNS TXT records associated to a domain +#### Getting the DNS TXT record list + +The `dns txt-record get` command gets the list of DNS TXT records associated to a domain. + +The following is a command example: ```bash open-attestation dns txt-record get --location resulting-magenta-locust.sandbox.openattestation.com +``` +The response looks like: + +``` ┌─────────┬────────────┬────────────┬───────┬──────────┬────────┐ │ (index) │ type │ net │ netId │ addr │ dnssec │ ├─────────┼────────────┼────────────┼───────┼──────────┼────────┤ │ 0 │ 'openatts' │ 'ethereum' │ '10' │ '0xabcd' │ false │ └─────────┴────────────┴────────────┴───────┴──────────┴────────┘ ``` +#### Filtering the DNS TXT record list -Filter the list of DNS TXT records associated to a domain on a specific network +You can use the `dns txt-record get` command with the `--networkId` option to filter the list of DNS TXT records associated to a domain on a specific network. + +The following is a command example: ```bash open-attestation dns txt-record get --location example.openattestation.com --networkId 3 +``` +The response looks like: + +``` ┌─────────┬────────────┬────────────┬───────┬──────────────────────────────────────────────┬────────┐ │ (index) │ type │ net │ netId │ addr │ dnssec │ ├─────────┼────────────┼────────────┼───────┼──────────────────────────────────────────────┼────────┤ @@ -510,11 +709,21 @@ open-attestation dns txt-record get --location example.openattestation.com --net ### Wallet -Creating a wallet +You can create, encrypt, decrypt, or provide a wallet using the commands below. + +#### Creating a wallet + +The `wallet create` command creates a new wallet. + +The following is a command example: ```bash open-attestation wallet create --of ./tmp +``` + +The response looks like: +``` ℹ info Creating a new wallet ? Wallet password [hidden] … awaiting Encrypting Wallet [====================] [100/100%] @@ -522,11 +731,21 @@ open-attestation wallet create --of ./tmp ✔ success Wallet successfully saved into /path/to/tmp ``` -Encrypting a wallet (see [below](#providing-the-wallet) to find out how to provide the key) +#### Encrypting a wallet + +The `wallet encrypt` command helps you encrypt a wallet. + +>**Note:** If you want to provide the wallet private key, see the ["Providing the wallet"](#providing-the-wallet) section. + +The following is a command example: ```bash open-attestation wallet encrypt --of ./tmp +``` + +The response looks like: +``` ℹ info Encrypting a wallet ? Wallet password [hidden] … awaiting Encrypting Wallet [====================] [100/100%] @@ -535,10 +754,21 @@ open-attestation wallet encrypt --of ./tmp ``` -Decrypt a wallet to get information about it. Some information might be sensitive +#### Decrypting a wallet + +The `wallet decrypt` command decrypts a wallet to get its information. + +>**Important:** Some information revealed by this command can be sensitive, e.g. the wallet private key. + +The following is a command example: ```bash open-attestation wallet decrypt wallet.json +``` + +The response looks like: + +``` ⚠ warning You are about to reveal the private key of your wallet. Please type the following word into the terminal to prove that you understand the risks: active-aqua-swordtail ? ack: active-aqua-swordtail ℹ info User consented to risks @@ -551,20 +781,28 @@ open-attestation wallet decrypt wallet.json - private key .... ``` -### Providing the wallet +#### Providing the wallet + +When interacting with blockchain, you may need to provide a way to access your wallet. When the wallet is required, all functions will provide multiples ways for you to provide the wallet information: + +1. It is recommended to use the `--encrypted-wallet-path` option where you provide a path to an [encrypted wallet](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt). -When interacting with blockchain you will likely need to provide a way to access your wallet. All functions - when the wallet is required - will provide multiples ways for you to pass it in: +1. Use the `OA_PRIVATE_KEY` environment variable to hold the private key. -1. Using `encrypted-wallet-path` option where you provide a path to an [encrypted wallet](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt) (recommended). -1. Using `OA_PRIVATE_KEY` environment variable holding the private key. -1. Using `--key-file` option where you provide a path to a file containing the private key. -1. Using `--key` option where you provide the private key directly to the command (**Note that in this case, the private key may be stored in the machine's bash history**). +1. Use the `--key-file` option where you provide a path to a file containing the private key. -Example: +1. Use the `--key` option where you provide the private key directly to the command. + +>**Important:** When you use the `--key` option, the private key may be stored in the machine's bash history. + +The following is a code example using the `--encrypted-wallet-path` option: ```bash -# Using encrypted-wallet-path option open-attestation deploy document-store "My Name" --network sepolia --encrypted-wallet-path /path/to/wallet.json +``` +The response looks like: + +```bash # Then you will be prompted to type your password to decrypt the wallet ? Wallet password [input is hidden] @@ -582,43 +820,52 @@ rm ./examples/sample-key open-attestation deploy document-store "My Name" --network sepolia --key 0000000000000000000000000000000000000000000000000000000000000003 ``` -### Config (Create configuration file) +### Creating the configuration file -This command will generate a config file with sandbox DNS, document store and token registry. +The `config create` command generates a configuration file named `config.json` with sandbox DNS, document store, and token registry. -> Please note that a wallet.json file with sufficient **funds** in the specified network must be provided in order for this command to work. +>**Note:** You need a `wallet.json` file with sufficient **funds** in the specified network for this command to work. -Command options to take note: +You can use the following options in this command: -- `--output-dir` option specify which folder the config file will be created in. +- `--output-dir` option specifies in which folder the configuration file will be created. - `--encrypted-wallet-path` option indicates a path to an [encrypted wallet](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt). - +- `--config-template-url` option provides a path to reference a configuration template file hosted on a public URL. To learn more, see [Method 1](#method-1-using-the-config-template-url-option-recommended). + +- `--config-template-path` option provides a path to reference a config template file locally. To learn more, see [Method 2](#method-2-using-the-config-template-path-option). -There are 2 ways of using this command to generate a config file, both in which, will return a new config file with sandbox DNS, updated document store and updated token registry. +There are two ways of using this command to generate a configuration file. Both ways will return a new configuration file with the sandbox DNS, updated document store, and updated token registry. -#### Method 1: Using config-template-url option (recommended) +#### Method 1: Using the `config-template-url` option (recommended) These are the reference config templates: -- [v2 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v2.json) -- [v3 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v3.json). +- [V2 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v2.json) +- [V3 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v3.json) -Step 1: Generate a wallet.json file & add funds into wallet.json +Step 1. Generate a `wallet.json` file and add funds into `wallet.json`. -``` -// If you already have a wallet.json that has sufficient funds in the specific network, you can skip step 1. +>**Note:** Skip Step 1 if you already have a `wallet.json` file with sufficient funds in the specified network. + +The following is a command example: + +```bash open-attestation wallet create --output-file wallet.json ``` -Currently, we do not provide any faucet to dispense any funds into the wallet.json. You can search the web for some faucets. +>**Note:** Currently, OpenAttestation does not provide any faucet to dispense funds into `wallet.json`. You can search online for some faucets. -Step 2: Generate config file by passing in the generated wallet.json file and a config template url +Step 2. Generate the configuration file by providing the `wallet.json` file you created and a URL to the configuration file template. + +The following is a command example: ``` open-attestation config create --output-dir ./example-configs --encrypted-wallet-path /wallet.json +``` +The response looks like the following, in which you need to provide certain information: +``` // Please fill in the necessary information when prompted. ℹ info Creating a new config file ? Wallet password [hidden] @@ -627,17 +874,30 @@ open-attestation config create --output-dir ./example-configs --encrypted-wallet ? Select Network sepolia ``` -#### Method 2: Using config-template-path option +#### Method 2: Using the `config-template-path` option -Step 1: Generate a wallet.json file & add funds into wallet.json +Step 1. Generate a `wallet.json` file and add funds into `wallet.json`. -This step is the same as [Method 1](#method-1-using-config-template-url-option-recommended). +>**Note:** Skip Step 1 if you already have a `wallet.json` file with sufficient funds in the specified network. -Step 2: Generate config file by passing in the generated wallet.json file and a existing config file +The following is a command example: +```bash +open-attestation wallet create --output-file wallet.json ``` + +>**Note:** Currently, OpenAttestation does not provide any faucet to dispense funds into `wallet.json`. You can search online for some faucets. + +Step 2. Generate the configuration file by providing the `wallet.json` file you created and an existing configuration file. + +The following is a command example: + +```bash open-attestation config create --output-dir ./example-configs --encrypted-wallet-path /wallet.json +``` +The response looks like the following, in which you need to provide certain information: +``` // Please fill in the necessary information when prompted. ℹ info Creating a new config file ? Wallet password [hidden] @@ -646,154 +906,216 @@ open-attestation config create --output-dir ./example-configs --encrypted-wallet ? Select Network sepolia ``` -### Cancel pending transaction +### Canceling a pending transaction -This command will cancel pending transaction. +The `transaction cancel` command cancels a pending transaction. -Please note that a this action is irreversible. +>**Important:** This action is irreversible. -You will need: +You need to use the following options: -- `--nonce` option specify which transaction to cancel. -- `--gas-price` option, the gas price is required to be higher than the pending transaction. -- `--transaction-hash` transaction hash option can be used as an alternative to nonce and gas-price option. Using this option will automatically increase the transaction gas price by 100%. -- options to provide the wallet (https://github.com/Open-Attestation/open-attestation-cli#providing-the-wallet) +- `--nonce` option specifies which transaction is to be canceled. -``` +- `--gas-price` option specifies the gas price, which is required to be higher than the pending transaction. + +- `--transaction-hash` option can be used as an alternative to the `--nonce` and `--gas-price` options. It will automatically increase the transaction gas price by 100%. + +- To learn more about the options for providing the wallet, see [this GitHub readme](https://github.com/Open-Attestation/open-attestation-cli#providing-the-wallet). + +The following is the command syntax: + +```bash open-attestation transaction cancel --nonce --gas-price [option] ``` -Examples: +The following shows a command example with the `--nonce` option: -``` +```bash open-attestation transaction cancel --nonce 1 --gas-price 300 --network sepolia --encrypted-wallet-path /path/to/wallet ``` +The following shows another example with the `--transaction-hash` option: -``` +```bash open-attestation transaction cancel --transaction-hash 0x000 --network sepolia --encrypted-wallet-path /path/to/wallet ``` -### Title Escrow +### Title escrow -#### Change Holder +#### Changing the holder -This command will allow the owner of a transferable record to change its holder. +The `title-escrow change-holder` command lets the owner of a transferable record change its holder. + +The following shows the command syntax: ```bash open-attestation title-escrow change-holder --token-registry --tokenId --newHolder [options] ``` -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. + ```bash open-attestation title-escrow change-holder --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --newHolder 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +``` +The response looks like: +``` ✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's holder has been successfully changed to holder with address: 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 ``` -#### Nominate Change of Owner +#### Nominating the change of owner + +The `title-escrow nominate-change-owner` command helps the owner of the transferable record nominate a new owner. + +>**Important:** This command will fail if you are not the owner of the transferable record. -This command will allow the owner of the transferable record to nominate a new owner of the transferable record. -**This command will fail if you are not the owner of the transferable record.** +The following shows the command syntax: ```bash open-attestation title-escrow nominate-change-owner --token-registry --tokenId --newOwner [options] ``` -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. + + +The following shows a command example: ```bash open-attestation title-escrow nominate-change-owner --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --newOwner 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +``` +The response looks like: +``` ✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's holder has been successfully nominated to new owner with address: 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 ``` -#### Endorse Transfer of Owner +#### Endorsing the transfer to owner + +The `title-escrow endorse-transfer-owner` command lets the transferable record holder endorse the transfer to an approved owner and holder. + +>**Important:** This command will fail if there is no approved owner or holder information on the transferable record. -This command will allow the holder of the transferable record to endorse the transfer to an approved owner and approved holder of the transferable record. -**This command will fail if there is no approved owner or holder record on the transferable record.** +The following is the command syntax: ```bash open-attestation title-escrow endorse-transfer-owner --token-registry --tokenId --newBeneficiary [options] ``` +See more options [here](#providing-the-wallet). -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. + + +The following shows a command example: ```bash open-attestation title-escrow endorse-transfer-owner --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --newBeneficiary 0x2f60375e8144e16Adf1979936301D8341D58C36C +``` +The response looks like: +``` ✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's holder has been successfully endorsed to approved beneficiary at 0x2f60375e8144e16Adf1979936301D8341D58C36C ``` -#### Endorse Change of Owner +#### Endorsing the change of owner -This command will allow the owner of the transferable record to endorse the change of owner to a new owner and new holder of the transferable record. -**This command will fail if the provided holder and owner's addresses are the same as the current owner and current holder's addresses.** +The `title-escrow endorse-change-owner` command helps the transferable record owner endorse the change to a new owner and holder. + +>**Important:** This command will fail if the new holder and owner's addresses you provide are the same as the current owner and holder's addresses. + +The following is the command syntax: ```bash open-attestation title-escrow endorse-change-owner --token-registry --tokenId --newOwner --newHolder [options] ``` +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation title-escrow endorse-change-owner --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --newOwner 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 --newHolder 0x2f60375e8144e16Adf1979936301D8341D58C36C - +``` +The response looks like: +``` ✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's holder has been successfully endorsed to new owner with address 0x2f60375e8144e16Adf1979936301D8341D58C36C and new holder with address: 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 ``` -#### Surrender Document +#### Surrendering a document -This command will allow the entity (who is both an owner and holder) to surrender it's transferable record to the token registry. +The `title-escrow surrender` command helps the entity (who is both an owner and a holder) surrender the transferable record to the token registry. + +The following is the command syntax: ```bash open-attestation title-escrow surrender --token-registry --tokenId [options] ``` +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia +``` +The response looks like: +``` ✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been surrendered. ``` -#### Reject Surrendered Document +#### Rejecting a surrendered document + +The `title-escrow reject-surrendered` command helps the token registry reject a surrendered transferable record. -This command will allow the token registry to reject a surrendered transferable record. +The following shows the command syntax: ```bash open-attestation title-escrow reject-surrendered --token-registry --tokenId [options] ``` +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia - +``` +The response looks like: +``` ✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been rejected. ``` -#### Accept Surrendered Document +#### Accepting a surrendered document + +The `title-escrow accept-surrendered` command lets the token registry accept a surrendered transferable record. -This command will allow the token registry to accept a surrendered transferable record. +The following shows the command syntax: ```bash open-attestation title-escrow accept-surrendered --token-registry --tokenId [options] ``` +See more options [here](#providing-the-wallet). + +The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. -Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet). ```bash open-attestation title-escrow accept-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia +``` +The response looks like: +``` ✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been accepted. ``` ## Help -Run the command with `--help` to get additional information +To get additional information, run each of the following commands with the `--help` option: ``` open-attestation deploy @@ -807,13 +1129,13 @@ open-attestation sign ## Development -To run on local +To start a development server on the local machine, run the command below: ``` npm run dev -- ``` -To run tests +To run tests for your projects, run the command below: ``` npm run test @@ -821,26 +1143,28 @@ npm run test ## Performance testing -To run performance testing for OA functionality +To run performance testing for OA functionality, follow the instructions below. ### Wrap -Monitor the response time for batched documents wrapping. +The `npm run benchmark` command helps you monitor the response time spent on wrapping a batch of documents. -The Default command will testing: 2 documents without base64 image in 1 iteration. +The default command (with no options) will test two documents without `base64` image in one iteration: ``` npm run benchmark ``` -The number of documents and iteration can be modified using these options. +The number of documents and iterations can be modified using these options below: -- First argument : Number of document for batched wrapping -- Second argument : Number of performance test iteration to achieve higher accuracy -- Third argument : File path for testing ( For window user, please encase the path in " " quotation marks ) +- First argument: The number of documents for batched wrapping +- Second argument: The number of performance test iterations to achieve higher accuracy +- Third argument: The file path for testing -Example: + >**Important:** For the Windows user, be sure to provide the file path in quotation marks "". -``` +The following is a command example, testing four documents in one iteration from the specified path: + +```bash npm run benchmark 4 1 performance-tests/unwrapped_document_wImage.json ``` From b009df4c51c3aa4e2a3d78344155ee38843416df Mon Sep 17 00:00:00 2001 From: Chloe Cai <93294344+rollerchloe@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:46:31 +0800 Subject: [PATCH 2/6] docs: rephrase --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 19bef0ec..4ee5fa8c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The response looks like: ```bash /!\ Welcome to the fee table. Please read the information below to understand the transaction fee -The table below display information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you better help you to choose a gas price depending on your needs: +The table below display information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you choose a gas price depending on your needs: Information about the network: Costs based on block number: 4275264 @@ -115,7 +115,7 @@ Please read the information above to understand the table The following is a feature list and the options each feature requires. -| | Private Key | Wallet | Aws Kms | +| Feature | Private Key | Wallet | Aws Kms | | -------------------------------------------------------------------------- | ----------- | ------ | ------- | | [Create config](#creating-the-configuration-file) | ❎ | ✔️ | ❎ | | [Deploy document store](#deploying-a-new-document-store) | ✔ | ✔ | ✔ | @@ -221,7 +221,7 @@ The response looks like: ##### HTTP endpoint in the `--schema` option -The `schema` parameter also allows an HTTP endpoint to return valid JSON schema: +With the `schema` parameter, an HTTP endpoint will return a valid JSON schema. The following shows a command example containing an HTTP endpoint: @@ -339,7 +339,7 @@ The response looks like: ### Document privacy filter -The `filter` command lets the document holders generate valid documents and obfuscates certain fields, such as those fields containing sensitive information that you prefer not to disclose. +Using the `filter` command, the document holders can generate valid documents and obfuscate certain fields, such as those fields containing sensitive information that they prefer not to disclose. The following shows the syntax of the `filter` command: @@ -360,7 +360,7 @@ The response looks like: ### Encrypting a document -The `encrypt` command helps you encrypt the documents, so that you can share and store them safely. +With the `encrypt` command, you can encrypt the documents to share and store them safely. The following shows the syntax of the `encrypt` command: @@ -382,7 +382,7 @@ The response looks like: ### Decrypting a document -The `decrypt` command lets you decrypt documents that were encrypted using the [encrypt](#encrypting-a-document) method. +Using the `decrypt` command, you can decrypt documents that were encrypted using the [encrypt](#encrypting-a-document) method. The following shows the syntax of the `decrypt` command: @@ -733,7 +733,7 @@ The response looks like: #### Encrypting a wallet -The `wallet encrypt` command helps you encrypt a wallet. +Using the `wallet encrypt` command, you can encrypt a wallet. >**Note:** If you want to provide the wallet private key, see the ["Providing the wallet"](#providing-the-wallet) section. @@ -943,7 +943,7 @@ open-attestation transaction cancel --transaction-hash 0x000 --network sepolia - #### Changing the holder -The `title-escrow change-holder` command lets the owner of a transferable record change its holder. +Using the `title-escrow change-holder` command, the owner of a transferable record can change the holder. The following shows the command syntax: @@ -967,7 +967,7 @@ The response looks like: #### Nominating the change of owner -The `title-escrow nominate-change-owner` command helps the owner of the transferable record nominate a new owner. +With the `title-escrow nominate-change-owner` command, the owner of the transferable record can nominate a new owner. >**Important:** This command will fail if you are not the owner of the transferable record. @@ -995,7 +995,7 @@ The response looks like: #### Endorsing the transfer to owner -The `title-escrow endorse-transfer-owner` command lets the transferable record holder endorse the transfer to an approved owner and holder. +Using the `title-escrow endorse-transfer-owner` command, the transferable record holder can endorse the transfer to an approved owner and holder. >**Important:** This command will fail if there is no approved owner or holder information on the transferable record. @@ -1022,7 +1022,7 @@ The response looks like: #### Endorsing the change of owner -The `title-escrow endorse-change-owner` command helps the transferable record owner endorse the change to a new owner and holder. +Using the `title-escrow endorse-change-owner` command, the transferable record owner can endorse the change to a new owner and holder. >**Important:** This command will fail if the new holder and owner's addresses you provide are the same as the current owner and holder's addresses. @@ -1046,7 +1046,7 @@ The response looks like: #### Surrendering a document -The `title-escrow surrender` command helps the entity (who is both an owner and a holder) surrender the transferable record to the token registry. +With the `title-escrow surrender` command, the entity (who is both an owner and a holder) can surrender the transferable record to the token registry. The following is the command syntax: @@ -1069,7 +1069,7 @@ The response looks like: #### Rejecting a surrendered document -The `title-escrow reject-surrendered` command helps the token registry reject a surrendered transferable record. +With the `title-escrow reject-surrendered` command, the token registry can reject a surrendered transferable record. The following shows the command syntax: @@ -1091,7 +1091,7 @@ The response looks like: #### Accepting a surrendered document -The `title-escrow accept-surrendered` command lets the token registry accept a surrendered transferable record. +Using the `title-escrow accept-surrendered` command, the token registry will be able to accept a surrendered transferable record. The following shows the command syntax: @@ -1147,7 +1147,7 @@ To run performance testing for OA functionality, follow the instructions below. ### Wrap -The `npm run benchmark` command helps you monitor the response time spent on wrapping a batch of documents. +Using the `npm run benchmark` command, you can monitor the response time spent on wrapping a batch of documents. The default command (with no options) will test two documents without `base64` image in one iteration: From fc2146d5f71862b9cb167c28444a411b0f12a28f Mon Sep 17 00:00:00 2001 From: Chloe Cai <93294344+rollerchloe@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:48:45 +0800 Subject: [PATCH 3/6] docs: fix a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ee5fa8c..57eab701 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The response looks like: ```bash /!\ Welcome to the fee table. Please read the information below to understand the transaction fee -The table below display information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you choose a gas price depending on your needs: +The table below displays information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you choose a gas price depending on your needs: Information about the network: Costs based on block number: 4275264 From 9f91fcfbdecc279e450bd385a4c9f0ef38f4bca7 Mon Sep 17 00:00:00 2001 From: Chloe Cai <93294344+rollerchloe@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:52:07 +0800 Subject: [PATCH 4/6] docs: merge comments into readme --- README.md | 102 +++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 57eab701..39045cc2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # OpenAttestation (CLI) -This command line interface tool in the [OpenAttestation CLI](https://github.com/Open-Attestation/open-attestation-cli) repository turns `.json` documents into OpenAttestation verifiable documents. It applies OpenAttestation algorithm to produce a hash of the `.json` document, and then creates a file with the data and proof of integrity. +This command line interface tool in the [OpenAttestation CLI](https://github.com/Open-Attestation/open-attestation-cli) repository turns `.json` documents into OpenAttestation verifiable documents. It applies the OpenAttestation algorithm to produce a hash of the `.json` document, and then creates a file with the data and proof of integrity. ## Installation -There are three ways to install the CLI, including binary, NPM, and NPX. +There are two ways to install the CLI, including binary and NPM. Additionally, you can use NPX to execute the code in the package directly. ### Binary @@ -22,16 +22,17 @@ npm install -g @govtechsg/open-attestation-cli The above command will install the open-attestation CLI to your machine. Be sure to have `node.js` installed, so that you can run the command. -### NPX -You can also opt to use `npx` for the installation: +### NPX + +If you only want to execute a few commands, you can also opt to use `npx` for the installation: ```bash npx -p @govtechsg/open-attestation-cli open-attestation ``` -No matter which way you choose, once the installation process is complete, a configuration folder will be created in the `~/.config/open-attestation/` folder. +Upon installation, a configuration folder will be created at `~/.config/open-attestation/`. ->**Important:** On this website, the CLI is referred to as `open-attestation` when you run a command. The assumption is the CLI is available in your execution path. If not, you must change `open-attestation` to reflect the full path to the executable. +>**Important:** The CLI is referred to as `open-attestation` when you run a command. The assumption is the CLI is available in your execution path. If not, you must change `open-attestation` to reflect the full path to the executable. --- @@ -221,7 +222,7 @@ The response looks like: ##### HTTP endpoint in the `--schema` option -With the `schema` parameter, an HTTP endpoint will return a valid JSON schema. +The `schema` parameter also accepts a remote JSON schema. The following shows a command example containing an HTTP endpoint: @@ -290,11 +291,11 @@ Alternatively, you can use the short form `--oav3` to replace `--open-attestatio open-attestation wrap ./examples/raw-documents/ ./examples/wrapped-documents/ --oav3 ``` ->**Note:** You should wrap Transferable Records individually, as each of them will be minted to a unique title escrow that represents the document's beneficiary and holder entities. For more information about title escrow, see [here](https://www.openattestation.com/docs/integrator-section/transferable-record/overview). +>**Note:** Transferable Records must be wrapped individually as each of them will be minted to a unique title escrow that represents the document's beneficiary and holder entities. For more information about title escrow, see [here](https://www.openattestation.com/docs/integrator-section/transferable-record/overview). ### Unwrapping documents -The `unwrap` command processes a document in the input directory. It will unwrap the document that has been wrapped to its raw document form, and display it in the console. +The `unwrap` command processes a wrapped document in the input directory. It will unwrap it to its raw document form, and display it in the console. The following shows a command example of `unwrap`: @@ -414,7 +415,7 @@ The following shows the syntax of the `deploy token-registry` command: ```bash open-attestation deploy token-registry --factory-address [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -430,9 +431,11 @@ The response looks like: #### Issuing a document to token registry -The `token-registry issue` command issues a hash to a token registry deployed on the blockchain. The `--tokenId` option indicates the document hash, and the `--to` option indicates the title escrow address to which the document is mapped. +The `token-registry issue` command issues a hash to a token registry deployed on the blockchain. - +* The `--tokenId` option indicates the document hash +* The `--beneficiary` option indicates the beneficiary's wallet address +* The `--holder` option indicates the document holder's wallet address The following shows the syntax of the `token-registry issue` command: @@ -441,17 +444,20 @@ open-attestation token-registry issue --network --address **Important:** In this command, you can use `mint` instead of `issue` and they will be strictly equivalent. -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). -The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. +In the example below: +* You will use 0x6FFeD6E6591b808130a9b248fEA32101b5220eca as beneficiary and holder. +* You will need to replace the value above with a wallet address you control, to be able to perform different actions on the transferable records later. +* The `key.txt` file stores the private key to token registry. ```bash -open-attestation token-registry mint --network sepolia --address 0x6133f580aE903b8e79845340375cCfd78a45FF35 --tokenId 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c --to 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +open-attestation token-registry issue -a 0x8431012Bc040942B59e3C5bf428221eab0b2f723 --tokenId 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca -n sepolia -f key.txt ``` The response looks like: ``` -✔ success Token with hash 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c has been issued on 0x6133f580aE903b8e79845340375cCfd78a45FF35 with the initial recipient being 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +✔ success Token with hash 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea has been issued on 0x1E63411DC2fCd6Fab5EE938622f5f6A390F48272 with the initial recipient being 0x6FFeD6E6591b808130a9b248fEA32101b5220eca and initial holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca ``` #### Token Registry roles @@ -469,7 +475,7 @@ The following shows the command syntax: ```bash open-attestation deploy document-store [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -500,7 +506,7 @@ The following shows the command syntax: ```bash open-attestation document-store issue --address --hash [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -524,7 +530,7 @@ The following shows the command syntax: open-attestation document-store revoke --address --hash [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -554,7 +560,7 @@ The `--role` option accepts the following values: - `issuer` - `revoker` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -584,7 +590,7 @@ The `--role` option accepts the following values: - `issuer` - `revoker` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -608,7 +614,7 @@ The following shows the command syntax: ```bash open-attestation document-store transfer-ownership --address --new-owner [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -783,7 +789,7 @@ The response looks like: #### Providing the wallet -When interacting with blockchain, you may need to provide a way to access your wallet. When the wallet is required, all functions will provide multiples ways for you to provide the wallet information: +When interacting with blockchain, you need to provide a way to access your wallet. All functions that require this provide multiple ways for you to enter your wallet information: 1. It is recommended to use the `--encrypted-wallet-path` option where you provide a path to an [encrypted wallet](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt). @@ -824,16 +830,16 @@ open-attestation deploy document-store "My Name" --network sepolia --key 0000000 The `config create` command generates a configuration file named `config.json` with sandbox DNS, document store, and token registry. ->**Note:** You need a `wallet.json` file with sufficient **funds** in the specified network for this command to work. +>**Note:** You need a `wallet.json` file with sufficient **funds** in the specified network for this command to work. Currently, OpenAttestation does not provide any faucet to dispense funds into `wallet.json`. You can search online for some faucets. You can use the following options in this command: - `--output-dir` option specifies in which folder the configuration file will be created. - `--encrypted-wallet-path` option indicates a path to an [encrypted wallet](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt). -- `--config-template-url` option provides a path to reference a configuration template file hosted on a public URL. To learn more, see [Method 1](#method-1-using-the-config-template-url-option-recommended). +- `--config-template-url` option provides a path to reference a configuration template file hosted on a public URL. -- `--config-template-path` option provides a path to reference a config template file locally. To learn more, see [Method 2](#method-2-using-the-config-template-path-option). +- `--config-template-path` option provides a path to reference a config template file locally. There are two ways of using this command to generate a configuration file. Both ways will return a new configuration file with the sandbox DNS, updated document store, and updated token registry. @@ -844,26 +850,19 @@ These are the reference config templates: - [V2 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v2.json) - [V3 config template](https://raw.githubusercontent.com/TradeTrust/tradetrust-config/master/build/reference/config-v3.json) -Step 1. Generate a `wallet.json` file and add funds into `wallet.json`. - ->**Note:** Skip Step 1 if you already have a `wallet.json` file with sufficient funds in the specified network. - -The following is a command example: +Step 1. Make sure the `wallet.json` file has sufficient funds. ```bash open-attestation wallet create --output-file wallet.json ``` ->**Note:** Currently, OpenAttestation does not provide any faucet to dispense funds into `wallet.json`. You can search online for some faucets. - -Step 2. Generate the configuration file by providing the `wallet.json` file you created and a URL to the configuration file template. - -The following is a command example: +Step 2. Generate the configuration file by providing the `wallet.json` file and a URL to the configuration file template. ``` open-attestation config create --output-dir ./example-configs --encrypted-wallet-path /wallet.json ``` -The response looks like the following, in which you need to provide certain information: + +You need to provide certain information in the response: ``` // Please fill in the necessary information when prompted. @@ -876,26 +875,19 @@ The response looks like the following, in which you need to provide certain info #### Method 2: Using the `config-template-path` option -Step 1. Generate a `wallet.json` file and add funds into `wallet.json`. - ->**Note:** Skip Step 1 if you already have a `wallet.json` file with sufficient funds in the specified network. - -The following is a command example: +Step 1. Make sure the `wallet.json` file has sufficient funds. ```bash open-attestation wallet create --output-file wallet.json ``` ->**Note:** Currently, OpenAttestation does not provide any faucet to dispense funds into `wallet.json`. You can search online for some faucets. - -Step 2. Generate the configuration file by providing the `wallet.json` file you created and an existing configuration file. - -The following is a command example: +Step 2. Generate the configuration file by providing the `wallet.json` file and an existing configuration file. ```bash open-attestation config create --output-dir ./example-configs --encrypted-wallet-path /wallet.json ``` -The response looks like the following, in which you need to provide certain information: + +You need to provide certain information in the response: ``` // Please fill in the necessary information when prompted. @@ -951,7 +943,7 @@ The following shows the command syntax: open-attestation title-escrow change-holder --token-registry --tokenId --newHolder [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -977,7 +969,7 @@ The following shows the command syntax: open-attestation title-escrow nominate-change-owner --token-registry --tokenId --newOwner [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -1004,7 +996,7 @@ The following is the command syntax: ```bash open-attestation title-escrow endorse-transfer-owner --token-registry --tokenId --newBeneficiary [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -1031,7 +1023,7 @@ The following is the command syntax: ```bash open-attestation title-escrow endorse-change-owner --token-registry --tokenId --newOwner --newHolder [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -1053,7 +1045,7 @@ The following is the command syntax: ```bash open-attestation title-escrow surrender --token-registry --tokenId [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -1076,7 +1068,7 @@ The following shows the command syntax: ```bash open-attestation title-escrow reject-surrendered --token-registry --tokenId [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. @@ -1098,7 +1090,7 @@ The following shows the command syntax: ```bash open-attestation title-escrow accept-surrendered --token-registry --tokenId [options] ``` -See more options [here](#providing-the-wallet). +For more ways to provide the wallet, see [here](#providing-the-wallet). The following command is a recommended example with the private key set in the `OA_PRIVATE_KEY` environment variable. From 5151f0ee7b5670478d7fd0402e9dc95958e246aa Mon Sep 17 00:00:00 2001 From: Lucas <31716292+yapyuyou@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:02:23 +0800 Subject: [PATCH 5/6] fix: commitlint --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 04c2e8af..67949723 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -24,5 +24,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install Commit Lint Dependencies - run: npm install @commitlint/config-conventional + run: npm install @commitlint/config-conventional@v17 - uses: JulienKode/pull-request-name-linter-action@v0.5.0 From 05f6a1a80ef0640153dc3ee1a64f62592d0bee6f Mon Sep 17 00:00:00 2001 From: Chloe Cai <93294344+rollerchloe@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:51:50 +0800 Subject: [PATCH 6/6] docs: update command lines --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 39045cc2..05460c95 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The above command will install the open-attestation CLI to your machine. Be sure ### NPX -If you only want to execute a few commands, you can also opt to use `npx` for the installation: +If you only want to execute a few commands, you can also opt to use `npx`: ```bash npx -p @govtechsg/open-attestation-cli open-attestation @@ -452,12 +452,12 @@ In the example below: * The `key.txt` file stores the private key to token registry. ```bash -open-attestation token-registry issue -a 0x8431012Bc040942B59e3C5bf428221eab0b2f723 --tokenId 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca -n sepolia -f key.txt +open-attestation token-registry issue --address 0x8431012Bc040942B59e3C5bf428221eab0b2f723 --tokenId 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca -n sepolia -f key.txt ``` The response looks like: ``` -✔ success Token with hash 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea has been issued on 0x1E63411DC2fCd6Fab5EE938622f5f6A390F48272 with the initial recipient being 0x6FFeD6E6591b808130a9b248fEA32101b5220eca and initial holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca +✔ success Token with hash 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea has been issued on 0x8431012Bc040942B59e3C5bf428221eab0b2f723 with the initial recipient being 0x6FFeD6E6591b808130a9b248fEA32101b5220eca and initial holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca ``` #### Token Registry roles