@@ -2,7 +2,6 @@ import { useCallback } from 'react';
22
33import backgroundApiProxy from '@onekeyhq/kit/src/background/instance/backgroundApiProxy' ;
44import { useSendConfirm } from '@onekeyhq/kit/src/hooks/useSendConfirm' ;
5- import { vaultFactory } from '@onekeyhq/kit-bg/src/vaults/factory' ;
65import { type IModalSendParamList } from '@onekeyhq/shared/src/routes' ;
76import networkUtils from '@onekeyhq/shared/src/utils/networkUtils' ;
87import { EAccountSelectorSceneName } from '@onekeyhq/shared/types' ;
@@ -47,8 +46,13 @@ export function useUniversalStake({
4746 term,
4847 provider,
4948 } ) ;
50- const vault = await vaultFactory . getVault ( { networkId, accountId } ) ;
51- const encodedTx = await vault . buildStakeEncodedTx ( stakeTx ) ;
49+
50+ const encodedTx = await backgroundApiProxy . serviceStaking . buildEarnTx ( {
51+ networkId,
52+ accountId,
53+ tx : stakeTx ,
54+ } ) ;
55+
5256 let useFeeInTx ;
5357 let feeInfoEditable ;
5458 if ( networkUtils . isBTCNetwork ( networkId ) ) {
@@ -153,8 +157,11 @@ export function useUniversalWithdraw({
153157 provider,
154158 } ) ;
155159 }
156- const vault = await vaultFactory . getVault ( { networkId, accountId } ) ;
157- const encodedTx = await vault . buildStakeEncodedTx ( stakeTx as any ) ;
160+ const encodedTx = await backgroundApiProxy . serviceStaking . buildEarnTx ( {
161+ networkId,
162+ accountId,
163+ tx : stakeTx ,
164+ } ) ;
158165 await navigationToSendConfirm ( {
159166 encodedTx,
160167 stakingInfo,
@@ -219,8 +226,11 @@ export function useUniversalClaim({
219226 amount,
220227 identity,
221228 } ) ;
222- const vault = await vaultFactory . getVault ( { networkId, accountId } ) ;
223- const encodedTx = await vault . buildStakeEncodedTx ( stakeTx as any ) ;
229+ const encodedTx = await backgroundApiProxy . serviceStaking . buildEarnTx ( {
230+ networkId,
231+ accountId,
232+ tx : stakeTx ,
233+ } ) ;
224234 await navigationToSendConfirm ( {
225235 encodedTx,
226236 stakingInfo,
0 commit comments