Skip to content

Commit 5cba3ec

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 5cba3ec

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

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

219219
/**
220220
* Create prebuilt staking transaction.
221+
*
222+
* for transactions with tx request id, we need to delete signature shares before creating prebuild transaction
223+
*
221224
* @param transaction
222225
*/
223226
async prebuildSelfManagedStakingTransaction(transaction: StakingTransaction): Promise<PrebuildTransactionResult> {
224-
const builtStakingTransaction = await this.build(transaction);
225-
const buildParams = builtStakingTransaction.transaction.buildParams;
227+
if (transaction.txRequestId) {
228+
await this.tssUtil.deleteSignatureShares(transaction.txRequestId);
229+
}
230+
const buildParams = (await this.expandBuildParams(transaction)).buildParams;
226231
const formattedParams = {
227232
...buildParams,
228233
coin: this.coin,
229234
walletId: this.walletId,
230235
walletType: this.wallet.type(),
231236
preview: true,
232237
};
233-
return await this.wallet.prebuildTransaction(formattedParams);
238+
return await (await this.getWalletForBuildingAndSigning()).prebuildTransaction(formattedParams);
234239
}
235240

236241
/**

0 commit comments

Comments
 (0)