@haven-fi/solauto-sdk 1.0.193 → 1.0.195
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.d.ts +3 -2
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +24 -18
- package/dist/clients/solautoMarginfiClient.d.ts +2 -2
- package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/clients/solautoMarginfiClient.js +15 -9
- package/dist/generated/types/lendingPlatform.d.ts +1 -2
- package/dist/generated/types/lendingPlatform.d.ts.map +1 -1
- package/dist/generated/types/lendingPlatform.js +0 -1
- package/dist/jupiter-sdk/index.d.ts +0 -4
- package/dist/jupiter-sdk/index.d.ts.map +1 -1
- package/dist/jupiter-sdk/index.js +0 -4
- package/dist/transactions/transactionUtils.js +8 -8
- package/dist/types/accounts.d.ts +1 -0
- package/dist/types/accounts.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +4 -0
- package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
- package/dist/utils/solauto/generalUtils.js +0 -1
- package/package.json +1 -1
- package/src/clients/solautoClient.ts +37 -31
- package/src/clients/solautoMarginfiClient.ts +20 -11
- package/src/generated/types/lendingPlatform.ts +0 -1
- package/src/jupiter-sdk/index.ts +0 -4
- package/src/transactions/transactionUtils.ts +8 -8
- package/src/types/accounts.ts +1 -0
- package/src/utils/marginfiUtils.ts +6 -1
- package/src/utils/solauto/generalUtils.ts +0 -1
- package/dist/jupiter-sdk/accounts/index.d.ts +0 -9
- package/dist/jupiter-sdk/accounts/index.d.ts.map +0 -1
- package/dist/jupiter-sdk/accounts/index.js +0 -24
- package/dist/jupiter-sdk/accounts/tokenLedger.d.ts +0 -32
- package/dist/jupiter-sdk/accounts/tokenLedger.d.ts.map +0 -1
- package/dist/jupiter-sdk/accounts/tokenLedger.js +0 -68
- package/dist/jupiter-sdk/instructions/aldrinSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/aldrinSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/aldrinSwap.js +0 -95
- package/dist/jupiter-sdk/instructions/aldrinV2Swap.d.ts +0 -30
- package/dist/jupiter-sdk/instructions/aldrinV2Swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/aldrinV2Swap.js +0 -100
- package/dist/jupiter-sdk/instructions/balansolSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/balansolSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/balansolSwap.js +0 -130
- package/dist/jupiter-sdk/instructions/claim.d.ts +0 -25
- package/dist/jupiter-sdk/instructions/claim.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/claim.js +0 -64
- package/dist/jupiter-sdk/instructions/claimToken.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/claimToken.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/claimToken.js +0 -93
- package/dist/jupiter-sdk/instructions/cloneSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/cloneSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/cloneSwap.js +0 -120
- package/dist/jupiter-sdk/instructions/createOpenOrders.d.ts +0 -24
- package/dist/jupiter-sdk/instructions/createOpenOrders.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/createOpenOrders.js +0 -76
- package/dist/jupiter-sdk/instructions/createProgramOpenOrders.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/createProgramOpenOrders.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/createProgramOpenOrders.js +0 -86
- package/dist/jupiter-sdk/instructions/createTokenAccount.d.ts +0 -27
- package/dist/jupiter-sdk/instructions/createTokenAccount.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/createTokenAccount.js +0 -70
- package/dist/jupiter-sdk/instructions/createTokenLedger.d.ts +0 -21
- package/dist/jupiter-sdk/instructions/createTokenLedger.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/createTokenLedger.js +0 -62
- package/dist/jupiter-sdk/instructions/cremaSwap.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/cremaSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/cremaSwap.js +0 -119
- package/dist/jupiter-sdk/instructions/cropperSwap.d.ts +0 -30
- package/dist/jupiter-sdk/instructions/cropperSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/cropperSwap.js +0 -103
- package/dist/jupiter-sdk/instructions/cykuraSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/cykuraSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/cykuraSwap.js +0 -99
- package/dist/jupiter-sdk/instructions/deltafiSwap.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/deltafiSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/deltafiSwap.js +0 -109
- package/dist/jupiter-sdk/instructions/dradexSwap.d.ts +0 -35
- package/dist/jupiter-sdk/instructions/dradexSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/dradexSwap.js +0 -121
- package/dist/jupiter-sdk/instructions/exactOutRoute.d.ts +0 -42
- package/dist/jupiter-sdk/instructions/exactOutRoute.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/exactOutRoute.js +0 -109
- package/dist/jupiter-sdk/instructions/goosefxSwap.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/goosefxSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/goosefxSwap.js +0 -115
- package/dist/jupiter-sdk/instructions/goosefxV2Swap.d.ts +0 -38
- package/dist/jupiter-sdk/instructions/goosefxV2Swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/goosefxV2Swap.js +0 -140
- package/dist/jupiter-sdk/instructions/heliumTreasuryManagementRedeemV0.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/heliumTreasuryManagementRedeemV0.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/heliumTreasuryManagementRedeemV0.js +0 -91
- package/dist/jupiter-sdk/instructions/index.d.ts +0 -72
- package/dist/jupiter-sdk/instructions/index.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/index.js +0 -87
- package/dist/jupiter-sdk/instructions/invariantSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/invariantSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/invariantSwap.js +0 -95
- package/dist/jupiter-sdk/instructions/lifinitySwap.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/lifinitySwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/lifinitySwap.js +0 -113
- package/dist/jupiter-sdk/instructions/lifinityV2Swap.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/lifinityV2Swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/lifinityV2Swap.js +0 -113
- package/dist/jupiter-sdk/instructions/marcoPoloSwap.d.ts +0 -36
- package/dist/jupiter-sdk/instructions/marcoPoloSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/marcoPoloSwap.js +0 -137
- package/dist/jupiter-sdk/instructions/marinadeDeposit.d.ts +0 -36
- package/dist/jupiter-sdk/instructions/marinadeDeposit.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/marinadeDeposit.js +0 -144
- package/dist/jupiter-sdk/instructions/marinadeUnstake.d.ts +0 -30
- package/dist/jupiter-sdk/instructions/marinadeUnstake.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/marinadeUnstake.js +0 -105
- package/dist/jupiter-sdk/instructions/mercurialSwap.d.ts +0 -25
- package/dist/jupiter-sdk/instructions/mercurialSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/mercurialSwap.js +0 -76
- package/dist/jupiter-sdk/instructions/meteoraDlmmSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/meteoraDlmmSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/meteoraDlmmSwap.js +0 -119
- package/dist/jupiter-sdk/instructions/meteoraSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/meteoraSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/meteoraSwap.js +0 -120
- package/dist/jupiter-sdk/instructions/moonshotWrappedBuy.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/moonshotWrappedBuy.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/moonshotWrappedBuy.js +0 -119
- package/dist/jupiter-sdk/instructions/moonshotWrappedSell.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/moonshotWrappedSell.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/moonshotWrappedSell.js +0 -106
- package/dist/jupiter-sdk/instructions/obricSwap.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/obricSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/obricSwap.js +0 -106
- package/dist/jupiter-sdk/instructions/oneIntroSwap.d.ts +0 -30
- package/dist/jupiter-sdk/instructions/oneIntroSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/oneIntroSwap.js +0 -100
- package/dist/jupiter-sdk/instructions/openBookV2Swap.d.ts +0 -35
- package/dist/jupiter-sdk/instructions/openBookV2Swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/openBookV2Swap.js +0 -125
- package/dist/jupiter-sdk/instructions/perpsAddLiquidity.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/perpsAddLiquidity.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsAddLiquidity.js +0 -110
- package/dist/jupiter-sdk/instructions/perpsRemoveLiquidity.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/perpsRemoveLiquidity.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsRemoveLiquidity.js +0 -110
- package/dist/jupiter-sdk/instructions/perpsSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/perpsSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsSwap.js +0 -120
- package/dist/jupiter-sdk/instructions/perpsV2AddLiquidity.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/perpsV2AddLiquidity.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsV2AddLiquidity.js +0 -115
- package/dist/jupiter-sdk/instructions/perpsV2RemoveLiquidity.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/perpsV2RemoveLiquidity.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsV2RemoveLiquidity.js +0 -112
- package/dist/jupiter-sdk/instructions/perpsV2Swap.d.ts +0 -36
- package/dist/jupiter-sdk/instructions/perpsV2Swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/perpsV2Swap.js +0 -130
- package/dist/jupiter-sdk/instructions/phoenixSwap.d.ts +0 -27
- package/dist/jupiter-sdk/instructions/phoenixSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/phoenixSwap.js +0 -89
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedBuy.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedBuy.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedBuy.js +0 -123
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedSell.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedSell.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/pumpdotfunWrappedSell.js +0 -107
- package/dist/jupiter-sdk/instructions/raydiumClmmSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/raydiumClmmSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/raydiumClmmSwap.js +0 -102
- package/dist/jupiter-sdk/instructions/raydiumClmmSwapV2.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/raydiumClmmSwapV2.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/raydiumClmmSwapV2.js +0 -117
- package/dist/jupiter-sdk/instructions/raydiumCpSwap.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/raydiumCpSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/raydiumCpSwap.js +0 -116
- package/dist/jupiter-sdk/instructions/raydiumSwap.d.ts +0 -36
- package/dist/jupiter-sdk/instructions/raydiumSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/raydiumSwap.js +0 -134
- package/dist/jupiter-sdk/instructions/route.d.ts +0 -40
- package/dist/jupiter-sdk/instructions/route.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/route.js +0 -99
- package/dist/jupiter-sdk/instructions/routeWithTokenLedger.d.ts +0 -39
- package/dist/jupiter-sdk/instructions/routeWithTokenLedger.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/routeWithTokenLedger.js +0 -103
- package/dist/jupiter-sdk/instructions/saberAddDecimals.d.ts +0 -26
- package/dist/jupiter-sdk/instructions/saberAddDecimals.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/saberAddDecimals.js +0 -81
- package/dist/jupiter-sdk/instructions/saberSwap.d.ts +0 -28
- package/dist/jupiter-sdk/instructions/saberSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/saberSwap.js +0 -87
- package/dist/jupiter-sdk/instructions/senchaSwap.d.ts +0 -28
- package/dist/jupiter-sdk/instructions/senchaSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/senchaSwap.js +0 -90
- package/dist/jupiter-sdk/instructions/serumSwap.d.ts +0 -34
- package/dist/jupiter-sdk/instructions/serumSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/serumSwap.js +0 -122
- package/dist/jupiter-sdk/instructions/setTokenLedger.d.ts +0 -20
- package/dist/jupiter-sdk/instructions/setTokenLedger.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/setTokenLedger.js +0 -46
- package/dist/jupiter-sdk/instructions/sharedAccountsExactOutRoute.d.ts +0 -46
- package/dist/jupiter-sdk/instructions/sharedAccountsExactOutRoute.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/sharedAccountsExactOutRoute.js +0 -120
- package/dist/jupiter-sdk/instructions/sharedAccountsRoute.d.ts +0 -46
- package/dist/jupiter-sdk/instructions/sharedAccountsRoute.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/sharedAccountsRoute.js +0 -120
- package/dist/jupiter-sdk/instructions/sharedAccountsRouteWithTokenLedger.d.ts +0 -45
- package/dist/jupiter-sdk/instructions/sharedAccountsRouteWithTokenLedger.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/sharedAccountsRouteWithTokenLedger.js +0 -126
- package/dist/jupiter-sdk/instructions/stabbleStableSwap.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/stabbleStableSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/stabbleStableSwap.js +0 -101
- package/dist/jupiter-sdk/instructions/stabbleWeightedSwap.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/stabbleWeightedSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/stabbleWeightedSwap.js +0 -101
- package/dist/jupiter-sdk/instructions/stepSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/stepSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/stepSwap.js +0 -98
- package/dist/jupiter-sdk/instructions/symmetrySwap.d.ts +0 -32
- package/dist/jupiter-sdk/instructions/symmetrySwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/symmetrySwap.js +0 -114
- package/dist/jupiter-sdk/instructions/tokenSwap.d.ts +0 -29
- package/dist/jupiter-sdk/instructions/tokenSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/tokenSwap.js +0 -98
- package/dist/jupiter-sdk/instructions/tokenSwapV2.d.ts +0 -33
- package/dist/jupiter-sdk/instructions/tokenSwapV2.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/tokenSwapV2.js +0 -114
- package/dist/jupiter-sdk/instructions/whirlpoolSwap.d.ts +0 -31
- package/dist/jupiter-sdk/instructions/whirlpoolSwap.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/whirlpoolSwap.js +0 -104
- package/dist/jupiter-sdk/instructions/whirlpoolSwapV2.d.ts +0 -35
- package/dist/jupiter-sdk/instructions/whirlpoolSwapV2.d.ts.map +0 -1
- package/dist/jupiter-sdk/instructions/whirlpoolSwapV2.js +0 -119
- package/dist/jupiter-sdk/shared/index.d.ts +0 -54
- package/dist/jupiter-sdk/shared/index.d.ts.map +0 -1
- package/dist/jupiter-sdk/shared/index.js +0 -69
- package/dist/jupiter-sdk/types/accountsType.d.ts +0 -15
- package/dist/jupiter-sdk/types/accountsType.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/accountsType.js +0 -22
- package/dist/jupiter-sdk/types/amountWithSlippage.d.ts +0 -18
- package/dist/jupiter-sdk/types/amountWithSlippage.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/amountWithSlippage.js +0 -17
- package/dist/jupiter-sdk/types/index.d.ts +0 -15
- package/dist/jupiter-sdk/types/index.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/index.js +0 -30
- package/dist/jupiter-sdk/types/remainingAccountsInfo.d.ts +0 -17
- package/dist/jupiter-sdk/types/remainingAccountsInfo.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/remainingAccountsInfo.js +0 -15
- package/dist/jupiter-sdk/types/remainingAccountsSlice.d.ts +0 -19
- package/dist/jupiter-sdk/types/remainingAccountsSlice.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/remainingAccountsSlice.js +0 -18
- package/dist/jupiter-sdk/types/routePlanStep.d.ts +0 -23
- package/dist/jupiter-sdk/types/routePlanStep.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/routePlanStep.js +0 -20
- package/dist/jupiter-sdk/types/side.d.ts +0 -15
- package/dist/jupiter-sdk/types/side.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/side.js +0 -20
- package/dist/jupiter-sdk/types/swap.d.ts +0 -372
- package/dist/jupiter-sdk/types/swap.d.ts.map +0 -1
- package/dist/jupiter-sdk/types/swap.js +0 -188
- package/src/jupiter-sdk/accounts/index.ts +0 -9
- package/src/jupiter-sdk/accounts/tokenLedger.ts +0 -146
- package/src/jupiter-sdk/instructions/aldrinSwap.ts +0 -165
- package/src/jupiter-sdk/instructions/aldrinV2Swap.ts +0 -171
- package/src/jupiter-sdk/instructions/balansolSwap.ts +0 -211
- package/src/jupiter-sdk/instructions/claim.ts +0 -128
- package/src/jupiter-sdk/instructions/claimToken.ts +0 -171
- package/src/jupiter-sdk/instructions/cloneSwap.ts +0 -195
- package/src/jupiter-sdk/instructions/createOpenOrders.ts +0 -148
- package/src/jupiter-sdk/instructions/createProgramOpenOrders.ts +0 -170
- package/src/jupiter-sdk/instructions/createTokenAccount.ts +0 -152
- package/src/jupiter-sdk/instructions/createTokenLedger.ts +0 -128
- package/src/jupiter-sdk/instructions/cremaSwap.ts +0 -193
- package/src/jupiter-sdk/instructions/cropperSwap.ts +0 -174
- package/src/jupiter-sdk/instructions/cykuraSwap.ts +0 -169
- package/src/jupiter-sdk/instructions/deltafiSwap.ts +0 -181
- package/src/jupiter-sdk/instructions/dradexSwap.ts +0 -200
- package/src/jupiter-sdk/instructions/exactOutRoute.ts +0 -208
- package/src/jupiter-sdk/instructions/goosefxSwap.ts +0 -189
- package/src/jupiter-sdk/instructions/goosefxV2Swap.ts +0 -222
- package/src/jupiter-sdk/instructions/heliumTreasuryManagementRedeemV0.ts +0 -169
- package/src/jupiter-sdk/instructions/index.ts +0 -72
- package/src/jupiter-sdk/instructions/invariantSwap.ts +0 -168
- package/src/jupiter-sdk/instructions/lifinitySwap.ts +0 -186
- package/src/jupiter-sdk/instructions/lifinityV2Swap.ts +0 -189
- package/src/jupiter-sdk/instructions/marcoPoloSwap.ts +0 -223
- package/src/jupiter-sdk/instructions/marinadeDeposit.ts +0 -230
- package/src/jupiter-sdk/instructions/marinadeUnstake.ts +0 -182
- package/src/jupiter-sdk/instructions/mercurialSwap.ts +0 -145
- package/src/jupiter-sdk/instructions/meteoraDlmmSwap.ts +0 -193
- package/src/jupiter-sdk/instructions/meteoraSwap.ts +0 -195
- package/src/jupiter-sdk/instructions/moonshotWrappedBuy.ts +0 -201
- package/src/jupiter-sdk/instructions/moonshotWrappedSell.ts +0 -186
- package/src/jupiter-sdk/instructions/obricSwap.ts +0 -178
- package/src/jupiter-sdk/instructions/oneIntroSwap.ts +0 -171
- package/src/jupiter-sdk/instructions/openBookV2Swap.ts +0 -207
- package/src/jupiter-sdk/instructions/perpsAddLiquidity.ts +0 -186
- package/src/jupiter-sdk/instructions/perpsRemoveLiquidity.ts +0 -188
- package/src/jupiter-sdk/instructions/perpsSwap.ts +0 -195
- package/src/jupiter-sdk/instructions/perpsV2AddLiquidity.ts +0 -194
- package/src/jupiter-sdk/instructions/perpsV2RemoveLiquidity.ts +0 -193
- package/src/jupiter-sdk/instructions/perpsV2Swap.ts +0 -207
- package/src/jupiter-sdk/instructions/phoenixSwap.ts +0 -157
- package/src/jupiter-sdk/instructions/pumpdotfunWrappedBuy.ts +0 -209
- package/src/jupiter-sdk/instructions/pumpdotfunWrappedSell.ts +0 -190
- package/src/jupiter-sdk/instructions/raydiumClmmSwap.ts +0 -175
- package/src/jupiter-sdk/instructions/raydiumClmmSwapV2.ts +0 -193
- package/src/jupiter-sdk/instructions/raydiumCpSwap.ts +0 -189
- package/src/jupiter-sdk/instructions/raydiumSwap.ts +0 -211
- package/src/jupiter-sdk/instructions/route.ts +0 -189
- package/src/jupiter-sdk/instructions/routeWithTokenLedger.ts +0 -201
- package/src/jupiter-sdk/instructions/saberAddDecimals.ts +0 -151
- package/src/jupiter-sdk/instructions/saberSwap.ts +0 -156
- package/src/jupiter-sdk/instructions/senchaSwap.ts +0 -159
- package/src/jupiter-sdk/instructions/serumSwap.ts +0 -200
- package/src/jupiter-sdk/instructions/setTokenLedger.ts +0 -106
- package/src/jupiter-sdk/instructions/sharedAccountsExactOutRoute.ts +0 -226
- package/src/jupiter-sdk/instructions/sharedAccountsRoute.ts +0 -225
- package/src/jupiter-sdk/instructions/sharedAccountsRouteWithTokenLedger.ts +0 -231
- package/src/jupiter-sdk/instructions/stabbleStableSwap.ts +0 -176
- package/src/jupiter-sdk/instructions/stabbleWeightedSwap.ts +0 -178
- package/src/jupiter-sdk/instructions/stepSwap.ts +0 -168
- package/src/jupiter-sdk/instructions/symmetrySwap.ts +0 -187
- package/src/jupiter-sdk/instructions/tokenSwap.ts +0 -168
- package/src/jupiter-sdk/instructions/tokenSwapV2.ts +0 -185
- package/src/jupiter-sdk/instructions/whirlpoolSwap.ts +0 -179
- package/src/jupiter-sdk/instructions/whirlpoolSwapV2.ts +0 -194
- package/src/jupiter-sdk/shared/index.ts +0 -117
- package/src/jupiter-sdk/types/accountsType.ts +0 -25
- package/src/jupiter-sdk/types/amountWithSlippage.ts +0 -34
- package/src/jupiter-sdk/types/index.ts +0 -15
- package/src/jupiter-sdk/types/remainingAccountsInfo.ts +0 -34
- package/src/jupiter-sdk/types/remainingAccountsSlice.ts +0 -33
- package/src/jupiter-sdk/types/routePlanStep.ts +0 -39
- package/src/jupiter-sdk/types/side.ts +0 -23
- package/src/jupiter-sdk/types/swap.ts +0 -566
@@ -3,11 +3,11 @@ import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { Signer, TransactionBuilder } from "@metaplex-foundation/umi";
|
4
4
|
import { WalletAdapter } from "@metaplex-foundation/umi-signer-wallet-adapters";
|
5
5
|
import { DCASettings, DCASettingsInpArgs, LendingPlatform, PositionState, SolautoActionArgs, SolautoPosition, SolautoRebalanceTypeArgs, SolautoSettingsParameters, SolautoSettingsParametersInpArgs, UpdatePositionDataArgs } from "../generated";
|
6
|
-
import { JupSwapDetails } from "../utils/jupiterUtils";
|
7
6
|
import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
|
8
7
|
import { LivePositionUpdates } from "../utils/solauto/generalUtils";
|
9
8
|
import { ReferralStateManager } from "./referralStateManager";
|
10
9
|
import { TxHandler } from "./txHandler";
|
10
|
+
import { QuoteResponse } from "@jup-ag/api";
|
11
11
|
export interface SolautoClientArgs {
|
12
12
|
authority?: PublicKey;
|
13
13
|
positionId?: number;
|
@@ -44,6 +44,7 @@ export declare abstract class SolautoClient extends TxHandler {
|
|
44
44
|
livePositionUpdates: LivePositionUpdates;
|
45
45
|
constructor(heliusApiUrl: string, localTest?: boolean);
|
46
46
|
initialize(args: SolautoClientArgs, lendingPlatform: LendingPlatform): Promise<void>;
|
47
|
+
setReferredBy(referredBy: PublicKey): void;
|
47
48
|
resetLiveTxUpdates(success?: boolean): Promise<void>;
|
48
49
|
abstract protocolAccount(): PublicKey;
|
49
50
|
defaultLookupTables(): string[];
|
@@ -64,7 +65,7 @@ export declare abstract class SolautoClient extends TxHandler {
|
|
64
65
|
protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
|
65
66
|
abstract flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
|
66
67
|
abstract flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
|
67
|
-
abstract rebalance(rebalanceStep: "A" | "B",
|
68
|
+
abstract rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number): TransactionBuilder;
|
68
69
|
getFreshPositionState(): Promise<PositionState | undefined>;
|
69
70
|
}
|
70
71
|
//# 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,EAOnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe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5E;IAyDD,uBAAuB,IAAI,yBAAyB,GAAG,SAAS;IAOhE,wBAAwB,IAAI,WAAW,GAAG,SAAS;IAO7C,wBAAwB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAOvE,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IA0BrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IAwDlE,eAAe,IAAI,kBAAkB;IAYrC,WAAW,IAAI,kBAAkB;IAgCjC,QAAQ,CAAC,OAAO,IAAI,kBAAkB;IAEtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
|
@@ -60,14 +60,33 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
60
60
|
signer: args.signer,
|
61
61
|
wallet: args.wallet,
|
62
62
|
});
|
63
|
+
if (args.referredByAuthority) {
|
64
|
+
this.setReferredBy(args.referredByAuthority);
|
65
|
+
}
|
66
|
+
this.solautoFeesWallet = generalAccounts_1.SOLAUTO_FEES_WALLET;
|
67
|
+
this.solautoFeesSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoFeesWallet, this.supplyMint);
|
68
|
+
const authorityReferralStateData = this.referralStateManager.referralStateData;
|
69
|
+
this.authorityLutAddress =
|
70
|
+
authorityReferralStateData?.lookupTable &&
|
71
|
+
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(authorityReferralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
|
72
|
+
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(authorityReferralStateData.lookupTable)
|
73
|
+
: undefined;
|
74
|
+
this.log("Position state: ", this.solautoPositionState);
|
75
|
+
this.log("Position settings: ", this.solautoPositionData?.position?.settingParams);
|
76
|
+
this.log("Position DCA: ", (this.solautoPositionData?.position?.dca?.automation?.targetPeriods ??
|
77
|
+
0) > 0
|
78
|
+
? this.solautoPositionData?.position?.dca
|
79
|
+
: undefined);
|
80
|
+
}
|
81
|
+
setReferredBy(referredBy) {
|
63
82
|
const authorityReferralStateData = this.referralStateManager.referralStateData;
|
64
83
|
const hasReferredBy = authorityReferralStateData &&
|
65
84
|
authorityReferralStateData.referredByState !==
|
66
85
|
(0, umi_1.publicKey)(web3_js_1.PublicKey.default);
|
67
86
|
const referredByAuthority = !hasReferredBy &&
|
68
|
-
|
69
|
-
!
|
70
|
-
?
|
87
|
+
referredBy &&
|
88
|
+
!referredBy.equals((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey))
|
89
|
+
? referredBy
|
71
90
|
: undefined;
|
72
91
|
this.referredByState = hasReferredBy
|
73
92
|
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(authorityReferralStateData.referredByState)
|
@@ -78,19 +97,6 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
78
97
|
if (this.referredByState !== undefined) {
|
79
98
|
this.referredBySupplyTa = (0, accountUtils_1.getTokenAccount)(this.referredByState, this.supplyMint);
|
80
99
|
}
|
81
|
-
this.solautoFeesWallet = generalAccounts_1.SOLAUTO_FEES_WALLET;
|
82
|
-
this.solautoFeesSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoFeesWallet, this.supplyMint);
|
83
|
-
this.authorityLutAddress =
|
84
|
-
authorityReferralStateData?.lookupTable &&
|
85
|
-
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(authorityReferralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
|
86
|
-
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(authorityReferralStateData.lookupTable)
|
87
|
-
: undefined;
|
88
|
-
this.log("Position state: ", this.solautoPositionState);
|
89
|
-
this.log("Position settings: ", this.solautoPositionData?.position?.settingParams);
|
90
|
-
this.log("Position DCA: ", (this.solautoPositionData?.position?.dca?.automation?.targetPeriods ??
|
91
|
-
0) > 0
|
92
|
-
? this.solautoPositionData?.position?.dca
|
93
|
-
: undefined);
|
94
100
|
}
|
95
101
|
async resetLiveTxUpdates(success) {
|
96
102
|
if (success) {
|
@@ -200,7 +206,7 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
200
206
|
type: "dcaInBalance",
|
201
207
|
value: {
|
202
208
|
amount: BigInt(dca.dcaInBaseUnit),
|
203
|
-
tokenType: dca.tokenType
|
209
|
+
tokenType: dca.tokenType,
|
204
210
|
},
|
205
211
|
});
|
206
212
|
}
|
@@ -241,7 +247,7 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
241
247
|
type: "dcaInBalance",
|
242
248
|
value: {
|
243
249
|
amount: BigInt(args.dca.value.dcaInBaseUnit),
|
244
|
-
tokenType: args.dca.value.tokenType
|
250
|
+
tokenType: args.dca.value.tokenType,
|
245
251
|
},
|
246
252
|
});
|
247
253
|
addingToPos = true;
|
@@ -4,8 +4,8 @@ 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 { JupSwapDetails } from "../utils/jupiterUtils";
|
8
7
|
import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
|
8
|
+
import { QuoteResponse } from "@jup-ag/api";
|
9
9
|
export interface SolautoMarginfiClientArgs extends SolautoClientArgs {
|
10
10
|
marginfiAccount?: PublicKey | Signer;
|
11
11
|
marginfiAccountSeedIdx?: bigint;
|
@@ -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",
|
41
|
+
rebalance(rebalanceStep: "A" | "B", jupQuote: QuoteResponse, rebalanceType: SolautoRebalanceTypeArgs, 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;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"solautoMarginfiClient.d.ts","s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AI,EAAE,yBAAyB;IAmE1C,8BAA8B;IA0CpC,eAAe,IAAI,SAAS;IAI5B,mBAAmB,IAAI,MAAM,EAAE;IAI/B,gBAAgB,IAAI,SAAS,EAAE;IAUzB,wBAAwB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAyBvE,yBAAyB,IAAI,kBAAkB;IAS/C,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA+C9B,OAAO,IAAI,kBAAkB;IAc7B,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUhE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAgErB,WAAW,CACT,gBAAgB,EAAE,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;CA4ClE"}
|
@@ -37,9 +37,11 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
37
37
|
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.marginfiAccount.publicKey)
|
38
38
|
: this.marginfiAccount;
|
39
39
|
const marginfiAccountData = await (0, marginfi_sdk_1.safeFetchMarginfiAccount)(this.umi, (0, umi_1.publicKey)(this.marginfiAccountPk), { commitment: "confirmed" });
|
40
|
-
this.marginfiGroup = marginfiAccountData
|
41
|
-
?
|
42
|
-
: args.marginfiGroup ??
|
40
|
+
this.marginfiGroup = new web3_js_1.PublicKey(marginfiAccountData
|
41
|
+
? marginfiAccountData.group.toString()
|
42
|
+
: args.marginfiGroup ??
|
43
|
+
marginfiAccounts_1.MARGINFI_ACCOUNTS[this.supplyMint.toString()].marginfiGroup ??
|
44
|
+
marginfiAccounts_1.DEFAULT_MARGINFI_GROUP);
|
43
45
|
this.marginfiSupplyAccounts =
|
44
46
|
marginfiAccounts_1.MARGINFI_ACCOUNTS[this.supplyMint.toString()];
|
45
47
|
this.marginfiDebtAccounts = marginfiAccounts_1.MARGINFI_ACCOUNTS[this.debtMint.toString()];
|
@@ -289,9 +291,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
289
291
|
solautoAction: args,
|
290
292
|
});
|
291
293
|
}
|
292
|
-
rebalance(rebalanceStep,
|
293
|
-
const inputIsSupply =
|
294
|
-
const outputIsSupply =
|
294
|
+
rebalance(rebalanceStep, jupQuote, rebalanceType, flashLoan, targetLiqUtilizationRateBps) {
|
295
|
+
const inputIsSupply = (new web3_js_1.PublicKey(jupQuote.inputMint)).equals(this.supplyMint);
|
296
|
+
const outputIsSupply = (new web3_js_1.PublicKey(jupQuote.outputMint)).equals(this.supplyMint);
|
295
297
|
const needSupplyAccounts = (inputIsSupply && rebalanceStep === "A") ||
|
296
298
|
(outputIsSupply && rebalanceStep === "B") ||
|
297
299
|
(inputIsSupply && flashLoan !== undefined && rebalanceStep == "B");
|
@@ -311,7 +313,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
311
313
|
solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
|
312
314
|
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
313
315
|
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
314
|
-
intermediaryTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey),
|
316
|
+
intermediaryTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), new web3_js_1.PublicKey(jupQuote.inputMint))),
|
315
317
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.bank),
|
316
318
|
supplyPriceOracle: (0, umi_1.publicKey)(this.supplyPriceOracle),
|
317
319
|
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
@@ -334,7 +336,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
334
336
|
: undefined,
|
335
337
|
rebalanceType,
|
336
338
|
targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
|
337
|
-
targetInAmountBaseUnit: rebalanceStep === "A" ?
|
339
|
+
targetInAmountBaseUnit: rebalanceStep === "A" ? parseInt(jupQuote.inAmount) : null,
|
338
340
|
});
|
339
341
|
}
|
340
342
|
flashBorrow(flashLoanDetails, destinationTokenAccount) {
|
@@ -433,7 +435,11 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
433
435
|
if (state) {
|
434
436
|
return state;
|
435
437
|
}
|
436
|
-
const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, !this.selfManaged && this.solautoPositionData === null
|
438
|
+
const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, !this.selfManaged && this.solautoPositionData === null
|
439
|
+
? this.supplyMint
|
440
|
+
: undefined, !this.selfManaged && this.solautoPositionData === null
|
441
|
+
? this.debtMint
|
442
|
+
: undefined, this.livePositionUpdates);
|
437
443
|
if (freshState) {
|
438
444
|
this.log("Fresh state", freshState);
|
439
445
|
const supplyPrice = (0, generalUtils_1.safeGetPrice)(freshState?.supply.mint);
|
@@ -7,8 +7,7 @@
|
|
7
7
|
*/
|
8
8
|
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
9
9
|
export declare enum LendingPlatform {
|
10
|
-
Marginfi = 0
|
11
|
-
Kamino = 1
|
10
|
+
Marginfi = 0
|
12
11
|
}
|
13
12
|
export type LendingPlatformArgs = LendingPlatform;
|
14
13
|
export declare function getLendingPlatformSerializer(): Serializer<LendingPlatformArgs, LendingPlatform>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lendingPlatform.d.ts","sourceRoot":"","sources":["../../../src/generated/types/lendingPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,eAAe;IACzB,QAAQ,IAAA;
|
1
|
+
{"version":3,"file":"lendingPlatform.d.ts","sourceRoot":"","sources":["../../../src/generated/types/lendingPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,eAAe;IACzB,QAAQ,IAAA;CACT;AAED,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAElD,wBAAgB,4BAA4B,IAAI,UAAU,CACxD,mBAAmB,EACnB,eAAe,CAChB,CAIA"}
|
@@ -13,7 +13,6 @@ const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
|
13
13
|
var LendingPlatform;
|
14
14
|
(function (LendingPlatform) {
|
15
15
|
LendingPlatform[LendingPlatform["Marginfi"] = 0] = "Marginfi";
|
16
|
-
LendingPlatform[LendingPlatform["Kamino"] = 1] = "Kamino";
|
17
16
|
})(LendingPlatform || (exports.LendingPlatform = LendingPlatform = {}));
|
18
17
|
function getLendingPlatformSerializer() {
|
19
18
|
return (0, serializers_1.scalarEnum)(LendingPlatform, {
|
@@ -5,10 +5,6 @@
|
|
5
5
|
*
|
6
6
|
* @see https://github.com/metaplex-foundation/kinobi
|
7
7
|
*/
|
8
|
-
export * from './accounts';
|
9
8
|
export * from './errors';
|
10
|
-
export * from './instructions';
|
11
9
|
export * from './programs';
|
12
|
-
export * from './shared';
|
13
|
-
export * from './types';
|
14
10
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jupiter-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jupiter-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
@@ -21,9 +21,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
22
22
|
};
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
24
|
-
__exportStar(require("./accounts"), exports);
|
25
24
|
__exportStar(require("./errors"), exports);
|
26
|
-
__exportStar(require("./instructions"), exports);
|
27
25
|
__exportStar(require("./programs"), exports);
|
28
|
-
__exportStar(require("./shared"), exports);
|
29
|
-
__exportStar(require("./types"), exports);
|
@@ -67,7 +67,7 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
67
67
|
!(await (0, generalUtils_1.getSolanaAccountCreated)(client.umi, client.marginfiAccountPk))) {
|
68
68
|
chores = chores.add(client.marginfiAccountInitialize());
|
69
69
|
}
|
70
|
-
// TODO:
|
70
|
+
// TODO: PF
|
71
71
|
}
|
72
72
|
const wSolUsage = getWSolUsage(client, solautoActions, initiatingDcaIn, undefined);
|
73
73
|
if (wSolUsage !== undefined) {
|
@@ -308,7 +308,7 @@ function getSolautoActions(tx) {
|
|
308
308
|
}
|
309
309
|
catch { }
|
310
310
|
}
|
311
|
-
// TODO
|
311
|
+
// TODO: PF
|
312
312
|
});
|
313
313
|
return solautoActions;
|
314
314
|
}
|
@@ -340,8 +340,8 @@ function requiresRefreshBeforeRebalance(client) {
|
|
340
340
|
oldSupply;
|
341
341
|
const debtDiff = (client.solautoPositionState?.debt.amountUsed.baseUnit ?? BigInt(0)) -
|
342
342
|
oldDebt;
|
343
|
-
if (Math.abs(Number(supplyDiff)) / Number(oldSupply) >= 0.
|
344
|
-
Math.abs(Number(debtDiff)) / Number(oldDebt) >= 0.
|
343
|
+
if (Math.abs(Number(supplyDiff)) / Number(oldSupply) >= 0.005 ||
|
344
|
+
Math.abs(Number(debtDiff)) / Number(oldDebt) >= 0.005) {
|
345
345
|
return true;
|
346
346
|
}
|
347
347
|
}
|
@@ -378,11 +378,11 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
|
|
378
378
|
client.flashBorrow(flashLoan, (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), swapDetails.inputMint)),
|
379
379
|
...(addFirstRebalance
|
380
380
|
? [
|
381
|
-
client.rebalance("A",
|
381
|
+
client.rebalance("A", jupQuote, rebalanceType, flashLoan, targetLiqUtilizationRateBps),
|
382
382
|
]
|
383
383
|
: []),
|
384
384
|
swapIx,
|
385
|
-
client.rebalance("B",
|
385
|
+
client.rebalance("B", jupQuote, rebalanceType, flashLoan, targetLiqUtilizationRateBps),
|
386
386
|
client.flashRepay(flashLoan),
|
387
387
|
]);
|
388
388
|
}
|
@@ -391,9 +391,9 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
|
|
391
391
|
tx = tx.add([
|
392
392
|
setupInstructions,
|
393
393
|
tokenLedgerIx,
|
394
|
-
client.rebalance("A",
|
394
|
+
client.rebalance("A", jupQuote, rebalanceType, undefined, targetLiqUtilizationRateBps),
|
395
395
|
swapIx,
|
396
|
-
client.rebalance("B",
|
396
|
+
client.rebalance("B", jupQuote, rebalanceType, undefined, targetLiqUtilizationRateBps),
|
397
397
|
]);
|
398
398
|
}
|
399
399
|
return {
|
package/dist/types/accounts.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAKL,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAU3E;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;IACN,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,IAAI,EAAE;IACJ,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,WAAW,CAAC,EAAE,MA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,CAAC;CACpB,EACD,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA+D3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CACR;IAAE,eAAe,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,EAAE,CAC/E,CAwDA;AAgED,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,SAAS,EAC5B,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,SAAS,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAkKpC;AA+DD,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyB3B"}
|
@@ -180,6 +180,10 @@ async function getMarginfiAccountPositionState(umi, marginfiAccountPk, supplyMin
|
|
180
180
|
if (supplyBank === null) {
|
181
181
|
return undefined;
|
182
182
|
}
|
183
|
+
if (!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(supplyBank.group).equals(new web3_js_1.PublicKey(marginfiAccounts_1.DEFAULT_MARGINFI_GROUP))) {
|
184
|
+
// Temporarily disabled for now
|
185
|
+
return undefined;
|
186
|
+
}
|
183
187
|
if (!supplyUsage) {
|
184
188
|
supplyUsage = await getTokenUsage(umi, supplyBank, true, 0, livePositionUpdates?.supplyAdjustment);
|
185
189
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,gCAAgC,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAC;KAAE,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;CAAE,CAAC;AAEjD,qBAAa,mBAAmB;IACvB,gBAAgB,SAAa;IAC7B,cAAc,SAAa;IAC3B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAC/C,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAC;KAAE,CAAa;IACrE,aAAa,EAAE,SAAS,GAAG,SAAS,CAAa;IAExD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IA6B9B,KAAK;IASL,UAAU,IAAI,OAAO;CAStB"}
|
package/package.json
CHANGED
@@ -53,6 +53,7 @@ import { currentUnixSeconds } from "../utils/generalUtils";
|
|
53
53
|
import { LivePositionUpdates } from "../utils/solauto/generalUtils";
|
54
54
|
import { ReferralStateManager } from "./referralStateManager";
|
55
55
|
import { TxHandler } from "./txHandler";
|
56
|
+
import { QuoteResponse } from "@jup-ag/api";
|
56
57
|
|
57
58
|
export interface SolautoClientArgs {
|
58
59
|
authority?: PublicKey;
|
@@ -102,10 +103,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
102
103
|
|
103
104
|
public livePositionUpdates: LivePositionUpdates = new LivePositionUpdates();
|
104
105
|
|
105
|
-
constructor(
|
106
|
-
heliusApiUrl: string,
|
107
|
-
localTest?: boolean
|
108
|
-
) {
|
106
|
+
constructor(heliusApiUrl: string, localTest?: boolean) {
|
109
107
|
super(heliusApiUrl, localTest);
|
110
108
|
|
111
109
|
this.umi = this.umi.use({
|
@@ -174,29 +172,8 @@ export abstract class SolautoClient extends TxHandler {
|
|
174
172
|
wallet: args.wallet,
|
175
173
|
});
|
176
174
|
|
177
|
-
|
178
|
-
this.
|
179
|
-
const hasReferredBy =
|
180
|
-
authorityReferralStateData &&
|
181
|
-
authorityReferralStateData.referredByState !==
|
182
|
-
publicKey(PublicKey.default);
|
183
|
-
const referredByAuthority =
|
184
|
-
!hasReferredBy &&
|
185
|
-
args.referredByAuthority &&
|
186
|
-
!args.referredByAuthority.equals(toWeb3JsPublicKey(this.signer.publicKey))
|
187
|
-
? args.referredByAuthority
|
188
|
-
: undefined;
|
189
|
-
this.referredByState = hasReferredBy
|
190
|
-
? toWeb3JsPublicKey(authorityReferralStateData!.referredByState)
|
191
|
-
: referredByAuthority
|
192
|
-
? getReferralState(referredByAuthority!)
|
193
|
-
: undefined;
|
194
|
-
this.referredByAuthority = referredByAuthority;
|
195
|
-
if (this.referredByState !== undefined) {
|
196
|
-
this.referredBySupplyTa = getTokenAccount(
|
197
|
-
this.referredByState,
|
198
|
-
this.supplyMint
|
199
|
-
);
|
175
|
+
if (args.referredByAuthority) {
|
176
|
+
this.setReferredBy(args.referredByAuthority);
|
200
177
|
}
|
201
178
|
|
202
179
|
this.solautoFeesWallet = SOLAUTO_FEES_WALLET;
|
@@ -205,6 +182,8 @@ export abstract class SolautoClient extends TxHandler {
|
|
205
182
|
this.supplyMint
|
206
183
|
);
|
207
184
|
|
185
|
+
const authorityReferralStateData =
|
186
|
+
this.referralStateManager.referralStateData;
|
208
187
|
this.authorityLutAddress =
|
209
188
|
authorityReferralStateData?.lookupTable &&
|
210
189
|
!toWeb3JsPublicKey(authorityReferralStateData.lookupTable).equals(
|
@@ -227,6 +206,33 @@ export abstract class SolautoClient extends TxHandler {
|
|
227
206
|
);
|
228
207
|
}
|
229
208
|
|
209
|
+
public setReferredBy(referredBy: PublicKey) {
|
210
|
+
const authorityReferralStateData =
|
211
|
+
this.referralStateManager.referralStateData;
|
212
|
+
const hasReferredBy =
|
213
|
+
authorityReferralStateData &&
|
214
|
+
authorityReferralStateData.referredByState !==
|
215
|
+
publicKey(PublicKey.default);
|
216
|
+
const referredByAuthority =
|
217
|
+
!hasReferredBy &&
|
218
|
+
referredBy &&
|
219
|
+
!referredBy.equals(toWeb3JsPublicKey(this.signer.publicKey))
|
220
|
+
? referredBy
|
221
|
+
: undefined;
|
222
|
+
this.referredByState = hasReferredBy
|
223
|
+
? toWeb3JsPublicKey(authorityReferralStateData!.referredByState)
|
224
|
+
: referredByAuthority
|
225
|
+
? getReferralState(referredByAuthority!)
|
226
|
+
: undefined;
|
227
|
+
this.referredByAuthority = referredByAuthority;
|
228
|
+
if (this.referredByState !== undefined) {
|
229
|
+
this.referredBySupplyTa = getTokenAccount(
|
230
|
+
this.referredByState,
|
231
|
+
this.supplyMint
|
232
|
+
);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
230
236
|
async resetLiveTxUpdates(success?: boolean) {
|
231
237
|
if (success) {
|
232
238
|
if (!this.solautoPositionData) {
|
@@ -377,7 +383,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
377
383
|
type: "dcaInBalance",
|
378
384
|
value: {
|
379
385
|
amount: BigInt(dca.dcaInBaseUnit),
|
380
|
-
tokenType: dca.tokenType
|
386
|
+
tokenType: dca.tokenType,
|
381
387
|
},
|
382
388
|
});
|
383
389
|
}
|
@@ -422,7 +428,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
422
428
|
type: "dcaInBalance",
|
423
429
|
value: {
|
424
430
|
amount: BigInt(args.dca.value.dcaInBaseUnit),
|
425
|
-
tokenType: args.dca.value.tokenType
|
431
|
+
tokenType: args.dca.value.tokenType,
|
426
432
|
},
|
427
433
|
});
|
428
434
|
addingToPos = true;
|
@@ -595,10 +601,10 @@ export abstract class SolautoClient extends TxHandler {
|
|
595
601
|
|
596
602
|
abstract rebalance(
|
597
603
|
rebalanceStep: "A" | "B",
|
598
|
-
|
604
|
+
jupQuote: QuoteResponse,
|
599
605
|
rebalanceType: SolautoRebalanceTypeArgs,
|
600
606
|
flashLoan?: FlashLoanDetails,
|
601
|
-
targetLiqUtilizationRateBps?: number
|
607
|
+
targetLiqUtilizationRateBps?: number
|
602
608
|
): TransactionBuilder;
|
603
609
|
|
604
610
|
async getFreshPositionState(): Promise<PositionState | undefined> {
|
@@ -57,6 +57,7 @@ import {
|
|
57
57
|
} from "../utils/marginfiUtils";
|
58
58
|
import { bytesToI80F48, fromBaseUnit, toBps } from "../utils/numberUtils";
|
59
59
|
import { createFakePositionState } from "../utils";
|
60
|
+
import { QuoteResponse } from "@jup-ag/api";
|
60
61
|
|
61
62
|
export interface SolautoMarginfiClientArgs extends SolautoClientArgs {
|
62
63
|
marginfiAccount?: PublicKey | Signer;
|
@@ -111,9 +112,13 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
111
112
|
publicKey(this.marginfiAccountPk),
|
112
113
|
{ commitment: "confirmed" }
|
113
114
|
);
|
114
|
-
this.marginfiGroup =
|
115
|
-
|
116
|
-
|
115
|
+
this.marginfiGroup = new PublicKey(
|
116
|
+
marginfiAccountData
|
117
|
+
? marginfiAccountData.group.toString()
|
118
|
+
: args.marginfiGroup ??
|
119
|
+
MARGINFI_ACCOUNTS[this.supplyMint.toString()].marginfiGroup ??
|
120
|
+
DEFAULT_MARGINFI_GROUP
|
121
|
+
);
|
117
122
|
|
118
123
|
this.marginfiSupplyAccounts =
|
119
124
|
MARGINFI_ACCOUNTS[this.supplyMint.toString()]!;
|
@@ -449,13 +454,13 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
449
454
|
|
450
455
|
rebalance(
|
451
456
|
rebalanceStep: "A" | "B",
|
452
|
-
|
457
|
+
jupQuote: QuoteResponse,
|
453
458
|
rebalanceType: SolautoRebalanceTypeArgs,
|
454
459
|
flashLoan?: FlashLoanDetails,
|
455
|
-
targetLiqUtilizationRateBps?: number
|
460
|
+
targetLiqUtilizationRateBps?: number
|
456
461
|
): TransactionBuilder {
|
457
|
-
const inputIsSupply =
|
458
|
-
const outputIsSupply =
|
462
|
+
const inputIsSupply = (new PublicKey(jupQuote.inputMint)).equals(this.supplyMint);
|
463
|
+
const outputIsSupply = (new PublicKey(jupQuote.outputMint)).equals(this.supplyMint);
|
459
464
|
const needSupplyAccounts =
|
460
465
|
(inputIsSupply && rebalanceStep === "A") ||
|
461
466
|
(outputIsSupply && rebalanceStep === "B") ||
|
@@ -484,7 +489,7 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
484
489
|
intermediaryTa: publicKey(
|
485
490
|
getTokenAccount(
|
486
491
|
toWeb3JsPublicKey(this.signer.publicKey),
|
487
|
-
|
492
|
+
new PublicKey(jupQuote.inputMint)
|
488
493
|
)
|
489
494
|
),
|
490
495
|
supplyBank: publicKey(this.marginfiSupplyAccounts.bank),
|
@@ -513,7 +518,7 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
513
518
|
: undefined,
|
514
519
|
rebalanceType,
|
515
520
|
targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
|
516
|
-
targetInAmountBaseUnit: rebalanceStep === "A" ?
|
521
|
+
targetInAmountBaseUnit: rebalanceStep === "A" ? parseInt(jupQuote.inAmount) : null,
|
517
522
|
});
|
518
523
|
}
|
519
524
|
|
@@ -649,8 +654,12 @@ export class SolautoMarginfiClient extends SolautoClient {
|
|
649
654
|
const freshState = await getMarginfiAccountPositionState(
|
650
655
|
this.umi,
|
651
656
|
this.marginfiAccountPk,
|
652
|
-
!this.selfManaged && this.solautoPositionData === null
|
653
|
-
|
657
|
+
!this.selfManaged && this.solautoPositionData === null
|
658
|
+
? this.supplyMint
|
659
|
+
: undefined,
|
660
|
+
!this.selfManaged && this.solautoPositionData === null
|
661
|
+
? this.debtMint
|
662
|
+
: undefined,
|
654
663
|
this.livePositionUpdates
|
655
664
|
);
|
656
665
|
|
package/src/jupiter-sdk/index.ts
CHANGED