File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11import { CosmosEvent , CosmosMessage } from "@subql/types-cosmos" ;
2- import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz" ;
32import { MsgGrant } from "cosmjs-types/cosmos/authz/v1beta1/tx" ;
43import { AuthzProps } from "../../types/models/Authz" ;
54import { getAuthzId , getBlockId , getEventId } from "../utils/ids" ;
@@ -54,10 +53,21 @@ function _handleEventGrant(event: CosmosEvent): AuthzProps {
5453function _handleMsgGrant ( msg : CosmosMessage < MsgGrant > ) : AuthzProps {
5554 const { grant, grantee, granter} = msg . msg . decodedMsg ;
5655
57- const msgType = GenericAuthorization . decode ( grant . authorization ! . value ) . msg
5856 const expiration = grant . expiration ? new Date ( Number ( grant . expiration . seconds ) * 1000 + Math . floor ( grant . expiration . nanos / 1_000_000 ) ) : undefined
5957 const event = msg . block . events . find ( e => e . event . type === '' && isEventOfMessageKind ( e ) && e . tx . hash === msg . tx . hash ) !
6058
59+ let msgType : string | null = null
60+
61+ for ( const { key, value} of event . event . attributes ) {
62+ if ( key === "msg_type_url" ) {
63+ msgType = parseAttribute ( value )
64+ break
65+ }
66+ }
67+
68+ if ( ! msgType ) {
69+ throw new Error ( `[handleMsgGrant] msgType not found in event` ) ;
70+ }
6171
6272 return {
6373 id : getAuthzId (
You can’t perform that action at this time.
0 commit comments