Skip to content

Commit

Permalink
feat(sdk-core): update prebuildSelfManagedStakingTransaction to bui…
Browse files Browse the repository at this point in the history
…ld once

`build` calls `prebuildTransaction` internally, for ETH like smc wallets
we only need the expanded params for staking transactions

SC-498

TICKET: SC-498
  • Loading branch information
noel-bitgo committed Oct 31, 2024
1 parent 8ef8b38 commit 7c17597
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/sdk-core/src/bitgo/staking/stakingWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ClaimRewardsOptions,
} from './iStakingWallet';
import { BitGoBase } from '../bitgoBase';
import { IWallet, PrebuildTransactionResult } from '../wallet';
import { IWallet, PrebuildTransactionOptions, PrebuildTransactionResult } from '../wallet';
import { ITssUtils, RequestTracer, TssUtils } from '../utils';

export class StakingWallet implements IStakingWallet {
Expand Down Expand Up @@ -221,8 +221,12 @@ export class StakingWallet implements IStakingWallet {
* @param transaction
*/
async prebuildSelfManagedStakingTransaction(transaction: StakingTransaction): Promise<PrebuildTransactionResult> {
const builtStakingTransaction = await this.build(transaction);
const buildParams = builtStakingTransaction.transaction.buildParams;
let buildParams: PrebuildTransactionOptions | undefined;
if ((this.wallet.baseCoin.supportsTss() && this.wallet.baseCoin.getFamily() !== 'eth') || this.isEthTss) {
buildParams = (await this.build(transaction)).transaction.buildParams;
} else {
buildParams = (await this.expandBuildParams(transaction)).buildParams;
}
const formattedParams = {
...buildParams,
coin: this.coin,
Expand Down

0 comments on commit 7c17597

Please sign in to comment.