Skip to content

Commit

Permalink
chore: add staking grant for cancelling unbondings (#123)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin <[email protected]>

---------

Signed-off-by: Justin <[email protected]>
Co-authored-by: Justin <[email protected]>
  • Loading branch information
icfor and justinbarry authored Mar 7, 2024
1 parent 8930780 commit e4aa3f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-tips-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"abstraxion-dashboard": patch
---

Add staking grant for cancelling unbondings (MsgCancelUnbondingDelegation)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
StakeAuthorization,
} from "cosmjs-types/cosmos/staking/v1beta1/authz";
import {
MsgCancelUnbondingDelegation,
MsgDelegate,
MsgUndelegate,
} from "cosmjs-types/cosmos/staking/v1beta1/tx";
Expand Down Expand Up @@ -46,6 +47,7 @@ export const generateStakeGrant = (
MsgDelegate.typeUrl,
MsgUndelegate.typeUrl,
MsgExec.typeUrl,
MsgCancelUnbondingDelegation.typeUrl,
],
}),
).finish(),
Expand All @@ -55,16 +57,19 @@ 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: {
authorization: {
typeUrl: GenericAuthorization.typeUrl,
value: GenericAuthorization.encode(
GenericAuthorization.fromPartial({
msg: MsgWithdrawDelegatorReward.typeUrl,
msg,
}),
).finish(),
},
Expand All @@ -75,7 +80,7 @@ export const generateStakeGrant = (
grantee,
granter,
}),
};
}));

const grants = [
AuthorizationType.AUTHORIZATION_TYPE_DELEGATE,
Expand All @@ -102,5 +107,5 @@ export const generateStakeGrant = (
}),
}));

return [...grants, genericMsgGrant, feeGrant];
return [...grants, ...genericMsgGrants, feeGrant];
};

0 comments on commit e4aa3f0

Please sign in to comment.