Browse Source

refactor(angular): remove angular references

Daniel Marin 3 năm trước cách đây
mục cha
commit
a7aad1841e

+ 1 - 1
FAQ.md

@@ -34,7 +34,7 @@ Yes, see the [ant-design](https://github.com/solana-labs/wallet-adapter/tree/mas
 Yes, see the [vue](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/vue) package.
 
 ### Angular / RxJS
-Yes, see the [angular](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/angular) package.
+Yes, see the [angular](https://github.com/heavy-duty/platform/tree/master/libs/wallet-adapter) package.
 
 ### Webpack / Gatsby
 Yes, but you may need to set up polyfills for certain imported modules.

+ 1 - 1
README.md

@@ -150,7 +150,7 @@ These packages are what most projects can use to support wallets on Solana.
 | --------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
 | [base](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/base)          | Adapter interfaces, error types, and common utilities | [`@solana/wallet-adapter-base`](https://npmjs.com/package/@solana/wallet-adapter-base)         |
 | [react](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/react)        | Contexts and hooks for React dApps                    | [`@solana/wallet-adapter-react`](https://npmjs.com/package/@solana/wallet-adapter-react)       |
-| [angular](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/angular) \* | Stores and configuration for Angular dApps            | [`@solana/wallet-adapter-angular`](https://npmjs.com/package/@solana/wallet-adapter-angular)   |
+| [angular](https://github.com/heavy-duty/platform/tree/master/libs/wallet-adapter) \* | Stores and configuration for Angular dApps            | [`@heavy-duty/wallet-adapter`](https://www.npmjs.com/package/@heavy-duty/wallet-adapter)   |
 | [vue](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/vue)            | Stores and composables for Vue 3 dApps                | [`@solana/wallet-adapter-vue`](https://npmjs.com/package/@solana/wallet-adapter-vue)           |
 | [svelte](https://github.com/solana-labs/wallet-adapter/tree/master/packages/core/svelte) \*   | Stores for Svelte dApps                               | [`@solana/wallet-adapter-svelte`](https://www.npmjs.com/package/@solana/wallet-adapter-svelte) |
 

+ 0 - 1
packages/core/angular/.gitignore

@@ -1 +0,0 @@
-/lib

+ 0 - 1
packages/core/angular/.prettierignore

@@ -1 +0,0 @@
-/lib

+ 0 - 202
packages/core/angular/LICENSE

@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.

+ 0 - 1
packages/core/angular/README.md

@@ -1 +0,0 @@
-# @solana/wallet-adapter-angular

+ 0 - 31
packages/core/angular/angular.json

@@ -1,31 +0,0 @@
-{
-    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
-    "version": 1,
-    "newProjectRoot": ".",
-    "projects": {
-        "angular": {
-            "projectType": "library",
-            "root": ".",
-            "sourceRoot": "src",
-            "prefix": "lib",
-            "architect": {
-                "build": {
-                    "builder": "@angular-devkit/build-angular:ng-packagr",
-                    "options": {
-                        "project": "./ng-package.json"
-                    },
-                    "configurations": {
-                        "production": {
-                            "tsConfig": "./tsconfig.prod.json"
-                        },
-                        "development": {
-                            "tsConfig": "./tsconfig.json"
-                        }
-                    },
-                    "defaultConfiguration": "production"
-                }
-            }
-        }
-    },
-    "defaultProject": "angular"
-}

+ 0 - 13
packages/core/angular/ng-package.json

@@ -1,13 +0,0 @@
-{
-    "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
-    "dest": "./lib",
-    "lib": {
-        "entryFile": "src/index.ts",
-        "umdModuleIds": {
-            "@ngrx/component-store": "@ngrx/component-store",
-            "@solana/web3.js": "@solana/web3.js",
-            "@solana/wallet-adapter-base": "@solana/wallet-adapter-base"
-        }
-    },
-    "allowedNonPeerDependencies": ["."]
-}

+ 0 - 44
packages/core/angular/package.json

@@ -1,44 +0,0 @@
-{
-    "private": true,
-    "name": "@solana/wallet-adapter-angular",
-    "version": "0.1.0",
-    "author": "Solana Maintainers <maintainers@solana.foundation>",
-    "repository": "https://github.com/solana/wallet-adapter",
-    "license": "Apache-2.0",
-    "publishConfig": {
-        "access": "public"
-    },
-    "type": "module",
-    "sideEffects": false,
-    "main": "lib/bundles/solana-wallet-adapter-angular.umd.js",
-    "module": "lib/fesm2015/solana-wallet-adapter-angular.js",
-    "types": "lib/solana-wallet-adapter-angular.d.ts",
-    "es2015": "lib/fesm2015/solana-wallet-adapter-angular.js",
-    "esm2015": "lib/esm2015/solana-wallet-adapter-angular.js",
-    "fesm2015": "lib/fesm2015/solana-wallet-adapter-angular.js",
-    "files": [
-        "lib",
-        "src",
-        "LICENSE"
-    ],
-    "scripts": {
-        "clean": "shx rm -rf lib/*",
-        "build": "yarn clean && ng build angular --configuration=production"
-    },
-    "dependencies": {
-        "@angular/core": "^12.0.0",
-        "@ngrx/component-store": "^12.0.0",
-        "@solana/wallet-adapter-base": "^0.8.1",
-        "@solana/web3.js": "^1.20.0",
-        "tslib": "^2.3.0",
-        "rxjs": "^6.0.0"
-    },
-    "devDependencies": {
-        "@angular-devkit/build-angular": "^12.0.0",
-        "@angular/cli": "^12.0.0",
-        "@angular/compiler": "^12.0.0",
-        "@angular/compiler-cli": "^12.0.0",
-        "ng-packagr": "^12.0.0",
-        "typescript": "~4.4.4"
-    }
-}

+ 0 - 34
packages/core/angular/src/connection/connection.store.ts

@@ -1,34 +0,0 @@
-import { Inject, Injectable, Optional } from '@angular/core';
-import { ComponentStore } from '@ngrx/component-store';
-import { Connection, ConnectionConfig } from '@solana/web3.js';
-import { map } from 'rxjs/operators';
-
-import { CONNECTION_CONFIG } from './connection.tokens';
-import { ConnectionState } from './connection.types';
-
-export const CONNECTION_DEFAULT_CONFIG: ConnectionConfig = { commitment: 'confirmed' };
-
-@Injectable()
-export class ConnectionStore extends ComponentStore<ConnectionState> {
-    connection$ = this.state$.pipe(map((state) => state.connection));
-
-    constructor(
-        @Optional()
-        @Inject(CONNECTION_CONFIG)
-        private _config: ConnectionConfig
-    ) {
-        super();
-
-        this._config = {
-            ...CONNECTION_DEFAULT_CONFIG,
-            ...this._config,
-        };
-
-        this.setState({ connection: null });
-    }
-
-    readonly setEndpoint = this.updater((state, endpoint: string) => ({
-        ...state,
-        connection: new Connection(endpoint, this._config),
-    }));
-}

+ 0 - 4
packages/core/angular/src/connection/connection.tokens.ts

@@ -1,4 +0,0 @@
-import { InjectionToken } from '@angular/core';
-import { ConnectionConfig } from '@solana/web3.js';
-
-export const CONNECTION_CONFIG = new InjectionToken<ConnectionConfig>('connectionConfig');

+ 0 - 5
packages/core/angular/src/connection/connection.types.ts

@@ -1,5 +0,0 @@
-import { Connection } from '@solana/web3.js';
-
-export interface ConnectionState {
-    connection: Connection | null;
-}

+ 0 - 3
packages/core/angular/src/connection/index.ts

@@ -1,3 +0,0 @@
-export * from './connection.tokens';
-export * from './connection.store';
-export * from './connection.types';

+ 0 - 2
packages/core/angular/src/index.ts

@@ -1,2 +0,0 @@
-export * from './connection';
-export * from './wallet';

+ 0 - 8
packages/core/angular/src/operators/from-adapter-event.ts

@@ -1,8 +0,0 @@
-import { WalletAdapter, WalletAdapterEvents } from '@solana/wallet-adapter-base';
-import { fromEventPattern, Observable } from 'rxjs';
-
-export const fromAdapterEvent = <T>(adapter: WalletAdapter, eventName: keyof WalletAdapterEvents): Observable<T> =>
-    fromEventPattern(
-        (addHandler) => adapter.on(eventName, addHandler),
-        (removeHandler) => adapter.off(eventName, removeHandler)
-    );

+ 0 - 2
packages/core/angular/src/operators/index.ts

@@ -1,2 +0,0 @@
-export * from './from-adapter-event';
-export * from './not-null';

+ 0 - 5
packages/core/angular/src/operators/not-null.ts

@@ -1,5 +0,0 @@
-import { Observable } from 'rxjs';
-import { filter } from 'rxjs/operators';
-
-export const isNotNull = <T>(source: Observable<T | null>): Observable<T> =>
-    source.pipe(filter((item: T | null): item is T => item !== null));

+ 0 - 4
packages/core/angular/src/wallet/index.ts

@@ -1,4 +0,0 @@
-export * from './wallet.errors';
-export * from './wallet.tokens';
-export * from './wallet.types';
-export * from './wallet.store';

+ 0 - 41
packages/core/angular/src/wallet/local-storage.ts

@@ -1,41 +0,0 @@
-export class LocalStorageService<T> {
-    private _value = this._defaultValue;
-
-    constructor(private _key: string, private _defaultValue: T) {}
-
-    get value(): T {
-        if (this._value) return this._value;
-
-        try {
-            const value = localStorage.getItem(this._key);
-            if (value) {
-                this._value = JSON.parse(value) as T;
-                return this._value;
-            }
-        } catch (error) {
-            if (typeof window !== 'undefined') {
-                console.error(error);
-            }
-        }
-
-        return this._defaultValue;
-    }
-
-    setItem(newValue: T): void {
-        if (newValue === this.value) return;
-
-        this._value = newValue;
-
-        try {
-            if (newValue === null) {
-                localStorage.removeItem(this._key);
-            } else {
-                localStorage.setItem(this._key, JSON.stringify(newValue));
-            }
-        } catch (error) {
-            if (typeof window !== 'undefined') {
-                console.error(error);
-            }
-        }
-    }
-}

+ 0 - 5
packages/core/angular/src/wallet/wallet.errors.ts

@@ -1,5 +0,0 @@
-import { WalletError } from '@solana/wallet-adapter-base';
-
-export class WalletNotSelectedError extends WalletError {
-    name = 'WalletNotSelectedError';
-}

+ 0 - 51
packages/core/angular/src/wallet/wallet.signer.ts

@@ -1,51 +0,0 @@
-import { MessageSignerWalletAdapter, SignerWalletAdapter, WalletNotConnectedError } from '@solana/wallet-adapter-base';
-import { Transaction } from '@solana/web3.js';
-import { defer, from, Observable, Subject, throwError } from 'rxjs';
-
-export const signMessage = (
-    adapter: MessageSignerWalletAdapter,
-    connected: boolean,
-    errorSubject: Subject<unknown>
-): ((message: Uint8Array) => Observable<Uint8Array>) => {
-    return (message: Uint8Array) => {
-        if (!connected) {
-            const error = new WalletNotConnectedError();
-            errorSubject.next(error);
-            return throwError(error);
-        }
-
-        return from(defer(() => adapter.signMessage(message)));
-    };
-};
-
-export const signTransaction = (
-    adapter: SignerWalletAdapter,
-    connected: boolean,
-    errorSubject: Subject<unknown>
-): ((transaction: Transaction) => Observable<Transaction>) => {
-    return (transaction: Transaction) => {
-        if (!connected) {
-            const error = new WalletNotConnectedError();
-            errorSubject.next(error);
-            return throwError(error);
-        }
-
-        return from(defer(() => adapter.signTransaction(transaction)));
-    };
-};
-
-export const signAllTransactions = (
-    adapter: SignerWalletAdapter,
-    connected: boolean,
-    errorSubject: Subject<unknown>
-): ((transactions: Transaction[]) => Observable<Transaction[]>) => {
-    return (transactions: Transaction[]) => {
-        if (!connected) {
-            const error = new WalletNotConnectedError();
-            errorSubject.next(error);
-            return throwError(error);
-        }
-
-        return from(defer(() => adapter.signAllTransactions(transactions)));
-    };
-};

+ 0 - 336
packages/core/angular/src/wallet/wallet.store.ts

@@ -1,336 +0,0 @@
-import { Inject, Injectable, Optional } from '@angular/core';
-import { ComponentStore } from '@ngrx/component-store';
-import {
-    Adapter,
-    SendTransactionOptions,
-    Wallet,
-    WalletName,
-    WalletNotConnectedError,
-    WalletNotReadyError,
-} from '@solana/wallet-adapter-base';
-import { Connection, PublicKey, Transaction } from '@solana/web3.js';
-import { combineLatest, defer, EMPTY, from, Observable, of, Subject, throwError } from 'rxjs';
-import { catchError, concatMap, filter, finalize, first, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
-
-import { fromAdapterEvent, isNotNull } from '../operators';
-import { LocalStorageService } from './local-storage';
-import { WalletNotSelectedError } from './wallet.errors';
-import { signAllTransactions, signMessage, signTransaction } from './wallet.signer';
-import { WALLET_CONFIG } from './wallet.tokens';
-import { WalletConfig, WalletState } from './wallet.types';
-
-export const WALLET_DEFAULT_CONFIG: WalletConfig = {
-    wallets: [],
-    autoConnect: false,
-    localStorageKey: 'walletName',
-};
-
-const initialState: {
-    wallet: Wallet | null;
-    adapter: Adapter | null;
-    ready: boolean;
-    connected: boolean;
-    publicKey: PublicKey | null;
-} = {
-    wallet: null,
-    adapter: null,
-    ready: false,
-    connected: false,
-    publicKey: null,
-};
-
-@Injectable()
-export class WalletStore extends ComponentStore<WalletState> {
-    private readonly _error = new Subject();
-    private readonly _localStorage = new LocalStorageService<WalletName | null>(
-        this._config?.localStorageKey || 'walletName',
-        null
-    );
-    readonly wallets$ = this.select((state) => state.wallets);
-    readonly autoConnect$ = this.select((state) => state.autoConnect);
-    readonly wallet$ = this.select((state) => state.wallet);
-    readonly adapter$ = this.select((state) => state.adapter);
-    readonly publicKey$ = this.select((state) => state.publicKey);
-    readonly ready$ = this.select((state) => state.ready);
-    readonly connecting$ = this.select((state) => state.connecting);
-    readonly disconnecting$ = this.select((state) => state.disconnecting);
-    readonly connected$ = this.select((state) => state.connected);
-    readonly name$ = this.select((state) => state.name);
-    readonly error$ = this._error.asObservable();
-    readonly anchorWallet$ = this.select(
-        this.publicKey$,
-        this.adapter$,
-        this.connected$,
-        (publicKey, adapter, connected) => {
-            const adapterSignTransaction =
-                adapter && 'signTransaction' in adapter ? signTransaction(adapter, connected, this._error) : undefined;
-            const adapterSignAllTransactions =
-                adapter && 'signAllTransactions' in adapter
-                    ? signAllTransactions(adapter, connected, this._error)
-                    : undefined;
-
-            return publicKey && adapterSignTransaction && adapterSignAllTransactions
-                ? {
-                      publicKey,
-                      signTransaction: (transaction: Transaction) => adapterSignTransaction(transaction).toPromise(),
-                      signAllTransactions: (transactions: Transaction[]) =>
-                          adapterSignAllTransactions(transactions).toPromise(),
-                  }
-                : undefined;
-        },
-        { debounce: true }
-    );
-
-    // Map of wallet names to wallets
-    private readonly _walletsByName$ = this.select(this.wallets$, (wallets) =>
-        wallets.reduce<Record<WalletName, Wallet>>((walletsByName, wallet) => {
-            walletsByName[wallet.name] = wallet;
-            return walletsByName;
-        }, {})
-    );
-
-    constructor(
-        @Optional()
-        @Inject(WALLET_CONFIG)
-        private _config: WalletConfig
-    ) {
-        super();
-
-        this._config = {
-            ...WALLET_DEFAULT_CONFIG,
-            ...this._config,
-        };
-
-        this.setState({
-            ...initialState,
-            wallets: this._config?.wallets || [],
-            name: this._localStorage.value,
-            connecting: false,
-            disconnecting: false,
-            autoConnect: this._config?.autoConnect || false,
-        });
-    }
-
-    // When the selected wallet changes, initialize the state
-    readonly onWalletChanged = this.effect(() =>
-        combineLatest([this.name$, this._walletsByName$]).pipe(
-            tap(([name, walletsByName]) => {
-                const wallet = (name && walletsByName[name]) || null;
-                const adapter = wallet && wallet.adapter;
-
-                if (adapter) {
-                    const { publicKey, connected } = adapter;
-                    this.patchState({
-                        name,
-                        adapter,
-                        wallet,
-                        publicKey,
-                        connected,
-                        ready: false,
-                    });
-
-                    // FIXME: Asynchronously update the ready state
-                } else {
-                    this.patchState(initialState);
-                }
-            })
-        )
-    );
-
-    // If autoConnect is enabled, try to connect when the adapter changes and is ready
-    readonly autoConnect = this.effect(() => {
-        return combineLatest([
-            this.autoConnect$,
-            this.adapter$.pipe(isNotNull),
-            this.ready$,
-            this.connecting$,
-            this.connected$,
-        ]).pipe(
-            filter(
-                ([autoConnect, , ready, connecting, connected]) => autoConnect && ready && !connecting && !connected
-            ),
-            concatMap(([, adapter]) => {
-                this.patchState({ connecting: true });
-                return from(defer(() => adapter.connect())).pipe(
-                    catchError(() => {
-                        // Clear the selected wallet
-                        this.patchState({ name: null });
-                        // Don't throw error, but onError will still be called
-                        return of(null);
-                    }),
-                    finalize(() => this.patchState({ connecting: false }))
-                );
-            })
-        );
-    });
-
-    // Select a wallet by name
-    readonly selectWallet = this.effect((newName$: Observable<WalletName | null>) => {
-        return newName$.pipe(
-            concatMap((action) => of(action).pipe(withLatestFrom(this.name$, this.adapter$))),
-            filter(([newName, name]) => newName !== name),
-            concatMap(([newName, , adapter]) => {
-                if (!adapter) {
-                    return of(newName);
-                } else {
-                    return from(defer(() => adapter.disconnect())).pipe(map(() => newName));
-                }
-            }),
-            tap((newName) => {
-                this._localStorage.setItem(newName);
-                this.patchState({ name: newName });
-            })
-        );
-    });
-
-    // Handle the adapter's connect event
-    readonly onConnect = this.effect(() => {
-        return this.adapter$.pipe(
-            isNotNull,
-            switchMap((adapter) =>
-                fromAdapterEvent(adapter, 'connect').pipe(
-                    tap(() => {
-                        const { connected, publicKey } = adapter;
-
-                        this.patchState({
-                            connected,
-                            publicKey,
-                        });
-                    })
-                )
-            )
-        );
-    });
-
-    // Handle the adapter's disconnect event
-    readonly onDisconnect = this.effect(() => {
-        return this.adapter$.pipe(
-            isNotNull,
-            switchMap((adapter) =>
-                fromAdapterEvent(adapter, 'disconnect').pipe(tap(() => this.patchState({ name: null })))
-            )
-        );
-    });
-
-    // Handle the adapter's error event
-    readonly onError = this.effect(() => {
-        return this.adapter$.pipe(
-            isNotNull,
-            switchMap((adapter) => fromAdapterEvent(adapter, 'error').pipe(tap((error) => this._error.next(error))))
-        );
-    });
-
-    // Connect the adapter to the wallet
-    connect(): Observable<void> {
-        return combineLatest([
-            this.connecting$,
-            this.disconnecting$,
-            this.connected$,
-            this.wallet$,
-            this.adapter$,
-            this.ready$,
-        ]).pipe(
-            first(),
-            filter(([connecting, disconnecting, connected]) => !connected && !connecting && !disconnecting),
-            concatMap(([, , , wallet, adapter, ready]) => {
-                if (!wallet || !adapter) {
-                    const error = new WalletNotSelectedError();
-                    this._error.next(error);
-                    return throwError(error);
-                }
-
-                if (!ready) {
-                    this.patchState({ name: null });
-
-                    if (typeof window !== 'undefined') {
-                        window.open(wallet.url, '_blank');
-                    }
-
-                    const error = new WalletNotReadyError();
-                    this._error.next(error);
-                    return throwError(error);
-                }
-
-                this.patchState({ connecting: true });
-
-                return from(defer(() => adapter.connect())).pipe(
-                    catchError((error) => {
-                        this.patchState({ name: null });
-                        return throwError(error);
-                    }),
-                    finalize(() => this.patchState({ connecting: false }))
-                );
-            })
-        );
-    }
-
-    // Disconnect the adapter from the wallet
-    disconnect(): Observable<void> {
-        return combineLatest([this.disconnecting$, this.adapter$]).pipe(
-            first(),
-            filter(([disconnecting]) => !disconnecting),
-            concatMap(([, adapter]) => {
-                if (!adapter) {
-                    this.patchState({ name: null });
-                    return EMPTY;
-                } else {
-                    this.patchState({ disconnecting: true });
-                    return from(defer(() => adapter.disconnect())).pipe(
-                        finalize(() => this.patchState({ disconnecting: false, name: null }))
-                    );
-                }
-            })
-        );
-    }
-
-    // Send a transaction using the provided connection
-    sendTransaction(
-        transaction: Transaction,
-        connection: Connection,
-        options?: SendTransactionOptions
-    ): Observable<string> {
-        return combineLatest([this.adapter$, this.connected$]).pipe(
-            first(),
-            concatMap(([adapter, connected]) => {
-                if (!adapter) {
-                    const error = new WalletNotSelectedError();
-                    this._error.next(error);
-                    return throwError(error);
-                }
-
-                if (!connected) {
-                    const error = new WalletNotConnectedError();
-                    this._error.next(error);
-                    return throwError(error);
-                }
-
-                return from(defer(() => adapter.sendTransaction(transaction, connection, options)));
-            })
-        );
-    }
-
-    // Sign a transaction if the wallet supports it
-    signTransaction(transaction: Transaction): Observable<Transaction> | undefined {
-        const { adapter, connected } = this.get();
-
-        return adapter && 'signTransaction' in adapter
-            ? signTransaction(adapter, connected, this._error)(transaction)
-            : undefined;
-    }
-
-    // Sign multiple transactions if the wallet supports it
-    signAllTransactions(transactions: Transaction[]): Observable<Transaction[]> | undefined {
-        const { adapter, connected } = this.get();
-
-        return adapter && 'signAllTransactions' in adapter
-            ? signAllTransactions(adapter, connected, this._error)(transactions)
-            : undefined;
-    }
-
-    // Sign an arbitrary message if the wallet supports it
-    signMessage(message: Uint8Array): Observable<Uint8Array> | undefined {
-        const { adapter, connected } = this.get();
-
-        return adapter && 'signMessage' in adapter ? signMessage(adapter, connected, this._error)(message) : undefined;
-    }
-}

+ 0 - 5
packages/core/angular/src/wallet/wallet.tokens.ts

@@ -1,5 +0,0 @@
-import { InjectionToken } from '@angular/core';
-
-import { WalletConfig } from './wallet.types';
-
-export const WALLET_CONFIG = new InjectionToken<WalletConfig>('walletConfig');

+ 0 - 22
packages/core/angular/src/wallet/wallet.types.ts

@@ -1,22 +0,0 @@
-import { Adapter, Wallet, WalletName } from '@solana/wallet-adapter-base';
-import { PublicKey } from '@solana/web3.js';
-
-export interface WalletState {
-    wallets: Wallet[];
-    name: WalletName | null;
-    wallet: Wallet | null;
-    adapter: Adapter | null;
-    connecting: boolean;
-    disconnecting: boolean;
-    connected: boolean;
-    ready: boolean;
-    publicKey: PublicKey | null;
-    autoConnect: boolean;
-}
-
-export interface WalletConfig {
-    wallets: Wallet[];
-    localStorageKey?: string;
-    autoConnect?: boolean;
-    onError?: (error: unknown) => void;
-}

+ 0 - 32
packages/core/angular/tsconfig.json

@@ -1,32 +0,0 @@
-/* To learn more about this file see: https://angular.io/config/tsconfig. */
-{
-    "compileOnSave": false,
-    "compilerOptions": {
-        "baseUrl": "./",
-        "forceConsistentCasingInFileNames": true,
-        "strict": true,
-        "noImplicitReturns": true,
-        "noFallthroughCasesInSwitch": true,
-        "sourceMap": true,
-        "downlevelIteration": true,
-        "experimentalDecorators": true,
-        "moduleResolution": "node",
-        "importHelpers": true,
-        "module": "es2020",
-        "outDir": "lib",
-        "target": "es2015",
-        "declaration": true,
-        "declarationMap": true,
-        "inlineSources": true,
-        "types": [],
-        "lib": ["dom", "es2018"],
-        "allowSyntheticDefaultImports": true
-    },
-    "angularCompilerOptions": {
-        "disableTypeScriptVersionCheck": true,
-        "enableI18nLegacyMessageIdFormat": false,
-        "strictInjectionParameters": true,
-        "strictInputAccessModifiers": true,
-        "strictTemplates": true
-    }
-}

+ 0 - 10
packages/core/angular/tsconfig.prod.json

@@ -1,10 +0,0 @@
-/* To learn more about this file see: https://angular.io/config/tsconfig. */
-{
-    "extends": "./tsconfig.json",
-    "compilerOptions": {
-        "declarationMap": false
-    },
-    "angularCompilerOptions": {
-        "compilationMode": "partial"
-    }
-}