@haven-fi/solauto-sdk 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/utils/deleteme.js +1 -1
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +3 -3
- package/dist/utils/solauto/generalUtils.js +1 -1
- package/package.json +1 -1
- package/src/utils/deleteme.ts +2 -2
- package/src/utils/marginfiUtils.ts +4 -5
- package/src/utils/solauto/generalUtils.ts +1 -1
package/dist/utils/deleteme.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAOL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,qBAAqB,CAWxB;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkC3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,SAAS,EAAE,CAAC,
|
1
|
+
{"version":3,"file":"marginfiUtils.d.ts","sourceR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(umi, authority, compatibleWithS
|
|
64
64
|
],
|
65
65
|
});
|
66
66
|
if (compatibleWithSolauto) {
|
67
|
-
const
|
67
|
+
const positionStates = await Promise.all(marginfiAccounts.map(async (x) => ({
|
68
68
|
publicKey: x.publicKey,
|
69
|
-
state: getMarginfiAccountPositionState(umi, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey)),
|
69
|
+
state: await getMarginfiAccountPositionState(umi, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey)),
|
70
70
|
})));
|
71
|
-
return
|
71
|
+
return positionStates
|
72
72
|
.filter((x) => x.state !== undefined)
|
73
73
|
.map((x) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey));
|
74
74
|
}
|
@@ -207,7 +207,7 @@ async function getAllPositionsByAuthority(umi, user) {
|
|
207
207
|
protocolAccount: pubkey,
|
208
208
|
})));
|
209
209
|
// TODO support other platforms
|
210
|
-
return
|
210
|
+
return allPositions;
|
211
211
|
}
|
212
212
|
exports.getAllPositionsByAuthority = getAllPositionsByAuthority;
|
213
213
|
async function positionStateWithLatestPrices(umi, state, protocolAccount, lendingPlatform) {
|
package/package.json
CHANGED
package/src/utils/deleteme.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { getDebtAdjustmentUsd, getLiqUtilzationRateBps } from "./numberUtils";
|
2
2
|
|
3
|
-
//
|
3
|
+
// TODO delete this file
|
4
4
|
function check() {
|
5
5
|
let supply = 458948;
|
6
6
|
let debt = 212846;
|
@@ -37,4 +37,4 @@ function check() {
|
|
37
37
|
console.log!(liq_utilization_rate);
|
38
38
|
}
|
39
39
|
|
40
|
-
check();
|
40
|
+
check();
|
@@ -112,17 +112,16 @@ export async function getAllMarginfiAccountsByAuthority(
|
|
112
112
|
);
|
113
113
|
|
114
114
|
if (compatibleWithSolauto) {
|
115
|
-
const
|
116
|
-
marginfiAccounts.map((x) => ({
|
115
|
+
const positionStates = await Promise.all(
|
116
|
+
marginfiAccounts.map(async (x) => ({
|
117
117
|
publicKey: x.publicKey,
|
118
|
-
state: getMarginfiAccountPositionState(
|
118
|
+
state: await getMarginfiAccountPositionState(
|
119
119
|
umi,
|
120
120
|
toWeb3JsPublicKey(x.publicKey)
|
121
121
|
),
|
122
122
|
}))
|
123
123
|
);
|
124
|
-
|
125
|
-
return compatiblePositions
|
124
|
+
return positionStates
|
126
125
|
.filter((x) => x.state !== undefined)
|
127
126
|
.map((x) => toWeb3JsPublicKey(x.publicKey));
|
128
127
|
} else {
|