@haven-fi/solauto-sdk 1.0.34 → 1.0.36
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.d.ts +0 -1
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +3 -4
- package/dist/clients/solautoMarginfiClient.js +4 -4
- package/dist/constants/solautoConstants.d.ts.map +1 -1
- package/dist/utils/solanaUtils.d.ts +1 -0
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +8 -1
- package/package.json +1 -1
- package/src/clients/solautoClient.ts +7 -12
- package/src/clients/solautoMarginfiClient.ts +4 -4
- package/src/constants/solautoConstants.ts +0 -2
- package/src/utils/solanaUtils.ts +10 -0
- package/tests/transactions/solautoMarginfi.ts +6 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EASvB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc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C,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
|
@@ -5,7 +5,6 @@ require("rpc-websockets/dist/lib/client");
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
6
6
|
const umi_1 = require("@metaplex-foundation/umi");
|
7
7
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
8
|
-
const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
|
9
8
|
const umi_signer_wallet_adapters_1 = require("@metaplex-foundation/umi-signer-wallet-adapters");
|
10
9
|
const generated_1 = require("../generated");
|
11
10
|
const accountUtils_1 = require("../utils/accountUtils");
|
@@ -17,11 +16,11 @@ const generalUtils_1 = require("../utils/generalUtils");
|
|
17
16
|
const generalUtils_2 = require("../utils/solauto/generalUtils");
|
18
17
|
class SolautoClient {
|
19
18
|
constructor(heliusApiKey, localTest) {
|
20
|
-
this.heliusApiKey = heliusApiKey;
|
21
19
|
this.localTest = localTest;
|
22
20
|
this.livePositionUpdates = new generalUtils_2.LivePositionUpdates();
|
23
|
-
|
24
|
-
this.
|
21
|
+
const [connection, umi] = (0, solanaUtils_1.getSolanaRpcConnection)(heliusApiKey);
|
22
|
+
this.connection = connection;
|
23
|
+
this.umi = umi.use({
|
25
24
|
install(umi) {
|
26
25
|
umi.programs.add((0, generated_1.createSolautoProgram)(), false);
|
27
26
|
},
|
@@ -110,9 +110,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
110
110
|
: undefined,
|
111
111
|
solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
|
112
112
|
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
113
|
-
marginfiAccount: this.
|
114
|
-
?
|
115
|
-
: this.marginfiAccount,
|
113
|
+
marginfiAccount: "publicKey" in this.marginfiAccount
|
114
|
+
? this.marginfiAccount
|
115
|
+
: (0, umi_1.publicKey)(this.marginfiAccount),
|
116
116
|
supplyMint: (0, umi_1.publicKey)(this.supplyMint),
|
117
117
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
118
118
|
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
@@ -125,7 +125,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
125
125
|
settingParams: settingParams ?? null,
|
126
126
|
dca: dca ?? null,
|
127
127
|
},
|
128
|
-
marginfiAccountSeedIdx: this.marginfiAccountSeedIdx
|
128
|
+
marginfiAccountSeedIdx: !this.selfManaged ? this.marginfiAccountSeedIdx : null,
|
129
129
|
});
|
130
130
|
}
|
131
131
|
refresh() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAQrC,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;KAAE,CAAA;CAAO,CAAC;AAE9E,eAAO,MAAM,kBAAkB,gDAAgD,CAAC;AAEhF,eAAO,MAAM,qBAAqB,UAWjC,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { AddressLookupTableInput, Signer, TransactionBuilder, Umi, WrappedInstruction } from "@metaplex-foundation/umi";
|
2
2
|
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
3
|
+
export declare function getSolanaRpcConnection(heliusApiKey: string): [Connection, Umi];
|
3
4
|
export declare function currentUnixSecondsSolana(umi: Umi): Promise<number>;
|
4
5
|
export declare function getWrappedInstruction(signer: Signer, ix: TransactionInstruction): WrappedInstruction;
|
5
6
|
export declare function setComputeUnitLimitUmiIx(signer: Signer, maxComputeUnits: number): WrappedInstruction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,UAAU,EACV,SAAS,EAIT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAazB,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAO9E;AAED,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,sBAAsB,GACzB,kBAAkB,CAMpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAOpB;AAED,wBAAgB,wBA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ault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.sendSingleOptimizedTransaction = exports.getComputeUnitPriceEstimate = exports.assembleFinalTransaction = exports.getAdressLookupInputs = exports.splTokenTransferUmiIx = exports.closeTokenAccountUmiIx = exports.systemTransferUmiIx = exports.createAssociatedTokenAccountUmiIx = exports.setComputeUnitPriceUmiIx = exports.setComputeUnitLimitUmiIx = exports.getWrappedInstruction = exports.currentUnixSecondsSolana = void 0;
|
6
|
+
exports.sendSingleOptimizedTransaction = exports.getComputeUnitPriceEstimate = exports.assembleFinalTransaction = exports.getAdressLookupInputs = exports.splTokenTransferUmiIx = exports.closeTokenAccountUmiIx = exports.systemTransferUmiIx = exports.createAssociatedTokenAccountUmiIx = exports.setComputeUnitPriceUmiIx = exports.setComputeUnitLimitUmiIx = exports.getWrappedInstruction = exports.currentUnixSecondsSolana = exports.getSolanaRpcConnection = void 0;
|
7
7
|
const bs58_1 = __importDefault(require("bs58"));
|
8
8
|
const umi_1 = require("@metaplex-foundation/umi");
|
9
9
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
10
|
+
const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
|
10
11
|
const web3_js_1 = require("@solana/web3.js");
|
11
12
|
const spl_token_1 = require("@solana/spl-token");
|
12
13
|
const accountUtils_1 = require("./accountUtils");
|
13
14
|
const generalUtils_1 = require("./generalUtils");
|
14
15
|
const marginfi_sdk_1 = require("../marginfi-sdk");
|
16
|
+
function getSolanaRpcConnection(heliusApiKey) {
|
17
|
+
const connection = new web3_js_1.Connection(`https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`, "finalized");
|
18
|
+
const umi = (0, umi_bundle_defaults_1.createUmi)(connection);
|
19
|
+
return [connection, umi];
|
20
|
+
}
|
21
|
+
exports.getSolanaRpcConnection = getSolanaRpcConnection;
|
15
22
|
async function currentUnixSecondsSolana(umi) {
|
16
23
|
return await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
|
17
24
|
const blockTime = await umi.rpc.getBlockTime(await umi.rpc.getSlot());
|
package/package.json
CHANGED
@@ -17,7 +17,6 @@ import {
|
|
17
17
|
some,
|
18
18
|
} from "@metaplex-foundation/umi";
|
19
19
|
import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
|
20
|
-
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
21
20
|
import {
|
22
21
|
WalletAdapter,
|
23
22
|
walletAdapterIdentity,
|
@@ -51,6 +50,7 @@ import {
|
|
51
50
|
import { SOLAUTO_FEES_WALLET } from "../constants/generalAccounts";
|
52
51
|
import { JupSwapDetails } from "../utils/jupiterUtils";
|
53
52
|
import {
|
53
|
+
getSolanaRpcConnection,
|
54
54
|
getWrappedInstruction,
|
55
55
|
splTokenTransferUmiIx,
|
56
56
|
} from "../utils/solanaUtils";
|
@@ -113,14 +113,12 @@ export abstract class SolautoClient {
|
|
113
113
|
public livePositionUpdates: LivePositionUpdates = new LivePositionUpdates();
|
114
114
|
|
115
115
|
constructor(
|
116
|
-
|
116
|
+
heliusApiKey: string,
|
117
117
|
public localTest?: boolean
|
118
118
|
) {
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
);
|
123
|
-
this.umi = createUmi(this.connection).use({
|
119
|
+
const [connection, umi] = getSolanaRpcConnection(heliusApiKey);
|
120
|
+
this.connection = connection;
|
121
|
+
this.umi = umi.use({
|
124
122
|
install(umi) {
|
125
123
|
umi.programs.add(createSolautoProgram(), false);
|
126
124
|
},
|
@@ -169,10 +167,7 @@ export abstract class SolautoClient {
|
|
169
167
|
this.debtMint =
|
170
168
|
args.debtMint ??
|
171
169
|
toWeb3JsPublicKey(this.solautoPositionData!.position.debtMint);
|
172
|
-
this.positionDebtTa = getTokenAccount(
|
173
|
-
this.solautoPosition,
|
174
|
-
this.debtMint
|
175
|
-
);
|
170
|
+
this.positionDebtTa = getTokenAccount(this.solautoPosition, this.debtMint);
|
176
171
|
this.signerDebtTa = getTokenAccount(
|
177
172
|
toWeb3JsPublicKey(this.signer.publicKey),
|
178
173
|
this.debtMint
|
@@ -352,7 +347,7 @@ export abstract class SolautoClient {
|
|
352
347
|
);
|
353
348
|
}
|
354
349
|
|
355
|
-
const addingReferredBy = accountsToAdd.length === 1
|
350
|
+
const addingReferredBy = accountsToAdd.length === 1;
|
356
351
|
// && accountsToAdd[0].toString().toLowerCase() ===
|
357
352
|
// this.referredBySupplyTa?.toString().toLowerCase();
|
358
353
|
|
@@ -215,9 +215,9 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
215
215
|
solautoPosition: publicKey(this.solautoPosition),
|
216
216
|
marginfiGroup: publicKey(this.marginfiGroup),
|
217
217
|
marginfiAccount:
|
218
|
-
this.
|
219
|
-
?
|
220
|
-
: (this.marginfiAccount
|
218
|
+
"publicKey" in this.marginfiAccount
|
219
|
+
? this.marginfiAccount as Signer
|
220
|
+
: publicKey(this.marginfiAccount),
|
221
221
|
supplyMint: publicKey(this.supplyMint),
|
222
222
|
supplyBank: publicKey(this.marginfiSupplyBankAccounts.bank),
|
223
223
|
positionSupplyTa: publicKey(this.positionSupplyTa),
|
@@ -230,7 +230,7 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
230
230
|
settingParams: settingParams ?? null,
|
231
231
|
dca: dca ?? null,
|
232
232
|
},
|
233
|
-
marginfiAccountSeedIdx: this.marginfiAccountSeedIdx
|
233
|
+
marginfiAccountSeedIdx: !this.selfManaged ? this.marginfiAccountSeedIdx : null,
|
234
234
|
});
|
235
235
|
}
|
236
236
|
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
toWeb3JsPublicKey,
|
14
14
|
toWeb3JsTransaction,
|
15
15
|
} from "@metaplex-foundation/umi-web3js-adapters";
|
16
|
+
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
16
17
|
import {
|
17
18
|
AddressLookupTableAccount,
|
18
19
|
ComputeBudgetProgram,
|
@@ -36,6 +37,15 @@ import {
|
|
36
37
|
getLendingAccountStartFlashloanInstructionDataSerializer,
|
37
38
|
} from "../marginfi-sdk";
|
38
39
|
|
40
|
+
export function getSolanaRpcConnection(heliusApiKey: string): [Connection, Umi] {
|
41
|
+
const connection = new Connection(
|
42
|
+
`https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`,
|
43
|
+
"finalized"
|
44
|
+
);
|
45
|
+
const umi = createUmi(connection);
|
46
|
+
return [connection, umi];
|
47
|
+
}
|
48
|
+
|
39
49
|
export async function currentUnixSecondsSolana(umi: Umi): Promise<number> {
|
40
50
|
return await retryWithExponentialBackoff(async () => {
|
41
51
|
const blockTime = await umi.rpc.getBlockTime(await umi.rpc.getSlot());
|
@@ -24,7 +24,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
24
24
|
|
25
25
|
const payForTransactions = false;
|
26
26
|
const useJitoBundle = false;
|
27
|
-
const positionId =
|
27
|
+
const positionId = 1;
|
28
28
|
|
29
29
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
30
30
|
const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
|
@@ -37,11 +37,11 @@ describe("Solauto Marginfi tests", async () => {
|
|
37
37
|
{
|
38
38
|
signer,
|
39
39
|
positionId,
|
40
|
-
marginfiAccount: new PublicKey(
|
41
|
-
|
42
|
-
),
|
43
|
-
supplyMint: NATIVE_MINT,
|
44
|
-
debtMint: new PublicKey(USDC_MINT),
|
40
|
+
// marginfiAccount: new PublicKey(
|
41
|
+
// "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
42
|
+
// ),
|
43
|
+
// supplyMint: NATIVE_MINT,
|
44
|
+
// debtMint: new PublicKey(USDC_MINT),
|
45
45
|
}
|
46
46
|
);
|
47
47
|
|