Skip to content

Commit

Permalink
SDKs (#776)
Browse files Browse the repository at this point in the history
* Create sdk-core package

* Private sdk-core

* LnBridge

* Improve ln-bridge

* Sdk indexer and lnv2 lnv3

* Pass relayer from relayInfo

* Improve lnv2-default bridge

* Improve lnv2-opposite bridge

* Improve ln-bridge

* Transfer test

* Setup jest forceExit

* Beta

* Fix example

* Add comments

* Rename the directory names of eslint and ts config packages

* Hook useCurrentlyAvailableCrossChain

* Add library eslint config

* Change indexer to be non-private

* Update indexer dependencies

* Change sdk-core to be non-private

* Create changeset
  • Loading branch information
JayJay1024 authored Nov 29, 2024
1 parent 8bf0358 commit 785f040
Show file tree
Hide file tree
Showing 99 changed files with 9,777 additions and 3,271 deletions.
6 changes: 6 additions & 0 deletions .changeset/lucky-forks-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@helixbridge/sdk-indexer": minor
"@helixbridge/sdk-core": minor
---

Release sdk-indexer and sdk-core
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
{
"mode": "auto"
}
]
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
14 changes: 8 additions & 6 deletions apps/helixbox-app/src/providers/walletconnect-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { PropsWithChildren } from "react";
import { getChainConfigs } from "../utils";
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
import { CaipNetwork, createAppKit } from "@reown/appkit/react";
import { createAppKit } from "@reown/appkit/react";
import { WagmiProvider } from "wagmi";
import { AppKitNetwork } from "@reown/appkit/networks";

// 0. Setup queryClient
const queryClient = new QueryClient();
Expand All @@ -21,28 +22,29 @@ const metadata = {

// 3. Set the networks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const networks: CaipNetwork[] = getChainConfigs().map(({ tokens, ...chain }) => ({
const networks = getChainConfigs().map(({ tokens, ...chain }) => ({
id: `eip155:${chain.id}`,
caipNetworkId: `eip155:${chain.id}`,
chainId: chain.id,
chainNamespace: "eip155",
name: chain.name,
currency: chain.nativeCurrency.symbol,
nativeCurrency: chain.nativeCurrency,
explorerUrl: chain.blockExplorers?.default?.url || "",
rpcUrl: chain.rpcUrls.default.http[0],
rpcUrls: chain.rpcUrls,
imageUrl: chain.logo,
}));

// 4. Create Wagmi Adapter
const wagmiAdapter = new WagmiAdapter({
networks,
networks: networks as AppKitNetwork[],
projectId,
ssr: false,
});

// 5. Create modal
createAppKit({
adapters: [wagmiAdapter],
networks,
networks: networks as unknown as [AppKitNetwork, ...AppKitNetwork[]],
projectId,
metadata,
features: {
Expand Down
24 changes: 24 additions & 0 deletions apps/sdks-playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
50 changes: 50 additions & 0 deletions apps/sdks-playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
25 changes: 25 additions & 0 deletions apps/sdks-playground/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
},
);
13 changes: 13 additions & 0 deletions apps/sdks-playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
34 changes: 34 additions & 0 deletions apps/sdks-playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "sdks-playground",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "echo 'build'",
"build2": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@helixbridge/chains": "workspace:*",
"@helixbridge/sdk-bridge": "workspace:*",
"@helixbridge/sdk-indexer": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.21.19"
},
"devDependencies": {
"@eslint/js": "^9.13.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"globals": "^15.11.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.10"
}
}
1 change: 1 addition & 0 deletions apps/sdks-playground/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions apps/sdks-playground/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
Loading

0 comments on commit 785f040

Please sign in to comment.