Skip to content

Commit

Permalink
Initial configurations for integration
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 20, 2023
1 parent 5a7cd0c commit 506f5fa
Show file tree
Hide file tree
Showing 10 changed files with 1,640 additions and 32 deletions.
1 change: 1 addition & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// module.exports = require('@open-web3/dev-config/config/babel-config-cjs.cjs');
1 change: 0 additions & 1 deletion babel.config.js

This file was deleted.

27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
"name": "@polkawallet/bridge",
"version": "0.1.5-20",
"description": "polkawallet bridge sdk",
"main": "index.js",
"types": "index.d.ts",
"author": "Polkawallet developers <[email protected]>",
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"yarn": "^1.10.1"
},
Expand All @@ -17,8 +29,9 @@
"repository": "https://github.com/polkawallet-io/bridge.git",
"homepage": "https://github.com/polkawallet-io/bridge",
"scripts": {
"clain": "rm -rf build",
"clain": "rm -r build",
"build": "tsc",
"build2": "rollup -c",
"test": "jest --runInBand --detectOpenHandles --forceExit",
"lint": "polkadot-dev-run-lint",
"build:docs": "ts-node ./scripts/generate-bridge-document.ts",
Expand Down Expand Up @@ -49,11 +62,19 @@
},
"devDependencies": {
"@acala-network/eth-providers": "^2.7.1",
"@babel/plugin-syntax-import-assertions": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@open-web3/dev-config": "^0.2.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^28.1.1",
"@types/lodash": "^4.14.161",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^28.1.1",
"rollup": "^4.9.1",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "^4.7.4"
},
"stableVersion": "0.1.5-19"
Expand Down
29 changes: 29 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import typescript from 'rollup-plugin-typescript2'
import babel from '@rollup/plugin-babel';
import json from '@rollup/plugin-json';
import dts from 'rollup-plugin-dts';

export default [
{
input: './src/index.ts', // Your main TypeScript file
output: [
{ file: './dist/index.cjs', format: 'cjs' },
{ file: './dist/index.mjs', format: 'es' }
],
plugins: [
json(),
typescript(), // Compile TypeScript files
babel({
plugins: ['@babel/plugin-syntax-import-assertions'],
babelHelpers: 'bundled',
presets: ['@babel/preset-env'],
extensions: ['.js', '.ts'],
}),
],
},
{
input: 'src/index.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts()],
},
];
28 changes: 27 additions & 1 deletion src/adapters/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
export * from "./";
export * from "./acala";
export * from "./astar";
export * from "./bifrost";
export * from "./darwinia";
export * from "./centrifuge";
export * from "./crust";
export * from "./hydradx";
export * from "./polkadot";
export * from "./integritee";
export * from "./interlay";
export * from "./kico";
export * from "./kylin";
export * from "./listen";
export * from "./mangata";
export * from "./manta";
export * from "./moonbeam";
export * from "./phala";
export * from "./oak";
export * from "./parallel";
export * from "./phala";
export * from "./robonomics";
export * from "./statemint";
export * from "./tinkernet";
export * from "./unique";
export * from "./zeitgeist";


76 changes: 76 additions & 0 deletions src/custom-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { ListenAdapter, KicoAdapter, KaruraAdapter, ShidenAdapter, BifrostAdapter, AltairAdapter, ShadowAdapter, CrabAdapter, BasiliskAdapter, IntegriteeAdapter, KintsugiAdapter, PichiuAdapter, MangataAdapter, CalamariAdapter, MoonriverAdapter, TuringAdapter, HeikoAdapter, KhalaAdapter, KusamaAdapter, RobonomicsAdapter, StatemineAdapter, TinkernetAdapter, QuartzAdapter} from './adapters/index'

export function getAdapter(paraId: number){
if(paraId == 0){
return new KusamaAdapter()
}

if(paraId == 1000){
return new StatemineAdapter()
}
if(paraId == 2001){
return new BifrostAdapter()
}
if(paraId == 2000){
return new KaruraAdapter()
}
if(paraId == 2004){
return new KhalaAdapter()
}
if(paraId == 2095){
return new QuartzAdapter()
}
if(paraId == 2092){
return new KintsugiAdapter()
}
if(paraId == 2023){
return new MoonriverAdapter()
}
if(paraId == 2085){
return new HeikoAdapter()
}
if(paraId == 2107){
return new KicoAdapter()
}
if(paraId == 2012){
return new ShadowAdapter()
}
if(paraId == 2084){
return new CalamariAdapter()
}
if(paraId == 2015){
return new IntegriteeAdapter()
}
if(paraId == 2088){
return new AltairAdapter()
}
if(paraId == 2105){
return new CrabAdapter()
}
if(paraId == 2114){
return new TuringAdapter()
}
if(paraId == 2007){
return new ShidenAdapter()
}
if(paraId == 2102){
return new PichiuAdapter()
}
if(paraId == 2090){
return new BasiliskAdapter()
}
if(paraId == 2118){
return new ListenAdapter()
}

if(paraId == 2048){
return new RobonomicsAdapter()
}
if(paraId == 2125){
return new TinkernetAdapter()
}
if(paraId == 2110){
return new MangataAdapter()
}
throw new Error("No adapter for paraId " + paraId)
}
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ export * from "./api-provider";
export * from "./adapters";
export * from "./configs/index";
export * from "./types";
export * from "./errors";
export * from "./utils/index";
export * from "./custom-utils";
13 changes: 6 additions & 7 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"emitDeclarationOnly": false,
"outDir": "build",
"typeRoots": ["./node_modules/@polkadot/ts", "./node_modules/@types"],
"jsx": "preserve",
"declaration": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true
}
"experimentalDecorators": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
},
"include": ["src"],
}
18 changes: 8 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{

"exclude": ["build/**/*", "**/build/**/*", "scripts/**/*", "docs/**/*", "**/*.spec.ts"],
"compilerOptions": {
"target": "es2019",
"module": "CommonJS",
"target": "es2015",
"module": "esnext",
"baseUrl": ".",
"resolveJsonModule": true,
"skipLibCheck": true,
"emitDeclarationOnly": false,
"outDir": "build",
"typeRoots": ["./node_modules/@polkadot/ts", "./node_modules/@types"],
"jsx": "preserve",
"declaration": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true
}
"experimentalDecorators": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"strict": true,
},
"include": ["src"]
}
Loading

0 comments on commit 506f5fa

Please sign in to comment.