Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
10d54ef
more token info
cheliosooo Apr 27, 2025
86e7784
fixes
cheliosooo Apr 28, 2025
03ec162
export function
cheliosooo Apr 30, 2025
31d2405
fixes
cheliosooo Apr 30, 2025
f5b4c5b
small fix
cheliosooo Apr 30, 2025
e49dd6a
unused imports
cheliosooo Apr 30, 2025
4c3fa12
fixes
cheliosooo May 1, 2025
773a441
unused imports
cheliosooo May 2, 2025
e8cdfa5
fixes
cheliosooo May 2, 2025
1d84aeb
fix
cheliosooo May 2, 2025
32552d2
fix logs
cheliosooo May 2, 2025
98aa25a
readmes
cheliosooo May 2, 2025
241c15c
fix
cheliosooo May 2, 2025
b8a7d5e
fixes
cheliosooo May 2, 2025
2f1a7c0
add patch lut
cheliosooo May 2, 2025
f03cce3
add patch lut
cheliosooo May 2, 2025
540bbd5
some re-organizing files
cheliosooo May 3, 2025
e712b3c
pull price unchecked
cheliosooo May 4, 2025
897bba4
remove unused import
cheliosooo May 4, 2025
604200b
tweak
cheliosooo May 4, 2025
1fca7bc
fixes
cheliosooo May 7, 2025
9a806de
space
cheliosooo May 7, 2025
0660387
optimize stack memory usage in program
cheliosooo May 9, 2025
d8af1b0
more optimizations for stack mem
cheliosooo May 9, 2025
b139e38
formatting & fixes
cheliosooo May 9, 2025
c9a807a
fixes
cheliosooo May 9, 2025
7d7c579
adjust fee
cheliosooo May 9, 2025
ed9e507
bump
cheliosooo May 9, 2025
dfe09fb
fixes
cheliosooo May 10, 2025
4422a3c
larger batch
cheliosooo May 11, 2025
40c1f5d
some utils
cheliosooo May 19, 2025
3b76d0b
fix sandbox
cheliosooo May 19, 2025
9ed8437
support marginfi changes
cheliosooo May 21, 2025
cee9086
formatting
cheliosooo May 21, 2025
66c75e4
fix missing piece
cheliosooo May 24, 2025
7a67b26
fixes
cheliosooo May 25, 2025
729cffa
slight change
cheliosooo May 25, 2025
1b81817
adjust threshold
cheliosooo May 25, 2025
2b9fa87
adjustment
cheliosooo May 26, 2025
724fe6a
remove unused import
cheliosooo May 26, 2025
f1f56bd
fixes
cheliosooo May 26, 2025
be83167
bump
cheliosooo May 27, 2025
a7386db
increase jito tip
cheliosooo May 30, 2025
21a740e
tweaks
cheliosooo May 30, 2025
a946e9c
updates
cheliosooo May 31, 2025
8356c77
fixes
cheliosooo Jun 3, 2025
c6a1f7e
filter obric out
cheliosooo Jun 5, 2025
374e1f9
get rid of patch lut
cheliosooo Jun 6, 2025
b9e81e9
bump api version
cheliosooo Jun 6, 2025
7a6d9a5
bump
cheliosooo Jun 9, 2025
5edcdda
fix price bias
cheliosooo Jun 11, 2025
7694328
bump
cheliosooo Jun 11, 2025
957dd0b
updates
cheliosooo Jun 30, 2025
c7a0c63
updates
cheliosooo Jun 30, 2025
e31ead3
upgrade jup price api
cheliosooo Jun 30, 2025
e25a49a
fixes
cheliosooo Jul 1, 2025
66fce95
bump versions
cheliosooo Jul 7, 2025
66bd277
Revert "bump versions"
cheliosooo Jul 9, 2025
46dfe24
Revert "Revert "bump versions""
cheliosooo Jul 11, 2025
65f71d9
Revert "Revert "Revert "bump versions"""
cheliosooo Jul 11, 2025
d949863
fixes
cheliosooo Jul 17, 2025
fa13e29
small fix
cheliosooo Jul 17, 2025
7c035af
fixes
cheliosooo Jul 17, 2025
ea157c0
adding some more accounts
cheliosooo Jul 19, 2025
033f82c
remove dependency on oracle key
cheliosooo Jul 22, 2025
6755a36
fixes
cheliosooo Jul 31, 2025
e0596bb
remove unused variables
cheliosooo Aug 6, 2025
eb0462a
test commit
cheliosooo Aug 8, 2025
6e041af
remove unused imports
cheliosooo Aug 10, 2025
17818b7
small fixes
cheliosooo Aug 10, 2025
a3dec7b
oracle changes from marginfi
cheliosooo Sep 3, 2025
05ebbcb
script change
cheliosooo Sep 8, 2025
728b973
revert
cheliosooo Sep 8, 2025
b5a32ae
marginfi crossbar instance
cheliosooo Sep 8, 2025
e765fff
fix jup api
cheliosooo Oct 1, 2025
cc047cd
wip fixing swb
cheliosooo Oct 2, 2025
f294abb
small fixes
cheliosooo Oct 4, 2025
c59aae6
add cbbtc and reorganize swb code
cheliosooo Oct 29, 2025
5591d05
sandbox script tweak
cheliosooo Oct 29, 2025
2af3803
mut on top of the fixes branch
jgur-psyops Dec 18, 2025
6f15e31
Merge pull request #14 from jgur-psyops/mrgn-mut-on-fixes
mtleliever Dec 18, 2025
d916fc7
set marginfiGroup account to isWritable: true
mtleliever Dec 18, 2025
8ece90a
fix marginfiProtocolInteraction isWritable
mtleliever Dec 19, 2025
3874f8a
fix transaction sizes
cheliosooo Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ See the [Program documentation](/programs/solauto/README.md) for more info on th
- PNPM

```
crate install shank-idl
cargo install shank-cli
rustup component add rustfmt
pnpm install -g ts-node
```
Expand Down Expand Up @@ -64,6 +64,7 @@ pnpm add @haven-fi/solauto-sdk

```typescript
import { PublicKey } from "@solana/web3.js";
import { NATIVE_MINT } from "@solana/spl-token";
import * as solauto from "@haven-fi/solauto-sdk";

// Create new Solauto client
Expand All @@ -73,8 +74,8 @@ const client = solauto.getClient(solauto.LendingPlatform.MARGINFI, {
});

// Initialize the client
const supplyMint = new PublicKey(NATIVE_MINT);
const debtMint = new PublicKey(USDC);
const supplyMint = NATIVE_MINT;
const debtMint = new PublicKey(solauto.USDC);
await client.initializeNewSolautoPosition({
positionId: 1,
lpPoolAccount: solauto.getMarginfiAccounts().defaultGroup,
Expand Down Expand Up @@ -133,7 +134,6 @@ const statuses = txManager.send(transactionItems);
## Rebalancing an existing position

```typescript
import { PublicKey } from "@solana/web3.js";
import * as solauto from "@haven-fi/solauto-sdk";

// Create new Solauto client
Expand Down
71 changes: 58 additions & 13 deletions generateClients.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,49 @@ function fixAnchorIDL(idlFilename, programId) {
origin: "anchor",
address: programId,
};

function flattenDefined(data) {
if (typeof data === "object" && data !== null) {
if (Array.isArray(data)) {
return data.map(flattenDefined);
} else if (data.defined && typeof data.defined === "object") {
return { ...data, defined: data.defined.name };
} else {
return Object.keys(data).reduce((acc, key) => {
acc[key] = flattenDefined(data[key]);
return acc;
}, {});
}
}
return data;
}

data = flattenDefined(data);

function replacePubkeyWithPublicKey(data) {
if (typeof data === "object" && data !== null) {
if (Array.isArray(data)) {
return data.map(replacePubkeyWithPublicKey);
} else {
return Object.keys(data).reduce((acc, key) => {
if (key === "pubkey") {
acc["publicKey"] = data[key];
} else if (typeof data[key] === "string" && data[key] === "pubkey") {
acc[key] = "publicKey";
} else {
acc[key] = replacePubkeyWithPublicKey(data[key]);
}
return acc;
}, {});
}
} else if (data === "pubkey") {
return "publicKey";
}
return data;
}

data = replacePubkeyWithPublicKey(data);

fs.writeFileSync(idlFilePath, JSON.stringify(data, null, 2), "utf8");
}

Expand All @@ -50,7 +93,9 @@ function generateTypescriptSDKForAnchorIDL(sdkDirName, idlFilename, programId) {
const kinobi = k.createFromIdls([idlFilePath]);

kinobi.accept(
new k.renderJavaScriptVisitor(path.join(typescriptSdkDir, sdkDirName))
new k.renderJavaScriptVisitor(
path.join(typescriptSdkDir, "externalSdks", sdkDirName)
)
);
}

Expand Down Expand Up @@ -92,29 +137,29 @@ async function cleanJupiterTsSDK(exclusions = []) {

generateSolautoSDK();

// generateRustSDKForAnchorIDL(
// "marginfi-sdk",
// "marginfi.json",
// "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA"
// );
// generateTypescriptSDKForAnchorIDL(
// "marginfi-sdk",
// "marginfi.json",
// "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA"
// );
generateRustSDKForAnchorIDL(
"marginfi-sdk",
"marginfi.json",
"MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA"
);
generateTypescriptSDKForAnchorIDL(
"marginfi",
"marginfi.json",
"MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA"
);

// generateRustSDKForAnchorIDL(
// "jupiter-sdk",
// "jupiter.json",
// "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
// );
// generateTypescriptSDKForAnchorIDL(
// "jupiter-sdk",
// "jupiter",
// "jupiter.json",
// "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
// );
// generateTypescriptSDKForAnchorIDL(
// "pyth-sdk",
// "pyth",
// "pyth.json",
// "pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT"
// );
Expand Down
2 changes: 1 addition & 1 deletion idls/marginfi.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
"accounts": [
{
"name": "marginfiGroup",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
Expand Down
4 changes: 2 additions & 2 deletions idls/solauto.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@
},
{
"name": "marginfiGroup",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
Expand Down Expand Up @@ -697,7 +697,7 @@
},
{
"name": "marginfiGroup",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"push": "git add . && git commit -m 'wip' && git push",
"format:rust": "find ./programs/* -name '*.rs' -exec rustfmt {} +",
"build:rs:local": "cargo build-sbf -- --package solauto --features local",
"build:rs:staging": "cargo build-sbf -- --package solauto --features \"test staging\"",
"build:rs:test": "cargo build-sbf -- --package solauto --features test",
"build:rs:prod": "solana-verify build --library-name solauto --base-image solanafoundation/solana-verifiable-build@sha256:f3d3a4adaa8008644fc4535373c6818275c7e35a0b07660890b4a95ef434221e",
"build:ts": "cd solauto-sdk && npm run build",
Expand All @@ -25,6 +26,7 @@
"sandbox": "cd solauto-sdk && npx ts-node local/txSandbox.ts",
"update-lut:solauto": "cd solauto-sdk && npx ts-node local/updateSolautoLUT.ts",
"update-lut:marginfi": "cd solauto-sdk && npx ts-node local/updateMarginfiLUT.ts",
"patch-lut": "cd solauto-sdk && npx ts-node local/patchLUT.ts",
"create-token-accounts": "cd solauto-sdk && npx ts-node local/createTokenAccounts.ts",
"prepare-accounts": "pnpm create-token-accounts && pnpm update-lut:solauto && pnpm update-lut:marginfi",
"log-pos": "cd solauto-sdk && npx ts-node local/logPositions.ts",
Expand All @@ -34,7 +36,8 @@
"@metaplex-foundation/kinobi": "^0.18.5",
"@mrgnlabs/marginfi-client-v2": "^6.0.1",
"@mrgnlabs/mrgn-common": "^2.0.2",
"borsh": "^2.0.0"
"borsh": "^2.0.0",
"cross-env": "^10.0.0"
},
"devDependencies": {
"solauto-sdk": "file:solauto-sdk",
Expand Down
Loading