From e4aa3f096cff27e6672393300532622040b0f781 Mon Sep 17 00:00:00 2001 From: Ignacio <142767109+icfor@users.noreply.github.com> Date: Thu, 7 Mar 2024 23:41:28 +0800 Subject: [PATCH] chore: add staking grant for cancelling unbondings (#123) Signed-off-by: Justin <328965+justinbarry@users.noreply.github.com> --------- Signed-off-by: Justin <328965+justinbarry@users.noreply.github.com> Co-authored-by: Justin <328965+justinbarry@users.noreply.github.com> --- .changeset/clever-tips-exercise.md | 5 +++++ .../AbstraxionGrant/generateStakeGrant.tsx | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .changeset/clever-tips-exercise.md diff --git a/.changeset/clever-tips-exercise.md b/.changeset/clever-tips-exercise.md new file mode 100644 index 00000000..040cb21a --- /dev/null +++ b/.changeset/clever-tips-exercise.md @@ -0,0 +1,5 @@ +--- +"abstraxion-dashboard": patch +--- + +Add staking grant for cancelling unbondings (MsgCancelUnbondingDelegation) diff --git a/apps/abstraxion-dashboard/components/AbstraxionGrant/generateStakeGrant.tsx b/apps/abstraxion-dashboard/components/AbstraxionGrant/generateStakeGrant.tsx index 7be368f9..13cc9c7d 100644 --- a/apps/abstraxion-dashboard/components/AbstraxionGrant/generateStakeGrant.tsx +++ b/apps/abstraxion-dashboard/components/AbstraxionGrant/generateStakeGrant.tsx @@ -6,6 +6,7 @@ import { StakeAuthorization, } from "cosmjs-types/cosmos/staking/v1beta1/authz"; import { + MsgCancelUnbondingDelegation, MsgDelegate, MsgUndelegate, } from "cosmjs-types/cosmos/staking/v1beta1/tx"; @@ -46,6 +47,7 @@ export const generateStakeGrant = ( MsgDelegate.typeUrl, MsgUndelegate.typeUrl, MsgExec.typeUrl, + MsgCancelUnbondingDelegation.typeUrl, ], }), ).finish(), @@ -55,8 +57,11 @@ export const generateStakeGrant = ( }), }; - // Need to grant MsgWithdrawDelegatorReward - const genericMsgGrant = { + // Need to grant MsgWithdrawDelegatorReward and MsgCancelUnbondingDelegation + const genericMsgGrants = [ + MsgWithdrawDelegatorReward.typeUrl, + MsgCancelUnbondingDelegation.typeUrl, + ].map((msg) => ({ typeUrl: MsgGrant.typeUrl, value: MsgGrant.fromPartial({ grant: { @@ -64,7 +69,7 @@ export const generateStakeGrant = ( typeUrl: GenericAuthorization.typeUrl, value: GenericAuthorization.encode( GenericAuthorization.fromPartial({ - msg: MsgWithdrawDelegatorReward.typeUrl, + msg, }), ).finish(), }, @@ -75,7 +80,7 @@ export const generateStakeGrant = ( grantee, granter, }), - }; + })); const grants = [ AuthorizationType.AUTHORIZATION_TYPE_DELEGATE, @@ -102,5 +107,5 @@ export const generateStakeGrant = ( }), })); - return [...grants, genericMsgGrant, feeGrant]; + return [...grants, ...genericMsgGrants, feeGrant]; };