authz queries to meet the expanded types provided in the sdk

This commit is contained in:
Mantas Vidutis 2022-10-25 18:27:06 -04:00
parent 30d0a656ea
commit 9263f33b69
No known key found for this signature in database
GPG Key ID: 60BDC8CD8FA60E29

View File

@ -10,6 +10,8 @@ export interface AuthzExtension {
msgTypeUrl: string,
paginationKey?: Uint8Array,
) => Promise<QueryGrantsResponse>;
readonly granteeGrants: (grantee: string, paginationKey?: Uint8Array) => Promise<QueryGrantsResponse>;
readonly granterGrants: (granter: string, paginationKey?: Uint8Array) => Promise<QueryGrantsResponse>;
};
}
@ -22,14 +24,24 @@ export function setupAuthzExtension(base: QueryClient): AuthzExtension {
return {
authz: {
grants: async (granter: string, grantee: string, msgTypeUrl: string, paginationKey?: Uint8Array) => {
const response = await queryService.Grants({
return await queryService.Grants({
granter: granter,
grantee: grantee,
msgTypeUrl: msgTypeUrl,
pagination: createPagination(paginationKey),
});
return response;
},
granteeGrants: async (grantee: string, paginationKey?: Uint8Array) => {
return await queryService.GranteeGrants({
grantee: grantee,
pagination: createPagination(paginationKey),
});
},
granterGrants: async (granter: string, paginationKey?: Uint8Array) => {
return await queryService.GranterGrants({
granter: granter,
pagination: createPagination(paginationKey),
});
},
},
};