From 066b667c46a356eb4eaf68afa693ba65ca095111 Mon Sep 17 00:00:00 2001 From: gabrielkerekes Date: Thu, 17 Aug 2023 17:15:50 +0200 Subject: [PATCH] Add Trezor wallet adapter --- PACKAGES.md | 3 +- packages/wallets/trezor/CHANGELOG.md | 7 + packages/wallets/trezor/LICENSE | 202 ++++++++++ packages/wallets/trezor/README.md | 5 + packages/wallets/trezor/package.json | 46 +++ packages/wallets/trezor/src/adapter.ts | 169 ++++++++ packages/wallets/trezor/src/index.ts | 1 + packages/wallets/trezor/tsconfig.cjs.json | 7 + packages/wallets/trezor/tsconfig.esm.json | 8 + packages/wallets/trezor/tsconfig.json | 11 + packages/wallets/wallets/package.json | 1 + packages/wallets/wallets/src/index.ts | 1 + pnpm-lock.yaml | 468 ++++++++++++++++++++++ tsconfig.base.json | 3 +- 14 files changed, 930 insertions(+), 2 deletions(-) create mode 100644 packages/wallets/trezor/CHANGELOG.md create mode 100644 packages/wallets/trezor/LICENSE create mode 100644 packages/wallets/trezor/README.md create mode 100644 packages/wallets/trezor/package.json create mode 100644 packages/wallets/trezor/src/adapter.ts create mode 100644 packages/wallets/trezor/src/index.ts create mode 100644 packages/wallets/trezor/tsconfig.cjs.json create mode 100644 packages/wallets/trezor/tsconfig.esm.json create mode 100644 packages/wallets/trezor/tsconfig.json diff --git a/PACKAGES.md b/PACKAGES.md index 75fb6c40c..b7b1eccc1 100644 --- a/PACKAGES.md +++ b/PACKAGES.md @@ -67,7 +67,8 @@ You can use the [wallets](https://github.com/solana-labs/wallet-adapter/tree/mas | [spot](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/spot) | Adapter for [Spot](https://spot-wallet.com) | [`@solana/wallet-adapter-spot`](https://npmjs.com/package/@solana/wallet-adapter-spot) | | [tokenary](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/tokenary) | Adapter for [Tokenary](https://tokenary.io) | [`@solana/wallet-adapter-tokenary`](https://npmjs.com/package/@solana/wallet-adapter-tokenary) | | [tokenpocket](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/tokenpocket) | Adapter for [TokenPocket](https://tokenpocket.pro) | [`@solana/wallet-adapter-tokenpocket`](https://npmjs.com/package/@solana/wallet-adapter-tokenpocket) | -| [torus](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/torus) | Adapter for [Torus](https://tor.us) | [`@solana/wallet-adapter-torus`](https://npmjs.com/package/@solana/wallet-adapter-torus) | +| [torus](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/torus) | Adapter for [Torus](https://tor.us) | [`@solana/wallet-adapter-torus`](https://npmjs.com/package/@solana/wallet-adapter-torus) +| [trezor](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/trezor) | Adapter for [Trezor](https://trezor.io) | [`@solana/wallet-adapter-trezor`](https://npmjs.com/package/@solana/wallet-adapter-trezor) | | [trust](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/trust) | Adapter for [Trust Wallet](https://trustwallet.com) | [`@solana/wallet-adapter-trust`](https://npmjs.com/package/@solana/wallet-adapter-trust) | | [walletconnect](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/walletconnect) | Adapter for [WalletConnect](https://walletconnect.com) | [`@solana/wallet-adapter-walletconnect`](https://npmjs.com/package/@solana/wallet-adapter-walletconnect) | | [xdefi](https://github.com/solana-labs/wallet-adapter/tree/master/packages/wallets/xdefi) | Adapter for [XDEFI](https://xdefi.io) | [`@solana/wallet-adapter-xdefi`](https://npmjs.com/package/@solana/wallet-adapter-xdefi) | diff --git a/packages/wallets/trezor/CHANGELOG.md b/packages/wallets/trezor/CHANGELOG.md new file mode 100644 index 000000000..6512b96c2 --- /dev/null +++ b/packages/wallets/trezor/CHANGELOG.md @@ -0,0 +1,7 @@ +# @solana/wallet-adapter-trezor + +## 0.1.0 + +### Patch Changes + +- Trezor wallet adapter added [] diff --git a/packages/wallets/trezor/LICENSE b/packages/wallets/trezor/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/packages/wallets/trezor/LICENSE @@ -0,0 +1,202 @@ + + 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. diff --git a/packages/wallets/trezor/README.md b/packages/wallets/trezor/README.md new file mode 100644 index 000000000..89ca30c27 --- /dev/null +++ b/packages/wallets/trezor/README.md @@ -0,0 +1,5 @@ +# `@solana/wallet-adapter-trezor` + + + +Coming soon. diff --git a/packages/wallets/trezor/package.json b/packages/wallets/trezor/package.json new file mode 100644 index 000000000..e9ea2bfa9 --- /dev/null +++ b/packages/wallets/trezor/package.json @@ -0,0 +1,46 @@ +{ + "name": "@solana/wallet-adapter-trezor", + "version": "0.1.0", + "author": "Solana Maintainers ", + "repository": "https://github.com/solana-labs/wallet-adapter", + "license": "Apache-2.0", + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "src", + "LICENSE" + ], + "engines": { + "node": ">=16" + }, + "type": "module", + "sideEffects": false, + "main": "./lib/cjs/index.js", + "module": "./lib/esm/index.js", + "types": "./lib/types/index.d.ts", + "exports": { + "require": "./lib/cjs/index.js", + "import": "./lib/esm/index.js", + "types": "./lib/types/index.d.ts" + }, + "scripts": { + "build": "tsc --build --verbose && pnpm run package", + "clean": "shx mkdir -p lib && shx rm -rf lib", + "lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint", + "package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json" + }, + "peerDependencies": { + "@solana/web3.js": "^1.77.3" + }, + "dependencies": { + "@solana/wallet-adapter-base": "workspace:^", + "@trezor/connect-web": "^9.0.11", + "buffer": "^6.0.3" + }, + "devDependencies": { + "@solana/web3.js": "^1.77.3", + "shx": "^0.3.4" + } +} diff --git a/packages/wallets/trezor/src/adapter.ts b/packages/wallets/trezor/src/adapter.ts new file mode 100644 index 000000000..b0bac764c --- /dev/null +++ b/packages/wallets/trezor/src/adapter.ts @@ -0,0 +1,169 @@ +import type { WalletName } from '@solana/wallet-adapter-base'; +import TrezorConnect, { DEVICE, DEVICE_EVENT } from '@trezor/connect-web'; +import { + BaseSignerWalletAdapter, + WalletDisconnectedError, + WalletDisconnectionError, + WalletNotConnectedError, + WalletNotReadyError, + WalletPublicKeyError, + WalletReadyState, + WalletSignTransactionError, + isVersionedTransaction, +} from '@solana/wallet-adapter-base'; +import type { Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js'; +import { PublicKey } from '@solana/web3.js'; + +export interface TrezorWalletAdapterConfig { + derivationPath?: string; + connectUrl?: string; +} + +export const TrezorWalletName = 'Trezor' as WalletName<'Trezor'>; + +export class TrezorWalletAdapter extends BaseSignerWalletAdapter { + name = TrezorWalletName; + url = 'https://trezor.io'; + icon = + 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEwOHB4IiBoZWlnaHQ9IjEwOHB4IiB2aWV3Qm94PSIwIDAgMTA4IDEwOCIgdmVyc2lvbj0iMS4xIj4NCjxnIGlkPSJzdXJmYWNlMSI+DQo8cGF0aCBzdHlsZT0iIHN0cm9rZTpub25lO2ZpbGwtcnVsZTpub256ZXJvO2ZpbGw6cmdiKDEwMCUsMTAwJSwxMDAlKTtmaWxsLW9wYWNpdHk6MTsiIGQ9Ik0gNTQgMCBDIDgzLjgyNDIxOSAwIDEwOCAyNC4xNzU3ODEgMTA4IDU0IEMgMTA4IDgzLjgyNDIxOSA4My44MjQyMTkgMTA4IDU0IDEwOCBDIDI0LjE3NTc4MSAxMDggMCA4My44MjQyMTkgMCA1NCBDIDAgMjQuMTc1NzgxIDI0LjE3NTc4MSAwIDU0IDAgWiBNIDU0IDAgIi8+DQo8cGF0aCBzdHlsZT0iIHN0cm9rZTpub25lO2ZpbGwtcnVsZTpub256ZXJvO2ZpbGw6cmdiKDAlLDAlLDAlKTtmaWxsLW9wYWNpdHk6MTsiIGQ9Ik0gNTQuMDQ2ODc1IDEwLjEyNSBDIDQxLjk0MTQwNiAxMC4xMjUgMzIuMTQwNjI1IDIwLjI0MjE4OCAzMi4xNDA2MjUgMzIuNzQyMTg4IEwgMzIuMTQwNjI1IDQxLjIxODc1IEMgMjcuODkwNjI1IDQyLjAxNTYyNSAyMy42MjUgNDMuMDc0MjE5IDIzLjYyNSA0NC40NDkyMTkgTCAyMy42MjUgODguNjg3NSBDIDIzLjYyNSA4OC42ODc1IDIzLjYyNSA4OS45MTAxNTYgMjQuOTU3MDMxIDkwLjQ4ODI4MSBDIDI5Ljc4MTI1IDkyLjUwNzgxMiA0OC43Njk1MzEgOTkuNDQ1MzEyIDUzLjEzMjgxMiAxMDEuMDM1MTU2IEMgNTMuNjk1MzEyIDEwMS4yNSA1My44NTE1NjIgMTAxLjI1IDU0IDEwMS4yNSBDIDU0LjIwNzAzMSAxMDEuMjUgNTQuMzA0Njg4IDEwMS4yNSA1NC44NjcxODggMTAxLjAzNTE1NiBDIDU5LjIzMDQ2OSA5OS40NDUzMTIgNzguMjY1NjI1IDkyLjUwNzgxMiA4My4wOTM3NSA5MC40ODgyODEgQyA4NC4zMjgxMjUgODkuOTYwOTM4IDg0LjM3NSA4OC43MzgyODEgODQuMzc1IDg4LjczODI4MSBMIDg0LjM3NSA0NC40NDkyMTkgQyA4NC4zNzUgNDMuMDc0MjE5IDgwLjE3MTg3NSA0MS45NjQ4NDQgNzUuOTA2MjUgNDEuMjE4NzUgTCA3NS45MDYyNSAzMi43NDIxODggQyA3NS45Njg3NSAyMC4yNDIxODggNjYuMTA5Mzc1IDEwLjEyNSA1NC4wNDY4NzUgMTAuMTI1IFogTSA1NC4wNDY4NzUgMjAuOTMzNTk0IEMgNjEuMTgzNTk0IDIwLjkzMzU5NCA2NS40OTYwOTQgMjUuMzg2NzE5IDY1LjQ5NjA5NCAzMi43NTM5MDYgTCA2NS40OTYwOTQgNDAuMTIxMDk0IEMgNTcuNDk2MDk0IDM5LjU0Mjk2OSA1MC42NjQwNjIgMzkuNTQyOTY5IDQyLjYxMzI4MSA0MC4xMjEwOTQgTCA0Mi42MTMyODEgMzIuNzUzOTA2IEMgNDIuNjEzMjgxIDI1LjM3NSA0Ni45MjU3ODEgMjAuOTMzNTk0IDU0LjA0Njg3NSAyMC45MzM1OTQgWiBNIDU0IDUwLjk2ODc1IEMgNjMuOTU3MDMxIDUwLjk2ODc1IDcyLjMxNjQwNiA1MS43NjU2MjUgNzIuMzE2NDA2IDUzLjE5MTQwNiBMIDcyLjMxNjQwNiA4MC43ODkwNjIgQyA3Mi4zMTY0MDYgODEuMjE4NzUgNzIuMjY1NjI1IDgxLjI2OTUzMSA3MS44OTg0MzggODEuNDIxODc1IEMgNzEuNTQ2ODc1IDgxLjU4NTkzOCA1NC45MTc5NjkgODcuNzc3MzQ0IDU0LjkxNzk2OSA4Ny43NzczNDQgQyA1NC45MTc5NjkgODcuNzc3MzQ0IDU0LjI0NjA5NCA4Ny45OTIxODggNTQuMDQ2ODc1IDg3Ljk5MjE4OCBDIDUzLjgzOTg0NCA4Ny45OTIxODggNTMuMTc5Njg4IDg3LjcyNjU2MiA1My4xNzk2ODggODcuNzI2NTYyIEMgNTMuMTc5Njg4IDg3LjcyNjU2MiAzNi41NTA3ODEgODEuNTM1MTU2IDM2LjE5OTIxOSA4MS4zNzEwOTQgQyAzNS44NDM3NSA4MS4yMDcwMzEgMzUuNzgxMjUgODEuMTU2MjUgMzUuNzgxMjUgODAuNzM4MjgxIEwgMzUuNzgxMjUgNTMuMTQwNjI1IEMgMzUuNjgzNTk0IDUxLjcxNDg0NCA0NC4wNDI5NjkgNTAuOTY4NzUgNTQgNTAuOTY4NzUgWiBNIDU0IDUwLjk2ODc1ICIvPg0KPC9nPg0KPC9zdmc+DQo='; + supportedTransactionVersions: ReadonlySet = new Set(['legacy', 0]); + + private _derivationPath: string; + private _connectUrl?: string; + private _connecting: boolean; + private _publicKey: PublicKey | null; + private _readyState: WalletReadyState = + typeof window === 'undefined' || + typeof document === 'undefined' || + typeof navigator === 'undefined' || + !navigator.hid + ? WalletReadyState.Unsupported + : WalletReadyState.Loadable; + + constructor(config: TrezorWalletAdapterConfig = {}) { + super(); + this._derivationPath = config.derivationPath || `m/44'/501'/0'/0'`; + this._connectUrl = config.connectUrl; + this._connecting = false; + this._publicKey = null; + } + + get publicKey() { + return this._publicKey; + } + + get connecting() { + return this._connecting; + } + + get readyState() { + return this._readyState; + } + + async connect(): Promise { + try { + if (this.connected || this.connecting) return; + if (this._readyState !== WalletReadyState.Loadable) throw new WalletNotReadyError(); + + this._connecting = true; + + const connectUrl = this._connectUrl && this._connectUrl + (this._connectUrl.endsWith('/') ? '' : '/'); + + await TrezorConnect.init({ + manifest: { + email: 'maintainers@solana.foundation', + appUrl: 'https://github.com/solana-labs/wallet-adapter', + }, + lazyLoad: true, + ...(this._connectUrl + ? { + connectSrc: connectUrl, + iframeSrc: connectUrl, + } + : {}), + }); + + let result; + try { + result = await TrezorConnect.solanaGetPublicKey({ + path: this._derivationPath, + }); + } catch (error: any) { + throw new WalletPublicKeyError(error?.message, error); + } + + if (!result.success) { + throw new WalletPublicKeyError(result.payload?.error, result.payload); + } + + const publicKey = result.payload.publicKey; + + TrezorConnect.on(DEVICE_EVENT, (event: any) => { + if (event.type === DEVICE.DISCONNECT) { + this._disconnected(); + } + }); + + this._publicKey = new PublicKey(Buffer.from(publicKey, 'hex')); + + this.emit('connect', this._publicKey); + } catch (error: any) { + this.emit('error', error); + throw error; + } finally { + this._connecting = false; + } + } + + async disconnect(): Promise { + this._publicKey = null; + + try { + await TrezorConnect.dispose(); + } catch (error: any) { + this.emit('error', new WalletDisconnectionError(error?.message, error)); + } + + this.emit('disconnect'); + } + + async signTransaction(transaction: T): Promise { + try { + const publicKey = this._publicKey; + if (!publicKey) throw new WalletNotConnectedError(); + + const serializedTransaction = isVersionedTransaction(transaction) + ? transaction.message.serialize() + : transaction.serializeMessage(); + + let result; + try { + result = await TrezorConnect.solanaSignTransaction({ + path: this._derivationPath, + serializedTx: Buffer.from(serializedTransaction).toString('hex'), + }); + } catch (error: any) { + throw new WalletSignTransactionError(error?.message, error); + } + + if (!result.success) { + throw new WalletSignTransactionError(result.payload?.error, result.payload); + } + + transaction.addSignature(publicKey, Buffer.from(result.payload.signature, 'hex')); + + return transaction; + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + private _disconnected = () => { + TrezorConnect.dispose(); + this._publicKey = null; + + this.emit('error', new WalletDisconnectedError()); + this.emit('disconnect'); + }; +} diff --git a/packages/wallets/trezor/src/index.ts b/packages/wallets/trezor/src/index.ts new file mode 100644 index 000000000..ddec7b57f --- /dev/null +++ b/packages/wallets/trezor/src/index.ts @@ -0,0 +1 @@ +export * from './adapter.js'; diff --git a/packages/wallets/trezor/tsconfig.cjs.json b/packages/wallets/trezor/tsconfig.cjs.json new file mode 100644 index 000000000..099b9aa7a --- /dev/null +++ b/packages/wallets/trezor/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.cjs.json", + "include": ["src"], + "compilerOptions": { + "outDir": "lib/cjs" + } +} diff --git a/packages/wallets/trezor/tsconfig.esm.json b/packages/wallets/trezor/tsconfig.esm.json new file mode 100644 index 000000000..4900d2fad --- /dev/null +++ b/packages/wallets/trezor/tsconfig.esm.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.esm.json", + "include": ["src"], + "compilerOptions": { + "outDir": "lib/esm", + "declarationDir": "lib/types" + } +} diff --git a/packages/wallets/trezor/tsconfig.json b/packages/wallets/trezor/tsconfig.json new file mode 100644 index 000000000..c2bd38181 --- /dev/null +++ b/packages/wallets/trezor/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.root.json", + "references": [ + { + "path": "./tsconfig.cjs.json" + }, + { + "path": "./tsconfig.esm.json" + } + ] +} diff --git a/packages/wallets/wallets/package.json b/packages/wallets/wallets/package.json index 3024477d4..f8fdb17c3 100644 --- a/packages/wallets/wallets/package.json +++ b/packages/wallets/wallets/package.json @@ -67,6 +67,7 @@ "@solana/wallet-adapter-tokenary": "workspace:^", "@solana/wallet-adapter-tokenpocket": "workspace:^", "@solana/wallet-adapter-torus": "workspace:^", + "@solana/wallet-adapter-trezor": "workspace:^", "@solana/wallet-adapter-trust": "workspace:^", "@solana/wallet-adapter-unsafe-burner": "workspace:^", "@solana/wallet-adapter-walletconnect": "workspace:^", diff --git a/packages/wallets/wallets/src/index.ts b/packages/wallets/wallets/src/index.ts index 8225afaad..d571859db 100644 --- a/packages/wallets/wallets/src/index.ts +++ b/packages/wallets/wallets/src/index.ts @@ -30,6 +30,7 @@ export * from '@solana/wallet-adapter-spot'; export * from '@solana/wallet-adapter-tokenary'; export * from '@solana/wallet-adapter-tokenpocket'; export * from '@solana/wallet-adapter-torus'; +export * from '@solana/wallet-adapter-trezor'; export * from '@solana/wallet-adapter-trust'; export * from '@solana/wallet-adapter-unsafe-burner'; export * from '@solana/wallet-adapter-walletconnect'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df6494fbc..01c1594e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1100,6 +1100,25 @@ importers: specifier: ^0.3.4 version: 0.3.4 + packages/wallets/trezor: + dependencies: + '@solana/wallet-adapter-base': + specifier: workspace:^ + version: link:../../core/base + '@trezor/connect-web': + specifier: ^9.0.11 + version: 9.0.11 + buffer: + specifier: ^6.0.3 + version: 6.0.3 + devDependencies: + '@solana/web3.js': + specifier: ^1.77.3 + version: 1.78.0 + shx: + specifier: ^0.3.4 + version: 0.3.4 + packages/wallets/trust: dependencies: '@solana/wallet-adapter-base': @@ -1255,6 +1274,9 @@ importers: '@solana/wallet-adapter-torus': specifier: workspace:^ version: link:../torus + '@solana/wallet-adapter-trezor': + specifier: workspace:^ + version: link:../trezor '@solana/wallet-adapter-trust': specifier: workspace:^ version: link:../trust @@ -5414,6 +5436,49 @@ packages: eventemitter3: 4.0.7 dev: false + /@protobufjs/aspromise@1.1.2: + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + dev: false + + /@protobufjs/base64@1.1.2: + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + dev: false + + /@protobufjs/codegen@2.0.4: + resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} + dev: false + + /@protobufjs/eventemitter@1.1.0: + resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} + dev: false + + /@protobufjs/fetch@1.1.0: + resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/inquire': 1.1.0 + dev: false + + /@protobufjs/float@1.0.2: + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + dev: false + + /@protobufjs/inquire@1.1.0: + resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} + dev: false + + /@protobufjs/path@1.1.2: + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + dev: false + + /@protobufjs/pool@1.1.0: + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + dev: false + + /@protobufjs/utf8@1.1.0: + resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} + dev: false + /@rc-component/portal@1.1.2(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-6f813C0IsasTZms08kfA8kPAGxbbkYToa8ALaiDIGGECU4i9hj8Plgbx0sNJDrey3EtHO30hmdaxtT0138xZcg==} engines: {node: '>=8.x'} @@ -6536,6 +6601,137 @@ packages: - utf-8-validate dev: false + /@trezor/analytics@1.0.3: + resolution: {integrity: sha512-7a0bHkY/+z6cDRoh1ZkhffHGw7iaVayD1UpP3fm4lPzrRpGQeH9ksRg8ZT0mBs6Pj+TLETzZRrS5ZBpDK0Piug==} + dependencies: + '@trezor/utils': 9.0.9 + dev: false + + /@trezor/blockchain-link-types@1.0.2: + resolution: {integrity: sha512-ON3A2Anu5k3BkMFtG0LWO48ZxikyWgSORqQ12ki3KDbTbqZV5BwAZTeFchUq8cv1kDlqkG7AtMV2nY9G3KfYOA==} + dev: false + + /@trezor/blockchain-link-utils@1.0.3: + resolution: {integrity: sha512-/mti1QY8n053P11wQwnQyBAASS+nNVBKu2kSZo8KAESwdnFGcnZwH0okXHTlUQZFud5ppg9EYJk9mpk0jf91tQ==} + dependencies: + '@trezor/utils': 9.0.8 + bignumber.js: 9.1.1 + dev: false + + /@trezor/blockchain-link@2.1.13: + resolution: {integrity: sha512-5yRvP8cFKjYd3FBRmUS6VJxHRLm8IuQg237hcRF8RbYRgW6ev7dwkjYmcVYz2iWXGaz+/FV8G0/xB/pmHhrpPQ==} + dependencies: + '@trezor/blockchain-link-types': 1.0.2 + '@trezor/blockchain-link-utils': 1.0.3 + '@trezor/utils': 9.0.9 + '@trezor/utxo-lib': 1.0.7 + '@types/web': 0.0.99 + bignumber.js: 9.1.1 + events: 3.3.0 + ripple-lib: 1.10.1 + socks-proxy-agent: 6.1.1 + ws: 7.5.9 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + + /@trezor/connect-analytics@1.0.2: + resolution: {integrity: sha512-eUAWb1nc5wGAKmNVTmiOc9DlFr+mbG+1JevzVUFB2q3VLQzcjf0st+RWE5DuDnPUVJiJFxBQWTqWlzACtq/HzQ==} + dependencies: + '@trezor/analytics': 1.0.3 + dev: false + + /@trezor/connect-common@0.0.16: + resolution: {integrity: sha512-DPGWhNYTe8SQO/XzqvVtY5YCOtRGHChN01J2Z5p3xD6aFGceou7SE0ROOcqU0ceSzMgl13+I9I0qXq/OLTGBGw==} + dependencies: + '@trezor/env-utils': 1.0.2 + dev: false + + /@trezor/connect-web@9.0.11: + resolution: {integrity: sha512-9398lmzxPGm/aZGM9OvkjasQ4kUQQs5bYz79eDtFz3jf24SyMM1yf2KvdvdssIyIfvcAbyJLZ+DK1qw2HxWn/Q==} + dependencies: + '@trezor/connect': 9.0.11 + '@trezor/utils': 9.0.9 + events: 3.3.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@trezor/connect@9.0.11: + resolution: {integrity: sha512-8fifMt3xtqIQ4122aHNb8e3l0uisVujsWXUJ/LQS6N+t6SnilohBZ8nfzUBQaCxo2JuorLuXmxQ1ngNpaL45TA==} + dependencies: + '@trezor/blockchain-link': 2.1.13 + '@trezor/connect-analytics': 1.0.2 + '@trezor/connect-common': 0.0.16 + '@trezor/transport': 1.1.12 + '@trezor/utils': 9.0.9 + '@trezor/utxo-lib': 1.0.7 + bignumber.js: 9.1.1 + blakejs: 1.2.1 + cross-fetch: 3.1.8 + events: 3.3.0 + randombytes: 2.1.0 + tslib: 2.5.2 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@trezor/env-utils@1.0.2: + resolution: {integrity: sha512-fPrX6EjaMHnRwAje7h2H3Qgu5/sBoewE8441j8cbBzxfJRgRuQJYZaGCy7lDALjxEwp7g02ZZ/FWavIhWGZIcQ==} + dependencies: + ua-parser-js: 1.0.36 + dev: false + + /@trezor/transport@1.1.12: + resolution: {integrity: sha512-RInOSOmgJ383QOBJbPzjyQW9BoWZ6HTneUmPkdzqydLxn9eyD3Ui13+W9fWFmxoMmljxJKct93twgxgHKUkhCg==} + dependencies: + '@trezor/utils': 9.0.9 + bytebuffer: 5.0.1 + json-stable-stringify: 1.0.2 + long: 4.0.0 + prettier: 2.8.7 + protobufjs: 6.11.3 + dev: false + + /@trezor/utils@9.0.8: + resolution: {integrity: sha512-XsX+VXP2UxanYo+LbY7zcjeIumEWFs5lArTAfK1fdWTIdiV8Od2htNO+D9lnCytvuu04LeJx7RihxinsQQVDvA==} + dev: false + + /@trezor/utils@9.0.9: + resolution: {integrity: sha512-+jzHy+YG3zJsnB11YfudT1a5u5lcwNX/tKoW9VmPU+isuW725M6uUOL+MSgW1aHucCJPyBAp0XUUssLE/ifqBw==} + dev: false + + /@trezor/utxo-lib@1.0.7: + resolution: {integrity: sha512-brC5xqGgT6yloHz3RWUK1CdEYkOSEjrhYM18GAzAaqS4MBULWDBPDD5Qt2XcYTOaoR/+8PKUXHdHVm+olbRSlA==} + dependencies: + '@trezor/utils': 9.0.9 + bchaddrjs: 0.5.2 + bech32: 2.0.0 + bip66: 1.1.5 + bitcoin-ops: 1.4.1 + blake-hash: 2.0.0 + blakejs: 1.2.1 + bn.js: 5.2.1 + bs58: 5.0.0 + bs58check: 3.0.1 + create-hash: 1.2.0 + create-hmac: 1.1.7 + int64-buffer: 1.0.1 + pushdata-bitcoin: 1.0.1 + tiny-secp256k1: 1.1.6 + typeforce: 1.18.0 + varuint-bitcoin: 1.1.2 + wif: 2.0.6 + dev: false + /@trysound/sax@0.2.0: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} @@ -6708,6 +6904,14 @@ packages: '@types/node': 18.16.19 dev: true + /@types/lodash@4.14.199: + resolution: {integrity: sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==} + dev: false + + /@types/long@4.0.2: + resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==} + dev: false + /@types/mime@1.3.2: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: false @@ -6883,6 +7087,10 @@ packages: resolution: {integrity: sha512-eTQRkPd2JukZfS9+kRtrBAaTCCb6waGh5X8BJHmH1MiVQPLMYwm4+EvhwFfOo9SDna15o9dFAwmWwN6r/YM53A==} dev: true + /@types/web@0.0.99: + resolution: {integrity: sha512-xMz3tOvtkZzc7RpQrDNiLe5sfMmP+fz8bOxHIZ/U8qXyvzDX4L4Ss1HCjor/O9DSelba+1iXK1VM7lruX28hiQ==} + dev: false + /@types/ws@7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: @@ -8185,6 +8393,20 @@ packages: resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} dev: false + /bchaddrjs@0.5.2: + resolution: {integrity: sha512-OO7gIn3m7ea4FVx4cT8gdlWQR2+++EquhdpWQJH9BQjK63tJJ6ngB3QMZDO6DiBoXiIGUsTPHjlrHVxPGcGxLQ==} + engines: {node: '>=8.0.0'} + dependencies: + bs58check: 2.1.2 + buffer: 6.0.3 + cashaddrjs: 0.4.4 + stream-browserify: 3.0.0 + dev: false + + /bech32@2.0.0: + resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} + dev: false + /better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} @@ -8202,6 +8424,16 @@ packages: tryer: 1.0.1 dev: false + /big-integer@1.6.36: + resolution: {integrity: sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==} + engines: {node: '>=0.6'} + dev: false + + /big-integer@1.6.51: + resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} + engines: {node: '>=0.6'} + dev: false + /big.js@5.2.2: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} @@ -8226,6 +8458,16 @@ packages: dependencies: file-uri-to-path: 1.0.0 + /bip66@1.1.5: + resolution: {integrity: sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==} + dependencies: + safe-buffer: 5.2.1 + dev: false + + /bitcoin-ops@1.4.1: + resolution: {integrity: sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==} + dev: false + /bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: @@ -8234,6 +8476,20 @@ packages: readable-stream: 3.6.2 dev: false + /blake-hash@2.0.0: + resolution: {integrity: sha512-Igj8YowDu1PRkRsxZA7NVkdFNxH5rKv5cpLxQ0CVXSIA77pVYwCPRQJ2sMew/oneUpfuYRyjG6r8SmmmnbZb1w==} + engines: {node: '>= 10'} + requiresBuild: true + dependencies: + node-addon-api: 3.2.1 + node-gyp-build: 4.6.0 + readable-stream: 3.6.2 + dev: false + + /blakejs@1.2.1: + resolution: {integrity: sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==} + dev: false + /bluebird@3.7.2: resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} dev: false @@ -8402,6 +8658,13 @@ packages: safe-buffer: 5.2.1 dev: false + /bs58check@3.0.1: + resolution: {integrity: sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==} + dependencies: + '@noble/hashes': 1.3.1 + bs58: 5.0.0 + dev: false + /bser@2.1.1: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} dependencies: @@ -8457,6 +8720,13 @@ packages: resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==} dev: true + /bytebuffer@5.0.1: + resolution: {integrity: sha512-IuzSdmADppkZ6DlpycMkm8l9zeEq16fWtLvunEwFiYciR/BHo4E8/xs5piFquG+Za8OWmMqHF8zuRviz2LHvRQ==} + engines: {node: '>=0.8'} + dependencies: + long: 3.2.0 + dev: false + /bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -8542,6 +8812,12 @@ packages: engines: {node: '>=4'} dev: false + /cashaddrjs@0.4.4: + resolution: {integrity: sha512-xZkuWdNOh0uq/mxJIng6vYWfTowZLd9F4GMAlp2DwFHlcCqCm91NtuAc47RuV4L7r4PYcY5p6Cr2OKNb4hnkWA==} + dependencies: + big-integer: 1.6.36 + dev: false + /cbor-sync@1.0.4: resolution: {integrity: sha512-GWlXN4wiz0vdWWXBU71Dvc1q3aBo0HytqwAZnXF1wOwjqNnDWA1vZ1gDMFLlqohak31VQzmhiYfiCX5QSSfagA==} dev: false @@ -8971,6 +9247,14 @@ packages: safe-buffer: 5.2.1 sha.js: 2.4.11 + /cross-fetch@3.1.8: + resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} + dependencies: + node-fetch: 2.6.12 + transitivePeerDependencies: + - encoding + dev: false + /cross-spawn@5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} dependencies: @@ -11476,6 +11760,11 @@ packages: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} dev: false + /int64-buffer@1.0.1: + resolution: {integrity: sha512-+3azY4pXrjAupJHU1V9uGERWlhoqNswJNji6aD/02xac7oxol508AsMC5lxKhEqyZeDFy3enq5OGWXF4u75hiw==} + engines: {node: '>= 4.5.0'} + dev: false + /internal-slot@1.0.5: resolution: {integrity: sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==} engines: {node: '>= 0.4'} @@ -11499,6 +11788,10 @@ packages: resolution: {integrity: sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==} dev: false + /ip@2.0.0: + resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} + dev: false + /ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -13109,6 +13402,10 @@ packages: engines: {node: '>=0.10.0'} dev: false + /jsonschema@1.2.2: + resolution: {integrity: sha512-iX5OFQ6yx9NgbHCwse51ohhKgLuLL7Z5cNOeZOPIlDUtAMrxlruHLzVZxbltdHE5mEDXN+75oFOwq6Gn0MZwsA==} + dev: false + /jsqr@1.4.0: resolution: {integrity: sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A==} dev: false @@ -13432,6 +13729,15 @@ packages: engines: {node: '>= 0.6.0'} dev: false + /long@3.2.0: + resolution: {integrity: sha512-ZYvPPOMqUwPoDsbJaR10iQJYnMuZhRTvHYl62ErLIEX7RgFlziSBUUvrt3OVfc47QlHHpzPZYP17g3Fv7oeJkg==} + engines: {node: '>=0.6'} + dev: false + + /long@4.0.0: + resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} + dev: false + /loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true @@ -14059,6 +14365,10 @@ packages: thenify-all: 1.6.0 dev: false + /nan@2.18.0: + resolution: {integrity: sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==} + dev: false + /nanoid@3.3.6: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -14171,6 +14481,10 @@ packages: resolution: {integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==} dev: false + /node-addon-api@3.2.1: + resolution: {integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==} + dev: false + /node-addon-api@4.3.0: resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==} dev: true @@ -14210,6 +14524,7 @@ packages: /node-gyp-build-optional-packages@5.0.7: resolution: {integrity: sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==} hasBin: true + requiresBuild: true dev: true optional: true @@ -15632,6 +15947,12 @@ packages: fast-diff: 1.3.0 dev: true + /prettier@2.8.7: + resolution: {integrity: sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: false + /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} @@ -15717,6 +16038,26 @@ packages: object-assign: 4.1.1 react-is: 16.13.1 + /protobufjs@6.11.3: + resolution: {integrity: sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==} + hasBin: true + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/long': 4.0.2 + '@types/node': 18.16.19 + long: 4.0.0 + dev: false + /proxy-addr@2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} @@ -15727,6 +16068,7 @@ packages: /prr@1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} + requiresBuild: true dev: true optional: true @@ -15761,6 +16103,12 @@ packages: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} + /pushdata-bitcoin@1.0.1: + resolution: {integrity: sha512-hw7rcYTJRAl4olM8Owe8x0fBuJJ+WGbMhQuLWOXEMN3PxPCKQHRkhfL+XG0+iXUmSHjkMmb3Ba55Mt21cZc9kQ==} + dependencies: + bitcoin-ops: 1.4.1 + dev: false + /q@1.5.1: resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==} engines: {node: '>=0.6.0', teleport: '>=0.2.0'} @@ -17004,6 +17352,66 @@ packages: hash-base: 3.1.0 inherits: 2.0.4 + /ripple-address-codec@4.3.1: + resolution: {integrity: sha512-Qa3+9wKVvpL/xYtT6+wANsn0A1QcC5CT6IMZbRJZ/1lGt7gmwIfsrCuz1X0+LCEO7zgb+3UT1I1dc0k/5dwKQQ==} + engines: {node: '>= 10'} + dependencies: + base-x: 3.0.9 + create-hash: 1.2.0 + dev: false + + /ripple-binary-codec@1.10.0: + resolution: {integrity: sha512-qWXxubgXBV3h5NTaaLiusZ1FhPqSy+bCYHHarfZ3bMmO2alRa1Ox61jvX1Zyozok8PcF3gs3bKwZci4RTlA07w==} + engines: {node: '>= 10'} + dependencies: + assert: 2.0.0 + big-integer: 1.6.51 + buffer: 6.0.3 + create-hash: 1.2.0 + decimal.js: 10.4.3 + ripple-address-codec: 4.3.1 + dev: false + + /ripple-keypairs@1.3.1: + resolution: {integrity: sha512-dmPlraWKJciFJxHcoubDahGnoIalG5e/BtV6HNDUs7wLXmtnLMHt6w4ed9R8MTL2zNrVPiIdI/HCtMMo0Tm7JQ==} + engines: {node: '>= 10'} + dependencies: + bn.js: 5.2.1 + brorand: 1.1.0 + elliptic: 6.5.4 + hash.js: 1.1.7 + ripple-address-codec: 4.3.1 + dev: false + + /ripple-lib-transactionparser@0.8.2: + resolution: {integrity: sha512-1teosQLjYHLyOQrKUQfYyMjDR3MAq/Ga+MJuLUfpBMypl4LZB4bEoMcmG99/+WVTEiZOezJmH9iCSvm/MyxD+g==} + dependencies: + bignumber.js: 9.1.1 + lodash: 4.17.21 + dev: false + + /ripple-lib@1.10.1: + resolution: {integrity: sha512-OQk+Syl2JfxKxV2KuF/kBMtnh012I5tNnziP3G4WDGCGSIAgeqkOgkR59IQ0YDNrs1YW8GbApxrdMSRi/QClcA==} + engines: {node: '>=10.13.0', yarn: ^1.15.2} + deprecated: 'ripple-lib is deprecated. Please migrate to xrpl.js using this migration guide: https://xrpl.org/xrpljs2-migration-guide.html' + dependencies: + '@types/lodash': 4.14.199 + '@types/ws': 7.4.7 + bignumber.js: 9.1.1 + https-proxy-agent: 5.0.1 + jsonschema: 1.2.2 + lodash: 4.17.21 + ripple-address-codec: 4.3.1 + ripple-binary-codec: 1.10.0 + ripple-keypairs: 1.3.1 + ripple-lib-transactionparser: 0.8.2 + ws: 7.5.9 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + /rollup-plugin-terser@7.0.2(rollup@2.79.1): resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser @@ -17404,6 +17812,11 @@ packages: is-fullwidth-code-point: 2.0.0 dev: false + /smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + dev: false + /smartwrap@2.0.2: resolution: {integrity: sha512-vCsKNQxb7PnCNd2wY1WClWifAc2lwqsG8OaswpJkVJsvMGcnEntdTCDajZCkk93Ay1U3t/9puJmb525Rg5MZBA==} engines: {node: '>=6'} @@ -17449,6 +17862,25 @@ packages: websocket-driver: 0.7.4 dev: false + /socks-proxy-agent@6.1.1: + resolution: {integrity: sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==} + engines: {node: '>= 10'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + socks: 2.7.1 + transitivePeerDependencies: + - supports-color + dev: false + + /socks@2.7.1: + resolution: {integrity: sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==} + engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} + dependencies: + ip: 2.0.0 + smart-buffer: 4.2.0 + dev: false + /sonic-boom@2.8.0: resolution: {integrity: sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg==} dependencies: @@ -18121,6 +18553,18 @@ packages: resolution: {integrity: sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==} dev: true + /tiny-secp256k1@1.1.6: + resolution: {integrity: sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==} + engines: {node: '>=6.0.0'} + requiresBuild: true + dependencies: + bindings: 1.5.0 + bn.js: 4.12.0 + create-hmac: 1.1.7 + elliptic: 6.5.4 + nan: 2.18.0 + dev: false + /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -18246,6 +18690,10 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + /tslib@2.5.2: + resolution: {integrity: sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==} + dev: false + /tslib@2.6.0: resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} @@ -18438,11 +18886,19 @@ packages: typescript: 4.7.4 dev: true + /typeforce@1.18.0: + resolution: {integrity: sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==} + dev: false + /typescript@4.7.4: resolution: {integrity: sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==} engines: {node: '>=4.2.0'} hasBin: true + /ua-parser-js@1.0.36: + resolution: {integrity: sha512-znuyCIXzl8ciS3+y3fHJI/2OhQIXbXw9MWC/o3qwyR+RGppjZHrM27CGFSKCJXi2Kctiz537iOu2KnXs1lMQhw==} + dev: false + /uglify-es@3.3.9: resolution: {integrity: sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==} engines: {node: '>=0.8.0'} @@ -18644,6 +19100,12 @@ packages: spdx-expression-parse: 3.0.1 dev: true + /varuint-bitcoin@1.1.2: + resolution: {integrity: sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==} + dependencies: + safe-buffer: 5.2.1 + dev: false + /vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} @@ -19013,6 +19475,12 @@ packages: dependencies: isexe: 2.0.0 + /wif@2.0.6: + resolution: {integrity: sha512-HIanZn1zmduSF+BQhkE+YXIbEiH0xPr1012QbFEGB0xsKqJii0/SqJjyn8dFv6y36kOznMgMB+LGcbZTJ1xACQ==} + dependencies: + bs58check: 2.1.2 + dev: false + /workbox-background-sync@6.6.0: resolution: {integrity: sha512-jkf4ZdgOJxC9u2vztxLuPT/UjlH7m/nWRQ/MgGL0v8BJHoZdVGJd18Kck+a0e55wGXdqyHO+4IQTk0685g4MUw==} dependencies: diff --git a/tsconfig.base.json b/tsconfig.base.json index 90620c4e4..f226d5850 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,6 +9,7 @@ "noEmitOnError": true, "resolveJsonModule": true, "strict": true, - "stripInternal": true + "stripInternal": true, + "skipLibCheck": true } }