@aurigami/sdk 1.5.6 → 1.5.7
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 +3 -3
- package/dist/Staking.d.ts +3 -3
- package/dist/sdk.cjs.development.js +5 -12
- 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 +5 -12
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +4 -5
- package/src/Staking.ts +9 -28
- package/src/types.ts +1 -1
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
MarketAction,
|
|
32
32
|
NetworkConnection,
|
|
33
33
|
PLYWNEARPoolDetails,
|
|
34
|
-
TokenValuation,
|
|
35
34
|
UserDetails,
|
|
36
35
|
UserMarketDetails,
|
|
37
36
|
} from './types';
|
|
@@ -228,16 +227,16 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
228
227
|
}
|
|
229
228
|
|
|
230
229
|
/**
|
|
231
|
-
* Get amount
|
|
230
|
+
* Get amount of staked LP tokens
|
|
232
231
|
*/
|
|
233
|
-
public async stakeBalanceOf(user: string): Promise<
|
|
232
|
+
public async stakeBalanceOf(user: string): Promise<TokenAmount> {
|
|
234
233
|
return this._stakingRead.stakeBalanceOf(user);
|
|
235
234
|
}
|
|
236
235
|
|
|
237
236
|
/**
|
|
238
|
-
* Get amount
|
|
237
|
+
* Get amount of LP token in user wallet
|
|
239
238
|
*/
|
|
240
|
-
public async LpBalanceOf(user: string): Promise<
|
|
239
|
+
public async LpBalanceOf(user: string): Promise<TokenAmount> {
|
|
241
240
|
return this._stakingRead.LpBalanceOf(user);
|
|
242
241
|
}
|
|
243
242
|
|
package/src/Staking.ts
CHANGED
|
@@ -20,15 +20,10 @@ import {
|
|
|
20
20
|
PLYWNEAR_REWARD_TOKENS,
|
|
21
21
|
} from './constants';
|
|
22
22
|
import { calcLMRewardApr, getDecimal } from './helpers';
|
|
23
|
-
import { fetchValuation
|
|
23
|
+
import { fetchValuation } from './priceFetcher';
|
|
24
24
|
import { PLYWNEARToken, Token } from './token';
|
|
25
25
|
import { TokenAmount } from './tokenAmount';
|
|
26
|
-
import {
|
|
27
|
-
NetworkConnection,
|
|
28
|
-
PLYWNEARPoolDetails,
|
|
29
|
-
TokenAPY,
|
|
30
|
-
TokenValuation,
|
|
31
|
-
} from './types';
|
|
26
|
+
import { NetworkConnection, PLYWNEARPoolDetails, TokenAPY } from './types';
|
|
32
27
|
|
|
33
28
|
export class StakingRead extends BlockchainEntityRead {
|
|
34
29
|
protected _comptroller: Comptroller;
|
|
@@ -104,37 +99,26 @@ export class StakingRead extends BlockchainEntityRead {
|
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
return {
|
|
107
|
-
totalStakedLiquidity:
|
|
108
|
-
tokenAmount: stakedLiquidityAmount,
|
|
109
|
-
currencyAmount: {
|
|
110
|
-
currency: 'USD',
|
|
111
|
-
amount: totalStakeValuation!.toFixed(DECIMAL_PRECISION),
|
|
112
|
-
},
|
|
113
|
-
},
|
|
102
|
+
totalStakedLiquidity: stakedLiquidityAmount,
|
|
114
103
|
APYs: APYs,
|
|
115
104
|
};
|
|
116
105
|
}
|
|
117
106
|
|
|
118
107
|
/**
|
|
119
|
-
* Get amount
|
|
108
|
+
* Get amount of staked LP tokens
|
|
120
109
|
*/
|
|
121
|
-
public async stakeBalanceOf(user: string): Promise<
|
|
110
|
+
public async stakeBalanceOf(user: string): Promise<TokenAmount> {
|
|
122
111
|
const userInfo = await this._auriFairLaunch.getUserInfo(
|
|
123
112
|
PLYWNEAR_POOL_ID,
|
|
124
113
|
user
|
|
125
114
|
);
|
|
126
|
-
|
|
127
|
-
PLYWNEARToken,
|
|
128
|
-
userInfo.amount.toString()
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
return valuateToken(stakeAmount, this._networkConnection.provider);
|
|
115
|
+
return new TokenAmount(PLYWNEARToken, userInfo.amount.toString());
|
|
132
116
|
}
|
|
133
117
|
|
|
134
118
|
/**
|
|
135
|
-
* Get amount
|
|
119
|
+
* Get amount of LP token in user wallet
|
|
136
120
|
*/
|
|
137
|
-
public async LpBalanceOf(user: string): Promise<
|
|
121
|
+
public async LpBalanceOf(user: string): Promise<TokenAmount> {
|
|
138
122
|
let lpContract = new Contract(
|
|
139
123
|
networkAddresses.tokens.PLYWNEAR,
|
|
140
124
|
EIP20InterfaceABI.abi,
|
|
@@ -142,10 +126,7 @@ export class StakingRead extends BlockchainEntityRead {
|
|
|
142
126
|
) as IERC20;
|
|
143
127
|
let balance = await lpContract.balanceOf(user);
|
|
144
128
|
|
|
145
|
-
return
|
|
146
|
-
new TokenAmount(PLYWNEARToken, balance.toString()),
|
|
147
|
-
this._networkConnection.provider
|
|
148
|
-
);
|
|
129
|
+
return new TokenAmount(PLYWNEARToken, balance.toString());
|
|
149
130
|
}
|
|
150
131
|
|
|
151
132
|
public async unclaimedRewardsOf(user: string): Promise<TokenAmount[]> {
|