-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feat/sgt-create-strategy
- Loading branch information
Showing
57 changed files
with
823 additions
and
143 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 |
---|---|---|
|
@@ -3,6 +3,22 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.12.0-beta.73](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-10) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
||
# [1.12.0-beta.72](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
||
# [1.12.0-beta.71](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
||
# [1.12.0-beta.70](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-08) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
||
# [1.12.0-beta.69](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-06) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.12.0-beta.16](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/contracts | ||
|
||
# [1.12.0-beta.15](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-06) | ||
|
||
**Note:** Version bump only for package @injectivelabs/contracts | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,16 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.12.0-beta.12](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
### Bug Fixes | ||
|
||
- export ([c3491fa](https://github.com/InjectiveLabs/injective-ts/commit/c3491fa4f400eadd59a232535dd11993ce4a82f4)) | ||
|
||
### Features | ||
|
||
- added trust wallet ([47bae16](https://github.com/InjectiveLabs/injective-ts/commit/47bae16f3a49f075a5733d5170c315c2f411bef3)) | ||
|
||
# [1.12.0-beta.11](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-06) | ||
|
||
### Features | ||
|
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
29 changes: 29 additions & 0 deletions
29
packages/exceptions/src/exceptions/TrustWalletException.ts
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,29 @@ | ||
import { ConcreteException } from '../exception' | ||
import { ErrorContext, ErrorType } from '../types' | ||
import { mapMetamaskMessage } from '../utils/maps' | ||
|
||
const removeTrustWalletFromErrorString = (message: string): string => | ||
message | ||
.replaceAll('TrustWallet', '') | ||
.replaceAll('Trust Wallet', '') | ||
.replaceAll('Trustwallet', '') | ||
.replaceAll('TrustWallet:', '') | ||
.replaceAll('Trust Wallet:', '') | ||
|
||
export class TrustWalletException extends ConcreteException { | ||
public errorClass: string = 'TrustWalletException' | ||
|
||
constructor(error: Error, context?: ErrorContext) { | ||
super(error, context) | ||
|
||
this.type = ErrorType.WalletError | ||
} | ||
|
||
public parseMessage(): void { | ||
const { message } = this | ||
|
||
this.setMessage( | ||
mapMetamaskMessage(removeTrustWalletFromErrorString(message)), | ||
) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.12.0-beta.16](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/networks | ||
|
||
# [1.12.0-beta.15](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-06) | ||
|
||
**Note:** Version bump only for package @injectivelabs/networks | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,22 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.12.0-beta.69](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-10) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-ts | ||
|
||
# [1.12.0-beta.68](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-ts | ||
|
||
# [1.12.0-beta.67](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-09) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-ts | ||
|
||
# [1.12.0-beta.66](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-08) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-ts | ||
|
||
# [1.12.0-beta.65](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-08-06) | ||
|
||
### Features | ||
|
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
60 changes: 60 additions & 0 deletions
60
packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthZApi.ts
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,60 @@ | ||
import { | ||
GrpcUnaryRequestException, | ||
UnspecifiedErrorCode, | ||
} from '@injectivelabs/exceptions' | ||
import { CosmosAuthzV1Beta1Query } from '@injectivelabs/core-proto-ts' | ||
import BaseGrpcConsumer from '../../BaseGrpcConsumer' | ||
import { ChainModule } from '../types' | ||
import { PaginationOption } from '../../../types/pagination' | ||
import { paginationRequestFromPagination } from '../../../utils/pagination' | ||
import { ChainGrpcAuthZTransformer } from '../transformers/ChainGrpcAuthZTransformer' | ||
|
||
/** | ||
* @category Chain Grpc API | ||
*/ | ||
export class ChainGrpcAuthZApi extends BaseGrpcConsumer { | ||
protected module: string = ChainModule.Authz | ||
|
||
protected client: CosmosAuthzV1Beta1Query.QueryClientImpl | ||
|
||
constructor(endpoint: string) { | ||
super(endpoint) | ||
|
||
this.client = new CosmosAuthzV1Beta1Query.QueryClientImpl( | ||
this.getGrpcWebImpl(endpoint), | ||
) | ||
} | ||
|
||
async fetchGrants(pagination?: PaginationOption) { | ||
const request = CosmosAuthzV1Beta1Query.QueryGrantsRequest.create() | ||
|
||
const paginationForRequest = paginationRequestFromPagination(pagination) | ||
|
||
if (paginationForRequest) { | ||
request.pagination = paginationForRequest | ||
} | ||
|
||
try { | ||
const response = | ||
await this.retry<CosmosAuthzV1Beta1Query.QueryGrantsResponse>(() => | ||
this.client.Grants(request), | ||
) | ||
|
||
return ChainGrpcAuthZTransformer.grpcGrantsToGrants(response) | ||
} catch (e: unknown) { | ||
if (e instanceof CosmosAuthzV1Beta1Query.GrpcWebError) { | ||
throw new GrpcUnaryRequestException(new Error(e.toString()), { | ||
code: e.code, | ||
context: 'Params', | ||
contextModule: this.module, | ||
}) | ||
} | ||
|
||
throw new GrpcUnaryRequestException(e as Error, { | ||
code: UnspecifiedErrorCode, | ||
context: 'Grants', | ||
contextModule: this.module, | ||
}) | ||
} | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
packages/sdk-ts/src/client/chain/transformers/ChainGrpcAuthZTransformer.ts
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,28 @@ | ||
import { grpcPaginationToPagination } from '../../../utils/pagination' | ||
import { | ||
CosmosAuthzV1Beta1Authz, | ||
CosmosAuthzV1Beta1Query, | ||
} from '@injectivelabs/core-proto-ts' | ||
|
||
/** | ||
* @category Chain Grpc Transformer | ||
*/ | ||
export class ChainGrpcAuthZTransformer { | ||
static grpcGrantToGrant(grant: CosmosAuthzV1Beta1Authz.Grant) { | ||
return { | ||
authorization: grant.authorization | ||
? Buffer.from(grant.authorization.value).toString('utf-8') | ||
: '', | ||
expiration: grant.expiration, | ||
} | ||
} | ||
|
||
static grpcGrantsToGrants( | ||
response: CosmosAuthzV1Beta1Query.QueryGrantsResponse, | ||
) { | ||
return { | ||
pagination: grpcPaginationToPagination(response.pagination!), | ||
grants: response.grants.map(ChainGrpcAuthZTransformer.grpcGrantToGrant), | ||
} | ||
} | ||
} |
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
Oops, something went wrong.