Skip to content

Commit

Permalink
Merge pull request #74 from CityOfZion/CU-86du15m7h-6
Browse files Browse the repository at this point in the history
CU-86du15m7h - Plan, Structure and Implement BsLib support to multich…
  • Loading branch information
raulduartep authored Jul 18, 2024
2 parents 7ca6b6b + 7062234 commit 49591fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-ethereum",
"comment": "Fix for EthersLedgerSigner instantiation",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-ethereum"
}
6 changes: 3 additions & 3 deletions packages/bs-ethereum/src/BSEthereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BitqueryEDSEthereum } from './BitqueryEDSEthereum'
import { GhostMarketNDSEthereum } from './GhostMarketNDSEthereum'
import { RpcBDSEthereum } from './RpcBDSEthereum'
import { BitqueryBDSEthereum } from './BitqueryBDSEthereum'
import { EthersLedgerServiceEthereum, EthersLedgerSigner } from './EthersLedgerServiceEthereum'
import { EthersLedgerServiceEthereum } from './EthersLedgerServiceEthereum'
import Transport from '@ledgerhq/hw-transport'
import { BSEthereumNetworkId, BSEthereumHelper } from './BSEthereumHelper'

Expand Down Expand Up @@ -161,7 +161,7 @@ export class BSEthereum<BSCustomName extends string = string>

let signer: ethers.Signer
if (ledgerTransport) {
signer = new EthersLedgerSigner(ledgerTransport, provider)
signer = this.ledgerService.getSigner(ledgerTransport, provider)
} else {
signer = new ethers.Wallet(param.senderAccount.key, provider)
}
Expand Down Expand Up @@ -202,7 +202,7 @@ export class BSEthereum<BSCustomName extends string = string>

let signer: ethers.Signer
if (ledgerTransport) {
signer = new EthersLedgerSigner(ledgerTransport, provider)
signer = this.ledgerService.getSigner(ledgerTransport, provider)
} else {
signer = new ethers.Wallet(param.senderAccount.key, provider)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/bs-ethereum/src/EthersLedgerServiceEthereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@ export class EthersLedgerServiceEthereum implements LedgerService {
constructor(public getLedgerTransport?: (account: Account) => Promise<Transport>) {}

async getAddress(transport: Transport): Promise<string> {
const signer = new EthersLedgerSigner(transport)
const signer = this.getSigner(transport)
return await signer.getAddress()
}

async getPublicKey(transport: Transport): Promise<string> {
const signer = new EthersLedgerSigner(transport)
const signer = this.getSigner(transport)
return await signer.getPublicKey()
}

getSigner(transport: Transport): EthersLedgerSigner {
return new EthersLedgerSigner(transport, undefined, this.emitter)
getSigner(transport: Transport, provider?: ethers.providers.Provider): EthersLedgerSigner {
return new EthersLedgerSigner(transport, provider, this.emitter)
}
}

Expand Down

0 comments on commit 49591fd

Please sign in to comment.