Skip to content

Commit

Permalink
Merge branch 'master' of github.com:InjectiveLabs/injective-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Feb 10, 2022
2 parents ea652e8 + ee1b836 commit df5cbc8
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 17 deletions.
8 changes: 8 additions & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## [0.0.101](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.100...@injectivelabs/contracts@0.0.101) (2022-02-10)

**Note:** Version bump only for package @injectivelabs/contracts





## [0.0.100](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@0.0.98...@injectivelabs/contracts@0.0.100) (2022-02-09)


Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/contracts",
"description": "Contracts wrapper that can be reused throughout Injective's projects.",
"version": "0.0.100",
"version": "0.0.101",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"@injectivelabs/ts-types": "^0.0.38",
"@injectivelabs/utils": "^0.0.54",
"@injectivelabs/web3-contract-typings": "^0.1.13",
"@injectivelabs/web3-strategy": "^0.0.92",
"@injectivelabs/web3-strategy": "^0.0.93",
"@types/ethereumjs-util": "^6.1.0",
"@types/jest": "^27.0.1",
"@types/node": "^16.9.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/referral-consumer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.10](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/referral-consumer@0.0.9...@injectivelabs/referral-consumer@0.0.10) (2022-02-10)


### Features

* update referral consumer with latest changes ([ee1b836](https://github.com/InjectiveLabs/injective-ts/commit/ee1b8363489f6d661c2321aad55384bce802b80a))





## [0.0.9](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/referral-consumer@0.0.7...@injectivelabs/referral-consumer@0.0.9) (2022-02-09)


Expand Down
5 changes: 3 additions & 2 deletions packages/referral-consumer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/referral-consumer",
"description": "Referral API on Injective Protocol made easy. Can be reused throughout Injective's projects.",
"version": "0.0.9",
"version": "0.0.10",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -29,8 +29,9 @@
"dependencies": {
"@improbable-eng/grpc-web": "^0.15.0",
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
"@injectivelabs/common-rpc": "^1.0.2",
"@injectivelabs/exceptions": "^0.0.42",
"@injectivelabs/referral-api": "^1.0.15",
"@injectivelabs/referral-api": "^1.0.19",
"@injectivelabs/ts-types": "^0.0.38",
"@injectivelabs/utils": "^0.0.54",
"link-module-alias": "^1.2.0",
Expand Down
24 changes: 22 additions & 2 deletions packages/referral-consumer/src/consumers/ReferralConsumer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { GrpcException } from '@injectivelabs/exceptions'
import { InjectiveReferralRPC } from '@injectivelabs/referral-api/injective-referral-rpc_pb_service'
import { InjectiveReferralRPC } from '@injectivelabs/referral-api/injective_referral_rpc_pb_service'
import {
ClaimCommissionsReq,
ReferReq,
GetFeeRecipientReq,
GetFeeRecipientResp,
GetReferralInfoReq,
GetReferralInfoResp,
} from '@injectivelabs/referral-api/injective-referral-rpc_pb'
GetRefereeListReq,
GetRefereeListResp,
} from '@injectivelabs/referral-api/injective_referral_rpc_pb'
import BaseConsumer from '../BaseConsumer'

export class ReferralConsumer extends BaseConsumer {
Expand Down Expand Up @@ -47,6 +49,24 @@ export class ReferralConsumer extends BaseConsumer {
}
}

async getRefereeList(address: string) {
const request = new GetRefereeListReq()

request.setReferrerAddress(address)

try {
const response = await this.request<
GetRefereeListReq,
GetRefereeListResp,
typeof InjectiveReferralRPC.GetRefereeList
>(request, InjectiveReferralRPC.GetRefereeList)

return response.getRefereesList()
} catch (e: any) {
throw new GrpcException(e.message)
}
}

async claimCommissions(address: string) {
const request = new ClaimCommissionsReq()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
RefereeInfo,
ReferrerInfo,
GrpcFeeRecipient,
GrpcReferralInfo,
GrpcRefereeInfo,
GrpcReferralInfo,
GrpcReferrerInfo,
} from '../types/index'

Expand All @@ -14,6 +14,7 @@ export class ReferralTransformer {
refereeInfo: GrpcRefereeInfo,
): RefereeInfo {
return {
accountAddress: refereeInfo.getAccountAddress(),
referralCode: refereeInfo.getReferralCode(),
referredTimeMs: refereeInfo.getReferredTimeMs(),
status: refereeInfo.getStatus(),
Expand All @@ -26,6 +27,7 @@ export class ReferralTransformer {
referrerInfo: GrpcReferrerInfo,
): ReferrerInfo {
return {
accountAddress: referrerInfo.getAccountAddress(),
referralCode: referrerInfo.getReferralCode(),
issuedTimeMs: referrerInfo.getIssuedTimeMs(),
status: referrerInfo.getStatus(),
Expand Down Expand Up @@ -59,4 +61,10 @@ export class ReferralTransformer {
: refereeInfo,
}
}

static grpcRefereeListToRefereeList(
grpcReferees: GrpcRefereeInfo[],
): RefereeInfo[] {
return grpcReferees.map(ReferralTransformer.grpcRefereeInfoToRefereeInfo)
}
}
13 changes: 11 additions & 2 deletions packages/referral-consumer/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
GetReferralInfoResp as GrpcReferralInfo,
RefereeInfo as GrpcRefereeInfo,
ReferrerInfo as GrpcReferrerInfo,
} from '@injectivelabs/referral-api/injective-referral-rpc_pb'
GetRefereeListResp as GrpcRefereeList,
} from '@injectivelabs/referral-api/injective_referral_rpc_pb'

export enum ReferrerStatus {
REFERRER_STATUS_UNSPECIFIED = 0,
Expand All @@ -12,6 +13,7 @@ export enum ReferrerStatus {
}

export interface RefereeInfo {
accountAddress: string
referralCode: string
referredTimeMs: number
status: ReferrerStatus
Expand All @@ -20,6 +22,7 @@ export interface RefereeInfo {
}

export interface ReferrerInfo {
accountAddress: string
referralCode: string
issuedTimeMs: number
status: ReferrerStatus
Expand All @@ -38,4 +41,10 @@ export interface ReferralInfo {
refereeInfo?: RefereeInfo
}

export { GrpcFeeRecipient, GrpcReferralInfo, GrpcRefereeInfo, GrpcReferrerInfo }
export {
GrpcFeeRecipient,
GrpcRefereeInfo,
GrpcRefereeList,
GrpcReferralInfo,
GrpcReferrerInfo,
}
11 changes: 11 additions & 0 deletions packages/ui-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.26](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ui-common@0.0.25...@injectivelabs/ui-common@0.0.26) (2022-02-10)


### Bug Fixes

* ledger gas fees ([ea652e8](https://github.com/InjectiveLabs/injective-ts/commit/ea652e85af3fc94ab99a91828324371a6e70debd))





## [0.0.25](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ui-common@0.0.24...@injectivelabs/ui-common@0.0.25) (2022-02-10)

**Note:** Version bump only for package @injectivelabs/ui-common
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/ui-common",
"description": "Reusable Vue Components, Vuex Store Modules, Composables, and more",
"version": "0.0.25",
"version": "0.0.26",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -32,7 +32,7 @@
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
"@injectivelabs/alchemy-api": "^0.0.22",
"@injectivelabs/chain-consumer": "^0.0.114",
"@injectivelabs/contracts": "^0.0.100",
"@injectivelabs/contracts": "^0.0.101",
"@injectivelabs/derivatives-consumer": "^0.0.96",
"@injectivelabs/exceptions": "^0.0.42",
"@injectivelabs/exchange-consumer": "^0.0.138",
Expand All @@ -43,7 +43,7 @@
"@injectivelabs/token-utils": "^0.0.17",
"@injectivelabs/ts-types": "^0.0.38",
"@injectivelabs/utils": "^0.0.54",
"@injectivelabs/web3-strategy": "^0.0.92",
"@injectivelabs/web3-strategy": "^0.0.93",
"bech32": "^2.0.0",
"date-fns": "^2.28.0",
"ethereumjs-util": "^7.1.4",
Expand Down
11 changes: 11 additions & 0 deletions packages/web3-strategy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.93](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/web3-strategy@0.0.92...@injectivelabs/web3-strategy@0.0.93) (2022-02-10)


### Bug Fixes

* ledger gas fees ([ea652e8](https://github.com/InjectiveLabs/injective-ts/commit/ea652e85af3fc94ab99a91828324371a6e70debd))





## [0.0.92](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/web3-strategy@0.0.90...@injectivelabs/web3-strategy@0.0.92) (2022-02-09)


Expand Down
2 changes: 1 addition & 1 deletion packages/web3-strategy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/web3-strategy",
"description": "A convenient way to use Web3 with a transaction signing provider.",
"version": "0.0.92",
"version": "0.0.93",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,11 @@
"@improbable-eng/grpc-web" "^0.13.0"
google-protobuf "^3.13.0"

"@injectivelabs/common-rpc@^1.0.2":
version "1.0.2"
resolved "https://registry.npmjs.org/@injectivelabs/common-rpc/-/common-rpc-1.0.2.tgz#12c641f9c07b3f34aee1bafaf5a54381a78bd83a"
integrity sha512-W96jZ63E9NRlPDfwgifZWVh6pvR+TNtQWb6i9/m/M/c1p41nWzcwO/GKRnVelvTXD5kNQ7SoTl37bwkddEEVfw==

"@injectivelabs/exceptions@^0.0.26":
version "0.0.26"
resolved "https://registry.yarnpkg.com/@injectivelabs/exceptions/-/exceptions-0.0.26.tgz#128ac7f3ab8c2de8030c6bb9ad07246de768c230"
Expand All @@ -1093,10 +1098,10 @@
"@improbable-eng/grpc-web" "^0.14.0"
google-protobuf "^3.14.0"

"@injectivelabs/referral-api@^1.0.15":
version "1.0.15"
resolved "https://registry.yarnpkg.com/@injectivelabs/referral-api/-/referral-api-1.0.15.tgz#7b38a6931da8f85031a03bbe3f1d2e22775bcafc"
integrity sha512-uZRGNBPH5CNx5pYKknA/zQYn4CBT37i8Vx0SuMIyEmb+V5E7bkoEKYasfhcDmvKXMcMqGk0e0ChG98prCwlmIA==
"@injectivelabs/referral-api@^1.0.19":
version "1.0.19"
resolved "https://registry.npmjs.org/@injectivelabs/referral-api/-/referral-api-1.0.19.tgz#a24b47863313cf50a693172c9051d0f0fec91946"
integrity sha512-8o+hVsm2+lmULtlq2CGA8u9FKp8qqB6+yYSRroRfeyk/D/lKogg49jPYeYp1I9n6bECGeVJv9G5YCRMO+AIsvA==

"@injectivelabs/ts-types@^0.0.22":
version "0.0.22"
Expand Down

0 comments on commit df5cbc8

Please sign in to comment.