-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(indy-sdk): replace indy SDK with AFJ
- Refactor test ledger `indy-testnet` into `indy-all-in-one`. New package uses the latest indy version, has healtcheck script, updated startup / cleanup scripts. - Remove `indy-sdk-cli` image since it's not used anymore. - Refactor `cactus-example-discounted-asset-trade` to use own aries agent instead of indy connector. This way it doesn't need to use indy-sdk anymore, and python indy connector can be safely removed / upgraded. - Update sample app readme to explain current workflow. - Remove client scripts since `cactus-example-discounted-asset-trade-client` can now be used to interact with the sample app. - Add `cactus-example-discounted-asset-trade-client`. It contains script for setting up test credentials on the ledger, script with interactive menu for interacting with `cactus-example-discounted-asset-trade` sample app, and bunch of helper functions used for writing these apps. Depends on #2859 Depends on #2860 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Loading branch information
Showing
58 changed files
with
3,057 additions
and
1,764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
examples/cactus-example-discounted-asset-trade-client/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# cactus-example-discounted-asset-trade-client | ||
- Client applications and helper libraries for interacting with test indy ledger and Cacti discounted asset trade example app. | ||
- Uses Hyperledger Aries Framework JavaScript (AFJ). | ||
- **Before running any of the script make sure that test indy ledger is running and it's config is available under `/etc/cactus/indy-all-in-one/` (at least `pool_transactions_genesis` should be there.)** | ||
|
||
## Build | ||
- This package will be build as part of main cacti build (`yarn run configure` in root dir), or can be build manually by running `yarn run build` from this directory). | ||
|
||
## Setup Credentials Script | ||
- This script can be used to setup indy credentials before running the example app, or to simply check indy test ledger operational status. | ||
- Script will register employment credential, issue it to agent `Alice`, and check that employment proof is correct. | ||
- Can be run repeatadelly. | ||
|
||
``` bash | ||
# Run the script | ||
yarn setup-credentials | ||
|
||
# Run with debug logs | ||
LOG_LEVEL=DEBUG yarn setup-credentials | ||
``` | ||
|
||
### Sample output | ||
|
||
``` bash | ||
Running with log level INFO | ||
Connecting Alice with Issuer... | ||
Connecting aliceCactiAgent to issuerCactiAgent... | ||
Agents connected! | ||
Register and issue the employment credential... | ||
Register Credential Schema... | ||
Register employment certificate credential schema 'cactiJobCert'... | ||
Register Credential Definition... | ||
Register job certificate credential definition (schemaId: 'did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0') ... | ||
Issue the credential... | ||
Accepting credential 018e6578-4e52-4ae0-8381-8c935c8a13dc... | ||
Credential accepted! | ||
Credential was issed and accepted by a peer agent! | ||
Verify employment status proof... | ||
Proof request was sent | ||
Accepting proof 5c0986ab-4f1d-4850-a2ff-53c90ce34a12... | ||
Proof request accepted! | ||
Requested proof status: done | ||
Finishing - cleaning up the agents... | ||
All done. | ||
`````` | ||
|
||
## Discounted Asset Trade Client | ||
- Used to interact with discounted asset trade example application. | ||
- Will connect Alice agent to sample application. After that you can choose action to perform. | ||
- Actions: | ||
- `Start the trade`: Will send trade request to example app, asset2 will change owner and payment will be processed on etherem (see `cactus-example-discounted-asset-trade` README for more details) | ||
- `Get this agent credentials`: Get list of Alice credentials. | ||
- `Get assets`: Get example app asset list (both fabric assets and ethereum balances) | ||
- `Exit`: Cleanup and leave. Note - may take few seconds due to ongoing timeouts etc... | ||
- Note: Use arrow keys to restore menu if any async message caused it to disappear. | ||
|
||
``` bash | ||
# Run the script | ||
yarn run-discounted-asset-trade-client | ||
# Run with debug logs | ||
LOG_LEVEL=DEBUG yarn run-discounted-asset-trade-client | ||
``` | ||
|
||
### Sample output | ||
|
||
``` bash | ||
Running with log level INFO | ||
Connected to the discounted asset trade sample app agent! ID: 5a4f0cf6-b53a-4f3d-9494-112edfdfd626 | ||
Action: (Use arrow keys) | ||
❯ Start the trade | ||
Get this agent credentials | ||
Get assets | ||
Exit | ||
`````` |
79 changes: 79 additions & 0 deletions
79
examples/cactus-example-discounted-asset-trade-client/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"name": "@hyperledger/cactus-example-discounted-asset-trade-client", | ||
"version": "2.0.0-alpha.2", | ||
"description": "Client for interacting with discounted asset trade sample app and some tools for setting up indy enviroment", | ||
"keywords": [ | ||
"Hyperledger", | ||
"Cacti", | ||
"Cactus", | ||
"Integration", | ||
"Blockchain", | ||
"Distributed Ledger Technology" | ||
], | ||
"homepage": "https://github.com/hyperledger/cacti#readme", | ||
"bugs": { | ||
"url": "https://github.com/hyperledger/cacti/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hyperledger/cacti.git" | ||
}, | ||
"license": "Apache-2.0", | ||
"author": { | ||
"name": "Hyperledger Cacti Contributors", | ||
"email": "cacti@lists.hyperledger.org", | ||
"url": "https://www.hyperledger.org/use/cacti" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Please add yourself to the list of contributors", | ||
"email": "your.name@example.com", | ||
"url": "https://example.com" | ||
}, | ||
{ | ||
"name": "Michal Bajer", | ||
"email": "michal.bajer@fujitsu.com", | ||
"url": "https://www.fujitsu.com/global/" | ||
} | ||
], | ||
"main": "dist/lib/main/typescript/index.js", | ||
"module": "dist/lib/main/typescript/index.js", | ||
"types": "dist/lib/main/typescript/index.d.ts", | ||
"bin": { | ||
"run-discounted-asset-trade-client": "dist/lib/main/typescript/scripts/run-discounted-asset-trade-client.js", | ||
"setup-credentials": "dist/lib/main/typescript/scripts/setup-credentials.js" | ||
}, | ||
"files": [ | ||
"dist/*" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"setup-credentials": "node dist/lib/main/typescript/scripts/setup-credentials.js", | ||
"run-discounted-asset-trade-client": "node dist/lib/main/typescript/scripts/run-discounted-asset-trade-client.js" | ||
}, | ||
"dependencies": { | ||
"@hyperledger/anoncreds-nodejs": "0.2.0-dev.4", | ||
"@hyperledger/aries-askar-nodejs": "0.2.0-dev.1", | ||
"@hyperledger/indy-vdr-nodejs": "0.2.0-dev.3", | ||
"axios": "1.5.1", | ||
"inquirer": "8.2.6", | ||
"loglevel": "1.8.1" | ||
}, | ||
"devDependencies": { | ||
"@aries-framework/anoncreds": "0.5.0-alpha.58", | ||
"@aries-framework/anoncreds-rs": "0.5.0-alpha.58", | ||
"@aries-framework/askar": "0.5.0-alpha.58", | ||
"@aries-framework/core": "0.5.0-alpha.58", | ||
"@aries-framework/indy-sdk": "0.5.0-alpha.58", | ||
"@aries-framework/indy-vdr": "0.5.0-alpha.58", | ||
"@aries-framework/node": "0.5.0-alpha.58", | ||
"@types/inquirer": "8.2.6" | ||
}, | ||
"engines": { | ||
"node": ">=18", | ||
"npm": ">=8" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
examples/cactus-example-discounted-asset-trade-client/src/main/typescript/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./public-api"; |
Oops, something went wrong.