Show transaction details in context methods and confirmation modals for redeeming/compounding rewards
This commit is contained in:
+2
-1
@@ -28,7 +28,8 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
|
||||
- wallet: new delegation and rewards UI
|
||||
- wallet: show version in nav bar
|
||||
- wallet: contract admin route put back
|
||||
- waller: staking_supply field to StateParams
|
||||
- wallet: staking_supply field to StateParams
|
||||
- wallet: show transaction hash for redeeming or compounding rewards
|
||||
- network-statistics: a new mixnet service that aggregates and exposes anonymized data about mixnet services ([#1328])
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -32,8 +32,8 @@ export type TDelegationContext = {
|
||||
tokenPool: TPoolOption,
|
||||
) => Promise<TransactionExecuteResult>;
|
||||
undelegate: (identity: string, proxy: string | null) => Promise<TransactionExecuteResult>;
|
||||
redeemRewards: (identity: string, proxy: string | null) => Promise<void>;
|
||||
compoundRewards: (identity: string, proxy: string | null) => Promise<void>;
|
||||
redeemRewards: (identity: string, proxy: string | null) => Promise<TransactionExecuteResult>;
|
||||
compoundRewards: (identity: string, proxy: string | null) => Promise<TransactionExecuteResult>;
|
||||
};
|
||||
|
||||
export type TDelegationTransaction = {
|
||||
@@ -100,10 +100,10 @@ export const DelegationContextProvider: FC<{
|
||||
try {
|
||||
if ((proxy || '').trim().length === 0) {
|
||||
// the owner of the delegation is main account (the owner of the vesting account), so it is delegation with unlocked tokens
|
||||
await claimDelegatorRewards(identity);
|
||||
return claimDelegatorRewards(identity);
|
||||
} else {
|
||||
// the delegation is with locked tokens, so use the vesting contract
|
||||
await vestingClaimDelegatorRewards(identity);
|
||||
return vestingClaimDelegatorRewards(identity);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e as string);
|
||||
@@ -114,10 +114,10 @@ export const DelegationContextProvider: FC<{
|
||||
try {
|
||||
if ((proxy || '').trim().length === 0) {
|
||||
// the owner of the delegation is main account (the owner of the vesting account), so it is delegation with unlocked tokens
|
||||
await compoundDelegatorRewards(identity);
|
||||
return compoundDelegatorRewards(identity);
|
||||
} else {
|
||||
// the delegation is with locked tokens, so use the vesting contract
|
||||
await vestingCompoundDelegatorRewards(identity);
|
||||
return vestingCompoundDelegatorRewards(identity);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e as string);
|
||||
|
||||
@@ -196,12 +196,13 @@ export const Delegation: FC = () => {
|
||||
setCurrentDelegationListActionItem(undefined);
|
||||
|
||||
try {
|
||||
await redeemRewards(identityKey, proxy);
|
||||
const tx = await redeemRewards(identityKey, proxy);
|
||||
const bal = await userBalance();
|
||||
setConfirmationModalProps({
|
||||
status: 'success',
|
||||
action: 'redeem',
|
||||
balance: bal?.printable_balance || '-',
|
||||
transactionUrl: `${urls(network).blockExplorer}/transaction/${tx.transaction_hash}`,
|
||||
});
|
||||
} catch (e) {
|
||||
setConfirmationModalProps({
|
||||
@@ -221,12 +222,13 @@ export const Delegation: FC = () => {
|
||||
setCurrentDelegationListActionItem(undefined);
|
||||
|
||||
try {
|
||||
await compoundRewards(identityKey, proxy);
|
||||
const tx = await compoundRewards(identityKey, proxy);
|
||||
const bal = await userBalance();
|
||||
setConfirmationModalProps({
|
||||
status: 'success',
|
||||
action: 'compound',
|
||||
balance: bal?.printable_balance || '-',
|
||||
transactionUrl: `${urls(network).blockExplorer}/transaction/${tx.transaction_hash}`,
|
||||
});
|
||||
} catch (e) {
|
||||
setConfirmationModalProps({
|
||||
|
||||
Reference in New Issue
Block a user