Skip to content

Commit 26eceb5

Browse files
committed
feat(sdk-core): update prebuildSelfManagedStakingTransaction
- for TSS transactions we need to delete shares (similar thing done in the build function) - we only care about the expanded params if they exists SC-498 TICKET: SC-498
1 parent 8ef8b38 commit 26eceb5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

modules/sdk-core/src/bitgo/staking/stakingWallet.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,25 @@ export class StakingWallet implements IStakingWallet {
218218

219219
/**
220220
* Create prebuilt staking transaction.
221+
*
222+
* for transactions with tx request id (TSS transactions), we need to delete signature shares before creating prebuild transaction
223+
* we only need to get transaction build params if they exist to pre build
224+
*
221225
* @param transaction
222226
*/
223227
async prebuildSelfManagedStakingTransaction(transaction: StakingTransaction): Promise<PrebuildTransactionResult> {
224-
const builtStakingTransaction = await this.build(transaction);
225-
const buildParams = builtStakingTransaction.transaction.buildParams;
228+
if (transaction.txRequestId) {
229+
await this.tssUtil.deleteSignatureShares(transaction.txRequestId);
230+
}
231+
const buildParams = (await this.expandBuildParams(transaction)).buildParams;
226232
const formattedParams = {
227233
...buildParams,
228234
coin: this.coin,
229235
walletId: this.walletId,
230236
walletType: this.wallet.type(),
231237
preview: true,
232238
};
233-
return await this.wallet.prebuildTransaction(formattedParams);
239+
return await (await this.getWalletForBuildingAndSigning()).prebuildTransaction(formattedParams);
234240
}
235241

236242
/**

0 commit comments

Comments
 (0)