From 85d093ccb27e75c09fcb4226df7987ea1138d139 Mon Sep 17 00:00:00 2001 From: Andrey Makarov Date: Mon, 30 Jan 2023 15:25:45 +0400 Subject: [PATCH] feat: change api --- package.json | 4 ++-- src/provider.ts | 33 ++++++++++++++------------------- src/types.ts | 1 - yarn.lock | 8 ++++---- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 7398686..f5f6422 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@haqq/provider-ledger-react-native", - "version": "0.0.11", + "version": "0.0.12", "description": "Provider for react-native ledger", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,7 +30,7 @@ }, "devDependencies": { "@types/react-native": "^0.70.6", - "@haqq/provider-base": "^0.0.7", + "@haqq/provider-base": "^0.0.10", "@types/jest": "^29.2.5", "@types/node": "^18.11.18", "jest": "^29.3.1", diff --git a/src/provider.ts b/src/provider.ts index f90c323..f72c2fb 100644 --- a/src/provider.ts +++ b/src/provider.ts @@ -6,7 +6,7 @@ import { } from '@haqq/provider-base'; import AppEth, {ledgerService} from '@ledgerhq/hw-app-eth'; import TransportBLE from '@ledgerhq/react-native-hw-transport-ble'; -import {UnsignedTransaction, utils} from 'ethers'; +import {utils, UnsignedTransaction} from 'ethers'; import {suggestApp} from './commands/suggest-app'; import {getDeviceConnection} from './get-device-connection'; import {sleep} from './sleep'; @@ -16,6 +16,11 @@ export class ProviderLedgerReactNative extends Provider { + const {address} = await this.getPublicKeyAndAddressForHDPath(hdPath) + return address + } + async getPublicKeyAndAddressForHDPath(hdPath: string) { let resp = {publicKey: '', address: ''} try { @@ -48,21 +53,12 @@ export class ProviderLedgerReactNative extends Provider