@haven-fi/solauto-sdk 1.0.366 → 1.0.367
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.
- package/dist/constants/tokenConstants.js +2 -2
- package/dist/utils/generalUtils.d.ts +1 -0
- package/dist/utils/generalUtils.d.ts.map +1 -1
- package/dist/utils/generalUtils.js +8 -0
- package/package.json +1 -1
- package/src/constants/tokenConstants.ts +2 -2
- package/src/utils/generalUtils.ts +11 -0
- package/tests/transactions/solautoMarginfi.ts +22 -22
@@ -107,12 +107,12 @@ exports.TOKEN_INFO = {
|
|
107
107
|
decimals: 6,
|
108
108
|
},
|
109
109
|
[exports.WBTC]: {
|
110
|
-
ticker: "
|
110
|
+
ticker: "wBTC",
|
111
111
|
decimals: 8,
|
112
112
|
isMajor: true,
|
113
113
|
},
|
114
114
|
[exports.WETH]: {
|
115
|
-
ticker: "
|
115
|
+
ticker: "wETH",
|
116
116
|
decimals: 8,
|
117
117
|
isMajor: true,
|
118
118
|
},
|
@@ -10,4 +10,5 @@ export declare function arraysAreEqual(arrayA: number[], arrayB: number[]): bool
|
|
10
10
|
export declare function zip<T, U>(list1: T[], list2: U[]): [T, U][];
|
11
11
|
export type ErrorsToThrow = Array<new (...args: any[]) => Error>;
|
12
12
|
export declare function retryWithExponentialBackoff<T>(fn: (attemptNum: number, prevErr?: Error) => Promise<T>, retries?: number, delay?: number, errorsToThrow?: ErrorsToThrow): Promise<T>;
|
13
|
+
export declare function toEnumValue<E extends object>(enumObj: E, value: number): E[keyof E] | undefined;
|
13
14
|
//# sourceMappingURL=generalUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;
|
1
|
+
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CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAQ/F"}
|
@@ -9,6 +9,7 @@ exports.rpcAccountCreated = rpcAccountCreated;
|
|
9
9
|
exports.arraysAreEqual = arraysAreEqual;
|
10
10
|
exports.zip = zip;
|
11
11
|
exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
|
12
|
+
exports.toEnumValue = toEnumValue;
|
12
13
|
const umi_1 = require("@metaplex-foundation/umi");
|
13
14
|
function consoleLog(...args) {
|
14
15
|
if (globalThis.LOCAL_TEST) {
|
@@ -85,3 +86,10 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
|
|
85
86
|
return attempt(0);
|
86
87
|
});
|
87
88
|
}
|
89
|
+
function toEnumValue(enumObj, value) {
|
90
|
+
const numericValues = Object.values(enumObj).filter(v => typeof v === "number");
|
91
|
+
if (numericValues.includes(value)) {
|
92
|
+
return value;
|
93
|
+
}
|
94
|
+
return undefined;
|
95
|
+
}
|
package/package.json
CHANGED
@@ -116,12 +116,12 @@ export const TOKEN_INFO: { [key: string]: TokenInfo } = {
|
|
116
116
|
decimals: 6,
|
117
117
|
},
|
118
118
|
[WBTC]: {
|
119
|
-
ticker: "
|
119
|
+
ticker: "wBTC",
|
120
120
|
decimals: 8,
|
121
121
|
isMajor: true,
|
122
122
|
},
|
123
123
|
[WETH]: {
|
124
|
-
ticker: "
|
124
|
+
ticker: "wETH",
|
125
125
|
decimals: 8,
|
126
126
|
isMajor: true,
|
127
127
|
},
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { MaybeRpcAccount, publicKey, Umi } from "@metaplex-foundation/umi";
|
3
|
+
import { LendingPlatform } from "../generated";
|
3
4
|
|
4
5
|
export function consoleLog(...args: any[]): void {
|
5
6
|
if ((globalThis as any).LOCAL_TEST) {
|
@@ -98,3 +99,13 @@ export function retryWithExponentialBackoff<T>(
|
|
98
99
|
return attempt(0);
|
99
100
|
});
|
100
101
|
}
|
102
|
+
|
103
|
+
export function toEnumValue<E extends object>(enumObj: E, value: number): E[keyof E] | undefined {
|
104
|
+
const numericValues = Object.values(enumObj).filter(v => typeof v === "number") as number[];
|
105
|
+
|
106
|
+
if (numericValues.includes(value)) {
|
107
|
+
return value as E[keyof E];
|
108
|
+
}
|
109
|
+
|
110
|
+
return undefined;
|
111
|
+
}
|
@@ -54,20 +54,20 @@ describe("Solauto Marginfi tests", async () => {
|
|
54
54
|
const supplyDecimals = 6;
|
55
55
|
const debtDecimals = 6;
|
56
56
|
|
57
|
-
await client.initialize({
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
});
|
69
|
-
|
70
|
-
|
57
|
+
// await client.initialize({
|
58
|
+
// signer,
|
59
|
+
// positionId,
|
60
|
+
// authority: new PublicKey("5FALSVLRjuRZHSmQVdT2RUZC6KadCuDmxY7gaQFWFBxf"),
|
61
|
+
// // new: true,
|
62
|
+
// // marginfiAccount: new PublicKey(
|
63
|
+
// // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
64
|
+
// // ),
|
65
|
+
// // marginfiGroup: new PublicKey("G1rt3EpQ43K3bY457rhukQGRAo2QxydFAGRKqnjKzyr5"),
|
66
|
+
// // supplyMint: new PublicKey("3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump"),
|
67
|
+
// // debtMint: new PublicKey(USDC),
|
68
|
+
// });
|
69
|
+
|
70
|
+
console.log(await getSolautoManagedPositions(client.umi));
|
71
71
|
|
72
72
|
const transactionItems: TransactionItem[] = [];
|
73
73
|
// const settingParams: SolautoSettingsParametersInpArgs = {
|
@@ -163,14 +163,14 @@ describe("Solauto Marginfi tests", async () => {
|
|
163
163
|
// )
|
164
164
|
// );
|
165
165
|
|
166
|
-
const statuses = await new TransactionsManager(
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
).clientSend(transactionItems);
|
166
|
+
// const statuses = await new TransactionsManager(
|
167
|
+
// client,
|
168
|
+
// undefined,
|
169
|
+
// !payForTransactions ? "only-simulate" : "normal",
|
170
|
+
// PriorityFeeSetting.Low,
|
171
|
+
// true
|
172
|
+
// ).clientSend(transactionItems);
|
173
173
|
|
174
|
-
console.log(statuses);
|
174
|
+
// console.log(statuses);
|
175
175
|
});
|
176
176
|
});
|