@sonarwatch/portfolio-plugins 0.12.142 → 0.12.144

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.
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/alphafi/types.ts"],"names":[],"mappings":""}
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -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 = yield cache.getItems(poolsIds, {
51
- prefix: constants_1.clmmPoolsPrefix,
52
- networkId: portfolio_core_1.NetworkId.sui,
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
- if (pool) {
57
- poolsById.set(pool.poolAddress, pool);
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
- if (poolsById.size === 0)
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 = yield cache.getTokenPrice(pool.coinTypeA, portfolio_core_1.NetworkId.sui);
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 = yield cache.getTokenPrice(pool.coinTypeB, portfolio_core_1.NetworkId.sui);
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,2CAKqB;AACrB,iDAAmD;AACnD,uCAAoE;AAGpE,qGAA6E;AAC7E,wFAAyF;AACzF,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,IAAA,kCAAwB,EAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjE,IAAI,IAAI,CAAC,YAAY,KAAK,oBAAQ,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAA,uBAAa,EA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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
+ {"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,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D,0BAAS,CAAC,GAAG,EACb,WAAW,CACZ,CAAC;QACF,IACE,CAAC,WAAW;YACZ,CAAC,WAAW;YACZ,WAAW,CAAC,KAAK,KAAK,IAAI;YAC1B,WAAW,CAAC,KAAK,KAAK,IAAI;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"}
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -42,20 +42,20 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
42
42
  const clients_1 = require("../../utils/clients");
43
43
  const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
44
44
  const helpers_1 = require("./helpers");
45
- const query = (0, graphql_request_1.gql) `
46
- query GetAirdropFinalFrontend($authority: String!) {
47
- getAirdropFinalFrontend(authority: $authority) {
48
- authority
49
- community_allocation
50
- eligibility
51
- main_allocation
52
- og_allocation
53
- s1_allocation
54
- s2_allocation
55
- total_allocation
56
- __typename
57
- }
58
- }
45
+ const query = (0, graphql_request_1.gql) `
46
+ query GetAirdropFinalFrontend($authority: String!) {
47
+ getAirdropFinalFrontend(authority: $authority) {
48
+ authority
49
+ community_allocation
50
+ eligibility
51
+ main_allocation
52
+ og_allocation
53
+ s1_allocation
54
+ s2_allocation
55
+ total_allocation
56
+ __typename
57
+ }
58
+ }
59
59
  `;
60
60
  const networkId = portfolio_core_1.NetworkId.solana;
61
61
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
@@ -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":";;;;;AAKA,sFAA8D;AAE9D,SAAwB,uBAAuB,CAC7C,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAA8B,EAC9B,KAAc;IAEd,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW;QACxC,OAAO;YACL,IAAA,gCAAsB,EAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC;SACtE,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,CACrB,CACF,CAAC;AACJ,CAAC;AAnBD,0CAmBC"}
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"}
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;