-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(polkadot): creation of polkadot connector openapi specs, test ca…
…se and connector class Primary Changes --------------- 1. Created openapi specs for get-prometheus-exporter-metrics, get-transaction-info, get-raw-transaction, sign-raw-transaction, run-transaction, deploy-contract-ink, and invoke-contract endpoints 2. Created relevant types for the request as well as response for the above endpoints 3. Added generated code for these endpoints 4. Created connector class with functions to interact with the polkadot ledger 5. Created webservices to interact with the endpoint and the relevant class method 6. Created unit and integration testcases in jest to test base functionality of the connector Secondary Changes ----------------- 1. Added an ink! contract for running the testcases 2. Added the polkadot connector to ci workflow 3. Created substrate.md to docs-cactus 4. Added the polkadot connector to tsconfig.json Signed-off-by: Anmol Bansal <[email protected]>
- Loading branch information
1 parent
cf223c8
commit d533ddc
Showing
46 changed files
with
6,479 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -790,6 +790,31 @@ jobs: | |
node-version: ${{ env.NODEJS_VERSION }} | ||
- uses: actions/[email protected] | ||
|
||
- id: yarn-cache | ||
name: Restore Yarn Cache | ||
uses: actions/[email protected] | ||
with: | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
path: ./.yarn/ | ||
restore-keys: | | ||
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
- run: ./tools/ci.sh | ||
cactus-plugin-ledger-connector-polkadot: | ||
continue-on-error: false | ||
env: | ||
FULL_BUILD_DISABLED: true | ||
JEST_TEST_PATTERN: packages/cactus-plugin-ledger-connector-polkadot/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts | ||
JEST_TEST_RUNNER_DISABLED: false | ||
TAPE_TEST_RUNNER_DISABLED: true | ||
needs: build-dev | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Use Node.js ${{ env.NODEJS_VERSION }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ env.NODEJS_VERSION }} | ||
- uses: actions/[email protected] | ||
|
||
- id: yarn-cache | ||
name: Restore Yarn Cache | ||
uses: actions/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Substrate Support | ||
----------------- | ||
|
||
|
||
```{note} | ||
Substrate chains include Polkadot, Kusama, Rococco, etc. The deployContract feature is for development and test case authoring only, not recommended to be used in production environments for managing smart contracts. | ||
``` | ||
|
||
<details> | ||
<summary>Hyperledger Cactus v1.0.0-rc3</summary> | ||
|
||
| Substrate API version | deployContract* | invokeContract | runTransaction | | ||
| --- | :---: | :---: | :---: | | ||
| @polkadot/api 10.9.1 | ✅ [test]() | ✅ [test]() | ✅ [test]() | | ||
|
||
</details> |
7 changes: 7 additions & 0 deletions
7
packages/cactus-plugin-ledger-connector-polkadot/openapitools.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,7 @@ | ||
{ | ||
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "6.6.0" | ||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
packages/cactus-plugin-ledger-connector-polkadot/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,123 @@ | ||
{ | ||
"name": "@hyperledger/cactus-plugin-ledger-connector-polkadot", | ||
"version": "2.0.0-alpha.2", | ||
"description": "Allows Cactus nodes to connect to a Substrate ledger.", | ||
"keywords": [ | ||
"Hyperledger", | ||
"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 Cactus Contributors", | ||
"email": "[email protected]", | ||
"url": "https://www.hyperledger.org/use/cactus" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Please add yourself to the list of contributors", | ||
"email": "[email protected]", | ||
"url": "https://example.com" | ||
}, | ||
{ | ||
"name": "Catarina Pedreira" | ||
}, | ||
{ | ||
"name": "Rafael Belchior" | ||
}, | ||
{ | ||
"name": "Anmol Bansal", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"type": "module", | ||
"main": "dist/lib/main/typescript/index.js", | ||
"module": "dist/lib/main/typescript/index.js", | ||
"browser": "dist/cactus-plugin-ledger-connector-polkadot.web.umd.js", | ||
"types": "dist/types/main/typescript/index.d.ts", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"scripts": { | ||
"codegen": "run-p 'codegen:*'", | ||
"codegen:openapi": "npm run generate-sdk", | ||
"generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected", | ||
"lint": "tslint tests/*.ts -t verbose", | ||
"lint-fix": "tslint --fix tests/*.ts -t verbose", | ||
"watch": "npm-watch", | ||
"webpack": "npm-run-all webpack:dev webpack:prod", | ||
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", | ||
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", | ||
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js", | ||
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web", | ||
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js", | ||
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js" | ||
}, | ||
"dependencies": { | ||
"@hyperledger/cactus-common": "2.0.0-alpha.2", | ||
"@hyperledger/cactus-core": "2.0.0-alpha.2", | ||
"@hyperledger/cactus-core-api": "2.0.0-alpha.2", | ||
"@polkadot/api": "10.9.1", | ||
"@polkadot/api-contract": "10.9.1", | ||
"@polkadot/rpc-provider": "10.9.1", | ||
"@polkadot/types": "10.9.1", | ||
"@polkadot/util": "12.6.2", | ||
"bl": "5.0.0", | ||
"eslint": "7.21.0", | ||
"express": "4.17.1", | ||
"express-openapi-validator": "4.13.1", | ||
"form-data": "4.0.0", | ||
"fs-extra": "11.2.0", | ||
"http-errors": "2.0.0", | ||
"http-status-codes": "2.1.4", | ||
"joi": "14.3.1", | ||
"multer": "1.4.2", | ||
"ngo": "2.6.2", | ||
"openapi-types": "9.1.0", | ||
"prom-client": "13.2.0", | ||
"temp": "0.9.1", | ||
"tslint": "6.1.3", | ||
"typescript-optional": "2.0.1", | ||
"uuid": "8.3.2" | ||
}, | ||
"devDependencies": { | ||
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2", | ||
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2", | ||
"@types/express": "4.17.19", | ||
"@types/http-errors": "2.0.4", | ||
"@types/joi": "14.3.4", | ||
"@types/multer": "1.4.7", | ||
"@types/ssh2": "0.5.44", | ||
"@types/supertest": "2.0.11", | ||
"@types/temp": "0.9.1", | ||
"@types/uuid": "8.3.1", | ||
"axios": "0.22.0", | ||
"supertest": "6.1.6" | ||
}, | ||
"engines": { | ||
"node": ">=10", | ||
"npm": ">=6" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"browserMinified": "dist/cactus-plugin-ledger-connector-polkadot.web.umd.min.js", | ||
"mainMinified": "dist/cactus-plugin-ledger-connector-polkadot.node.umd.min.js", | ||
"watch": { | ||
"codegen:openapi": { | ||
"patterns": [ | ||
"./src/main/json/openapi.json" | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.