From c17330cffa1545339193ea7c7dbd0f7a335fe596 Mon Sep 17 00:00:00 2001 From: kuduzow Date: Sun, 18 Dec 2022 22:18:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B0=D0=B4=D1=80=D0=B5=D1=81?= =?UTF-8?q?=D0=B0=20=D1=80=D0=B5=D1=84=D0=B5=D1=80=D1=80=D0=B0=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/OrionUnit/index.ts | 2 +- src/services/ReferralSystem/index.ts | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4cb557a..f52d72d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.15.25", + "version": "0.15.26-rc.0", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/OrionUnit/index.ts b/src/OrionUnit/index.ts index 7e8c720..e305cf1 100644 --- a/src/OrionUnit/index.ts +++ b/src/OrionUnit/index.ts @@ -145,7 +145,7 @@ export default class OrionUnit { this.orionAnalytics = new OrionAnalytics(orionAnalyticsUrl); this.exchange = new Exchange(this); this.farmingManager = new FarmingManager(this); - this.referralSystem = new ReferralSystem(`${options?.api ?? customApi}/referral-api/referer`); + this.referralSystem = new ReferralSystem(`${options?.api ?? customApi}/referral-api`); } get siblings() { diff --git a/src/services/ReferralSystem/index.ts b/src/services/ReferralSystem/index.ts index 7db8219..42af467 100644 --- a/src/services/ReferralSystem/index.ts +++ b/src/services/ReferralSystem/index.ts @@ -28,14 +28,24 @@ class ReferralSystem { this.subscribeToReferral = this.subscribeToReferral.bind(this); } - getLink = (refererAddress: string) => fetchWithValidation(`${this.apiUrl}/view/link`, linkSchema, { + getLink = (refererAddress: string) => fetchWithValidation(`${this.apiUrl}/referer/view/link`, linkSchema, { headers: { 'referer-address': refererAddress, }, }); + getMyReferral = (myWalletAddress: string) => fetchWithValidation( + `${this.apiUrl}/referral/view/link`, + linkSchema, + { + headers: { + referral: myWalletAddress, + }, + }, + ); + getSubscribersList = (refererAddress: string) => fetchWithValidation( - `${this.apiUrl}/view/distinct-analytics`, + `${this.apiUrl}/referer/view/distinct-analytics`, distinctAnalyticsSchema, { headers: { @@ -45,7 +55,7 @@ class ReferralSystem { ); createReferralLink = (payload: CreateLinkPayloadType, signature: SignatureType) => fetchWithValidation( - `${this.apiUrl}/create`, + `${this.apiUrl}/referer/create`, linkSchema, { headers: { @@ -57,7 +67,7 @@ class ReferralSystem { ); subscribeToReferral = (payload: SubscribePayloadType, signature: SignatureType) => fetchWithValidation( - `${this.apiUrl}/subscribe`, + `${this.apiUrl}/referer/subscribe`, linkSchema, { headers: {