-
Notifications
You must be signed in to change notification settings - Fork 573
fix(cosmosgen): fix ts-client #4347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e8e84de
fix(cosmosgen): fix ts-client
julienrbrt c0e38f7
Merge branch 'main' into julien/ts-client
julienrbrt ab206ce
cl
julienrbrt 4092791
Merge branch 'main' into julien/ts-client
julienrbrt 3580f45
Merge branch 'main' into julien/ts-client
julienrbrt 8da0038
fix path
julienrbrt 22d8370
add axios + fix typescript path
julienrbrt 6ffb680
simplify
julienrbrt a99085e
Merge branch 'main' into julien/ts-client
julienrbrt 4993803
updates
julienrbrt 0e9c136
rm consensus chain specific logic
julienrbrt 0485cb9
Merge branch 'main' into julien/ts-client
julienrbrt 00426a6
fix
julienrbrt b0f511e
fix templates
julienrbrt 6f03bdc
fix type discovery
julienrbrt edb41e6
Merge branch 'main' into julien/ts-client
julienrbrt 9a4388a
lint
julienrbrt 10efe64
remove broken disclaimer from docs
julienrbrt 01dc256
add error goup at correct place
julienrbrt fd14adf
lint
julienrbrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| package cosmosgen_test |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,45 @@ | ||
| /* eslint-disable */ | ||
| import axios from 'axios' | ||
| import * as qs from 'qs' | ||
|
|
||
| // this is used to derive the proper return types for query endpoints | ||
| export type BaseQueryClient = { | ||
| queryBalances: (address: string, params?: any) => Promise<any> | ||
| } | ||
|
|
||
| export class Api { | ||
| private axios: any | ||
| private baseURL: string | ||
|
|
||
| constructor({ baseURL }: { baseURL: string }) { | ||
| this.baseURL = baseURL | ||
| this.axios = axios.create({ | ||
| baseURL, | ||
| timeout: 30000, | ||
| paramsSerializer: function(params: any) { | ||
| return qs.stringify(params, { arrayFormat: 'repeat' }) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| // common helper for most simple operations | ||
| private async handleRequest(url: string, params?: any): Promise<any> { | ||
| try { | ||
| const response = await this.axios.get(url, { params }) | ||
| return response | ||
| } catch (e: any) { | ||
| if (e.response?.data) { | ||
| console.error('Error in API request:', e.response.data) | ||
| } | ||
| throw e | ||
| } | ||
| } | ||
|
|
||
| // Return URL for specific module endpoints | ||
| public getModuleEndpoint(endpoint: string): string { | ||
| return `${this.baseURL}/${endpoint}` | ||
| } | ||
|
|
||
| // Methods for specific module endpoints can be added here | ||
| // The actual methods will be auto-generated from OpenAPI specs in a real implementation | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.