From 2bd22df22b4e815469863885e5c73076f598bd8a Mon Sep 17 00:00:00 2001 From: Erdit Kurteshi Date: Thu, 2 Nov 2023 10:14:45 +0100 Subject: [PATCH] added ledger wallet via wallet-selector --- package.json | 1 + pnpm-lock.yaml | 73 ++++++++++++++++++++++++++--- src/components/vm/VmInitializer.tsx | 2 + 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e8057ed47..5911501da 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@near-js/biometric-ed25519": "0.3.0", "@near-wallet-selector/core": "8.7.0", "@near-wallet-selector/here-wallet": "8.7.0", + "@near-wallet-selector/ledger": "^8.7.0", "@near-wallet-selector/meteor-wallet": "8.7.0", "@near-wallet-selector/modal-ui": "8.7.0", "@near-wallet-selector/my-near-wallet": "8.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7b804500..c616098d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: '@braintree/sanitize-url': specifier: ^6.0.4 @@ -19,6 +23,9 @@ dependencies: '@near-wallet-selector/here-wallet': specifier: 8.7.0 version: 8.7.0(borsh@0.7.0)(near-api-js@2.1.4) + '@near-wallet-selector/ledger': + specifier: ^8.7.0 + version: 8.7.0(near-api-js@2.1.4)(typescript@5.2.2) '@near-wallet-selector/meteor-wallet': specifier: 8.7.0 version: 8.7.0(near-api-js@2.1.4) @@ -2127,6 +2134,40 @@ packages: resolution: {integrity: sha512-mscwGroSJQrCTjtNGBu+18FQbZYA4+q6Tyx6K7CXHl6AwgZKbWfZYdgP2F+fyZcRUdGRsMX8QtvU61VcGGtO1A==} dev: false + /@ledgerhq/devices@6.27.1: + resolution: {integrity: sha512-jX++oy89jtv7Dp2X6gwt3MMkoajel80JFWcdc0HCouwDsV1mVJ3SQdwl/bQU0zd8HI6KebvUP95QTwbQLLK/RQ==} + dependencies: + '@ledgerhq/errors': 6.14.0 + '@ledgerhq/logs': 6.10.1 + rxjs: 6.6.7 + semver: 7.5.4 + dev: false + + /@ledgerhq/errors@6.14.0: + resolution: {integrity: sha512-ZWJw2Ti6Dq1Ott/+qYqJdDWeZm16qI3VNG5rFlb0TQ3UcAyLIQZbnnzzdcVVwVeZiEp66WIpINd/pBdqsHVyOA==} + dev: false + + /@ledgerhq/hw-transport-webhid@6.27.1: + resolution: {integrity: sha512-u74rBYlibpbyGblSn74fRs2pMM19gEAkYhfVibq0RE1GNFjxDMFC1n7Sb+93Jqmz8flyfB4UFJsxs8/l1tm2Kw==} + dependencies: + '@ledgerhq/devices': 6.27.1 + '@ledgerhq/errors': 6.14.0 + '@ledgerhq/hw-transport': 6.27.1 + '@ledgerhq/logs': 6.10.1 + dev: false + + /@ledgerhq/hw-transport@6.27.1: + resolution: {integrity: sha512-hnE4/Fq1YzQI4PA1W0H8tCkI99R3UWDb3pJeZd6/Xs4Qw/q1uiQO+vNLC6KIPPhK0IajUfuI/P2jk0qWcMsuAQ==} + dependencies: + '@ledgerhq/devices': 6.27.1 + '@ledgerhq/errors': 6.14.0 + events: 3.3.0 + dev: false + + /@ledgerhq/logs@6.10.1: + resolution: {integrity: sha512-z+ILK8Q3y+nfUl43ctCPuR4Y2bIxk/ooCQFwZxhtci1EhAtMDzMAx2W25qx8G1PPL9UUOdnUax19+F0OjXoj4w==} + dev: false + /@lit-labs/ssr-dom-shim@1.1.1: resolution: {integrity: sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ==} dev: false @@ -2501,6 +2542,23 @@ packages: - borsh dev: false + /@near-wallet-selector/ledger@8.7.0(near-api-js@2.1.4)(typescript@5.2.2): + resolution: {integrity: sha512-m//xBs9P2j3caUhHYYqV1JcIHW+xJde13N45ohiWHl00S7iVtysZvIt1FArJ/ZhWooJzJSZb+pIFEBmli88Jlg==} + peerDependencies: + near-api-js: ^1.0.0 || ^2.0.0 + dependencies: + '@ledgerhq/hw-transport': 6.27.1 + '@ledgerhq/hw-transport-webhid': 6.27.1 + '@near-wallet-selector/core': 8.7.0(near-api-js@2.1.4) + '@near-wallet-selector/wallet-utils': 8.7.0(near-api-js@2.1.4) + bn.js: 5.2.1 + is-mobile: 4.0.0 + near-api-js: 2.1.4 + ts-essentials: 7.0.3(typescript@5.2.2) + transitivePeerDependencies: + - typescript + dev: false + /@near-wallet-selector/meteor-wallet@8.7.0(near-api-js@2.1.4): resolution: {integrity: sha512-2uuxdQC79PhNqu2L8xzGRiYqeNEp/bW1tcniCyP4O/lJ9TwidTaHcqQIDqSrFFPSdN6c9OnZL9ZkLnciZq9IgQ==} peerDependencies: @@ -7936,7 +7994,6 @@ packages: engines: {node: '>=10'} dependencies: yallist: 4.0.0 - dev: true /lru-queue@0.1.0: resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} @@ -9585,7 +9642,6 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 - dev: true /set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} @@ -9973,6 +10029,14 @@ packages: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} dev: false + /ts-essentials@7.0.3(typescript@5.2.2): + resolution: {integrity: sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==} + peerDependencies: + typescript: '>=3.7.0' + dependencies: + typescript: 5.2.2 + dev: false + /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -10496,7 +10560,6 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true /yargs-parser@13.1.2: resolution: {integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==} @@ -10692,7 +10755,3 @@ packages: - supports-color - utf-8-validate dev: false - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false diff --git a/src/components/vm/VmInitializer.tsx b/src/components/vm/VmInitializer.tsx index 415c84089..ec1ca84b4 100644 --- a/src/components/vm/VmInitializer.tsx +++ b/src/components/vm/VmInitializer.tsx @@ -2,6 +2,7 @@ import { sanitizeUrl } from '@braintree/sanitize-url'; import { setupKeypom } from '@keypom/selector'; import { setupWalletSelector } from '@near-wallet-selector/core'; import { setupHereWallet } from '@near-wallet-selector/here-wallet'; +import { setupLedger } from '@near-wallet-selector/ledger'; import { setupMeteorWallet } from '@near-wallet-selector/meteor-wallet'; import type { WalletSelectorModal } from '@near-wallet-selector/modal-ui'; import { setupModal } from '@near-wallet-selector/modal-ui'; @@ -91,6 +92,7 @@ export default function VmInitializer() { networkId, signInContractId, }) as any, // TODO: Refactor setupKeypom() to TS + setupLedger(), ], }), customElements: {