Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-86du15m7h - Plan, Structure and Implement BsLib support to multich… #74

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading