Skip to content

Commit

Permalink
refactor!: move WalletConnect logic to dedicated subpath export
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Aug 4, 2024
1 parent a716a04 commit bd0ca32
Showing 13 changed files with 27 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-numbers-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reactive-dot/core": minor
---

**BREAKING**: move `WalletConnect` logic to dedicated subpath export.
6 changes: 2 additions & 4 deletions apps/docs/docs/getting-started/connect-wallets.mdx
Original file line number Diff line number Diff line change
@@ -45,10 +45,8 @@ 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,
WalletConnect,
} from "@reactive-dot/core/wallets.js";
import { InjectedWalletAggregator } from "@reactive-dot/core/wallets.js";
import { WalletConnect } from "@reactive-dot/core/wallets/wallet-connect.js";

export const config = {
// ...
6 changes: 2 additions & 4 deletions apps/example/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { kusama, polkadot, westend } from "@polkadot-api/descriptors";
import type { Config } from "@reactive-dot/core";
import {
InjectedWalletAggregator,
WalletConnect,
} from "@reactive-dot/core/wallets.js";
import { InjectedWalletAggregator } from "@reactive-dot/core/wallets.js";
import { WalletConnect } from "@reactive-dot/core/wallets/wallet-connect.js";
import { getSmProvider } from "polkadot-api/sm-provider";
import { startFromWorker } from "polkadot-api/smoldot/from-worker";

8 changes: 6 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -29,8 +29,12 @@
"default": "./build/index.js"
},
"./wallets.js": {
"default": "./build/wallets/index.js",
"types": "./src/wallets/index.ts"
"types": "./src/wallets/index.ts",
"default": "./build/wallets/index.js"
},
"./wallets/wallet-connect.js": {
"types": "./src/wallets/wallet-connect/index.ts",
"default": "./build/wallets/wallet-connect/index.js"
}
},
"scripts": {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Wallet } from "../wallet.js";
import type { Wallet } from "./wallet.js";
import type { Observable } from "rxjs";

export abstract class WalletAggregator {
2 changes: 0 additions & 2 deletions packages/core/src/wallets/aggregator/index.ts

This file was deleted.

File renamed without changes.
7 changes: 3 additions & 4 deletions packages/core/src/wallets/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from "./aggregator/index.js";
export { DeepLinkWallet } from "./deep-link.js";
export { WalletAggregator } from "./aggregator.js";
export { DeepLinkWallet } from "./deep-link-wallet.js";
export { initializeWallets } from "./initialize-wallets.js";
export { InjectedWallet } from "./injected.js";
export { WalletConnect } from "./wallet-connect/index.js";
export { InjectedWallet, InjectedWalletAggregator } from "./injected/index.js";
export { Wallet } from "./wallet.js";
2 changes: 1 addition & 1 deletion packages/core/src/wallets/initialize-wallets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WalletAggregator } from "./aggregator/index.js";
import { WalletAggregator } from "./aggregator.js";
import type { Wallet } from "./wallet.js";

export async function initializeWallets(
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InjectedWallet } from "../injected.js";
import { WalletAggregator } from "../aggregator.js";
import type { WalletOptions } from "../wallet.js";
import { WalletAggregator } from "./aggregator.js";
import { InjectedWallet } from "./wallet.js";
import { getInjectedExtensions } from "polkadot-api/pjs-signer";
import { BehaviorSubject } from "rxjs";
import { map } from "rxjs/operators";
2 changes: 2 additions & 0 deletions packages/core/src/wallets/injected/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./aggregator.js";
export * from "./wallet.js";
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReDotError } from "../errors.js";
import { Wallet, type WalletOptions } from "./wallet.js";
import { ReDotError } from "../../errors.js";
import { Wallet, type WalletOptions } from "../wallet.js";
import {
connectInjectedExtension,
type InjectedExtension,
2 changes: 1 addition & 1 deletion packages/core/src/wallets/wallet-connect/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReDotError } from "../../errors.js";
import { DeepLinkWallet } from "../deep-link.js";
import { DeepLinkWallet } from "../deep-link-wallet.js";
import { getPolkadotSignerFromPjs } from "./from-pjs-account.js";
import type {
WalletConnectModal,

0 comments on commit bd0ca32

Please sign in to comment.