From 50d6dee7adfeb4574e7883c95ba85856a1cce1b7 Mon Sep 17 00:00:00 2001 From: homura Date: Wed, 27 Nov 2024 17:54:34 +0900 Subject: [PATCH] chore: change hw sdk to forked one --- packages/neuron-wallet/package.json | 2 +- .../src/services/hardware/ledger.ts | 2 +- packages/neuron-wallet/src/types/ledger.d.ts | 2 +- .../tests/services/hardware/ledger.test.ts | 2 +- packages/neuron-wallet/tests/setup.ts | 2 +- yarn.lock | 58 +++++-------------- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/packages/neuron-wallet/package.json b/packages/neuron-wallet/package.json index 586fbc6168..029be3ab88 100644 --- a/packages/neuron-wallet/package.json +++ b/packages/neuron-wallet/package.json @@ -47,6 +47,7 @@ "@ckb-lumos/helpers": "0.23.0", "@ckb-lumos/rpc": "0.23.0", "@ckb-lumos/lumos": "0.23.0", + "@magickbase/hw-app-ckb": "0.2.0-alpha.0", "@iarna/toml": "2.2.5", "@ledgerhq/hw-transport-node-hid": "6.27.22", "@spore-sdk/core": "0.1.0", @@ -59,7 +60,6 @@ "electron-updater": "6.3.0", "electron-window-state": "5.0.3", "elliptic": "6.6.0", - "hw-app-ckb": "0.1.2", "i18next": "21.10.0", "leveldown": "6.1.1", "levelup": "4.4.0", diff --git a/packages/neuron-wallet/src/services/hardware/ledger.ts b/packages/neuron-wallet/src/services/hardware/ledger.ts index 34bfcbb38a..c7bbaaa58d 100644 --- a/packages/neuron-wallet/src/services/hardware/ledger.ts +++ b/packages/neuron-wallet/src/services/hardware/ledger.ts @@ -1,7 +1,7 @@ import { DeviceInfo, ExtendedPublicKey } from './common' import { Hardware } from './hardware' import HID from '@ledgerhq/hw-transport-node-hid' -import LedgerCKB from 'hw-app-ckb' +import LedgerCKB from '@magickbase/hw-app-ckb' import type { DescriptorEvent, Subscription, Observer } from '@ledgerhq/hw-transport' import type Transport from '@ledgerhq/hw-transport' import { Observable, timer } from 'rxjs' diff --git a/packages/neuron-wallet/src/types/ledger.d.ts b/packages/neuron-wallet/src/types/ledger.d.ts index e95a2f7034..7aa9338e1b 100644 --- a/packages/neuron-wallet/src/types/ledger.d.ts +++ b/packages/neuron-wallet/src/types/ledger.d.ts @@ -1,7 +1,7 @@ // Until there's a @types/hw-app-ckb // import type Transport from '@ledgerhq/hw-transport' declare module '@ledgerhq/hw-transport-node-ble' -declare module 'hw-app-ckb' { +declare module '@magickbase/hw-app-ckb' { export interface WalletPublicKey { publicKey: string lockArg: string diff --git a/packages/neuron-wallet/tests/services/hardware/ledger.test.ts b/packages/neuron-wallet/tests/services/hardware/ledger.test.ts index 84ee4255f1..81dc37c3fb 100644 --- a/packages/neuron-wallet/tests/services/hardware/ledger.test.ts +++ b/packages/neuron-wallet/tests/services/hardware/ledger.test.ts @@ -2,7 +2,7 @@ import Ledger from '../../../src/services/hardware/ledger' const getWalletExtendedPublicKeyMock = jest.fn() -jest.mock('hw-app-ckb', () => { +jest.mock('@magickbase/hw-app-ckb', () => { return function () { return { getWalletExtendedPublicKey: getWalletExtendedPublicKeyMock, diff --git a/packages/neuron-wallet/tests/setup.ts b/packages/neuron-wallet/tests/setup.ts index a0baee9a06..7f7d615326 100644 --- a/packages/neuron-wallet/tests/setup.ts +++ b/packages/neuron-wallet/tests/setup.ts @@ -112,6 +112,6 @@ jest.mock('@ledgerhq/hw-transport-node-hid', () => { return LedgerHID }) -jest.mock('hw-app-ckb', () => { +jest.mock('@magickbase/hw-app-ckb', () => { return LedgerCkbApp }) diff --git a/yarn.lock b/yarn.lock index b8695d4a06..de72f256a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3414,6 +3414,16 @@ yargs "17.7.2" yargs-parser "21.1.1" +"@magickbase/hw-app-ckb@0.2.0-alpha.0": + version "0.2.0-alpha.0" + resolved "https://registry.yarnpkg.com/@magickbase/hw-app-ckb/-/hw-app-ckb-0.2.0-alpha.0.tgz#903dea98bc349e32f39015fdebb95f8fe3436ab5" + integrity sha512-qphkM7WNQ1bLTvUS6VsJXaqyUg+kDzw+A2PAeCaQ0f3LhYqeTkg7keIGgPCUro7UTijatUxgkD903xq6VIuDlA== + dependencies: + "@ledgerhq/hw-transport" "^5.9.0" + bech32 "2.0.0" + bip32-path "0.4.2" + blake2b-wasm "2.1.0" + "@malept/cross-spawn-promise@^1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz#504af200af6b98e198bce768bc1730c6936ae01d" @@ -7600,12 +7610,7 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -bech32@^2.0.0: +bech32@2.0.0, bech32@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== @@ -12267,16 +12272,6 @@ husky@8.0.3: resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== -hw-app-ckb@0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/hw-app-ckb/-/hw-app-ckb-0.1.2.tgz#ca5b69ebcd4009af5cf0002c09e61962721d7e74" - integrity sha512-ruzlfQpo/jeByaPCNNlzGlZdfhFTeTwIWfAJDZaBjspvWLOzSi1L1gV/NsjRS+B03rI4gR5HAnQJiblrnf4d7A== - dependencies: - "@ledgerhq/hw-transport" "^5.9.0" - bech32 "1.1.4" - bip32-path "0.4.2" - blake2b-wasm "2.1.0" - i18next@21.10.0: version "21.10.0" resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.10.0.tgz#85429af55fdca4858345d0e16b584ec29520197d" @@ -18974,16 +18969,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -19101,14 +19087,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -20858,16 +20837,7 @@ workbox-window@6.6.1: "@types/trusted-types" "^2.0.2" workbox-core "6.6.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==