@aurigami/sdk 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SDK.d.ts +2 -0
- package/dist/helpers/notification-api.d.ts +2 -0
- package/dist/sdk.cjs.development.js +130 -20
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +130 -20
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +35 -0
- package/src/helpers/notification-api.ts +22 -0
- package/src/helpers/priceFetcher.ts +1 -1
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ALL_STAKING_POOLS } from './consts';
|
|
|
4
4
|
import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from './entities';
|
|
5
5
|
import { MiscRead, StakingRead, StakingReadWrite } from './interactors';
|
|
6
6
|
import * as types from './types';
|
|
7
|
+
import * as NotificationApi from './helpers/notification-api';
|
|
7
8
|
|
|
8
9
|
export class SdkRead extends BlockchainEntityRead {
|
|
9
10
|
protected env: AuriEnv;
|
|
@@ -101,6 +102,40 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
101
102
|
const miscRead = new MiscRead(this._networkConnection);
|
|
102
103
|
return miscRead.getNetApyWithIncentive(userAddress);
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
public async setUserNotificationSettings(
|
|
107
|
+
address: types.Address,
|
|
108
|
+
mail: string,
|
|
109
|
+
utilisation: number,
|
|
110
|
+
liquidation: boolean,
|
|
111
|
+
captchaResponse: string
|
|
112
|
+
) {
|
|
113
|
+
const body = {
|
|
114
|
+
address,
|
|
115
|
+
mail,
|
|
116
|
+
setting: {
|
|
117
|
+
utilisation,
|
|
118
|
+
liquidation,
|
|
119
|
+
},
|
|
120
|
+
captchaResponse,
|
|
121
|
+
};
|
|
122
|
+
const response = await NotificationApi.postApi('alert-setting/set', body);
|
|
123
|
+
return response;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public async unsetUserNotificationSettings(address: types.Address, captchaResponse: string) {
|
|
127
|
+
const body = {
|
|
128
|
+
address,
|
|
129
|
+
mail: '',
|
|
130
|
+
setting: {
|
|
131
|
+
utilisation: null,
|
|
132
|
+
liquidation: false,
|
|
133
|
+
},
|
|
134
|
+
captchaResponse,
|
|
135
|
+
};
|
|
136
|
+
const response = await NotificationApi.postApi('alert-setting/set', body);
|
|
137
|
+
return response;
|
|
138
|
+
}
|
|
104
139
|
}
|
|
105
140
|
|
|
106
141
|
export class SdkReadWrite extends SdkRead {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const NOTIFICATION_API_END_POINT = 'https://api.aurigami.finance/notification/';
|
|
4
|
+
|
|
5
|
+
export async function getApi(url: string, params: Record<string, any> = {}): Promise<any> {
|
|
6
|
+
const resp = await axios.get(
|
|
7
|
+
NOTIFICATION_API_END_POINT + url + '?' + new URLSearchParams(params),
|
|
8
|
+
{
|
|
9
|
+
headers: { 'Content-Type': 'application/json' },
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
return resp.data;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function postApi(url: string, body: Record<string, any>): Promise<any> {
|
|
17
|
+
const resp = await axios.post(NOTIFICATION_API_END_POINT + url, body, {
|
|
18
|
+
headers: { 'Content-Type': 'application/json' },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return resp.data;
|
|
22
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
DECIMAL_PRECISION,
|
|
9
9
|
HARDCODE_PRICE_TOKENS,
|
|
10
10
|
networkAddresses,
|
|
11
|
-
PRICE_WHITELISTED
|
|
11
|
+
PRICE_WHITELISTED,
|
|
12
12
|
} from '../consts/constants';
|
|
13
13
|
import { TokenAmount } from '../entities/tokenAmount';
|
|
14
14
|
import { Address, TokenValuation } from '../types';
|