Skip to content

Commit

Permalink
hotfix(rewards): unable to claim rewards using HW (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
creed-victor authored Dec 23, 2021
1 parent 44604a4 commit ac1e819
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/hooks/useSendContractTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function useSendContractTx(
const [tx, setTx] = useState<Transaction>();

const send = useCallback(
(
async (
args: any[],
config: TransactionConfig = {},
options: TransactionOptions = {},
Expand All @@ -72,7 +72,7 @@ export function useSendContractTx(
config.gas = gasLimit[options.type];
}

contractWriter
await contractWriter
.send(contractName, methodName, args, config)
.then(e => {
const transactionHash = e as string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ import { contractReader } from 'utils/sovryn/contract-reader';
import { useSendContractTx } from 'app/hooks/useSendContractTx';
import { useAccount } from 'app/hooks/useAccount';
import { ethGenesisAddress, gasLimit } from 'utils/classifiers';
import { TxType } from 'store/global/transactions-store/types';
import { TxStatus, TxType } from 'store/global/transactions-store/types';
import { useMemo } from 'react';

export const useClaimRewardSov = (
hasLockedSov: boolean,
hasLMRewards: boolean,
) => {
const address = useAccount();

const { send: sendLocked } = useSendContractTx(
const { send: sendLocked, ...tx1 } = useSendContractTx(
'lockedSov',
'createVestingAndStake',
);

const { send, ...tx } = useSendContractTx(
const { send, ...tx2 } = useSendContractTx(
'liquidityMiningProxy',
'claimRewardFromAllPools',
);

const tx = useMemo(() => (tx2 && tx2.status !== TxStatus.NONE ? tx2 : tx1), [
tx1,
tx2,
]);

return {
send: async () => {
let nonce = await contractReader.nonce(address);
Expand Down

0 comments on commit ac1e819

Please sign in to comment.