Skip to content

Commit

Permalink
feat(connector-chainlink): add skeleton implementation - oracle streams
Browse files Browse the repository at this point in the history
WORK IN PROGRESS

Fixes hyperledger-cacti#3530

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Sep 20, 2024
1 parent 299af74 commit af3db4c
Show file tree
Hide file tree
Showing 208 changed files with 30,853 additions and 86 deletions.
34 changes: 34 additions & 0 deletions packages/cacti-plugin-ledger-connector-avalanche/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# `@hyperledger/cacti-plugin-ledger-connector-avalanche`

This plugin provides `Cacti` a way to interact with Avalanche networks. Using this we can perform:
* Deploy Smart-contracts through bytecode.
* Build and sign transactions using different keystores.
* Invoke smart-contract functions that we have deployed on the network.

## Summary

- [`@hyperledger/cacti-plugin-ledger-connector-avalanche`](#hyperledgercacti-plugin-ledger-connector-avalanche)
- [Summary](#summary)
- [Getting Started](#getting-started)
- [References](#references)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgments](#acknowledgments)

## Getting Started

## References

1. https://docs.avax.network/tooling/rpc-providers

## Contributing

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## License

This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file.

## Acknowledgments
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"
}
}
117 changes: 117 additions & 0 deletions packages/cacti-plugin-ledger-connector-avalanche/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"name": "@hyperledger/cacti-plugin-ledger-connector-avalanche",
"version": "2.0.0-rc.4",
"description": "Allows Cacti nodes to connect to a Avalanche ledger.",
"keywords": [
"Hyperledger",
"Cacti",
"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": "[email protected]",
"url": "https://www.hyperledger.org/use/cacti"
},
"contributors": [
{
"name": "Please add yourself to the list of contributors",
"email": "[email protected]",
"url": "https://example.com"
},
{
"name": "Peter Somogyvari",
"email": "[email protected]",
"url": "https://accenture.com"
}
],
"main": "dist/lib/main/typescript/index.js",
"module": "dist/lib/main/typescript/index.js",
"browser": "dist/cacti-plugin-ledger-connector-avalanche.web.umd.js",
"types": "dist/lib/main/typescript/index.d.ts",
"files": [
"dist/*"
],
"scripts": {
"benchmark": "tsx ./src/test/typescript/benchmark/run-plugin-ledger-connector-avalanche-benchmark.ts .tmp/benchmark-results/plugin-ledger-connector-avalanche/run-plugin-ledger-connector-avalanche-benchmark.ts.log",
"codegen": "yarn run --top-level run-s 'codegen:*'",
"codegen:openapi": "npm run generate-sdk",
"codegen:proto": "run-s proto:openapi proto:protoc-gen-ts",
"generate-sdk": "run-s 'generate-sdk:*'",
"generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:typescript-axios": "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 --ignore-file-override ../../openapi-generator-ignore",
"proto:openapi": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --model-name-suffix=PB --language-specific-primitives=google.protobuf.Any --type-mappings=AnyType=google.protobuf.Any --type-mappings=object=google.protobuf.Any --additional-properties=packageName=org.hyperledger.cacti.plugin.ledger.connector.avalanche -o ./src/main/proto/generated/openapi/ -t=./src/main/mustache/openapi-generator/templates/protobuf-schema/ --ignore-file-override ../../openapi-generator-ignore",
"proto:protoc-gen-ts": "yarn run --top-level grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/ ./src/main/proto/generated/openapi/services/*.proto ./src/main/proto/services/*.proto",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev",
"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"
},
"dependencies": {
"@avalabs/avalanchejs": "4.0.5",
"@grpc/grpc-js": "1.11.2",
"@hyperledger/cactus-common": "2.0.0-rc.4",
"@hyperledger/cactus-core": "2.0.0-rc.4",
"@hyperledger/cactus-core-api": "2.0.0-rc.4",
"axios": "1.7.7",
"ethers": "6.13.2",
"express": "4.19.2",
"google-protobuf": "3.21.4",
"http-errors-enhanced-cjs": "2.0.1",
"joi": "17.13.3",
"openapi-types": "12.1.3",
"prom-client": "15.1.3",
"run-time-error-cjs": "1.4.0",
"rxjs": "7.8.1",
"socket.io-client-fixed-types": "4.5.4",
"typescript-optional": "2.0.1"
},
"devDependencies": {
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.4",
"@hyperledger/cactus-test-tooling": "2.0.0-rc.4",
"@openapitools/openapi-generator-cli": "2.7.0",
"@types/benchmark": "2.1.5",
"@types/body-parser": "1.19.4",
"@types/express": "4.17.21",
"@types/fs-extra": "11.0.4",
"@types/google-protobuf": "3.15.5",
"@types/http-errors": "2.0.4",
"@types/uuid": "10.0.0",
"benchmark": "2.1.4",
"body-parser": "1.20.2",
"fs-extra": "11.2.0",
"grpc-tools": "1.12.4",
"grpc_tools_node_protoc_ts": "5.3.3",
"npm-run-all2": "6.1.2",
"protobufjs": "7.4.0",
"socket.io": "4.6.2",
"tsx": "4.16.2"
},
"engines": {
"node": ">=18",
"npm": ">=8"
},
"publishConfig": {
"access": "public"
},
"browserMinified": "dist/cacti-plugin-ledger-connector-avalanche.web.umd.min.js",
"mainMinified": "dist/cacti-plugin-ledger-connector-avalanche.node.umd.min.js",
"watch": {
"codegen:openapi": {
"patterns": [
"./src/main/json/openapi.json"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.travis.yml
README.md
api/openapi.yaml
api_default.go
client.go
configuration.go
go.mod
go.sum
model_deploy_contract_v1_request.go
model_deploy_contract_v1_response.go
model_watch_blocks_v1.go
model_watch_blocks_v1_progress.go
model_watch_blocks_v1_request.go
model_web3_signing_credential_private_key_hex.go
response.go
utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: go

install:
- go get -d -v .

script:
- go build -v ./

Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Go API client for cacti-plugin-ledger-connector-avalanche

Can perform basic tasks on a Avalanche ledger

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2.0.0-rc.4
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation

Install the following dependencies:

```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```golang
import cacti-plugin-ledger-connector-avalanche "github.com/hyperledger/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```golang
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Configuration of Server URL

Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.

### Select Server Configuration

For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.

```golang
ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.

```golang
ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```

Note, enum values are always validated and all unused variables are silently ignored.

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```

## Documentation for API Endpoints

All URIs are relative to *http://cacti.local:3000*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**DeployContractV1**](docs/DefaultApi.md#deploycontractv1) | **Post** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract | Deploys the bytecode of a Solidity contract without the need of keychain
*DefaultApi* | [**GetOpenApiSpecV1**](docs/DefaultApi.md#getopenapispecv1) | **Get** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec | Retrieves the .json file that contains the OpenAPI specification for the plugin.


## Documentation For Models

- [DeployContractV1Request](docs/DeployContractV1Request.md)
- [DeployContractV1Response](docs/DeployContractV1Response.md)
- [WatchBlocksV1](docs/WatchBlocksV1.md)
- [WatchBlocksV1Progress](docs/WatchBlocksV1Progress.md)
- [WatchBlocksV1Request](docs/WatchBlocksV1Request.md)
- [Web3SigningCredentialPrivateKeyHex](docs/Web3SigningCredentialPrivateKeyHex.md)


## Documentation For Authorization

Endpoints do not require authorization.


## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`

## Author



Loading

0 comments on commit af3db4c

Please sign in to comment.