@haven-fi/solauto-sdk 1.0.215 → 1.0.217
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/referralStateManager.d.ts +6 -5
- package/dist/clients/referralStateManager.d.ts.map +1 -1
- package/dist/clients/referralStateManager.js +9 -10
- package/dist/clients/solautoClient.d.ts +8 -17
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +15 -42
- package/dist/clients/solautoMarginfiClient.d.ts +2 -2
- package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/clients/solautoMarginfiClient.js +20 -13
- package/dist/clients/txHandler.d.ts +1 -4
- package/dist/clients/txHandler.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiRebalance.d.ts +1 -1
- package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -1
- package/dist/generated/types/index.d.ts +1 -0
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +1 -0
- package/dist/generated/types/rebalanceData.d.ts +3 -3
- package/dist/generated/types/rebalanceData.d.ts.map +1 -1
- package/dist/generated/types/rebalanceData.js +2 -2
- package/dist/generated/types/rebalanceDirection.d.ts +15 -0
- package/dist/generated/types/rebalanceDirection.d.ts.map +1 -0
- package/dist/generated/types/rebalanceDirection.js +22 -0
- package/dist/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionUtils.js +14 -13
- package/dist/utils/solauto/rebalanceUtils.d.ts +2 -0
- package/dist/utils/solauto/rebalanceUtils.d.ts.map +1 -1
- package/dist/utils/solauto/rebalanceUtils.js +1 -0
- package/package.json +1 -1
- package/src/clients/referralStateManager.ts +17 -15
- package/src/clients/solautoClient.ts +21 -75
- package/src/clients/solautoMarginfiClient.ts +31 -20
- package/src/clients/txHandler.ts +0 -5
- package/src/generated/instructions/marginfiRebalance.ts +1 -1
- package/src/generated/types/index.ts +1 -0
- package/src/generated/types/rebalanceData.ts +7 -5
- package/src/generated/types/rebalanceDirection.ts +25 -0
- package/src/transactions/transactionUtils.ts +19 -13
- package/src/utils/solauto/rebalanceUtils.ts +4 -0
- package/tests/transactions/solautoMarginfi.ts +4 -4
@@ -3,20 +3,22 @@ import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
|
|
3
3
|
import { WalletAdapter } from "@metaplex-foundation/umi-signer-wallet-adapters";
|
4
4
|
import { ReferralState } from "../generated";
|
5
5
|
import { TxHandler } from "./txHandler";
|
6
|
-
interface ReferralStateManagerArgs {
|
6
|
+
export interface ReferralStateManagerArgs {
|
7
7
|
signer?: Signer;
|
8
8
|
wallet?: WalletAdapter;
|
9
|
-
|
9
|
+
authority?: PublicKey;
|
10
10
|
referredByAuthority?: PublicKey;
|
11
11
|
}
|
12
12
|
export declare class ReferralStateManager extends TxHandler {
|
13
13
|
localTest?: boolean | undefined;
|
14
14
|
umi: Umi;
|
15
15
|
signer: Signer;
|
16
|
-
|
16
|
+
authority: PublicKey;
|
17
17
|
referralState: PublicKey;
|
18
18
|
referralStateData: ReferralState | null;
|
19
|
-
|
19
|
+
referredBy?: PublicKey;
|
20
|
+
referredByState?: PublicKey;
|
21
|
+
constructor(rpcUrl: string, localTest?: boolean | undefined);
|
20
22
|
initialize(args: ReferralStateManagerArgs): Promise<void>;
|
21
23
|
defaultLookupTables(): string[];
|
22
24
|
setReferredBy(referredBy?: PublicKey): void;
|
@@ -24,5 +26,4 @@ export declare class ReferralStateManager extends TxHandler {
|
|
24
26
|
claimReferralFeesIx(destFeesMint?: PublicKey): TransactionBuilder;
|
25
27
|
resetLiveTxUpdates(success?: boolean): Promise<void>;
|
26
28
|
}
|
27
|
-
export {};
|
28
29
|
//# sourceMappingURL=referralStateManager.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,MAAM,EAEN,kBAAkB,EAClB,GAAG,E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AAY,CAAC,EAAE,SAAS,EACxB,WAAW,CAAC,EAAE,SAAS,GACtB,kBAAkB;IAerB,mBAAmB,CAAC,YAAY,CAAC,EAAE,SAAS,GAAG,kBAAkB;IA8B3D,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
|
@@ -11,8 +11,8 @@ const utils_1 = require("../utils");
|
|
11
11
|
const txHandler_1 = require("./txHandler");
|
12
12
|
const constants_1 = require("../constants");
|
13
13
|
class ReferralStateManager extends txHandler_1.TxHandler {
|
14
|
-
constructor(
|
15
|
-
super(
|
14
|
+
constructor(rpcUrl, localTest) {
|
15
|
+
super(rpcUrl, localTest);
|
16
16
|
this.localTest = localTest;
|
17
17
|
this.umi = this.umi.use({
|
18
18
|
install(umi) {
|
@@ -28,7 +28,8 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
28
28
|
? (0, umi_1.signerIdentity)(args.signer)
|
29
29
|
: (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
|
30
30
|
this.signer = this.umi.identity;
|
31
|
-
this.
|
31
|
+
this.authority = args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
|
32
|
+
this.referralState = (0, utils_1.getReferralState)(args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey));
|
32
33
|
this.referralStateData = await (0, generated_1.safeFetchReferralState)(this.umi, (0, umi_1.publicKey)(this.referralState), { commitment: "confirmed" });
|
33
34
|
this.setReferredBy(args.referredByAuthority);
|
34
35
|
}
|
@@ -39,10 +40,8 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
39
40
|
: [constants_1.SOLAUTO_LUT];
|
40
41
|
}
|
41
42
|
setReferredBy(referredBy) {
|
42
|
-
const
|
43
|
-
|
44
|
-
authorityReferralStateData.referredByState !==
|
45
|
-
(0, umi_1.publicKey)(web3_js_1.PublicKey.default);
|
43
|
+
const hasReferredBy = this.referralStateData &&
|
44
|
+
this.referralStateData.referredByState !== (0, umi_1.publicKey)(web3_js_1.PublicKey.default);
|
46
45
|
const finalReferredBy = !hasReferredBy &&
|
47
46
|
referredBy &&
|
48
47
|
!referredBy.equals((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey))
|
@@ -51,8 +50,8 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
51
50
|
this.referredBy = finalReferredBy;
|
52
51
|
this.referredByState = finalReferredBy
|
53
52
|
? (0, utils_1.getReferralState)(finalReferredBy)
|
54
|
-
:
|
55
|
-
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(
|
53
|
+
: this.referralStateData
|
54
|
+
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.referredByState)
|
56
55
|
: undefined;
|
57
56
|
}
|
58
57
|
updateReferralStatesIx(destFeesMint, lookupTable) {
|
@@ -78,7 +77,7 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
78
77
|
return (0, generated_1.claimReferralFees)(this.umi, {
|
79
78
|
signer: this.signer,
|
80
79
|
signerWsolTa: (0, umi_1.publicKey)((0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), spl_token_1.NATIVE_MINT)),
|
81
|
-
referralAuthority: (0, umi_1.publicKey)(this.
|
80
|
+
referralAuthority: (0, umi_1.publicKey)(this.authority),
|
82
81
|
referralState: (0, umi_1.publicKey)(this.referralState),
|
83
82
|
referralFeesDestTa: (0, umi_1.publicKey)(referralDestTa),
|
84
83
|
referralFeesDestMint: (0, umi_1.publicKey)(referralFeesDestMint),
|
@@ -1,25 +1,19 @@
|
|
1
1
|
import "rpc-websockets/dist/lib/client";
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
3
3
|
import { Signer, TransactionBuilder } from "@metaplex-foundation/umi";
|
4
|
-
import { WalletAdapter } from "@metaplex-foundation/umi-signer-wallet-adapters";
|
5
4
|
import { DCASettings, DCASettingsInpArgs, LendingPlatform, PositionState, SolautoActionArgs, SolautoPosition, SolautoRebalanceTypeArgs, SolautoSettingsParameters, SolautoSettingsParametersInpArgs, UpdatePositionDataArgs } from "../generated";
|
6
|
-
import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
|
5
|
+
import { FlashLoanDetails, RebalanceValues } from "../utils/solauto/rebalanceUtils";
|
7
6
|
import { LivePositionUpdates } from "../utils/solauto/generalUtils";
|
8
|
-
import { ReferralStateManager } from "./referralStateManager";
|
9
|
-
import { TxHandler } from "./txHandler";
|
7
|
+
import { ReferralStateManager, ReferralStateManagerArgs } from "./referralStateManager";
|
10
8
|
import { QuoteResponse } from "@jup-ag/api";
|
11
|
-
export interface SolautoClientArgs {
|
9
|
+
export interface SolautoClientArgs extends ReferralStateManagerArgs {
|
12
10
|
new?: boolean;
|
13
|
-
authority?: PublicKey;
|
14
11
|
positionId?: number;
|
15
|
-
signer?: Signer;
|
16
|
-
wallet?: WalletAdapter;
|
17
12
|
supplyMint?: PublicKey;
|
18
13
|
debtMint?: PublicKey;
|
19
|
-
referredByAuthority?: PublicKey;
|
20
14
|
}
|
21
|
-
export declare abstract class SolautoClient extends
|
22
|
-
lendingPlatform
|
15
|
+
export declare abstract class SolautoClient extends ReferralStateManager {
|
16
|
+
lendingPlatform?: LendingPlatform;
|
23
17
|
authority: PublicKey;
|
24
18
|
signer: Signer;
|
25
19
|
positionId: number;
|
@@ -35,15 +29,12 @@ export declare abstract class SolautoClient extends TxHandler {
|
|
35
29
|
debtMint: PublicKey;
|
36
30
|
positionDebtTa: PublicKey;
|
37
31
|
signerDebtTa: PublicKey;
|
38
|
-
referralStateManager: ReferralStateManager;
|
39
|
-
referredBySupplyTa?: PublicKey;
|
40
32
|
solautoFeesWallet: PublicKey;
|
41
33
|
solautoFeesSupplyTa: PublicKey;
|
42
34
|
authorityLutAddress?: PublicKey;
|
43
35
|
livePositionUpdates: LivePositionUpdates;
|
44
|
-
|
45
|
-
|
46
|
-
setReferredBy(referredBy?: PublicKey): void;
|
36
|
+
initialize(args: SolautoClientArgs): Promise<void>;
|
37
|
+
referredBySupplyTa(): PublicKey | undefined;
|
47
38
|
resetLiveTxUpdates(success?: boolean): Promise<void>;
|
48
39
|
abstract protocolAccount(): PublicKey;
|
49
40
|
defaultLookupTables(): string[];
|
@@ -64,7 +55,7 @@ export declare abstract class SolautoClient extends TxHandler {
|
|
64
55
|
protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
|
65
56
|
abstract flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
|
66
57
|
abstract flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
|
67
|
-
abstract rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number): TransactionBuilder;
|
58
|
+
abstract rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, rebalanceValues: RebalanceValues, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number): TransactionBuilder;
|
68
59
|
getFreshPositionState(): Promise<PositionState | undefined>;
|
69
60
|
}
|
70
61
|
//# sourceMappingURL=solautoClient.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,EACN,kBAAkB,
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,EACN,kBAAkB,EA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E,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,eAAe,EAAE,eAAe,EAChC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
|
@@ -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_signer_wallet_adapters_1 = require("@metaplex-foundation/umi-signer-wallet-adapters");
|
9
8
|
const generated_1 = require("../generated");
|
10
9
|
const accountUtils_1 = require("../utils/accountUtils");
|
11
10
|
const generalAccounts_1 = require("../constants/generalAccounts");
|
@@ -14,29 +13,15 @@ const solautoConstants_1 = require("../constants/solautoConstants");
|
|
14
13
|
const generalUtils_1 = require("../utils/generalUtils");
|
15
14
|
const generalUtils_2 = require("../utils/solauto/generalUtils");
|
16
15
|
const referralStateManager_1 = require("./referralStateManager");
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
super(rpcUrl, localTest);
|
16
|
+
class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
17
|
+
constructor() {
|
18
|
+
super(...arguments);
|
21
19
|
this.livePositionUpdates = new generalUtils_2.LivePositionUpdates();
|
22
|
-
this.umi = this.umi.use({
|
23
|
-
install(umi) {
|
24
|
-
umi.programs.add((0, generated_1.createSolautoProgram)(), false);
|
25
|
-
},
|
26
|
-
});
|
27
20
|
}
|
28
|
-
async initialize(args
|
29
|
-
|
30
|
-
throw new Error("Signer or wallet must be provided");
|
31
|
-
}
|
32
|
-
this.umi = this.umi.use(args.signer
|
33
|
-
? (0, umi_1.signerIdentity)(args.signer)
|
34
|
-
: (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
|
35
|
-
this.signer = this.umi.identity;
|
36
|
-
this.authority = args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
|
21
|
+
async initialize(args) {
|
22
|
+
await super.initialize(args);
|
37
23
|
this.positionId = args.positionId ?? 0;
|
38
24
|
this.selfManaged = this.positionId === 0;
|
39
|
-
this.lendingPlatform = lendingPlatform;
|
40
25
|
this.solautoPosition = (0, accountUtils_1.getSolautoPositionAccount)(this.authority, this.positionId);
|
41
26
|
this.solautoPositionData = !args.new
|
42
27
|
? await (0, generated_1.safeFetchSolautoPosition)(this.umi, (0, umi_1.publicKey)(this.solautoPosition), { commitment: "confirmed" })
|
@@ -58,24 +43,12 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
58
43
|
: web3_js_1.PublicKey.default);
|
59
44
|
this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
|
60
45
|
this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
|
61
|
-
this.referralStateManager = new referralStateManager_1.ReferralStateManager(this.rpcUrl);
|
62
|
-
await this.referralStateManager.initialize({
|
63
|
-
referralAuthority: this.authority,
|
64
|
-
referredByAuthority: args.referredByAuthority,
|
65
|
-
signer: args.signer,
|
66
|
-
wallet: args.wallet,
|
67
|
-
});
|
68
|
-
console.log(this.referralStateManager.referredBy?.toString());
|
69
|
-
if (this.referralStateManager.referredByState !== undefined) {
|
70
|
-
this.referredBySupplyTa = (0, accountUtils_1.getTokenAccount)(this.referralStateManager.referredByState, this.supplyMint);
|
71
|
-
}
|
72
46
|
this.solautoFeesWallet = generalAccounts_1.SOLAUTO_FEES_WALLET;
|
73
47
|
this.solautoFeesSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoFeesWallet, this.supplyMint);
|
74
|
-
const authorityReferralStateData = this.referralStateManager.referralStateData;
|
75
48
|
this.authorityLutAddress =
|
76
|
-
|
77
|
-
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(
|
78
|
-
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(
|
49
|
+
this.referralStateData?.lookupTable &&
|
50
|
+
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
|
51
|
+
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable)
|
79
52
|
: undefined;
|
80
53
|
this.log("Position state: ", this.solautoPositionState);
|
81
54
|
this.log("Position settings: ", this.solautoPositionData?.position?.settingParams);
|
@@ -84,11 +57,11 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
84
57
|
? this.solautoPositionData?.position?.dca
|
85
58
|
: undefined);
|
86
59
|
}
|
87
|
-
|
88
|
-
this.
|
89
|
-
|
90
|
-
this.referredBySupplyTa = (0, accountUtils_1.getTokenAccount)(this.referralStateManager.referredByState, this.supplyMint);
|
60
|
+
referredBySupplyTa() {
|
61
|
+
if (this.referredByState !== undefined) {
|
62
|
+
return (0, accountUtils_1.getTokenAccount)(this.referredByState, this.supplyMint);
|
91
63
|
}
|
64
|
+
return undefined;
|
92
65
|
}
|
93
66
|
async resetLiveTxUpdates(success) {
|
94
67
|
if (success) {
|
@@ -129,8 +102,8 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
129
102
|
this.solautoPosition,
|
130
103
|
this.positionSupplyTa,
|
131
104
|
this.positionDebtTa,
|
132
|
-
this.
|
133
|
-
...(this.referredBySupplyTa ? [this.referredBySupplyTa] : []),
|
105
|
+
this.referralState,
|
106
|
+
...(this.referredBySupplyTa() ? [this.referredBySupplyTa()] : []),
|
134
107
|
];
|
135
108
|
}
|
136
109
|
async fetchExistingAuthorityLutAccounts() {
|
@@ -172,7 +145,7 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
172
145
|
}
|
173
146
|
const addingReferredBy = accountsToAdd.length === 1 &&
|
174
147
|
accountsToAdd[0].toString().toLowerCase() ===
|
175
|
-
this.referredBySupplyTa?.toString().toLowerCase();
|
148
|
+
this.referredBySupplyTa()?.toString().toLowerCase();
|
176
149
|
if (tx.getInstructions().length > 0) {
|
177
150
|
this.log("Updating authority lookup table...");
|
178
151
|
}
|
@@ -4,7 +4,7 @@ import { SolautoClient, SolautoClientArgs } from "./solautoClient";
|
|
4
4
|
import { MarginfiAssetAccounts } from "../types/accounts";
|
5
5
|
import { DCASettingsInpArgs, PositionState, SolautoActionArgs, SolautoRebalanceTypeArgs, SolautoSettingsParametersInpArgs } from "../generated";
|
6
6
|
import { MarginfiAccount } from "../marginfi-sdk";
|
7
|
-
import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
|
7
|
+
import { FlashLoanDetails, RebalanceValues } from "../utils/solauto/rebalanceUtils";
|
8
8
|
import { QuoteResponse } from "@jup-ag/api";
|
9
9
|
export interface SolautoMarginfiClientArgs extends SolautoClientArgs {
|
10
10
|
marginfiAccount?: PublicKey | Signer;
|
@@ -38,7 +38,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
|
|
38
38
|
protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
|
39
39
|
private marginfiProtocolInteractionIx;
|
40
40
|
private marginfiSolautoProtocolInteractionIx;
|
41
|
-
rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number): TransactionBuilder;
|
41
|
+
rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, rebalanceValues: RebalanceValues, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number): TransactionBuilder;
|
42
42
|
flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
|
43
43
|
flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
|
44
44
|
createIntermediaryMarginfiAccount(): TransactionBuilder;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EAEb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EAEb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAOtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,qBAAa,q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AE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAoFlE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CA6ClE"}
|
@@ -19,7 +19,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
19
19
|
this.marginfiAccountSeedIdx = BigInt(0);
|
20
20
|
}
|
21
21
|
async initialize(args) {
|
22
|
-
await super.initialize(args
|
22
|
+
await super.initialize(args);
|
23
|
+
this.lendingPlatform = generated_1.LendingPlatform.Marginfi;
|
23
24
|
if (this.selfManaged) {
|
24
25
|
this.marginfiAccount =
|
25
26
|
args.marginfiAccount ??
|
@@ -135,12 +136,12 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
135
136
|
return (0, generated_1.marginfiOpenPosition)(this.umi, {
|
136
137
|
signer: this.signer,
|
137
138
|
marginfiProgram: (0, umi_1.publicKey)(marginfi_sdk_1.MARGINFI_PROGRAM_ID),
|
138
|
-
signerReferralState: (0, umi_1.publicKey)(this.
|
139
|
-
referredByState: this.
|
140
|
-
? (0, umi_1.publicKey)(this.
|
139
|
+
signerReferralState: (0, umi_1.publicKey)(this.referralState),
|
140
|
+
referredByState: this.referredByState
|
141
|
+
? (0, umi_1.publicKey)(this.referredByState)
|
141
142
|
: undefined,
|
142
|
-
referredBySupplyTa: this.referredBySupplyTa
|
143
|
-
? (0, umi_1.publicKey)(this.referredBySupplyTa)
|
143
|
+
referredBySupplyTa: this.referredBySupplyTa()
|
144
|
+
? (0, umi_1.publicKey)(this.referredBySupplyTa())
|
144
145
|
: undefined,
|
145
146
|
solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
|
146
147
|
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
@@ -285,7 +286,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
285
286
|
solautoAction: args,
|
286
287
|
});
|
287
288
|
}
|
288
|
-
rebalance(rebalanceStep, jupQuote, rebalanceType, flashLoan, targetLiqUtilizationRateBps) {
|
289
|
+
rebalance(rebalanceStep, jupQuote, rebalanceType, rebalanceValues, flashLoan, targetLiqUtilizationRateBps) {
|
289
290
|
const inputIsSupply = new web3_js_1.PublicKey(jupQuote.inputMint).equals(this.supplyMint);
|
290
291
|
const outputIsSupply = new web3_js_1.PublicKey(jupQuote.outputMint).equals(this.supplyMint);
|
291
292
|
const needSupplyAccounts = (inputIsSupply && rebalanceStep === "A") ||
|
@@ -299,11 +300,13 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
299
300
|
marginfiProgram: (0, umi_1.publicKey)(marginfi_sdk_1.MARGINFI_PROGRAM_ID),
|
300
301
|
ixsSysvar: (0, umi_1.publicKey)(web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY),
|
301
302
|
solautoFeesSupplyTa: rebalanceStep === "B" ? (0, umi_1.publicKey)(this.solautoFeesSupplyTa) : undefined,
|
302
|
-
authorityReferralState: (0, umi_1.publicKey)(this.
|
303
|
-
referredBySupplyTa: this.referredBySupplyTa
|
304
|
-
? (0, umi_1.publicKey)(this.referredBySupplyTa)
|
303
|
+
authorityReferralState: (0, umi_1.publicKey)(this.referralState),
|
304
|
+
referredBySupplyTa: this.referredBySupplyTa()
|
305
|
+
? (0, umi_1.publicKey)(this.referredBySupplyTa())
|
306
|
+
: undefined,
|
307
|
+
positionAuthority: rebalanceValues.rebalanceAction === "dca"
|
308
|
+
? (0, umi_1.publicKey)(this.authority)
|
305
309
|
: undefined,
|
306
|
-
positionAuthority: (0, umi_1.publicKey)(this.authority),
|
307
310
|
solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
|
308
311
|
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
309
312
|
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
@@ -311,7 +314,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
311
314
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.bank),
|
312
315
|
supplyPriceOracle: (0, umi_1.publicKey)(this.supplyPriceOracle),
|
313
316
|
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
314
|
-
authoritySupplyTa:
|
317
|
+
authoritySupplyTa: this.selfManaged
|
318
|
+
? (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)(this.authority, this.supplyMint))
|
319
|
+
: undefined,
|
315
320
|
vaultSupplyTa: needSupplyAccounts
|
316
321
|
? (0, umi_1.publicKey)(this.marginfiSupplyAccounts.liquidityVault)
|
317
322
|
: undefined,
|
@@ -321,7 +326,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
321
326
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
|
322
327
|
debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
|
323
328
|
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
324
|
-
authorityDebtTa:
|
329
|
+
authorityDebtTa: this.selfManaged
|
330
|
+
? (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)(this.authority, this.debtMint))
|
331
|
+
: undefined,
|
325
332
|
vaultDebtTa: needDebtAccounts
|
326
333
|
? (0, umi_1.publicKey)(this.marginfiDebtAccounts.liquidityVault)
|
327
334
|
: undefined,
|
@@ -1,15 +1,12 @@
|
|
1
1
|
import { Umi } from "@metaplex-foundation/umi";
|
2
|
-
import { Connection
|
2
|
+
import { Connection } from "@solana/web3.js";
|
3
3
|
export declare abstract class TxHandler {
|
4
4
|
rpcUrl: string;
|
5
5
|
umi: Umi;
|
6
6
|
connection: Connection;
|
7
|
-
referredBy?: PublicKey;
|
8
|
-
referredByState?: PublicKey;
|
9
7
|
constructor(rpcUrl: string, localTest?: boolean);
|
10
8
|
log(...args: any[]): void;
|
11
9
|
abstract defaultLookupTables(): string[];
|
12
10
|
abstract resetLiveTxUpdates(success?: boolean): Promise<void>;
|
13
|
-
abstract setReferredBy(referredBy?: PublicKey): void;
|
14
11
|
}
|
15
12
|
//# sourceMappingURL=txHandler.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,
|
1
|
+
{"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AAGxD,8BAAsB,SAAS;IACtB,MAAM,EAAG,MAAM,CAAC;IAChB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;gBAG7B,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,OAAO;IAYrB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAIzB,QAAQ,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAExC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9D"}
|
@@ -17,7 +17,7 @@ export type MarginfiRebalanceInstructionAccounts = {
|
|
17
17
|
solautoFeesSupplyTa?: PublicKey | Pda;
|
18
18
|
authorityReferralState: PublicKey | Pda;
|
19
19
|
referredBySupplyTa?: PublicKey | Pda;
|
20
|
-
positionAuthority
|
20
|
+
positionAuthority?: PublicKey | Pda;
|
21
21
|
solautoPosition: PublicKey | Pda;
|
22
22
|
marginfiGroup: PublicKey | Pda;
|
23
23
|
marginfiAccount: PublicKey | Pda;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAOX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,mBAAmB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,sBAAsB,EAAE,SAAS,GAAG,GAAG,CAAC;IACxC,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,iBAAiB,EAAE,SAAS,GAAG,GAAG,CAAC;
|
1
|
+
{"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAOX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC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sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,aAAa,EAAE,wBAAwB,CAAC;IACxC,2BAA2B,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,sBAAsB,EAAE,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAoBA;AAGD,MAAM,MAAM,gCAAgC,GAC1C,oCAAoC,CAAC;AAGvC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,CAkLpB"}
|
@@ -16,6 +16,7 @@ export * from './positionState';
|
|
16
16
|
export * from './positionTokenUsage';
|
17
17
|
export * from './positionType';
|
18
18
|
export * from './rebalanceData';
|
19
|
+
export * from './rebalanceDirection';
|
19
20
|
export * from './solautoAction';
|
20
21
|
export * from './solautoRebalanceType';
|
21
22
|
export * from './solautoSettingsParameters';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
@@ -32,6 +32,7 @@ __exportStar(require("./positionState"), exports);
|
|
32
32
|
__exportStar(require("./positionTokenUsage"), exports);
|
33
33
|
__exportStar(require("./positionType"), exports);
|
34
34
|
__exportStar(require("./rebalanceData"), exports);
|
35
|
+
__exportStar(require("./rebalanceDirection"), exports);
|
35
36
|
__exportStar(require("./solautoAction"), exports);
|
36
37
|
__exportStar(require("./solautoRebalanceType"), exports);
|
37
38
|
__exportStar(require("./solautoSettingsParameters"), exports);
|
@@ -6,11 +6,11 @@
|
|
6
6
|
* @see https://github.com/metaplex-foundation/kinobi
|
7
7
|
*/
|
8
8
|
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
9
|
-
import { SolautoRebalanceType, SolautoRebalanceTypeArgs } from '.';
|
9
|
+
import { RebalanceDirection, RebalanceDirectionArgs, SolautoRebalanceType, SolautoRebalanceTypeArgs } from '.';
|
10
10
|
export type RebalanceData = {
|
11
11
|
rebalanceType: SolautoRebalanceType;
|
12
12
|
padding1: Array<number>;
|
13
|
-
|
13
|
+
rebalanceDirection: RebalanceDirection;
|
14
14
|
padding2: Array<number>;
|
15
15
|
flashLoanAmount: bigint;
|
16
16
|
padding: Uint8Array;
|
@@ -18,7 +18,7 @@ export type RebalanceData = {
|
|
18
18
|
export type RebalanceDataArgs = {
|
19
19
|
rebalanceType: SolautoRebalanceTypeArgs;
|
20
20
|
padding1: Array<number>;
|
21
|
-
|
21
|
+
rebalanceDirection: RebalanceDirectionArgs;
|
22
22
|
padding2: Array<number>;
|
23
23
|
flashLoanAmount: number | bigint;
|
24
24
|
padding: Uint8Array;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceData.d.ts","sourceRoot":"","sources":["../../../src/generated/types/rebalanceData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,
|
1
|
+
{"version":3,"file":"rebalanceData.d.ts","sourceRoot":"","sources":["../../../src/generated/types/rebalanceData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EAGzB,MAAM,GAAG,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,EAAE,oBAAoB,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,wBAAwB,CAAC;IACxC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,kBAAkB,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,UAAU,CACtD,iBAAiB,EACjB,aAAa,CACd,CAYA"}
|
@@ -14,8 +14,8 @@ function getRebalanceDataSerializer() {
|
|
14
14
|
return (0, serializers_1.struct)([
|
15
15
|
['rebalanceType', (0, _1.getSolautoRebalanceTypeSerializer)()],
|
16
16
|
['padding1', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 7 })],
|
17
|
-
['
|
18
|
-
['padding2', (0, serializers_1.array)((0, serializers_1.u8)(), { size:
|
17
|
+
['rebalanceDirection', (0, _1.getRebalanceDirectionSerializer)()],
|
18
|
+
['padding2', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 7 })],
|
19
19
|
['flashLoanAmount', (0, serializers_1.u64)()],
|
20
20
|
['padding', (0, serializers_1.bytes)({ size: 32 })],
|
21
21
|
], { description: 'RebalanceData' });
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
9
|
+
export declare enum RebalanceDirection {
|
10
|
+
Boost = 0,
|
11
|
+
Repay = 1
|
12
|
+
}
|
13
|
+
export type RebalanceDirectionArgs = RebalanceDirection;
|
14
|
+
export declare function getRebalanceDirectionSerializer(): Serializer<RebalanceDirectionArgs, RebalanceDirection>;
|
15
|
+
//# sourceMappingURL=rebalanceDirection.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rebalanceDirection.d.ts","sourceRoot":"","sources":["../../../src/generated/types/rebalanceDirection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,kBAAkB;IAC5B,KAAK,IAAA;IACL,KAAK,IAAA;CACN;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAExD,wBAAgB,+BAA+B,IAAI,UAAU,CAC3D,sBAAsB,EACtB,kBAAkB,CACnB,CAIA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
/**
|
3
|
+
* This code was AUTOGENERATED using the kinobi library.
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
5
|
+
* to add features, then rerun kinobi to update it.
|
6
|
+
*
|
7
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
8
|
+
*/
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.RebalanceDirection = void 0;
|
11
|
+
exports.getRebalanceDirectionSerializer = getRebalanceDirectionSerializer;
|
12
|
+
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
13
|
+
var RebalanceDirection;
|
14
|
+
(function (RebalanceDirection) {
|
15
|
+
RebalanceDirection[RebalanceDirection["Boost"] = 0] = "Boost";
|
16
|
+
RebalanceDirection[RebalanceDirection["Repay"] = 1] = "Repay";
|
17
|
+
})(RebalanceDirection || (exports.RebalanceDirection = RebalanceDirection = {}));
|
18
|
+
function getRebalanceDirectionSerializer() {
|
19
|
+
return (0, serializers_1.scalarEnum)(RebalanceDirection, {
|
20
|
+
description: 'RebalanceDirection',
|
21
|
+
});
|
22
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAA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