referral history search update

This commit is contained in:
Demid
2023-05-03 00:26:08 +03:00
parent a8f065ff5e
commit 3d915b7f66
3 changed files with 16 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.18.21-rc1",
"version": "0.18.21-rc2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.18.21-rc1",
"version": "0.18.21-rc2",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.21.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.18.21-rc1",
"version": "0.18.21-rc2",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -65,9 +65,9 @@ class ReferralSystem {
});
getMyReferral = (myWalletAddress: string) =>
fetchWithValidation(`${this.apiUrl}/referer/view/link`, linkSchema, {
fetchWithValidation(`${this.apiUrl}/referral/view/link`, linkSchema, {
headers: {
'referer-address': myWalletAddress,
referral: myWalletAddress,
},
});
@@ -183,7 +183,13 @@ class ReferralSystem {
errorSchema
);
getAggregatedHistory = (refererAddress: string, chainId: SupportedChainId | undefined, itemPerPage: number, page: number) => {
getAggregatedHistory = (
refererAddress: string,
chainId: SupportedChainId | undefined,
types: string[] | undefined,
itemPerPage: number,
page: number
) => {
const queryParams: Record<string, string | number> = {
n_per_page: itemPerPage,
page,
@@ -194,6 +200,10 @@ class ReferralSystem {
queryParams['chain_id'] = chainId;
}
if (types !== undefined) {
queryParams['history_filter'] = encodeURIComponent(types.join(','));
}
const queryString = Object.entries(queryParams).map(([k, v]) => `${k}=${v}`).join('&')
return fetchWithValidation(