Skip to content

Commit

Permalink
feat: P-1330 init omni client sdk (#3261)
Browse files Browse the repository at this point in the history
Co-authored-by: higherordertech <higherordertech>
  • Loading branch information
wli-pro authored Feb 21, 2025
1 parent c43f180 commit c776fda
Show file tree
Hide file tree
Showing 38 changed files with 10,675 additions and 0 deletions.
1 change: 1 addition & 0 deletions tee-worker/omni-executor/client-sdk/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
46 changes: 46 additions & 0 deletions tee-worker/omni-executor/client-sdk/.eslintrc.json
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": {}
}
]
}
41 changes: 41 additions & 0 deletions tee-worker/omni-executor/client-sdk/.gitignore
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
2 changes: 2 additions & 0 deletions tee-worker/omni-executor/client-sdk/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
strict-peer-dependencies=false
auto-install-peers=true
4 changes: 4 additions & 0 deletions tee-worker/omni-executor/client-sdk/.prettierignore
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
4 changes: 4 additions & 0 deletions tee-worker/omni-executor/client-sdk/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"printWidth": 120
}
28 changes: 28 additions & 0 deletions tee-worker/omni-executor/client-sdk/.verdaccio/config.yml
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
12 changes: 12 additions & 0 deletions tee-worker/omni-executor/client-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
![Logo](https://avatars.githubusercontent.com/u/51339301?s=200&v=4)

# 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.
5 changes: 5 additions & 0 deletions tee-worker/omni-executor/client-sdk/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions tee-worker/omni-executor/client-sdk/jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;

module.exports = { ...nxPreset };
55 changes: 55 additions & 0 deletions tee-worker/omni-executor/client-sdk/nx.json
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"
]
}
}
59 changes: 59 additions & 0 deletions tee-worker/omni-executor/client-sdk/package.json
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]"
}
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"
}
}
]
}
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 tee-worker/omni-executor/client-sdk/packages/chaindata/README.md
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}`);
```
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"
}
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": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit c776fda

Please sign in to comment.