Skip to content
Merged
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
10 changes: 9 additions & 1 deletion modules/utxo-staking/src/babylon/stakingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class BitGoStakingManager extends vendor.BabylonBtcStakingManager {
stakerBtcAddress: string,
sigType: BTCSigType
): Promise<ProofOfPossessionBTC> {
if (!bech32Address.startsWith('bbn1')) {
throw new Error('invalid bech32 babylon address, must start with bbn1');
}
const signedBabylonAddress = await this.btcProvider.signMessage(
bech32Address,
sigType === BTCSigType.BIP322 ? 'bip322-simple' : 'ecdsa'
Expand All @@ -65,11 +68,16 @@ class BitGoStakingManager extends vendor.BabylonBtcStakingManager {

/**
* Creates a proof of possession for the staker based on ECDSA signature.
* @param channel - The channel for which the proof of possession is created.
* @param bech32Address - The staker's bech32 address on the babylon network.
* @param stakerBtcAddress
* @returns The proof of possession.
*/
async createProofOfPossession(bech32Address: string, stakerBtcAddress: string): Promise<ProofOfPossessionBTC> {
override async createProofOfPossession(
channel: 'delegation:create' | 'delegation:register',
bech32Address: string,
stakerBtcAddress: string
): Promise<ProofOfPossessionBTC> {
// force the ECDSA signature type
return this.createProofOfPossessionWithSigType(bech32Address, stakerBtcAddress, BTCSigType.ECDSA);
}
Expand Down