@haven-fi/solauto-sdk 1.0.544 → 1.0.545
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.
@@ -101,7 +101,7 @@ async function getJupPriceData(mints, mayIncludeSpamTokens) {
|
|
101
101
|
if (invalidValues && !mayIncludeSpamTokens) {
|
102
102
|
throw new Error("Invalid price values");
|
103
103
|
}
|
104
|
-
const trueData = Object.entries(result).reduce((acc, [key, val]) => val
|
104
|
+
const trueData = Object.entries(result).reduce((acc, [key, val]) => !val?.extraInfo?.quotedPrice?.sellAt
|
105
105
|
? { ...acc, [key]: { ...val, price: "0" } }
|
106
106
|
: { ...acc, [key]: val }, {});
|
107
107
|
return trueData;
|
package/package.json
CHANGED
@@ -204,7 +204,7 @@ export async function getJupPriceData(
|
|
204
204
|
result as { [key: string]: any }
|
205
205
|
).reduce(
|
206
206
|
(acc, [key, val]) =>
|
207
|
-
val
|
207
|
+
!val?.extraInfo?.quotedPrice?.sellAt
|
208
208
|
? { ...acc, [key]: { ...val, price: "0" } }
|
209
209
|
: { ...acc, [key]: val },
|
210
210
|
{}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { describe, it } from "mocha";
|
2
|
-
import { none, publicKey, some } from "@metaplex-foundation/umi";
|
2
|
+
import { none, publicKey, some, Umi } from "@metaplex-foundation/umi";
|
3
3
|
import { setupTest } from "../shared";
|
4
4
|
import { SolautoMarginfiClient } from "../../src/clients/solautoMarginfiClient";
|
5
5
|
import {
|
@@ -43,6 +43,29 @@ import {
|
|
43
43
|
import { PriorityFeeSetting } from "../../src/types";
|
44
44
|
import { buildIronforgeApiUrl, fromBaseUnit, tokenInfo, USD_DECIMALS } from "../../dist";
|
45
45
|
|
46
|
+
async function getAssets(
|
47
|
+
umi: Umi,
|
48
|
+
mints: PublicKey[]
|
49
|
+
) {
|
50
|
+
const response = await fetch(umi.rpc.getEndpoint(), {
|
51
|
+
method: 'POST',
|
52
|
+
headers: {
|
53
|
+
'Content-Type': 'application/json',
|
54
|
+
},
|
55
|
+
body: JSON.stringify({
|
56
|
+
jsonrpc: '2.0',
|
57
|
+
id: 'get-assets',
|
58
|
+
method: 'getAssetBatch',
|
59
|
+
params: {
|
60
|
+
ids: mints.map((x) => x.toString()),
|
61
|
+
},
|
62
|
+
}),
|
63
|
+
});
|
64
|
+
const res = await response.json();
|
65
|
+
return res;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
46
69
|
describe("Solauto Marginfi tests", async () => {
|
47
70
|
// const signer = setupTest();
|
48
71
|
const signer = setupTest("solauto-manager");
|
@@ -62,18 +85,21 @@ describe("Solauto Marginfi tests", async () => {
|
|
62
85
|
const supplyDecimals = 6;
|
63
86
|
const debtDecimals = 6;
|
64
87
|
|
65
|
-
await client.initialize({
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
});
|
88
|
+
// await client.initialize({
|
89
|
+
// signer,
|
90
|
+
// positionId,
|
91
|
+
// authority: new PublicKey("FKYQs7KgRvaKQHxXwb8HKfoBcFdSxLL3JvHWpPdVQ16v"),
|
92
|
+
// // new: true,
|
93
|
+
// // marginfiAccount: new PublicKey(
|
94
|
+
// // ""
|
95
|
+
// // ),
|
96
|
+
// // marginfiGroup: new PublicKey(""),
|
97
|
+
// // supplyMint: new PublicKey(""),
|
98
|
+
// // debtMint: new PublicKey(USDC),
|
99
|
+
// });
|
100
|
+
|
101
|
+
console.log(await getAssets(client.umi, [NATIVE_MINT, new PublicKey(USDC)]));
|
102
|
+
return;
|
77
103
|
|
78
104
|
const transactionItems: TransactionItem[] = [];
|
79
105
|
// const settingParams: SolautoSettingsParametersInpArgs = {
|