-
Notifications
You must be signed in to change notification settings - Fork 196
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 #257 from InjectiveLabs/dev
chore: patch release
- Loading branch information
Showing
54 changed files
with
971 additions
and
381 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 |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
node-version: '16.18.1' | ||
|
||
- name: 'Setup [email protected]' | ||
run: yarn global add [email protected] --ignore-engines | ||
run: yarn global add [email protected] --ignore-engines | ||
|
||
- name: Set up Git user | ||
run: | | ||
|
@@ -33,7 +33,7 @@ jobs: | |
- name: Build dependencies | ||
run: | | ||
node etc/bootstrapEnv | ||
yarn install --ignore-engines | ||
yarn install --ignore-engines | ||
yarn build | ||
- name: 'Setup npm' | ||
|
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,14 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-10-27) | ||
|
||
**Note:** Version bump only for package @injectivelabs/bridge-ts | ||
|
||
|
||
|
||
|
||
|
||
## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-09-24) | ||
|
||
**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,14 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-10-27) | ||
|
||
**Note:** Version bump only for package @injectivelabs/contracts | ||
|
||
|
||
|
||
|
||
|
||
## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-09-23) | ||
|
||
**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,14 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-10-27) | ||
|
||
**Note:** Version bump only for package @injectivelabs/exceptions | ||
|
||
|
||
|
||
|
||
|
||
## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-09-23) | ||
|
||
**Note:** Version bump only for package @injectivelabs/exceptions | ||
|
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
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,14 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-10-27) | ||
|
||
**Note:** Version bump only for package @injectivelabs/networks | ||
|
||
|
||
|
||
|
||
|
||
## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-09-23) | ||
|
||
**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
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,14 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-10-27) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-ts | ||
|
||
|
||
|
||
|
||
|
||
## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/[email protected]...@injectivelabs/[email protected]) (2023-09-24) | ||
|
||
**Note:** Version bump only for package @injectivelabs/sdk-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
33 changes: 33 additions & 0 deletions
33
packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.spec.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,33 @@ | ||
import { getNetworkEndpoints, Network } from '@injectivelabs/networks' | ||
import { IndexerCampaignTransformer } from '../transformers' | ||
import { IndexerGrpcCampaignApi } from './IndexerGrpcCampaignApi' | ||
|
||
const CAMPAIGN_ID = 'spot-grid-inj-usdt-test' | ||
const MARKET_ID = | ||
'0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0' | ||
const endpoints = getNetworkEndpoints(Network.MainnetSentry) | ||
const indexerGrpcCampaignApi = new IndexerGrpcCampaignApi(endpoints.indexer) | ||
|
||
describe('IndexerGrpcCampaignApi', () => { | ||
test('fetchCampaign', async () => { | ||
try { | ||
const response = await indexerGrpcCampaignApi.fetchCampaign({ | ||
marketId: MARKET_ID, | ||
campaignId: CAMPAIGN_ID, | ||
}) | ||
|
||
expect(response).toBeDefined() | ||
expect(response).toEqual( | ||
expect.objectContaining< | ||
ReturnType< | ||
typeof IndexerCampaignTransformer.CampaignResponseToCampaign | ||
> | ||
>(response), | ||
) | ||
} catch (e) { | ||
console.error( | ||
'IndexerGrpcCampaignApi.fetchCampaign => ' + (e as any).message, | ||
) | ||
} | ||
}) | ||
}) |
82 changes: 82 additions & 0 deletions
82
packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.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,82 @@ | ||
import { | ||
UnspecifiedErrorCode, | ||
GrpcUnaryRequestException, | ||
} from '@injectivelabs/exceptions' | ||
import { InjectiveMetaRpc } from '@injectivelabs/indexer-proto-ts' | ||
import { InjectiveCampaignRpc } from '@injectivelabs/indexer-proto-ts' | ||
import BaseGrpcConsumer from '../../BaseGrpcConsumer' | ||
import { IndexerCampaignTransformer } from '../transformers' | ||
import { IndexerModule } from '../types' | ||
|
||
/** | ||
* @category Indexer Grpc API | ||
*/ | ||
export class IndexerGrpcCampaignApi extends BaseGrpcConsumer { | ||
protected module: string = IndexerModule.Campaign | ||
|
||
protected client: InjectiveCampaignRpc.InjectiveCampaignRPCClientImpl | ||
|
||
constructor(endpoint: string) { | ||
super(endpoint) | ||
|
||
this.client = new InjectiveCampaignRpc.InjectiveCampaignRPCClientImpl( | ||
this.getGrpcWebImpl(endpoint), | ||
) | ||
} | ||
|
||
async fetchCampaign({ | ||
skip, | ||
limit, | ||
marketId, | ||
campaignId, | ||
accountAddress, | ||
}: { | ||
skip?: string | ||
limit?: number | ||
marketId?: string | ||
campaignId: string | ||
accountAddress?: string | ||
}) { | ||
const request = InjectiveCampaignRpc.RankingRequest.create() | ||
|
||
request.campaignId = campaignId | ||
|
||
if (skip) { | ||
request.skip = skip | ||
} | ||
|
||
if (limit) { | ||
request.limit = limit | ||
} | ||
|
||
if (marketId) { | ||
request.marketId = marketId | ||
} | ||
|
||
if (accountAddress) { | ||
request.accountAddress = accountAddress | ||
} | ||
|
||
try { | ||
const response = await this.retry<InjectiveCampaignRpc.RankingResponse>( | ||
() => this.client.Ranking(request), | ||
) | ||
|
||
return IndexerCampaignTransformer.CampaignResponseToCampaign(response) | ||
} catch (e: unknown) { | ||
if (e instanceof InjectiveMetaRpc.GrpcWebError) { | ||
throw new GrpcUnaryRequestException(new Error(e.toString()), { | ||
code: e.code, | ||
context: 'FetchCampaign', | ||
contextModule: this.module, | ||
}) | ||
} | ||
|
||
throw new GrpcUnaryRequestException(e as Error, { | ||
code: UnspecifiedErrorCode, | ||
context: 'FetchCampaign', | ||
contextModule: this.module, | ||
}) | ||
} | ||
} | ||
} |
Oops, something went wrong.