Skip to content

Commit

Permalink
Replaced keyring with key pair
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed Sep 29, 2023
1 parent 17f4917 commit ab4a3c6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions typescript/src/redemption.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BigNumber } from "ethers"
import {
createKeyRing,
createAddressFromPublicKey,
decomposeRawTransaction,
RawTransaction,
Expand Down Expand Up @@ -145,15 +144,22 @@ export async function submitRedemptionTransaction(
transactionHex: mainUtxoRawTransaction.transactionHex,
}

const bitcoinNetwork = await bitcoinClient.getNetwork()

// eslint-disable-next-line new-cap
const walletKeyPair = ECPairFactory(tinysecp).fromWIF(
walletPrivateKey,
toBitcoinJsLibNetwork(bitcoinNetwork)
)
const walletPublicKey = walletKeyPair.publicKey.toString("hex")

const redemptionRequests = await getWalletRedemptionRequests(
bridge,
createKeyRing(walletPrivateKey).getPublicKey().toString("hex"),
walletPublicKey,
redeemerOutputScripts,
"pending"
)

const bitcoinNetwork = await bitcoinClient.getNetwork()

const { transactionHash, newMainUtxo, rawTransaction } =
await assembleRedemptionTransaction(
bitcoinNetwork,
Expand Down

0 comments on commit ab4a3c6

Please sign in to comment.