diff --git a/package.json b/package.json index c592613..c0c42a8 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "@lifeomic/axios-fetch": "3.0.1", "@multiversx/sdk-extension-provider": "4.0.0-alpha.0", - "@multiversx/sdk-hw-provider": "6.4.0", + "@multiversx/sdk-hw-provider": "7.0.0-alpha.0", "@multiversx/sdk-metamask-provider": "0.0.7", "@multiversx/sdk-native-auth-client": "^1.0.8", "@multiversx/sdk-opera-provider": "1.0.0-alpha.1", diff --git a/src/core/providers/ProviderFactory.ts b/src/core/providers/ProviderFactory.ts index e52659c..ea5c01e 100644 --- a/src/core/providers/ProviderFactory.ts +++ b/src/core/providers/ProviderFactory.ts @@ -68,8 +68,15 @@ export class ProviderFactory { createdProvider.login = async (options?: { callbackUrl?: string | undefined; token?: string | undefined; - }) => { - await provider.isConnected(); + }): Promise<{ + address: string; + signature: string; + }> => { + const isConnected = provider.isConnected(); + + if (!isConnected) { + throw new Error('Ledger device is not connected'); + } // TODO: perform additional UI logic here // maybe extract to file @@ -132,7 +139,7 @@ export class ProviderFactory { signature: loginInfo.signature.toString('hex') }; } else { - const address = await hwProviderLogin({ + const { address } = await hwProviderLogin({ addressIndex: accountsWithBalance[selectedIndex].index }); return { diff --git a/yarn.lock b/yarn.lock index 0e10a06..9ddfb63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -763,7 +763,7 @@ rxjs "6" semver "^7.3.5" -"@ledgerhq/devices@^8.0.3", "@ledgerhq/devices@^8.0.5", "@ledgerhq/devices@^8.4.3": +"@ledgerhq/devices@^8.0.7", "@ledgerhq/devices@^8.3.0", "@ledgerhq/devices@^8.4.3": version "8.4.3" resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-8.4.3.tgz#4c296df4dd4af6f1085d728609b6931a640baf86" integrity sha512-+ih+M27E6cm6DHrmw3GbS3mEaznCyFc0e62VdQux40XK2psgYhL2yBPftM4KCrBYm1UbHqXzqLN+Jb7rNIzsHg== @@ -778,52 +778,52 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.12.6.tgz#f89c82c91c2930f34bc3e0d86a27ec7b6e6e4f5f" integrity sha512-D+r2B09vaRO06wfGoss+rNgwqWSoK0bCtsaJWzlD2hv1zxTtucqVtSztbRFypIqxWTCb3ix5Nh2dWHEJVTp2Xw== -"@ledgerhq/errors@^6.12.6", "@ledgerhq/errors@^6.13.0", "@ledgerhq/errors@^6.19.0": +"@ledgerhq/errors@^6.12.6", "@ledgerhq/errors@^6.14.0", "@ledgerhq/errors@^6.16.4", "@ledgerhq/errors@^6.19.0": version "6.19.0" resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.19.0.tgz#ed4f01df3dabfcdeb0b073159d66cb5f2d086243" integrity sha512-c3Jid7euMSnpHFp8H7iPtsmKDjwbTjlG46YKdw+RpCclsqtBx1uQDlYmcbP1Yv9201kVlUFUhhP4H623k8xzlQ== -"@ledgerhq/hw-transport-web-ble@6.27.17": - version "6.27.17" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-web-ble/-/hw-transport-web-ble-6.27.17.tgz#40bdf67dd277863c307399ea42f62e607c88b278" - integrity sha512-OoKbImhgyi43F6PM2KAJfViW+oEmZ3M8Tq9XZ0X57oL6QCQUYv6FakEFFkZzNuNWFdtFKGPgNt6xygqIdNElEQ== +"@ledgerhq/hw-transport-web-ble@6.28.6": + version "6.28.6" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-web-ble/-/hw-transport-web-ble-6.28.6.tgz#f1f5361983b2f4ead0f716f326b5881809b97066" + integrity sha512-SsseU5T4ePhdvFdwUOsF207gyMgiHyymvRAV66/hpHCd0+m/81kV8nZneeD3Z1pG0XPG+tPlF90r7nLwtUoiXw== dependencies: - "@ledgerhq/devices" "^8.0.5" - "@ledgerhq/errors" "^6.13.0" - "@ledgerhq/hw-transport" "^6.28.6" - "@ledgerhq/logs" "^6.10.1" - rxjs "6" + "@ledgerhq/devices" "^8.3.0" + "@ledgerhq/errors" "^6.16.4" + "@ledgerhq/hw-transport" "^6.30.6" + "@ledgerhq/logs" "^6.12.0" + rxjs "^7.8.1" -"@ledgerhq/hw-transport-webhid@6.27.15": - version "6.27.15" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webhid/-/hw-transport-webhid-6.27.15.tgz#36cbf1fd710dee19f51519668229a5df95b05046" - integrity sha512-xhtFy/SNttvBna8t1ZiP74K6Lj8uDhp0W+Zjvwz4IS6tS9gWZbKUB7scbrNrJep6Q77Of1bzDXrswyaoxFZrUg== +"@ledgerhq/hw-transport-webhid@6.28.6": + version "6.28.6" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webhid/-/hw-transport-webhid-6.28.6.tgz#94562750136d869774cb56304573a1875ca6375f" + integrity sha512-npU1mgL97KovpTUgcdORoOZ7eVFgwCA7zt0MpgUGUMRNJWDgCFsJslx7KrVXlCGOg87gLfDojreIre502I5pYg== dependencies: - "@ledgerhq/devices" "^8.0.3" - "@ledgerhq/errors" "^6.12.6" - "@ledgerhq/hw-transport" "^6.28.4" - "@ledgerhq/logs" "^6.10.1" + "@ledgerhq/devices" "^8.3.0" + "@ledgerhq/errors" "^6.16.4" + "@ledgerhq/hw-transport" "^6.30.6" + "@ledgerhq/logs" "^6.12.0" -"@ledgerhq/hw-transport-webusb@6.27.15": - version "6.27.15" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webusb/-/hw-transport-webusb-6.27.15.tgz#b661000ca68f21ed1cd4f931f0c9690b217529fc" - integrity sha512-XRteQmJMFbMETOwwwJrXhEvBEdu1DpuDQNI04bzMQE9p81rLjwd6pIhfP/W1O94av7Iq4kaatNsNpxkitmp59w== +"@ledgerhq/hw-transport-webusb@6.28.6": + version "6.28.6" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webusb/-/hw-transport-webusb-6.28.6.tgz#c17c193578da112ef76769e4ce72129d40d87faa" + integrity sha512-rzICsvhcFcL4wSAvRPe+b9EEWB8cxj6yWy3FZdfs7ufi/0muNpFXWckWv1TC34em55sGXu2cMcwMKXg/O/Lc0Q== dependencies: - "@ledgerhq/devices" "^8.0.3" - "@ledgerhq/errors" "^6.12.6" - "@ledgerhq/hw-transport" "^6.28.4" - "@ledgerhq/logs" "^6.10.1" + "@ledgerhq/devices" "^8.3.0" + "@ledgerhq/errors" "^6.16.4" + "@ledgerhq/hw-transport" "^6.30.6" + "@ledgerhq/logs" "^6.12.0" -"@ledgerhq/hw-transport@6.28.4": - version "6.28.4" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.28.4.tgz#c2fc5bff4fca71ac44f069b775d33d0b1b5d9000" - integrity sha512-fB2H92YQjidmae2GFCmOGPwkZWk0lvTu0tlLlzfiY0wRheAG+DEgjnqhdU8wmydkPLIj0WUjRgldtnJtg/a2iQ== +"@ledgerhq/hw-transport@6.28.8": + version "6.28.8" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.28.8.tgz#f99a5c71c5c09591e9bfb1b970c42aafbe81351f" + integrity sha512-XxQVl4htd018u/M66r0iu5nlHi+J6QfdPsORzDF6N39jaz+tMqItb7tUlXM/isggcuS5lc7GJo7NOuJ8rvHZaQ== dependencies: - "@ledgerhq/devices" "^8.0.3" - "@ledgerhq/errors" "^6.12.6" + "@ledgerhq/devices" "^8.0.7" + "@ledgerhq/errors" "^6.14.0" events "^3.3.0" -"@ledgerhq/hw-transport@^6.28.4", "@ledgerhq/hw-transport@^6.28.6": +"@ledgerhq/hw-transport@^6.30.6": version "6.31.3" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.31.3.tgz#ceecea278ee200dbb8d7e2ce5e47e09a287c1611" integrity sha512-rFplkHWF5NXtlYwAusqLlMu298NHtRD+2q/jrTYc//uu/xJO9LkDIgKid6IVF2+e1Wj7yX6YQVrU6L0Yu1ntEw== @@ -987,17 +987,17 @@ resolved "https://registry.yarnpkg.com/@multiversx/sdk-extension-provider/-/sdk-extension-provider-4.0.0-alpha.0.tgz#e00ba0df0d1ef8ac0330ff3f6f0c5ced8163c5b3" integrity sha512-LPRy2sgWG1Ti3KMxembP0/13GHntenFK1kbXAfHUJiOH29s4nbGDqBlTI0p42en4c1BGlEbVJEfpUq1LtO5ZYA== -"@multiversx/sdk-hw-provider@6.4.0": - version "6.4.0" - resolved "https://registry.yarnpkg.com/@multiversx/sdk-hw-provider/-/sdk-hw-provider-6.4.0.tgz#a9afda37a23b2950c8b9a4c1f1ddbf1e513b0fda" - integrity sha512-o+iO64U7gi3oqQHIaCNWoOCarrOQyjXEq7kEsWg/HXJOANpc+lq4GiXPtBkN5mOwPoj/UlEk1HfxA+54mTCFNQ== +"@multiversx/sdk-hw-provider@7.0.0-alpha.0": + version "7.0.0-alpha.0" + resolved "https://registry.yarnpkg.com/@multiversx/sdk-hw-provider/-/sdk-hw-provider-7.0.0-alpha.0.tgz#449b96d63ec1efa945ae15a6f217b90338a7a131" + integrity sha512-Mrv+AKXoe95CvxoGRVSF7d1MLNjvI3ot+/1muuBc3cgiwcKBFTbdW9cp5P79mEEDizI5foy/Gscn1Qs5Nh2Hrg== dependencies: "@ledgerhq/devices" "8.0.3" "@ledgerhq/errors" "6.12.6" - "@ledgerhq/hw-transport" "6.28.4" - "@ledgerhq/hw-transport-web-ble" "6.27.17" - "@ledgerhq/hw-transport-webhid" "6.27.15" - "@ledgerhq/hw-transport-webusb" "6.27.15" + "@ledgerhq/hw-transport" "6.28.8" + "@ledgerhq/hw-transport-web-ble" "6.28.6" + "@ledgerhq/hw-transport-webhid" "6.28.6" + "@ledgerhq/hw-transport-webusb" "6.28.6" buffer "6.0.3" platform "1.3.6" @@ -1622,7 +1622,7 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.13": +"@types/jest@29.5.13": version "29.5.13" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.13.tgz#8bc571659f401e6a719a7bf0dbcb8b78c71a8adc" integrity sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==