Добавлен новый метод для получения адреса реферрала

This commit is contained in:
kuduzow
2022-12-18 22:18:16 +03:00
parent e4f8778b2d
commit c17330cffa
3 changed files with 16 additions and 6 deletions

View File

@@ -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",

View File

@@ -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() {

View File

@@ -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: {