-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from NibiruChain/develop
feat: devgas query (#325)
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 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,55 @@ | ||
import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate" | ||
import { | ||
QueryClientImpl, | ||
QueryFeeShareRequest, | ||
QueryFeeShareResponse, | ||
QueryFeeSharesByWithdrawerRequest, | ||
QueryFeeSharesByWithdrawerResponse, | ||
QueryFeeSharesRequest, | ||
QueryFeeSharesResponse, | ||
QueryParamsRequest, | ||
QueryParamsResponse, | ||
} from "../../protojs/nibiru/devgas/v1/query" | ||
|
||
export interface DevgasExtension { | ||
readonly devgas: Readonly<{ | ||
feeShare: (args: QueryFeeShareRequest) => Promise<QueryFeeShareResponse> | ||
feeSharesByWithdrawer: ( | ||
args: QueryFeeSharesByWithdrawerRequest | ||
) => Promise<QueryFeeSharesByWithdrawerResponse> | ||
feeShares: (args: QueryFeeSharesRequest) => Promise<QueryFeeSharesResponse> | ||
params: (args: QueryParamsRequest) => Promise<QueryParamsResponse> | ||
}> | ||
} | ||
|
||
export const setupDevgasExtension = (base: QueryClient): DevgasExtension => { | ||
const rpcClient = createProtobufRpcClient(base) | ||
const queryService = new QueryClientImpl(rpcClient) | ||
|
||
return { | ||
devgas: { | ||
feeShare: async (args: QueryFeeShareRequest) => { | ||
const req = QueryFeeShareRequest.fromPartial(args) | ||
const resp = await queryService.FeeShare(req) | ||
return resp | ||
}, | ||
feeSharesByWithdrawer: async ( | ||
args: QueryFeeSharesByWithdrawerRequest | ||
) => { | ||
const req = QueryFeeSharesByWithdrawerRequest.fromPartial(args) | ||
const resp = await queryService.FeeSharesByWithdrawer(req) | ||
return resp | ||
}, | ||
feeShares: async (args: QueryFeeSharesRequest) => { | ||
const req = QueryFeeSharesRequest.fromPartial(args) | ||
const resp = await queryService.FeeShares(req) | ||
return resp | ||
}, | ||
params: async (args: QueryParamsRequest) => { | ||
const req = QueryParamsRequest.fromPartial(args) | ||
const resp = await queryService.Params(req) | ||
return resp | ||
}, | ||
}, | ||
} | ||
} |
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
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
b239919
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.