-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1bba09
commit c959343
Showing
3 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
QueryAllowanceResponse, | ||
QueryAllowancesResponse, | ||
QueryClientImpl, | ||
} from "cosmjs-types/cosmos/feegrant/v1beta1/query"; | ||
|
||
import { createPagination, createProtobufRpcClient, QueryClient } from "../../queryclient"; | ||
|
||
export interface FeegrantExtension { | ||
readonly feegrant: { | ||
readonly allowance: (granter: string, grantee: string) => Promise<QueryAllowanceResponse>; | ||
readonly allowances: (grantee: string, paginationKey?: Uint8Array) => Promise<QueryAllowancesResponse>; | ||
}; | ||
} | ||
|
||
export function setupFeegrantExtension(base: QueryClient): FeegrantExtension { | ||
// Use this service to get easy typed access to query methods | ||
// This cannot be used for proof verification | ||
const rpc = createProtobufRpcClient(base); | ||
const queryService = new QueryClientImpl(rpc); | ||
|
||
return { | ||
feegrant: { | ||
allowance: async (granter: string, grantee: string) => { | ||
const response = await queryService.Allowance({ | ||
granter: granter, | ||
grantee: grantee, | ||
}); | ||
return response; | ||
}, | ||
allowances: async (grantee: string, paginationKey?: Uint8Array) => { | ||
const response = await queryService.Allowances({ | ||
grantee: grantee, | ||
pagination: createPagination(paginationKey), | ||
}); | ||
return response; | ||
}, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters