@sonarwatch/portfolio-plugins 0.12.143 → 0.12.145
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -937
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/alphafi/constants.d.ts +10 -0
- package/src/plugins/alphafi/constants.js +61 -0
- package/src/plugins/alphafi/constants.js.map +1 -0
- package/src/plugins/alphafi/index.d.ts +6 -0
- package/src/plugins/alphafi/index.js +13 -0
- package/src/plugins/alphafi/index.js.map +1 -0
- package/src/plugins/alphafi/poolsJob.d.ts +3 -0
- package/src/plugins/alphafi/poolsJob.js +117 -0
- package/src/plugins/alphafi/poolsJob.js.map +1 -0
- package/src/plugins/alphafi/positionsFetcher.d.ts +3 -0
- package/src/plugins/alphafi/positionsFetcher.js +149 -0
- package/src/plugins/alphafi/positionsFetcher.js.map +1 -0
- package/src/plugins/alphafi/types.d.ts +224 -0
- package/src/plugins/alphafi/types.js +3 -0
- package/src/plugins/alphafi/types.js.map +1 -0
- package/src/plugins/cetus/clmmsFetcher.js +22 -11
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/flexlend/constants.js +1 -1
- package/src/plugins/flexlend/constants.js.map +1 -1
- package/src/plugins/whalesmarket/depositFetcher.js +6 -3
- package/src/plugins/whalesmarket/depositFetcher.js.map +1 -1
- package/src/utils/misc/tokenPriceToAssetTokens.d.ts +2 -2
- package/src/utils/misc/tokenPriceToAssetTokens.js +3 -3
- package/src/utils/misc/tokenPriceToAssetTokens.js.map +1 -1
@@ -0,0 +1,224 @@
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
2
|
+
export type Receipt = {
|
3
|
+
id: {
|
4
|
+
id: string;
|
5
|
+
};
|
6
|
+
image_url: string;
|
7
|
+
last_acc_reward_per_xtoken: {
|
8
|
+
fields: {
|
9
|
+
contents: {
|
10
|
+
fields: {
|
11
|
+
key: {
|
12
|
+
fields: {
|
13
|
+
name: string;
|
14
|
+
};
|
15
|
+
type: string;
|
16
|
+
};
|
17
|
+
value: string;
|
18
|
+
};
|
19
|
+
type: string;
|
20
|
+
}[];
|
21
|
+
type: string;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
locked_balance: {
|
25
|
+
fields: {
|
26
|
+
head: string;
|
27
|
+
id: {
|
28
|
+
id: string;
|
29
|
+
};
|
30
|
+
size: string;
|
31
|
+
tail: string;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
name: string;
|
35
|
+
owner: string;
|
36
|
+
pending_rewards: {
|
37
|
+
fields: {
|
38
|
+
contents: {
|
39
|
+
fields: {
|
40
|
+
key: {
|
41
|
+
fields: {
|
42
|
+
name: string;
|
43
|
+
};
|
44
|
+
type: string;
|
45
|
+
};
|
46
|
+
value: string;
|
47
|
+
};
|
48
|
+
type: string;
|
49
|
+
}[];
|
50
|
+
type: string;
|
51
|
+
};
|
52
|
+
};
|
53
|
+
pool_id: string;
|
54
|
+
unlocked_xtokens: string;
|
55
|
+
xTokenBalance: string;
|
56
|
+
};
|
57
|
+
export type AlphaPool = {
|
58
|
+
acc_rewards_per_xtoken: {
|
59
|
+
fields: {
|
60
|
+
contents: {
|
61
|
+
key: {
|
62
|
+
fields: {
|
63
|
+
name: string;
|
64
|
+
};
|
65
|
+
type: string;
|
66
|
+
};
|
67
|
+
value: string;
|
68
|
+
type: string;
|
69
|
+
}[];
|
70
|
+
};
|
71
|
+
type: string;
|
72
|
+
};
|
73
|
+
alpha_bal: string;
|
74
|
+
deposit_fee: string;
|
75
|
+
deposit_fee_max_cap: string;
|
76
|
+
id: {
|
77
|
+
id: string;
|
78
|
+
};
|
79
|
+
image_url: number[];
|
80
|
+
instant_withdraw_fee: string;
|
81
|
+
instant_withdraw_fee_max_cap: string;
|
82
|
+
locked_period_in_ms: string;
|
83
|
+
locking_start_ms: string;
|
84
|
+
name: number[];
|
85
|
+
paused: boolean;
|
86
|
+
performance_fee: string;
|
87
|
+
performance_fee_max_cap: string;
|
88
|
+
rewards: {
|
89
|
+
fields: {
|
90
|
+
id: {
|
91
|
+
id: string;
|
92
|
+
};
|
93
|
+
size: string;
|
94
|
+
};
|
95
|
+
type: string;
|
96
|
+
};
|
97
|
+
tokensInvested: string;
|
98
|
+
withdraw_fee_max_cap: string;
|
99
|
+
withdrawal_fee: string;
|
100
|
+
xTokenSupply: string;
|
101
|
+
};
|
102
|
+
export type Investor = {
|
103
|
+
emergency_balance_a: string;
|
104
|
+
emergency_balance_b: string;
|
105
|
+
free_balance_a: string;
|
106
|
+
free_balance_b: string;
|
107
|
+
free_rewards: FreeRewards;
|
108
|
+
id: ID;
|
109
|
+
is_emergency: boolean;
|
110
|
+
lower_tick: number;
|
111
|
+
minimum_swap_amount: string;
|
112
|
+
performance_fee: string;
|
113
|
+
performance_fee_max_cap: string;
|
114
|
+
upper_tick: number;
|
115
|
+
};
|
116
|
+
export type FreeRewards = {
|
117
|
+
fields: Fields;
|
118
|
+
type: string;
|
119
|
+
};
|
120
|
+
export type Fields = {
|
121
|
+
id: ID;
|
122
|
+
size: string;
|
123
|
+
};
|
124
|
+
export type ID = {
|
125
|
+
id: string;
|
126
|
+
};
|
127
|
+
export type AlphaPoolInfo = {
|
128
|
+
tokenAmountA: BigNumber;
|
129
|
+
tokenAmountB?: BigNumber;
|
130
|
+
cointTypeA: string;
|
131
|
+
cointTypeB?: string;
|
132
|
+
alphaPoolId: string;
|
133
|
+
underlyingPoolId?: string;
|
134
|
+
xTokenSupply: BigNumber;
|
135
|
+
tokensInvested: BigNumber;
|
136
|
+
unlockAt?: number;
|
137
|
+
};
|
138
|
+
export type CetusPosition = {
|
139
|
+
id: ID;
|
140
|
+
name: number[];
|
141
|
+
value: Value;
|
142
|
+
};
|
143
|
+
export type Value = {
|
144
|
+
fields: ValueFields;
|
145
|
+
type: string;
|
146
|
+
};
|
147
|
+
export type ValueFields = {
|
148
|
+
coin_type_a: CoinType;
|
149
|
+
coin_type_b: CoinType;
|
150
|
+
description: string;
|
151
|
+
id: ID;
|
152
|
+
index: string;
|
153
|
+
liquidity: string;
|
154
|
+
name: string;
|
155
|
+
pool: string;
|
156
|
+
tick_lower_index: TickErIndex;
|
157
|
+
tick_upper_index: TickErIndex;
|
158
|
+
url: string;
|
159
|
+
};
|
160
|
+
export type CoinType = {
|
161
|
+
fields: CoinTypeAFields;
|
162
|
+
type: string;
|
163
|
+
};
|
164
|
+
export type CoinTypeAFields = {
|
165
|
+
name: string;
|
166
|
+
};
|
167
|
+
export type TickErIndex = {
|
168
|
+
fields: TickLowerIndexFields;
|
169
|
+
type: string;
|
170
|
+
};
|
171
|
+
export type TickLowerIndexFields = {
|
172
|
+
bits: number;
|
173
|
+
};
|
174
|
+
export type AlphaVault = {
|
175
|
+
acc_rewards_per_xtoken: AccRewardsPerXtoken;
|
176
|
+
alpha_bal: string;
|
177
|
+
deposit_fee: string;
|
178
|
+
deposit_fee_max_cap: string;
|
179
|
+
id: ID;
|
180
|
+
image_url: number[];
|
181
|
+
instant_withdraw_fee: string;
|
182
|
+
instant_withdraw_fee_max_cap: string;
|
183
|
+
locked_period_in_ms: string;
|
184
|
+
locking_start_ms: string;
|
185
|
+
name: number[];
|
186
|
+
paused: boolean;
|
187
|
+
performance_fee: string;
|
188
|
+
performance_fee_max_cap: string;
|
189
|
+
rewards: Rewards;
|
190
|
+
tokensInvested: string;
|
191
|
+
withdraw_fee_max_cap: string;
|
192
|
+
withdrawal_fee: string;
|
193
|
+
xTokenSupply: string;
|
194
|
+
};
|
195
|
+
export type AccRewardsPerXtoken = {
|
196
|
+
fields: AccRewardsPerXtokenFields;
|
197
|
+
type: string;
|
198
|
+
};
|
199
|
+
export type AccRewardsPerXtokenFields = {
|
200
|
+
contents: Content[];
|
201
|
+
};
|
202
|
+
export type Content = {
|
203
|
+
fields: ContentFields;
|
204
|
+
type: string;
|
205
|
+
};
|
206
|
+
export type ContentFields = {
|
207
|
+
key: Key;
|
208
|
+
value: string;
|
209
|
+
};
|
210
|
+
export type Key = {
|
211
|
+
fields: KeyFields;
|
212
|
+
type: string;
|
213
|
+
};
|
214
|
+
export type KeyFields = {
|
215
|
+
name: string;
|
216
|
+
};
|
217
|
+
export type Rewards = {
|
218
|
+
fields: RewardsFields;
|
219
|
+
type: string;
|
220
|
+
};
|
221
|
+
export type RewardsFields = {
|
222
|
+
id: ID;
|
223
|
+
size: string;
|
224
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/alphafi/types.ts"],"names":[],"mappings":""}
|
@@ -20,6 +20,7 @@ const helpers_1 = require("./helpers");
|
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
22
22
|
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
23
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
23
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
25
|
const client = (0, clients_1.getClientSui)();
|
25
26
|
const ownerRes = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
@@ -47,18 +48,28 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
47
48
|
if (clmmPositions.length === 0)
|
48
49
|
return [];
|
49
50
|
const poolsIds = clmmPositions.map((position) => position.pool);
|
50
|
-
const pools =
|
51
|
-
|
52
|
-
|
53
|
-
});
|
51
|
+
// const pools = await cache.getItems<Pool>(poolsIds, {
|
52
|
+
// prefix: clmmPoolsPrefix,
|
53
|
+
// networkId: NetworkId.sui,
|
54
|
+
// });
|
54
55
|
const poolsById = new Map();
|
55
|
-
pools.forEach((pool) => {
|
56
|
-
|
57
|
-
|
56
|
+
// pools.forEach((pool) => {
|
57
|
+
// if (pool) {
|
58
|
+
// poolsById.set(pool.poolAddress, pool);
|
59
|
+
// }
|
60
|
+
// });
|
61
|
+
// if (poolsById.size === 0) return [];
|
62
|
+
const mints = [];
|
63
|
+
const poolsObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, poolsIds);
|
64
|
+
poolsObjects.forEach((poolObj) => {
|
65
|
+
var _a, _b;
|
66
|
+
if ((_b = (_a = poolObj.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) {
|
67
|
+
const pool = (0, helpers_1.getPoolFromObject)(poolObj);
|
68
|
+
poolsById.set(poolObj.data.objectId, pool);
|
69
|
+
mints.push(pool.coinTypeA, pool.coinTypeB);
|
58
70
|
}
|
59
71
|
});
|
60
|
-
|
61
|
-
return [];
|
72
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.sui);
|
62
73
|
const assets = [];
|
63
74
|
let totalLiquidityValue = 0;
|
64
75
|
for (const clmmPosition of clmmPositions) {
|
@@ -66,11 +77,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
66
77
|
if (!pool)
|
67
78
|
continue;
|
68
79
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(clmmPosition.liquidity), pool.current_tick_index, clmmPosition.tick_lower_index, clmmPosition.tick_upper_index, false);
|
69
|
-
const tokenPriceA =
|
80
|
+
const tokenPriceA = tokenPriceById.get(pool.coinTypeA);
|
70
81
|
if (!tokenPriceA)
|
71
82
|
continue;
|
72
83
|
const assetTokenA = (0, tokenPriceToAssetToken_1.default)(pool.coinTypeA, tokenAmountA.dividedBy(Math.pow(10, tokenPriceA.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceA);
|
73
|
-
const tokenPriceB =
|
84
|
+
const tokenPriceB = tokenPriceById.get(pool.coinTypeB);
|
74
85
|
if (!tokenPriceB)
|
75
86
|
continue;
|
76
87
|
const assetTokenB = (0, tokenPriceToAssetToken_1.default)(pool.coinTypeB, tokenAmountB.dividedBy(Math.pow(10, tokenPriceB.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceB);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAAsE;AACtE,iDAAmD;AACnD,uCAImB;AAGnB,qGAA6E;AAC7E,wFAAyF;AACzF,qEAAkE;AAClE,qEAAkE;AAElE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QACpD,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;SAChB;QACD,MAAM,EAAE,EAAE,OAAO,EAAE,6BAAiB,EAAE;KACvC,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,aAAa,GAAe,EAAE,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI;YAAE,SAAS;QAClE,MAAM,IAAI,GAAG,IA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AI;YAE1B,SAAS;QACX,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QACpD,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;YAClC,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,EAAE;YAChB,iBAAiB,EAAE,CAAC;YACpB,KAAK;YACL,MAAM,EAAE,EAAE;SACX,CAAC,CAAC;QACH,mBAAmB,IAAI,KAAK,CAAC;IAC/B,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,CAAC,cAAc,CAAC;YACtB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE;gBACJ,WAAW,EAAE,MAAM;aACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE,6BAA6B;CACvC,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAI,mBAAS,CAChD,8CAA8C,CAC/C,CAAC"}
|
@@ -85,14 +85,17 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
85
85
|
const collateral = offer.collateral
|
86
86
|
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
87
87
|
.toNumber();
|
88
|
-
const fill =
|
88
|
+
const fill = offer.filledAmount
|
89
89
|
.dividedBy(offer.totalAmount)
|
90
90
|
.times(100)
|
91
|
-
.
|
91
|
+
.decimalPlaces(2)
|
92
|
+
.toNumber();
|
93
|
+
if (fill === 0 && offer.status === structs_1.OfferStatus.Closed)
|
94
|
+
continue;
|
92
95
|
const collatAsset = (0, tokenPriceToAssetToken_1.default)(mint, collateral, portfolio_core_1.NetworkId.solana, tokenPrice, undefined, {
|
93
96
|
tags: isEnded
|
94
97
|
? undefined
|
95
|
-
: [`${structs_1.OfferType[offer.offerType]} Offer`, fill],
|
98
|
+
: [`${structs_1.OfferType[offer.offerType]} Offer`, `${fill}% Filled`],
|
96
99
|
isClaimable: isEnded ? true : undefined,
|
97
100
|
});
|
98
101
|
const existingAssets = assetsById.get(id);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/whalesmarket/depositFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAG5C,2CAAyD;AACzD,iDAAsD;AACtD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KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { NetworkIdType, PortfolioAssetToken, TokenPrice } from '@sonarwatch/portfolio-core';
|
2
|
-
export default function tokenPriceToAssetTokens(address: string, amount: number, networkId: NetworkIdType, tokenPrice?: TokenPrice | null, price?: number): PortfolioAssetToken[];
|
1
|
+
import { NetworkIdType, PortfolioAssetAttributes, PortfolioAssetToken, TokenPrice } from '@sonarwatch/portfolio-core';
|
2
|
+
export default function tokenPriceToAssetTokens(address: string, amount: number, networkId: NetworkIdType, tokenPrice?: TokenPrice | null, price?: number, attributes?: PortfolioAssetAttributes | undefined): PortfolioAssetToken[];
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const tokenPriceToAssetToken_1 = __importDefault(require("./tokenPriceToAssetToken"));
|
7
|
-
function tokenPriceToAssetTokens(address, amount, networkId, tokenPrice, price) {
|
7
|
+
function tokenPriceToAssetTokens(address, amount, networkId, tokenPrice, price, attributes) {
|
8
8
|
if (!tokenPrice || !tokenPrice.underlyings)
|
9
9
|
return [
|
10
|
-
(0, tokenPriceToAssetToken_1.default)(address, amount, networkId, tokenPrice, price),
|
10
|
+
(0, tokenPriceToAssetToken_1.default)(address, amount, networkId, tokenPrice, price, attributes),
|
11
11
|
];
|
12
|
-
return tokenPrice.underlyings.map((tokenPriceUnderlying) => (0, tokenPriceToAssetToken_1.default)(tokenPriceUnderlying.address, amount * tokenPriceUnderlying.amountPerLp, tokenPriceUnderlying.networkId, tokenPriceUnderlying));
|
12
|
+
return tokenPrice.underlyings.map((tokenPriceUnderlying) => (0, tokenPriceToAssetToken_1.default)(tokenPriceUnderlying.address, amount * tokenPriceUnderlying.amountPerLp, tokenPriceUnderlying.networkId, tokenPriceUnderlying, undefined, attributes));
|
13
13
|
}
|
14
14
|
exports.default = tokenPriceToAssetTokens;
|
15
15
|
//# sourceMappingURL=tokenPriceToAssetTokens.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokenPriceToAssetTokens.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToAssetTokens.ts"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"file":"tokenPriceToAssetTokens.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToAssetTokens.ts"],"names":[],"mappings":";;;;;AAMA,sFAA8D;AAE9D,SAAwB,uBAAuB,CAC7C,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAA8B,EAC9B,KAAc,EACd,UAAiD;IAEjD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW;QACxC,OAAO;YACL,IAAA,gCAAsB,EACpB,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,KAAK,EACL,UAAU,CACX;SACF,CAAC;IACJ,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,oBAAoB,EAAE,EAAE,CACzD,IAAA,gCAAsB,EACpB,oBAAoB,CAAC,OAAO,EAC5B,MAAM,GAAG,oBAAoB,CAAC,WAAW,EACzC,oBAAoB,CAAC,SAAS,EAC9B,oBAAoB,EACpB,SAAS,EACT,UAAU,CACX,CACF,CAAC;AACJ,CAAC;AA7BD,0CA6BC"}
|