@sonarwatch/portfolio-plugins 0.12.177 → 0.12.179
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/index.js +12 -0
- package/src/index.js.map +1 -1
- package/src/plugins/adrena/constants.d.ts +8 -0
- package/src/plugins/adrena/constants.js +18 -0
- package/src/plugins/adrena/constants.js.map +1 -0
- package/src/plugins/adrena/custodiesJob.d.ts +3 -0
- package/src/plugins/adrena/custodiesJob.js +34 -0
- package/src/plugins/adrena/custodiesJob.js.map +1 -0
- package/src/plugins/adrena/filters.d.ts +3 -0
- package/src/plugins/adrena/filters.js +21 -0
- package/src/plugins/adrena/filters.js.map +1 -0
- package/src/plugins/adrena/helpers.d.ts +5 -0
- package/src/plugins/adrena/helpers.js +22 -0
- package/src/plugins/adrena/helpers.js.map +1 -0
- package/src/plugins/adrena/index.d.ts +6 -0
- package/src/plugins/adrena/index.js +14 -0
- package/src/plugins/adrena/index.js.map +1 -0
- package/src/plugins/adrena/positionsFetcher.d.ts +3 -0
- package/src/plugins/adrena/positionsFetcher.js +49 -0
- package/src/plugins/adrena/positionsFetcher.js.map +1 -0
- package/src/plugins/adrena/stakingFetcher.d.ts +3 -0
- package/src/plugins/adrena/stakingFetcher.js +69 -0
- package/src/plugins/adrena/stakingFetcher.js.map +1 -0
- package/src/plugins/adrena/structs.d.ts +187 -0
- package/src/plugins/adrena/structs.js +175 -0
- package/src/plugins/adrena/structs.js.map +1 -0
- package/src/plugins/adrena/types.d.ts +9 -0
- package/src/plugins/adrena/types.js +3 -0
- package/src/plugins/adrena/types.js.map +1 -0
- package/src/plugins/elemental/depositFetcher.js +0 -8
- package/src/plugins/elemental/depositFetcher.js.map +1 -1
- package/src/plugins/flash/helpers.js +16 -1
- package/src/plugins/flash/helpers.js.map +1 -1
- package/src/plugins/flash/types.d.ts +5 -0
- package/src/plugins/hawksight/positionsFetcher.js +4 -0
- package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
- package/src/plugins/joule/constants.d.ts +6 -0
- package/src/plugins/joule/constants.js +16 -0
- package/src/plugins/joule/constants.js.map +1 -0
- package/src/plugins/joule/depositFetcher.d.ts +3 -0
- package/src/plugins/joule/depositFetcher.js +71 -0
- package/src/plugins/joule/depositFetcher.js.map +1 -0
- package/src/plugins/joule/index.d.ts +6 -0
- package/src/plugins/joule/index.js +13 -0
- package/src/plugins/joule/index.js.map +1 -0
- package/src/plugins/joule/marketsJob.d.ts +3 -0
- package/src/plugins/joule/marketsJob.js +33 -0
- package/src/plugins/joule/marketsJob.js.map +1 -0
- package/src/plugins/joule/structs.d.ts +19 -0
- package/src/plugins/joule/structs.js +22 -0
- package/src/plugins/joule/structs.js.map +1 -0
- package/src/plugins/joule/types.d.ts +50 -0
- package/src/plugins/joule/types.js +3 -0
- package/src/plugins/joule/types.js.map +1 -0
- package/src/plugins/jupiter/exchange/constants.d.ts +1 -0
- package/src/plugins/jupiter/exchange/constants.js +2 -1
- package/src/plugins/jupiter/exchange/constants.js.map +1 -1
- package/src/plugins/jupiter/exchange/filters.d.ts +1 -0
- package/src/plugins/jupiter/exchange/filters.js +11 -1
- package/src/plugins/jupiter/exchange/filters.js.map +1 -1
- package/src/plugins/jupiter/exchange/lockFetcher.d.ts +3 -0
- package/src/plugins/jupiter/exchange/lockFetcher.js +47 -0
- package/src/plugins/jupiter/exchange/lockFetcher.js.map +1 -0
- package/src/plugins/jupiter/exchange/structs.d.ts +19 -0
- package/src/plugins/jupiter/exchange/structs.js +19 -1
- package/src/plugins/jupiter/exchange/structs.js.map +1 -1
- package/src/plugins/jupiter/index.js +2 -0
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/meso/constants.d.ts +7 -0
- package/src/plugins/meso/constants.js +17 -0
- package/src/plugins/meso/constants.js.map +1 -0
- package/src/plugins/meso/depositFetcher.d.ts +3 -0
- package/src/plugins/meso/depositFetcher.js +93 -0
- package/src/plugins/meso/depositFetcher.js.map +1 -0
- package/src/plugins/meso/index.d.ts +6 -0
- package/src/plugins/meso/index.js +13 -0
- package/src/plugins/meso/index.js.map +1 -0
- package/src/plugins/meso/marketsJob.d.ts +3 -0
- package/src/plugins/meso/marketsJob.js +37 -0
- package/src/plugins/meso/marketsJob.js.map +1 -0
- package/src/plugins/meso/structs.d.ts +19 -0
- package/src/plugins/meso/structs.js +22 -0
- package/src/plugins/meso/structs.js.map +1 -0
- package/src/plugins/meso/types.d.ts +100 -0
- package/src/plugins/meso/types.js +9 -0
- package/src/plugins/meso/types.js.map +1 -0
- package/src/plugins/navi/collateralFetcher.js +42 -81
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js +4 -0
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +1 -1
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
@@ -0,0 +1,175 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.userStakingStruct = exports.liquidStakeStruct = exports.lockedStakeStruct = exports.positionStruct = exports.custodyStruct = exports.borrowRateStateStruct = exports.positionsAccountingStruct = exports.StableLockedAmountStatStruct = exports.u128SplitStruct = exports.tradeStatsStruct = exports.volumeStatsStruct = exports.assetsStruct = exports.feesStatsStruct = exports.borrowRateParamsStruct = exports.feesStruct = exports.pricingParamsStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../utils/solana");
|
7
|
+
exports.pricingParamsStruct = new beet_1.BeetStruct([
|
8
|
+
['maxInitialLeverage', beet_1.u32],
|
9
|
+
['maxLeverage', beet_1.u32],
|
10
|
+
['maxPositionLockedUsd', solana_1.u64],
|
11
|
+
['maxCumulativeShortPositionSizeUsd', solana_1.u64],
|
12
|
+
], (args) => args);
|
13
|
+
exports.feesStruct = new beet_1.BeetStruct([
|
14
|
+
['swapIn', beet_1.u16],
|
15
|
+
['swapOut', beet_1.u16],
|
16
|
+
['stableSwapIn', beet_1.u16],
|
17
|
+
['stableSwapOut', beet_1.u16],
|
18
|
+
['addLiquidity', beet_1.u16],
|
19
|
+
['removeLiquidity', beet_1.u16],
|
20
|
+
['closePosition', beet_1.u16],
|
21
|
+
['liquidation', beet_1.u16],
|
22
|
+
['feeMax', beet_1.u16],
|
23
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 6)],
|
24
|
+
['padding2', solana_1.u64],
|
25
|
+
], (args) => args);
|
26
|
+
exports.borrowRateParamsStruct = new beet_1.BeetStruct([['maxHourlyBorrowInterestRate', solana_1.u64]], (args) => args);
|
27
|
+
exports.feesStatsStruct = new beet_1.BeetStruct([
|
28
|
+
['swapUsd', solana_1.u64],
|
29
|
+
['addLiquidityUsd', solana_1.u64],
|
30
|
+
['removeLiquidityUsd', solana_1.u64],
|
31
|
+
['closePositionUsd', solana_1.u64],
|
32
|
+
['liquidationUsd', solana_1.u64],
|
33
|
+
['borrowUsd', solana_1.u64],
|
34
|
+
], (args) => args);
|
35
|
+
exports.assetsStruct = new beet_1.BeetStruct([
|
36
|
+
['collateral', solana_1.u64],
|
37
|
+
['owned', solana_1.u64],
|
38
|
+
['locked', solana_1.u64],
|
39
|
+
], (args) => args);
|
40
|
+
exports.volumeStatsStruct = new beet_1.BeetStruct([
|
41
|
+
['swapUsd', solana_1.u64],
|
42
|
+
['addLiquidityUsd', solana_1.u64],
|
43
|
+
['removeLiquidityUsd', solana_1.u64],
|
44
|
+
['openPositionUsd', solana_1.u64],
|
45
|
+
['closePositionUsd', solana_1.u64],
|
46
|
+
['liquidationUsd', solana_1.u64],
|
47
|
+
], (args) => args);
|
48
|
+
exports.tradeStatsStruct = new beet_1.BeetStruct([
|
49
|
+
['profitUsd', solana_1.u64],
|
50
|
+
['lossUsd', solana_1.u64],
|
51
|
+
['oiLongUsd', solana_1.u64],
|
52
|
+
['oiShortUsd', solana_1.u64],
|
53
|
+
], (args) => args);
|
54
|
+
exports.u128SplitStruct = new beet_1.BeetStruct([
|
55
|
+
['high', solana_1.u64],
|
56
|
+
['low', solana_1.u64],
|
57
|
+
], (args) => args);
|
58
|
+
exports.StableLockedAmountStatStruct = new beet_1.BeetStruct([
|
59
|
+
['custody', beet_solana_1.publicKey],
|
60
|
+
['lockedAmount', solana_1.u64],
|
61
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
62
|
+
], (args) => args);
|
63
|
+
exports.positionsAccountingStruct = new beet_1.FixableBeetStruct([
|
64
|
+
['openPositions', solana_1.u64],
|
65
|
+
['sizeUsd', solana_1.u64],
|
66
|
+
['borrowSizeUsd', solana_1.u64],
|
67
|
+
['lockedAmount', solana_1.u64],
|
68
|
+
['weightedPrice', exports.u128SplitStruct],
|
69
|
+
['totalQuantity', exports.u128SplitStruct],
|
70
|
+
['cumulativeInterestUsd', solana_1.u64],
|
71
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
72
|
+
['cumulativeInterestSnapshot', exports.u128SplitStruct],
|
73
|
+
['exitFeeUsd', solana_1.u64],
|
74
|
+
[
|
75
|
+
'stableLockedAmount',
|
76
|
+
(0, beet_1.uniformFixedSizeArray)(exports.StableLockedAmountStatStruct, 2),
|
77
|
+
],
|
78
|
+
], (args) => args);
|
79
|
+
exports.borrowRateStateStruct = new beet_1.BeetStruct([
|
80
|
+
['currentRate', solana_1.u64],
|
81
|
+
['lastUpdate', solana_1.i64],
|
82
|
+
['cumulativeInterest', exports.u128SplitStruct],
|
83
|
+
], (args) => args);
|
84
|
+
exports.custodyStruct = new beet_1.FixableBeetStruct([
|
85
|
+
['buffer', (0, solana_1.blob)(8)],
|
86
|
+
['bump', beet_1.u8],
|
87
|
+
['tokenAccountBump', beet_1.u8],
|
88
|
+
['allowTrade', beet_1.u8],
|
89
|
+
['allowSwap', beet_1.u8],
|
90
|
+
['decimals', beet_1.u8],
|
91
|
+
['isStable', beet_1.u8],
|
92
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 2)],
|
93
|
+
['pool', beet_solana_1.publicKey],
|
94
|
+
['mint', beet_solana_1.publicKey],
|
95
|
+
['tokenAccount', beet_solana_1.publicKey],
|
96
|
+
['oracle', beet_solana_1.publicKey],
|
97
|
+
['tradeOracle', beet_solana_1.publicKey],
|
98
|
+
['pricing', exports.pricingParamsStruct],
|
99
|
+
['fees', exports.feesStruct],
|
100
|
+
['borrowRate', exports.borrowRateParamsStruct],
|
101
|
+
['collectedFees', exports.feesStatsStruct],
|
102
|
+
['volumeStats', exports.volumeStatsStruct],
|
103
|
+
['tradeStats', exports.tradeStatsStruct],
|
104
|
+
['assets', exports.assetsStruct],
|
105
|
+
['longPositions', exports.positionsAccountingStruct],
|
106
|
+
['shortPositions', exports.positionsAccountingStruct],
|
107
|
+
['borrowRateState', exports.borrowRateStateStruct],
|
108
|
+
], (args) => args);
|
109
|
+
exports.positionStruct = new beet_1.BeetStruct([
|
110
|
+
['buffer', (0, solana_1.blob)(8)],
|
111
|
+
['bump', beet_1.u8],
|
112
|
+
['side', beet_1.u8],
|
113
|
+
['takeProfitThreadIsSet', beet_1.u8],
|
114
|
+
['stopLossThreadIsSet', beet_1.u8],
|
115
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)],
|
116
|
+
['owner', beet_solana_1.publicKey],
|
117
|
+
['pool', beet_solana_1.publicKey],
|
118
|
+
['custody', beet_solana_1.publicKey],
|
119
|
+
['collateralCustody', beet_solana_1.publicKey],
|
120
|
+
['openTime', solana_1.i64],
|
121
|
+
['updateTime', solana_1.i64],
|
122
|
+
['price', solana_1.u64],
|
123
|
+
['sizeUsd', solana_1.u64],
|
124
|
+
['borrowSizeUsd', solana_1.u64],
|
125
|
+
['collateralUsd', solana_1.u64],
|
126
|
+
['unrealizedLossUsd', solana_1.u64],
|
127
|
+
['cumulativeInterestSnapshot', exports.u128SplitStruct],
|
128
|
+
['lockedAmount', solana_1.u64],
|
129
|
+
['collateralAmount', solana_1.u64],
|
130
|
+
['exitFeeUsd', solana_1.u64],
|
131
|
+
['liquidationFeeUsd', solana_1.u64],
|
132
|
+
['takeProfitThreadId', solana_1.u64],
|
133
|
+
['takeProfitLimitPrice', solana_1.u64],
|
134
|
+
['stopLossThreadId', solana_1.u64],
|
135
|
+
['stopLossLimitPrice', solana_1.u64],
|
136
|
+
['stopLossClosePositionPrice', solana_1.u64],
|
137
|
+
], (args) => args);
|
138
|
+
exports.lockedStakeStruct = new beet_1.BeetStruct([
|
139
|
+
['amount', solana_1.u64],
|
140
|
+
['stakeTime', solana_1.i64],
|
141
|
+
['claimTime', solana_1.i64],
|
142
|
+
['endTime', solana_1.i64],
|
143
|
+
['lockDuration', solana_1.u64],
|
144
|
+
['rewardMultiplier', beet_1.u32],
|
145
|
+
['lmRewardMultiplier', beet_1.u32],
|
146
|
+
['voteMultiplier', beet_1.u32],
|
147
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)],
|
148
|
+
['amountWithRewardMultiplier', solana_1.u64],
|
149
|
+
['amountWithLmRewardMultiplier', solana_1.u64],
|
150
|
+
['resolved', beet_1.u8],
|
151
|
+
['padding2', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
|
152
|
+
['stakeResolutionThreadId', solana_1.u64],
|
153
|
+
['earlyExit', beet_1.u8],
|
154
|
+
['padding3', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
|
155
|
+
['earlyExitFee', solana_1.u64],
|
156
|
+
['isGenesis', beet_1.u8],
|
157
|
+
['padding4', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
|
158
|
+
['genesisClaimTime', solana_1.i64],
|
159
|
+
], (args) => args);
|
160
|
+
exports.liquidStakeStruct = new beet_1.BeetStruct([
|
161
|
+
['amount', solana_1.u64],
|
162
|
+
['stakeTime', solana_1.i64],
|
163
|
+
['claimTime', solana_1.i64],
|
164
|
+
['overlapTime', solana_1.i64],
|
165
|
+
['overlapAmount', solana_1.u64],
|
166
|
+
], (args) => args);
|
167
|
+
exports.userStakingStruct = new beet_1.FixableBeetStruct([
|
168
|
+
['bump', beet_1.u8],
|
169
|
+
['threadAuthorityBump', beet_1.u8],
|
170
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 6)],
|
171
|
+
['stakesClaimCronThreadId', solana_1.u64],
|
172
|
+
['liquidStake', exports.liquidStakeStruct],
|
173
|
+
['lockedStakes', (0, beet_1.uniformFixedSizeArray)(exports.lockedStakeStruct, 32)],
|
174
|
+
], (args) => args);
|
175
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,+CAAoD;AASvC,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,oBAAoB,EAAE,UAAG,CAAC;IAC3B,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,mCAAmC,EAAE,YAAG,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC;AAgBW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,iBAAiB,EAAE,UAAG,CAAC;IACxB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS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E,CAAC,IAAmB,CAC9B,CAAC;AAWW,QAAA,iBAAiB,GAAG,IAAI,wBAAiB,CACpD;IACE,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,qBAAqB,EAAE,SAAE,CAAC;IAC3B,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,yBAAyB,EAAE,YAAG,CAAC;IAChC,CAAC,aAAa,EAAE,yBAAiB,CAAC;IAClC,CAAC,cAAc,EAAE,IAAA,4BAAqB,EAAC,yBAAiB,EAAE,EAAE,CAAC,CAAC;CAC/D,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/types.ts"],"names":[],"mappings":""}
|
@@ -64,14 +64,6 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
64
64
|
alreadyShifted: false,
|
65
65
|
attributes: { isClaimable: true },
|
66
66
|
});
|
67
|
-
element.addAsset({
|
68
|
-
address: pool.liquidity_mint,
|
69
|
-
amount: position.deactivating_amount
|
70
|
-
.plus(position.claiming_amount)
|
71
|
-
.div(pool.per_token_amount),
|
72
|
-
alreadyShifted: true,
|
73
|
-
attributes: { tags: ['withdrawing'] },
|
74
|
-
});
|
75
67
|
element.addAsset({
|
76
68
|
address: pool.liquidity_mint,
|
77
69
|
amount: position.deactivating_amount.div(pool.per_token_amount),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/elemental/depositFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAAwD;AAExD,iDAAsD;AACtD,+CAAmE;AACnE,gFAA6E;AAE7E,kEAA+D;AAC/D,uCAA2C;AAC3C,uCAA0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QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
exports.getLpTokenPrice = exports.getPdas = void 0;
|
13
16
|
const web3_js_1 = require("@solana/web3.js");
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
14
18
|
const constants_1 = require("./constants");
|
15
19
|
const anchorSighash_1 = require("../../utils/solana/anchorSighash");
|
16
20
|
const solana_1 = require("../../utils/solana");
|
@@ -64,17 +68,28 @@ function getLpTokenPrice(connection, pool, oracles) {
|
|
64
68
|
];
|
65
69
|
const data = Buffer.concat([(0, anchorSighash_1.anchorSighash)('global', 'getLpTokenPrice')]);
|
66
70
|
const recentBlockhash = (yield connection.getLatestBlockhash()).blockhash;
|
71
|
+
const prefixResponse = yield axios_1.default.get(`https://api.prod.flash.trade/backup-oracle/prices?poolAddress=${pool.pubkey.toString()}`);
|
72
|
+
if (!prefixResponse.data)
|
73
|
+
return null;
|
74
|
+
const addressLookupTable = (yield connection.getAddressLookupTable(new web3_js_1.PublicKey('4E5u7DBVrJp6tVaWkH1sr6r9hhkFwGWmhEHrHeTNDdnP'))).value;
|
75
|
+
if (!addressLookupTable)
|
76
|
+
return null;
|
67
77
|
const messageV0 = new web3_js_1.TransactionMessage({
|
68
78
|
payerKey: new web3_js_1.PublicKey(solana_1.emptyWithSol),
|
69
79
|
recentBlockhash,
|
70
80
|
instructions: [
|
81
|
+
new web3_js_1.TransactionInstruction({
|
82
|
+
keys: prefixResponse.data.keys,
|
83
|
+
programId: new web3_js_1.PublicKey(prefixResponse.data.programId),
|
84
|
+
data: Buffer.from(prefixResponse.data.data),
|
85
|
+
}),
|
71
86
|
new web3_js_1.TransactionInstruction({
|
72
87
|
keys,
|
73
88
|
programId: constants_1.flashPid,
|
74
89
|
data,
|
75
90
|
}),
|
76
91
|
],
|
77
|
-
}).compileToV0Message();
|
92
|
+
}).compileToV0Message([addressLookupTable]);
|
78
93
|
const versionedTransaction = new web3_js_1.VersionedTransaction(messageV0);
|
79
94
|
const simulatedTransactionResponse = yield connection.simulateTransaction(versionedTransaction);
|
80
95
|
const returnedData = (_a = simulatedTransactionResponse.value.returnData) === null || _a === void 0 ? void 0 : _a.data[0];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAOyB;AACzB,kDAA6C;AAC7C,2CAAoE;AAEpE,oEAAiE;AAEjE,+CAK4B;AAG5B,SAAgB,OAAO,CAAC,KAAa;IACnC,OAAO,sBAAU,CAAC,GAAG,CACnB,CAAC,GAAG,EAAE,EAAE,CACN,mBAAS,CAAC,sBAAsB,CAC9B;QACE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;QAC5B,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC/B,GAAG,CAAC,QAAQ,EAAE;KACf,EACD,oBAAQ,CACT,CAAC,CAAC,CAAC,CACP,CAAC;AACJ,CAAC;AAZD,0BAYC;AAED,SAAsB,eAAe,CACnC,UAAwB,EACxB,IAA2B,EAC3B,OAAiB;;;QAEjB,MAAM,IAAI,GAAkB;YAC1B;gBACE,MAAM,EAAE,2BAAe;gBACvB,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,KAAK;aAClB;YACD;gBACE,MAAM,EAAE,IAAI,CAAC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
const constants_1 = require("./constants");
|
18
18
|
const helper_1 = require("./helper");
|
19
19
|
const obligationsFetcher_1 = __importDefault(require("../save/obligationsFetcher"));
|
20
|
+
const dlmmPositionsFetcher_1 = __importDefault(require("../meteora/dlmmPositionsFetcher"));
|
20
21
|
const solana_1 = __importDefault(require("../tokens/fetchers/solana"));
|
21
22
|
const getWhirlpoolPositions_1 = require("../orca/getWhirlpoolPositions");
|
22
23
|
const constants_2 = require("../tokens/constants");
|
@@ -53,6 +54,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
53
54
|
// This handles Save
|
54
55
|
obligationsFetcher_1.default.executor(derivedAddresses[0].toString(), cache),
|
55
56
|
obligationsFetcher_1.default.executor(derivedAddresses[1].toString(), cache),
|
57
|
+
// This handles Meteora
|
58
|
+
dlmmPositionsFetcher_1.default.executor(derivedAddresses[0].toString(), cache),
|
59
|
+
dlmmPositionsFetcher_1.default.executor(derivedAddresses[1].toString(), cache),
|
56
60
|
])).flat();
|
57
61
|
if (portfolioElements.length === 0)
|
58
62
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hawksight/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAG5C,2CAAyC;AACzC,qCAAgD;AAChD,oFAA4D;AAC5D,uEAAqD;AACrD,yEAAsE;AACtE,mDAA2D;AAC3D,oGAA4E;AAC5E,oFAAiF;AAEjF,wGAAqG;AAErG,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IACtC,MAAM,gBAAgB,GAAG,IAAA,6BAAoB,EAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpE,MAAM,cAAc,GAAmB;QACrC,sBAAsB,EAAE,IAAI;QAC5B,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+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hawksight/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAG5C,2CAAyC;AACzC,qCAAgD;AAChD,oFAA4D;AAC5D,2FAAkE;AAClE,uEAAqD;AACrD,yEAAsE;AACtE,mDAA2D;AAC3D,oGAA4E;AAC5E,oFAAiF;AAEjF,wGAAqG;AAErG,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IACtC,MAAM,gBAAgB,GAAG,IAAA,6BAAoB,EAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpE,MAAM,cAAc,GAAmB;QACrC,sBAAsB,EAAE,IAAI;QAC5B,yBAAyB,EAAE,IAAI;QAC/B,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,IAAI;KACnB,CAAC;IACF,MAAM,YAAY,GAAG,CACnB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,yCAAmB,EACjB,MAAM,EACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAC9B,cAAc,CACf;QACD,IAAA,yCAAmB,EACjB,MAAM,EACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAC9B,cAAc,CACf;KACF,CAAC,CACH,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,YAAY,GAAgC,EAAE,CAAC;IACrD,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7B,MAAM,WAAW,GAAG,IAAA,6DAA6B,EAAC,KAAK,CAAC,CAAC;QACzD,IAAI,WAAW;YAAE,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC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ACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "joule";
|
3
|
+
export declare const platform: Platform;
|
4
|
+
export declare const marketsCacheKey = "markets";
|
5
|
+
export declare const api = "https://app.joule.finance/api/market";
|
6
|
+
export declare const userPositionMapType = "0x2fe576faa841347a9b1b32c869685deb75a15e3f62dfe37cbd6d52cc403a16f6::pool::UserPositionsMap";
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.userPositionMapType = exports.api = exports.marketsCacheKey = exports.platform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'joule';
|
5
|
+
exports.platform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Joule',
|
8
|
+
image: 'https://sonar.watch/img/platforms/joule.webp',
|
9
|
+
website: 'https://app.joule.finance/',
|
10
|
+
twitter: 'https://twitter.com/JouleFinance',
|
11
|
+
defiLlamaId: 'joule-finance', // from https://defillama.com/docs/api
|
12
|
+
};
|
13
|
+
exports.marketsCacheKey = `markets`;
|
14
|
+
exports.api = 'https://app.joule.finance/api/market';
|
15
|
+
exports.userPositionMapType = '0x2fe576faa841347a9b1b32c869685deb75a15e3f62dfe37cbd6d52cc403a16f6::pool::UserPositionsMap';
|
16
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/joule/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;IAC3C,WAAW,EAAE,eAAe,EAAE,sCAAsC;CACrE,CAAC;AAEW,QAAA,eAAe,GAAG,SAAS,CAAC;AAC5B,QAAA,GAAG,GAAG,sCAAsC,CAAC;AAC7C,QAAA,mBAAmB,GAC9B,4FAA4F,CAAC"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const constants_1 = require("./constants");
|
14
|
+
const aptos_1 = require("../../utils/aptos");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
17
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
18
|
+
const marketsMemo = new MemoizedCache_1.MemoizedCache(constants_1.marketsCacheKey, {
|
19
|
+
prefix: constants_1.platformId,
|
20
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
21
|
+
});
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const client = (0, clients_1.getClientAptos)();
|
24
|
+
const positionMap = yield (0, aptos_1.getAccountResource)(client, owner, constants_1.userPositionMapType);
|
25
|
+
const markets = yield marketsMemo.getItem(cache);
|
26
|
+
if (!positionMap)
|
27
|
+
return [];
|
28
|
+
const registry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.aptos, constants_1.platformId);
|
29
|
+
for (const position of positionMap.positions_map.data) {
|
30
|
+
const element = registry.addElementBorrowlend({
|
31
|
+
label: 'Lending',
|
32
|
+
name: position.value.position_name,
|
33
|
+
});
|
34
|
+
for (const lendingPos of position.value.lend_positions.data) {
|
35
|
+
const market = markets.find((m) => lendingPos.key.includes(m.assetsName));
|
36
|
+
element.addSuppliedAsset({
|
37
|
+
address: lendingPos.key,
|
38
|
+
amount: Number(lendingPos.value),
|
39
|
+
});
|
40
|
+
if (market)
|
41
|
+
element.addSuppliedYield([
|
42
|
+
{
|
43
|
+
apr: (0, portfolio_core_1.apyToApr)(market.depositApy / 100),
|
44
|
+
apy: market.depositApy / 100,
|
45
|
+
},
|
46
|
+
]);
|
47
|
+
}
|
48
|
+
for (const borrowPos of position.value.borrow_positions.data) {
|
49
|
+
const market = markets.find((m) => borrowPos.key.includes(m.assetsName));
|
50
|
+
element.addBorrowedAsset({
|
51
|
+
address: borrowPos.key,
|
52
|
+
amount: Number(borrowPos.value.borrow_amount),
|
53
|
+
});
|
54
|
+
if (market)
|
55
|
+
element.addBorrowedYield([
|
56
|
+
{
|
57
|
+
apr: (0, portfolio_core_1.apyToApr)(market.borrowApy / 100),
|
58
|
+
apy: market.borrowApy / 100,
|
59
|
+
},
|
60
|
+
]);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
return registry.getElements(cache);
|
64
|
+
});
|
65
|
+
const fetcher = {
|
66
|
+
id: `${constants_1.platformId}-deposits`,
|
67
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
68
|
+
executor,
|
69
|
+
};
|
70
|
+
exports.default = fetcher;
|
71
|
+
//# sourceMappingURL=depositFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"depositFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/joule/depositFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAiE;AAGjE,2CAA+E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AAM;gBACR,OAAO,CAAC,gBAAgB,CAAC;oBACvB;wBACE,GAAG,EAAE,IAAA,yBAAQ,EAAC,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC;wBACtC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG;qBAC7B;iBACF,CAAC,CAAC;QACP,CAAC;QAED,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;YACzE,OAAO,CAAC,gBAAgB,CAAC;gBACvB,OAAO,EAAE,SAAS,CAAC,GAAG;gBACtB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC;aAC9C,CAAC,CAAC;YACH,IAAI,MAAM;gBACR,OAAO,CAAC,gBAAgB,CAAC;oBACvB;wBACE,GAAG,EAAE,IAAA,yBAAQ,EAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;wBACrC,GAAG,EAAE,MAAM,CAAC,SAAS,GAAG,GAAG;qBAC5B;iBACF,CAAC,CAAC;QACP,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,KAAK;IAC1B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
9
|
+
const depositFetcher_1 = __importDefault(require("./depositFetcher"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [marketsJob_1.default];
|
12
|
+
exports.fetchers = [depositFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/joule/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,8DAAsC;AACtC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const markets = yield axios_1.default.get(constants_1.api);
|
20
|
+
if (!markets.data)
|
21
|
+
return;
|
22
|
+
yield cache.setItem(constants_1.marketsCacheKey, markets.data.res, {
|
23
|
+
prefix: constants_1.platformId,
|
24
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
25
|
+
});
|
26
|
+
});
|
27
|
+
const job = {
|
28
|
+
id: `${constants_1.platformId}-markets`,
|
29
|
+
executor,
|
30
|
+
label: 'normal',
|
31
|
+
};
|
32
|
+
exports.default = job;
|
33
|
+
//# sourceMappingURL=marketsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/joule/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,2CAA+D;AAG/D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,OAAO,GAAmC,MAAM,eAAK,CAAC,GAAG,CAAC,eAAG,CAAC,CAAC;IAErE,IAAI,CAAC,OAAO,CAAC,IAAI;QAAE,OAAO;IAE1B,MAAM,KAAK,CAAC,OAAO,CAAC,2BAAe,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;QACrD,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export declare enum State {
|
6
|
+
Uninitialized = 0,
|
7
|
+
StakePool = 1,
|
8
|
+
InactiveStakePool = 2,
|
9
|
+
StakeAccount = 3
|
10
|
+
}
|
11
|
+
export type Liquidity = {
|
12
|
+
buffer: Buffer;
|
13
|
+
state: State;
|
14
|
+
mint: PublicKey;
|
15
|
+
owner: PublicKey;
|
16
|
+
amountDeposited: BigNumber;
|
17
|
+
space: number[];
|
18
|
+
};
|
19
|
+
export declare const liquidityStruct: BeetStruct<Liquidity, Partial<Liquidity>>;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.liquidityStruct = exports.State = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../utils/solana");
|
7
|
+
var State;
|
8
|
+
(function (State) {
|
9
|
+
State[State["Uninitialized"] = 0] = "Uninitialized";
|
10
|
+
State[State["StakePool"] = 1] = "StakePool";
|
11
|
+
State[State["InactiveStakePool"] = 2] = "InactiveStakePool";
|
12
|
+
State[State["StakeAccount"] = 3] = "StakeAccount";
|
13
|
+
})(State || (exports.State = State = {}));
|
14
|
+
exports.liquidityStruct = new beet_1.BeetStruct([
|
15
|
+
['buffer', (0, solana_1.blob)(8)],
|
16
|
+
['state', beet_1.u8],
|
17
|
+
['mint', beet_solana_1.publicKey],
|
18
|
+
['owner', beet_solana_1.publicKey],
|
19
|
+
['amountDeposited', solana_1.u64],
|
20
|
+
['space', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 128)],
|
21
|
+
], (args) => args);
|
22
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/joule/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAE/C,IAAY,KAKX;AALD,WAAY,KAAK;IACf,mDAAa,CAAA;IACb,2CAAS,CAAA;IACT,2DAAiB,CAAA;IACjB,iDAAY,CAAA;AACd,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAWY,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,OAAO,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,GAAG,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
export type UserPositionMap = {
|
2
|
+
positions_map: PositionsMap;
|
3
|
+
user_position_ids: string[];
|
4
|
+
};
|
5
|
+
export type PositionsMap = {
|
6
|
+
data: PositionsMapData[];
|
7
|
+
};
|
8
|
+
export type PositionsMapData = {
|
9
|
+
key: string;
|
10
|
+
value: PurpleValue;
|
11
|
+
};
|
12
|
+
export type PurpleValue = {
|
13
|
+
borrow_positions: BorrowPositions;
|
14
|
+
lend_positions: LendPositions;
|
15
|
+
position_name: string;
|
16
|
+
};
|
17
|
+
export type BorrowPositions = {
|
18
|
+
data: BorrowPositionsDatum[];
|
19
|
+
};
|
20
|
+
export type BorrowPositionsDatum = {
|
21
|
+
key: string;
|
22
|
+
value: FluffyValue;
|
23
|
+
};
|
24
|
+
export type FluffyValue = {
|
25
|
+
borrow_amount: string;
|
26
|
+
coin_name: string;
|
27
|
+
interest_accumulated: string;
|
28
|
+
last_interest_rate_index: LastInterestRateIndex;
|
29
|
+
};
|
30
|
+
export type LastInterestRateIndex = {
|
31
|
+
v: string;
|
32
|
+
};
|
33
|
+
export type LendPositions = {
|
34
|
+
data: LendPositionsDatum[];
|
35
|
+
};
|
36
|
+
export type LendPositionsDatum = {
|
37
|
+
key: string;
|
38
|
+
value: string;
|
39
|
+
};
|
40
|
+
export type MarketsResponse = {
|
41
|
+
res: Market[];
|
42
|
+
};
|
43
|
+
export type Market = {
|
44
|
+
assetsName: string;
|
45
|
+
ltv: string;
|
46
|
+
marketSize: string;
|
47
|
+
totalBorrowed: string;
|
48
|
+
depositApy: number;
|
49
|
+
borrowApy: number;
|
50
|
+
};
|