-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tangle-dapp): Implement
useLsUpdateCommissionTx
hook
- Loading branch information
1 parent
6e3d067
commit ea75c17
Showing
4 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/tangle-dapp/data/liquidStaking/tangle/useLsUpdateCommissionTx.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import { TxName } from '../../../constants'; | ||
import { | ||
SubstrateTxFactory, | ||
useSubstrateTxWithNotification, | ||
} from '../../../hooks/useSubstrateTx'; | ||
|
||
export type LsPoolUpdateCommissionTxContext = { | ||
poolId: number; | ||
commission: number; | ||
}; | ||
|
||
const useLsUpdateCommissionTx = () => { | ||
const substrateTxFactory: SubstrateTxFactory<LsPoolUpdateCommissionTxContext> = | ||
useCallback( | ||
async (api, _activeSubstrateAddress, { poolId, commission }) => { | ||
return api.tx.lst.setCommission(poolId, commission); | ||
}, | ||
[], | ||
); | ||
|
||
// TODO: Add EVM support once precompile(s) for the `lst` pallet are implemented on Tangle. | ||
return useSubstrateTxWithNotification( | ||
TxName.LST_UPDATE_COMMISSION, | ||
substrateTxFactory, | ||
); | ||
}; | ||
|
||
export default useLsUpdateCommissionTx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters