@@ -148,36 +148,30 @@ export function getBtcProviderForECKey(
148148
149149 return {
150150 /**
151- * @param signingStep
152151 * @param message
153152 * @param type
154153 * @returns Base64 encoded string
155154 */
156- async signMessage (
157- signingStep : vendor . SigningStep ,
158- message : string ,
159- type : 'ecdsa' | 'bip322-simple'
160- ) : Promise < string > {
161- assert ( signingStep === 'proof-of-possession' ) ;
155+ async signMessage ( message : string , type : 'ecdsa' | 'bip322-simple' ) : Promise < string > {
162156 switch ( type ) {
163157 case 'ecdsa' :
164158 return toBase64 ( stakerKey . sign ( Buffer . from ( message , 'hex' ) ) ) ;
165159 case 'bip322-simple' :
166160 return toBase64 ( signBip322Simple ( message ) ) ;
167161 default :
168- throw new Error ( `unexpected signing step : ${ signingStep } ` ) ;
162+ throw new Error ( `unexpected type : ${ type } ` ) ;
169163 }
170164 } ,
171165
172- async signPsbt ( signingStep : vendor . SigningStep , psbtHex : string ) : Promise < string > {
166+ async signPsbt ( psbtHex : string , options : vendor . SignPsbtOptions ) : Promise < string > {
173167 const psbt = bitcoinjslib . Psbt . fromHex ( psbtHex ) ;
174- switch ( signingStep ) {
175- case 'staking- slashing' :
168+ switch ( options . action . name ) {
169+ case 'sign-btc- slashing-transaction ' :
176170 return signWithDescriptor ( psbt , descriptorBuilder . getStakingDescriptor ( ) , stakerKey ) . toHex ( ) ;
177- case 'unbonding-slashing' :
171+ case 'sign-btc- unbonding-slashing-transaction ' :
178172 return signWithDescriptor ( psbt , descriptorBuilder . getUnbondingDescriptor ( ) , stakerKey ) . toHex ( ) ;
179173 default :
180- throw new Error ( `unexpected signing step: ${ signingStep } ` ) ;
174+ throw new Error ( `unexpected signing step: ${ options . action . name } ` ) ;
181175 }
182176 } ,
183177 } ;
@@ -225,7 +219,7 @@ export function createStaking(
225219 toBitcoinJsNetwork ( network ) ,
226220 stakerBtcInfo ,
227221 params ,
228- stakingInput . finalityProviderPkNoCoordHex ,
222+ stakingInput . finalityProviderPksNoCoordHex ,
229223 stakingInput . stakingTimelock
230224 ) ;
231225}
@@ -265,6 +259,7 @@ export function toStakingTransaction(tx: TransactionLike): bitcoinjslib.Transact
265259 * The difference is that here we are returning an _unsigned_ delegation message.
266260 */
267261export async function createDelegationMessageWithTransaction (
262+ channel : 'delegation:create' | 'delegation:register' ,
268263 manager : vendor . BabylonBtcStakingManager ,
269264 staking : vendor . Staking ,
270265 stakingAmountSat : number ,
@@ -276,10 +271,11 @@ export async function createDelegationMessageWithTransaction(
276271 }
277272 // Create delegation message without including inclusion proof
278273 return manager . createBtcDelegationMsg (
274+ channel ,
279275 staking ,
280276 {
281277 stakingTimelock : staking . stakingTimelock ,
282- finalityProviderPkNoCoordHex : staking . finalityProviderPkNoCoordHex ,
278+ finalityProviderPksNoCoordHex : staking . finalityProviderPksNoCoordHex ,
283279 stakingAmountSat,
284280 } ,
285281 toStakingTransaction ( transaction ) ,
@@ -298,6 +294,7 @@ export async function createUnsignedPreStakeRegistrationBabylonTransactionWithBt
298294 inputUTXOs : vendor . UTXO [ ] ,
299295 feeRateSatB : number ,
300296 babylonAddress : string ,
297+ channel : 'delegation:create' | 'delegation:register' ,
301298 stakingParams : vendor . VersionedStakingParams [ ] = getStakingParams ( network )
302299) : Promise < Result > {
303300 if ( inputUTXOs . length === 0 ) {
@@ -308,6 +305,7 @@ export async function createUnsignedPreStakeRegistrationBabylonTransactionWithBt
308305 // Create unsigned staking transaction
309306 const { transaction } = staking . createStakingTransaction ( stakingInput . stakingAmountSat , inputUTXOs , feeRateSatB ) ;
310307 const unsignedDelegationMsg = await createDelegationMessageWithTransaction (
308+ channel ,
311309 manager ,
312310 staking ,
313311 stakingInput . stakingAmountSat ,
0 commit comments