-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: P-1330 init omni client sdk (#3261)
Co-authored-by: higherordertech <higherordertech>
- Loading branch information
Showing
38 changed files
with
10,675 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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,46 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": ["**/*"], | ||
"plugins": ["@nrwl/nx"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nrwl/nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "varsIgnorePattern": "[iI]gnored" } | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"extends": ["plugin:@nrwl/nx/typescript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": ["plugin:@nrwl/nx/javascript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], | ||
"env": { | ||
"jest": true | ||
}, | ||
"rules": {} | ||
} | ||
] | ||
} |
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,41 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
dist | ||
tmp | ||
/out-tsc | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
npm-debug.log | ||
yarn-error.log | ||
testem.log | ||
/typings | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.nx |
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,2 @@ | ||
strict-peer-dependencies=false | ||
auto-install-peers=true |
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,4 @@ | ||
# Add files here to ignore them from prettier formatting | ||
/dist | ||
/coverage | ||
/.nx/cache |
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,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
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,28 @@ | ||
# path to a directory with all packages | ||
storage: ../tmp/local-registry/storage | ||
|
||
# a list of other known repositories we can talk to | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
maxage: 60m | ||
|
||
packages: | ||
'**': | ||
# give all users (including non-authenticated users) full access | ||
# because it is a local registry | ||
access: $all | ||
publish: $all | ||
unpublish: $all | ||
|
||
# if package is not available locally, proxy requests to npm registry | ||
proxy: npmjs | ||
|
||
# log settings | ||
logs: | ||
type: stdout | ||
format: pretty | ||
level: warn | ||
|
||
publish: | ||
allow_offline: true # set offline to true to allow publish offline |
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,12 @@ | ||
 | ||
|
||
# Omni Client Packages | ||
|
||
This repository contains packages that are published on NPM for dApps to interact with the Heima Protocol. | ||
|
||
Learn more about it on [Heima's official documentation](https://docs.heima.network/parachain/sdk-documentation). | ||
|
||
## Packages | ||
|
||
- `@heima/omni-client-sdk` ([go-to](packages/client-sdk/README.md)): provides helpers for dApps to interact with the Heima Protocol | ||
- `@heima/chaindata` ([go-to](packages/chaindata/README.md)): provides chain information of Heima networks. |
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,5 @@ | ||
import { getJestProjects } from '@nrwl/jest'; | ||
|
||
export default { | ||
projects: getJestProjects(), | ||
}; |
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,3 @@ | ||
const nxPreset = require('@nrwl/jest/preset').default; | ||
|
||
module.exports = { ...nxPreset }; |
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,55 @@ | ||
{ | ||
"pluginsConfig": { | ||
"@nrwl/js": { | ||
"analyzeSourceFiles": true | ||
} | ||
}, | ||
"extends": "nx/presets/npm.json", | ||
"$schema": "./node_modules/nx/schemas/nx-schema.json", | ||
"targetDefaults": { | ||
"build": { | ||
"dependsOn": [ | ||
"^build" | ||
], | ||
"inputs": [ | ||
"production", | ||
"^production" | ||
] | ||
}, | ||
"lint": { | ||
"inputs": [ | ||
"default", | ||
"{workspaceRoot}/.eslintrc.json", | ||
"{workspaceRoot}/.eslintignore", | ||
"{workspaceRoot}/eslint.config.js" | ||
] | ||
}, | ||
"e2e": {}, | ||
"@nrwl/jest:jest": { | ||
"inputs": [ | ||
"default", | ||
"^default", | ||
"{workspaceRoot}/jest.preset.js" | ||
], | ||
"options": { | ||
"passWithNoTests": true | ||
}, | ||
"configurations": { | ||
"ci": { | ||
"ci": true, | ||
"codeCoverage": true | ||
} | ||
} | ||
} | ||
}, | ||
"namedInputs": { | ||
"default": [ | ||
"{projectRoot}/**/*" | ||
], | ||
"production": [ | ||
"default", | ||
"!{projectRoot}/jest.config.ts", | ||
"!{projectRoot}/**/?(*.)+(spec|test).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,59 @@ | ||
{ | ||
"name": "@omni-client-sdk/source", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "nx affected --base=dev --target=test --plain", | ||
"lint": "nx affected --base=dev --target=lint --plain", | ||
"clean": "pnpm clean:dist; pnpm clean:packages", | ||
"clean:dist": "rm -rf dist", | ||
"clean:packages": "rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm i" | ||
}, | ||
"private": true, | ||
"dependencies": { | ||
"@polkadot/api": "^15.0.1", | ||
"@polkadot/types": "^15.0.1", | ||
"@polkadot/types-codec": "^15.0.1", | ||
"@polkadot/util": "^13.2.3", | ||
"@polkadot/util-crypto": "^13.2.3", | ||
"ts-node": "10.9.1", | ||
"tslib": "^2.5.3", | ||
"ws": "^8.17.1" | ||
}, | ||
"devDependencies": { | ||
"@altack/nx-bundlefy": "^0.16.0", | ||
"@nrwl/cli": "^15.9.3", | ||
"@nrwl/devkit": "^19.8.4", | ||
"@nrwl/eslint-plugin-nx": "^19.8.4", | ||
"@nrwl/jest": "^19.8.4", | ||
"@nrwl/js": "^19.8.4", | ||
"@nrwl/linter": "^19.8.4", | ||
"@nrwl/workspace": "^19.8.4", | ||
"@polkadot/api-base": "^15.5.2", | ||
"@polkadot/rpc-core": "^15.5.2", | ||
"@polkadot/rpc-provider": "^15.5.2", | ||
"@swc-node/register": "^1.8.0", | ||
"@swc/core": "^1.4.17", | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "20.14.8", | ||
"@types/ws": "^8.5.9", | ||
"@typescript-eslint/eslint-plugin": "8.x", | ||
"@typescript-eslint/parser": "8.x", | ||
"eslint": "^9.20.1", | ||
"eslint-config-prettier": "^10.0.1", | ||
"jest": "^29.4.1", | ||
"jest-environment-node": "^29.4.1", | ||
"nx": "^20.4.4", | ||
"prettier": "^3.5.1", | ||
"ts-jest": "^29.1.0", | ||
"typedoc": "^0.27.7", | ||
"typedoc-plugin-markdown": "^4.4.2", | ||
"typescript": "5.4.5", | ||
"validate-npm-package-name": "^6.0.0", | ||
"verdaccio": "^6.0.5" | ||
}, | ||
"nx": { | ||
"includedScripts": [] | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
25 changes: 25 additions & 0 deletions
25
tee-worker/omni-executor/client-sdk/packages/chaindata/.eslintrc.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,25 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nrwl/nx/dependency-checks": "error" | ||
} | ||
} | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
tee-worker/omni-executor/client-sdk/packages/chaindata/CHANGELOG.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,10 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
- Initial version |
21 changes: 21 additions & 0 deletions
21
tee-worker/omni-executor/client-sdk/packages/chaindata/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,21 @@ | ||
# @heima/chaindata | ||
|
||
This library contains information about the available networks at Heima, including its testnets. | ||
|
||
## Installation | ||
|
||
1. Install from NPM | ||
|
||
``` | ||
npm install @heima/chaindata | ||
``` | ||
|
||
2. Explore | ||
|
||
```ts | ||
import { all, byId } from '@heima/chaindata`; | ||
|
||
console.log(all); | ||
|
||
console.log(`Heima's production RPC URL is: ${byId['heima-prod'].rpcs[0].url}`); | ||
``` |
10 changes: 10 additions & 0 deletions
10
tee-worker/omni-executor/client-sdk/packages/chaindata/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,10 @@ | ||
{ | ||
"name": "@heima/chaindata", | ||
"version": "0.3.0", | ||
"dependencies": { | ||
"tslib": "^2.5.3" | ||
}, | ||
"type": "commonjs", | ||
"main": "./src/index.js", | ||
"typings": "./src/index.d.ts" | ||
} |
41 changes: 41 additions & 0 deletions
41
tee-worker/omni-executor/client-sdk/packages/chaindata/project.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,41 @@ | ||
{ | ||
"name": "chaindata", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/chaindata/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:tsc", | ||
"outputs": [ | ||
"{options.outputPath}" | ||
], | ||
"options": { | ||
"outputPath": "dist/packages/chaindata", | ||
"main": "packages/chaindata/src/index.ts", | ||
"tsConfig": "packages/chaindata/tsconfig.lib.json", | ||
"assets": [ | ||
"packages/chaindata/*.md" | ||
] | ||
} | ||
}, | ||
"publish": { | ||
"command": "node tools/scripts/publish.mjs chaindata {args.ver} {args.tag}", | ||
"dependsOn": [ | ||
"build" | ||
] | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": [ | ||
"{options.outputFile}" | ||
], | ||
"options": { | ||
"lintFilePatterns": [ | ||
"packages/chaindata/**/*.ts", | ||
"packages/chaindata/package.json" | ||
] | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
1 change: 1 addition & 0 deletions
1
tee-worker/omni-executor/client-sdk/packages/chaindata/src/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 @@ | ||
|
Oops, something went wrong.