Skip to content

Commit

Permalink
refactor!: move WalletConnect adapter to a standalone package (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Sep 9, 2024
1 parent 179402e commit 21ec7d1
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 90 deletions.
6 changes: 6 additions & 0 deletions .changeset/curly-walls-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reactive-dot/wallet-walletconnect": minor
"@reactive-dot/core": minor
---

BREAKING: Moved WalletConnect adapter to a standalone package.
8 changes: 4 additions & 4 deletions apps/docs/docs/getting-started/connect-wallets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ Additional dependencies are required if you use any of be bellow wallet type.
<Tabs>
<TabItem value="npm" label="npm" default>
```sh
npm add @walletconnect/modal @walletconnect/universal-provider
npm add @reactive-dot/wallet-walletconnect
```
</TabItem>
<TabItem value="yarn" label="yarn">
```sh
yarn add @walletconnect/modal @walletconnect/universal-provider
yarn add @reactive-dot/wallet-walletconnect
```
</TabItem>
<TabItem value="pnpm" label="pnpm">
```sh
pnpm add @walletconnect/modal @walletconnect/universal-provider
pnpm add @reactive-dot/wallet-walletconnect
```
</TabItem>
</Tabs>
Expand All @@ -46,7 +46,7 @@ Additional dependencies are required if you use any of be bellow wallet type.
```ts title="config.ts"
import type { Config } from "@reactive-dot/core";
import { InjectedWalletAggregator } from "@reactive-dot/core/wallets.js";
import { WalletConnect } from "@reactive-dot/core/wallets/wallet-connect.js";
import { WalletConnect } from "@reactive-dot/wallet-walletconnect";

export const config = {
// ...
Expand Down
3 changes: 1 addition & 2 deletions apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"dependencies": {
"@polkadot-api/descriptors": "portal:.papi/descriptors",
"@reactive-dot/react": "workspace:^",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/universal-provider": "^2.14.0",
"@reactive-dot/wallet-walletconnect": "workspace:^",
"date-fns": "^3.6.0",
"jotai-devtools": "^0.10.1",
"polkadot-api": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/example/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { kusama, polkadot, westend } from "@polkadot-api/descriptors";
import type { Config } from "@reactive-dot/core";
import { InjectedWalletAggregator } from "@reactive-dot/core/wallets.js";
import { WalletConnect } from "@reactive-dot/core/wallets/wallet-connect.js";
import { WalletConnect } from "@reactive-dot/wallet-walletconnect";
import { getSmProvider } from "polkadot-api/sm-provider";
import { startFromWorker } from "polkadot-api/smoldot/from-worker";

Expand Down
15 changes: 1 addition & 14 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
],
"exports": {
".": "./build/index.js",
"./wallets.js": "./build/wallets/index.js",
"./wallets/wallet-connect.js": "./build/wallets/wallet-connect/index.js"
"./wallets.js": "./build/wallets/index.js"
},
"scripts": {
"dev": "tsc --build --watch",
Expand All @@ -40,23 +39,11 @@
"@reactive-dot/eslint-config": "workspace:^",
"@tsconfig/recommended": "^1.0.7",
"@tsconfig/strictest": "^2.0.5",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/universal-provider": "^2.14.0",
"eslint": "^9.10.0",
"polkadot-api": "^1.2.0",
"typescript": "^5.5.4"
},
"peerDependencies": {
"@walletconnect/modal": "2.x",
"@walletconnect/universal-provider": "2.x",
"polkadot-api": "1.x"
},
"peerDependenciesMeta": {
"@walletconnect/modal": {
"optional": true
},
"@walletconnect/universal-provider": {
"optional": true
}
}
}
1 change: 0 additions & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"jsx": "react-jsx",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
Expand Down
1 change: 1 addition & 0 deletions packages/wallet-walletconnect/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
4 changes: 4 additions & 0 deletions packages/wallet-walletconnect/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import recommended from "@reactive-dot/eslint-config";
import tseslint from "typescript-eslint";

export default tseslint.config(...recommended);
48 changes: 48 additions & 0 deletions packages/wallet-walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@reactive-dot/wallet-walletconnect",
"version": "0.0.0",
"description": "WalletConnect adapter for Reactive DOT",
"keywords": [
"substrate",
"polkadot",
"WalletConnect"
],
"homepage": "https://reactivedot.dev/",
"bugs": {
"url": "https://github.com/tien/reactive-dot/issues",
"email": "[email protected]"
},
"license": "LGPL-3.0-or-later",
"author": "Tiến Nguyễn Khắc <[email protected]> (https://tien.zone/)",
"repository": {
"type": "git",
"url": "https://github.com/tien/reactive-dot.git",
"directory": "packages/wallet-walletconnect"
},
"type": "module",
"files": [
"src",
"build"
],
"exports": "./build/index.js",
"scripts": {
"dev": "tsc --build --watch",
"build": "rm -rf build && tsc --build",
"lint": "eslint src"
},
"dependencies": {
"@walletconnect/modal": "^2.6.2",
"@walletconnect/universal-provider": "^2.16.1"
},
"devDependencies": {
"@reactive-dot/core": "workspace:^",
"@reactive-dot/eslint-config": "workspace:^",
"@tsconfig/recommended": "^1.0.7",
"@tsconfig/strictest": "^2.0.5",
"eslint": "^9.10.0",
"typescript": "^5.5.4"
},
"peerDependencies": {
"@reactive-dot/core": "workspace:^"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReDotError } from "../../errors.js";
import { DeepLinkWallet } from "../deep-link-wallet.js";
import { getPolkadotSignerFromPjs } from "./from-pjs-account.js";
import { ReDotError } from "@reactive-dot/core";
import { DeepLinkWallet } from "@reactive-dot/core/wallets.js";
import type {
WalletConnectModal,
WalletConnectModalConfig,
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions packages/wallet-walletconnect/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": [
"@tsconfig/recommended/tsconfig.json",
"@tsconfig/strictest/tsconfig.json"
],
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "build"
},
"include": ["src"]
}
Loading

0 comments on commit 21ec7d1

Please sign in to comment.