Skip to content

Commit

Permalink
feat: breaking change: v3 cli with token-registry v5 (#40)
Browse files Browse the repository at this point in the history
feat: release CLI with token-registry v5

BREAKING CHANGE: v3 cli with token-registry v5
  • Loading branch information
nghaninn authored Dec 5, 2024
1 parent 1f526db commit 8333eeb
Show file tree
Hide file tree
Showing 82 changed files with 8,767 additions and 8,537 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- master
- beta
- v[0-9]*
- +([0-9])?(.{+([0-9]),x}).x

env:
Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/@tradetrust-tt/tradetrust-cli-linux
dist/@tradetrust-tt/tradetrust-cli-macos
dist/@tradetrust-tt/tradetrust-cli-win.exe
86 changes: 85 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,4 +1,88 @@
{
"branches": [
{
"name": "master",
"release": true
},
{
"name": "v3",
"prerelease": "alpha"
}
],
"tagFormat": "v${version}",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{
"subject": "*BREAKING CHANGE*",
"release": "major"
},
{
"footer": "*BREAKING CHANGE*",
"release": "major"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "docs",
"section": "Miscellaneous Chores",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": false
}
]
},
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
"@semantic-release/github"
],
"prepare": [
"@semantic-release/npm",
{
Expand Down Expand Up @@ -29,4 +113,4 @@
]
}
]
}
}
106 changes: 88 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ Please read the information above to understand the table
| [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) ||||
| [Reject change of owner (Title Escrow)](#reject-change-of-owner) ||||
| [Reject change of holder (Title Escrow)](#reject-change-of-holder) ||||
| [Reject change of owners (Title Escrow)](#reject-change-of-owners) ||||
| [Return document to issuer (Title Escrow)](#return-document-to-issuer) ||||
| [Reject return of document (Title Escrow)](#reject-returned-document) ||||
| [Accept return of document (Title Escrow)](#accept-returned-document) ||||

### Wrapping documents

Expand Down Expand Up @@ -588,6 +591,22 @@ rm ./examples/sample-key
tradetrust deploy document-store "My Name" --network sepolia --key 0000000000000000000000000000000000000000000000000000000000000003
```

### Providing the Remarks and Encryption Key

Enables users to attach encrypted remarks (up to 120 characters) to blockchain transactions. The encrypted remarks are stored immutably on the blockchain and can be viewed in the endorsement chain. This ensures secure and meaningful metadata is recorded alongside transactions.

1. Using `remark` option where you provide a remark not more than 120 characters.
1. Using `encryptionKey` option where you provide token registry address as your encryption key.

```bash
# Using remark
tradetrust title-escrow reject-transfer-owner-holder --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> --remark <Remark>
# Using encryption key
tradetrust title-escrow reject-transfer-owner-holder --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> --remark <Remark> --encryptionKey <ENCRYPTION_KEY>
```

### Config (Create configuration file)

This command will generate a config file with sandbox DNS, document store and token registry.
Expand Down Expand Up @@ -748,52 +767,103 @@ tradetrust title-escrow endorse-change-owner --token-registry 0x4933e30eF8A083f4
✔ 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
#### Reject Change of Owner

This command will allow the owner of the transferable record to reject the change of owner to previous owner.
**This command will fail if the current owner has made any transactions.**

```bash
tradetrust title-escrow reject-transfer-owner --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```

Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).

```bash
tradetrust title-escrow reject-transfer-owner --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's owner has been successfully rejected to previous owner
```
#### Reject Change of Holder
This command will allow the holder of the transferable record to reject the change of holder to previous holder.
**This command will fail if the current holder has made any transactions.**
```bash
tradetrust title-escrow reject-transfer-holder --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
tradetrust title-escrow reject-transfer-holder --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's holder has been successfully rejected to previous holder
```

#### Reject Change of Owners

This command will allow the owner of the transferable record to reject the change of owner and holder to previous owner and holder.
**This command will fail if the current owner has made any transactions.**

```bash
tradetrust title-escrow reject-transfer-owner-holder --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```

Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).

```bash
tradetrust title-escrow reject-transfer-owner-holder --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990's owners has been successfully rejected to previous owner and holder
```
#### Return Document to Issuer
This command will allow the entity (who is both an owner and holder) to surrender it's transferable record to the token registry.
This command will allow the entity (who is both an owner and holder) to return it's transferable record to the token registry.
```bash
tradetrust title-escrow surrender --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
tradetrust title-escrow return-to-issuer --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
tradetrust title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
tradetrust title-escrow return-to-issuer --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been surrendered.
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been returned to issuer.
```
#### Reject Surrendered Document
#### Reject Returned Document
This command will allow the token registry to reject a surrendered transferable record.
This command will allow the token registry to reject a returned transferable record.
```bash
tradetrust title-escrow reject-surrendered --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
tradetrust title-escrow reject-returned --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
tradetrust title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
tradetrust title-escrow reject-returned --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been rejected.
✔ success Returned transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been rejected.
```
#### Accept Surrendered Document
#### Accept Returned Document
This command will allow the token registry to accept a surrendered transferable record.
This command will allow the token registry to accept a returned transferable record.
```bash
tradetrust title-escrow accept-surrendered --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
tradetrust title-escrow accept-returned --token-registry <TOKEN_REGISTRY_ADDRESS> --tokenId <TOKEN_ID> [options]
```
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
tradetrust title-escrow accept-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
tradetrust title-escrow accept-returned --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been accepted.
✔ success Returned transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been accepted.
```
Expand Down
69 changes: 0 additions & 69 deletions __mocks__/@digitalbazaar/http-client.js

This file was deleted.

56 changes: 56 additions & 0 deletions examples/v5/raw-documents/example.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"version": "https://schema.openattestation.com/3.0/schema.json",
"network": {
"chain": "MATIC",
"chainId": "80002"
},
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schemata.openattestation.com/com/openattestation/1.0/OpenAttestation.v3.json",
"https://schemata.openattestation.com/io/tradetrust/bill-of-lading/1.0/bill-of-lading-context.json"
],
"credentialSubject": {
"shipper": {
"address": {}
},
"consignee": {},
"notifyParty": {},
"blNumber": "20240315",
"scac": "20240315",
"links": {
"self": {
"href": "https://action.openattestation.com?q=%7B%22type%22%3A%22DOCUMENT%22%2C%22payload%22%3A%7B%22uri%22%3A%22https%3A%2F%2Ftradetrust-functions.netlify.app%2F.netlify%2Ffunctions%2Fstorage%2F430b1a37-510e-4f38-a27c-444b3c464f83%22%2C%22key%22%3A%2254d6b2b34aea27541c3143988e7f1fc26f0f9f58f215d4915fa1da3a13441d00%22%2C%22permittedActions%22%3A%5B%22STORE%22%5D%2C%22redirect%22%3A%22https%3A%2F%2Fdev.tradetrust.io%2F%22%2C%22chainId%22%3A%2280001%22%7D%7D"
}
}
},
"openAttestationMetadata": {
"template": {
"type": "EMBEDDED_RENDERER",
"name": "BILL_OF_LADING",
"url": "https://generic-templates.tradetrust.io"
},
"proof": {
"type": "OpenAttestationProofMethod",
"method": "TOKEN_REGISTRY",
"value": "0x0f99945c7ebae71a9a615c422d716fe1eeab2b2e",
"revocation": {
"type": "NONE"
}
},
"identityProof": {
"type": "DNS-TXT",
"identifier": "verifier-amoy.dev.nghaninn.com"
}
},
"issuanceDate": "2021-12-03T12:19:52Z",
"expirationDate": "2029-12-03T12:19:52Z",
"issuer": {
"id": "https://example.com",
"name": "DEMO TOKEN REGISTRY",
"type": "OpenAttestationIssuer"
},
"type": [
"VerifiableCredential",
"OpenAttestationCredential"
]
}
Loading

0 comments on commit 8333eeb

Please sign in to comment.